/* ============================================
   Mini App Builder v2 - Fullscreen Overlay
   ============================================ */
@keyframes spin { to { transform: rotate(360deg); } }

/* === FULLSCREEN OVERLAY === */
/* Hide taskbar when overlay is active (stacking context fix) */
body.ma-overlay-active .taskbar {
  display: none !important;
}

.ma-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  background: #080c18;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* === TOP BAR === */
.ma-topbar {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: rgba(15,23,42,.95);
  border-bottom: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}
.ma-topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.ma-topbar-title {
  font-size: 14px;
  font-weight: 600;
  color: rgba(234,245,255,.9);
  display: flex;
  align-items: center;
  gap: 8px;
}
.ma-topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ma-topbar-btn {
  padding: 6px 14px;
  border-radius: 8px;
  border: none;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  display: flex;
  align-items: center;
  gap: 4px;
}
.ma-topbar-btn.save {
  background: rgba(0,86,179,.42);
  color: #fff;
  border: 1px solid rgba(96,165,250,.45);
}
.ma-topbar-btn.save:hover { background: rgba(0,86,179,.56); }
.ma-topbar-btn.deploy {
  background: linear-gradient(135deg, #0068FF, #00D2FF);
  color: #fff;
}
.ma-topbar-btn.deploy:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,104,255,.3);
}
.ma-topbar-btn.close {
  background: transparent;
  color: rgba(160,180,210,.7);
  font-size: 18px;
  padding: 6px 10px;
}
.ma-topbar-btn.close:hover { color: #fff5f5; background: rgba(153,27,27,.62); }
.ma-dirty-dot {
  width: 8px; height: 8px;
  background: #F59E0B;
  border-radius: 50%;
  display: inline-block;
  animation: maPulse 1.5s infinite;
}
@keyframes maPulse { 0%,100% { opacity:1 } 50% { opacity:.4 } }

/* === MAIN AREA === */
.ma-main {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

/* === LEFT TOOLBAR === */
.ma-toolbar {
  width: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  gap: 2px;
  background: rgba(15,23,42,.7);
  border-right: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}
.ma-tool-btn {
  width: 38px; height: 38px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: rgba(160,180,210,.6);
  font-size: 17px;
  cursor: pointer;
  transition: all .15s;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.ma-tool-btn:hover { background: #334155; color: #f8fafc; }
.ma-tool-btn.active { background: rgba(0,86,179,.42); color: #fff; }
.ma-tool-sep {
  width: 28px; height: 1px;
  background: rgba(255,255,255,.06);
  margin: 6px 0;
}

/* === SLIDE PANEL === */
#ma-panel-container {
  overflow: hidden;
  flex-shrink: 0;
}
.ma-panel {
  width: 300px;
  height: 100%;
  background: rgba(15,23,42,.97);
  backdrop-filter: blur(20px);
  border-right: 1px solid rgba(255,255,255,.06);
  overflow-y: auto;
  padding: 16px;
  flex-shrink: 0;
  animation: maSlideIn .15s ease;
}
@keyframes maSlideIn {
  from { opacity:0; transform:translateX(-12px) }
  to { opacity:1; transform:translateX(0) }
}
.ma-panel::-webkit-scrollbar { width: 3px; }
.ma-panel::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 3px; }
.ma-panel-title {
  font-size: 13px;
  font-weight: 600;
  color: rgba(234,245,255,.9);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* === PHONE AREA === */
.ma-phone-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  overflow: hidden;
}

/* === PHONE DEVICE === */
.ma-phone {
  width: 340px;
  height: calc(100vh - 80px);
  max-height: 700px;
  background: #000;
  border-radius: 38px;
  padding: 8px;
  box-shadow:
    0 0 0 2px #333,
    0 0 0 4px #1a1a1a,
    0 20px 50px rgba(0,0,0,.5),
    inset 0 0 20px rgba(255,255,255,.02);
  position: relative;
  flex-shrink: 0;
}
.ma-phone::before {
  content: '';
  position: absolute;
  top: 8px; left: 50%;
  transform: translateX(-50%);
  width: 120px; height: 22px;
  background: #000;
  border-radius: 0 0 12px 12px;
  z-index: 20;
}
.ma-phone-screen {
  width: 100%; height: 100%;
  background: #f5f5f5;
  border-radius: 30px;
  overflow-x: hidden;
  overflow-y: auto;
  position: relative;
  display: flex;
  flex-direction: column;
}
.ma-phone-screen::-webkit-scrollbar { width: 2px; }
.ma-phone-screen::-webkit-scrollbar-thumb { background: rgba(0,0,0,.12); border-radius: 2px; }

/* === PHONE INTERNALS === */
.ma-statusbar {
  height: 44px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 0 20px 6px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
  z-index: 15;
}
.ma-statusbar-right { display: flex; gap: 4px; align-items: center; font-size: 11px; }

.ma-app-header {
  display: flex;
  align-items: center;
  padding: 6px 14px 8px;
  gap: 8px;
  color: #fff;
  flex-shrink: 0;
}
.ma-app-header-logo {
  width: 28px; height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid rgba(255,255,255,.3);
  cursor: pointer;
}
.ma-app-header-name {
  font-size: 13px;
  font-weight: 600;
  min-width: 20px;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ma-app-header-name[contenteditable] {
  cursor: text;
  border-radius: 3px;
  padding: 1px 4px;
  transition: background .15s;
}
.ma-app-header-name[contenteditable]:hover { background: rgba(255,255,255,.12); }
.ma-app-header-name[contenteditable]:focus { outline: none; background: rgba(255,255,255,.2); }
.ma-app-header-actions {
  display: flex;
  align-items: center;
  gap: 0;
  font-size: 12px;
  opacity: .7;
  background: rgba(0,0,0,.15);
  border-radius: 15px;
  padding: 3px 0;
  flex-shrink: 0;
}
.ma-app-header-actions span {
  padding: 2px 8px;
  line-height: 1;
}
.ma-app-header-actions span:first-child {
  border-right: 1px solid rgba(255,255,255,.2);
}

/* Hero - Banner style like Trung Nguyen */
.ma-hero {
  text-align: center;
  color: #fff;
  min-height: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  background-size: cover;
  background-position: center;
  position: relative;
  cursor: default;
  flex-shrink: 0;
  padding: 12px 14px 14px;
  overflow: hidden;
}
.ma-hero.has-image {
  min-height: 180px;
  justify-content: flex-end;
}
.ma-hero.has-image .ma-hero-logo,
.ma-hero.has-image .ma-hero-title,
.ma-hero.has-image .ma-hero-desc {
  text-shadow: 0 2px 8px rgba(0,0,0,.5);
}
.ma-hero-upload-hint {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  background: rgba(0,0,0,.45);
  color: #fff;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 11px;
  opacity: 0;
  transition: opacity .15s;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 4px;
}
.ma-hero:hover .ma-hero-upload-hint { opacity: 1; }
/* Small camera icon hint on hero */
.ma-hero-edit-hint {
  position: absolute;
  bottom: 8px; right: 8px;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(0,0,0,.5);
  color: #fff;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s;
  backdrop-filter: blur(4px);
  pointer-events: auto;
}
.ma-hero:hover .ma-hero-edit-hint { opacity: 1; }
/* Editable logo in header */
.ma-editable-logo {
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}
.ma-editable-logo:hover {
  transform: scale(1.1);
  box-shadow: 0 0 0 2px rgba(255,255,255,.4);
}
/* Editable app name in header */
.ma-hero-logo {
  width: 48px; height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,.4);
  margin-bottom: 4px;
  background: rgba(255,255,255,.15);
  cursor: pointer;
}
.ma-hero-title {
  font-size: 14px;
  font-weight: 700;
  text-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.ma-hero-title[contenteditable] {
  cursor: text;
  padding: 1px 6px;
  border-radius: 3px;
}
.ma-hero-title[contenteditable]:hover { background: rgba(255,255,255,.12); }
.ma-hero-title[contenteditable]:focus { outline: none; background: rgba(255,255,255,.2); }
.ma-hero-desc {
  font-size: 11px;
  opacity: .85;
  margin-top: 2px;
}
.ma-hero-desc[contenteditable] {
  cursor: text;
  padding: 1px 6px;
  border-radius: 3px;
  min-width: 40px;
  min-height: 14px;
}
.ma-hero-desc[contenteditable]:hover { background: rgba(255,255,255,.12); }
.ma-hero-desc[contenteditable]:focus { outline: none; background: rgba(255,255,255,.2); }

/* OA Bar */
.ma-oa-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #fff;
  border-bottom: 1px solid rgba(0,0,0,.05);
  flex-shrink: 0;
}
.ma-oa-bar-logo {
  width: 30px; height: 30px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
}
.ma-oa-bar-text { flex: 1; font-size: 11px; color: #666; line-height: 1.3; }
.ma-oa-bar-btn {
  padding: 4px 12px;
  border-radius: 14px;
  border: 1.5px solid;
  background: transparent;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

/* Module grid */
.ma-scroll-area {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 4px;
}
.ma-module-grid {
  display: grid;
  gap: 8px;
  padding: 10px;
}
.ma-module-grid.cols-1 { grid-template-columns: 1fr; }
.ma-module-grid.cols-2 { grid-template-columns: repeat(2,1fr); }
.ma-module-grid.cols-3 { grid-template-columns: repeat(3,1fr); }
.ma-module-grid.cols-4 { grid-template-columns: repeat(4,1fr); }
.ma-module-grid.cols-5 { grid-template-columns: repeat(5,1fr); }

/* Module cell: CARD style (cols <= 2) */
.ma-module-cell {
  background: #fff;
  border-radius: 10px;
  overflow: visible;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  cursor: grab;
  transition: all .15s;
  position: relative;
  user-select: none;
}
.ma-module-cell:active { cursor: grabbing; }
.ma-module-cell.selected {
  outline: 2px solid #0068FF;
  outline-offset: 1px;
  transform: scale(.97);
  box-shadow: 0 0 0 3px rgba(0,104,255,.35), 0 4px 16px rgba(0,104,255,.18);
}
.ma-module-cell.selected::after {
  content: '✏️';
  position: absolute;
  top: 4px; right: 4px;
  font-size: 14px;
  background: #0068FF;
  width: 22px; height: 22px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  z-index: 2;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
}
.ma-module-cell.drag-over { outline: 2px dashed #0068FF; background: #f0f7ff; }
.ma-module-cell.dragging { opacity: .35; transform: scale(.96); }
.ma-module-cell .cell-img {
  width: 100%;
  aspect-ratio: 1;
  background: linear-gradient(135deg,#f0f4ff,#e8eeff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  overflow: hidden;
  position: relative;
  border-radius: 10px 10px 0 0;
}
.ma-module-cell .cell-img .cell-img-view {
  width: 100%; height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.ma-module-cell .cell-img .cell-img-view img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.ma-module-cell .cell-img .cell-img-edit {
  position: absolute;
  bottom: 4px; right: 4px;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: rgba(0,0,0,.55);
  color: #fff;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s;
  z-index: 2;
  backdrop-filter: blur(4px);
}
.ma-module-cell .cell-img:hover .cell-img-edit { opacity: 1; }
.ma-module-cell .cell-img img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.ma-module-cell .cell-body { padding: 6px 8px 8px; }
.ma-module-cell .cell-label {
  font-size: 11px;
  font-weight: 500;
  color: #333;
  line-height: 1.3;
  display: inline;
}
.ma-module-cell .cell-label[contenteditable] {
  cursor: text;
  padding: 1px 2px;
  border-radius: 3px;
}
.ma-module-cell .cell-label[contenteditable]:focus { outline: none; background: rgba(0,104,255,.08); }
.ma-module-cell .cell-meta {
  font-size: 9px;
  color: #aaa;
  margin-top: 2px;
}
.ma-module-cell .cell-price {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-top: 3px;
}
.ma-module-cell .cell-price .new-price {
  font-size: 12px;
  font-weight: 700;
  color: #EF4444;
}
.ma-module-cell .cell-price .new-price[contenteditable] {
  cursor: text;
  padding: 0 2px;
  border-radius: 3px;
  min-width: 30px;
}
.ma-module-cell .cell-price .new-price[contenteditable]:hover { background: rgba(239,68,68,.08); }
.ma-module-cell .cell-price .new-price[contenteditable]:focus { outline: none; background: #fee2e2; color: #7f1d1d; }
.ma-module-cell .cell-price .old-price {
  font-size: 10px;
  color: #bbb;
  text-decoration: line-through;
}
.ma-module-cell .cell-price .old-price[contenteditable] {
  cursor: text;
  padding: 0 2px;
  border-radius: 3px;
  min-width: 25px;
  text-decoration: none;
}
.ma-module-cell .cell-price .old-price[contenteditable]:hover { background: rgba(0,0,0,.04); text-decoration: none; }
.ma-module-cell .cell-price .old-price[contenteditable]:focus { outline: none; background: #e5e7eb; color: #111827; text-decoration: none; }
.ma-module-cell .cell-discount {
  position: absolute;
  top: 6px; left: 6px;
  background: #b91c1c;
  color: #fff;
  font-size: 9px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
}
.ma-module-cell .cell-img-upload {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  background: rgba(0,0,0,.4);
  color: #fff;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 10px;
  opacity: 0;
  transition: opacity .12s;
  display: flex;
  align-items: center;
  gap: 3px;
}
.ma-module-cell .cell-img:hover .cell-img-upload { opacity: 1; }
.ma-module-cell .cell-add-btn {
  position: absolute;
  bottom: 6px; right: 6px;
  width: 22px; height: 22px;
  border-radius: 50%;
  border: none;
  background: #0068FF;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.ma-module-cell .cell-img.has-product-img {
  background: #fff;
}
.ma-module-cell .cell-actions {
  position: absolute;
  top: -6px; right: -6px;
  display: flex;
  gap: 3px;
  z-index: 10;
}
.cell-action-btn {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid #fff;
  font-size: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
  transition: transform 0.15s;
}
.cell-action-btn:hover { transform: scale(1.15); }
.cell-action-btn.delete { background: #dc2626; color: #fff; }

/* Module cell: ICON style (cols >= 3) */
.ma-module-cell.icon-style {
  padding: 10px 4px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 64px;
}
.ma-module-cell.icon-style .cell-img {
  width: 32px; height: 32px;
  aspect-ratio: auto;
  background: transparent;
  font-size: 24px;
  border-radius: 8px;
}
.ma-module-cell.icon-style .cell-img img { width: 32px; height: 32px; object-fit: contain; }
.ma-module-cell.icon-style .cell-body { padding: 0; }
.ma-module-cell.icon-style .cell-label {
  font-size: 9px;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.ma-module-cell.icon-style .cell-price,
.ma-module-cell.icon-style .cell-meta,
.ma-module-cell.icon-style .cell-add-btn { display: none; }

/* Add cell */
.ma-add-cell {
  background: #eff6ff;
  border: 1.5px dashed #93c5fd;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  transition: all .15s;
  min-height: 50px;
  color: #1e3a8a;
  font-size: 18px;
}
.ma-add-cell:hover { background: #93c5fd; border-color: #1e40af; color: #172554; }
.ma-add-cell .add-text { font-size: 9px; font-weight: 500; }

/* Bottom tabs */
.ma-bottom-tabs {
  display: flex;
  align-items: center;
  justify-content: space-around;
  height: 50px;
  background: #fff;
  border-top: 1px solid rgba(0,0,0,.06);
  flex-shrink: 0;
  z-index: 12;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.ma-tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 10px;
  color: #999;
  cursor: pointer;
  padding: 6px 12px;
  min-width: 48px;
  min-height: 42px;
  transition: all .15s;
  user-select: none;
  border-radius: 6px;
  justify-content: center;
}
.ma-tab-item:active { transform: scale(.92); }
.ma-tab-item.active { font-weight: 600; }
.ma-tab-item-icon { font-size: 18px; position: relative; }

/* === PANEL FORM CONTROLS === */
.ma-panel-section { margin-bottom: 16px; }
.ma-panel-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: rgba(160,180,210,.5);
  margin-bottom: 8px;
  font-weight: 600;
}
.ma-label {
  display: block;
  font-size: 12px;
  color: rgba(160,180,210,.7);
  margin-bottom: 4px;
  font-weight: 500;
}
.ma-input {
  width: 100%;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid rgba(148,163,184,.28);
  background: rgba(15,23,42,.88);
  color: #f8fafc;
  font-size: 13px;
  transition: border-color .15s;
  box-sizing: border-box;
}
.ma-input:focus { outline: none; border-color: #0068FF; box-shadow: 0 0 0 2px rgba(0,104,255,.12); }
.ma-input::placeholder { color: rgba(160,180,210,.35); }
.ma-textarea { min-height: 50px; resize: vertical; }

/* Color picker */
.ma-color-row { display: flex; gap: 5px; flex-wrap: wrap; }
.ma-color-swatch {
  width: 26px; height: 26px;
  border-radius: 7px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all .12s;
}
.ma-color-swatch:hover { transform: scale(1.15); }
.ma-color-swatch.active { border-color: #fff; box-shadow: 0 0 6px rgba(255,255,255,.3); }
.ma-color-custom { width: 26px; height: 26px; border-radius: 7px; border: none; cursor: pointer; padding: 0; }

/* Column selector */
.ma-col-selector { display: flex; gap: 5px; }
.ma-col-btn {
  flex: 1;
  padding: 7px 3px;
  border-radius: 7px;
  border: 1.5px solid rgba(148,163,184,.35);
  background: #334155;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  text-align: center;
}
.ma-col-btn:hover { border-color: #93c5fd; background: #475569; color: #fff; }
.ma-col-btn.active { border-color: #60a5fa; background: rgba(0,86,179,.42); color: #fff; }

/* Upload */
.ma-upload-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px;
  border-radius: 8px;
  border: 1.5px dashed rgba(255,255,255,.12);
  background: transparent;
  color: #dbe7f5;
  font-size: 12px;
  cursor: pointer;
  transition: all .15s;
  width: 100%;
}
.ma-upload-btn:hover { border-color: #60a5fa; color: #fff; }

/* Asset grid */
.ma-asset-grid {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 6px;
  max-height: 180px;
  overflow-y: auto;
}
.ma-asset-grid::-webkit-scrollbar { width: 3px; }
.ma-asset-grid::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 3px; }
.ma-asset-item {
  aspect-ratio: 1;
  border-radius: 7px;
  border: 2px solid transparent;
  overflow: hidden;
  cursor: pointer;
  transition: all .15s;
  position: relative;
}
.ma-asset-item:hover { border-color: rgba(0,104,255,.5); transform: scale(1.04); }
.ma-asset-item.active { border-color: #0068FF; box-shadow: 0 0 6px rgba(0,104,255,.3); }
.ma-asset-item img { width: 100%; height: 100%; object-fit: cover; }
.ma-asset-item .asset-delete {
  position: absolute; top: 2px; right: 2px;
  width: 15px; height: 15px; border-radius: 50%;
  background: #b91c1c; color: #fff;
  font-size: 8px; border: none; cursor: pointer;
  display: none;
  align-items: center; justify-content: center;
}
.ma-asset-item:hover .asset-delete { display: flex; }

/* Module type library */
.ma-module-types {
  display: grid;
  grid-template-columns: repeat(2,1fr);
  gap: 6px;
}
.ma-module-type-card {
  padding: 8px 6px;
  border-radius: 8px;
  border: 1.5px solid rgba(255,255,255,.06);
  background: rgba(255,255,255,.03);
  cursor: pointer;
  transition: all .15s;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.ma-module-type-card:hover { border-color: rgba(0,104,255,.35); background: rgba(0,104,255,.06); }
.ma-module-type-card .type-icon { font-size: 20px; }
.ma-module-type-card .type-name { font-size: 11px; color: #eef6ff; font-weight: 500; }

/* === TEMPLATE LIBRARY PANEL === */
.ma-tpl-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.ma-tpl-filter-btn {
  padding: 4px 10px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.03);
  color: rgba(160,180,210,.6);
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  transition: all .15s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.ma-tpl-filter-btn:hover {
  border-color: rgba(139,92,246,.35);
  color: rgba(234,245,255,.8);
}
.ma-tpl-filter-btn.active {
  background: rgba(139,92,246,.15);
  border-color: rgba(139,92,246,.4);
  color: #c4b5fd;
}
.ma-tpl-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.ma-tpl-card {
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.06);
  background: rgba(255,255,255,.02);
  cursor: pointer;
  overflow: hidden;
  transition: all .15s;
}
.ma-tpl-card:hover {
  border-color: rgba(139,92,246,.35);
  background: rgba(139,92,246,.04);
  transform: translateY(-1px);
}
.ma-tpl-card-img {
  width: 100%;
  aspect-ratio: 9/16;
  overflow: hidden;
  background: linear-gradient(180deg, #e8eef9, #f8fafc);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
}
.ma-tpl-card-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  border-radius: 18px;
  background: #fff;
}
.ma-tpl-card-body {
  padding: 6px 8px;
}
.ma-tpl-card-name {
  font-size: 11px;
  font-weight: 600;
  color: rgba(234,245,255,.85);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ma-tpl-card-cat {
  font-size: 10px;
  color: rgba(160,180,210,.4);
  margin-top: 2px;
}
.ma-tpl-back {
  background: none;
  border: none;
  color: rgba(160,180,210,.6);
  font-size: 16px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  transition: all .15s;
}
.ma-tpl-back:hover {
  color: #c4b5fd;
  background: rgba(139,92,246,.1);
}
.ma-tpl-detail-img {
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.06);
  background: linear-gradient(180deg, #e8eef9, #f8fafc);
  padding: 12px;
}
.ma-tpl-detail-img img {
  width: 100%;
  aspect-ratio: 9/16;
  object-fit: contain;
  object-position: center;
  border-radius: 18px;
  background: #fff;
}
.ma-tpl-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.ma-tpl-tag {
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(139,92,246,.1);
  border: 1px solid rgba(139,92,246,.2);
  color: #c4b5fd;
  font-size: 10px;
  font-weight: 500;
}
.ma-tpl-features {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ma-tpl-feature-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: rgba(160,180,210,.7);
}
.ma-tpl-apply-btn {
  width: 100%;
  padding: 10px 16px;
  border-radius: 8px;
  border: none;
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all .15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.ma-tpl-apply-btn:hover {
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(139,92,246,.3);
}
.ma-tpl-github-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.03);
  color: rgba(160,180,210,.6);
  font-size: 12px;
  text-decoration: none;
  transition: all .15s;
}
.ma-tpl-github-link:hover {
  border-color: rgba(255,255,255,.15);
  color: rgba(234,245,255,.8);
  background: rgba(255,255,255,.05);
}
/* Template preview on phone */
.ma-tpl-phone-preview {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, #e8eef9, #f8fafc);
}
.ma-tpl-phone-preview > img {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  object-position: center;
}
.ma-tpl-preview-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 16px;
  background: linear-gradient(transparent, rgba(0,0,0,.7));
  display: flex;
  justify-content: center;
}
.ma-tpl-preview-apply {
  padding: 10px 24px;
  border-radius: 20px;
  border: none;
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all .15s;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 16px rgba(139,92,246,.4);
}
.ma-tpl-preview-apply:hover {
  transform: scale(1.03);
  box-shadow: 0 6px 20px rgba(139,92,246,.5);
}

/* Module editor */
.ma-module-editor {
  padding: 12px;
  border-radius: 10px;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.06);
}
.ma-module-editor-title {
  font-size: 13px;
  font-weight: 600;
  color: rgba(234,245,255,.9);
  margin-bottom: 12px;
}
.ma-icon-picker {
  display: grid;
  grid-template-columns: repeat(5,1fr);
  gap: 5px;
  max-height: 140px;
  overflow-y: auto;
}
.ma-icon-option {
  aspect-ratio: 1;
  border-radius: 7px;
  border: 1.5px solid rgba(255,255,255,.06);
  background: rgba(255,255,255,.03);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
  padding: 3px;
}
.ma-icon-option:hover { border-color: rgba(0,104,255,.35); }
.ma-icon-option.active { border-color: #0068FF; background: rgba(0,104,255,.12); }
.ma-icon-option img { width: 22px; height: 22px; object-fit: contain; }

/* Emoji */
.ma-emoji-grid {
  display: grid;
  grid-template-columns: repeat(6,1fr);
  gap: 3px;
  max-height: 110px;
  overflow-y: auto;
}
.ma-emoji-btn {
  padding: 5px;
  border-radius: 6px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 17px;
  transition: background .1s;
}
.ma-emoji-btn:hover { background: rgba(0,104,255,.1); }

/* Panel tabs */
.ma-panel-tabs {
  display: flex;
  gap: 3px;
  margin-bottom: 12px;
  background: rgba(255,255,255,.03);
  border-radius: 8px;
  padding: 3px;
}
.ma-panel-tab {
  flex: 1;
  padding: 5px 6px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: #dbe7f5;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  text-align: center;
}
.ma-panel-tab.active { background: rgba(0,86,179,.42); color: #fff; }

/* Tab editor */
.ma-tab-editor { display: flex; flex-direction: column; gap: 6px; }
.ma-tab-editor-item {
  display: flex; align-items: center; gap: 6px;
  padding: 6px;
  border-radius: 7px;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.05);
}
.ma-tab-editor-item input {
  flex: 1; padding: 3px 6px;
  border-radius: 5px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(15,23,42,.88);
  color: #f8fafc;
  font-size: 12px;
}
.ma-tab-editor-item input:focus { outline: none; border-color: #0068FF; }
.ma-tab-remove {
  width: 20px; height: 20px;
  border-radius: 50%; border: none;
  background: #fee2e2; color: #991b1b;
  font-size: 11px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

/* Deploy */
.ma-deploy-card {
  padding: 14px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.06);
  background: rgba(255,255,255,.03);
  margin-bottom: 10px;
}
.ma-deploy-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 16px;
  font-size: 11px;
  font-weight: 600;
}
.ma-deploy-status.draft { background: #475569; color: #fff; }
.ma-deploy-status.pending_review { background: #b45309; color: #fff; }
.ma-deploy-status.submitted { background: #1d4ed8; color: #fff; }
.ma-deploy-status.approved { background: #047857; color: #fff; }
.ma-deploy-status.rejected { background: #b91c1c; color: #fff; }
.ma-deploy-status.building { background: #6d28d9; color: #fff; }
.ma-deploy-btn {
  width: 100%;
  padding: 10px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg,#0068FF,#00D2FF);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.ma-deploy-btn:hover { box-shadow: 0 4px 16px rgba(0,104,255,.35); }
.ma-deploy-btn:disabled { opacity: .5; cursor: not-allowed; }
.ma-deploy-list { max-height: 180px; overflow-y: auto; }
.ma-deploy-item {
  display: flex; align-items: center; gap: 6px;
  padding: 6px;
  border-bottom: 1px solid rgba(255,255,255,.03);
  font-size: 12px;
}
.ma-deploy-ver { font-weight: 600; color: rgba(234,245,255,.9); }
.ma-deploy-time { color: rgba(160,180,210,.4); font-size: 11px; }

/* Quick-add popup on phone */
.ma-quick-add {
  position: fixed;
  z-index: 10002;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,.25);
  padding: 10px;
  width: 190px;
  max-height: 260px;
  overflow-y: auto;
}
.ma-quick-add-title {
  font-size: 11px;
  font-weight: 600;
  color: #333;
  margin-bottom: 6px;
  padding: 0 4px;
}
.ma-quick-add-item {
  display: flex; align-items: center; gap: 6px;
  padding: 6px;
  border-radius: 7px;
  cursor: pointer;
  transition: background .1s;
  font-size: 12px;
  color: #333;
}
.ma-quick-add-item:hover { background: #f0f7ff; }
.ma-quick-add-item .qi-emoji { font-size: 16px; }
.ma-quick-add-item .qi-label { font-weight: 500; }

/* =============================================
   PHONE E-COMMERCE VIEWS
   ============================================= */

.ma-cart-badge {
  position: absolute;
  top: -6px; right: -8px;
  background: #b91c1c;
  color: #fff;
  font-size: 8px;
  font-weight: 700;
  min-width: 14px;
  height: 14px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}

/* === PRODUCT DETAIL VIEW === */
.ma-pv-scroll {
  flex: 1;
  overflow-y: auto;
  background: #fff;
}
.ma-pv-scroll::-webkit-scrollbar { width: 2px; }
.ma-pv-scroll::-webkit-scrollbar-thumb { background: rgba(0,0,0,.1); border-radius: 2px; }
.ma-pv-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  background: #fafafa;
}
.ma-pv-logo-img {
  width: 36px; height: 36px;
  border-radius: 50%;
  overflow: hidden;
  position: relative;
  cursor: default;
  flex-shrink: 0;
  background: #eee;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ma-pv-logo-img img { width: 100%; height: 100%; object-fit: cover; }
.ma-pv-logo-placeholder { font-size: 18px; }
.ma-pv-logo-edit {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.45);
  color: #fff;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .15s;
  border-radius: 50%;
  cursor: pointer;
  pointer-events: auto;
}
.ma-pv-logo-img:hover .ma-pv-logo-edit { opacity: 1; }
.ma-pv-logo-text {
  font-size: 10px;
  font-weight: 700;
  color: #666;
  letter-spacing: .5px;
  cursor: text;
  padding: 2px 4px;
  border-radius: 4px;
}
.ma-pv-logo-text:hover { background: rgba(0,0,0,.04); }
.ma-pv-logo-text:focus { outline: none; background: rgba(0,104,255,.08); }
.ma-pv-image {
  width: 100%;
  aspect-ratio: 1;
  background: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  cursor: default;
}
.ma-pv-image img { width: 100%; height: 100%; object-fit: contain; }
.ma-pv-image-placeholder { font-size: 60px; }
.ma-pv-image-edit {
  position: absolute;
  bottom: 8px; right: 8px;
  background: rgba(0,0,0,.55);
  color: #fff;
  padding: 4px 10px;
  border-radius: 16px;
  font-size: 11px;
  opacity: 0;
  transition: opacity .15s;
  backdrop-filter: blur(4px);
  cursor: pointer;
  pointer-events: auto;
}
.ma-pv-image:hover .ma-pv-image-edit { opacity: 1; }
.ma-pv-dots {
  display: flex;
  gap: 6px;
  justify-content: center;
  padding: 8px 0;
}
.ma-pv-dots .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #ccc;
}
.ma-pv-dots .dot.active { background: #333; }
.ma-pv-info { padding: 12px 14px 80px; }
.ma-pv-price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.ma-pv-price {
  font-size: 20px;
  font-weight: 700;
  color: #EF4444;
  cursor: text;
  padding: 1px 3px;
  border-radius: 4px;
  min-width: 40px;
}
.ma-pv-price:hover { background: rgba(239,68,68,.06); }
.ma-pv-price:focus { outline: none; background: rgba(239,68,68,.1); }
.ma-pv-share {
  border: 1px solid #ddd;
  background: #fff;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 11px;
  cursor: pointer;
  color: #333;
}
.ma-pv-old-price {
  font-size: 13px;
  color: #999;
  text-decoration: line-through;
  margin-right: 8px;
  cursor: text;
  padding: 1px 3px;
  border-radius: 4px;
  display: inline-block;
  min-width: 30px;
}
.ma-pv-old-price:hover { background: rgba(0,0,0,.04); text-decoration: none; }
.ma-pv-old-price:focus { outline: none; background: rgba(0,0,0,.06); text-decoration: none; }
.ma-pv-discount {
  font-size: 11px;
  color: #EF4444;
  font-weight: 600;
}
.ma-pv-title {
  font-size: 16px;
  font-weight: 700;
  color: #1a1a1a;
  margin: 8px 0 4px;
  line-height: 1.3;
  cursor: text;
  padding: 2px 3px;
  border-radius: 4px;
}
.ma-pv-title:hover { background: rgba(0,0,0,.03); }
.ma-pv-title:focus { outline: none; background: rgba(0,104,255,.06); }
.ma-pv-sold {
  font-size: 11px;
  color: #999;
  margin-bottom: 12px;
}
.ma-pv-desc-heading {
  font-size: 12px;
  font-weight: 700;
  color: #333;
  margin-bottom: 6px;
  padding-top: 8px;
  border-top: 1px solid #eee;
}
.ma-pv-desc {
  font-size: 11px;
  color: #555;
  line-height: 1.6;
  cursor: text;
  padding: 4px 3px;
  border-radius: 4px;
  min-height: 30px;
}
.ma-pv-desc:hover { background: rgba(0,0,0,.02); }
.ma-pv-desc:focus { outline: none; background: rgba(0,104,255,.04); }

/* Product bottom bar */
.ma-pv-bottom {
  display: flex;
  background: #fff;
  border-top: 1px solid #eee;
  flex-shrink: 0;
}
.ma-pv-btn {
  flex: 1;
  padding: 10px 4px;
  border: none;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.ma-pv-btn.cart { background: #f5f5f5; color: #333; }
.ma-pv-btn.home { background: #f5f5f5; color: #333; }
.ma-pv-btn.add { color: #fff; }
.ma-pv-btn.buy { background: #047857; color: #fff; }

/* === CART POPUP (Add to cart overlay) === */
.ma-popup-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 10;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  border-radius: 0 0 30px 30px;
  overflow: hidden;
}
.ma-popup-overlay:has(.ma-addr-popup) {
  align-items: center;
}
.ma-cart-popup {
  width: 100%;
  background: #fff;
  border-radius: 16px 16px 0 0;
  padding: 16px;
  position: relative;
  animation: maSlideUp .2s ease;
}
@keyframes maSlideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.ma-popup-close {
  position: absolute;
  top: 10px; right: 12px;
  background: #eee;
  border: none;
  width: 24px; height: 24px;
  border-radius: 50%;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ma-popup-product {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}
.ma-popup-img {
  width: 60px; height: 60px;
  border-radius: 8px;
  overflow: hidden;
  background: #f5f5f5;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ma-popup-img img { width: 100%; height: 100%; object-fit: cover; }
.ma-popup-info { flex: 1; }
.ma-popup-name {
  font-size: 13px;
  font-weight: 700;
  color: #1a1a1a;
  line-height: 1.3;
  margin-bottom: 2px;
}
.ma-popup-variant-label {
  font-size: 10px;
  color: #999;
}
.ma-popup-section-title {
  font-size: 11px;
  font-weight: 600;
  color: #333;
  margin-bottom: 6px;
}
.ma-popup-variants {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
}
.ma-popup-variant-btn {
  padding: 5px 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #fff;
  font-size: 10px;
  cursor: pointer;
  color: #333;
  transition: all .15s;
}
.ma-popup-variant-btn.active {
  border-color: #0068FF;
  background: #dbeafe;
  color: #1d4ed8;
  font-weight: 600;
}
.ma-popup-qty-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 8px 0;
}
.ma-popup-qty-btn {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 1px solid #ddd;
  background: #f9f9f9;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ma-popup-qty-val {
  width: 28px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: #0068FF;
  border-radius: 5px;
  padding: 2px 0;
}
.ma-popup-price {
  margin-left: auto;
  font-size: 14px;
  font-weight: 700;
  color: #1a1a1a;
}
.ma-popup-add-btn {
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 4px;
}

/* === CART VIEW === */
.ma-cv-scroll {
  flex: 1;
  overflow-y: auto;
  background: #f5f5f5;
  padding: 8px;
}
.ma-cv-scroll::-webkit-scrollbar { width: 2px; }
.ma-cv-scroll::-webkit-scrollbar-thumb { background: rgba(0,0,0,.1); border-radius: 2px; }
.ma-cv-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: #999;
  font-size: 13px;
}
.ma-cv-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: #fff;
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 6px;
  position: relative;
}
.ma-cv-item-check { padding-top: 2px; }
.ma-cv-item-check input { accent-color: #0068FF; }
.ma-cv-item-img {
  width: 60px; height: 60px;
  border-radius: 8px;
  overflow: hidden;
  background: #f5f5f5;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ma-cv-item-img img { width: 100%; height: 100%; object-fit: cover; }
.ma-cv-item-info { flex: 1; min-width: 0; }
.ma-cv-item-name {
  font-size: 12px;
  font-weight: 600;
  color: #1a1a1a;
  line-height: 1.3;
  display: -webkit-box;
  line-clamp: 2;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ma-cv-item-variant {
  font-size: 10px;
  color: #999;
  margin: 2px 0;
}
.ma-cv-item-price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}
.ma-cv-item-price {
  font-size: 13px;
  font-weight: 700;
  color: #1a1a1a;
}
.ma-cv-item-qty {
  display: flex;
  align-items: center;
  gap: 2px;
}
.ma-cv-item-qty button {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1px solid #ddd;
  background: #f9f9f9;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ma-cv-item-qty span {
  min-width: 20px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
}
.ma-cv-item-del {
  position: absolute;
  top: 4px; right: 4px;
  background: none;
  border: none;
  color: #ccc;
  font-size: 12px;
  cursor: pointer;
}
.ma-cv-item-del:hover { color: #EF4444; }

/* Cart footer */
.ma-cv-footer {
  background: #fff;
  padding: 10px 14px;
  border-top: 1px solid #eee;
  flex-shrink: 0;
}
.ma-cv-total {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #333;
}
.ma-cv-total-val {
  font-size: 14px;
  font-weight: 700;
  color: #1a1a1a;
}
.ma-cv-saving {
  font-size: 10px;
  color: #999;
  text-align: right;
  margin-bottom: 6px;
}
.ma-cv-order-btn {
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.ma-cv-order-btn:disabled { opacity: .5; cursor: not-allowed; }

/* === ORDER FORM VIEW === */
.ma-ov-scroll {
  flex: 1;
  overflow-y: auto;
  background: #f0ebe4;
  padding: 12px;
}
.ma-ov-scroll::-webkit-scrollbar { width: 2px; }
.ma-ov-scroll::-webkit-scrollbar-thumb { background: rgba(0,0,0,.1); border-radius: 2px; }
.ma-ov-card {
  background: #fff;
  border-radius: 16px;
  padding: 20px 16px;
  box-shadow: 0 2px 12px rgba(0,0,0,.06);
}
.ma-ov-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
}
.ma-ov-logo img {
  width: 70px; height: 70px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(0,0,0,.08);
}
.ma-ov-heading {
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 4px;
}
.ma-ov-sub {
  text-align: center;
  font-size: 11px;
  color: #888;
  margin-bottom: 16px;
  line-height: 1.5;
}
.ma-ov-field {
  margin-bottom: 12px;
}
.ma-ov-field label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #333;
  margin-bottom: 4px;
}
.ma-ov-field input, .ma-ov-select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 10px;
  font-size: 12px;
  color: #333;
  background: #fafafa;
  box-sizing: border-box;
}
.ma-ov-field input:focus, .ma-ov-select:focus {
  outline: none;
  border-color: #0068FF;
}
.ma-ov-address-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 2px dashed #c9a87e;
  border-radius: 12px;
  cursor: pointer;
}
.ma-ov-address-plus {
  font-size: 18px;
  font-weight: 700;
  color: #333;
}
.ma-ov-payment {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 10px;
  font-size: 12px;
  color: #666;
}
.ma-ov-payment-cod {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
  cursor: default;
}
.ma-ov-payment span:last-child { margin-left: auto; font-size: 16px; color: #ccc; }
.ma-ov-submit {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 12px;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 8px;
  opacity: .85;
}
.ma-ov-submit:hover { opacity: 1; }

/* Field hint (auto from Zalo) */
.ma-ov-field-hint {
  font-size: 9px;
  color: #0068FF;
  margin-top: 3px;
  opacity: .7;
}

/* Saved address display */
.ma-ov-address-saved {
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 10px;
  background: #fafafa;
  position: relative;
}
.ma-ov-addr-name {
  font-size: 12px;
  font-weight: 600;
  color: #333;
  margin-bottom: 2px;
}
.ma-ov-addr-detail {
  font-size: 11px;
  color: #666;
  line-height: 1.4;
}
.ma-ov-addr-change {
  position: absolute;
  top: 8px; right: 8px;
  background: none;
  border: none;
  color: #0068FF;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

/* Address popup */
.ma-addr-popup {
  width: 90%;
  max-width: 320px;
  max-height: 85%;
  background: #fff;
  border-radius: 16px;
  padding: 18px 16px;
  position: relative;
  animation: maSlideUp .2s ease;
  overflow-y: auto;
}
.ma-addr-popup::-webkit-scrollbar { width: 2px; }
.ma-addr-popup::-webkit-scrollbar-thumb { background: rgba(0,0,0,.1); border-radius: 2px; }
.ma-addr-title {
  font-size: 14px;
  font-weight: 700;
  color: #333;
  text-align: center;
  margin: 0 0 14px;
}
.ma-addr-field {
  margin-bottom: 10px;
}
.ma-addr-field label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #555;
  margin-bottom: 3px;
}
.ma-addr-field input, .ma-addr-field select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 12px;
  color: #333;
  background: #fafafa;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
}
.ma-addr-field select {
  background: #fafafa url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23999'/%3E%3C/svg%3E") no-repeat right 10px center;
  padding-right: 28px;
}
.ma-addr-field input:focus, .ma-addr-field select:focus {
  outline: none;
  border-color: #0068FF;
}
.ma-addr-default {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #555;
  margin: 8px 0 12px;
  cursor: pointer;
}
.ma-addr-default input { accent-color: #0068FF; }
.ma-addr-submit {
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

/* =============================================
   ZALO COMPLIANCE: Loading bar (Design Guidelines)
   "Cơ chế hiển thị tải trang dạng quá trình"
   ============================================= */
.ma-loading-bar {
  position: absolute;
  top: 44px;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, #0068FF 50%, transparent 100%);
  z-index: 100;
  animation: ma-loading-slide .8s ease-in-out;
  pointer-events: none;
}
@keyframes ma-loading-slide {
  0% { transform: translateX(-100%); opacity: 1; }
  80% { transform: translateX(0); opacity: 1; }
  100% { transform: translateX(0); opacity: 0; }
}

/* =============================================
   ZALO COMPLIANCE: Order success result page
   "Phản hồi về kết quả - dạng trang kết quả"
   ============================================= */
.ma-success-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px 20px;
  text-align: center;
}
.ma-success-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #15803d;
  color: #fff;
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  box-shadow: 0 4px 12px rgba(34,197,94,.3);
}
.ma-success-title {
  font-size: 18px;
  font-weight: 700;
  color: #1a1a1a;
  margin: 0 0 8px;
}
.ma-success-desc {
  font-size: 13px;
  color: #666;
  margin: 0 0 24px;
  line-height: 1.5;
}
.ma-success-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 220px;
}
.ma-success-btn {
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all .15s;
}
.ma-success-btn.primary {
  background: #0058dd;
  color: #fff;
}
.ma-success-btn.secondary {
  background: #f5f5f5;
  color: #333;
  border: 1px solid #e5e5e5;
}
.ma-success-btn:active { transform: scale(.96); }

/* =============================================
   ZALO COMPLIANCE: Privacy consent in order form
   ============================================= */
.ma-ov-consent {
  margin: 8px 0 12px;
  padding: 8px 10px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #e9ecef;
}
.ma-ov-consent a { text-decoration: underline; }

/* =============================================
   ZALO COMPLIANCE: Deploy compliance checklist
   ============================================= */
.ma-compliance-checklist {
  padding: 10px 12px;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 8px;
  margin-bottom: 8px;
}

/* =============================================
   ZALO COMPLIANCE: Back button (7-9mm touch target)
   "giữ nút trở lại ở góc trên bên trái"
   ============================================= */
.ma-back-btn {
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  font-weight: 700;
  min-width: 32px;
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: background .15s;
}
.ma-back-btn:active {
  background: rgba(255,255,255,.15);
}

/* =============================================
   ZALO COMPLIANCE: Font color system
   NL300=main, NL700=secondary, NL500=body,
   BL300=links, GL300=success, OL300=warning, RL300=error
   ============================================= */
.ma-phone-screen .ma-pv-title,
.ma-phone-screen .ma-cv-item-name { color: #353535; }
.ma-phone-screen .ma-pv-sold,
.ma-phone-screen .ma-cv-item-variant,
.ma-phone-screen .ma-ov-sub { color: #8c8c8c; }
.ma-phone-screen .ma-pv-desc { color: #595959; line-height: 1.6; }
.ma-phone-screen .ma-pv-share { color: #1677FF; }
.ma-phone-screen .ma-pv-discount { color: #FA541C; }

/* =============================================
   INLINE VALIDATION WARNINGS
   ============================================= */
/* (moved to bottom - Gift Link Builder section) */

/* Inline field hint (guidelines/specs) */
.ma-field-hint {
  font-size: 10px;
  color: rgba(160, 180, 210, 0.4);
  margin: 2px 0 6px 0;
  line-height: 1.5;
}
/* Character counter in labels */
.ma-char-count {
  font-weight: 400;
  font-size: 9px;
  color: rgba(160, 180, 210, 0.35);
  margin-left: 4px;
}
.ma-input-warn {
  border-color: #ff7a45 !important;
  box-shadow: 0 0 0 2px rgba(255, 122, 69, 0.15) !important;
}
.ma-panel-warn-box {
  background: #fff7e6;
  border: 1px solid #ffd591;
  border-radius: 6px;
  padding: 8px 12px;
  margin-bottom: 12px;
  font-size: 12px;
  color: #ad4e00;
  line-height: 1.5;
}
.ma-panel-warn-box .ma-field-warn {
  color: #ad4e00;
  margin: 3px 0;
}

/* Warning badges on toolbar buttons */
.ma-tool-warn {
  display: none;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  background: #991b1b;
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 0 4px;
  position: absolute;
  top: 2px;
  right: 2px;
  line-height: 1;
}
/* Rules topbar button */
.ma-topbar-btn.rules {
  background: rgba(51,65,85,.92);
  border: 1px solid rgba(148,163,184,.28);
  color: #fff;
  font-weight: 500;
}
.ma-topbar-btn.rules:hover {
  background: rgba(71,85,105,.96);
}

/* =============================================
   RULES MODAL
   ============================================= */
.ma-rules-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.55);
  z-index: 10020;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: maFadeIn 0.2s;
}
.ma-rules-modal.v2 {
  background: #fff;
  border-radius: 14px;
  width: 620px;
  max-width: 94vw;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 16px 48px rgba(0,0,0,0.25);
  animation: maSlideUp 0.25s;
}
@keyframes maSlideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
@keyframes maFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.ma-rules-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid #f0f0f0;
}
.ma-rules-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: #1a1a2e;
  display: flex; align-items: center; gap: 6px;
}
.ma-rules-header h3 i { color: #0068ff; font-size: 18px; }
.ma-rules-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: #999;
  padding: 4px 8px;
  border-radius: 4px;
}
.ma-rules-close:hover { background: #f5f5f5; color: #333; }

/* Status bar */
.ma-rules-status {
  padding: 8px 20px;
  font-size: 13px;
  font-weight: 500;
  display: flex; align-items: center; gap: 6px;
  border-bottom: 1px solid #f0f0f0;
}
.ma-rules-status.ok { background: #f6ffed; color: #389e0d; }
.ma-rules-status.warn { background: #fffbe6; color: #d48806; }
.ma-rules-status.error { background: #fff2f0; color: #cf1322; }
.ma-rules-status i { font-size: 16px; }

/* Tabs */
.ma-rules-tabs {
  display: flex;
  gap: 2px;
  padding: 8px 12px 0;
  border-bottom: 1px solid #f0f0f0;
  overflow-x: auto;
  flex-shrink: 0;
}
.ma-rtab {
  background: none;
  border: none;
  padding: 8px 10px 10px;
  font-size: 12px;
  color: #666;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: all 0.15s;
  position: relative;
}
.ma-rtab i { font-size: 16px; }
.ma-rtab:hover { color: #0068ff; background: #f0f7ff; border-radius: 6px 6px 0 0; }
.ma-rtab.active { color: #0068ff; border-bottom-color: #0068ff; font-weight: 600; }
.ma-rules-badge {
  position: absolute;
  top: 2px; right: 2px;
  background: #ff4d4f;
  color: #fff;
  font-size: 10px;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600;
  padding: 0 3px;
}
.ma-rules-badge.ok {
  background: #52c41a;
  font-size: 10px;
}

/* Body */
.ma-rules-body {
  overflow-y: auto;
  padding: 16px 20px 20px;
  flex: 1;
}
.ma-rules-section {
  margin-bottom: 16px;
}
.ma-rules-stitle {
  font-size: 13px;
  font-weight: 600;
  color: #0050b3;
  margin-bottom: 8px;
  display: flex; align-items: center; gap: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid #e6f7ff;
}
.ma-rules-stitle i { font-size: 15px; }

/* Rules table */
.ma-rules-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  margin-top: 4px;
}
.ma-rules-table td {
  padding: 6px 10px;
  border-bottom: 1px solid #f5f5f5;
  color: #333;
  line-height: 1.6;
  vertical-align: top;
}
.ma-rules-table td.rl {
  font-weight: 600;
  color: #1a1a2e;
  width: 120px;
  white-space: nowrap;
}
.ma-rules-table td b { color: #0050b3; }
.ma-rules-table td code {
  background: #f5f5f5;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 11px;
  color: #7c2d12;
}
.ma-rules-table td a {
  color: #0068ff;
  text-decoration: none;
}
.ma-rules-table td a:hover { text-decoration: underline; }
.ma-rules-table.img-table tr.head td {
  background: #e6f7ff;
  font-weight: 600;
  color: #0050b3;
  font-size: 11.5px;
  text-align: center;
}
.ma-rules-table.img-table tr.head td:first-child { text-align: left; }
.ma-rules-table.img-table td { text-align: center; }
.ma-rules-table.img-table td:first-child { text-align: left; }
.ma-rules-table.img-table td i { margin-right: 4px; color: #0068ff; }
.ma-rules-table.banned td {
  padding: 7px 10px;
  font-size: 12.5px;
  display: flex; align-items: center; gap: 6px;
}

/* Warnings in rules */
.ma-rules-warns {
  margin-top: 10px;
  padding: 10px 12px;
  background: #fff2f0;
  border: 1px solid #ffccc7;
  border-radius: 8px;
}
.ma-rules-warn-item {
  font-size: 12px;
  color: #cf1322;
  padding: 3px 0;
  display: flex; align-items: center; gap: 5px;
}
.ma-rules-warn-item i { font-size: 14px; flex-shrink: 0; }

/* Auto-fix list */
.ma-auto-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}
.ma-auto-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: #333;
  padding: 6px 10px;
  background: #f6ffed;
  border-radius: 6px;
  border: 1px solid #d9f7be;
}
.ma-auto-item i { font-size: 15px; flex-shrink: 0; }

/* Tips */
.ma-rules-tips {
  margin-top: 10px;
  display: flex; flex-direction: column; gap: 4px;
}
.ma-rules-tips .tip {
  font-size: 12px;
  color: #8c8c8c;
  display: flex; align-items: center; gap: 5px;
}
.ma-rules-tips .tip i { color: #faad14; font-size: 14px; flex-shrink: 0; }

/* Flow steps */
.ma-rules-flow {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}
.ma-flow-step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 12px;
  background: #fafafa;
  border-radius: 8px;
  border-left: 3px solid #0068ff;
}
.ma-flow-num {
  background: #0068ff;
  color: #fff;
  width: 22px; height: 22px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}
.ma-flow-step div { font-size: 12.5px; color: #333; line-height: 1.5; }
.ma-flow-step div b { color: #1a1a2e; }
.ma-flow-step div br + * { color: #666; }

/* Footer links */
.ma-rules-footer {
  padding: 10px 20px;
  border-top: 1px solid #f0f0f0;
  display: flex;
  gap: 16px;
  flex-shrink: 0;
}
.ma-rules-footer a {
  font-size: 12px;
  color: #0068ff;
  text-decoration: none;
  display: flex; align-items: center; gap: 4px;
}
.ma-rules-footer a:hover { text-decoration: underline; }
.ma-rules-footer a i { font-size: 13px; }

@media (max-width: 600px) {
  .ma-rules-modal.v2 { width: 100%; max-width: 100vw; max-height: 100vh; border-radius: 0; }
  .ma-rules-tabs { gap: 0; padding: 4px 8px 0; }
  .ma-rtab { padding: 6px 6px 8px; font-size: 10px; }
  .ma-rtab i { font-size: 14px; }
  .ma-rtab span { display: none; }
  .ma-rules-table td.rl { width: 90px; font-size: 11.5px; }
  .ma-rules-body { padding: 12px 14px 16px; }
  .ma-rules-footer { flex-wrap: wrap; gap: 8px; }
}

/* =============================================
   SAVE WARNINGS OVERLAY
   ============================================= */
.ma-save-warn-overlay {
  position: fixed; inset: 0; z-index: 100010;
  background: rgba(0,0,0,.55); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  animation: maFadeIn .2s ease;
}
.ma-save-warn-modal {
  background: #1a1d23; border-radius: 16px; width: 400px; max-width: 92vw;
  max-height: 80vh; display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,.5); border: 1px solid rgba(255,255,255,.08);
}
.ma-sw-header {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 20px 14px; border-bottom: 1px solid rgba(255,255,255,.06);
}
.ma-sw-header-icon { font-size: 28px; }
.ma-sw-header-title { font-size: 15px; font-weight: 700; color: #F59E0B; }
.ma-sw-header-sub { font-size: 11px; color: rgba(160,180,210,.5); margin-top: 2px; }
.ma-sw-body {
  flex: 1; overflow-y: auto; padding: 12px 16px;
}
.ma-sw-group { margin-bottom: 12px; }
.ma-sw-group-title {
  font-size: 11px; font-weight: 700; color: rgba(160,180,210,.5);
  margin-bottom: 6px; text-transform: uppercase; letter-spacing: .5px;
}
.ma-sw-item {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  border-radius: 8px; cursor: pointer; transition: background .15s;
  border: 1px solid rgba(255,255,255,.04);
  margin-bottom: 4px;
}
.ma-sw-item:hover { background: rgba(255,255,255,.06); }
.ma-sw-icon { color: #F59E0B; font-size: 12px; flex-shrink: 0; }
.ma-sw-msg { flex: 1; font-size: 12px; color: rgba(234,245,255,.7); }
.ma-sw-go { color: rgba(160,180,210,.3); font-size: 14px; }
.ma-sw-footer {
  display: flex; gap: 8px; padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,.06);
}
.ma-sw-btn-later {
  flex: 1; padding: 10px; border-radius: 8px;
  background: #475569; border: 1px solid #64748b;
  color: #f8fafc; font-size: 12px; font-weight: 600; cursor: pointer;
}
.ma-sw-btn-later:hover { background: #64748b; }
.ma-sw-btn-fix {
  flex: 1; padding: 10px; border-radius: 8px;
  background: #0068FF; border: none;
  color: #fff; font-size: 12px; font-weight: 600; cursor: pointer;
}
.ma-sw-btn-fix:hover { background: #0058dd; }

/* =============================================
   PHONE REMINDER CARD
   ============================================= */
.ma-phone-reminder {
  position: absolute; bottom: 80px; left: 50%; transform: translateX(-50%);
  width: 300px; max-width: 90%;
  background: #1e2028; border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,.5); border: 1px solid rgba(255,255,255,.08);
  z-index: 50; animation: maSlideUp .3s ease;
}
@keyframes maSlideUp {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.ma-rem-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px 8px; border-bottom: 1px solid rgba(255,255,255,.06);
}
.ma-rem-header span { font-size: 12px; font-weight: 700; color: #F59E0B; }
.ma-rem-close {
  background: none; border: none; color: rgba(160,180,210,.4); font-size: 14px;
  cursor: pointer; padding: 0 4px;
}
.ma-rem-close:hover { color: #fff; }
.ma-rem-body { padding: 8px 12px 4px; }
.ma-rem-group { margin-bottom: 8px; }
.ma-rem-group-hd {
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; padding: 4px 6px; border-radius: 6px;
  transition: background .15s;
}
.ma-rem-group-hd:hover { background: rgba(255,255,255,.06); }
.ma-rem-panel {
  font-size: 11px; font-weight: 600; color: #e2ebf7;
  text-transform: uppercase; letter-spacing: .3px;
}
.ma-rem-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  background: #b45309; color: #fff;
  border-radius: 9px; font-size: 10px; font-weight: 700;
}
.ma-rem-msg {
  font-size: 11px; color: rgba(160,180,210,.5); padding: 1px 0 1px 12px;
  line-height: 1.5;
}
.ma-rem-more {
  font-size: 10px; color: rgba(160,180,210,.3); padding-left: 12px;
  font-style: italic;
}
.ma-rem-tip {
  text-align: center; font-size: 10px; color: rgba(160,180,210,.25);
  padding: 4px 0 10px; border-top: 1px solid rgba(255,255,255,.04);
  margin-top: 4px;
}

/* =============================================
   DEPLOY CHECK OVERLAY
   ============================================= */
.ma-deploy-check-overlay {
  position: fixed; inset: 0; z-index: 100010;
  background: rgba(0,0,0,.6); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  animation: maFadeIn .2s ease;
}
.ma-deploy-check-modal {
  background: #1a1d23; border-radius: 18px; width: 480px; max-width: 94vw;
  max-height: 85vh; display: flex; flex-direction: column;
  box-shadow: 0 24px 80px rgba(0,0,0,.6); border: 1px solid rgba(255,255,255,.08);
}
.ma-dc-header {
  display: flex; align-items: center; gap: 14px;
  padding: 20px 20px 16px; border-bottom: 1px solid rgba(255,255,255,.06);
}
.ma-dc-score {
  width: 56px; height: 56px; border-radius: 50%;
  border: 3px solid; display: flex; flex-direction: column;
  align-items: center; justify-content: center; flex-shrink: 0;
}
.ma-dc-score-num { font-size: 16px; font-weight: 800; line-height: 1; }
.ma-dc-score-label { font-size: 9px; color: rgba(160,180,210,.4); text-transform: uppercase; }
.ma-dc-header-text { flex: 1; }
.ma-dc-title { font-size: 16px; font-weight: 700; color: rgba(234,245,255,.9); }
.ma-dc-subtitle { font-size: 12px; margin-top: 3px; font-weight: 500; }
.ma-dc-close {
  background: none; border: none; font-size: 20px;
  color: rgba(160,180,210,.4); cursor: pointer; padding: 4px 8px; border-radius: 6px;
  align-self: flex-start;
}
.ma-dc-close:hover { background: rgba(71,85,105,.9); color: #fff; }
.ma-dc-body { flex: 1; overflow-y: auto; padding: 14px 18px; }
.ma-dc-group { margin-bottom: 16px; }
.ma-dc-group-title {
  font-size: 12px; font-weight: 700;
  margin-bottom: 8px; padding-bottom: 4px;
  border-bottom: 1px solid rgba(255,255,255,.04);
}
.ma-dc-item {
  background: rgba(255,255,255,.03); border-radius: 10px;
  border: 1px solid rgba(255,255,255,.05);
  margin-bottom: 6px; overflow: hidden;
}
.ma-dc-item-hd {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
}
.ma-dc-item-icon { font-size: 13px; flex-shrink: 0; }
.ma-dc-item-label { font-size: 12px; font-weight: 600; color: rgba(234,245,255,.8); }
.ma-dc-item-msg { font-size: 11px; color: rgba(160,180,210,.45); margin-left: auto; }
.ma-dc-item-fix {
  padding: 8px 12px; font-size: 11px; color: #dbeafe;
  background: rgba(0,86,179,.38); cursor: pointer;
  border-top: 1px solid rgba(255,255,255,.04);
  transition: background .15s;
}
.ma-dc-item-fix:hover { background: rgba(0,86,179,.5); color: #fff; }
.ma-dc-passed {
  font-size: 11px; color: rgba(34,197,94,.5); padding: 3px 0;
}
.ma-dc-footer {
  display: flex; gap: 10px; padding: 14px 18px;
  border-top: 1px solid rgba(255,255,255,.06);
}
.ma-dc-btn-cancel {
  flex: 1; padding: 11px; border-radius: 10px;
  background: rgba(71,85,105,.92); border: 1px solid rgba(148,163,184,.24);
  color: #e2ebf7; font-size: 13px; font-weight: 600; cursor: pointer;
}
.ma-dc-btn-cancel:hover { background: rgba(100,116,139,.95); }
.ma-dc-btn-deploy {
  flex: 1; padding: 11px; border-radius: 10px;
  background: linear-gradient(135deg, #0068FF, #00C853); border: none;
  color: #fff; font-size: 13px; font-weight: 700; cursor: pointer;
  transition: opacity .15s;
}
.ma-dc-btn-deploy:hover { opacity: .9; }
.ma-dc-btn-deploy.disabled {
  background: rgba(71,85,105,.78); color: #cbd5e1;
  cursor: not-allowed;
}
.ma-dc-btn-deploy.disabled:hover { opacity: 1; }

/* ============ WIFI REMOTE SETUP ============ */
/* -- Theme-aware variables for wifi-setup -- */
.ws-modal-overlay, .ws-brand-grid, .ws-brand-card, .ws-form-section,
.ws-howto-step, .ws-manual-steps, .ws-guide-brand, .ws-isp-note {
  --ws-text: var(--text-primary);
  --ws-text2: var(--text-secondary);
  --ws-bg: var(--bg-card);
  --ws-border: var(--border-color);
}

/* -- Modal overlay -- */
.ws-modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 1000;
  background: rgba(0,0,0,.55); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; animation: wsFadeIn .2s ease;
}
@keyframes wsFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes wsSlideUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
.ws-modal {
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: 16px; width: 100%; max-width: 640px; max-height: 85vh;
  display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.4);
  animation: wsSlideUp .25s ease;
}
[data-theme="dark"] .ws-modal { background: #0f172a; border-color: rgba(148,163,184,.3); }
.ws-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px; border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}
.ws-modal-title { font-size: 17px; font-weight: 700; color: var(--text-primary); }
.ws-modal-close {
  width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--border-color);
  background: var(--bg-input); color: var(--text-secondary); font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all .15s;
}
.ws-modal-close:hover { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.ws-modal-body { padding: 24px; overflow-y: auto; flex: 1; }

/* -- Brand grid -- */
.ws-brand-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.ws-brand-card {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  border-radius: 12px; cursor: pointer; transition: all .2s;
  background: var(--bg-card); border: 2px solid var(--border-color);
}
[data-theme="dark"] .ws-brand-card { background: rgba(15,23,42,.85); border-color: rgba(148,163,184,.25); }
.ws-brand-card:hover { border-color: var(--primary-light); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,.15); }
[data-theme="dark"] .ws-brand-card:hover { background: rgba(15,23,42,.95); border-color: rgba(148,163,184,.4); }
.ws-brand-card.active { border-color: var(--brand-color, var(--primary)); box-shadow: 0 0 0 3px rgba(37,99,235,.2); }
[data-theme="dark"] .ws-brand-card.active { background: rgba(15,23,42,.95); }
.ws-brand-icon { font-size: 28px; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; border-radius: 10px; background: var(--bg-input); flex-shrink: 0; }
.ws-brand-info { flex: 1; min-width: 0; }
.ws-brand-name { font-weight: 700; font-size: 15px; color: var(--text-primary); }
.ws-brand-desc { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.ws-brand-mode { font-size: 11px; padding: 4px 8px; border-radius: 6px; background: var(--bg-input); color: var(--text-primary); white-space: nowrap; font-weight: 600; }

.ws-form-section { margin-bottom: 20px; }
.ws-section-title { font-size: 16px; font-weight: 700; margin-bottom: 12px; color: var(--text-primary); }
.ws-tip { font-size: 12px; color: var(--text-primary); background: rgba(255,180,0,.1); border: 1px solid rgba(255,180,0,.3); border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; line-height: 1.6; font-weight: 500; }
[data-theme="dark"] .ws-tip { background: #92400e; color: #fff7ed; }
.ws-field { margin-bottom: 14px; }
.ws-label { display: block; font-size: 13px; font-weight: 700; color: var(--text-primary); margin-bottom: 5px; }
.ws-input { width: 100%; padding: 10px 14px; border-radius: 8px; border: 1px solid var(--border-color); background: var(--bg-input); color: var(--text-primary); font-size: 14px; font-weight: 500; transition: border-color .2s; box-sizing: border-box; }
[data-theme="dark"] .ws-input { background: rgba(15,23,42,.8); border-color: rgba(148,163,184,.4); color: #fff; }
.ws-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.2); }
.ws-input::placeholder { color: var(--text-muted); }
select.ws-input { appearance: auto; }
.ws-hint { font-size: 11px; color: var(--text-secondary); margin-top: 4px; font-weight: 500; }

.ws-actions { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.ws-btn { display: inline-flex; align-items: center; gap: 6px; padding: 10px 20px; border-radius: 8px; font-size: 14px; font-weight: 700; cursor: pointer; border: none; transition: all .15s; }
.ws-btn-test { background: var(--primary-bg); color: var(--primary); border: 1px solid var(--primary-light); }
[data-theme="dark"] .ws-btn-test { background: #1d4ed8; color: #fff; border-color: #60a5fa; }
.ws-btn-test:hover { background: var(--primary-light); color: #fff; }
.ws-btn-apply { background: linear-gradient(135deg, #1d4ed8, #5b21b6); color: #fff; font-size: 15px; padding: 12px 28px; }
.ws-btn-apply:hover { opacity: .9; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(37,99,235,.3); }
.ws-btn.loading { opacity: .6; cursor: wait; }

.ws-test-result { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 8px; flex: 1; min-width: 200px; }
.ws-test-result.success { background: rgba(76,175,80,.12); border: 1px solid rgba(76,175,80,.35); }
.ws-test-result.error { background: rgba(244,67,54,.12); border: 1px solid rgba(244,67,54,.35); }
.ws-test-icon { font-size: 20px; }
.ws-test-info { font-size: 13px; color: var(--text-primary); font-weight: 600; line-height: 1.4; }
.ws-test-details { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.ws-test-details span { margin-right: 8px; }

.ws-result-section { margin-top: 20px; }
.ws-result-header { font-size: 16px; font-weight: 700; padding: 12px 16px; border-radius: 10px 10px 0 0; }
.ws-result-header.success { background: #dcfce7; color: #166534; }
[data-theme="dark"] .ws-result-header.success { color: #86efac; }
.ws-result-header.partial { background: #ffedd5; color: #9a3412; }
[data-theme="dark"] .ws-result-header.partial { color: #fbbf24; }
.ws-result-steps { border: 1px solid var(--border-color); border-top: none; border-radius: 0 0 10px 10px; background: var(--bg-input); }
[data-theme="dark"] .ws-result-steps { background: rgba(15,23,42,.5); }
.ws-step { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--border-color); font-size: 13px; }
.ws-step:last-child { border-bottom: none; }
.ws-step.ok { color: var(--text-primary); font-weight: 500; }
.ws-step.fail { color: #dc2626; font-weight: 600; }
[data-theme="dark"] .ws-step.fail { color: #fca5a5; }
.ws-step-icon { font-size: 16px; }
.ws-step-name { flex: 1; }
.ws-step-detail { font-size: 11px; color: var(--text-secondary); }
.ws-success-box { text-align: center; padding: 24px; margin-top: 16px; background: #dcfce7; border-radius: 12px; border: 1px solid #86efac; color: #166534; font-size: 15px; font-weight: 700; }
[data-theme="dark"] .ws-success-box { color: #f0fdf4; background: #166534; }

.ws-script-box { margin-top: 12px; border-radius: 10px; overflow: hidden; border: 1px solid var(--border-color); }
.ws-script-header { display: flex; align-items: center; justify-content: space-between; padding: 8px 14px; background: var(--bg-input); font-size: 12px; color: var(--text-secondary); font-weight: 600; }
[data-theme="dark"] .ws-script-header { background: rgba(30,41,59,.8); }
.ws-btn-copy { font-size: 12px; padding: 4px 10px; border-radius: 6px; border: 1px solid var(--border-color); background: var(--bg-card); color: var(--text-primary); cursor: pointer; transition: all .15s; font-weight: 600; }
.ws-btn-copy:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.ws-script-content { margin: 0; padding: 14px; font-family: 'Fira Code', monospace; font-size: 12px; line-height: 1.6; color: #22c55e; background: #0a0a0a; white-space: pre-wrap; word-break: break-all; max-height: 360px; overflow-y: auto; }
.ws-url-copy { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 8px; background: var(--bg-input); border: 1px solid var(--border-color); }
[data-theme="dark"] .ws-url-copy { background: rgba(15,23,42,.7); }
.ws-url-copy code { flex:1; font-size: 13px; color: var(--primary); font-weight: 600; word-break: break-all; }

.ws-manual-steps { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.ws-guide-brand { background: var(--bg-input); border-radius: 10px; padding: 14px; border: 1px solid var(--border-color); }
[data-theme="dark"] .ws-guide-brand { background: rgba(15,23,42,.7); border-color: rgba(148,163,184,.25); }
.ws-guide-brand-name { font-weight: 700; font-size: 14px; margin-bottom: 10px; color: var(--text-primary); }
.ws-guide-step { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-primary); margin-bottom: 6px; line-height: 1.5; font-weight: 500; }

.ws-isp-note { background: rgba(251,191,36,.08); border: 1px solid rgba(251,191,36,.25); border-radius: 10px; padding: 14px 16px; margin-bottom: 16px; }
.ws-guide-num { width: 20px; height: 20px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0; }

.ws-howto-step { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-primary); font-weight: 600; }
.ws-howto-num { width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; }
.ws-howto-arrow { font-size: 16px; color: var(--text-secondary); }

@media (max-width: 600px) {
  .ws-brand-grid { grid-template-columns: 1fr; }
  .ws-manual-steps { grid-template-columns: 1fr; }
  .ws-actions { flex-direction: column; }
  .ws-test-result { min-width: 100%; }
  .ws-modal { max-height: 90vh; margin: 10px; }
  .ws-modal-body { padding: 16px; }
}

/* ─── Gift Link Builder: Validation & Image Preview ─── */
.ma-field-warn {
  font-size: 11px;
  color: #ef4444;
  margin: 4px 0 2px 0;
  line-height: 1.4;
  display: flex;
  align-items: center;
  gap: 4px;
}
.ma-field-warn i { font-size: 13px; }

.gl-img-preview {
  position: relative;
  margin: 6px 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(148,163,184,.2);
  max-height: 120px;
}
.gl-img-preview img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 120px;
  object-fit: cover;
}
.gl-img-preview.gl-img-logo {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  max-height: 48px;
}
.gl-img-preview.gl-img-logo img {
  width: 48px;
  height: 48px;
  max-height: 48px;
  object-fit: contain;
}
.gl-img-badge {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: rgba(0,0,0,.6);
  color: #fff;
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
}

.gl-validation-warn {
  background: rgba(239,68,68,.08);
  border: 1px solid rgba(239,68,68,.2);
  border-radius: 10px;
  padding: 12px 14px;
  margin-top: 12px;
  font-size: 12px;
  color: #ef4444;
  line-height: 1.5;
}
.gl-validation-warn i { margin-right: 4px; }
.gl-validation-warn ul {
  margin: 6px 0 0 16px;
  padding: 0;
  list-style: disc;
}
.gl-validation-warn li {
  margin: 2px 0;
  color: rgba(239,68,68,.8);
}

.gl-validation-ok {
  background: rgba(34,197,94,.08);
  border: 1px solid rgba(34,197,94,.2);
  border-radius: 10px;
  padding: 12px 14px;
  margin-top: 12px;
  font-size: 12px;
  color: #22c55e;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ═══════════════════════════════════════════════
   TEMPLATE LIBRARY PAGE
   ═══════════════════════════════════════════════ */
.tpl-page {
  padding: 24px 32px;
  max-width: 1400px;
  margin: 0 auto;
}
.tpl-header { margin-bottom: 20px; }
.tpl-header h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary, #e2e8f0);
  margin: 0 0 4px;
}
.tpl-subtitle {
  font-size: 13px;
  color: var(--text-muted, #64748b);
  margin: 0;
}
.tpl-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.tpl-filter-btn {
  padding: 7px 16px;
  border-radius: 20px;
  border: 1px solid rgba(148,163,184,.2);
  background: rgba(30,41,59,.5);
  color: var(--text-secondary, #94a3b8);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all .2s;
}
.tpl-filter-btn:hover { border-color: #8b5cf6; color: #c4b5fd; }
.tpl-filter-btn.active {
  background: rgba(139,92,246,.15);
  border-color: #8b5cf6;
  color: #c4b5fd;
  font-weight: 600;
}
.tpl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.tpl-card {
  background: rgba(30,41,59,.6);
  border: 1px solid rgba(148,163,184,.12);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  transition: all .25s;
}
.tpl-card:hover {
  border-color: #8b5cf6;
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(0,0,0,.3);
}
.tpl-card-img {
  aspect-ratio: 9/16;
  height: auto;
  overflow: hidden;
  background: linear-gradient(180deg, #e8eef9, #f8fafc);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}
.tpl-card-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  border-radius: 22px;
  background: #fff;
}
.tpl-card-body { padding: 14px 16px 16px; }
.tpl-card-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary, #e2e8f0);
  margin-bottom: 4px;
}
.tpl-card-cat {
  font-size: 11px;
  color: #8b5cf6;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.tpl-card-desc {
  font-size: 12px;
  color: var(--text-muted, #64748b);
  line-height: 1.5;
  margin-bottom: 10px;
  min-height: 36px;
}
.tpl-card-features {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.tpl-tag {
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(139,92,246,.1);
  color: #c4b5fd;
  font-size: 10px;
  white-space: nowrap;
}
.tpl-footer-info {
  margin-top: 24px;
  padding: 12px 16px;
  border-radius: 10px;
  background: rgba(139,92,246,.06);
  border: 1px solid rgba(139,92,246,.12);
  font-size: 12px;
  color: var(--text-muted, #64748b);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ─── Template Detail View ─── */
.tpl-detail { padding: 0; height: 100%; display: flex; flex-direction: column; }
.tpl-detail-topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 24px;
  background: rgba(15,23,42,.8);
  border-bottom: 1px solid rgba(148,163,184,.1);
}
.tpl-back-btn {
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid rgba(148,163,184,.2);
  background: transparent;
  color: var(--text-secondary, #94a3b8);
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.tpl-back-btn:hover { border-color: #8b5cf6; color: #c4b5fd; }
.tpl-detail-name {
  font-weight: 700;
  font-size: 16px;
  color: var(--text-primary, #e2e8f0);
  flex: 1;
}
.tpl-detail-actions { display: flex; gap: 8px; }
.tpl-github-btn {
  padding: 6px 14px;
  border-radius: 8px;
  background: rgba(139,92,246,.15);
  border: 1px solid rgba(139,92,246,.3);
  color: #c4b5fd;
  font-size: 13px;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}
.tpl-github-btn:hover { background: rgba(139,92,246,.25); }

.tpl-detail-main {
  display: flex;
  flex: 1;
  overflow: hidden;
  padding: 24px;
  gap: 32px;
}
.tpl-detail-info {
  flex: 1;
  overflow-y: auto;
  padding-right: 16px;
}
.tpl-detail-section {
  margin-bottom: 20px;
}
.tpl-detail-section h3 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary, #e2e8f0);
  margin: 0 0 8px;
}
.tpl-detail-section h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary, #e2e8f0);
  margin: 0 0 8px;
}
.tpl-detail-section p {
  font-size: 13px;
  color: var(--text-secondary, #94a3b8);
  line-height: 1.6;
  margin: 0;
}
.tpl-feature-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.tpl-feature-list li {
  font-size: 13px;
  color: var(--text-secondary, #94a3b8);
  padding: 4px 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tpl-tech-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.tpl-tech-item {
  padding: 8px 12px;
  background: rgba(30,41,59,.5);
  border-radius: 8px;
  border: 1px solid rgba(148,163,184,.08);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tpl-tech-label {
  font-size: 10px;
  color: var(--text-muted, #64748b);
  text-transform: uppercase;
}
.tpl-tech-item span:last-child,
.tpl-tech-item a {
  font-size: 13px;
  color: var(--text-primary, #e2e8f0);
}
.tpl-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.tpl-step {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-secondary, #94a3b8);
  padding: 10px 14px;
  background: rgba(30,41,59,.4);
  border-radius: 8px;
  border: 1px solid rgba(148,163,184,.08);
}
.tpl-step code {
  background: rgba(139,92,246,.1);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  color: #c4b5fd;
  user-select: all;
}
.tpl-step-n {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(139,92,246,.2);
  color: #c4b5fd;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
.tpl-detail-preview {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  flex-shrink: 0;
}

@media (max-width: 900px) {
  .tpl-page { padding: 16px; }
  .tpl-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
  .tpl-detail-main { flex-direction: column-reverse; }
  .tpl-detail-preview { display: none; }
}

/* ═══════════════════════════════════════════════
   TEMPLATE LIBRARY PAGE
   ═══════════════════════════════════════════════ */
.tpl-page {
  padding: 24px 32px;
  max-width: 1400px;
  margin: 0 auto;
}
.tpl-header { margin-bottom: 20px; }
.tpl-header h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary, #e2e8f0);
  margin: 0 0 4px;
}
.tpl-subtitle {
  font-size: 13px;
  color: var(--text-muted, #64748b);
  margin: 0;
}
.tpl-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.tpl-filter-btn {
  padding: 7px 16px;
  border-radius: 20px;
  border: 1px solid rgba(148,163,184,.2);
  background: rgba(30,41,59,.5);
  color: var(--text-secondary, #94a3b8);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all .2s;
}
.tpl-filter-btn:hover { border-color: #8b5cf6; color: #c4b5fd; }
.tpl-filter-btn.active {
  background: rgba(139,92,246,.15);
  border-color: #8b5cf6;
  color: #c4b5fd;
  font-weight: 600;
}
.tpl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.tpl-card {
  background: rgba(30,41,59,.6);
  border: 1px solid rgba(148,163,184,.12);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  transition: all .25s;
}
.tpl-card:hover {
  border-color: #8b5cf6;
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(0,0,0,.3);
}
.tpl-card-img {
  aspect-ratio: 9/16;
  height: auto;
  overflow: hidden;
  background: linear-gradient(180deg, #e8eef9, #f8fafc);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}
.tpl-card-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  border-radius: 22px;
  background: #fff;
}
.tpl-card-body { padding: 14px 16px 16px; }
.tpl-card-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary, #e2e8f0);
  margin-bottom: 4px;
}
.tpl-card-cat {
  font-size: 11px;
  color: #8b5cf6;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.tpl-card-desc {
  font-size: 12px;
  color: var(--text-muted, #64748b);
  line-height: 1.5;
  margin-bottom: 10px;
  min-height: 36px;
}
.tpl-card-features {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.tpl-tag {
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(139,92,246,.1);
  color: #c4b5fd;
  font-size: 10px;
  white-space: nowrap;
}
.tpl-footer-info {
  margin-top: 24px;
  padding: 12px 16px;
  border-radius: 10px;
  background: rgba(139,92,246,.06);
  border: 1px solid rgba(139,92,246,.12);
  font-size: 12px;
  color: var(--text-muted, #64748b);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ─── Template Detail View ─── */
.tpl-detail { padding: 0; height: 100%; display: flex; flex-direction: column; }
.tpl-detail-topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 24px;
  background: rgba(15,23,42,.8);
  border-bottom: 1px solid rgba(148,163,184,.1);
}
.tpl-back-btn {
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid rgba(148,163,184,.2);
  background: transparent;
  color: var(--text-secondary, #94a3b8);
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.tpl-back-btn:hover { border-color: #8b5cf6; color: #c4b5fd; }
.tpl-detail-name {
  font-weight: 700;
  font-size: 16px;
  color: var(--text-primary, #e2e8f0);
  flex: 1;
}
.tpl-detail-actions { display: flex; gap: 8px; }
.tpl-github-btn {
  padding: 6px 14px;
  border-radius: 8px;
  background: rgba(139,92,246,.15);
  border: 1px solid rgba(139,92,246,.3);
  color: #c4b5fd;
  font-size: 13px;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}
.tpl-github-btn:hover { background: rgba(139,92,246,.25); }

.tpl-detail-main {
  display: flex;
  flex: 1;
  overflow: hidden;
  padding: 24px;
  gap: 32px;
}
.tpl-detail-info {
  flex: 1;
  overflow-y: auto;
  padding-right: 16px;
}
.tpl-detail-section {
  margin-bottom: 20px;
}
.tpl-detail-section h3 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary, #e2e8f0);
  margin: 0 0 8px;
}
.tpl-detail-section h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary, #e2e8f0);
  margin: 0 0 8px;
}
.tpl-detail-section p {
  font-size: 13px;
  color: var(--text-secondary, #94a3b8);
  line-height: 1.6;
  margin: 0;
}
.tpl-feature-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.tpl-feature-list li {
  font-size: 13px;
  color: var(--text-secondary, #94a3b8);
  padding: 4px 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tpl-tech-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.tpl-tech-item {
  padding: 8px 12px;
  background: rgba(30,41,59,.5);
  border-radius: 8px;
  border: 1px solid rgba(148,163,184,.08);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tpl-tech-label {
  font-size: 10px;
  color: var(--text-muted, #64748b);
  text-transform: uppercase;
}
.tpl-tech-item span:last-child,
.tpl-tech-item a {
  font-size: 13px;
  color: var(--text-primary, #e2e8f0);
}
.tpl-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.tpl-step {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-secondary, #94a3b8);
  padding: 10px 14px;
  background: rgba(30,41,59,.4);
  border-radius: 8px;
  border: 1px solid rgba(148,163,184,.08);
}
.tpl-step code {
  background: rgba(139,92,246,.1);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  color: #c4b5fd;
  user-select: all;
}
.tpl-step-n {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(139,92,246,.2);
  color: #c4b5fd;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
.tpl-detail-preview {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  flex-shrink: 0;
}

@media (max-width: 900px) {
  .tpl-page { padding: 16px; }
  .tpl-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
  .tpl-detail-main { flex-direction: column-reverse; }
  .tpl-detail-preview { display: none; }
}

/* ═══════════════════════════════════════════════
   ZALO GUIDE PAGE
   ═══════════════════════════════════════════════ */
.zg-page {
  display: flex;
  height: calc(100vh - 100px);
  overflow: hidden;
}
.zg-sidebar {
  width: 260px;
  flex-shrink: 0;
  background: rgba(15,23,42,.8);
  border-right: 1px solid rgba(148,163,184,.1);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.zg-sidebar-header {
  padding: 18px 20px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary, #e2e8f0);
  border-bottom: 1px solid rgba(148,163,184,.08);
  display: flex;
  align-items: center;
  gap: 8px;
}
.zg-sidebar-header i { color: #8b5cf6; font-size: 18px; }
.zg-nav { flex: 1; padding: 8px; }
.zg-nav-item {
  padding: 9px 14px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-secondary, #94a3b8);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
  transition: all .15s;
}
.zg-nav-item:hover { background: rgba(139,92,246,.08); color: #c4b5fd; }
.zg-nav-item.active {
  background: rgba(139,92,246,.15);
  color: #c4b5fd;
  font-weight: 600;
}
.zg-nav-item i { font-size: 16px; width: 20px; text-align: center; }
.zg-sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(148,163,184,.08);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.zg-ext-link {
  font-size: 12px;
  color: var(--text-muted, #64748b);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 5px;
}
.zg-ext-link:hover { color: #8b5cf6; }
.zg-content {
  flex: 1;
  overflow-y: auto;
  padding: 28px 36px 60px;
  max-width: 900px;
}
.zg-content h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary, #e2e8f0);
  margin: 0 0 8px;
}
.zg-content h3 {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary, #e2e8f0);
  margin: 24px 0 10px;
}
.zg-intro {
  font-size: 14px;
  color: var(--text-secondary, #94a3b8);
  line-height: 1.7;
  margin-bottom: 20px;
}
.zg-intro code {
  background: rgba(139,92,246,.12);
  padding: 2px 6px;
  border-radius: 4px;
  color: #c4b5fd;
  font-size: 13px;
}
.zg-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.zg-card {
  background: rgba(30,41,59,.5);
  border: 1px solid rgba(148,163,184,.1);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
}
.zg-card i { font-size: 24px; color: #8b5cf6; margin-bottom: 8px; }
.zg-card h4 { font-size: 20px; font-weight: 700; color: var(--text-primary, #e2e8f0); margin: 0 0 4px; }
.zg-card p { font-size: 12px; color: var(--text-muted, #64748b); margin: 0; }
.zg-audience {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 12px 0;
}
.zg-audience > div {
  padding: 14px;
  background: rgba(30,41,59,.4);
  border-radius: 10px;
  border: 1px solid rgba(148,163,184,.08);
}
.zg-audience i { font-size: 20px; color: #8b5cf6; }
.zg-audience strong { display: block; margin: 6px 0 4px; font-size: 13px; color: var(--text-primary, #e2e8f0); }
.zg-audience p { font-size: 12px; color: var(--text-muted, #64748b); margin: 0; }
.zg-tip, .zg-warn, .zg-ok {
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.6;
  margin: 14px 0;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.zg-tip i, .zg-warn i, .zg-ok i { font-size: 16px; margin-top: 2px; flex-shrink: 0; }
.zg-tip { background: rgba(59,130,246,.08); border: 1px solid rgba(59,130,246,.2); color: #93c5fd; }
.zg-tip i { color: #60a5fa; }
.zg-warn { background: rgba(245,158,11,.08); border: 1px solid rgba(245,158,11,.2); color: #fcd34d; }
.zg-warn i { color: #f59e0b; }
.zg-ok { background: rgba(34,197,94,.08); border: 1px solid rgba(34,197,94,.2); color: #86efac; }
.zg-ok i { color: #22c55e; }
.zg-rule {
  margin: 14px 0;
  background: rgba(30,41,59,.4);
  border-radius: 10px;
  border: 1px solid rgba(148,163,184,.08);
  overflow: hidden;
}
.zg-rule-title {
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary, #e2e8f0);
  background: rgba(139,92,246,.06);
  border-bottom: 1px solid rgba(148,163,184,.06);
}
.zg-rule ul {
  margin: 0;
  padding: 10px 16px 10px 34px;
  list-style: disc;
}
.zg-rule li {
  font-size: 13px;
  color: var(--text-secondary, #94a3b8);
  line-height: 1.6;
  padding: 3px 0;
}
.zg-steps { display: flex; flex-direction: column; gap: 16px; }
.zg-step-card {
  background: rgba(30,41,59,.4);
  border: 1px solid rgba(148,163,184,.1);
  border-radius: 12px;
  padding: 18px 20px;
  position: relative;
}
.zg-step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #8b5cf6, #6d28d9);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}
.zg-step-card h4 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary, #e2e8f0);
  margin: 0 0 8px;
}
.zg-step-card ul, .zg-step-card ol {
  margin: 0;
  padding-left: 20px;
}
.zg-step-card li {
  font-size: 13px;
  color: var(--text-secondary, #94a3b8);
  line-height: 1.6;
  padding: 2px 0;
}
.zg-step-card a { color: #818cf8; text-decoration: underline; }
.zg-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.zg-summary-item {
  padding: 12px 14px;
  background: rgba(30,41,59,.5);
  border-radius: 10px;
  border: 1px solid rgba(148,163,184,.08);
}
.zg-summary-item i { font-size: 18px; color: #8b5cf6; }
.zg-summary-item strong { display: block; font-size: 13px; margin: 6px 0 4px; color: var(--text-primary, #e2e8f0); }
.zg-summary-item p { font-size: 12px; color: var(--text-muted, #64748b); margin: 0; }
.zg-perm-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.zg-perm {
  padding: 6px 14px;
  background: rgba(139,92,246,.1);
  border: 1px solid rgba(139,92,246,.2);
  border-radius: 20px;
  font-size: 12px;
  color: #c4b5fd;
}
.zg-perf-meters { display: flex; gap: 16px; margin-bottom: 20px; }
.zg-perf-meter {
  flex: 1;
  text-align: center;
  padding: 16px;
  background: rgba(30,41,59,.5);
  border-radius: 12px;
  border: 1px solid rgba(148,163,184,.1);
}
.zg-perf-value {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 4px;
}
.zg-perf-value.bad { color: #ef4444; }
.zg-perf-value.warn { color: #f59e0b; }
.zg-perf-value.good { color: #22c55e; }
.zg-perf-label { font-size: 12px; color: var(--text-muted, #64748b); }
.zg-compare { display: flex; gap: 16px; margin-bottom: 16px; }
.zg-compare-col {
  flex: 1;
  background: rgba(30,41,59,.4);
  border: 1px solid rgba(148,163,184,.1);
  border-radius: 12px;
  padding: 16px;
}
.zg-compare-col h4 {
  font-size: 14px;
  font-weight: 600;
  color: #c4b5fd;
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.zg-compare-col ul { margin: 0; padding-left: 18px; }
.zg-compare-col li { font-size: 12px; color: var(--text-secondary, #94a3b8); line-height: 1.6; padding: 2px 0; }
.zg-compare-steps {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(148,163,184,.08);
}
.zg-compare-steps strong { font-size: 12px; color: var(--text-primary, #e2e8f0); }
.zg-compare-steps ol { margin: 6px 0 0; padding-left: 18px; }
.zg-compare-steps li { font-size: 12px; color: var(--text-muted, #64748b); line-height: 1.5; }
.zg-api-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.zg-api-group {
  background: rgba(30,41,59,.4);
  border: 1px solid rgba(148,163,184,.08);
  border-radius: 10px;
  padding: 14px;
}
.zg-api-group h4 {
  font-size: 13px;
  font-weight: 600;
  color: #c4b5fd;
  margin: 0 0 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.zg-api-group ul { list-style: none; margin: 0; padding: 0; }
.zg-api-group li {
  font-size: 12px;
  color: var(--text-secondary, #94a3b8);
  padding: 3px 0;
}
.zg-api-group code {
  background: rgba(139,92,246,.1);
  padding: 1px 5px;
  border-radius: 3px;
  color: #c4b5fd;
  font-size: 11px;
}
.zg-open-api-note {
  background: rgba(30,41,59,.4);
  border: 1px solid rgba(148,163,184,.1);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 13px;
  color: var(--text-secondary, #94a3b8);
  line-height: 1.7;
}
.zg-devtools-steps { margin-bottom: 16px; }
.zg-dt-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(30,41,59,.3);
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--text-secondary, #94a3b8);
}
.zg-dt-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(139,92,246,.2);
  color: #c4b5fd;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
.zg-contact-box {
  margin-top: 20px;
  padding: 16px;
  background: rgba(139,92,246,.06);
  border: 1px solid rgba(139,92,246,.15);
  border-radius: 10px;
  font-size: 13px;
  color: var(--text-secondary, #94a3b8);
  line-height: 1.7;
}
.zg-contact-box a { color: #818cf8; }
.zg-checklist { display: flex; flex-direction: column; gap: 16px; }
.zg-cl-group {
  background: rgba(30,41,59,.4);
  border: 1px solid rgba(148,163,184,.08);
  border-radius: 12px;
  padding: 14px 16px;
}
.zg-cl-group h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary, #e2e8f0);
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.zg-cl {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 13px;
  color: var(--text-secondary, #94a3b8);
  cursor: pointer;
}
.zg-cl input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #8b5cf6;
  flex-shrink: 0;
}
.zg-cl-auto {
  margin-left: auto;
  font-size: 11px;
  color: #22c55e;
  white-space: nowrap;
}
@media (max-width: 900px) {
  .zg-page { flex-direction: column; height: auto; }
  .zg-sidebar { width: 100%; border-right: none; border-bottom: 1px solid rgba(148,163,184,.1); }
  .zg-nav { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px; }
  .zg-nav-item { padding: 6px 10px; font-size: 12px; }
  .zg-content { padding: 16px; }
  .zg-cards { grid-template-columns: repeat(2, 1fr); }
  .zg-audience { grid-template-columns: 1fr; }
  .zg-summary-grid { grid-template-columns: repeat(2, 1fr); }
  .zg-compare { flex-direction: column; }
  .zg-api-grid { grid-template-columns: 1fr; }
  .zg-perf-meters { flex-direction: column; }
}

/* ═══════════════════════════════════════════════
  TEMPLATE DETAIL — macOS Style Enhancements
  Use Template + 3D
  ═══════════════════════════════════════════════ */

/* Floating phone animation */
@keyframes tplPhoneFloat {
  0%, 100% { transform: translateY(0px) rotateY(0deg); }
  50% { transform: translateY(-12px) rotateY(2deg); }
}

/* === Use Template Button === */
.tpl-use-btn {
  padding: 8px 18px;
  border-radius: 10px;
  background: linear-gradient(135deg, #8b5cf6, #6d28d9);
  border: none;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all .25s;
  box-shadow: 0 4px 15px rgba(139,92,246,.3);
}
.tpl-use-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(139,92,246,.45);
  background: linear-gradient(135deg, #a78bfa, #7c3aed);
}

/* === Platform Badges === */
.tpl-platform-badges {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.tpl-platform-badge {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
}
.tpl-platform-badge.zalo {
  background: rgba(0,104,255,.12);
  color: #60a5fa;
  border: 1px solid rgba(0,104,255,.2);
}
.tpl-platform-badge.chplay {
  background: rgba(61,220,132,.12);
  color: #4ade80;
  border: 1px solid rgba(61,220,132,.2);
}

/* === Dual Platform Cards === */
.tpl-dual-platform {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.tpl-platform-card {
  padding: 20px;
  border-radius: 16px;
  background: rgba(30,41,59,.6);
  border: 1px solid rgba(148,163,184,.1);
  backdrop-filter: blur(20px);
  text-align: center;
  transition: all .3s;
}
.tpl-platform-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0,0,0,.25);
  border-color: rgba(139,92,246,.3);
}
.tpl-platform-card h5 {
  font-size: 14px;
  font-weight: 700;
  color: #f1f5f9;
  margin: 10px 0 6px;
}
.tpl-platform-card p {
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.5;
  margin-bottom: 14px;
}
.tpl-platform-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin: 0 auto;
  transition: all .3s;
}
.tpl-platform-icon.zalo-icon {
  background: linear-gradient(135deg, rgba(0,104,255,.2), rgba(0,210,255,.2));
  color: #60a5fa;
  box-shadow: 0 4px 20px rgba(0,104,255,.2);
}
.tpl-platform-icon.chplay-icon {
  background: linear-gradient(135deg, rgba(61,220,132,.2), rgba(0,200,83,.2));
  color: #4ade80;
  box-shadow: 0 4px 20px rgba(61,220,132,.2);
}
.tpl-platform-card:hover .tpl-platform-icon {
  transform: scale(1.1) rotateZ(-5deg);
}
.tpl-platform-action {
  padding: 8px 20px;
  border-radius: 10px;
  border: none;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  background: rgba(139,92,246,.15);
  color: #c4b5fd;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.tpl-platform-action:hover {
  background: rgba(139,92,246,.3);
  transform: translateY(-1px);
}

/* === APK Build Dialog === */
.tpl-apk-dialog-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(8px);
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: tplFadeIn .2s ease;
}
@keyframes tplFadeIn { from { opacity: 0; } to { opacity: 1; } }

.tpl-apk-dialog {
  width: 540px;
  max-width: 92vw;
  max-height: 85vh;
  background: rgba(15,23,42,.97);
  border: 1px solid rgba(148,163,184,.15);
  border-radius: 20px;
  box-shadow: 0 32px 64px rgba(0,0,0,.5), 0 0 0 1px rgba(255,255,255,.05) inset;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: tplDialogIn .3s ease;
}
@keyframes tplDialogIn {
  from { opacity: 0; transform: scale(.92) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.tpl-apk-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid rgba(148,163,184,.1);
}
.tpl-apk-dialog-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: #f1f5f9;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.tpl-apk-close {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: none;
  background: rgba(148,163,184,.1);
  color: #94a3b8;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tpl-apk-close:hover { background: rgba(239,68,68,.2); color: #fca5a5; }

.tpl-apk-dialog-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}
.tpl-apk-info p {
  font-size: 13px;
  color: #94a3b8;
  line-height: 1.6;
  margin: 0 0 16px;
}
.tpl-apk-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 20px;
}
.tpl-apk-form label {
  font-size: 11px;
  font-weight: 600;
  color: rgba(234,245,255,.7);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-top: 8px;
}
.tpl-apk-form input,
.tpl-apk-form textarea {
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(148,163,184,.15);
  background: rgba(30,41,59,.6);
  color: #f1f5f9;
  font-size: 13px;
  font-family: inherit;
  transition: border-color .2s;
}
.tpl-apk-form input:focus,
.tpl-apk-form textarea:focus {
  outline: none;
  border-color: #8b5cf6;
  box-shadow: 0 0 0 3px rgba(139,92,246,.15);
}

.tpl-apk-steps {
  padding: 16px;
  border-radius: 12px;
  background: rgba(139,92,246,.06);
  border: 1px solid rgba(139,92,246,.12);
}
.tpl-apk-steps h4 {
  font-size: 13px;
  font-weight: 600;
  color: #c4b5fd;
  margin: 0 0 12px;
}
.tpl-apk-step {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: #94a3b8;
  padding: 6px 0;
}
.tpl-apk-step-n {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(139,92,246,.2);
  color: #c4b5fd;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.tpl-apk-dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid rgba(148,163,184,.1);
}
.tpl-apk-cancel {
  padding: 9px 20px;
  border-radius: 10px;
  border: 1px solid rgba(148,163,184,.2);
  background: transparent;
  color: #94a3b8;
  font-size: 13px;
  cursor: pointer;
}
.tpl-apk-cancel:hover { border-color: rgba(148,163,184,.4); color: #e2e8f0; }
.tpl-apk-submit {
  padding: 9px 24px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, #3DDC84, #00C853);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all .2s;
  box-shadow: 0 4px 15px rgba(61,220,132,.25);
}
.tpl-apk-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(61,220,132,.4);
}
.tpl-apk-submit:disabled {
  opacity: .6;
  cursor: not-allowed;
  transform: none;
}

/* === macOS-style glassmorphism cards ─── */
.tpl-card {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.tpl-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.12), transparent);
  pointer-events: none;
}
.tpl-card { position: relative; }

/* 3D tilt on hover */
.tpl-card:hover {
  transform: translateY(-4px) perspective(800px) rotateX(2deg);
}

/* Animated gradient border on active card */
@keyframes tplBorderGlow {
  0%, 100% { border-color: rgba(139,92,246,.3); }
  50% { border-color: rgba(96,165,250,.4); }
}
.tpl-card:hover {
  animation: tplBorderGlow 2s ease infinite;
}

/* Icon bounce on platform cards */
@keyframes tplIconBounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15) rotate(-3deg); }
}
.tpl-platform-card:hover .tpl-platform-icon {
  animation: tplIconBounce .5s ease;
}

/* Responsive for dual platform */
@media (max-width: 700px) {
  .tpl-dual-platform { grid-template-columns: 1fr; }
  .tpl-apk-dialog { width: 95vw; }
}
