:root {
  --font-scale: 16px;
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-muted: #64748b;
  --primary: #2563eb;
  --primary-soft: #eff6ff;
  --primary-border: #bfdbfe;
  --primary-text: #1d4ed8;
  --radius-lg: 18px;
  --radius-md: 12px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 10px 26px rgba(15, 23, 42, 0.07);
  --topbar-h: 62px;
  --sidebar-w: 262px;
  --sidebar-rail-w: 72px;
}

body.dark-mode {
  --bg: #0b1120;
  --surface: #111827;
  --surface-2: #1e293b;
  --border: #283548;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --primary-soft: rgba(59, 130, 246, 0.16);
  --primary-border: rgba(96, 165, 250, 0.34);
  --primary-text: #93c5fd;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 12px 28px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: var(--font-scale); scroll-behavior: smooth; }
body {
  font-family: 'Sarabun', 'Plus Jakarta Sans', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
.hidden { display: none !important; }

.svg-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  vertical-align: middle;
  line-height: 1;
}

/* Announcement Bar */
.announce-bar {
  background: var(--primary-soft);
  color: var(--primary-text);
  border-bottom: 1px solid var(--primary-border);
  padding: 0.42rem 1rem;
  text-align: center;
  font-size: 0.86rem;
  font-weight: 500;
}

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--topbar-h);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0 1rem;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 0.45rem; flex-shrink: 0; }
.topbar-center { flex: 1; max-width: 410px; margin: 0 auto; }

/* ปุ่มวิธีการเพิ่ม API Key ส่วนตัว บนแถบด้านบน */
.api-guide-btn {
  height: 36px;
  padding: 0 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--primary-border);
  background: var(--primary-soft);
  color: var(--primary-text);
  font-size: 0.84rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.42rem;
  white-space: nowrap;
  flex-shrink: 0;
  transition: 0.16s ease;
}
.api-guide-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}
.api-guide-btn.active {
  background: var(--text);
  border-color: var(--text);
  color: var(--surface);
}

.icon-btn, .chip-tool-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  height: 36px;
  min-width: 36px;
  border-radius: 10px;
  padding: 0 0.6rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  transition: 0.16s ease;
  font-size: 0.84rem;
  font-weight: 600;
}
.icon-btn:hover, .chip-tool-btn:hover { background: var(--surface-2); border-color: var(--primary-border); }

.brand-link { display: flex; align-items: center; gap: 0.6rem; color: var(--text); }
.brand-logo-wrap {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
}
.brand-logo-wrap img { width: 100%; height: 100%; object-fit: cover; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-title { font-family: 'Plus Jakarta Sans', 'Sarabun', sans-serif; font-weight: 700; font-size: 0.98rem; }
.brand-sub { font-size: 0.74rem; color: var(--text-muted); }

.search-box {
  display: flex;
  align-items: center;
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0 0.85rem;
  height: 38px;
  transition: 0.16s;
}
.search-box:focus-within { background: var(--surface); border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.search-icon { color: var(--text-muted); flex-shrink: 0; margin-right: 0.45rem; }
.search-box input { border: none; background: transparent; width: 100%; outline: none; font-size: 0.9rem; }
.search-clear { border: none; background: transparent; cursor: pointer; color: var(--text-muted); display: inline-flex; padding: 0.15rem; }

.font-size-group {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
}
.font-size-group button {
  border: none;
  background: transparent;
  padding: 0 0.48rem;
  height: 34px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  border-right: 1px solid var(--border);
}
.font-size-group button:last-child { border-right: none; }
.font-size-group button:hover, .font-size-group button.active { background: var(--primary-soft); color: var(--primary-text); }

/* Shell & Collapsible Sidebar */
.app-shell { display: flex; min-height: calc(100vh - var(--topbar-h)); }
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(3px);
  z-index: 30;
}
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  transition: width 0.2s cubic-bezier(0.4, 0, 0.2, 1), transform 0.22s ease;
  padding: 0.8rem 0.6rem;
  z-index: 35;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 0.18rem; }
.nav-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.7rem 0.3rem;
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}
.nav-divider { height: 1px; background: var(--border); margin: 0.5rem 0.4rem; }
.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.52rem 0.72rem;
  border-radius: 999px;
  color: var(--text);
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  transition: 0.15s ease;
  border: 1px solid transparent;
  white-space: nowrap;
}
.nav-item:hover { background: var(--surface-2); }
.nav-item.active {
  background: var(--primary-soft);
  color: var(--primary-text);
  border-color: var(--primary-border);
  font-weight: 600;
}
.nav-item-left { display: flex; align-items: center; gap: 0.6rem; min-width: 0; overflow: hidden; }
.nav-icon { width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.nav-label { overflow: hidden; text-overflow: ellipsis; }
.nav-count {
  font-size: 0.72rem;
  padding: 0.06rem 0.45rem;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-muted);
  font-weight: 600;
}
.nav-item.active .nav-count { background: var(--text); color: var(--surface); }

/* Sidebar Bottom Card + Gear Admin Button */
.sidebar-footer {
  margin-top: 0.9rem;
  padding: 0.6rem 0.7rem;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
}
.sidebar-footer-info { min-width: 0; flex: 1; font-size: 0.74rem; color: var(--text-muted); line-height: 1.38; }
.sidebar-footer-title { font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-footer-mail {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.sidebar-footer-mail:hover { color: var(--text); }
.sidebar-gear-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: 0.16s ease;
}
.sidebar-gear-btn:hover { background: var(--surface); border-color: var(--border); color: var(--text); }

@media (min-width: 901px) {
  body.sidebar-collapsed .sidebar { width: var(--sidebar-rail-w); padding: 0.8rem 0.45rem; }
  body.sidebar-collapsed .nav-label,
  body.sidebar-collapsed .nav-count,
  body.sidebar-collapsed .nav-section-header,
  body.sidebar-collapsed .sidebar-footer-info { display: none; }
  body.sidebar-collapsed .nav-group-items.collapsed-group { display: flex !important; }
  body.sidebar-collapsed .nav-item { justify-content: center; padding: 0.6rem 0; border-radius: 13px; }
  body.sidebar-collapsed .nav-item-left { justify-content: center; }
  body.sidebar-collapsed .sidebar-footer { background: transparent; border-color: transparent; padding: 0.2rem 0; justify-content: center; }
}

/* Workspace */
.workspace { flex: 1; min-width: 0; }
.main-content { max-width: 1240px; width: 100%; margin: 0 auto; padding: 1.4rem 1.5rem 2.6rem; }

.hero-strip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}
.hero-strip h1 { font-size: 1.25rem; font-weight: 700; margin-bottom: 0.2rem; }
.hero-strip p { font-size: 0.9rem; color: var(--text-muted); }

.section-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.section-heading { font-size: 1.12rem; font-weight: 700; display: flex; align-items: center; gap: 0.45rem; }

/* Minimal Square / Bento App Grid */
.apps-bento {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(235px, 1fr));
  gap: 0.9rem;
}
.apps-bento.compact {
  grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
  gap: 0.75rem;
}

.app-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.85rem;
  min-height: 156px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
  position: relative;
  text-align: left;
}
.apps-bento.compact .app-tile {
  padding: 0.95rem 1rem;
  min-height: 136px;
  gap: 0.65rem;
}

.app-tile.is-linked { cursor: pointer; }
.app-tile.is-linked:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-border);
}
.app-tile.is-soon { cursor: default; }
.app-tile.is-soon:hover { border-color: var(--border); }

.tile-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}
.tile-icon {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}
.apps-bento.compact .tile-icon { width: 40px; height: 40px; border-radius: 11px; }
.tile-icon img { width: 100%; height: 100%; object-fit: cover; }
.app-tile.is-linked:hover .tile-icon {
  background: var(--primary-soft);
  border-color: var(--primary-border);
  color: var(--primary-text);
}

.tile-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--text-muted);
}
.tile-arrow {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: transform 0.16s ease, background 0.16s ease, color 0.16s ease;
}
.app-tile.is-linked:hover .tile-arrow {
  background: var(--primary-soft);
  color: var(--primary-text);
  transform: translate(2px, -2px);
}
.soon-pill {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
}

.tile-body { display: flex; flex-direction: column; gap: 0.25rem; }
.tile-title {
  font-weight: 700;
  font-size: 0.98rem;
  color: var(--text);
  line-height: 1.3;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.tile-desc {
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.48;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* API Key Guide Page Styles */
.guide-wrap {
  max-width: 980px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.guide-hero {
  background: linear-gradient(135deg, var(--primary-soft), var(--surface));
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-lg);
  padding: 1.75rem 1.85rem;
  box-shadow: var(--shadow-sm);
}
.guide-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 0.65rem;
}
.guide-hero h1 {
  font-size: 1.48rem;
  font-weight: 700;
  line-height: 1.32;
  margin-bottom: 0.45rem;
}
.guide-hero p {
  color: var(--text-muted);
  font-size: 0.95rem;
  max-width: 740px;
  line-height: 1.65;
}
.guide-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.15rem;
}
.guide-benefit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 0.85rem;
}
.guide-benefit-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.2rem 1.25rem;
  box-shadow: var(--shadow-sm);
}
.guide-benefit-top {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.45rem;
  font-weight: 700;
  font-size: 0.98rem;
}
.guide-benefit-ico {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.guide-benefit-card p {
  font-size: 0.87rem;
  color: var(--text-muted);
  line-height: 1.58;
}

/* Mode Selector Tabs (First-time vs Multi-app) */
.guide-mode-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.65rem;
  box-shadow: var(--shadow-sm);
}
.guide-mode-tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.7rem;
  margin-bottom: 1.35rem;
}
.guide-mode-btn {
  text-align: left;
  padding: 0.95rem 1.1rem;
  border-radius: 14px;
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  cursor: pointer;
  transition: 0.16s ease;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}
.guide-mode-btn:hover {
  border-color: var(--primary-border);
}
.guide-mode-btn.active {
  background: var(--primary-soft);
  border-color: var(--primary);
}
.guide-mode-num {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.84rem;
  flex-shrink: 0;
}
.guide-mode-btn.active .guide-mode-num {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}
.guide-mode-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  display: block;
}
.guide-mode-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.12rem;
  display: block;
}

/* Step-by-Step List & Mockups */
.step-list {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
.step-item {
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 14px;
  padding: 1.15rem 1.25rem;
  display: flex;
  gap: 0.95rem;
  align-items: flex-start;
}
.step-badge {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--text);
  color: var(--surface);
  font-weight: 700;
  font-size: 0.88rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 0.1rem;
}
.step-body { flex: 1; min-width: 0; }
.step-title { font-weight: 700; font-size: 1rem; margin-bottom: 0.3rem; color: var(--text); }
.step-desc { font-size: 0.9rem; color: var(--text-muted); line-height: 1.62; }
.step-desc strong { color: var(--text); }
.step-desc code {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0.08rem 0.42rem;
  border-radius: 6px;
  font-size: 0.84rem;
  color: var(--text);
}

/* Visual UI Wireframe Mockup inside Guide */
.ui-mock {
  margin-top: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 0.75rem 0.95rem;
  font-size: 0.82rem;
  overflow-x: auto;
}
.ui-mock-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-width: 340px;
}
.ui-mock-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.32rem 0.75rem;
  border-radius: 999px;
  border: 1.5px solid var(--primary);
  background: var(--primary-soft);
  color: var(--primary-text);
  font-weight: 700;
}
.ui-mock-table {
  width: 100%;
  min-width: 440px;
  border-collapse: collapse;
  margin-top: 0.25rem;
}
.ui-mock-table th, .ui-mock-table td {
  text-align: left;
  padding: 0.45rem 0.55rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
}
.ui-mock-table th { color: var(--text-muted); font-weight: 600; }
.ui-mock-table tr:last-child td { border-bottom: none; }

.guide-tip-banner {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3.5px solid var(--primary);
  border-radius: 12px;
  padding: 0.95rem 1.15rem;
  margin-bottom: 1.1rem;
  font-size: 0.89rem;
  line-height: 1.6;
}

.faq-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 0.85rem;
  margin-top: 0.75rem;
}
.faq-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.1rem;
}
.faq-q { font-weight: 700; font-size: 0.92rem; margin-bottom: 0.3rem; color: var(--text); }
.faq-a { font-size: 0.85rem; color: var(--text-muted); line-height: 1.58; }

.promo-showcase {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.65rem;
  box-shadow: var(--shadow-sm);
}

/* Unified Single-Block Legal & About Pages */
.doc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.85rem 2rem;
  box-shadow: var(--shadow-sm);
}
.doc-card h1 { font-size: 1.32rem; margin-bottom: 0.35rem; display: flex; align-items: center; gap: 0.5rem; }
.doc-card h2 { font-size: 1.04rem; margin: 1.25rem 0 0.45rem; color: var(--text); }
.doc-card p, .doc-card li { font-size: 0.94rem; color: var(--text); margin-bottom: 0.48rem; }
.doc-card ul { padding-left: 1.3rem; margin-bottom: 0.75rem; }
.doc-card a { color: var(--primary); }

.about-unified { line-height: 1.85; }
.about-legal-th { font-size: 1.25rem; font-weight: 700; color: var(--text); }
.about-legal-en {
  font-family: 'Plus Jakarta Sans', 'Sarabun', sans-serif;
  font-size: 0.94rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}
.about-divider { height: 1px; background: var(--border); margin: 1rem 0 1.15rem; }
.about-lines p { margin-bottom: 0.42rem; font-size: 0.95rem; }
.about-lines .lbl { color: var(--text-muted); margin-right: 0.35rem; font-weight: 600; }

/* Buttons */
.btn-primary, .btn-outline, .btn-soft, .btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.38rem;
  padding: 0.48rem 0.95rem;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: 0.15s;
  white-space: nowrap;
}
.btn-primary { background: var(--text); color: var(--surface); }
.btn-primary:hover { opacity: 0.9; }
.btn-soft { background: var(--primary-soft); color: var(--primary-text); border-color: var(--primary-border); }
.btn-outline { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-outline:hover { background: var(--surface-2); }
.btn-danger { background: #fee2e2; color: #b91c1c; border-color: #fecaca; }

/* Admin Modal */
.admin-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.admin-dialog {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: min(1040px, 100%);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.admin-modal-body { overflow-y: auto; padding: 1.3rem; }
.admin-tabs { display: flex; gap: 0.4rem; overflow-x: auto; border-bottom: 1px solid var(--border); padding-bottom: 0.7rem; margin-bottom: 1.05rem; }
.admin-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  padding: 0.42rem 0.8rem;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  cursor: pointer;
  white-space: nowrap;
  font-weight: 600;
  font-size: 0.84rem;
}
.admin-tab.active { background: var(--text); color: var(--surface); border-color: var(--text); }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 0.8rem; margin-bottom: 0.8rem; }
.form-group { display: flex; flex-direction: column; gap: 0.28rem; margin-bottom: 0.7rem; }
.form-group label { font-size: 0.82rem; font-weight: 600; color: var(--text-muted); }
.form-control {
  padding: 0.48rem 0.72rem;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg);
  outline: none;
  font-size: 0.88rem;
}
.form-control:focus { border-color: var(--primary); }

.admin-row-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.65rem 0.85rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 0.5rem;
}
.icon-picker-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.5rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.icon-pick-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: var(--surface);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.icon-pick-btn.active { border-color: var(--text); background: var(--text); color: var(--surface); }

.theme-swatch-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.6rem; margin-bottom: 1rem; }
.theme-card {
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 0.65rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  background: var(--surface);
}
.theme-card.active { border-color: var(--primary); background: var(--primary-soft); }
.swatch-dot { width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0; }

/* Toast */
.toast-container { position: fixed; bottom: 1.2rem; right: 1.2rem; z-index: 100; display: flex; flex-direction: column; gap: 0.45rem; }
.toast {
  background: var(--text);
  color: var(--surface);
  padding: 0.6rem 0.95rem;
  border-radius: 10px;
  font-size: 0.86rem;
  font-weight: 500;
  box-shadow: var(--shadow-md);
}

/* Mobile Responsive */
@media (max-width: 980px) {
  .topbar { flex-wrap: wrap; height: auto; padding: 0.6rem 0.8rem; justify-content: space-between; }
  .topbar-left { order: 1; }
  .topbar-right { order: 2; }
  .api-guide-btn { order: 3; flex: 1 1 100%; height: 38px; }
  .topbar-center { order: 4; max-width: 100%; flex: 1 1 100%; margin: 0; }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 70;
    transform: translateX(-105%);
    box-shadow: var(--shadow-md);
  }
  body.drawer-open .sidebar { transform: translateX(0); }
  body.drawer-open .sidebar-backdrop { display: block; }
  .main-content { padding: 1.05rem 0.9rem 2rem; }
  .apps-bento { grid-template-columns: repeat(auto-fill, minmax(162px, 1fr)); gap: 0.7rem; }
  .app-tile { padding: 0.95rem; min-height: 142px; }
  .guide-hero, .guide-mode-box, .promo-showcase, .doc-card { padding: 1.25rem; }
  .step-item { flex-direction: column; gap: 0.6rem; }
}
@media (max-width: 460px) {
  .font-size-group { display: none; }
}