/* ============ Nano Banana — site + app + admin ============ */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/assets/fonts/inter/inter-latin.woff2') format('woff2');
}

:root {
  --font-sans: 'Inter', -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", Consolas, monospace;
  --bg: #fafafa;
  --bg-soft: #f0f0f0;
  --sidebar: #f2f2f2;
  --surface: #ffffff;
  --surface-2: #ebebeb;
  --border: #e4e4e4;
  --text: #101216;
  --text-dim: #5c636e;
  --accent: #0891b2;
  --accent-ink: #0e7490;
  --accent-soft: rgba(8, 145, 178, 0.10);
  --danger: #d92d20;
  --btn-bg: #101216;
  --btn-fg: #ffffff;
  --nav-bg: rgba(255, 255, 255, 0.88);
  --hero-a: rgba(8, 145, 178, 0.05);
  --checker1: #ececec;
  --checker2: #e2e2e2;
  --row-hover: rgba(16, 18, 22, 0.03);
  --tag-image-fg: #4f46e5;
  --shadow-card: 0 10px 30px rgba(16, 18, 22, 0.07);
}

html[data-theme="dark"] {
  --bg: #131313;
  --bg-soft: #1a1a1a;
  --sidebar: #171717;
  --surface: #1f1f1f;
  --surface-2: #2a2a2a;
  --border: #2e2e2e;
  --text: #ededed;
  --text-dim: #a3a7ae;
  --accent: #22d3ee;
  --accent-ink: #67e8f9;
  --accent-soft: rgba(34, 211, 238, 0.14);
  --danger: #f87171;
  --btn-bg: #f2f2f2;
  --btn-fg: #101216;
  --nav-bg: rgba(19, 19, 19, 0.85);
  --hero-a: rgba(34, 211, 238, 0.06);
  --checker1: #242424;
  --checker2: #1d1d1d;
  --row-hover: rgba(255, 255, 255, 0.02);
  --tag-image-fg: #a5b4fc;
  --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  overflow-x: clip;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  color: var(--text);
  background: var(--bg);
}

body.site-body {
  background:
    radial-gradient(1100px 500px at 50% -10%, var(--hero-a) 0%, transparent 60%),
    var(--bg);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

code {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.92em;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 5px;
}

.muted { color: var(--text-dim); }
.center { text-align: center; }
.inline { display: inline; }


.brand-logo { height: 32px; width: auto; display: block; }
.brand-logo.sm { height: 24px; }

/* Theme-switching logo pairs: light variant on light theme, dark on dark */
.logo-d { display: none; }
html[data-theme="dark"] .logo-l { display: none; }
html[data-theme="dark"] .logo-d { display: block; }

.empty-state .brand-logo { height: 44px; margin: 0 auto 10px; }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 600;
  color: var(--btn-fg);
  background: var(--btn-bg);
  border-radius: 999px;
  padding: 10px 20px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: filter 0.15s, box-shadow 0.2s;
  font-size: 14px;
  overflow: hidden;
}
.btn:hover { filter: brightness(1.12); text-decoration: none; box-shadow: 0 8px 24px rgba(99, 102, 241, 0.3); }
.btn-ghost { box-shadow: none; }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: 6px 13px; font-size: 13px; }
.btn-lg { padding: 13px 26px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-danger { background: rgba(248,113,113,0.12); color: var(--danger); border: 1px solid rgba(248,113,113,0.4); }

/* ---------- site nav / footer ---------- */

.site-nav { border-bottom: 1px solid var(--border); background: var(--nav-bg); backdrop-filter: blur(6px); position: sticky; top: 0; z-index: 20; }
.site-nav-inner { max-width: 1120px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 700; color: var(--text); font-size: 16px; }
.site-links { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.site-links a { color: var(--text-dim); padding: 7px 11px; border-radius: 999px; font-size: 14px; }
.site-links a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.site-links a.on { color: var(--text); background: var(--surface); }
.site-auth { display: flex; align-items: center; gap: 8px; }

.site-footer { border-top: 1px solid var(--border); margin-top: 60px; background: var(--bg-soft); }.site-footer-inner { max-width: 1120px; margin: 0 auto; padding: 26px 20px; display: flex; flex-direction: column; gap: 12px; }
.site-footer nav { display: flex; gap: 16px; }
.site-footer nav a { color: var(--text-dim); font-size: 14px; }
.site-footer p { color: var(--text-dim); font-size: 12px; margin: 0; }

/* ---------- site sections ---------- */

.site-main { min-height: calc(100vh - 300px); }
.section { max-width: 1120px; margin: 0 auto; padding: 72px 20px; }
.section-alt { background: rgba(18, 24, 38, 0.025); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
html[data-theme="dark"] .section-alt { background: rgba(255, 255, 255, 0.02); }
.section h2 { font-size: clamp(26px, 3.4vw, 38px); letter-spacing: -0.02em; margin: 0 0 12px; }
.section-lead { color: var(--text-dim); font-size: 16px; margin: 0 0 32px; max-width: 640px; line-height: 1.6; }
.section.narrow { max-width: 760px; }

.eyebrow {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-ink);
  margin-bottom: 14px;
}

/* Spec strip (moonshot-style stats under the hero) */
.specs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  max-width: 880px;
  margin: 56px auto 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  overflow: hidden;
}
.spec { padding: 22px 14px; text-align: center; position: relative; }
.spec + .spec::before { content: ""; position: absolute; left: 0; top: 18%; bottom: 18%; width: 1px; background: var(--border); }
.spec-num { font-size: clamp(24px, 3vw, 32px); font-weight: 800; letter-spacing: -0.02em; color: var(--text); }
.spec-lbl { font-size: 12px; color: var(--text-dim); margin-top: 4px; }

/* News / changelog rows */
.news { display: flex; flex-direction: column; gap: 12px; max-width: 780px; }
.news-item {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 4px 20px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text);
  text-decoration: none;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.news-item:hover { transform: translateY(-2px); border-color: var(--surface-2); box-shadow: var(--shadow-card); text-decoration: none; }
.news-date { grid-row: span 2; font-size: 12px; color: var(--text-dim); font-family: var(--font-mono); padding-top: 3px; }
.news-title { font-weight: 700; font-size: 15px; }
.news-desc { color: var(--text-dim); font-size: 13.5px; line-height: 1.55; }

/* Models page */
.model-panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }.model-card .model-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.model-card .model-head h3 { margin: 0; }
.chip-ok-model { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-ink); background: var(--accent-soft); padding: 3px 9px; border-radius: 999px; }
.model-desc { margin: 0 0 14px; color: var(--text-dim); font-size: 14px; line-height: 1.6; }
.model-specs { margin: 0 0 18px; }
.model-specs > div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.model-specs dt { color: var(--text-dim); }
.model-specs dd { margin: 0; font-weight: 600; }
.model-id { margin: 0 0 10px; }

/* Build-in-seconds code section */
.code-section { padding-top: 64px; }
.code-duo { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; margin: 0 0 22px; }
.code-block {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  min-width: 0;
}
.code-head {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-dim);
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
}
.code-block pre {
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text);
}
.code-block code { background: none; border: none; padding: 0; font-size: inherit; }

/* Models strip */
.models-strip { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 0 0 22px; }
.model-pill {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: 13.5px;
  font-weight: 600;
}
.card-link { margin-top: 12px; font-size: 14px; }

/* Big footer */
.footer-top { display: flex; gap: 48px; justify-content: space-between; flex-wrap: wrap; }
.footer-brand { max-width: 320px; display: flex; flex-direction: column; gap: 12px; }
.footer-brand p { margin: 0; font-size: 13.5px; line-height: 1.6; }
.footer-cols { display: flex; gap: 56px; flex-wrap: wrap; }
.footer-col { display: flex; flex-direction: column; gap: 9px; }
.footer-col h4 { margin: 0 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-dim); }
.footer-col a { color: var(--text-dim); font-size: 14px; }
.footer-col a:hover { color: var(--text); }
.footer-bottom {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  border-top: 1px solid var(--border);
  margin-top: 30px; padding-top: 20px;
  font-size: 12.5px; color: var(--text-dim);
}

@media (max-width: 600px) {
  .news-item { grid-template-columns: 1fr; }
  .news-date { grid-row: auto; }
  .footer-cols { gap: 28px; flex-direction: column; }
}

.page-head { max-width: 1120px; margin: 0 auto; padding: 64px 20px 10px; }
.page-head h1 { font-size: clamp(30px, 4.4vw, 44px); letter-spacing: -0.02em; margin: 0 0 8px; }
.page-head p { color: var(--text-dim); font-size: 15px; margin: 0; }

.hero { max-width: 1120px; margin: 0 auto; padding: 96px 20px 56px; text-align: center; }
.hero h1 {
  font-size: clamp(38px, 6vw, 68px);
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin: 18px auto 22px;
  max-width: 880px;
}
.hero .lead { color: var(--text-dim); font-size: clamp(15px, 1.6vw, 18px); max-width: 620px; margin: 0 auto 30px; line-height: 1.65; }
.hero-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; min-width: 0; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  min-width: 0;
}
.card:hover {
  transform: translateY(-3px);
  border-color: var(--surface-2);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.35);
}
.card h3 { margin: 0 0 8px; font-size: 17px; }
.card p { margin: 0; color: var(--text-dim); line-height: 1.6; font-size: 14px; }
.card .card-icon {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  transition: transform 0.2s ease, background 0.2s ease;
}
.card:hover .card-icon { transform: scale(1.08); background: color-mix(in srgb, var(--accent) 22%, transparent); }
.card .card-icon svg { width: 23px; height: 23px; }
.card-featured { border-color: color-mix(in srgb, var(--accent) 50%, transparent); box-shadow: 0 0 40px color-mix(in srgb, var(--accent) 12%, transparent); }
.cards .card-featured { max-width: 440px; width: 100%; margin: 0 auto; }
.pricing-section { padding-bottom: 20px; }
.price { font-size: 42px; font-weight: 800; margin: 6px 0 14px; }
.price span { font-size: 15px; font-weight: 400; color: var(--text-dim); }
.perks { list-style: none; padding: 0; margin: 0 0 18px; display: flex; flex-direction: column; gap: 9px; color: var(--text-dim); font-size: 14px; }
.perks li { display: flex; align-items: flex-start; gap: 9px; }
.perks li::before {
  content: "";
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 2px;
  border-radius: 50%;
  background: var(--accent-soft) url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%2310a37f" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6L9 17l-5-5"/></svg>') center / 10px no-repeat;
}

/* scroll-reveal handled by the lite-animations block at the end of this file */

.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.step { display: flex; gap: 14px; align-items: flex-start; }
.step span {
  width: 36px; height: 36px; border-radius: 12px; flex-shrink: 0;
  background: var(--btn-bg); color: var(--btn-fg);
  display: flex; align-items: center; justify-content: center; font-weight: 800;
}
.step strong { display: block; font-size: 15px; margin-bottom: 2px; }
.step p { margin: 0; color: var(--text-dim); font-size: 13px; }

.faqs { display: flex; flex-direction: column; gap: 10px; max-width: 780px; margin: 0 auto; }
.faqs details { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; transition: border-color 0.2s; }
.faqs details[open] { border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.faqs summary { font-weight: 600; cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.faqs summary::-webkit-details-marker { display: none; }
.faqs summary::after { content: "›"; font-size: 20px; line-height: 1; color: var(--text-dim); transform: rotate(90deg); transition: transform 0.2s; flex-shrink: 0; }
.faqs details[open] summary::after { transform: rotate(-90deg); color: var(--accent-ink); }
.faqs p { color: var(--text-dim); margin: 10px 0 0; line-height: 1.6; }

.cta { max-width: 1120px; margin: 30px auto; padding: 50px 20px; text-align: center; }
.cta h2 { font-size: 30px; margin: 0 0 8px; }
.cta p { color: var(--text-dim); margin: 0 0 22px; }
.legal h3 { font-size: 16px; margin: 26px 0 8px; }
.legal p { color: var(--text-dim); line-height: 1.7; }

.flash { max-width: 1120px; margin: 16px auto 0; padding: 12px 18px; border-radius: 10px; font-size: 14px; }
.flash.success { color: var(--accent-ink); background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); }
.flash.error { color: var(--danger); background: rgba(248,113,113,0.1); border: 1px solid rgba(248,113,113,0.35); }

.auth-wrap { min-height: 60vh; display: flex; align-items: center; justify-content: center; padding: 40px 16px; }
.auth-card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 28px; }
.auth-card h1 { margin: 0 0 6px; font-size: 24px; }
.auth-card form { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }
.auth-card label { font-size: 13px; font-weight: 600; color: var(--text-dim); margin-top: 6px; }
.auth-card input {
  width: 100%; padding: 11px 13px; font: inherit; font-size: 15px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px; outline: none;
}
.auth-card input:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }

.or-divider { display: flex; align-items: center; gap: 10px; color: var(--text-dim); font-size: 12px; margin: 12px 0; }
.or-divider::before, .or-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.admin-card {
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
  border-color: var(--surface-2);
}
.admin-card .brand { font-size: 15px; }

table.docs { width: 100%; border-collapse: collapse; font-size: 14px; margin: 10px 0 26px; }
table.docs th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-dim); padding: 8px; border-bottom: 1px solid var(--border); }
table.docs td { padding: 9px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.docs .m { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 5px; background: var(--accent-soft); color: var(--accent-ink); }
table.docs .params { font-family: ui-monospace, Consolas, monospace; font-size: 11px; color: var(--text-dim); margin-top: 3px; }
pre.code { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; overflow-x: auto; font-size: 13px; }

/* ============ Chat app — ChatGPT-style ============ */

body.app-body {
  overflow: hidden;
  --app-side: #171717;             /* persistent dark sidebar (both themes) */
  --app-side-2: #212121;           /* hover / active surface */
  --app-side-text: #ececec;
  --app-side-dim: #9ca3af;
}

.app { display: flex; height: 100vh; }

/* ---- sidebar ---- */

.app .sidebar {
  width: 260px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--app-side);
  color: var(--app-side-text);
  padding: 12px 10px;
  gap: 6px;
  border-right: 1px solid rgba(255,255,255,0.06);
}
.app .sidebar-head { display: flex; align-items: center; gap: 8px; padding: 0 4px 6px; }
.app .sidebar-head .brand-link {
  display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 15px;
  color: var(--app-side-text); text-decoration: none; flex: 1;
}
.app .sidebar-head .brand-link img { height: 22px; width: auto; }
.app .new-chat {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 32px; height: 32px; padding: 0; font-size: 14px; font-weight: 600;
  background: var(--app-side-2);
  color: var(--app-side-text);
  border: 1px solid rgba(255,255,255,0.08); border-radius: 8px;
  cursor: pointer; transition: background 0.15s, border-color 0.15s;
  flex-shrink: 0;
}
.app .new-chat:hover { background: #2d2d2d; border-color: rgba(255,255,255,0.12); }
.app .new-chat svg { color: var(--app-side-dim); }

.app .search-wrap {
  padding: 0 4px; margin-bottom: 4px;
}
.app .search-input {
  width: 100%; padding: 8px 10px 8px 32px; font: inherit; font-size: 13px;
  background: var(--app-side-2); color: var(--app-side-text);
  border: 1px solid transparent; border-radius: 8px; outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.app .search-input::placeholder { color: var(--app-side-dim); }
.app .search-input:focus { border-color: rgba(255,255,255,0.15); background: #2d2d2d; }
.app .search-wrap { position: relative; }
.app .search-wrap .search-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--app-side-dim); pointer-events: none;
}

.app .sidebar-section-label {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--app-side-dim); padding: 8px 8px 4px; opacity: 0.7;
}

.app .history { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 1px; margin: 0 -2px; padding: 0 2px; }
.app .hist-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  text-align: left; padding: 9px 10px; font-size: 13px;
  color: var(--app-side-dim); border-radius: 8px; overflow: hidden;
  transition: background 0.12s;
}
.app .hist-item:hover { background: var(--app-side-2); color: var(--app-side-text); }
.app .hist-item.active { background: rgba(255,255,255,0.08); color: var(--app-side-text); }
.app .hist-item .thumb { width: 24px; height: 24px; border-radius: 6px; object-fit: cover; flex-shrink: 0; background: var(--app-side-2); }
.app .hist-item .titles { min-width: 0; flex: 1; }
.app .hist-item .t { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.app .hist-item .d { font-size: 11px; color: var(--app-side-dim); opacity: 0.6; }
.app .hist-item .del { flex-shrink: 0; padding: 4px; border-radius: 6px; color: var(--app-side-dim); opacity: 0; transition: opacity 0.12s; }
.app .hist-item:hover .del { opacity: 1; }
.app .hist-item .del:hover { color: #ff6b6b; background: rgba(255,255,255,0.08); }

.app .sidebar-foot { border-top: 1px solid rgba(255,255,255,0.06); padding: 8px 4px 0; margin-top: 4px; }
.app .user-row { display: flex; align-items: center; gap: 8px; padding: 7px 6px; border-radius: 8px; }
.app .user-row:hover { background: var(--app-side-2); }
.app .user-avatar {
  width: 28px; height: 28px; flex-shrink: 0; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0891b2, #06b6d4);
  color: #fff; font-size: 13px; font-weight: 700;
}
html[data-theme="dark"] .user-avatar { background: linear-gradient(135deg, #0e7490, #22d3ee); }
.app .user-row .label { flex: 1; font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--app-side-text); font-weight: 500; }
.app .user-row .icon-btn { color: var(--app-side-dim); }
.app .user-row .icon-btn:hover { background: #2d2d2d; color: var(--app-side-text); }

.icon-btn { padding: 7px; border-radius: 8px; color: var(--text-dim); display: inline-flex; background: transparent; border: none; cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

.backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 40; }
body.app-body.show-sidebar .backdrop { display: block; }

/* ---- main ---- */

.chat { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--bg); }
.chat-header {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; border-bottom: 1px solid var(--border);
  background: var(--surface); min-height: 48px;
}
.chat-header .brand-mini {
  display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 14px;
  color: var(--text); padding-right: 8px; border-right: 1px solid var(--border); margin-right: 2px;
}
.chat-header .brand-mini img { height: 20px; width: auto; }
.sidebar-toggle { display: none; padding: 6px 8px; border-radius: 8px; color: var(--text-dim); background: transparent; border: none; cursor: pointer; }
.sidebar-toggle:hover { background: var(--surface-2); color: var(--text); }

.model-select {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border-radius: 8px; border: 1px solid var(--border);
  font-size: 13px; font-weight: 600;
  transition: border-color 0.15s, background 0.15s;
  background: var(--surface);
}
.model-select:hover { border-color: var(--accent); background: var(--accent-soft); }
.model-select .model-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.model-select select { max-width: 220px; background: transparent; border: none; outline: none; color: var(--text); font: inherit; font-weight: 600; font-size: 13px; cursor: pointer; }
.model-select option { background: var(--sidebar); color: var(--text); }
.model-select svg { color: var(--text-dim); pointer-events: none; flex-shrink: 0; }

/* ---- messages ---- */

.messages { flex: 1; overflow-y: auto; scroll-behavior: smooth; display: flex; flex-direction: column; padding: 20px 0; }
.messages .msg { max-width: 820px; width: 100%; margin: 0 auto; }

.msg { display: flex; gap: 12px; padding: 14px 20px; border-radius: 12px; transition: background 0.15s; }
.msg:hover { background: rgba(0,0,0,0.015); }
html[data-theme="dark"] .msg:hover { background: rgba(255,255,255,0.02); }
.msg .wrap { max-width: min(720px, 100%); min-width: 0; }
.msg .avatar {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0891b2, #06b6d4);
  color: #fff; font-size: 12px; font-weight: 700; margin-top: 2px;
}
html[data-theme="dark"] .msg .avatar { background: linear-gradient(135deg, #0e7490, #22d3ee); }
.msg.user { justify-content: flex-end; }
.msg.user .bubble {
  background: var(--surface-2);
  border-radius: 18px 18px 4px 18px;
  padding: 10px 16px;
  font-size: 15px; white-space: pre-wrap; word-break: break-word;
  border: none; line-height: 1.55;
}
.msg.assistant .bubble { font-size: 15px; line-height: 1.65; }
.msg.assistant .bubble.text-reply { white-space: pre-wrap; word-break: break-word; padding: 2px 0; color: var(--text); }

.img-card { border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: repeating-conic-gradient(var(--checker1) 0% 25%, var(--checker2) 0% 50%) 0 0 / 22px 22px; }
.img-card img { display: block; width: 100%; max-height: 480px; object-fit: contain; }

.error-card { display: flex; flex-direction: column; gap: 8px; border: 1px solid rgba(248,113,113,0.35); background: rgba(248,113,113,0.06); border-radius: 10px; padding: 12px 14px; font-size: 14px; }
.error-card .actions { display: flex; gap: 8px; }
.error-card button { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 5px 10px; background: var(--surface); cursor: pointer; transition: background 0.12s; }
.error-card button:hover { background: var(--surface-2); }

.loading { display: flex; align-items: center; gap: 10px; color: var(--text-dim); font-size: 14px; }
.dots { display: inline-flex; gap: 4px; }
.dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: blink 1.2s infinite; }
.dots span:nth-child(2) { animation-delay: 0.2s; }
.dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 60%, 100% { opacity: 0.2; } 30% { opacity: 1; } }

/* ---- composer ---- */

.composer-wrap { padding: 8px 16px 12px; background: var(--bg); }
.composer { max-width: 820px; margin: 0 auto; }
.composer-inner {
  position: relative;
  display: flex; align-items: flex-end; gap: 6px;
  border: 1px solid var(--border); border-radius: 16px;
  background: var(--surface);
  padding: 10px 10px 10px 16px;
  transition: box-shadow 0.2s, border-color 0.2s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.composer-inner:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent), 0 2px 12px rgba(0,0,0,0.06); }
.composer textarea {
  flex: 1; resize: none; border: none; outline: none; background: transparent;
  color: var(--text); font: inherit; font-size: 15px; line-height: 1.5;
  max-height: 220px; min-height: 24px; padding: 3px 0;
}
.composer textarea::placeholder { color: var(--text-dim); opacity: 0.8; }
.send-btn {
  width: 32px; height: 32px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: #fff; border: none; cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.send-btn:hover:not(:disabled) { filter: brightness(1.1); }
.send-btn:disabled { background: var(--surface-2); color: var(--text-dim); cursor: not-allowed; }
.stop-btn {
  width: 32px; height: 32px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border); cursor: pointer;
  transition: background 0.12s;
}
.stop-btn:hover { background: var(--border); }
.stop-btn[hidden] { display: none !important; }
.composer-foot { max-width: 820px; margin: 6px auto 0; display: flex; justify-content: center; gap: 10px; font-size: 11px; color: var(--text-dim); opacity: 0.7; }

/* ---- empty state (greeting) ---- */

.empty-state { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 24px; text-align: center; }
.empty-state .brand-logo { height: 40px; margin: 0 auto 6px; opacity: 0.85; }
.empty-state h1 { font-size: 26px; margin: 0; font-weight: 700; letter-spacing: -0.4px; }
.empty-state p { color: var(--text-dim); margin: 0 0 24px; font-size: 14.5px; max-width: 480px; line-height: 1.55; }
.suggestions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; max-width: 560px; width: 100%; }
.suggestions button {
  display: flex; align-items: center; gap: 10px; text-align: left;
  padding: 12px 14px; font-size: 13.5px; font-weight: 500;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px;
  cursor: pointer; transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.suggestions button:hover { background: var(--surface-2); border-color: var(--accent); box-shadow: 0 2px 8px rgba(0,0,0,0.04); }
.suggestions .s-icon { display: inline-flex; flex-shrink: 0; color: var(--accent); }
.suggestions .s-icon svg { width: 16px; height: 16px; }

/* message actions (copy) + stopped badge */
.msg-actions { display: flex; gap: 4px; margin-top: 4px; opacity: 0; transition: opacity 0.15s; }
.msg:hover .msg-actions { opacity: 1; }
.copy-btn { display: inline-flex; align-items: center; gap: 4px; font: inherit; font-size: 11px; color: var(--text-dim); background: transparent; border: 1px solid var(--border); border-radius: 6px; padding: 3px 7px; cursor: pointer; transition: color 0.12s, border-color 0.12s; }
.copy-btn:hover { color: var(--text); border-color: var(--surface-2); }
.copy-btn.copied { color: var(--accent); border-color: var(--accent); }
.edit-btn { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; color: var(--text-dim); background: transparent; border: 1px solid var(--border); border-radius: 6px; cursor: pointer; transition: color 0.12s, border-color 0.12s; }
.edit-btn:hover { color: var(--text); border-color: var(--surface-2); }
.edit-input { width: 100%; min-height: 48px; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; resize: vertical; }
.edit-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.msg.user .msg-actions { justify-content: flex-end; }
.stopped-tag { margin-top: 4px; font-size: 11px; color: var(--text-dim); font-style: italic; opacity: 0.7; }
.disclaimer { text-align: center; font-size: 11px; color: var(--text-dim); padding: 4px 16px 8px; opacity: 0.6; }

.appbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 16px; border-bottom: 1px solid var(--border); font-size: 13px; color: var(--text-dim); }
.appbar .who { display: flex; align-items: center; gap: 10px; }

[hidden] { display: none !important; }

/* ---------- settings modal ---------- */

.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center; padding: 24px; z-index: 60; }
.modal { width: min(720px, 100%); max-height: 85vh; display: flex; flex-direction: column; background: var(--sidebar); border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 24px 70px rgba(0,0,0,0.5); }
.modal header { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.modal header h2 { margin: 0; font-size: 17px; }
.modal-body { overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 22px; }
.modal-body h3 { margin: 0 0 10px; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-dim); }
.usage-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.stat { flex: 1; min-width: 110px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.stat .num { font-size: 20px; font-weight: 700; color: var(--accent); }
.stat .lbl { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.kv { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.kv .row { display: flex; justify-content: space-between; gap: 16px; padding: 7px 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.kv .row .k { color: var(--text-dim); flex-shrink: 0; }
.kv .row .v { font-family: var(--font-mono); font-size: 12px; word-break: break-all; text-align: right; }
.limit-input {
  width: 110px;
  padding: 8px 10px;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  text-align: right;
  font-family: var(--font-mono);
}
.limit-input:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.note { font-size: 12px; color: var(--text-dim); line-height: 1.55; }
.note code { font-size: 11px; }
.waiting { color: var(--text-dim); font-size: 13px; text-align: center; padding: 12px; }
.btn-ghost{margin:0}

/* ---------- admin ---------- */

body.admin-body { overflow: hidden; }
.admin-app { display: flex; height: 100vh; }
.admin-side { width: 220px; flex-shrink: 0; background: var(--sidebar); border-right: 1px solid var(--border); padding: 12px; display: flex; flex-direction: column; gap: 4px; }
.admin-side .brand { padding: 6px 10px 14px; }
.admin-side a.nav {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: 10px; color: var(--text-dim); font-size: 14px;
}
.admin-side a.nav .nav-ic { width: 17px; height: 17px; flex-shrink: 0; }
.admin-side a.nav.on .nav-ic { color: var(--accent); }
.admin-side a.nav:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.admin-side a.nav.on { background: var(--surface); color: var(--text); }
.admin-side .foot { margin-top: auto; padding: 10px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-dim); display: flex; flex-direction: column; gap: 10px; }

.admin-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.admin-head { padding: 16px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.admin-head h1 { margin: 0; font-size: 20px; }
.admin-content { flex: 1; overflow-y: auto; padding: 22px; }

.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 26px; }
.admin-grid .stat { border: 1px solid var(--border); position: relative; }
.stat-ic { position: absolute; top: 12px; right: 12px; width: 18px; height: 18px; color: var(--text-dim); opacity: 0.55; }
.stat-ic svg { width: 18px; height: 18px; }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 18px; margin-bottom: 20px; }
.panel h2 { margin: 0 0 14px; font-size: 15px; }

table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-dim); padding: 7px 9px; border-bottom: 1px solid var(--border); }
table.tbl td { padding: 8px 9px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.tbl tr:hover td { background: var(--row-hover); }
.thumb-sm { width: 40px; height: 40px; object-fit: cover; border-radius: 8px; background: var(--surface-2); }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.tag.image { background: rgba(99,102,241,0.15); color: var(--tag-image-fg); }
.tag.chat { background: var(--accent-soft); color: var(--accent-ink); }
.tag.admin { background: rgba(248,113,113,0.12); color: var(--danger); }
.tag.user { background: var(--surface-2); color: var(--text-dim); }

.thread { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.thread .bubble { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px; font-size: 13px; white-space: pre-wrap; word-break: break-word; }
.thread .bubble.user { border-color: rgba(99,102,241,0.4); }
.thread .bubble.error { border-color: rgba(248,113,113,0.4); color: var(--danger); }
.thread img { max-width: 260px; border-radius: 10px; display: block; }

.admin-login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.admin-login .auth-card { width: min(380px, 100%); }

/* ============ responsive: sites, admin, app ============ */

/* Mobile nav burger (hidden on desktop) */
.nav-burger { display: none; align-items: center; justify-content: center; width: 42px; height: 42px; border-radius: 10px; color: var(--text-dim); }
.nav-burger:hover { background: var(--surface-2); color: var(--text); }

/* Admin drawer toggle (hidden on desktop) */
.admin-burger { display: none; }

@media (max-width: 960px) {
  .nav-burger { display: inline-flex; }
  .site-nav-inner { flex-wrap: wrap; gap: 10px; }
  .site-links { order: 3; flex: 1 1 100%; display: none; flex-direction: column; border-top: 1px solid var(--border); padding-top: 8px; }
  .site-nav-inner.open .site-links { display: flex; }
  .site-links a { padding: 13px 10px; border-radius: 8px; }
  .site-auth { margin-left: auto; }

  .hero { padding: 56px 16px 28px; }
  .page-head { padding: 44px 16px 6px; }
  .section { padding: 40px 16px; }
  .site-footer-inner { padding: 22px 16px; }
  .cta { padding: 36px 16px; }

  .admin-burger { display: inline-flex; }
  .admin-side { position: fixed; top: 0; bottom: 0; left: 0; z-index: 50; width: 250px; transform: translateX(-100%); transition: transform 0.2s ease; }
  .admin-side.open { transform: translateX(0); }
  .admin-main { width: 100%; }
  .admin-content { padding: 16px; }
}

@media (max-width: 720px) {
  /* Tables scroll horizontally instead of squashing cells */
  table.docs, table.tbl { display: block; overflow-x: auto; white-space: nowrap; }

  .cards { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr; }
  .hero h1 { font-size: clamp(26px, 8vw, 38px); }
  .hero-cta { flex-direction: column; }
  .hero-cta .btn { width: 100%; }

  .btn { min-height: 42px; }

  .composer-foot { flex-direction: column; align-items: center; text-align: center; gap: 4px; }
  .empty-state { padding: 16px; }
  .modal { max-height: 94vh; border-radius: 14px; }
  .modal-body { padding: 14px; }
  .usage-grid .stat { min-width: 130px; }
  .auth-card { padding: 22px; }
  .admin-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
  .admin-head { padding: 12px 14px; }
}

@media (max-width: 480px) {
  .appbar { flex-direction: column; align-items: flex-start; gap: 6px; padding: 8px 12px; }
  .model-select { max-width: calc(100vw - 90px); }
  .model-select select { max-width: 175px; }
  .msg { gap: 10px; }
  .msg .avatar { width: 26px; height: 26px; }
  .disclaimer { padding: 2px 10px 8px; font-size: 10px; }
  .site-nav-inner { padding: 8px 12px; }
  /* Keep both auth buttons visible in one compact row */
  .site-auth { gap: 6px; padding-right: 4px; }
  .site-auth .btn { padding: 9px 12px; min-height: 38px; font-size: 13px; }
  .brand { font-size: 15px; }
  .site-links a { padding: 12px 8px; }
}

/* ============ lite animations ============ */

@keyframes rise-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

/* Hero: staggered entrance + ambient floating orbs */
.hero { position: relative; }
.hero-inner { position: relative; z-index: 1; }

.hero-inner > * { animation: rise-in 0.55s ease both; }
.hero-inner > *:nth-child(1) { animation-delay: 0.02s; }
.hero-inner > *:nth-child(2) { animation-delay: 0.1s; }
.hero-inner > *:nth-child(3) { animation-delay: 0.18s; }
.hero-inner > *:nth-child(4) { animation-delay: 0.26s; }
.hero-inner > *:nth-child(5) { animation-delay: 0.34s; }

/* Scroll-reveal (JS adds .in; --rd staggers siblings) */
.reveal { opacity: 0; }
.reveal.in { animation: rise-in 0.5s ease var(--rd, 0s) both; }

/* Chat: new messages / images */
.msg-enter { animation: rise-in 0.3s ease both; }
.img-fade { opacity: 0; transition: opacity 0.4s ease; }
.img-fade.img-in { opacity: 1; }

/* Empty-state logo glow */
.empty-state .logo { animation: logo-glow 3s ease-in-out infinite; }
@keyframes logo-glow {
  0%, 100% { box-shadow: 0 0 0 color-mix(in srgb, var(--accent) 0%, transparent); }
  50% { box-shadow: 0 0 22px color-mix(in srgb, var(--accent) 45%, transparent); }
}

/* Press feedback */
.btn:active:not(:disabled) { transform: scale(0.97); }
.send-btn:active:not(:disabled) { transform: scale(0.9); }

/* Smooth theme switch */
body, .site-nav, .site-footer, .admin-side, .auth-card, .panel, .composer, .modal, .stat { transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease; }

@media (max-width: 720px) {
  .hero::before, .hero::after { width: 280px; height: 280px; opacity: 0.35; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ============ theme toggle ============ */

.theme-toggle .ic-moon { display: none; }
html[data-theme="dark"] .theme-toggle .ic-moon { display: block; }
html[data-theme="dark"] .theme-toggle .ic-sun { display: none; }
html[data-theme="dark"] .theme-toggle { color: #22d3ee; }
html[data-theme="dark"] .theme-toggle:hover { color: #67e8f9; }
/* Streaming reply caret — subtle blink while tokens arrive */
.bubble.streaming::after {
  content: '';
  display: inline-block;
  width: 2px;
  height: 1em;
  margin-left: 2px;
  vertical-align: -0.15em;
  background: var(--accent);
  opacity: .6;
  animation: iwe3-caret 1s steps(1) infinite;
}
@keyframes iwe3-caret { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .bubble.streaming::after { animation: none; }
}

/* ============ Chat app — responsive (mobile) ============ */

@media (max-width: 720px) {
  /* Mobile: sidebar becomes an off-canvas drawer; toggle always visible. */
  .sidebar-toggle { display: inline-flex; }
  .chat-header .brand-mini { display: none; }
  .app .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 50;
    width: 280px; max-width: 85vw;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: 8px 0 30px rgba(0,0,0,0.25);
  }
  .app .sidebar.open { transform: translateX(0); }
  body.app-body.nav-open .backdrop { display: block; }
  .chat-header { padding: 10px 12px; gap: 8px; }
  .messages { padding: 12px 0; }
  .msg { padding: 10px 14px; }
  .msg-actions { opacity: 1; }
  .composer-wrap { padding: 6px 10px 10px; }
  .composer-inner { padding: 10px 10px 10px 14px; border-radius: 14px; }
  .suggestions { grid-template-columns: 1fr; gap: 6px; }
  .suggestions button { padding: 11px 13px; font-size: 13px; }
  .empty-state { padding: 16px 14px; justify-content: flex-start; padding-top: 10vh; }
  .empty-state h1 { font-size: 22px; }
  .empty-state p { font-size: 13.5px; }
  .user-avatar { width: 28px; height: 28px; }
}

@media (max-width: 480px) {
  .chat-header { padding: 8px 10px; }
  .model-select { padding: 5px 10px; max-width: calc(100vw - 80px); font-size: 12px; }
  .model-select select { max-width: 160px; font-size: 12px; }
  .msg .avatar { width: 24px; height: 24px; font-size: 11px; }
  .msg.user .bubble { border-radius: 16px 16px 4px 16px; padding: 9px 13px; font-size: 14.5px; }
  .composer textarea { font-size: 16px; } /* iOS avoids zoom-on-focus */
  .send-btn, .stop-btn { width: 30px; height: 30px; border-radius: 8px; }
  .composer-foot { font-size: 10px; }
  .disclaimer { padding: 2px 10px 6px; font-size: 10px; }
}
