/* ============================================================================
   SMILINK AI — Web app design system
   Mirrors the Flutter app's dark RTL theme, laid out for desktop + mobile.
   ========================================================================== */

:root {
  --base: #070A12;
  --base-2: #05070D;
  --panel: #101624;
  --card: #151D2E;
  --line: #27324A;
  --text: #F6F8FF;
  --muted: #A9B4CC;
  --cyan: #49D3FF;
  --mint: #3FF2B8;
  --violet: #A98BFF;
  --rose: #FF5FA2;
  --amber: #FFC857;
  --orange: #FF8A00;

  --grad-accent: linear-gradient(90deg, var(--mint), var(--cyan));
  --shell-bg:
    radial-gradient(120% 80% at 70% 0%, #07110F 0%, var(--base) 55%, var(--base-2) 100%);
  --sidebar-bg: rgba(11, 17, 29, 0.82);
  --topbar-bg: rgba(7, 10, 18, .82);
  --surface: rgba(21, 29, 46, .72);
  --surface-strong: rgba(16, 22, 36, .92);
  --surface-soft: rgba(255, 255, 255, .04);
  --surface-hover: rgba(255, 255, 255, .08);
  --field-bg: rgba(21, 29, 46, .85);
  --field-bg-strong: rgba(10, 15, 26, .90);
  --border-soft: rgba(255, 255, 255, .08);
  --border-softer: rgba(255, 255, 255, .06);
  --muted-soft: rgba(169, 180, 204, .70);
  --image-text: #FFFFFF;
  --image-muted: #D7DEEC;
  --accent-shadow: rgba(63, 242, 184, .28);
  --accent-ink: #06100E;
  --sidebar-w: 264px;
  --radius: 18px;
  --shadow-card: 0 18px 50px rgba(0, 0, 0, 0.45);
  --font: "IBM Plex Sans Arabic", -apple-system, "Segoe UI", Tahoma, sans-serif;
}

html[data-theme="light"] {
  --base: #F6FAFF;
  --base-2: #EAF1F8;
  --panel: #FFFFFF;
  --card: #FFFFFF;
  --line: #C8D5E5;
  --text: #0D1726;
  --muted: #42526A;
  --cyan: #0278A7;
  --mint: #078262;
  --violet: #6E56CF;
  --rose: #C02662;
  --amber: #A15C04;
  --orange: #B45309;

  --grad-accent: linear-gradient(90deg, #22D3A5, #31B9E6);
  --shell-bg:
    radial-gradient(120% 80% at 72% 0%, #E6FBF5 0%, #F6FAFF 50%, #ECF2F8 100%);
  --sidebar-bg: rgba(255, 255, 255, .88);
  --topbar-bg: rgba(255, 255, 255, .92);
  --surface: rgba(255, 255, 255, .88);
  --surface-strong: #FFFFFF;
  --surface-soft: rgba(13, 23, 38, .045);
  --surface-hover: rgba(13, 23, 38, .075);
  --field-bg: #FFFFFF;
  --field-bg-strong: #F8FBFF;
  --border-soft: rgba(66, 82, 106, .18);
  --border-softer: rgba(66, 82, 106, .12);
  --muted-soft: rgba(66, 82, 106, .82);
  --accent-shadow: rgba(34, 211, 165, .22);
  --accent-ink: #06100E;
  --shadow-card: 0 18px 42px rgba(25, 41, 61, .12);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--base);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body { overscroll-behavior-y: none; overflow-x: hidden; }
img { max-width: 100%; }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--text) 18%, transparent); border-radius: 10px; border: 2px solid var(--base); }
::-webkit-scrollbar-track { background: transparent; }

.muted { color: var(--muted); }
.hidden { display: none !important; }
.spacer { flex: 1 1 auto; }

/* ---------- App shell: sidebar (desktop) + content ------------------------ */
.app-shell {
  display: grid;
  grid-template-columns: 1fr var(--sidebar-w);   /* RTL: sidebar on the right */
  min-height: 100vh;
  background: var(--shell-bg);
}

.sidebar {
  grid-column: 2;
  grid-row: 1;
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 22px 18px;
  background: var(--sidebar-bg);
  backdrop-filter: blur(14px);
  border-inline-start: 1px solid var(--line);
}

.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 16px;
}
.sidebar .brand img { height: 38px; width: auto; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  color: var(--muted);
  font-weight: 600;
  font-size: 14.5px;
  border: 1px solid transparent;
  transition: background .15s, color .15s, border-color .15s;
}
.nav-item .ico { width: 22px; height: 22px; display: grid; place-items: center; }
.nav-item:hover { background: var(--surface-hover); color: var(--text); }
.nav-item.active {
  color: var(--text);
  background: linear-gradient(90deg, rgba(63,242,184,.16), rgba(73,211,255,.10));
  border-color: rgba(63, 242, 184, .28);
}
.nav-item .badge-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--mint);
  box-shadow: 0 0 8px rgba(63,242,184,.6); margin-inline-start: auto;
}

.points-chip {
  margin-top: 6px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px; border-radius: 12px;
  color: var(--text); font-weight: 700; font-size: 13px;
  background: rgba(63, 242, 184, .10);
  border: 1px solid rgba(63, 242, 184, .22);
}
.points-chip .ico { color: var(--mint); }
.topbar .points-chip { margin-top: 0; }

.theme-toggle {
  width: 42px;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin: 0 0 8px;
  padding: 0;
  border: 1px solid var(--border-soft);
  border-radius: 13px;
  color: var(--text);
  background: var(--surface-soft);
  font-size: 13px;
  font-weight: 800;
  transition: background .15s, border-color .15s, transform .12s;
}
.theme-toggle:hover { background: var(--surface-hover); border-color: rgba(63,242,184,.34); }
.theme-toggle:active { transform: translateY(1px); }
.theme-toggle-icon {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  color: var(--mint);
}
.theme-toggle.compact {
  width: 38px;
  height: 36px;
  min-height: 36px;
  margin: 0;
  padding: 0;
  flex: 0 0 auto;
}

.content {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.content > .page { position: relative; z-index: 1; }

/* page max width for comfortable desktop reading */
.page {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 26px clamp(16px, 4vw, 40px) 60px;
}

/* ---------- Top bar (mobile) ---------------------------------------------- */
.topbar {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  position: sticky; top: 0; z-index: 40;
  background: var(--topbar-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar .brand img { height: 30px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 12px;
  display: grid; place-items: center;
  background: var(--surface-soft); border: 1px solid var(--border-soft);
  color: var(--text);
}
.icon-btn:hover { background: var(--surface-hover); }

/* ---------- Bottom nav (mobile) ------------------------------------------- */
.bottom-nav {
  display: none;
  position: fixed; inset-inline: 0; bottom: 0; z-index: 50;
  height: 64px;
  background: var(--panel);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav .row { display: flex; height: 64px; }
.bottom-nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--muted); font-size: 11px; font-weight: 700;
}
.bottom-nav a .ico {
  width: 34px; height: 28px; border-radius: 8px; display: grid; place-items: center;
}
.bottom-nav a.active { color: var(--text); }
.bottom-nav a.active .ico { background: var(--grad-accent); color: var(--accent-ink); }

/* ---------- Headings / sections ------------------------------------------- */
.eyebrow { color: var(--mint); font-size: 12px; font-weight: 700; letter-spacing: .4px; margin: 0 0 6px; }
.page-title { font-size: clamp(22px, 3vw, 30px); font-weight: 800; margin: 0 0 4px; }
.page-sub { color: var(--muted); font-size: 14px; margin: 0 0 22px; }

/* ---------- Cards / buttons ----------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 18px;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding: 0 20px; border: none; border-radius: 14px;
  font-weight: 800; font-size: 15px; color: var(--accent-ink);
  background: var(--grad-accent);
  box-shadow: 0 8px 22px var(--accent-shadow);
  transition: transform .12s, filter .15s;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .6; cursor: default; box-shadow: none; }
.btn-ghost {
  background: var(--surface-soft); color: var(--text);
  border: 1px solid var(--border-soft); box-shadow: none;
}
.btn-ghost:hover { background: var(--surface-hover); }

.spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2.4px solid color-mix(in srgb, var(--accent-ink) 28%, transparent); border-top-color: var(--accent-ink);
  animation: spin .7s linear infinite;
}
.spinner.light { border-color: var(--border-soft); border-top-color: var(--mint); }
@keyframes spin { to { transform: rotate(360deg); } }

.field {
  width: 100%; height: 50px; padding: 0 14px;
  background: var(--field-bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 14px;
  font-size: 15px; outline: none; transition: border-color .15s;
}
.field:focus { border-color: var(--mint); }
textarea.field { height: auto; min-height: 96px; padding: 12px 14px; resize: vertical; line-height: 1.6; }
.field-label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 7px; font-weight: 600; }
.error-text { color: var(--rose); font-size: 13px; margin-top: 10px; }

.toast {
  position: fixed; inset-inline: 0; bottom: 22px; margin-inline: auto; width: max-content; max-width: 90vw; z-index: 100;
  background: var(--card); color: var(--text); border: 1px solid var(--line);
  padding: 12px 18px; border-radius: 14px; box-shadow: var(--shadow-card);
  opacity: 0; transform: translateY(12px); transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.ok { border-color: rgba(63,242,184,.4); }
.toast.err { border-color: rgba(255,95,162,.5); }

/* ---------- Animated background canvas ------------------------------------ */
.bg-canvas { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.bg-over { position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: linear-gradient(to bottom, rgba(7,10,18,0), rgba(7,10,18,.55)); }

/* ====================== LOGIN ============================================= */
.login-wrap {
  position: relative; z-index: 1;
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
}
.login-card {
  width: 100%; max-width: 420px; padding: 26px 24px 28px;
  background: var(--surface); backdrop-filter: blur(10px);
  border: 1px solid rgba(63, 242, 184, .22); border-radius: 22px;
  box-shadow: var(--shadow-card);
}
.login-logo { display: block; height: 64px; max-width: 80%; object-fit: contain; margin: 0 auto 14px; }
.login-tag { text-align: center; color: var(--muted); font-size: 14px; margin-bottom: 26px; }
.login-card h1 { font-size: 19px; font-weight: 800; margin: 0 0 4px; }
.login-card .sub { color: var(--muted); font-size: 14px; margin: 0 0 18px; }
.input-icon { position: relative; }
.input-icon .ico { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); color: var(--mint); }
.input-icon .field { padding-inline-start: 42px; }
.login-foot { text-align: center; color: var(--muted-soft); font-size: 12px; margin-top: 18px; }
.link-btn { background: none; border: none; color: var(--mint); font-size: 13px; font-weight: 700; margin-top: 8px; }

/* ====================== CHAT / HOME ======================================= */
.chat-screen { position: relative; z-index: 1; height: 100vh; }
.chat-workspace { position: relative; z-index: 1; height: 100%; }
.chat-main { min-width: 0; display: flex; flex-direction: column; height: 100%; }
.chat-scroll { flex: 1; overflow-y: auto; }
.chat-inner { max-width: 820px; margin: 0 auto; padding: 24px 18px 8px; }

.chat-history {
  min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 10px;
  margin: 10px 0 8px; padding: 12px 0 0; background: transparent; border: 0;
  border-top: 1px solid var(--border-softer);
}
.history-head { display: flex; gap: 8px; }
.history-new {
  flex: 1; height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: none; border-radius: 12px; background: var(--mint); color: var(--accent-ink); font-size: 13px; font-weight: 900;
}
.history-new span, .history-icon span { display: inline-flex; }
.history-icon {
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--border-soft);
  display: grid; place-items: center; background: var(--surface-soft); color: var(--text);
}
.history-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.history-tabs button, .folder-filter button {
  height: 34px; border: 1px solid var(--border-soft); border-radius: 10px;
  background: var(--surface-soft); color: var(--muted); font-size: 12px; font-weight: 800;
}
.history-tabs button.active, .folder-filter button.active {
  color: var(--accent-ink); background: var(--grad-accent); border-color: transparent;
}
.folder-filter { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.folder-filter::-webkit-scrollbar { display: none; }
.folder-filter button { flex: 0 0 auto; padding: 0 10px; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-list { min-height: 90px; max-height: min(48vh, 420px); overflow-y: auto; display: flex; flex-direction: column; gap: 7px; padding-left: 2px; }
.history-empty { color: var(--muted); font-size: 12px; text-align: center; padding: 28px 8px; }
.history-item {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px;
  width: 100%; min-height: 46px; padding: 8px 8px 8px 4px; border-radius: 12px;
  border: 1px solid var(--border-soft); background: var(--surface-soft); color: var(--text);
}
.history-item.active { border-color: rgba(63,242,184,.34); background: rgba(63,242,184,.08); }
.history-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; font-weight: 800; }
.history-meta { margin-top: 2px; color: var(--muted); font-size: 10.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-actions { display: flex; align-items: center; gap: 2px; }
.history-actions button {
  width: 27px; height: 27px; display: grid; place-items: center; border-radius: 8px; border: none;
  background: transparent; color: var(--muted);
}
.history-actions button:hover { background: var(--surface-hover); color: var(--text); }

.chat-empty { height: 100%; display: grid; place-items: center; text-align: center; padding: 24px; }
.chat-empty img { height: 46px; margin-bottom: 12px; }
.chat-empty h2 { font-size: clamp(22px, 4vw, 30px); font-weight: 800; margin: 14px 0 8px; }
.chat-empty p { color: var(--muted); font-size: 14px; max-width: 440px; }

.bubble-row { display: flex; margin-bottom: 12px; direction: ltr; }
.bubble-row.user { justify-content: flex-start; }       /* user on the physical left */
.bubble-row.bot { justify-content: flex-end; }          /* assistant on the physical right */
.bubble {
  max-width: min(640px, 86%); padding: 12px 15px; line-height: 1.65; font-size: 14.5px;
  border-radius: 18px; white-space: pre-wrap; word-wrap: break-word;
  direction: rtl; text-align: right;
}
.bubble.user { background: rgba(63,242,184,.16); border: 1px solid rgba(63,242,184,.28); border-top-left-radius: 5px; }
.bubble.bot { background: var(--surface-strong); border: 1px solid var(--border-soft); border-top-right-radius: 5px; }
.bubble table { border-collapse: collapse; width: 100%; margin: 8px 0; font-size: 13px; }
.bubble th { background: var(--mint); color: var(--accent-ink); padding: 7px 9px; font-weight: 800; }
.bubble td { border: 1px solid var(--border-soft); padding: 7px 9px; }
.sources { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.source-chip {
  display: inline-flex; align-items: center; gap: 5px; max-width: 200px;
  padding: 6px 9px; font-size: 11.5px; font-weight: 700;
  background: rgba(73,211,255,.08); border: 1px solid rgba(73,211,255,.18); border-radius: 9px;
}
.source-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.typing { display: inline-flex; gap: 5px; align-items: center; }
.typing .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1s infinite; }
.typing .dot:nth-child(2) { animation-delay: .2s; }
.typing .dot:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 100% { opacity: .3; } 50% { opacity: 1; } }

.dock { position: relative; z-index: 2;
  background: linear-gradient(to bottom, color-mix(in srgb, var(--base) 0%, transparent), color-mix(in srgb, var(--base) 94%, transparent) 40%, var(--base)); }
.dock-inner { max-width: 820px; margin: 0 auto; padding: 6px 18px 16px; }
.action-rail { display: flex; gap: 8px; overflow-x: auto; padding: 6px 2px; scrollbar-width: none; }
.action-rail::-webkit-scrollbar { display: none; }
.action-pill {
  flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 5px; width: 70px;
  padding: 8px 4px; border-radius: 13px; color: var(--text); font-size: 11.5px; font-weight: 700;
  background: var(--surface); border: 1px solid var(--border-soft);
}
.action-pill:hover { border-color: rgba(63,242,184,.4); }
.action-pill .ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; }
.composer {
  display: flex; align-items: flex-end; gap: 8px; margin-top: 6px;
  background: var(--field-bg-strong); border: 1px solid var(--border-soft); border-radius: 22px; padding: 7px;
  transition: border-color .15s;
}
.composer:focus-within { border-color: rgba(63,242,184,.44); }
.composer .lead { width: 40px; height: 40px; flex: 0 0 auto; border-radius: 13px; display: grid; place-items: center; background: rgba(63,242,184,.1); color: var(--mint); }
.composer textarea {
  flex: 1; border: none; outline: none; background: transparent; color: var(--text);
  font-family: inherit; font-size: 15px; line-height: 1.5; resize: none; max-height: 160px; padding: 10px 4px;
}
.send-btn { width: 44px; height: 44px; flex: 0 0 auto; border: none; border-radius: 14px; display: grid; place-items: center; background: var(--surface-hover); color: var(--muted); transition: background .15s, color .15s; }
.send-btn.ready { background: var(--mint); color: var(--accent-ink); }

/* ====================== PRODUCTS ========================================== */
.cat-tabs { display: flex; flex-wrap: wrap; gap: 8px; padding-bottom: 16px; }
.cat-tab {
  flex: 0 0 auto; padding: 9px 16px; border-radius: 999px; font-size: 13.5px; font-weight: 700;
  color: var(--muted); background: var(--surface-soft); border: 1px solid var(--border-soft);
  transition: color .15s, background .15s, border-color .15s;
}
.cat-tab:hover { color: var(--text); border-color: rgba(63,242,184,.3); }
.cat-tab.active { color: var(--accent-ink); background: var(--grad-accent); border-color: transparent; }

.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.product-card {
  position: relative; border-radius: var(--radius); cursor: pointer; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border-soft); transition: transform .14s, border-color .14s;
  display: flex; flex-direction: column;
}
.product-card:hover { transform: translateY(-3px); border-color: rgba(63,242,184,.4); }
.product-card .poster {
  position: relative; height: 132px; background: var(--card);
  background-size: cover; background-position: center;
}
.product-card .poster::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(7,10,18,.05), rgba(7,10,18,.55));
}
.product-card .poster.fallback { display: grid; place-items: center; }
.product-card .poster.fallback .pico { color: #fff; opacity: .92; position: relative; z-index: 1; }
.product-card .cost-badge {
  position: absolute; top: 9px; inset-inline-start: 9px; z-index: 2;
  display: inline-flex; align-items: center; gap: 4px;
  height: 24px; padding: 0 9px; border-radius: 8px; font-size: 11px; font-weight: 900; color: #fff;
  background: rgba(7,10,18,.5); border: 1px solid rgba(255,255,255,.12);
}
.product-card .cost-badge .ico { color: var(--amber); display: inline-flex; }
.product-card .body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.product-card h3 { margin: 0; font-size: 15.5px; font-weight: 800; }
.product-card p { margin: 0; color: var(--muted); font-size: 12.8px; line-height: 1.6; }

/* ====================== PRODUCT DETAIL (full screen) ====================== */
.product-page {
  max-width: 1180px;
  padding-top: 18px;
  padding-inline: clamp(12px, 2.4vw, 28px);
}
.detail-layout {
  display: grid;
  grid-template-columns: minmax(300px, .86fr) minmax(420px, 1.14fr);
  gap: 16px;
  align-items: start;
}
.detail-summary {
  position: sticky;
  top: 22px;
  min-width: 0;
}
.detail-hero {
  position: relative;
  min-height: 330px;
  height: min(48vh, 430px);
  border-radius: 18px;
  overflow: hidden;
  background: var(--card) center/cover no-repeat;
  border: 1px solid var(--border-soft);
  box-shadow: 0 18px 42px rgba(0,0,0,.28);
}
.detail-hero.fallback { display: grid; place-items: center; }
.detail-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to top, rgba(7,10,18,.96) 0%, rgba(7,10,18,.46) 48%, rgba(7,10,18,.22) 100%),
    linear-gradient(100deg, rgba(63,242,184,.18), rgba(255,95,162,.08));
}
.detail-hero .fallico { position: relative; z-index: 1; color: #fff; opacity: .9; }
.detail-back {
  position: absolute;
  top: 12px;
  inset-inline-start: 12px;
  z-index: 3;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(7,10,18,.54);
  border: 1px solid rgba(255,255,255,.16);
  color: #fff;
  backdrop-filter: blur(8px);
}
.detail-back:hover { background: rgba(7,10,18,.78); }
.detail-cost {
  position: absolute;
  top: 14px;
  inset-inline-end: 14px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 31px;
  padding: 5px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 900;
  color: #fff;
  background: rgba(7,10,18,.58);
  border: 1px solid rgba(255,255,255,.16);
  backdrop-filter: blur(8px);
}
.detail-cost .ico { color: var(--amber); display: inline-flex; }
.detail-hero .htext {
  position: absolute;
  inset-inline: 18px;
  bottom: 17px;
  z-index: 2;
}
.detail-hero .htext span {
  display: inline-flex;
  margin-bottom: 8px;
  color: var(--mint);
  font-size: 11.5px;
  font-weight: 900;
}
.detail-hero .htext h1 {
  margin: 0 0 8px;
  color: var(--image-text);
  font-size: clamp(24px, 3.1vw, 36px);
  line-height: 1.22;
  font-weight: 900;
}
.detail-hero .htext p {
  margin: 0;
  color: var(--image-muted);
  font-size: 14px;
  line-height: 1.7;
  max-width: 96%;
}
.detail-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 10px;
  padding: 13px 14px;
  border-radius: 14px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border-soft);
  font-size: 12.8px;
  line-height: 1.65;
}
.detail-note .ico {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--mint);
  background: rgba(63,242,184,.11);
}
.detail-panel {
  min-width: 0;
  padding: 18px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-card);
}
.detail-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  margin-bottom: 2px;
  border-bottom: 1px solid var(--border-softer);
}
.detail-kicker {
  display: block;
  color: var(--mint);
  font-size: 11.5px;
  font-weight: 900;
  margin-bottom: 5px;
}
.detail-panel h2 {
  margin: 0 0 4px;
  font-size: 20px;
  font-weight: 900;
}
.detail-panel-head p {
  margin: 0;
  font-size: 12.8px;
  line-height: 1.6;
}
.detail-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
}
.detail-form .full { grid-column: 1 / -1; }
.product-page .field-label {
  margin: 11px 0 6px;
  font-size: 12.5px;
}
.product-page .field {
  height: 46px;
  border-radius: 12px;
  background: var(--field-bg-strong);
}
.product-page textarea.field {
  min-height: 112px;
  padding-top: 11px;
}

.uploader {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 72px;
  padding: 12px;
  border-radius: 14px;
  background: var(--field-bg-strong);
  border: 1px dashed rgba(73,211,255,.36);
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .12s;
}
.uploader:hover {
  background: rgba(73,211,255,.07);
  border-color: rgba(63,242,184,.5);
}
.uploader:active { transform: translateY(1px); }
.uploader .uico {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(63,242,184,.12);
  color: var(--mint);
}
.uploader .ut { flex: 1; min-width: 0; }
.uploader .ut .t1 { font-size: 13.5px; font-weight: 800; }
.uploader .ut .t2 {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.uploader .thumb {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid rgba(255,255,255,.12);
}

.detail-actions {
  display: grid;
  grid-template-columns: 132px 1fr;
  gap: 10px;
  margin-top: 18px;
}
.detail-actions .btn {
  width: 100%;
  height: 50px;
  border-radius: 13px;
}

@media (max-width: 1040px) {
  .detail-layout {
    grid-template-columns: 1fr;
  }
  .detail-summary {
    position: static;
  }
  .detail-hero {
    min-height: 250px;
    height: 34vh;
  }
}

@media (max-width: 560px) {
  .product-page {
    padding-top: 12px;
    padding-inline: 12px;
  }
  .detail-layout {
    gap: 12px;
  }
  .detail-hero {
    min-height: 218px;
    height: 218px;
    border-radius: 16px;
  }
  .detail-hero .htext {
    inset-inline: 14px;
    bottom: 14px;
  }
  .detail-hero .htext h1 {
    font-size: 22px;
  }
  .detail-hero .htext p {
    font-size: 12.8px;
    line-height: 1.55;
  }
  .detail-note {
    display: none;
  }
  .detail-panel {
    padding: 14px;
    border-radius: 16px;
  }
  .detail-form {
    grid-template-columns: 1fr;
  }
  .detail-actions {
    grid-template-columns: 1fr;
  }
}

/* ====================== JOBS ============================================== */
.job-list { display: flex; flex-direction: column; gap: 12px; }
.job-card { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border-soft); }
.job-card .jico { width: 46px; height: 46px; flex: 0 0 auto; border-radius: 13px; display: grid; place-items: center; font-size: 20px; background: rgba(169,139,255,.14); }
.job-card .meta { flex: 1; min-width: 0; }
.job-card .meta h3 { margin: 0 0 4px; font-size: 15px; font-weight: 700; }
.job-card .meta .sub { color: var(--muted); font-size: 12.5px; }
.status-chip { font-size: 11.5px; font-weight: 800; padding: 5px 11px; border-radius: 999px; }
.status-pending, .status-processing { background: rgba(255,200,87,.14); color: var(--amber); }
.status-completed { background: rgba(63,242,184,.16); color: var(--mint); }
.status-failed, .status-cancelled { background: rgba(255,95,162,.16); color: var(--rose); }
.progress-track { height: 5px; border-radius: 5px; background: rgba(255,255,255,.08); margin-top: 8px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--grad-accent); transition: width .4s; }

/* ====================== ACCOUNT =========================================== */
/* compact, grid-based account screen */
.acct-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.acct-avatar { width: 48px; height: 48px; flex: 0 0 auto; border-radius: 15px; display: grid; place-items: center;
  font-size: 19px; font-weight: 800; color: var(--accent-ink); background: var(--grad-accent); }
.acct-head .nm { font-size: 17px; font-weight: 800; line-height: 1.2; }
.acct-head .ph { color: var(--muted); font-size: 12.5px; direction: ltr; text-align: start; }
.acct-logout { width: 40px; height: 40px; flex: 0 0 auto; border-radius: 12px; display: grid; place-items: center;
  background: rgba(255,95,162,.1); border: 1px solid rgba(255,95,162,.25); color: var(--rose); }
.acct-logout:hover { background: rgba(255,95,162,.18); }

.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.stat { padding: 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border-soft); }
.stat.accent { background: linear-gradient(125deg, rgba(63,242,184,.16), rgba(73,211,255,.07)); border-color: rgba(63,242,184,.3); }
.stat .v { font-size: 24px; font-weight: 900; line-height: 1; }
.stat .k { color: var(--muted); font-size: 11.5px; margin-top: 6px; }

.acct-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 14px; align-items: start; }
.acct-grid .card { padding: 16px; }
.acct-grid h3 { margin: 0 0 2px; font-size: 14.5px; font-weight: 800; }
.acct-grid .hint { color: var(--muted); font-size: 12px; margin: 0 0 10px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; }
.form-grid .field-label { margin: 6px 0 5px; font-size: 12px; }
.form-grid .field { height: 42px; font-size: 13.5px; border-radius: 11px; }
.txn { display: flex; align-items: center; justify-content: space-between; padding: 10px 2px; border-bottom: 1px solid var(--border-softer); font-size: 12.5px; }
.txn:last-child { border-bottom: none; }
.txn .amt.pos { color: var(--mint); font-weight: 800; }
.txn .amt.neg { color: var(--rose); font-weight: 800; }

@media (max-width: 760px) {
  .acct-grid { grid-template-columns: 1fr; }
}

.empty-state { text-align: center; color: var(--muted); padding: 50px 20px; }
.empty-state .big-ico { font-size: 40px; margin-bottom: 12px; opacity: .8; }

/* ====================== LIGHT THEME READABILITY =========================== */
html[data-theme="light"] body {
  background: var(--base);
}
html[data-theme="light"] .bg-canvas {
  opacity: .24 !important;
}
html[data-theme="light"] .bg-over {
  background: linear-gradient(to bottom, rgba(246,250,255,.44), rgba(246,250,255,.92));
}
html[data-theme="light"] .sidebar,
html[data-theme="light"] .topbar,
html[data-theme="light"] .bottom-nav {
  box-shadow: 0 10px 32px rgba(25,41,61,.08);
}
html[data-theme="light"] .nav-item {
  color: #334155;
}
html[data-theme="light"] .nav-item.active {
  color: #07111F;
  background: linear-gradient(90deg, rgba(34,211,165,.23), rgba(49,185,230,.16));
  border-color: rgba(7,130,98,.28);
}
html[data-theme="light"] .points-chip {
  color: #0B3B31;
  background: rgba(7,130,98,.10);
  border-color: rgba(7,130,98,.24);
}
html[data-theme="light"] .theme-toggle {
  color: #0D1726;
  background: rgba(255,255,255,.70);
}
html[data-theme="light"] .field,
html[data-theme="light"] .composer textarea,
html[data-theme="light"] select,
html[data-theme="light"] input,
html[data-theme="light"] textarea {
  color: var(--text);
}
html[data-theme="light"] .field::placeholder,
html[data-theme="light"] .composer textarea::placeholder {
  color: #65748B;
  opacity: 1;
}
html[data-theme="light"] .card,
html[data-theme="light"] .product-card,
html[data-theme="light"] .job-card,
html[data-theme="light"] .stat,
html[data-theme="light"] .detail-panel,
html[data-theme="light"] .detail-note,
html[data-theme="light"] .action-pill,
html[data-theme="light"] .history-item,
html[data-theme="light"] .login-card {
  box-shadow: var(--shadow-card);
}
html[data-theme="light"] .bubble.user {
  background: rgba(34,211,165,.18);
  border-color: rgba(7,130,98,.26);
}
html[data-theme="light"] .bubble.bot {
  background: #FFFFFF;
}
html[data-theme="light"] .dock {
  background: linear-gradient(to bottom, rgba(246,250,255,0), rgba(246,250,255,.96) 42%, var(--base));
}
html[data-theme="light"] .composer,
html[data-theme="light"] .product-page .field,
html[data-theme="light"] .uploader {
  border-color: #C5D3E3;
}
html[data-theme="light"] .product-card .poster::after {
  background: linear-gradient(to bottom, rgba(7,10,18,.02), rgba(7,10,18,.38));
}
html[data-theme="light"] .detail-hero {
  box-shadow: 0 18px 42px rgba(25,41,61,.16);
}
html[data-theme="light"] .detail-hero::after {
  background:
    linear-gradient(to top, rgba(7,10,18,.86) 0%, rgba(7,10,18,.34) 50%, rgba(7,10,18,.08) 100%),
    linear-gradient(100deg, rgba(34,211,165,.14), rgba(192,38,98,.06));
}
html[data-theme="light"] .detail-note {
  color: #34445A;
}
html[data-theme="light"] .progress-track {
  background: rgba(66,82,106,.14);
}
html[data-theme="light"] .status-pending,
html[data-theme="light"] .status-processing {
  background: rgba(161,92,4,.13);
}
html[data-theme="light"] .status-completed {
  background: rgba(7,130,98,.13);
}
html[data-theme="light"] .status-failed,
html[data-theme="light"] .status-cancelled {
  background: rgba(192,38,98,.12);
}
html[data-theme="light"] .login-tag,
html[data-theme="light"] .login-foot,
html[data-theme="light"] .page-sub,
html[data-theme="light"] .muted,
html[data-theme="light"] .product-card p,
html[data-theme="light"] .history-meta,
html[data-theme="light"] .job-card .meta .sub,
html[data-theme="light"] .acct-grid .hint,
html[data-theme="light"] .stat .k {
  color: var(--muted);
}

/* ====================== RESPONSIVE ======================================== */
@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .content { grid-column: 1; }
  .topbar { display: flex; }
  .bottom-nav { display: block; }
  .content, .chat-screen { padding-bottom: 64px; }
  .chat-screen { height: calc(100vh - 0px); }
  .chat-workspace { display: flex; flex-direction: column; }
  .chat-main { flex: 1; min-height: 0; }
  .chat-history {
    flex: 0 0 auto; border-inline-start: none; border-bottom: 1px solid var(--border-soft);
    padding: 10px 12px; gap: 8px;
  }
  .history-list { max-height: 132px; flex: 0 0 auto; }
  .page { padding: 18px 14px 84px; }
  .dock-inner { padding-bottom: 76px; }
}

@media (min-width: 861px) {
  /* on desktop the chat screen lives inside content column already */
  .chat-screen { height: 100vh; }
}
