/* =====================================================================
   CupAut — design system
   Monochrome black & white theme · clean · minimal · chat-style search
   Palette: teal #20808D · ink #091717 · cream #FBFAF4
   ===================================================================== */

:root {
  /* THE THREE COLOURS: teal #20808D · ink #091717 · cream #FBFAF4 */
  --bg: #FBFAF4;
  --bg-2: #f2efe3;
  --card: #ffffff;
  --card-2: #faf8ef;
  /* neutrals are indigo-tinted ink so even greys belong to the palette */
  --text: #091717;
  --muted: #42605e;
  --muted-2: #5e7d7b;
  --border: rgba(9, 23, 23, 0.10);
  --border-strong: rgba(9, 23, 23, 0.18);
  /* PRIMARY: green (buttons, success, brand actions) */
  --accent: #20808D;
  --accent-600: #186671;
  --accent-soft: rgba(32, 128, 141, 0.09);
  --on-accent: #ffffff;
  /* SECONDARY: light indigo (links, focus, active states, info) */
  --indigo: #20808D;
  --indigo-600: #186671;
  --indigo-300: #5cb7c2;
  --indigo-soft: rgba(32, 128, 141, 0.10);
  --indigo-tint: #e8f1f0;
  /* the signature trio combination */
  --brand-grad: linear-gradient(135deg, #2ba3b0 0%, #14545c 100%);
  --brand-grad-soft: linear-gradient(135deg, rgba(32, 128, 141, 0.09), rgba(32, 128, 141, 0.11));
  --brand-blue: #20808D;
  --brand-green: #20808D;
  /* semantic */
  --green: #20808D;
  --red: #c0392b;
  --blue: #20808D;
  --purple: #20808D;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --shadow: 0 12px 32px -16px rgba(9, 23, 23, 0.22);
  --shadow-soft: 0 1px 2px rgba(9, 23, 23, 0.06), 0 8px 24px -18px rgba(9, 23, 23, 0.25);
  --shadow-md: 0 1px 1px rgba(9,23,23,0.04), 0 4px 8px -2px rgba(9,23,23,0.06), 0 12px 24px -8px rgba(9,23,23,0.08);
  --shadow-lg: 0 1px 1px rgba(9,23,23,0.04), 0 8px 16px -4px rgba(9,23,23,0.08), 0 24px 48px -12px rgba(9,23,23,0.14);
  --shadow-xl: 0 2px 4px rgba(9,23,23,0.05), 0 16px 32px -8px rgba(9,23,23,0.12), 0 40px 72px -16px rgba(9,23,23,0.2);
  --ring: 0 0 0 3px rgba(32, 128, 141, 0.22);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out: cubic-bezier(0.22, 0.7, 0.2, 1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}

::selection { background: rgba(13, 13, 13, 0.12); }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted-2); }

/* ---- Typography ---- */
.h-display { font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; }
.text-muted { color: var(--muted); }
.text-accent { color: var(--accent); }
.mono { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; }

/* ---- Surfaces ---- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}
.glass {
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(16px) saturate(120%);
  -webkit-backdrop-filter: blur(16px) saturate(120%);
  border: 1px solid var(--border);
}
.hairline { border-color: var(--border); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  font-weight: 600; font-size: 0.92rem; padding: 0.65rem 1.05rem;
  border-radius: var(--radius-sm); border: 1px solid transparent; cursor: pointer;
  transition: transform 0.12s ease, background 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  white-space: nowrap; user-select: none;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn-primary { background: var(--accent); color: var(--on-accent); box-shadow: 0 8px 20px -12px rgba(0, 0, 0, 0.55); }
.btn-primary:hover { background: var(--accent-600); box-shadow: 0 12px 26px -10px rgba(0, 0, 0, 0.6); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--accent-soft); }
.btn-soft { background: var(--accent-soft); color: var(--text); border-color: var(--border); }
.btn-soft:hover { background: rgba(13, 13, 13, 0.12); }
.btn-danger { background: transparent; color: var(--red); border-color: rgba(192, 57, 43, 0.4); }
.btn-danger:hover { background: rgba(192, 57, 43, 0.08); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { padding: 0.4rem 0.7rem; font-size: 0.82rem; }

/* ---- Inputs ---- */
.input, select.input, textarea.input {
  width: 100%; background: var(--bg); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 0.7rem 0.9rem; font-size: 0.95rem; outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input::placeholder { color: var(--muted-2); }
.input:focus { border-color: var(--accent); box-shadow: var(--ring); }
.label { font-size: 0.8rem; color: var(--muted); font-weight: 600; margin-bottom: 0.35rem; display: block; }

/* ---- Badges / chips ---- */
.badge { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.72rem; font-weight: 700; padding: 0.2rem 0.55rem; border-radius: 999px; }
.badge-accent { background: var(--accent); color: var(--on-accent); }
.badge-green { background: rgba(26, 127, 75, 0.12); color: var(--green); }
.badge-red { background: rgba(192, 57, 43, 0.12); color: var(--red); }
.badge-blue { background: rgba(37, 99, 235, 0.12); color: var(--blue); }
.badge-muted { background: var(--accent-soft); color: var(--muted); }

/* ---- Chips ---- */
.chip { border: 1px solid var(--border-strong); border-radius: 999px; padding: 0.4rem 0.85rem; font-size: 0.84rem; color: var(--text); background: var(--bg); cursor: pointer; transition: all 0.15s; }
.chip:hover { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }

/* ---- Tables ---- */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted-2); padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--border); }
.table td { padding: 0.8rem 0.9rem; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.table tr:hover td { background: var(--accent-soft); }

/* ---- Sidebar nav ---- */
.nav-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 0.85rem; border-radius: var(--radius-sm); color: var(--muted); font-weight: 500; cursor: pointer; transition: all 0.15s; font-size: 0.9rem; }
.nav-item:hover { color: var(--text); background: var(--accent-soft); }
.nav-item.active { color: var(--text); background: var(--accent-soft); box-shadow: inset 2px 0 0 var(--accent); font-weight: 600; }
.nav-item svg { width: 18px; height: 18px; flex: none; }

/* ---- Coupon card ---- */
.coupon-card { position: relative; overflow: hidden; transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease; }
.coupon-card:hover { transform: translateY(-3px); border-color: var(--border-strong); box-shadow: var(--shadow); }
.coupon-card .code-pill { font-family: ui-monospace, monospace; letter-spacing: 0.08em; border: 1px dashed var(--border-strong); border-radius: 8px; padding: 0.4rem 0.7rem; }

/* ---- Skeleton loaders ---- */
.skeleton { position: relative; overflow: hidden; background: var(--bg-2); border-radius: 8px; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.05), transparent); animation: shimmer 1.3s infinite; }
@keyframes shimmer { 100% { transform: translateX(100%); } }

/* ---- Toasts ---- */
#toasts { position: fixed; top: 1rem; right: 1rem; z-index: 1000; display: flex; flex-direction: column; gap: 0.6rem; }
.toast { min-width: 260px; max-width: 360px; padding: 0.8rem 1rem; border-radius: var(--radius-sm); background: var(--card); border: 1px solid var(--border-strong); box-shadow: var(--shadow); animation: toastIn 0.25s ease; font-size: 0.9rem; }
.toast.ok { border-left: 3px solid var(--green); }
.toast.err { border-left: 3px solid var(--red); }
.toast.info { border-left: 3px solid var(--accent); }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } }

/* ---- Command palette (Ctrl+K) ---- */
#cmdk { position: fixed; inset: 0; z-index: 1100; display: none; align-items: flex-start; justify-content: center; padding-top: 12vh; background: rgba(13, 13, 13, 0.28); backdrop-filter: blur(6px); }
#cmdk.open { display: flex; animation: fadeIn 0.15s ease; }
#cmdk .panel { width: min(640px, 92vw); }
.cmdk-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.7rem 1rem; border-radius: 10px; cursor: pointer; color: var(--muted); }
.cmdk-item.active, .cmdk-item:hover { background: var(--accent-soft); color: var(--text); }
@keyframes fadeIn { from { opacity: 0; } }

/* ---- Modal ---- */
.modal-backdrop { position: fixed; inset: 0; z-index: 1050; display: none; align-items: center; justify-content: center; padding: 1rem; background: rgba(13, 13, 13, 0.32); backdrop-filter: blur(4px); }
.modal-backdrop.open { display: flex; animation: fadeIn 0.15s ease; }
.modal { width: min(520px, 94vw); max-height: 88vh; overflow-y: auto; animation: modalIn 0.2s ease; }
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(0.98); } }

/* ---- Utility ---- */
.fade-up { animation: fadeUp 0.45s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } }
.stagger > * { animation: fadeUp 0.45s ease both; }
.stagger > *:nth-child(2) { animation-delay: 0.05s; }
.stagger > *:nth-child(3) { animation-delay: 0.1s; }
.stagger > *:nth-child(4) { animation-delay: 0.15s; }
.stagger > *:nth-child(5) { animation-delay: 0.2s; }
.stagger > *:nth-child(6) { animation-delay: 0.25s; }
.gradient-text { color: var(--accent); }
.grid-bg { background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px); background-size: 44px 44px; -webkit-mask-image: radial-gradient(ellipse at 50% 0%, #000 30%, transparent 75%); mask-image: radial-gradient(ellipse at 50% 0%, #000 30%, transparent 75%); }
.hide { display: none !important; }
.spinner { width: 16px; height: 16px; border: 2px solid rgba(13,13,13,0.2); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.ok { background: var(--green); box-shadow: 0 0 8px rgba(26,127,75,0.5); }
.dot.bad { background: var(--red); box-shadow: 0 0 8px rgba(192,57,43,0.5); }

/* ---- Brand mark (monochrome) ---- */
.brand-mark {
  display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: var(--on-accent);
  font-weight: 900; border-radius: 9px;
}

/* Uploaded logo. The mark keeps its size, radius and alignment and simply
   becomes a frame, so a custom logo drops into every header, sidebar and
   auth screen without a single template change. */
.brand-mark.has-logo {
  background: none !important;
  background-image: none !important;
  box-shadow: none !important;
  overflow: hidden;
}
.brand-mark.has-logo > img.brand-logo {
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
}

/* ---- Branding uploader (admin) ---- */
.logo-drop {
  display: flex; align-items: center; gap: 1rem;
  padding: 1rem; border-radius: 14px;
  border: 1.5px dashed var(--border);
  background: var(--card);
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
  cursor: pointer;
}
.logo-drop:hover { border-color: var(--accent); background: rgba(0,0,0,0.015); }
.logo-drop.is-dragging { border-color: var(--accent); background: rgba(0,0,0,0.04); transform: translateY(-1px); }
.logo-drop.is-busy { opacity: .6; pointer-events: none; }
.logo-drop__preview {
  width: 62px; height: 62px; flex: none;
  display: flex; align-items: center; justify-content: center;
  border-radius: 12px; border: 1px solid var(--border);
  background:
    linear-gradient(45deg, rgba(0,0,0,0.045) 25%, transparent 25%, transparent 75%, rgba(0,0,0,0.045) 75%),
    linear-gradient(45deg, rgba(0,0,0,0.045) 25%, transparent 25%, transparent 75%, rgba(0,0,0,0.045) 75%);
  background-size: 12px 12px;
  background-position: 0 0, 6px 6px;
  overflow: hidden;
}
.logo-drop__preview img { width: 100%; height: 100%; object-fit: contain; }
.logo-drop__preview .placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 1.15rem;
  background: var(--accent); color: var(--on-accent);
}
.logo-drop__body { min-width: 0; }
.logo-drop__label { font-weight: 700; font-size: 0.92rem; }
.logo-drop__hint { color: var(--muted); font-size: 0.78rem; margin-top: 2px; }
.brand-preview-bar {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.85rem 1rem; border-radius: 12px; border: 1px solid var(--border);
}
.brand-preview-bar.on-dark { background: #0d0d0d; color: #fff; border-color: rgba(255,255,255,0.14); }

/* =====================================================================
   chat-style coupon search
   ===================================================================== */
.chat-shell {
  display: flex; flex-direction: column;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--card); box-shadow: var(--shadow-soft); overflow: hidden;
}
.chat-thread {
  display: flex; flex-direction: column; gap: 1.4rem;
  padding: 1.5rem; overflow-y: auto; scroll-behavior: smooth;
}
.chat-empty { text-align: center; color: var(--muted); padding: 2.5rem 1rem; }

/* a single turn */
.chat-row { display: flex; gap: 0.85rem; align-items: flex-start; animation: fadeUp 0.35s ease both; }
.chat-row.user { flex-direction: row-reverse; }
.chat-avatar {
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 0.78rem;
}
.chat-avatar.bot { background: var(--accent); color: var(--on-accent); }
.chat-avatar.bot svg { width: 17px; height: 17px; }
.chat-avatar.user { background: var(--accent-soft); color: var(--text); border: 1px solid var(--border); }

.chat-bubble {
  max-width: 80%; padding: 0.8rem 1rem; border-radius: 14px;
  font-size: 0.95rem; line-height: 1.5;
}
.chat-row.user .chat-bubble { background: var(--accent); color: var(--on-accent); border-bottom-right-radius: 4px; }
.chat-row.bot .chat-bubble { background: var(--bg-2); color: var(--text); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.chat-bubble.full { max-width: 100%; width: 100%; background: transparent; border: none; padding: 0; }

.chat-meta { font-size: 0.74rem; color: var(--muted); margin-top: 0.5rem; }

/* typing indicator */
.typing { display: inline-flex; align-items: center; gap: 5px; padding: 0.35rem 0; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted-2); animation: typing 1.2s infinite ease-in-out; }
.typing span:nth-child(2) { animation-delay: 0.18s; }
.typing span:nth-child(3) { animation-delay: 0.36s; }
@keyframes typing { 0%, 60%, 100% { transform: translateY(0); opacity: 0.5; } 30% { transform: translateY(-5px); opacity: 1; } }

/* chat composer (sticky input like a chat app) */
.chat-composer {
  border-top: 1px solid var(--border); background: var(--card);
  padding: 0.75rem; display: flex; align-items: flex-end; gap: 0.6rem;
}
.chat-composer .input-wrap {
  flex: 1; display: flex; align-items: center; gap: 0.5rem;
  background: var(--bg-2); border: 1px solid var(--border-strong);
  border-radius: 14px; padding: 0.5rem 0.75rem; transition: border-color 0.2s, box-shadow 0.2s;
}
.chat-composer .input-wrap:focus-within { border-color: var(--accent); box-shadow: var(--ring); }
.chat-composer textarea {
  flex: 1; border: none; background: transparent; resize: none; outline: none;
  font-family: inherit; font-size: 1rem; color: var(--text); line-height: 1.45;
  max-height: 140px; padding: 0.25rem 0;
}
.chat-send {
  width: 38px; height: 38px; flex: none; border-radius: 10px; border: none; cursor: pointer;
  background: var(--accent); color: var(--on-accent);
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.2s, transform 0.12s;
}
.chat-send:hover { transform: translateY(-1px); }
.chat-send:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }
.chat-send svg { width: 18px; height: 18px; }

.chat-suggest { display: flex; flex-wrap: wrap; gap: 0.5rem; }


/* =====================================================================
   App shell layout + mobile responsiveness
   ===================================================================== */
.app-shell { display: flex; min-height: 100vh; }

.app-sidebar {
  width: 248px; flex: none;
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  border-top: none; border-bottom: none; border-left: none;
  z-index: 60;
}
.app-main { flex: 1; min-width: 0; }

/* hamburger + overlay are hidden on desktop */
.menu-btn { display: none; align-items: center; justify-content: center; width: 38px; height: 38px; padding: 0; flex: none; }
.menu-btn svg { width: 20px; height: 20px; }
.sidebar-overlay {
  position: fixed; inset: 0; background: rgba(13, 13, 13, 0.4);
  z-index: 55; opacity: 0; pointer-events: none; transition: opacity 0.25s ease;
  backdrop-filter: blur(2px);
}

/* ---- Tablet / mobile: turn the sidebar into an off-canvas drawer ---- */
@media (max-width: 900px) {
  .app-sidebar {
    position: fixed; top: 0; left: 0; height: 100dvh;
    transform: translateX(-100%);
    transition: transform 0.28s ease;
    box-shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.45);
    /* solid (not glass) so text stays readable over page content */
    background: var(--card);
    -webkit-backdrop-filter: none; backdrop-filter: none;
  }
  .app-sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { opacity: 1; pointer-events: auto; }
  .menu-btn { display: inline-flex; }
}

/* ---- Phone: tighten spacing ---- */
@media (max-width: 640px) {
  #view { padding: 1rem !important; }
  .app-header { padding-left: 0.75rem !important; padding-right: 0.75rem !important; gap: 0.5rem; }
  .chat-thread { padding: 1rem; gap: 1.1rem; }
  .chat-bubble { max-width: 88%; font-size: 0.92rem; }
  .chat-composer { padding: 0.6rem; }
  .chat-row { gap: 0.6rem; }
}

/* let the global header search shrink gracefully instead of overflowing */
.header-search { min-width: 0; }
@media (max-width: 480px) {
  .header-search .input { font-size: 0.9rem; }
}


/* Dashboard chat fills the viewport height (dvh handles mobile browser chrome) */
.chat-fill { height: calc(100vh - 8.5rem); height: calc(100dvh - 8.5rem); }
@media (max-width: 640px) {
  .chat-fill { height: calc(100dvh - 11rem); }
}


/* =====================================================================
   chat-style sidebar: chat history + bottom account menu
   ===================================================================== */
.app-sidebar #nav { scrollbar-width: thin; align-content: start; }
.chat-hist { position: relative; padding-right: 2rem; }
.chat-hist-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.chat-hist-del {
  position: absolute; right: 0.5rem; top: 50%; transform: translateY(-50%);
  width: 26px; height: 26px; display: none; align-items: center; justify-content: center;
  border-radius: 7px; color: var(--muted);
}
.chat-hist-del svg { width: 15px; height: 15px; }
.chat-hist:hover .chat-hist-del { display: flex; }
.chat-hist-del:hover { background: rgba(192, 57, 43, 0.12); color: var(--red); }

.sidebar-foot { position: relative; border-top: 1px solid var(--border); padding: 0.6rem; }
.acct-btn {
  width: 100%; display: flex; align-items: center; gap: 0.6rem;
  padding: 0.5rem 0.6rem; border-radius: 12px; border: 1px solid transparent;
  background: transparent; cursor: pointer; color: var(--text); transition: background 0.15s;
}
.acct-btn:hover { background: var(--accent-soft); }
.acct-avatar { width: 30px; height: 30px; border-radius: 50%; flex: none; background: var(--accent); color: var(--on-accent); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.85rem; }
.acct-menu {
  position: absolute; left: 0.6rem; right: 0.6rem; bottom: calc(100% - 0.2rem);
  background: var(--card); border: 1px solid var(--border-strong); border-radius: 14px;
  box-shadow: var(--shadow); padding: 0.4rem; z-index: 70; max-height: 70vh; overflow-y: auto;
  animation: modalIn 0.16s ease;
}
.acct-item { display: flex; align-items: center; gap: 0.6rem; padding: 0.55rem 0.7rem; border-radius: 9px; color: var(--text); text-decoration: none; font-size: 0.9rem; border: none; background: transparent; cursor: pointer; text-align: left; }
.acct-item:hover { background: var(--accent-soft); }
.acct-item.active { background: var(--accent-soft); font-weight: 600; }
.acct-sep { height: 1px; background: var(--border); margin: 0.35rem 0.3rem; }

/* =====================================================================
   Refined chat-style chat (centered, compact, calm)
   ===================================================================== */
.chat-page { height: 100%; }
.chat-thread { padding: 1.25rem 1rem; gap: 1.1rem; }
.chat-thread > .chat-row { width: 100%; max-width: 760px; margin-left: auto; margin-right: auto; }
.chat-thread > .chat-empty { max-width: 760px; margin-left: auto; margin-right: auto; }
.chat-row { gap: 0.7rem; }
.chat-avatar { width: 28px; height: 28px; border-radius: 7px; font-size: 0.72rem; }
.chat-avatar.bot svg { width: 16px; height: 16px; }
.chat-bubble { padding: 0.7rem 0.95rem; border-radius: 13px; font-size: 0.94rem; line-height: 1.55; max-width: 78%; }
.chat-row.bot .chat-bubble.full { background: transparent; border: none; padding: 0; }
.chat-composer { padding: 0.85rem 1rem 1rem; }
.chat-composer .input-wrap { max-width: 760px; margin: 0 auto; width: 100%; }

/* The dashboard chat fills the viewport (no page title above it now) */
.chat-fill { height: calc(100vh - 7.5rem); height: calc(100dvh - 7.5rem); }
@media (max-width: 640px) { .chat-fill { height: calc(100dvh - 8rem); } }


/* =====================================================================
   Marketing / legal content pages
   ===================================================================== */
.page-wrap { max-width: 820px; margin: 0 auto; padding: 3rem 1.25rem; }
.page-hero { max-width: 760px; margin: 0 auto; padding: 3.5rem 1.25rem 1rem; text-align: center; }
.prose { color: var(--text); line-height: 1.7; }
.prose h2 { font-size: 1.3rem; font-weight: 800; letter-spacing: -0.01em; margin: 2rem 0 0.6rem; }
.prose h3 { font-size: 1.05rem; font-weight: 700; margin: 1.4rem 0 0.4rem; }
.prose p { margin: 0 0 0.9rem; color: var(--muted); }
.prose ul { margin: 0 0 1rem; padding-left: 1.2rem; color: var(--muted); }
.prose li { margin: 0.3rem 0; }
.prose a { color: var(--accent); text-decoration: underline; }
.prose strong { color: var(--text); }


/* =====================================================================
   Premium chat-style chat (final pass)
   - Assistant replies render as clean text (no gray box), avatar at left
   - Dashboard chat is seamless/full-bleed (no surrounding card)
   - User messages keep a subtle solid bubble on the right
   ===================================================================== */
.chat-row.bot .chat-bubble,
.chat-row.bot .chat-bubble.full {
  background: transparent;
  border: none;
  padding: 0;
  max-width: 100%;
  color: var(--text);
}
.chat-row.bot .chat-bubble p { margin: 0 0 0.5rem; }
.chat-row.bot .chat-bubble > :last-child { margin-bottom: 0; }

/* Bot/typing rows align cleanly to the top */
.chat-row.bot { align-items: flex-start; }
.chat-avatar.bot { background: var(--accent); color: var(--on-accent); box-shadow: 0 2px 8px -3px rgba(0,0,0,0.4); }

/* User bubble: calmer, rounded, premium */
.chat-row.user .chat-bubble {
  background: var(--accent);
  color: var(--on-accent);
  border-radius: 16px;
  border-bottom-right-radius: 5px;
  max-width: 80%;
}

/* Typing indicator without a box */
.chat-row.bot .typing { padding: 0.15rem 0; }

/* Dashboard chat: seamless, no card frame */
.chat-shell.chat-fill {
  border: none;
  box-shadow: none;
  border-radius: 0;
  background: transparent;
}
.chat-shell.chat-fill .chat-thread { padding-top: 1.75rem; }
.chat-shell.chat-fill .chat-composer { background: transparent; }

/* Roomier, readable assistant copy + result grid spacing */
.chat-thread { gap: 1.6rem; }
.chat-row .chat-bubble { font-size: 0.95rem; line-height: 1.6; }
.chat-row.bot .chat-bubble .grid { margin-top: 0.7rem; }
.chat-meta { margin-top: 0.7rem; opacity: 0.9; }


/* =====================================================================
   Admin live logs console
   ===================================================================== */
.live-console {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.8rem; line-height: 1.7;
  max-height: 460px; overflow-y: auto;
  padding: 0.75rem 1rem; background: var(--bg-2);
}
.live-line { white-space: pre-wrap; word-break: break-word; padding: 1px 0; }
.live-line .lt { color: var(--muted-2); }
.live-line .lj { color: var(--blue); font-weight: 700; }
.live-line .lc { color: var(--green); font-weight: 700; }
.live-line .lcode { background: var(--accent); color: var(--on-accent); border-radius: 5px; padding: 0 6px; }
.live-line .le { color: var(--red); }
.live-line .ls-ok { color: var(--green); font-weight: 700; }
.live-line .ls-bad { color: var(--red); font-weight: 700; }
.live-line .ls-run { color: var(--blue); font-weight: 700; }
.live-line .ls-queue { color: var(--muted); }


/* =====================================================================
   Professional footer
   ===================================================================== */
.site-footer { margin-top: 4rem; background: var(--bg-2); border-top: 1px solid var(--border); }
.footer-col-title { font-weight: 700; font-size: 0.8rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted-2); margin-bottom: 0.9rem; }
.footer-link { color: var(--muted); text-decoration: none; font-size: 0.9rem; transition: color 0.15s; }
.footer-link:hover { color: var(--text); }
.footer-social {
  width: 34px; height: 34px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-strong); color: var(--muted); transition: all 0.15s;
}
.footer-social:hover { background: var(--accent); color: var(--on-accent); border-color: var(--accent); transform: translateY(-2px); }
.footer-social svg { width: 17px; height: 17px; }
.footer-bottom { border-top: 1px solid var(--border); }


/* =====================================================================
   In-chat ad unit (shown after assistant responses when ads are enabled)
   ===================================================================== */
.chat-ad {
  width: 100%; max-width: 760px; margin: 0.25rem auto 0;
  border: 1px solid var(--border); border-radius: 12px; background: var(--card);
  padding: 0.6rem 0.85rem; overflow: hidden;
}
.chat-ad-label {
  font-size: 0.62rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted-2); margin-bottom: 0.4rem;
}
.chat-ad-slot { min-height: 0; }
.chat-ad-slot .adsbygoogle { display: block; }

/* ---- Support / donation card (UPI / Razorpay QR after chat responses) ---- */
.chat-support {
  width: 100%; max-width: 760px; margin: 0.4rem auto 0;
  border: 1px solid var(--border-strong); border-radius: 14px;
  background: linear-gradient(180deg, var(--accent-soft), var(--card));
  padding: 0.95rem 1.05rem; text-align: center; box-shadow: var(--shadow-soft);
}
.chat-support-head { display: inline-flex; align-items: center; gap: 0.45rem; font-size: 0.98rem; }
.chat-support-head .cs-ico { width: 17px; height: 17px; display: inline-flex; color: var(--accent); }
.chat-support-msg { color: var(--muted); font-size: 0.88rem; line-height: 1.5; margin: 0.4rem auto 0.7rem; max-width: 460px; }
.chat-support-qr { width: 150px; height: 150px; object-fit: contain; border-radius: 12px; border: 1px solid var(--border); background: #fff; padding: 6px; display: block; margin: 0 auto; }
.chat-support-scan { font-size: 0.72rem; color: var(--muted-2); margin-top: 0.4rem; }
.chat-support-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; margin-top: 0.8rem; }

/* ---- Custom promo banner (admin-defined, after chat responses) ---- */
.chat-banner {
  display: flex; align-items: center; gap: 0.9rem;
  width: 100%; max-width: 760px; margin: 0.4rem auto 0;
  border: 1px solid var(--border-strong); border-radius: 14px;
  background: var(--card); padding: 0.8rem 0.95rem; box-shadow: var(--shadow-soft);
  text-decoration: none; color: var(--text);
  transition: transform 0.18s ease, box-shadow 0.22s ease, border-color 0.18s ease;
}
a.chat-banner-link:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--accent); }
.chat-banner-img { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; flex: none; }
.chat-banner-body { flex: 1; min-width: 0; }
.chat-banner-title { font-weight: 700; font-size: 0.95rem; }
.chat-banner-text { color: var(--muted); font-size: 0.85rem; line-height: 1.45; margin-top: 0.15rem; }
.chat-banner-cta { margin-top: 0.55rem; }
.chat-banner-raw { display: block; padding: 0; border: none; background: transparent; box-shadow: none; }


/* =====================================================================
   Premium motion & polish (scroll reveal, icon micro-animations, marquee)
   ===================================================================== */
@media (prefers-reduced-motion: no-preference) {
  .reveal { opacity: 0; transform: translateY(20px); transition: opacity 0.7s cubic-bezier(0.22, 0.7, 0.2, 1), transform 0.7s cubic-bezier(0.22, 0.7, 0.2, 1); will-change: opacity, transform; }
  .reveal.in { opacity: 1; transform: none; }
  .reveal-delay-1 { transition-delay: 0.06s; }
  .reveal-delay-2 { transition-delay: 0.12s; }
  .reveal-delay-3 { transition-delay: 0.18s; }
}

/* Animated icon tiles */
.feature-ico { transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.28s ease; }
.bento:hover .feature-ico { transform: translateY(-3px) rotate(-4deg) scale(1.06); box-shadow: 0 10px 24px -12px rgba(0, 0, 0, 0.5); }

/* Bento sheen on hover (subtle, monochrome) */
.bento { position: relative; overflow: hidden; }
.bento::after { content: ""; position: absolute; top: 0; left: -60%; width: 40%; height: 100%; background: linear-gradient(100deg, transparent, rgba(0, 0, 0, 0.04), transparent); transform: skewX(-18deg); transition: left 0.6s ease; pointer-events: none; }
.bento:hover::after { left: 130%; }

/* Logo marquee */
.marquee-mask { overflow: hidden; -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent); mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent); }
.logo-marquee { display: flex; gap: 3rem; width: max-content; align-items: center; }
@media (prefers-reduced-motion: no-preference) {
  .logo-marquee { animation: marquee 26s linear infinite; }
  .marquee-mask:hover .logo-marquee { animation-play-state: paused; }
}
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* Hero badge pulse dot */
.pulse-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); display: inline-block; position: relative; }
.pulse-dot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--accent); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(32, 128, 141, 0.4); } 70% { box-shadow: 0 0 0 8px rgba(32, 128, 141, 0); } 100% { box-shadow: 0 0 0 0 rgba(32, 128, 141, 0); } }

.btn-primary:hover { transform: translateY(-1px); }

/* Pre-footer CTA strip */
.footer-cta { border-top: 1px solid var(--border); }

/* Headline gradient underline accent (monochrome shimmer) */
.h-underline { background-image: linear-gradient(90deg, var(--accent), var(--muted-2), var(--accent)); background-size: 200% auto; -webkit-background-clip: text; background-clip: text; color: transparent; }



/* =====================================================================
   ✦ PREMIUM v2 — dub.co-grade polish layer
   A refined, monochrome, ultra-clean upgrade applied via existing
   class names so every page inherits it automatically.
   ===================================================================== */

/* ---- Global type rhythm ---- */
body { font-feature-settings: "ss01" 1, "cv01" 1, "cv11" 1; letter-spacing: -0.011em; }
.h-display { letter-spacing: -0.035em; }
h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }

/* ---- Subtle page ambience ---- */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(60rem 40rem at 50% -12%, rgba(13,13,13,0.05), transparent 60%),
    radial-gradient(45rem 30rem at 100% 0%, rgba(13,13,13,0.035), transparent 55%);
}

/* =====================================================================
   Buttons — crisper, deeper, springier
   ===================================================================== */
.btn { border-radius: 11px; font-weight: 600; transition: transform .16s var(--ease-spring), background .2s, box-shadow .25s, border-color .2s, color .2s; }
.btn-primary {
  background-image: linear-gradient(180deg, #27939f, #186671);
  box-shadow: 0 1px 0 0 rgba(255,255,255,0.2) inset, 0 1px 2px rgba(9,23,23,0.12), 0 10px 24px -10px rgba(32,128,141,0.55);
}
.btn-primary:hover { transform: translateY(-1.5px); box-shadow: 0 1px 0 0 rgba(255,255,255,0.14) inset, 0 2px 4px rgba(0,0,0,0.22), 0 18px 36px -12px rgba(0,0,0,0.6); }
.btn-ghost { background: var(--card); border-color: var(--border-strong); box-shadow: var(--shadow-soft); }
.btn-ghost:hover { background: var(--card); border-color: var(--text); transform: translateY(-1.5px); box-shadow: var(--shadow-md); }
.btn-lg { padding: 0.85rem 1.5rem; font-size: 1rem; border-radius: 13px; }

/* Shimmer sweep on primary CTAs */
.btn-primary { position: relative; overflow: hidden; }
.btn-primary::after {
  content: ""; position: absolute; top: 0; left: -120%; width: 60%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,0.18), transparent);
  transform: skewX(-18deg); transition: left .7s var(--ease-out); pointer-events: none;
}
.btn-primary:hover::after { left: 140%; }

/* =====================================================================
   Cards & surfaces — refined elevation
   ===================================================================== */
.card { border-radius: var(--radius-lg); box-shadow: var(--shadow-md); transition: box-shadow .3s var(--ease-out), border-color .25s, transform .25s var(--ease-out); }
.bento { border-radius: 20px; box-shadow: var(--shadow-soft); padding: 1.6rem; border: 1px solid var(--border); background: var(--card); }
.bento:hover { box-shadow: var(--shadow-lg); transform: translateY(-3px); border-color: var(--text); }

/* Glass nav — tighter, premium */
.glass { background: rgba(255,255,255,0.7); backdrop-filter: blur(18px) saturate(160%); -webkit-backdrop-filter: blur(18px) saturate(160%); border-bottom: 1px solid var(--border) !important; }

/* Brand mark — depth + sheen */
.brand-mark { background-image: linear-gradient(135deg, #20808D, #20808D); box-shadow: 0 1px 0 rgba(255,255,255,0.25) inset, 0 6px 16px -8px rgba(32,128,141,0.55); letter-spacing: -0.02em; }

/* =====================================================================
   Pills / eyebrows — gradient hairline border
   ===================================================================== */
.pill {
  background: rgba(255,255,255,0.7); backdrop-filter: blur(8px);
  border: 1px solid transparent; border-radius: 999px;
  background-image: linear-gradient(var(--card), var(--card)), linear-gradient(120deg, rgba(13,13,13,0.22), rgba(13,13,13,0.05));
  background-origin: border-box; background-clip: padding-box, border-box;
  box-shadow: var(--shadow-soft); font-weight: 600;
}
.eyebrow { color: var(--muted-2); }

/* =====================================================================
   Hero ambience — animated aurora + crisp grid (monochrome)
   ===================================================================== */
.hero-aurora { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.hero-aurora span {
  position: absolute; border-radius: 50%; filter: blur(60px); opacity: 0.5;
  background: radial-gradient(circle at 30% 30%, rgba(13,13,13,0.14), transparent 70%);
}
.hero-aurora span:nth-child(1) { width: 420px; height: 420px; top: -120px; left: 8%; animation: float1 14s ease-in-out infinite; }
.hero-aurora span:nth-child(2) { width: 360px; height: 360px; top: -60px; right: 6%; opacity: 0.4; animation: float2 18s ease-in-out infinite; }
.hero-aurora span:nth-child(3) { width: 300px; height: 300px; top: 180px; left: 42%; opacity: 0.3; animation: float1 22s ease-in-out infinite reverse; }
@keyframes float1 { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(30px,24px) scale(1.08); } }
@keyframes float2 { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(-26px,20px) scale(1.05); } }
@media (prefers-reduced-motion: reduce) { .hero-aurora span { animation: none !important; } }

/* tighter dot grid with soft fade */
.dotgrid { background-image: radial-gradient(rgba(13,13,13,0.13) 1px, transparent 1px); background-size: 24px 24px; }

/* =====================================================================
   Chat search shell — floating, premium
   ===================================================================== */
.chat-shell { border-radius: var(--radius-xl); box-shadow: var(--shadow-xl); border-color: var(--border); }
.chat-shell::after { content: ""; position: absolute; }
.chat-composer .input-wrap { border-radius: 16px; }
.chat-send { border-radius: 12px; box-shadow: 0 1px 0 rgba(255,255,255,0.12) inset, 0 6px 16px -8px rgba(0,0,0,0.6); }

/* floating soft glow under the hero chat */
.chat-float { position: relative; }
.chat-float::before {
  content: ""; position: absolute; inset: auto 8% -28px 8%; height: 60px; z-index: -1;
  background: radial-gradient(50% 100% at 50% 0%, rgba(13,13,13,0.16), transparent 70%); filter: blur(8px);
}

/* =====================================================================
   Section headers
   ===================================================================== */
.eyebrow-chip {
  display: inline-flex; align-items: center; gap: .45rem; padding: .3rem .7rem;
  border-radius: 999px; border: 1px solid var(--border-strong); background: var(--card);
  font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted-2);
  box-shadow: var(--shadow-soft);
}

/* =====================================================================
   Stats band — refined dividers + hover
   ===================================================================== */
.stats-band { border-radius: var(--radius-lg) !important; box-shadow: var(--shadow-md); }
.stats-band > div { transition: background .2s; }
.stats-band > div:hover { background: var(--bg-2) !important; }

/* =====================================================================
   Pricing cards — premium, with featured glow + billing toggle
   ===================================================================== */
.price-card { border-radius: var(--radius-lg); transition: transform .25s var(--ease-out), box-shadow .3s var(--ease-out), border-color .25s; }
.price-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.price-card.featured {
  border-color: var(--text) !important;
  box-shadow: 0 0 0 1.5px var(--text), var(--shadow-lg) !important;
}
.price-card.featured::before {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; z-index: -1; pointer-events: none;
  background: radial-gradient(120% 60% at 50% 0%, rgba(13,13,13,0.1), transparent 60%);
}
.billing-toggle { display: inline-flex; align-items: center; gap: .25rem; padding: .25rem; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--bg-2); box-shadow: var(--shadow-soft) inset; }
.billing-toggle button { border: none; background: transparent; cursor: pointer; padding: .45rem .95rem; border-radius: 999px; font-size: .85rem; font-weight: 600; color: var(--muted); transition: all .2s; }
.billing-toggle button.active { background: var(--card); color: var(--text); box-shadow: var(--shadow-soft); }
.save-badge { background: var(--accent); color: var(--on-accent); border-radius: 999px; padding: .1rem .5rem; font-size: .68rem; font-weight: 700; margin-left: .4rem; }

/* =====================================================================
   CTA card — gradient ink with grid texture
   ===================================================================== */
.cta-card { position: relative; overflow: hidden; border-radius: var(--radius-xl) !important; background-image: radial-gradient(700px 340px at 85% 115%, rgba(32, 128, 141, 0.35), transparent 60%), linear-gradient(150deg, #0e373d 0%, #0b282c 55%, #091717 100%) !important; }
.cta-card::before {
  content: ""; position: absolute; inset: 0; opacity: .5; pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,0.06) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.06) 1px, transparent 1px);
  background-size: 38px 38px; -webkit-mask-image: radial-gradient(ellipse at 50% 0%, #000 35%, transparent 75%); mask-image: radial-gradient(ellipse at 50% 0%, #000 35%, transparent 75%);
}
.cta-card > * { position: relative; }

/* =====================================================================
   Footer — calmer, refined
   ===================================================================== */
.site-footer { background: var(--bg-2); }
.footer-social { border-radius: 10px; box-shadow: var(--shadow-soft); }

/* =====================================================================
   Marketing hero (about/contact/pricing/legal) — add ambient glow
   ===================================================================== */
.page-hero { position: relative; }
.page-hero::before {
  content: ""; position: absolute; inset: -2rem 0 auto 0; height: 320px; z-index: -1; pointer-events: none;
  background: radial-gradient(40rem 18rem at 50% -20%, rgba(13,13,13,0.06), transparent 65%);
}

/* =====================================================================
   Auth cards — floating glass with ambient glow
   ===================================================================== */
.auth-card { box-shadow: var(--shadow-xl); border-radius: var(--radius-xl); }

/* =====================================================================
   Reveal motion — slightly richer
   ===================================================================== */
@media (prefers-reduced-motion: no-preference) {
  .reveal { transform: translateY(24px); }
}

/* =====================================================================
   Coupon cards in chat — premium
   ===================================================================== */
.coupon-card { border-radius: 16px; }
.coupon-card:hover { box-shadow: var(--shadow-lg); }
.code-pill { transition: background .15s, color .15s, border-color .15s; }

/* Responsive hero scale */
@media (max-width: 640px) {
  .hero-aurora span { filter: blur(48px); }
}



/* =====================================================================
   Dedicated /ai page — mobile-first full-screen chat
   ===================================================================== */
.ai-page {
  display: flex; flex-direction: column;
  height: 100vh; height: 100dvh; min-height: 100vh; min-height: 100dvh;
  background: var(--bg);
}
.ai-top {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.55rem 0.8rem; padding-top: calc(0.55rem + env(safe-area-inset-top));
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.ai-back {
  width: 38px; height: 38px; flex: none; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text); border: 1px solid var(--border-strong); background: var(--card);
}
.ai-back span { width: 19px; height: 19px; display: inline-flex; transform: rotate(180deg); }
.ai-back svg { width: 100%; height: 100%; }
.ai-count { white-space: nowrap; }
.ai-thread {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 1rem 0.9rem 1.5rem; width: 100%; max-width: 820px; margin: 0 auto;
}
.ai-composer-wrap {
  border-top: 1px solid var(--border); background: var(--card);
  padding: 0.6rem 0.8rem calc(0.6rem + env(safe-area-inset-bottom));
  position: sticky; bottom: 0; z-index: 20;
  width: 100%; max-width: 820px; margin: 0 auto;
}
.ai-chips {
  display: flex; gap: 0.45rem; overflow-x: auto; -webkit-overflow-scrolling: touch;
  padding-bottom: 0.55rem; scrollbar-width: none;
}
.ai-chips::-webkit-scrollbar { display: none; }
.ai-chips .chip { white-space: nowrap; flex: none; }
.ai-composer { display: flex; align-items: flex-end; gap: 0.5rem; }
.ai-input-wrap {
  flex: 1; border: 1px solid var(--border-strong); border-radius: 14px;
  background: var(--bg-2); padding: 0.55rem 0.8rem; transition: border-color 0.15s, box-shadow 0.15s;
}
.ai-input-wrap:focus-within { border-color: var(--accent); box-shadow: var(--ring); background: var(--card); }
.ai-input-wrap textarea {
  width: 100%; border: none; outline: none; background: transparent; resize: none;
  font: inherit; color: var(--text); line-height: 1.45; max-height: 140px;
}
.ai-composer .chat-send { flex: none; width: 44px; height: 44px; border-radius: 12px; }
.ai-disclaimer { text-align: center; color: var(--muted-2); font-size: 0.68rem; margin: 0.5rem 0 0; }

/* On wider screens, let example chips wrap instead of scroll. */
@media (min-width: 720px) {
  .ai-chips { flex-wrap: wrap; overflow: visible; }
}

/* =====================================================================
   Mobile-first polish (global)
   ===================================================================== */
@media (max-width: 640px) {
  /* Comfortable tap targets */
  .btn { min-height: 40px; }
  .btn-sm { min-height: 34px; }
  /* Tame oversized hero type on small phones */
  .h-display { letter-spacing: -0.03em; }
  /* Cards: a touch tighter so content breathes on small screens */
  .card.p-8 { padding: 1.4rem !important; }
  /* Coupon result grids stack cleanly */
  .coupon-card { padding: 1rem !important; }
  /* Tables scroll horizontally instead of overflowing */
  .table { display: block; overflow-x: auto; white-space: nowrap; }
  /* Chat bubbles use more width on phones */
  .chat-bubble { max-width: 88% !important; }
  /* Support/banner cards fit small screens */
  .chat-support, .chat-banner, .chat-ad { border-radius: 12px; }
}

/* Respect users who prefer reduced motion across the app */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}


/* =====================================================================
   CUPAUT DESIGN SYSTEM 2.0 - the only theme layer.
   Palette: WHITE surfaces - GREEN primary - LIGHT INDIGO secondary.
   The green->indigo gradient is the brand signature, used on brand
   marks, primary emphasis, charts and hero copy.
   ===================================================================== */

/* ---- Global feel ---------------------------------------------------- */
::selection { background: rgba(32, 128, 141, 0.18); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(9, 23, 23, 0.16); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(32, 128, 141, 0.45); }
body {
  background: var(--bg);
  background-image:
    radial-gradient(900px 480px at 12% -8%, rgba(32, 128, 141, 0.055), transparent 62%),
    radial-gradient(900px 480px at 88% -8%, rgba(32, 128, 141, 0.065), transparent 62%);
  background-attachment: fixed;
}
a:not(.btn):not(.nav-item):not(.footer-link):not(.tab):not(.admin-foot-link):hover { color: var(--indigo-600); }
.text-accent { color: var(--accent) !important; }
.text-gradient {
  background: var(--brand-grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}

/* Hero ambience: green + indigo aurora */
.hero-aurora span:nth-child(1) { background: rgba(32, 128, 141, 0.16) !important; }
.hero-aurora span:nth-child(2) { background: rgba(32, 128, 141, 0.18) !important; }
.hero-aurora span:nth-child(3) { background: rgba(129, 140, 248, 0.13) !important; }

/* ---- Buttons: green primary, indigo focus --------------------------- */
.btn { border-radius: 11px; font-weight: 640; }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn-primary {
  background: linear-gradient(180deg, #27939f 0%, #186671 100%) !important;
  color: #ffffff !important;
  border: 1px solid #036c4e !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 1px 2px rgba(9, 23, 23, 0.12), 0 6px 16px -6px rgba(32, 128, 141, 0.55) !important;
}
.btn-primary:hover {
  background: linear-gradient(180deg, #2ba3b0 0%, #20808D 100%) !important;
  transform: translateY(-1.5px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 2px 4px rgba(9, 23, 23, 0.12), 0 12px 24px -8px rgba(32, 128, 141, 0.6) !important;
}
.btn-primary:active { transform: translateY(0.5px); box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.22) !important; }
.btn-ghost, .btn-soft {
  background: #ffffff;
  border: 1px solid var(--border-strong);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(9, 23, 23, 0.06);
}
.btn-ghost:hover, .btn-soft:hover {
  border-color: var(--indigo) !important;
  color: var(--indigo-600) !important;
  background: var(--indigo-tint) !important;
  transform: translateY(-1px);
}
.btn-danger { background: linear-gradient(180deg, #d0483a, #b5311f) !important; color: #fff !important; border-color: #9e2a1a !important; }

.chip:hover { border-color: var(--indigo) !important; color: var(--indigo-600) !important; background: var(--indigo-tint) !important; transform: translateY(-1px); }

/* ---- Brand mark: the trio gradient tile ----------------------------- */
.brand-mark {
  background: var(--brand-grad) !important;
  color: #ffffff !important;
  border-radius: 9px;
  font-weight: 800;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 6px 16px -8px rgba(32, 128, 141, 0.55) !important;
}
.chat-avatar.bot, .feature-ico, .step-num, .chat-send {
  background: var(--brand-grad) !important;
  color: #ffffff !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 6px 16px -8px rgba(32, 128, 141, 0.5) !important;
}
.avatar-ini { background: var(--brand-grad) !important; color: #fff !important; }
#avatar { background: var(--brand-grad) !important; color: #ffffff !important; font-weight: 800; }

/* ---- Pills / eyebrows / badges -------------------------------------- */
.eyebrow { color: var(--indigo-600); }
.eyebrow-chip {
  background: var(--brand-grad-soft) !important;
  color: var(--indigo-600) !important;
  border: 1px solid rgba(32, 128, 141, 0.22) !important;
}
.pill { border: 1px solid var(--border); background: rgba(255, 255, 255, 0.85); box-shadow: var(--shadow-soft); }
.pulse-dot, .pulse-dot::after { background: var(--accent) !important; }
.dot.ok { background: var(--accent) !important; }
.badge-accent { background: var(--brand-grad) !important; color: #fff !important; }
.badge-blue { background: var(--indigo-soft) !important; color: var(--indigo-600) !important; }
.badge-green { background: var(--accent-soft) !important; color: var(--accent-600) !important; }
.badge-red { background: rgba(192, 57, 43, 0.10) !important; color: var(--red) !important; }
.save-badge { background: var(--accent-soft) !important; color: var(--accent-600) !important; }

/* ---- Forms (Stripe-grade) ------------------------------------------- */
.input, select.input, textarea.input {
  padding: 0.6rem 0.85rem; font-size: 0.9rem; border-radius: 10px;
  border: 1px solid var(--border-strong); background: var(--card); color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:hover { border-color: rgba(32, 128, 141, 0.45); }
.input:focus, .input:focus-visible, select.input:focus, textarea.input:focus {
  outline: none; border-color: var(--indigo) !important; box-shadow: var(--ring) !important;
}
.input::placeholder { color: var(--muted-2); }
.label { font-size: 0.78rem; font-weight: 650; color: var(--text); margin-bottom: 0.4rem; display: block; }
select.input { padding-right: 2rem; }
.prov-ico {
  width: 40px; height: 40px; border-radius: 10px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--indigo-tint); border: 1px solid rgba(32, 128, 141, 0.18); color: var(--indigo-600);
}
.prov-ico svg { width: 20px; height: 20px; }

/* Toggle switch -> green when on */
input.switch {
  -webkit-appearance: none; appearance: none;
  position: relative; flex: none; margin: 0;
  width: 46px; height: 26px; border-radius: 999px;
  background: var(--bg-2); border: 1px solid var(--border-strong);
  cursor: pointer; outline: none;
  transition: background .22s ease, border-color .22s ease, box-shadow .22s ease;
  box-shadow: inset 0 1px 3px rgba(9, 23, 23, .1);
}
input.switch::before {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff; border: 1px solid rgba(9, 23, 23, .08);
  box-shadow: 0 2px 6px rgba(9, 23, 23, .28);
  transition: transform .22s cubic-bezier(.34, 1.4, .64, 1), width .15s ease;
}
input.switch:active::before { width: 24px; }
input.switch:checked { background: var(--accent); border-color: var(--accent-600); }
input.switch:checked::before { transform: translateX(20px); }
input.switch:checked:active::before { transform: translateX(16px); }
input.switch:focus-visible { box-shadow: var(--ring); }
input.switch:disabled { opacity: .5; cursor: not-allowed; }
@media (prefers-reduced-motion: reduce) { input.switch, input.switch::before { transition: none; } }

/* ---- App shell: header + sidebars ----------------------------------- */
.app-header {
  background: rgba(255, 255, 255, 0.78) !important;
  backdrop-filter: saturate(180%) blur(18px); -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid var(--border) !important;
}

/* USER PANEL rail: clean white, indigo active, green presence dot */
.app-sidebar:not(.admin-dark) { background: linear-gradient(180deg, #ffffff, #f7f5ea) !important; border-right: 1px solid var(--border) !important; }
.app-sidebar:not(.admin-dark) #nav { overflow-x: hidden; }
.app-sidebar .nav-item { min-width: 0; border-radius: 10px; font-weight: 560; }
.app-sidebar .nav-item > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-sidebar:not(.admin-dark) .nav-item:hover { background: var(--indigo-tint); color: var(--indigo-600); }
.app-sidebar:not(.admin-dark) .nav-item:hover svg { color: var(--indigo-600); }
.app-sidebar:not(.admin-dark) .nav-item.active {
  background: var(--indigo-tint) !important;
  color: var(--indigo-600) !important;
  box-shadow: inset 3px 0 0 var(--indigo) !important;
  font-weight: 680 !important;
}
.app-sidebar:not(.admin-dark) .nav-item.active svg { color: var(--indigo) !important; }
.chat-hist-title { min-width: 0; }
#new-chat { border: 1px solid var(--border-strong); border-radius: 11px; font-weight: 650; }
#new-chat:hover { border-color: var(--accent); color: var(--accent-600); background: var(--accent-soft); }
.app-sidebar:not(.admin-dark) .chat-hist { border-radius: 9px; }
.app-sidebar:not(.admin-dark) .chat-hist.active { background: var(--indigo-tint) !important; box-shadow: inset 2px 0 0 var(--indigo) !important; color: var(--text); }
.app-sidebar:not(.admin-dark) .chat-hist.active svg { color: var(--indigo); }

/* ADMIN rail: deep-indigo enterprise console */
.app-sidebar.admin-dark {
  background: linear-gradient(180deg, #0d3238 0%, #0a2427 55%, #091717 100%) !important;
  border-right: 1px solid rgba(255, 255, 255, 0.08) !important;
  color: rgba(255, 255, 255, 0.72);
  display: flex; flex-direction: column;
}
.admin-side-head { padding: 1.05rem 1.15rem 0.4rem; }
.admin-brand { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; }
.admin-brand-name { color: #fff; font-weight: 800; font-size: 1rem; display: block; line-height: 1.1; }
.admin-brand-sub { color: rgba(255, 255, 255, 0.44); font-size: 0.64rem; display: block; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.admin-dark .brand-mark { box-shadow: inset 0 1px 0 rgba(255,255,255,0.3), 0 6px 18px -8px rgba(0, 0, 0, 0.7) !important; }
.admin-profile {
  display: flex; align-items: center; gap: 0.6rem; margin: 0.6rem 0.85rem 0.45rem;
  padding: 0.6rem 0.7rem; border-radius: 12px;
  background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.09);
}
.admin-avatar {
  width: 36px; height: 36px; border-radius: 10px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; color: #fff; background: var(--brand-grad);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.admin-profile-name { color: #fff; font-weight: 700; font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-profile-role { color: rgba(255, 255, 255, 0.44); font-size: 0.7rem; }
.admin-nav { padding: 0.4rem 0.6rem; display: grid; gap: 2px; flex: 1; overflow-y: auto; overflow-x: hidden; }
.admin-nav-group {
  color: rgba(255, 255, 255, 0.38); font-size: 0.62rem; font-weight: 800;
  letter-spacing: 0.12em; text-transform: uppercase; padding: 1rem 0.65rem 0.35rem;
}
.admin-dark .nav-item { color: rgba(255, 255, 255, 0.68); border-radius: 10px; font-weight: 550; }
.admin-dark .nav-item svg { color: rgba(255, 255, 255, 0.42); }
.admin-dark .nav-item:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.admin-dark .nav-item:hover svg { color: rgba(255, 255, 255, 0.85); }
.admin-dark .nav-item.active {
  background: linear-gradient(90deg, rgba(32, 128, 141, 0.28), rgba(32, 128, 141, 0.26)) !important;
  color: #ffffff !important;
  box-shadow: inset 3px 0 0 #3fc0ce, inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
  font-weight: 650;
}
.admin-dark .nav-item.active svg { color: #8fd6de !important; }
.admin-nav::-webkit-scrollbar { width: 8px; }
.admin-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.14); border-radius: 8px; }
.admin-side-foot { padding: 0.6rem; border-top: 1px solid rgba(255, 255, 255, 0.08); display: grid; gap: 2px; }
.admin-foot-link {
  display: flex; align-items: center; gap: 0.6rem; padding: 0.55rem 0.7rem; border-radius: 9px;
  color: rgba(255, 255, 255, 0.62); background: none; border: none; cursor: pointer;
  font-size: 0.85rem; text-decoration: none; width: 100%; text-align: left; font-family: inherit;
}
.admin-foot-link:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.admin-foot-link svg { width: 17px; height: 17px; flex: none; }

/* ---- Page headers (used by admin.js + app.js renderers) ------------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.6rem; }
.page-head-eyebrow {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.66rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--indigo-600); margin-bottom: 0.45rem;
}
.page-head-eyebrow::before { content: ""; width: 16px; height: 3px; border-radius: 2px; background: var(--brand-grad); }
.page-title { font-size: 1.75rem; letter-spacing: -0.035em; line-height: 1.1; margin: 0; }
.page-sub { color: var(--muted); font-size: 0.9rem; margin-top: 0.35rem; max-width: 62ch; }
.page-head-actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }

/* ---- Stat cards: white tile, trio top bar, tinted icon -------------- */
.stat-card { position: relative; overflow: hidden; transition: transform 0.2s var(--ease-out), box-shadow 0.25s var(--ease-out), border-color 0.2s; }
.stat-card::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--tone, var(--indigo)); opacity: 0.95; }
.stat-card:hover { transform: translateY(-3px); border-color: rgba(32, 128, 141, 0.35); box-shadow: 0 22px 44px -22px rgba(32, 128, 141, 0.4); }
.stat-ico {
  width: 40px; height: 40px; border-radius: 12px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--tone, var(--indigo));
  background: color-mix(in srgb, var(--tone, var(--indigo)) 12%, #ffffff);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tone, var(--indigo)) 24%, transparent);
}
.stat-ico svg { width: 20px; height: 20px; }
@supports not (background: color-mix(in srgb, red 10%, white)) {
  .stat-ico { background: var(--indigo-tint); box-shadow: inset 0 0 0 1px rgba(32, 128, 141, 0.22); }
}

/* ---- Tables + lists -------------------------------------------------- */
.table thead th {
  color: var(--muted-2); font-weight: 800; font-size: 0.68rem;
  letter-spacing: 0.09em; text-transform: uppercase;
  background: var(--bg-2); border-bottom: 1px solid var(--border);
}
.table tbody tr { transition: background 0.13s; }
.table tbody tr:hover { background: var(--indigo-tint); }
.cmdk-item.active, .cmdk-item:hover { background: var(--indigo-tint); color: var(--indigo-600); }

/* ---- Account menu ---------------------------------------------------- */
.acct-menu { max-height: 72vh; overflow-y: auto; padding: 0.4rem; }
.acct-group { font-size: 0.62rem; font-weight: 800; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted-2); padding: 0.6rem 0.7rem 0.25rem; }
.acct-btn { border-radius: 12px; border: 1px solid transparent; transition: background 0.15s, border-color 0.15s; }
.acct-btn:hover { background: var(--indigo-tint); border-color: var(--border); }
.acct-avatar { background: var(--brand-grad) !important; border-radius: 10px !important; }
.acct-item svg { color: var(--muted); }
.acct-item:hover svg, .acct-item.active svg { color: var(--indigo-600); }
.acct-item.active { background: var(--indigo-tint) !important; color: var(--indigo-600) !important; }

/* ---- /ai app bar ------------------------------------------------------ */
.ai-top {
  box-shadow: 0 1px 0 var(--border);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(16px); -webkit-backdrop-filter: saturate(180%) blur(16px);
}
.ai-top .brand-mark { width: 30px; height: 30px; flex: none; }
.ai-top a.flex { min-width: 0; overflow: hidden; }
.ai-top .ai-back { border-radius: 50%; width: 40px; height: 40px; }
.ai-top .ai-back:hover { background: var(--indigo-tint); border-color: var(--indigo); color: var(--indigo-600); }
.ai-signin.btn { border-radius: 999px; }

/* ---- Hero trust row --------------------------------------------------- */
.hero-trust { display: flex; align-items: center; justify-content: center; gap: 0.85rem; margin-top: 1.6rem; flex-wrap: wrap; }
.avatar-stack { display: inline-flex; }
.avatar-stack span {
  width: 38px; height: 38px; border-radius: 50%; margin-left: -10px;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 0.8rem;
  background: linear-gradient(135deg, var(--a), var(--b));
  border: 2.5px solid var(--bg); box-shadow: 0 4px 10px -4px rgba(9, 23, 23, 0.4);
}
.avatar-stack span:first-child { margin-left: 0; }
.hero-trust-text { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.25; font-size: 0.9rem; }
.hero-stars { display: inline-flex; gap: 1px; color: var(--accent); }
.hero-stars svg { width: 15px; height: 15px; }
@media (max-width: 480px) {
  .hero-trust { gap: 0.6rem; }
  .hero-trust-text { align-items: center; text-align: center; }
}

/* ---- Auth split layout ------------------------------------------------ */
.auth-split { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 100vh; min-height: 100dvh; }
.auth-aside {
  position: relative; overflow: hidden; color: #fff;
  background: linear-gradient(150deg, #186671 0%, #27939f 34%, #186671 100%);
  display: flex; flex-direction: column; justify-content: space-between; padding: 2.6rem;
}
.auth-aside.admin { background: linear-gradient(150deg, #0d3238 0%, #124750 55%, #186671 145%); }
.auth-aside::before { content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(600px 320px at 18% -5%, rgba(255,255,255,0.22), transparent 60%),
    radial-gradient(500px 300px at 100% 110%, rgba(255,255,255,0.12), transparent 60%); }
.auth-aside::after { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0.5;
  background-image: radial-gradient(rgba(255,255,255,0.14) 1px, transparent 1px); background-size: 22px 22px;
  -webkit-mask-image: linear-gradient(180deg, #000, transparent 70%); mask-image: linear-gradient(180deg, #000, transparent 70%); }
.auth-aside > * { position: relative; z-index: 1; }
.auth-logo { display: inline-flex; align-items: center; gap: 0.6rem; color: #fff; text-decoration: none; font-weight: 800; font-size: 1.08rem; }
.auth-logo .brand-mark { background: rgba(255, 255, 255, 0.2) !important; box-shadow: none !important; color: #fff !important; }
.auth-aside-title { font-size: clamp(1.7rem, 2.6vw, 2.5rem); font-weight: 800; line-height: 1.08; letter-spacing: -0.03em; max-width: 460px; }
.auth-aside-title u { text-decoration-thickness: 3px; text-underline-offset: 5px; text-decoration-color: rgba(255,255,255,0.6); }
.auth-aside-list { list-style: none; padding: 0; margin: 1.4rem 0 0; display: grid; gap: 0.75rem; }
.auth-aside-list li { display: flex; align-items: center; gap: 0.65rem; font-size: 1rem; color: rgba(255,255,255,0.94); }
.auth-aside-list .tick { width: 22px; height: 22px; border-radius: 50%; flex: none; display: inline-flex; align-items: center; justify-content: center; background: rgba(255,255,255,0.22); }
.auth-aside-list .tick svg { width: 13px; height: 13px; }
.auth-aside-foot { display: flex; align-items: center; gap: 0.6rem; font-size: 0.92rem; color: rgba(255,255,255,0.9); }
.auth-aside-foot .stars { color: #ffffff; display: inline-flex; gap: 1px; }
.auth-aside-foot .stars svg { width: 14px; height: 14px; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 2.2rem 1.25rem; background: var(--bg); }
.auth-form-wrap { width: 100%; max-width: 400px; }
.auth-form-wrap .brand-mark { width: 34px; height: 34px; }
@media (max-width: 860px) {
  .auth-split { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
}
.prose a { color: var(--indigo-600) !important; text-decoration: underline; text-underline-offset: 2px; }
.page-hero .eyebrow-chip { display: inline-flex; margin-bottom: 0.4rem; }

/* ---- Native-app / PWA polish ----------------------------------------- */
@media (max-width: 768px) {
  .btn, .nav-item, .chip, .acct-btn, .ai-back, .menu-btn, .code-pill, .chat-send, .badge {
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none; user-select: none;
  }
  .app-shell, .ai-page { overscroll-behavior-y: contain; }
  .ai-count { display: none; }
  html { -webkit-text-size-adjust: 100%; }
  body.has-tabbar { padding-bottom: calc(60px + env(safe-area-inset-bottom)); }
  body.has-tabbar .ai-fab { display: none; }
}
@media (min-width: 520px) { .ai-count { display: inline-flex; } }
@media (display-mode: standalone) {
  .ai-top { padding-top: max(0.55rem, env(safe-area-inset-top)); }
  .app-header, header.glass { padding-top: max(0px, env(safe-area-inset-top)); }
  body { overscroll-behavior: none; }
}

/* ---- Mobile bottom tab bar -------------------------------------------- */
.mobile-tabbar { display: none; }
@media (max-width: 768px) {
  .mobile-tabbar {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: saturate(180%) blur(18px); -webkit-backdrop-filter: saturate(180%) blur(18px);
    border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .mobile-tabbar .tab {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    padding: 0.5rem 0.25rem 0.45rem; background: none; border: none; cursor: pointer;
    color: var(--muted-2); font-size: 0.64rem; font-weight: 600; text-decoration: none;
    -webkit-tap-highlight-color: transparent; transition: color 0.15s;
  }
  .mobile-tabbar .tab svg { width: 22px; height: 22px; }
  .mobile-tabbar .tab.active { color: var(--indigo-600); }
  .mobile-tabbar .tab:active { transform: scale(0.94); }
  .app-main { padding-bottom: 64px; }
}

/* ---- Floating Ask-AI chip (marketing pages) --------------------------- */
.ai-fab {
  position: fixed; right: 18px; bottom: 18px; z-index: 80;
  display: inline-flex; align-items: center; gap: 0.6rem;
  padding: 0.55rem 1rem 0.55rem 0.6rem; border-radius: 999px;
  background: var(--brand-grad); color: #fff; text-decoration: none;
  box-shadow: 0 14px 34px -10px rgba(32, 128, 141, 0.6), 0 2px 10px rgba(9, 23, 23, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.28);
  transition: transform 0.18s ease, box-shadow 0.25s ease;
  animation: fabIn 0.4s ease both;
}
.ai-fab:hover { transform: translateY(-2px); box-shadow: 0 20px 44px -12px rgba(32, 128, 141, 0.7), 0 4px 14px rgba(9, 23, 23, 0.2); }
.ai-fab .fab-ico { width: 36px; height: 36px; border-radius: 50%; background: rgba(255, 255, 255, 0.22); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.ai-fab .fab-ico svg { width: 19px; height: 19px; }
.ai-fab .fab-text { display: flex; flex-direction: column; line-height: 1.12; }
.ai-fab .fab-title { font-weight: 800; font-size: 0.9rem; }
.ai-fab .fab-sub { font-size: 0.66rem; opacity: 0.88; font-weight: 500; }
@keyframes fabIn { from { opacity: 0; transform: translateY(14px) scale(0.96); } }
@media (max-width: 600px) {
  .ai-fab .fab-text { display: none; }
  .ai-fab { right: 14px; bottom: 16px; padding: 0.55rem; }
}
@media (prefers-reduced-motion: reduce) { .ai-fab { animation: none; } }

/* ---- Dashboard refinements -------------------------------------------- */
#view .card, .app-main .card { border-color: var(--border); box-shadow: 0 1px 2px rgba(9,23,23,0.04), 0 8px 24px -18px rgba(9,23,23,0.16); }
.btn-sm { padding: 0.45rem 0.8rem; font-size: 0.82rem; border-radius: 9px; }
.app-main .h-display, #view .h-display { letter-spacing: -0.03em; }

/* =====================================================================
   CUPAUT DARK MODE — token override, fully working light/dark
   ===================================================================== */
html[data-theme="dark"] { color-scheme: dark; }
html[data-theme="dark"] {
  --bg: #091717;
  --bg-2: #0c2124;
  --card: #0e2529;
  --card-2: #123034;
  --text: #FBFAF4;
  --muted: #a7bfbd;
  --muted-2: #87a3a1;
  --border: rgba(251, 250, 244, 0.12);
  --border-strong: rgba(251, 250, 244, 0.22);
  --accent: #2ba3b0;
  --accent-600: #27939f;
  --accent-soft: rgba(43, 163, 176, 0.14);
  --indigo: #2ba3b0;
  --indigo-600: #27939f;
  --indigo-300: #5cb7c2;
  --indigo-soft: rgba(43, 163, 176, 0.14);
  --indigo-tint: rgba(43, 163, 176, 0.12);
  --brand-grad: linear-gradient(135deg, #2ba3b0 0%, #14545c 100%);
  --brand-grad-soft: linear-gradient(135deg, rgba(43, 163, 176, 0.16), rgba(32, 128, 141, 0.16));
  --green: #3fc0ce;
  --red: #e07b6a;
  --blue: #5cb7c2;
  --purple: #5cb7c2;
  --shadow: 0 12px 32px -16px rgba(0, 0, 0, 0.6);
  --shadow-soft: 0 1px 2px rgba(0,0,0,0.3), 0 8px 24px -18px rgba(0,0,0,0.6);
  --shadow-md: 0 1px 1px rgba(0,0,0,0.25), 0 4px 8px -2px rgba(0,0,0,0.3), 0 12px 24px -8px rgba(0,0,0,0.4);
  --shadow-lg: 0 1px 1px rgba(0,0,0,0.25), 0 8px 16px -4px rgba(0,0,0,0.35), 0 24px 48px -12px rgba(0,0,0,0.5);
  --shadow-xl: 0 2px 4px rgba(0,0,0,0.3), 0 16px 32px -8px rgba(0,0,0,0.45), 0 40px 72px -16px rgba(0,0,0,0.6);
  --ring: 0 0 0 3px rgba(92, 183, 194, 0.3);
}
html[data-theme="dark"] body {
  background:
    radial-gradient(1100px 520px at 82% -10%, rgba(43, 163, 176, 0.12), transparent 55%),
    radial-gradient(900px 480px at -10% 8%, rgba(32, 128, 141, 0.10), transparent 55%),
    var(--bg);
}
html[data-theme="dark"] .btn-ghost,
html[data-theme="dark"] .btn-soft {
  background: #10292d;
  color: var(--text);
  border-color: var(--border);
}
html[data-theme="dark"] .btn-ghost:hover,
html[data-theme="dark"] .btn-soft:hover {
  background: #143439;
  border-color: rgba(92, 183, 194, 0.4);
}
html[data-theme="dark"] .app-sidebar:not(.admin-dark) {
  background: linear-gradient(180deg, #0c2124, #091717) !important;
  border-right: 1px solid var(--border) !important;
}
html[data-theme="dark"] .glass {
  background: rgba(14, 37, 41, 0.6);
  border-color: rgba(251, 250, 244, 0.1);
}
html[data-theme="dark"] .stat-ico {
  background: color-mix(in srgb, var(--tone, var(--accent)) 24%, #0e2529);
  color: #FBFAF4;
}
@supports not (background: color-mix(in srgb, red 10%, white)) {
  html[data-theme="dark"] .stat-ico { background: rgba(43, 163, 176, 0.18); color: #FBFAF4; }
}
html[data-theme="dark"] input.switch { background: rgba(251, 250, 244, 0.18); }
html[data-theme="dark"] input.switch:checked { background: var(--accent); }
html[data-theme="dark"] .mobile-tabbar {
  background: rgba(9, 23, 23, 0.94);
  border-top: 1px solid var(--border);
}
html[data-theme="dark"] ::selection { background: rgba(92, 183, 194, 0.35); color: #FBFAF4; }
html[data-theme="dark"] img { opacity: 0.94; }
html[data-theme="dark"] .chat-support-qr { background: #FBFAF4; }

/* Theme toggle — floating, present on every page */
.theme-toggle {
  position: fixed;
  left: 18px;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  z-index: 1200;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  transition: transform 0.18s var(--ease-out), box-shadow 0.18s var(--ease-out), color 0.18s;
}
.theme-toggle:hover { transform: translateY(-2px); color: var(--accent); box-shadow: var(--shadow-lg); }
.theme-toggle svg { width: 20px; height: 20px; }
body.has-tabbar .theme-toggle { bottom: calc(86px + env(safe-area-inset-bottom, 0px)); }
@media print { .theme-toggle { display: none; } }

/* =====================================================================
   ADMIN CONSOLE REFINEMENT — professional rail + section polish
   ===================================================================== */
.app-sidebar.admin-dark {
  background: linear-gradient(180deg, #0d3238 0%, #0a2427 45%, #091717 100%) !important;
  border-right: 1px solid rgba(251, 250, 244, 0.08) !important;
}
.admin-nav { padding: 8px 10px; }
.admin-nav-group {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(251, 250, 244, 0.42);
  margin: 18px 10px 6px;
  font-weight: 700;
}
.admin-nav a, .admin-nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 500;
  color: rgba(251, 250, 244, 0.72);
  transition: background 0.15s var(--ease-out), color 0.15s, transform 0.15s var(--ease-out);
}
.admin-nav a:hover, .admin-nav button:hover {
  background: rgba(251, 250, 244, 0.07);
  color: #FBFAF4;
  transform: translateX(2px);
}
.admin-nav a.active, .admin-nav button.active {
  background: rgba(43, 163, 176, 0.18);
  box-shadow: inset 3px 0 0 #3fc0ce;
  color: #FBFAF4;
}
.admin-nav a.active svg, .admin-nav button.active svg { color: #5cb7c2; }
.admin-side-head { padding: 16px 14px 12px; border-bottom: 1px solid rgba(251, 250, 244, 0.08); }
.admin-profile {
  background: rgba(251, 250, 244, 0.05);
  border: 1px solid rgba(251, 250, 244, 0.09);
  border-radius: 12px;
}
.admin-side-foot { border-top: 1px solid rgba(251, 250, 244, 0.08); padding: 10px 12px; }
.admin-foot-link { color: rgba(251, 250, 244, 0.55); font-size: 12.5px; }
.admin-foot-link:hover { color: #FBFAF4; }

/* consistent section cards */
.card { border-radius: var(--radius); }
.card + .card, .card + .grid, .grid + .card { margin-top: 16px; }
.table th { color: var(--muted); }
.table tbody tr { transition: background 0.12s; }

/* source test result panel */
.src-test {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-2);
  padding: 10px 12px;
  font-size: 13px;
}
.src-test-row { display: flex; align-items: center; gap: 8px; }
.src-test-samples { margin: 8px 0 0; padding-left: 18px; color: var(--muted); font-size: 12.5px; }
.src-test-samples li { margin: 2px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 420px; }
.src-spin {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--border); border-top-color: var(--accent);
  animation: srcspin 0.7s linear infinite; display: inline-block;
}
@keyframes srcspin { to { transform: rotate(360deg); } }

/* =====================================================================
   NAVBAR THEME TOGGLE + SIDEBAR SCROLLBARS + ELEGANT CARDS
   ===================================================================== */
.theme-toggle-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  cursor: pointer;
  flex: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.theme-toggle-nav:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--border); }
.theme-toggle-nav svg { width: 18px; height: 18px; }

/* refined, almost-invisible sidebar scrollbars */
.app-sidebar, .admin-nav {
  scrollbar-width: thin;
  scrollbar-color: rgba(9, 23, 23, 0.16) transparent;
}
.app-sidebar.admin-dark, .app-sidebar.admin-dark .admin-nav {
  scrollbar-color: rgba(251, 250, 244, 0.16) transparent;
}
.app-sidebar::-webkit-scrollbar, .admin-nav::-webkit-scrollbar { width: 5px; }
.app-sidebar::-webkit-scrollbar-track, .admin-nav::-webkit-scrollbar-track { background: transparent; }
.app-sidebar::-webkit-scrollbar-thumb, .admin-nav::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 999px;
}
.app-sidebar:hover::-webkit-scrollbar-thumb, .admin-nav:hover::-webkit-scrollbar-thumb {
  background: rgba(9, 23, 23, 0.16);
}
.app-sidebar.admin-dark:hover::-webkit-scrollbar-thumb,
.app-sidebar.admin-dark .admin-nav:hover::-webkit-scrollbar-thumb {
  background: rgba(251, 250, 244, 0.2);
}
.app-sidebar::-webkit-scrollbar-thumb:hover, .admin-nav::-webkit-scrollbar-thumb:hover {
  background: rgba(32, 128, 141, 0.5) !important;
}

/* elegant cards — hairline border, layered shadow, calm hover */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  transition: box-shadow 0.18s var(--ease-out), border-color 0.18s var(--ease-out);
}
.card:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.table th { font-size: 11px; letter-spacing: 0.08em; }
html[data-theme="dark"] .theme-toggle-nav:hover { background: var(--accent-soft); color: var(--indigo-300); }

/* =====================================================================
   SKEUOMORPHIC FINISH — admin & user panels
   Real-material depth: glossy raised buttons, embossed cards, engraved
   inputs, machined switches, pressed nav states. Subtle, not kitsch.
   ===================================================================== */

/* ---- Cards: raised panels with a top light edge ---- */
.app-shell .card {
  background: linear-gradient(180deg, var(--card) 0%, var(--card-2) 100%);
  border-color: var(--border-strong);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.85),
    inset 0 -1px 0 rgba(9, 23, 23, 0.03),
    0 1px 2px rgba(9, 23, 23, 0.07),
    0 10px 26px -14px rgba(9, 23, 23, 0.28);
}
.app-shell .card:hover {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -1px 0 rgba(9, 23, 23, 0.03),
    0 2px 4px rgba(9, 23, 23, 0.08),
    0 16px 34px -14px rgba(9, 23, 23, 0.32);
}
.app-shell .stat-card {
  background: linear-gradient(178deg, var(--card) 0%, var(--card-2) 88%, var(--bg-2) 100%);
}

/* ---- Primary buttons: glossy, machined, with a true pressed state ---- */
.app-shell .btn-primary, .modal .btn-primary {
  background: linear-gradient(180deg, #2ba3b0 0%, #20808D 55%, #186671 100%) !important;
  border-color: #14545c !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.32),
    inset 0 -2px 3px rgba(9, 23, 23, 0.22),
    0 2px 5px rgba(9, 23, 23, 0.18),
    0 10px 20px -10px rgba(32, 128, 141, 0.55) !important;
  text-shadow: 0 1px 1px rgba(9, 23, 23, 0.25);
}
.app-shell .btn-primary:hover, .modal .btn-primary:hover {
  background: linear-gradient(180deg, #35adba 0%, #24909d 55%, #1b7280 100%) !important;
}
.app-shell .btn-primary:active, .modal .btn-primary:active {
  transform: translateY(1px);
  box-shadow:
    inset 0 2px 6px rgba(9, 23, 23, 0.35),
    inset 0 1px 0 rgba(9, 23, 23, 0.15),
    0 1px 2px rgba(9, 23, 23, 0.12) !important;
}

/* ---- Ghost / soft buttons: embossed chrome ---- */
.app-shell .btn-ghost, .app-shell .btn-soft, .modal .btn-ghost, .modal .btn-soft {
  background: linear-gradient(180deg, #ffffff 0%, var(--card-2) 100%);
  border-color: var(--border-strong);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 1px 2px rgba(9, 23, 23, 0.08),
    0 3px 8px -4px rgba(9, 23, 23, 0.12);
}
.app-shell .btn-ghost:active, .app-shell .btn-soft:active,
.modal .btn-ghost:active, .modal .btn-soft:active {
  transform: translateY(1px);
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--card-2) 100%);
  box-shadow: inset 0 2px 4px rgba(9, 23, 23, 0.12);
}
.app-shell .btn-danger:active { transform: translateY(1px); }

/* ---- Inputs: engraved wells ---- */
.app-shell .input, .app-shell select.input, .app-shell textarea.input,
.modal .input, .modal select.input, .modal textarea.input {
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--card) 45%);
  box-shadow:
    inset 0 1.5px 3px rgba(9, 23, 23, 0.09),
    inset 0 1px 6px rgba(9, 23, 23, 0.04),
    0 1px 0 rgba(255, 255, 255, 0.7);
}

/* ---- Switches: machined track + domed knob ---- */
.app-shell input.switch, .modal input.switch {
  background: linear-gradient(180deg, rgba(9, 23, 23, 0.14), rgba(9, 23, 23, 0.07));
  box-shadow: inset 0 1.5px 3px rgba(9, 23, 23, 0.22);
}
.app-shell input.switch::before, .modal input.switch::before {
  background: linear-gradient(180deg, #ffffff 0%, #eef0e9 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 1px 2px rgba(9, 23, 23, 0.3),
    0 2px 4px rgba(9, 23, 23, 0.15);
}
.app-shell input.switch:checked, .modal input.switch:checked {
  background: linear-gradient(180deg, #186671, #2ba3b0);
  box-shadow: inset 0 1.5px 3px rgba(9, 23, 23, 0.3);
}

/* ---- Tables: brushed header, ledger rows ---- */
.app-shell .table th {
  background: linear-gradient(180deg, var(--card-2), var(--bg-2));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), inset 0 -1px 0 var(--border-strong);
}

/* ---- Stat icons: glossy enamel chips ---- */
.app-shell .stat-ico {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    inset 0 -2px 4px rgba(9, 23, 23, 0.12),
    0 2px 5px rgba(9, 23, 23, 0.14);
}

/* ---- Sidebar nav: active item sits pressed into the rail ---- */
.app-sidebar.admin-dark .nav-item.active {
  background: linear-gradient(180deg, rgba(9, 23, 23, 0.45), rgba(43, 163, 176, 0.16)) !important;
  box-shadow:
    inset 0 2px 5px rgba(0, 0, 0, 0.35),
    inset 3px 0 0 #3fc0ce,
    inset 0 -1px 0 rgba(251, 250, 244, 0.06) !important;
}
.app-sidebar:not(.admin-dark) .nav-item.active {
  box-shadow:
    inset 0 2px 4px rgba(9, 23, 23, 0.1),
    inset 3px 0 0 var(--accent) !important;
}

/* ---- Header + modal: raised surfaces ---- */
.app-header {
  box-shadow: inset 0 -1px 0 var(--border), 0 1px 0 rgba(255, 255, 255, 0.6), 0 6px 18px -14px rgba(9, 23, 23, 0.3);
}
.modal {
  background: linear-gradient(180deg, var(--card) 0%, var(--card-2) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.85),
    0 12px 28px -8px rgba(9, 23, 23, 0.35),
    0 32px 64px -24px rgba(9, 23, 23, 0.4);
}

/* ---- Badges: soft pill highlight ---- */
.app-shell .badge { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 1px 1px rgba(9, 23, 23, 0.06); }

/* =====================================================================
   SKEUOMORPHIC FINISH — dark mode variants
   ===================================================================== */
html[data-theme="dark"] .app-shell .card {
  background: linear-gradient(180deg, var(--card) 0%, var(--card-2) 130%);
  box-shadow:
    inset 0 1px 0 rgba(251, 250, 244, 0.07),
    inset 0 -1px 0 rgba(0, 0, 0, 0.25),
    0 2px 4px rgba(0, 0, 0, 0.3),
    0 14px 30px -16px rgba(0, 0, 0, 0.55);
}
html[data-theme="dark"] .app-shell .card:hover {
  box-shadow:
    inset 0 1px 0 rgba(251, 250, 244, 0.09),
    0 4px 8px rgba(0, 0, 0, 0.32),
    0 20px 40px -16px rgba(0, 0, 0, 0.6);
}
html[data-theme="dark"] .app-shell .stat-card {
  background: linear-gradient(178deg, var(--card) 0%, var(--card-2) 100%);
}
html[data-theme="dark"] .app-shell .btn-ghost,
html[data-theme="dark"] .app-shell .btn-soft,
html[data-theme="dark"] .modal .btn-ghost,
html[data-theme="dark"] .modal .btn-soft {
  background: linear-gradient(180deg, var(--card-2) 0%, var(--card) 100%);
  box-shadow: inset 0 1px 0 rgba(251, 250, 244, 0.08), 0 2px 6px rgba(0, 0, 0, 0.3);
}
html[data-theme="dark"] .app-shell .btn-ghost:active,
html[data-theme="dark"] .app-shell .btn-soft:active {
  background: var(--bg-2);
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.4);
}
html[data-theme="dark"] .app-shell .input,
html[data-theme="dark"] .app-shell select.input,
html[data-theme="dark"] .app-shell textarea.input,
html[data-theme="dark"] .modal .input,
html[data-theme="dark"] .modal select.input,
html[data-theme="dark"] .modal textarea.input {
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.28) 0%, var(--bg-2) 60%);
  box-shadow: inset 0 1.5px 4px rgba(0, 0, 0, 0.4), 0 1px 0 rgba(251, 250, 244, 0.05);
}
html[data-theme="dark"] .app-shell input.switch {
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.25));
  box-shadow: inset 0 1.5px 3px rgba(0, 0, 0, 0.5);
}
html[data-theme="dark"] .app-shell input.switch::before {
  background: linear-gradient(180deg, #f4f2e6 0%, #d9d6c6 100%);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}
html[data-theme="dark"] .app-shell .table th {
  background: linear-gradient(180deg, var(--card-2), var(--bg-2));
  box-shadow: inset 0 1px 0 rgba(251, 250, 244, 0.06), inset 0 -1px 0 rgba(251, 250, 244, 0.1);
}
html[data-theme="dark"] .app-shell .stat-ico {
  box-shadow: inset 0 1px 0 rgba(251, 250, 244, 0.14), inset 0 -2px 4px rgba(0, 0, 0, 0.35), 0 2px 6px rgba(0, 0, 0, 0.35);
}
html[data-theme="dark"] .app-header {
  box-shadow: inset 0 -1px 0 rgba(251, 250, 244, 0.08), 0 6px 18px -12px rgba(0, 0, 0, 0.6);
}
html[data-theme="dark"] .modal {
  background: linear-gradient(180deg, var(--card) 0%, var(--card-2) 100%);
  box-shadow: inset 0 1px 0 rgba(251, 250, 244, 0.08), 0 24px 64px -16px rgba(0, 0, 0, 0.7);
}
html[data-theme="dark"] .app-shell .badge { box-shadow: inset 0 1px 0 rgba(251, 250, 244, 0.1); }

@media (prefers-reduced-motion: reduce) {
  .app-shell .btn-primary:active, .app-shell .btn-ghost:active,
  .app-shell .btn-soft:active, .app-shell .btn-danger:active { transform: none; }
}

