/* ─────────────────────────────────────────────────────────────
   idiibi — conversational UI design system (light + dark)
   ───────────────────────────────────────────────────────────── */
@font-face { font-family: "Cairo"; src: url("/assets/fonts/Cairo-VF.ttf") format("truetype"); font-weight: 200 1000; font-display: swap; }
@font-face { font-family: "Amiri"; src: url("/assets/fonts/Amiri-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Amiri"; src: url("/assets/fonts/Amiri-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }

:root {
  --accent: #038387;
  --accent-2: #0aa3a8;
  --accent-ink: #035f62;
  --accent-soft: #e3f3f2;
  --accent-glow: rgba(3, 131, 135, .28);
  --bg: #faf9f5;
  --bg-2: #f3f1ea;
  --rail: #f1efe7;
  --surface: #ffffff;
  --surface-2: #f6f4ee;
  --text: #1f1e1b;
  --text-2: #3d3b36;
  --muted: #77736a;
  --border: #e6e2d7;
  --border-2: #d9d4c7;
  --danger: #c2413b;
  --ok: #1f8a5b;
  --warn: #a8690c;
  --shadow-sm: 0 1px 2px rgba(31, 30, 27, .06);
  --shadow: 0 6px 24px rgba(31, 30, 27, .07), 0 1px 3px rgba(31, 30, 27, .05);
  --shadow-lg: 0 24px 64px rgba(31, 30, 27, .14);
  --r-sm: 10px; --r: 16px; --r-lg: 24px;
  --font: "Cairo", "Segoe UI", Tahoma, system-ui, sans-serif;
  --serif: "Amiri", "Georgia", "Times New Roman", serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --rail-w: 272px;
  color-scheme: light;
}
[data-theme="dark"] {
  --accent: #2bb3b6;
  --accent-2: #5fd0d2;
  --accent-ink: #8fe3e4;
  --accent-soft: #15302f;
  --accent-glow: rgba(43, 179, 182, .25);
  --bg: #1c1c1b;
  --bg-2: #232322;
  --rail: #161615;
  --surface: #262625;
  --surface-2: #2e2e2c;
  --text: #ecebe6;
  --text-2: #d3d1ca;
  --muted: #9c998f;
  --border: #353533;
  --border-2: #42423f;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 8px 28px rgba(0, 0, 0, .35);
  --shadow-lg: 0 28px 70px rgba(0, 0, 0, .55);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 15.5px; line-height: 1.75; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; transition: background-color .35s var(--ease), color .35s var(--ease);
}
img, svg { max-width: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4 { line-height: 1.3; margin: 0 0 .45em; color: var(--text); }
p { margin: 0 0 .9em; }
button { font: inherit; color: inherit; }
::selection { background: var(--accent-glow); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.sr-only { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; inset-inline-start: 10px; inset-block-start: -60px; z-index: 200; background: var(--accent); color: #fff; padding: 8px 14px; border-radius: 10px; }
.skip:focus { inset-block-start: 10px; }
.ic { flex: none; vertical-align: middle; }
.muted { color: var(--muted); }
.serif { font-family: var(--serif); }
.nf { padding: 80px 16px; text-align: center; }

/* ───────── controls ───────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; white-space: nowrap;
  border: 1px solid transparent; border-radius: 12px; padding: 9px 16px; font-weight: 700; font-size: .93rem;
  background: var(--accent); color: #fff; transition: transform .18s var(--ease), background .2s, box-shadow .2s, opacity .2s;
}
[data-theme="dark"] .btn { color: #0d1d1d; }
.btn:hover { text-decoration: none; transform: translateY(-1px); box-shadow: 0 8px 22px var(--accent-glow); }
.btn:active { transform: translateY(0) scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border-2); }
[data-theme="dark"] .btn-ghost { color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); box-shadow: none; }
.btn-soft { background: var(--accent-soft); color: var(--accent-ink); }
[data-theme="dark"] .btn-soft { color: var(--accent-ink); }
.btn-danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
[data-theme="dark"] .btn-danger { color: #ff8a80; }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); box-shadow: none; }
.btn-sm { padding: 6px 12px; font-size: .84rem; border-radius: 10px; }
.btn-lg { padding: 12px 22px; font-size: 1rem; border-radius: 14px; }
.icon-btn {
  inline-size: 38px; block-size: 38px; display: inline-grid; place-items: center; border-radius: 10px; cursor: pointer;
  background: transparent; border: 1px solid transparent; color: var(--muted); transition: background .2s, color .2s, transform .2s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.icon-btn:active { transform: scale(.94); }
.icon-btn.recording { color: #fff; background: var(--danger); animation: pulse 1.2s infinite; }
.lang-btn { font-weight: 800; font-size: .78rem; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 13px; border-radius: 999px; cursor: pointer; white-space: nowrap;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-size: .85rem; font-weight: 600;
  transition: border-color .2s, background .2s, transform .2s, color .2s;
}
.chip:hover { border-color: var(--accent); color: var(--accent-ink); transform: translateY(-1px); }
.chip .ic { color: var(--accent); }
.theme-ico-dark { display: none; }
[data-theme="dark"] .theme-ico-dark { display: inline; }
[data-theme="dark"] .theme-ico-light { display: none; }

/* ───────── app shell (rail + stage) ───────── */
.app { display: grid; grid-template-columns: var(--rail-w) 1fr; min-block-size: 100dvh; transition: grid-template-columns .3s var(--ease); }
.app.rail-collapsed { grid-template-columns: 64px 1fr; }
.rail {
  position: sticky; inset-block-start: 0; block-size: 100dvh; background: var(--rail); border-inline-end: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 6px; padding: 12px 10px; overflow: hidden;
}
.rail-head { display: flex; align-items: center; gap: 8px; padding: 2px 4px 8px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 900; font-size: 1.15rem; color: var(--text); min-inline-size: 0; }
.brand:hover { text-decoration: none; }
.brand img { inline-size: 30px; block-size: 30px; flex: none; }
.brand small { display: block; font-size: .64rem; font-weight: 700; color: var(--muted); letter-spacing: .04em; line-height: 1; }
.rail-head .icon-btn { margin-inline-start: auto; }
.rail-link {
  display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 10px; color: var(--text-2); font-weight: 600; font-size: .92rem;
  white-space: nowrap; border: 0; background: none; cursor: pointer; inline-size: 100%; text-align: start; transition: background .18s, color .18s;
}
.rail-link .ic { color: var(--muted); transition: color .18s; }
.rail-link:hover { background: color-mix(in srgb, var(--text) 6%, transparent); text-decoration: none; color: var(--text); }
.rail-link.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.rail-link.active .ic, .rail-link:hover .ic { color: var(--accent); }
.rail-new { border: 1px solid var(--border-2); background: var(--surface); margin-block-end: 6px; }
.rail-new .ic { color: var(--accent); }
.rail-label { font-size: .72rem; font-weight: 800; color: var(--muted); padding: 12px 10px 4px; letter-spacing: .03em; white-space: nowrap; }
.rail-scroll { flex: 1; overflow-y: auto; min-block-size: 0; display: flex; flex-direction: column; gap: 2px; margin-inline: -4px; padding-inline: 4px; }
.recent { font-weight: 500; font-size: .87rem; }
.recent span { overflow: hidden; text-overflow: ellipsis; }
.rail-foot { border-block-start: 1px solid var(--border); padding-block-start: 8px; display: grid; gap: 6px; }
.rail-tools { display: flex; gap: 4px; }
.rail-cta {
  display: grid; gap: 6px; padding: 12px; border-radius: 14px; color: var(--text);
  background: linear-gradient(135deg, var(--accent-soft), transparent 80%), var(--surface); border: 1px solid var(--border);
}
.rail-cta b { font-size: .88rem; } .rail-cta small { color: var(--muted); font-size: .78rem; line-height: 1.5; }
.app.rail-collapsed .rail-label, .app.rail-collapsed .rail-link span, .app.rail-collapsed .brand span,
.app.rail-collapsed .rail-cta, .app.rail-collapsed .recent, .app.rail-collapsed .rail-tools .lang-btn { display: none; }
.app.rail-collapsed .rail-head { flex-direction: column; }
.app.rail-collapsed .rail-head .icon-btn { margin: 0; }
.app.rail-collapsed .rail-link { justify-content: center; padding: 10px 0; }
.app.rail-collapsed .rail-tools { flex-direction: column; align-items: center; }

.stage { min-inline-size: 0; display: flex; flex-direction: column; position: relative; }
.topbar {
  position: sticky; inset-block-start: 0; z-index: 20; display: flex; align-items: center; gap: 8px; padding: 10px 18px; min-block-size: 56px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.4) blur(14px);
}
.topbar .title { font-weight: 700; color: var(--text-2); display: flex; align-items: center; gap: 8px; font-size: .95rem; }
.topbar .title .dot { inline-size: 8px; block-size: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 18%, transparent); }
.topbar .end { margin-inline-start: auto; display: flex; align-items: center; gap: 6px; }
.mobile-only { display: none; }
.scrim { display: none; }

/* ───────── conversation thread ───────── */
.thread { flex: 1; display: flex; flex-direction: column; inline-size: min(780px, 100% - 32px); margin-inline: auto; min-block-size: calc(100dvh - 56px); }
.hello { position: relative; text-align: center; padding-block: clamp(36px, 10vh, 110px) 22px; display: grid; justify-items: center; gap: 16px; }
.hello h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(2rem, 5.2vw, 3.1rem); letter-spacing: -.01em; line-height: 1.25; margin: 0; }
.hello h1 em { font-style: normal; color: var(--accent); }
.hello .tagline { color: var(--muted); font-size: .95rem; margin: 0; direction: ltr; }
.hello-mark { color: var(--accent); filter: drop-shadow(0 6px 18px var(--accent-glow)); }
.hello-mark .bm { animation: bm-in 1s var(--ease) both; }
.hello-mark .bm-head { animation: bm-float 3.4s ease-in-out 1s infinite; }
.hello-mark .bm-chip { animation: bm-chip 3.4s ease-in-out 1s infinite; }
.chat-log { display: flex; flex-direction: column; gap: 22px; padding-block: 24px 12px; }
.chat-log:empty { display: none; }
.composer {
  position: relative; z-index: 2; display: grid; gap: 4px; padding: 10px 12px 8px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 22px; box-shadow: var(--shadow); transition: border-color .2s, box-shadow .25s;
}
.composer:focus-within { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); box-shadow: var(--shadow), 0 0 0 4px var(--accent-glow); }
.composer textarea {
  inline-size: 100%; resize: none; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; font-size: 1rem;
  padding: 6px 6px; min-block-size: 30px; max-block-size: 220px; line-height: 1.6;
}
.composer textarea::placeholder { color: var(--muted); }
.composer-row { display: flex; align-items: center; gap: 4px; }
.composer-row .hint { font-size: .74rem; color: var(--muted); margin-inline: 6px auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.send-btn {
  inline-size: 36px; block-size: 36px; border-radius: 11px; border: 0; cursor: pointer; display: grid; place-items: center;
  background: var(--accent); color: #fff; transition: transform .18s var(--ease), opacity .2s, background .2s; margin-inline-start: auto;
}
[data-theme="dark"] .send-btn { color: #0d1d1d; }
.send-btn:hover { transform: translateY(-1px); }
.send-btn:disabled { opacity: .35; cursor: default; transform: none; }
.suggest { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr)); gap: 10px; inline-size: 100%; margin-block-start: 14px; }
.suggest button {
  display: grid; gap: 4px; justify-items: start; text-align: start; padding: 14px; cursor: pointer; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text); transition: transform .25s var(--ease), border-color .2s, box-shadow .25s;
}
.suggest button:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: var(--shadow); }
.suggest .s-ico { inline-size: 34px; block-size: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-block-end: 4px; }
.suggest b { font-size: .9rem; } .suggest small { color: var(--muted); font-size: .78rem; line-height: 1.45; }
.chips-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-block-start: 12px; }
.composer-dock { position: sticky; inset-block-end: 0; padding-block: 8px 14px; background: linear-gradient(to top, var(--bg) 70%, transparent); z-index: 5; }
.disclaimer { text-align: center; font-size: .74rem; color: var(--muted); margin: 8px 0 0; }

/* chatting state: greeting collapses, composer docks at the bottom */
.thread.chatting .hello { display: none; }
.thread.chatting .chat-log { flex: 1; }
.thread:not(.chatting) .composer-dock { position: static; background: none; padding: 0; }

/* messages */
.msg { animation: rise .45s var(--ease) both; overflow-wrap: anywhere; }
.msg.user {
  align-self: flex-end; max-inline-size: 82%; background: var(--surface-2); border: 1px solid var(--border); padding: 10px 16px;
  border-radius: 20px; border-end-end-radius: 6px; white-space: pre-wrap; color: var(--text);
}
.msg.bot { display: grid; grid-template-columns: 30px 1fr; gap: 12px; align-items: start; }
.msg.bot .who { color: var(--accent); padding-block-start: 2px; }
.msg.bot .body { white-space: pre-wrap; color: var(--text-2); min-inline-size: 0; }
.msg.bot .body a { font-weight: 700; }
.msg.bot .tools { display: flex; gap: 2px; margin-block-start: 6px; opacity: 0; transition: opacity .2s; }
.msg.bot:hover .tools, .msg.bot:focus-within .tools { opacity: 1; }
.msg.bot .tools .icon-btn { inline-size: 30px; block-size: 30px; }
.msg.thinking .who .bm-head { animation: bm-bounce .75s ease-in-out infinite; }
.msg.thinking .who .bm-body { animation: breathe 1.5s ease-in-out infinite; }
.msg.thinking .who .bm-chip { animation: bm-chip .75s ease-in-out infinite; }
.msg.thinking .body { background: linear-gradient(90deg, var(--muted) 0%, var(--text) 40%, var(--muted) 80%); background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmer 1.6s linear infinite; }
.caret::after { content: ""; display: inline-block; inline-size: 7px; block-size: 1.05em; margin-inline-start: 3px; vertical-align: -2px; background: var(--accent); border-radius: 2px; animation: blink .9s steps(2) infinite; }

/* confirmation card (artifact-style) */
.msg.card {
  inline-size: 100%; max-inline-size: 640px; margin-inline-start: 42px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; overflow: hidden; box-shadow: var(--shadow);
}
.card-title { display: flex; align-items: center; gap: 10px; padding: 12px 16px; font-weight: 800; border-block-end: 1px solid var(--border); background: var(--surface-2); }
.card-title .badge-ico { inline-size: 28px; block-size: 28px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.card-title .pending { margin-inline-start: auto; font-size: .72rem; font-weight: 700; color: var(--warn); display: flex; align-items: center; gap: 6px; }
.card-title .pending::before { content: ""; inline-size: 7px; block-size: 7px; border-radius: 50%; background: currentColor; animation: pulse 1.4s infinite; }
.kv { display: grid; grid-template-columns: minmax(110px, 32%) 1fr; font-size: .9rem; }
.kv > div { padding: 9px 16px; border-block-end: 1px solid var(--border); white-space: pre-wrap; overflow-wrap: anywhere; }
.kv > .k { color: var(--muted); font-size: .84rem; }
.kv .old { display: block; color: var(--danger); text-decoration: line-through; opacity: .75; font-size: .82rem; }
.card-note { padding: 10px 16px; font-size: .86rem; color: var(--warn); background: color-mix(in srgb, var(--warn) 9%, transparent); border-block-end: 1px solid var(--border); }
.card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 16px; }
.card-actions .q { inline-size: 100%; font-weight: 700; color: var(--text-2); font-size: .9rem; }
.card-result { display: flex; align-items: center; gap: 10px; font-weight: 700; animation: rise .4s var(--ease) both; }
.card-result .tick { inline-size: 28px; block-size: 28px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: var(--ok); animation: pop .5s var(--ease) both; }
.card-result.fail .tick { background: var(--muted); }
.msg.card.done .card-title .pending { display: none; }
.badge { display: inline-flex; align-items: center; padding: 1px 10px; border-radius: 999px; font-size: .76rem; font-weight: 800; background: var(--accent-soft); color: var(--accent-ink); }
.badge.draft { background: #fbefd5; color: #8a5a07; } .badge.published, .badge.success { background: #dcf2e6; color: #176b46; }
.badge.hidden, .badge.undone { background: #ecebe6; color: #5d5a52; } .badge.archived, .badge.failed { background: #f8e0dd; color: #9b2f29; }
[data-theme="dark"] .badge.draft { background: #3c3020; color: #f0c674; } [data-theme="dark"] .badge.published, [data-theme="dark"] .badge.success { background: #1e3a2c; color: #7ee0aa; }
[data-theme="dark"] .badge.hidden, [data-theme="dark"] .badge.undone { background: #3a3a37; color: #c9c6bd; } [data-theme="dark"] .badge.archived, [data-theme="dark"] .badge.failed { background: #45231f; color: #ff9d92; }

/* ───────── decorative art & motion ───────── */
.aurora { position: absolute; inset: -40px 0 auto; block-size: 420px; pointer-events: none; z-index: -1; overflow: hidden; mask-image: radial-gradient(ellipse at 50% 30%, #000 30%, transparent 70%); }
.aurora i { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .55; }
.aurora i:nth-child(1) { inline-size: 340px; block-size: 340px; background: #7fd6d3; inset-inline-start: 18%; inset-block-start: -60px; animation: drift1 18s ease-in-out infinite; }
.aurora i:nth-child(2) { inline-size: 280px; block-size: 280px; background: #f5d9a8; inset-inline-end: 16%; inset-block-start: 10px; animation: drift2 22s ease-in-out infinite; }
.aurora i:nth-child(3) { inline-size: 220px; block-size: 220px; background: #b7c7f2; inset-inline-start: 44%; inset-block-start: 80px; animation: drift1 26s ease-in-out infinite reverse; }
[data-theme="dark"] .aurora i { opacity: .22; }
.dots { position: absolute; inset: 0; pointer-events: none; z-index: -2; opacity: .5;
  background-image: radial-gradient(color-mix(in srgb, var(--text) 18%, transparent) 1px, transparent 1.2px); background-size: 22px 22px;
  mask-image: radial-gradient(ellipse at 50% 20%, #000 10%, transparent 60%); }
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
.stagger > * { animation: rise .6s var(--ease) both; }
.stagger > *:nth-child(2) { animation-delay: .08s; } .stagger > *:nth-child(3) { animation-delay: .16s; } .stagger > *:nth-child(4) { animation-delay: .24s; }
.stagger > *:nth-child(5) { animation-delay: .32s; } .stagger > *:nth-child(6) { animation-delay: .4s; }

@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes breathe { 50% { opacity: .55; } }
@keyframes bm-in { from { opacity: 0; transform: translateY(14px) scale(.6); } to { opacity: 1; transform: none; } }
@keyframes bm-float { 50% { transform: translateY(-34px); } }
@keyframes bm-bounce { 50% { transform: translateY(-70px); } }
@keyframes bm-chip { 50% { opacity: .45; transform: translate(-10px, -10px); } }
.bm { overflow: visible; }
.bm-head, .bm-body, .bm-chip { transform-box: view-box; }
.bm-chip { opacity: .75; }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes pulse { 50% { opacity: .45; } }
@keyframes pop { 0% { transform: scale(.3); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }
@keyframes drift1 { 50% { transform: translate(60px, 30px) scale(1.12); } }
@keyframes drift2 { 50% { transform: translate(-50px, 40px) scale(.9); } }
@keyframes marquee { to { transform: translateX(-50%); } }
@keyframes marquee-rtl { to { transform: translateX(50%); } }
@keyframes orbit { to { transform: rotate(360deg); } }
@keyframes counter { to { transform: rotate(-360deg); } }
@keyframes float { 50% { transform: translateY(-8px); } }
@keyframes dash { to { stroke-dashoffset: 0; } }

/* ───────── explore sections (public) ───────── */
.explore { inline-size: min(1080px, 100% - 32px); margin-inline: auto; padding-block: 30px 60px; display: grid; gap: 80px; }
.thread.chatting ~ .explore { display: none; }
.sec-head { text-align: center; max-inline-size: 640px; margin: 0 auto 28px; }
.sec-head .eyebrow { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 800; color: var(--accent); letter-spacing: .04em; margin-block-end: 6px; }
.sec-head h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(1.7rem, 3.6vw, 2.4rem); margin: 0 0 6px; }
.sec-head p { color: var(--muted); margin: 0; }

.os-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: center; }
.orbit { position: relative; aspect-ratio: 1; inline-size: min(440px, 100%); margin-inline: auto; }
.orbit .ring { position: absolute; inset: 0; border-radius: 50%; border: 1px dashed var(--border-2); }
.orbit .ring.r2 { inset: 17%; border-style: solid; border-color: var(--border); }
.orbit .core {
  position: absolute; inset: 36%; border-radius: 50%; display: grid; place-items: center; background: var(--surface);
  box-shadow: 0 0 0 10px color-mix(in srgb, var(--accent) 8%, transparent), 0 0 60px var(--accent-glow), var(--shadow); animation: float 6s ease-in-out infinite;
}
.orbit .core img { inline-size: 54%; }
.orbit .spin { position: absolute; inset: 0; animation: orbit 60s linear infinite; }
.orbit .node {
  position: absolute; inline-size: 74px; block-size: 74px; margin: -37px; border-radius: 22px; display: grid; place-items: center; gap: 0;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); color: var(--accent); animation: counter 60s linear infinite;
  font-size: .68rem; font-weight: 800; text-align: center; line-height: 1.1; padding-block: 8px;
}
.orbit .node span { color: var(--text-2); }
.orbit .n0 { inset-block-start: 0; inset-inline-start: 50%; } .orbit .n1 { inset-block-start: 14.6%; inset-inline-start: 85.4%; }
.orbit .n2 { inset-block-start: 50%; inset-inline-start: 100%; } .orbit .n3 { inset-block-start: 85.4%; inset-inline-start: 85.4%; }
.orbit .n4 { inset-block-start: 100%; inset-inline-start: 50%; } .orbit .n5 { inset-block-start: 85.4%; inset-inline-start: 14.6%; }
.orbit .n6 { inset-block-start: 50%; inset-inline-start: 0; } .orbit .n7 { inset-block-start: 14.6%; inset-inline-start: 14.6%; }
.orbit:hover .spin, .orbit:hover .node { animation-play-state: paused; }
.os-list { display: grid; gap: 10px; }
.os-item { display: grid; grid-template-columns: 40px 1fr; gap: 12px; padding: 12px 14px; border-radius: 14px; border: 1px solid transparent; transition: background .2s, border-color .2s; }
.os-item:hover { background: var(--surface); border-color: var(--border); }
.os-item .s-ico { inline-size: 40px; block-size: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.os-item b { display: block; } .os-item small { color: var(--muted); font-size: .84rem; line-height: 1.5; display: block; }

.svc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 14px; }
.svc {
  position: relative; display: grid; gap: 10px; align-content: start; padding: 20px; border-radius: 20px; background: var(--surface); border: 1px solid var(--border);
  overflow: hidden; transition: transform .35s var(--ease), box-shadow .35s, border-color .25s;
}
.svc::before { content: ""; position: absolute; inset: auto -40px -60px auto; inline-size: 160px; block-size: 160px; border-radius: 50%; background: radial-gradient(circle, var(--accent-glow), transparent 70%); opacity: 0; transition: opacity .35s; }
.svc:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.svc:hover::before { opacity: 1; }
.svc .s-ico { inline-size: 46px; block-size: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); transition: transform .35s var(--ease); }
.svc:hover .s-ico { transform: rotate(-8deg) scale(1.08); }
.svc h3 { font-size: 1.05rem; margin: 0; }
.svc p { color: var(--muted); font-size: .9rem; margin: 0; }
.tags { display: flex; flex-wrap: wrap; gap: 5px; margin: 0; padding: 0; list-style: none; }
.tags li { font-size: .72rem; padding: 2px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); direction: ltr; border: 1px solid var(--border); }
.svc .ask { justify-self: start; margin-block-start: 4px; }

.marquee { position: relative; overflow: hidden; mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); padding-block: 6px; }
.marquee-track { display: flex; gap: 14px; inline-size: max-content; animation: marquee 60s linear infinite; }
html[dir="rtl"] .marquee-track { animation-name: marquee-rtl; }
.marquee:hover .marquee-track { animation-play-state: paused; }
.proj {
  inline-size: 220px; flex: none; border-radius: 18px; overflow: hidden; background: var(--surface); border: 1px solid var(--border); color: var(--text);
  transition: transform .3s var(--ease), box-shadow .3s;
}
.proj:hover { transform: translateY(-4px) rotate(-.4deg); box-shadow: var(--shadow-lg); text-decoration: none; }
.proj-art { position: relative; block-size: 120px; display: grid; place-items: center; color: #fff; font-family: var(--serif); font-size: 2.1rem; overflow: hidden; }
.proj-art::before, .proj-art::after { content: ""; position: absolute; border-radius: 50%; border: 1.5px solid rgba(255, 255, 255, .35); }
.proj-art::before { inline-size: 160px; block-size: 160px; inset-inline-end: -50px; inset-block-start: -60px; }
.proj-art::after { inline-size: 90px; block-size: 90px; inset-inline-start: -20px; inset-block-end: -40px; background: rgba(255, 255, 255, .1); }
.proj-art span { position: relative; z-index: 1; text-shadow: 0 4px 20px rgba(0, 0, 0, .25); }
.proj-info { padding: 10px 14px 14px; display: grid; }
.proj-info b { font-size: .92rem; } .proj-info small { color: var(--muted); font-size: .78rem; }
.hue-0 { background: linear-gradient(135deg, #038387, #46c1b8); } .hue-1 { background: linear-gradient(135deg, #24476b, #4f8dc4); }
.hue-2 { background: linear-gradient(135deg, #b4602f, #e8a15d); } .hue-3 { background: linear-gradient(135deg, #5b4a99, #9b87e0); }
.hue-4 { background: linear-gradient(135deg, #2f6b4a, #6cbc8b); } .hue-5 { background: linear-gradient(135deg, #8c3d52, #d97a8f); }
.hue-6 { background: linear-gradient(135deg, #3d4b55, #7b919f); } .hue-7 { background: linear-gradient(135deg, #a0782a, #dfbb62); }

.timeline { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; position: relative; }
.timeline::before { content: ""; position: absolute; inset-inline: 8%; inset-block-start: 26px; block-size: 2px; background: linear-gradient(90deg, var(--accent), var(--border-2)); }
.tstep { position: relative; text-align: center; display: grid; gap: 6px; justify-items: center; padding-inline: 6px; }
.tstep .num { inline-size: 54px; block-size: 54px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 2px solid var(--accent); color: var(--accent); font-weight: 900; font-size: 1.1rem; box-shadow: 0 0 0 8px var(--bg); }
.tstep b { margin-block-start: 6px; } .tstep small { color: var(--muted); font-size: .86rem; }

.faq-list { max-inline-size: 760px; margin-inline: auto; display: grid; gap: 8px; }
details.faq { border: 1px solid var(--border); border-radius: 14px; background: var(--surface); transition: border-color .2s, box-shadow .2s; }
details.faq[open] { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); box-shadow: var(--shadow); }
details.faq summary { cursor: pointer; list-style: none; padding: 14px 18px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::after { content: "+"; margin-inline-start: auto; color: var(--accent); font-size: 1.3rem; line-height: 1; transition: transform .3s var(--ease); }
details.faq[open] summary::after { transform: rotate(45deg); }
details.faq p { padding: 0 18px 16px; margin: 0; color: var(--muted); animation: rise .35s var(--ease); }

.cta {
  position: relative; overflow: hidden; border-radius: 28px; padding: clamp(28px, 6vw, 56px); text-align: center; color: #fff;
  background: radial-gradient(600px 300px at 85% 0%, rgba(255, 255, 255, .18), transparent 60%), linear-gradient(135deg, #035c60, #038387 55%, #2bb3b6);
}
.cta h2 { color: #fff; font-family: var(--serif); font-weight: 400; font-size: clamp(1.7rem, 4vw, 2.5rem); }
.cta p { opacity: .88; }
.cta .btn { background: #fff; color: #035c60; }
.cta .art { position: absolute; inset-inline-end: -20px; inset-block-end: -40px; inline-size: 220px; opacity: .18; color: #fff; animation: float 7s ease-in-out infinite; }
.site-foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 24px 16px 34px; }

/* ───────── admin pages ───────── */
.page { inline-size: min(1100px, 100% - 32px); margin-inline: auto; padding-block: 8px 40px; display: grid; gap: 18px; animation: rise .5s var(--ease) both; }
.page-head h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(1.6rem, 3vw, 2.1rem); margin: 0; }
.page-head p { color: var(--muted); margin: 0; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 20px; box-shadow: var(--shadow-sm); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr)); gap: 12px; }
.stat { position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 16px; display: grid; gap: 2px; transition: transform .25s var(--ease), box-shadow .25s; }
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.stat b { font-family: var(--serif); font-size: 2.2rem; line-height: 1.1; color: var(--accent); font-weight: 700; }
.stat span { color: var(--muted); font-weight: 600; font-size: .86rem; }
.stat small { color: var(--muted); font-size: .76rem; }
.tbl-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); }
table.tbl { inline-size: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th, .tbl td { padding: 11px 14px; text-align: start; border-block-end: 1px solid var(--border); vertical-align: middle; }
.tbl th { color: var(--muted); font-size: .76rem; font-weight: 800; white-space: nowrap; background: var(--surface-2); }
.tbl tbody tr { transition: background .15s; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tr:last-child td { border-block-end: 0; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.filters a { padding: 5px 13px; border-radius: 999px; border: 1px solid var(--border); color: var(--text-2); font-weight: 700; font-size: .82rem; background: var(--surface); }
.filters a:hover { text-decoration: none; border-color: var(--accent); }
.filters a.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.kv-list { display: grid; gap: 6px; }
.kv-list > div { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; padding: 10px 14px; border-radius: 12px; background: var(--surface-2); }
.kv-list b { direction: ltr; }
.note-box { display: flex; gap: 10px; align-items: flex-start; border-radius: 12px; padding: 10px 14px; font-size: .86rem; background: var(--accent-soft); color: var(--accent-ink); }
.field { display: grid; gap: 6px; font-weight: 700; font-size: .88rem; }
.field input, .field textarea {
  font: inherit; font-weight: 500; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--border-2); background: var(--surface); color: var(--text); transition: border-color .2s, box-shadow .2s;
}
.field input:focus, .field textarea:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-glow); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 12px; align-items: end; }
.err { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); padding: 10px 14px; border-radius: 12px; font-weight: 700; font-size: .88rem; }

/* login */
.login-wrap { position: relative; min-block-size: 100dvh; display: grid; place-items: center; padding: 20px; overflow: hidden; isolation: isolate; }
.login-wrap .aurora { inset: 0; block-size: auto; mask-image: none; }
.login { inline-size: min(400px, 100%); display: grid; gap: 14px; padding: 30px; border-radius: 24px; background: color-mix(in srgb, var(--surface) 88%, transparent); border: 1px solid var(--border); box-shadow: var(--shadow-lg); backdrop-filter: blur(18px); animation: rise .6s var(--ease) both; }
.login .mark { justify-self: center; color: var(--accent); }
.login .mark .bm { animation: bm-in 1s var(--ease) both; }
.login .mark .bm-head { animation: bm-float 3.4s ease-in-out 1s infinite; }
.login h1 { font-family: var(--serif); font-weight: 400; text-align: center; font-size: 1.8rem; margin: 0; }
.login p { text-align: center; color: var(--muted); margin: 0; font-size: .9rem; }

/* dialogs */
dialog { border: 1px solid var(--border); border-radius: 20px; padding: 0; inline-size: min(640px, 94vw); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
dialog[open] { animation: pop-in .3s var(--ease); }
@keyframes pop-in { from { opacity: 0; transform: translateY(10px) scale(.97); } }
dialog::backdrop { background: rgba(20, 20, 18, .45); backdrop-filter: blur(4px); }
.dlg-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-block-end: 1px solid var(--border); font-weight: 800; }
.dlg-head .icon-btn { margin-inline-start: auto; }
.dlg-body { padding: 16px; display: grid; gap: 12px; max-block-size: 72dvh; overflow: auto; }
.dlg-body .msg.card { margin: 0; max-inline-size: none; }
pre.json { margin: 0; padding: 14px; border-radius: 12px; overflow: auto; direction: ltr; text-align: left; font-size: .8rem; background: #1b1b1a; color: #a8e6e3; }
textarea.json-edit { inline-size: 100%; min-block-size: 240px; direction: ltr; text-align: left; font: .8rem/1.6 ui-monospace, Consolas, monospace; padding: 12px; border-radius: 12px; border: 1px solid var(--border-2); background: var(--surface-2); color: var(--text); }
.dropzone { display: grid; gap: 8px; justify-items: center; text-align: center; padding: 30px 20px; border-radius: 18px; border: 2px dashed var(--border-2); background: var(--surface-2); color: var(--muted); transition: border-color .2s, background .2s, transform .2s; }
.dropzone .ic { color: var(--accent); animation: float 3s ease-in-out infinite; }
.dropzone.drop-active, .drop-active .composer { border-color: var(--accent); background: var(--accent-soft); transform: scale(1.01); }
.toast { position: fixed; inset-block-end: 24px; inset-inline-start: 50%; transform: translateX(-50%); z-index: 300; padding: 10px 18px; border-radius: 12px; background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg); font-weight: 600; animation: rise .35s var(--ease); }

/* ───────── responsive ───────── */
@media (max-width: 900px) {
  .app, .app.rail-collapsed { grid-template-columns: 1fr; }
  .rail { position: fixed; inset-block: 0; inset-inline-start: 0; inline-size: min(300px, 86vw); z-index: 60; transform: translateX(-104%); transition: transform .3s var(--ease); box-shadow: var(--shadow-lg); }
  html[dir="rtl"] .rail { transform: translateX(104%); }
  html[dir] .app.rail-open .rail { transform: none; }
  .app.rail-open .scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(20, 20, 18, .4); backdrop-filter: blur(2px); animation: rise .2s; }
  .app.rail-collapsed .rail-label, .app.rail-collapsed .rail-link span, .app.rail-collapsed .brand span, .app.rail-collapsed .rail-cta, .app.rail-collapsed .recent { display: revert; }
  .mobile-only { display: inline-grid; }
  .desk-only { display: none; }
  .os-wrap { grid-template-columns: 1fr; }
  .timeline { grid-template-columns: 1fr 1fr; row-gap: 26px; }
  .timeline::before { display: none; }
}
@media (max-width: 560px) {
  body { font-size: 15px; }
  .topbar { padding-inline: 10px; }
  .thread, .page { inline-size: calc(100% - 20px); }
  .msg.user { max-inline-size: 90%; }
  .msg.card { margin-inline-start: 0; }
  .kv { grid-template-columns: 1fr; } .kv > .k { padding-block-end: 0; border-block-end: 0; }
  .orbit .node { inline-size: 58px; block-size: 58px; margin: -29px; font-size: .6rem; border-radius: 16px; }
  .composer-row .hint { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .reveal { opacity: 1; transform: none; }
}
.hello.hello-after { padding-block: 0 28px; gap: 0; }
.login-theme { position: absolute; inset-block-start: 16px; inset-inline-end: 16px; }
.login > a { text-align: center; font-size: .85rem; }
.contact-form { display: grid; gap: 12px; }
.app { overflow-x: clip; }
.explore > * { min-inline-size: 0; }
.thread.chatting ~ .site-foot { display: none; }
.thread.chatting { padding-block-start: 8px; }

/* ───────── v2 components ───────── */
.msg.bot .col { min-inline-size: 0; }
.msg.bot .body.status { color: var(--muted); font-size: .9rem; }
.rail-link .count, .count { margin-inline-start: auto; font-style: normal; font-size: .7rem; font-weight: 800; min-inline-size: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: #fff; text-align: center; line-height: 18px; animation: pop .4s var(--ease); }
.app.rail-collapsed .rail-link .count { display: none; }
.recent-row { display: flex; align-items: center; gap: 2px; }
.recent-row .recent { flex: 1; min-inline-size: 0; }
.recent-row .del { inline-size: 26px; block-size: 26px; opacity: 0; }
.recent-row:hover .del, .recent-row .del:focus-visible { opacity: 1; }
.app.rail-collapsed .recent-row { display: none; }
.ai-state b { display: flex; align-items: center; gap: 8px; }
.ai-state .led { inline-size: 9px; block-size: 9px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 20%, transparent); }
.ai-state.off .led { background: var(--warn); box-shadow: 0 0 0 4px color-mix(in srgb, var(--warn) 22%, transparent); animation: pulse 1.6s infinite; }
.ai-state:hover { text-decoration: none; border-color: var(--accent); }
.topbar .title .dot.warn { background: var(--warn); box-shadow: 0 0 0 4px color-mix(in srgb, var(--warn) 20%, transparent); }

.bell-wrap { position: relative; }
.bell { position: relative; }
.bell-count { position: absolute; inset-block-start: 3px; inset-inline-end: 2px; font-style: normal; font-size: .62rem; font-weight: 800; min-inline-size: 17px; block-size: 17px; line-height: 17px; padding: 0 4px; border-radius: 999px; background: var(--danger); color: #fff; animation: pop .4s var(--ease); }
.bell-panel { position: absolute; inset-block-start: calc(100% + 8px); inset-inline-end: 0; inline-size: min(380px, 92vw); z-index: 80; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-lg); overflow: hidden; animation: pop-in .25s var(--ease); }
.bell-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-block-end: 1px solid var(--border); }
.bell-list { max-block-size: 380px; overflow-y: auto; }
.bell-foot { display: block; text-align: center; padding: 10px; font-weight: 700; font-size: .86rem; border-block-start: 1px solid var(--border); }
.notif { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: start; padding: 11px 14px; color: var(--text); border-block-end: 1px solid var(--border); transition: background .15s; }
.notif:last-child { border-block-end: 0; }
.notif:hover { background: var(--surface-2); text-decoration: none; }
.notif.unread { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.notif.unread .n-main b::before { content: ""; display: inline-block; inline-size: 7px; block-size: 7px; border-radius: 50%; background: var(--accent); margin-inline-end: 6px; vertical-align: middle; }
.n-ico { inline-size: 34px; block-size: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.n-ico.lead { background: #fdecd3; color: #9a5b07; } .n-ico.security { background: #f8e0dd; color: #9b2f29; } .n-ico.change { background: #dcf2e6; color: #176b46; }
.n-main { display: grid; min-inline-size: 0; } .n-main b { font-size: .9rem; } .n-main small { color: var(--muted); font-size: .8rem; line-height: 1.5; }
.notif time { font-size: .74rem; white-space: nowrap; }
.notif-list { padding: 0; overflow: hidden; }
.empty { display: grid; justify-items: center; gap: 8px; text-align: center; padding: 34px 16px; color: var(--muted); }
.empty .bm { color: var(--accent); opacity: .8; }
.empty.small { padding: 18px; font-size: .86rem; }
.empty p { max-inline-size: 460px; margin: 0; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.toolbar .filters { margin-inline-end: auto; }
.search { display: flex; align-items: center; gap: 8px; padding: 0 12px; block-size: 38px; border-radius: 12px; border: 1px solid var(--border-2); background: var(--surface); color: var(--muted); }
.search input { border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; inline-size: min(240px, 50vw); }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-glow); }
.row-actions { white-space: nowrap; }
.row-actions .icon-btn { inline-size: 32px; block-size: 32px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.panel h3 { display: flex; align-items: center; gap: 8px; font-size: 1.02rem; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-block-end: 8px; }
.panel-head h3 { margin: 0; }
.stat { color: var(--text); }
.stat:hover { text-decoration: none; border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.stat-ico { position: absolute; inset-block-start: 14px; inset-inline-end: 14px; inline-size: 32px; block-size: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }

.legend { display: flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--muted); margin-block-end: 8px; }
.lg { inline-size: 10px; block-size: 10px; border-radius: 3px; display: inline-block; margin-inline-start: 8px; }
.lg.c-conv, .bar.c-conv { background: var(--accent); } .lg.c-lead, .bar.c-lead { background: #e0a14a; }
.bars { display: grid; grid-template-columns: repeat(14, 1fr); gap: 6px; align-items: end; block-size: 170px; padding-block-start: 10px; }
.bar-col { display: grid; grid-template-rows: 1fr auto; grid-template-columns: 1fr 1fr; gap: 2px; block-size: 100%; align-items: end; }
.bar-col small { grid-column: 1 / -1; text-align: center; font-size: .66rem; color: var(--muted); }
.bar { display: block; border-radius: 4px 4px 1px 1px; min-block-size: 3px; transform-origin: bottom; animation: grow .8s var(--ease) both; }
@keyframes grow { from { transform: scaleY(0); } }
.h0 { block-size: 3px; opacity: .35; } .h1 { block-size: 5%; } .h2 { block-size: 10%; } .h3 { block-size: 15%; } .h4 { block-size: 20%; } .h5 { block-size: 25%; } .h6 { block-size: 30%; } .h7 { block-size: 35%; }
.h8 { block-size: 40%; } .h9 { block-size: 45%; } .h10 { block-size: 50%; } .h11 { block-size: 55%; } .h12 { block-size: 60%; } .h13 { block-size: 65%; } .h14 { block-size: 70%; }
.h15 { block-size: 75%; } .h16 { block-size: 80%; } .h17 { block-size: 85%; } .h18 { block-size: 90%; } .h19 { block-size: 95%; } .h20 { block-size: 100%; }
.meter { display: flex; block-size: 12px; border-radius: 999px; overflow: hidden; background: var(--surface-2); margin-block-end: 12px; }
.seg { display: block; animation: grow-x .9s var(--ease) both; transform-origin: left; }
@keyframes grow-x { from { transform: scaleX(0); } }
.seg.published { background: #2f9e6a; } .seg.draft { background: #e0a14a; } .seg.hidden { background: #9a978e; } .seg.archived { background: #c95a50; }
.w0 { inline-size: 0; } .w1 { inline-size: 5%; } .w2 { inline-size: 10%; } .w3 { inline-size: 15%; } .w4 { inline-size: 20%; } .w5 { inline-size: 25%; } .w6 { inline-size: 30%; } .w7 { inline-size: 35%; }
.w8 { inline-size: 40%; } .w9 { inline-size: 45%; } .w10 { inline-size: 50%; } .w11 { inline-size: 55%; } .w12 { inline-size: 60%; } .w13 { inline-size: 65%; } .w14 { inline-size: 70%; }
.w15 { inline-size: 75%; } .w16 { inline-size: 80%; } .w17 { inline-size: 85%; } .w18 { inline-size: 90%; } .w19 { inline-size: 95%; } .w20 { inline-size: 100%; }

.badge.lead-new { background: #fdecd3; color: #9a5b07; } .badge.lead-contacted { background: #dde9f8; color: #2b5d96; } .badge.lead-qualified { background: var(--accent-soft); color: var(--accent-ink); }
.badge.lead-won { background: #dcf2e6; color: #176b46; } .badge.lead-lost { background: #ecebe6; color: #5d5a52; }
[data-theme="dark"] .badge.lead-new { background: #3c3020; color: #f0c674; } [data-theme="dark"] .badge.lead-contacted { background: #1f2c3d; color: #9cc3f2; }
[data-theme="dark"] .badge.lead-won { background: #1e3a2c; color: #7ee0aa; } [data-theme="dark"] .badge.lead-lost { background: #3a3a37; color: #c9c6bd; }
.lead-list { display: grid; gap: 10px; }
details.lead { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; transition: box-shadow .2s, border-color .2s; }
details.lead[open] { box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
details.lead summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
details.lead summary::-webkit-details-marker { display: none; }
.avatar { inline-size: 36px; block-size: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #fff; font-weight: 800; flex: none; }
.lead-main { display: grid; min-inline-size: 0; flex: 1; } .lead-main small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
details.lead time { font-size: .78rem; }
.lead-body { border-block-start: 1px solid var(--border); display: grid; gap: 4px; animation: rise .35s var(--ease); }
.lead-form { padding: 14px 16px; display: grid; gap: 10px; }
select, .field select { font: inherit; padding: 9px 12px; border-radius: 12px; border: 1px solid var(--border-2); background: var(--surface); color: var(--text); }

.split { display: grid; grid-template-columns: 320px 1fr; gap: 14px; align-items: start; }
.conv-list { padding: 6px; max-block-size: 72vh; overflow-y: auto; display: grid; gap: 2px; }
.conv { display: grid; gap: 2px; padding: 10px 12px; border-radius: 12px; color: var(--text); }
.conv:hover { background: var(--surface-2); text-decoration: none; }
.conv.active { background: var(--accent-soft); }
.conv b { font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .conv small { color: var(--muted); font-size: .76rem; }
.conv .badge { justify-self: start; }
.conv-view .chat-log { padding-block: 6px; }
.conv-view .msg { animation: none; }

.guide-hero { display: flex; gap: 20px; align-items: center; background: linear-gradient(135deg, var(--accent-soft), transparent 70%), var(--surface); }
.guide-hero h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(1.4rem, 3vw, 1.9rem); }
.guide-mark { color: var(--accent); flex: none; }
.guide-mark .bm-head { animation: bm-float 3.4s ease-in-out infinite; }
.steps-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 12px; }
.step-card { position: relative; display: grid; gap: 6px; }
.step-card .num { position: absolute; inset-block-start: 14px; inset-inline-end: 16px; font-family: var(--serif); font-size: 2rem; color: color-mix(in srgb, var(--accent) 30%, transparent); }
.step-card .s-ico { inline-size: 40px; block-size: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.step-card h3 { margin: 0; }
.chips-row.start { justify-content: flex-start; }
kbd { font: 700 .78rem ui-monospace, Consolas, monospace; padding: 2px 8px; border-radius: 6px; border: 1px solid var(--border-2); border-block-end-width: 2px; background: var(--surface); direction: ltr; }
.checks { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr)); gap: 8px; }
.checks .card-actions { grid-column: 1 / -1; padding: 6px 0 0; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: .9rem; cursor: pointer; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); }
.check input { accent-color: var(--accent); inline-size: 17px; block-size: 17px; }
.form-grid .card-actions { grid-column: 1 / -1; padding: 4px 0 0; }

/* lead form card in chat */
.lead-card { border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.card-note.neutral { color: var(--muted); background: transparent; }
.lead-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px 16px 0; }
.lead-grid .full, .lead-grid .card-actions { grid-column: 1 / -1; }
.lead-grid .card-actions { padding: 4px 0 14px; }
.lead-grid .field input, .lead-grid .field textarea { font-size: .92rem; padding: 8px 12px; }
.lead-card .err { margin: 0 16px 14px; }
.hp { position: absolute !important; inset-inline-start: -9999px; inline-size: 1px; block-size: 1px; opacity: 0; }

.cta-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-block: 8px 14px; }
.btn-outline-light { background: transparent; color: #fff !important; border-color: rgba(255, 255, 255, .55); }
.btn-outline-light:hover { background: rgba(255, 255, 255, .12); box-shadow: none; }

/* guided tour */
.tour-overlay { position: fixed; inset: 0; z-index: 150; background: rgba(20, 20, 18, .45); animation: rise .25s; }
.tour-focus { position: relative; z-index: 160 !important; box-shadow: 0 0 0 4px var(--accent), 0 0 0 9999px transparent; border-radius: 16px; }
.tour-box { position: fixed; z-index: 170; inline-size: min(330px, 92vw); padding: 16px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); animation: pop-in .3s var(--ease); inset-block-start: 40%; inset-inline-start: 50%; }
.tour-top { display: flex; align-items: center; justify-content: space-between; color: var(--accent); margin-block-end: 6px; }
.tour-step { font-size: .76rem; font-weight: 800; color: var(--muted); }
.tour-box h4 { margin: 0 0 4px; font-size: 1.02rem; }
.tour-box p { color: var(--muted); font-size: .9rem; margin: 0 0 12px; }
.tour-actions { display: flex; gap: 6px; justify-content: flex-end; }
.tour-actions .btn-ghost:first-child { margin-inline-end: auto; }
.update-toast { display: flex; align-items: center; gap: 10px; }

@media (max-width: 900px) {
  .grid-2, .split { grid-template-columns: 1fr; }
  .conv-list { max-block-size: 40vh; }
}
@media (max-width: 560px) {
  .lead-grid { grid-template-columns: 1fr; }
  .guide-hero { flex-direction: column; text-align: center; }
  .search input { inline-size: 100%; }
  .search { flex: 1; }
  details.lead time { display: none; }
}
[hidden] { display: none !important; }
.msg.bot .body strong { color: var(--text); font-weight: 800; }

/* ───────── v3: users, live presence, insights, customer accounts ───────── */
.who-cell { display: flex; align-items: center; gap: 10px; }
.who-cell > span:last-child { display: grid; min-inline-size: 0; }
.avatar.online { position: relative; }
.avatar.online::after { content: ""; position: absolute; inset-block-end: -1px; inset-inline-end: -1px; inline-size: 11px; block-size: 11px; border-radius: 50%; background: var(--ok); border: 2px solid var(--surface); }
tr.inactive td { opacity: .55; }
tr.hl td { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.badge.role-admin { background: #ece4fb; color: #5a3aa8; } .badge.role-manager { background: #dde9f8; color: #2b5d96; }
.badge.role-sales { background: #fdecd3; color: #9a5b07; } .badge.role-staff { background: #ecebe6; color: #5d5a52; }
[data-theme="dark"] .badge.role-admin { background: #2e2548; color: #c9b5ff; } [data-theme="dark"] .badge.role-manager { background: #1f2c3d; color: #9cc3f2; }
[data-theme="dark"] .badge.role-sales { background: #3c3020; color: #f0c674; } [data-theme="dark"] .badge.role-staff { background: #3a3a37; color: #c9c6bd; }
.grid-2.wide-first { grid-template-columns: 1.6fr 1fr; }
.inline-form { display: flex; gap: 8px; margin-block-end: 10px; }
.inline-form input { flex: 1; font: inherit; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--border-2); background: var(--surface); color: var(--text); }
.dept-list { display: grid; gap: 6px; }
.dept { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 12px; background: var(--surface-2); }
.dept b { flex: 1; } .dept .icon-btn { inline-size: 30px; block-size: 30px; }
.mt { margin-block-start: 18px; }
.kv-list.roles > div { display: grid; gap: 4px; justify-content: stretch; }
.kv-list.roles small { color: var(--muted); }
#user-form.editing .new-only, #user-form:not(.editing) .edit-only { display: none; }
.reveal-pw code { font: 700 1rem ui-monospace, Consolas, monospace; background: var(--surface); padding: 2px 8px; border-radius: 6px; user-select: all; }
.pw-meter { block-size: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.pw-meter span { display: block; block-size: 100%; inline-size: 0; transition: inline-size .3s var(--ease), background .3s; }
.pw-meter .s1 { inline-size: 25%; background: var(--danger); } .pw-meter .s2 { inline-size: 50%; background: #e0a14a; }
.pw-meter .s3 { inline-size: 75%; background: #9bbf4a; } .pw-meter .s4 { inline-size: 100%; background: var(--ok); }

/* live */
.live-top { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: stretch; }
.live-pulse { position: relative; display: grid; place-items: center; align-content: center; min-inline-size: 150px; padding: 18px; border-radius: var(--r);
  background: linear-gradient(135deg, var(--accent-soft), transparent), var(--surface); border: 1px solid var(--border); text-align: center; overflow: hidden; }
.live-pulse b { font-family: var(--serif); font-size: 3rem; line-height: 1; color: var(--accent); position: relative; }
.live-pulse small { color: var(--muted); font-weight: 700; position: relative; }
.live-pulse .ring { position: absolute; inline-size: 120px; block-size: 120px; border-radius: 50%; border: 2px solid var(--accent); opacity: 0; animation: ring 2.4s ease-out infinite; }
@keyframes ring { 0% { transform: scale(.4); opacity: .6; } 100% { transform: scale(1.6); opacity: 0; } }
.live-stats { grid-template-columns: repeat(4, 1fr) 2fr; }
.live-stats .stat b { font-size: 1.8rem; }
.live-stats .stat.wide { gap: 8px; }
.live-stats .chip { cursor: default; font-size: .76rem; padding: 3px 10px; }
.live-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, 440px); gap: 14px; align-items: start; }
.live-list { display: grid; gap: 8px; }
.live-card {
  position: relative; display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; text-align: start; inline-size: 100%;
  padding: 12px 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); color: var(--text); cursor: pointer;
  transition: border-color .2s, box-shadow .2s, transform .2s; animation: rise .35s var(--ease) both; font: inherit;
}
.live-card:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); box-shadow: var(--shadow); transform: translateY(-1px); }
.live-card.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.live-card.k-customer, .live-card.k-lead { border-inline-start: 4px solid #e0a14a; }
.live-card.k-staff { cursor: default; border-inline-start: 4px solid #7b62d4; }
.live-card .flag { font-size: 1.9rem; line-height: 1; }
.lc-main { display: grid; min-inline-size: 0; gap: 1px; }
.lc-main b { font-size: .95rem; }
.lc-main small { color: var(--muted); font-size: .78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lc-main .page { color: var(--text-2); }
.lc-side { display: grid; justify-items: end; gap: 3px; font-size: .78rem; }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--text-2); }
.badge.k-visitor { background: var(--surface-2); color: var(--muted); } .badge.k-customer, .badge.k-lead { background: #fdecd3; color: #9a5b07; }
.badge.k-staff { background: #ece4fb; color: #5a3aa8; }
.temp { font-weight: 800; font-size: .74rem; padding: 1px 8px; border-radius: 999px; }
.temp.t-hot { background: #fde0dc; color: #b3261e; } .temp.t-warm { background: #fdecd3; color: #9a5b07; } .temp.t-cold { background: #e3eef8; color: #2b5d96; }
.wants { grid-column: 1 / -1; font-size: .82rem; color: var(--text-2); background: var(--surface-2); border-radius: 10px; padding: 6px 10px; }
.live-detail { position: sticky; inset-block-start: 70px; max-block-size: calc(100dvh - 90px); overflow-y: auto; display: grid; gap: 14px; align-content: start; }
.ld-head { display: flex; align-items: center; gap: 12px; }
.ld-head h3 { margin: 0; } .ld-head > div { flex: 1; min-inline-size: 0; }
.flag.big { font-size: 2.6rem; line-height: 1; }
.ld-sec h4 { margin: 0 0 8px; font-size: .9rem; color: var(--muted); }
.ld-sec .kv { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; font-size: .84rem; }
.journey { margin: 0; padding-inline-start: 18px; display: grid; gap: 6px; border-inline-start: 2px solid var(--border); list-style: none; }
.journey li { position: relative; display: grid; font-size: .86rem; }
.journey li::before { content: ""; position: absolute; inset-inline-start: -24px; inset-block-start: 7px; inline-size: 10px; block-size: 10px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); }
.journey li:not(:first-child)::before { background: var(--border-2); }
.chat-log.mini { gap: 10px; padding: 0; font-size: .86rem; }
.chat-log.mini .msg { animation: none; }
.small-print { font-size: .78rem; }
.geo { font-size: .8rem; color: var(--muted); white-space: nowrap; }
.score { font-weight: 800; font-size: .74rem; inline-size: 30px; block-size: 30px; border-radius: 50%; display: inline-grid; place-items: center; flex: none; }
.score.s3 { background: #fde0dc; color: #b3261e; } .score.s2 { background: #fdecd3; color: #9a5b07; } .score.s1 { background: #e3eef8; color: #2b5d96; }

/* insight card */
.insight-slot { display: grid; gap: 10px; }
.lead-body .insight-slot { padding: 12px 16px 0; }
.conv-view .insight-slot { padding: 12px; border: 1px solid var(--border); border-radius: 16px; background: linear-gradient(135deg, var(--accent-soft), transparent 60%); margin-block-end: 12px; }
.ins-head { display: flex; align-items: center; gap: 12px; }
.ins-head > div:last-child { display: grid; }
.gauge { inline-size: 64px; block-size: 64px; border-radius: 50%; display: grid; place-items: center; align-content: center; flex: none; line-height: 1; border: 5px solid; }
.gauge b { font-size: 1.3rem; } .gauge small { font-size: .62rem; color: var(--muted); }
.gauge.t-hot { border-color: #e2584c; color: #b3261e; } .gauge.t-warm { border-color: #e0a14a; color: #9a5b07; } .gauge.t-cold { border-color: #6f9ed6; color: #2b5d96; }
.ins-block h5 { margin: 0 0 4px; font-size: .78rem; color: var(--muted); font-weight: 800; }
.ins-block p { margin: 0; font-size: .9rem; }
.ins-block ul { margin: 0; padding-inline-start: 18px; display: grid; gap: 3px; font-size: .9rem; }
.wants-text { font-weight: 700; color: var(--text); }

/* customer account in chat */
.account-btn.signed { border-color: var(--accent); color: var(--accent-ink); }
.account-btn [data-account-label] { max-inline-size: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auth-tabs { display: flex; gap: 4px; padding: 10px 16px 0; }
.auth-tabs button { flex: 1; padding: 8px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); font-weight: 700; cursor: pointer; }
.auth-tabs button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.auth-card .lead-grid .full { grid-column: 1 / -1; }
.server-chats { display: flex; flex-direction: column; gap: 2px; }

@media (max-width: 1100px) {
  .live-stats { grid-template-columns: repeat(2, 1fr); }
  .live-stats .stat.wide { grid-column: 1 / -1; }
}
@media (max-width: 900px) {
  .live-top, .live-grid, .grid-2.wide-first { grid-template-columns: 1fr; }
  .live-detail { position: fixed; inset: auto 0 0; z-index: 70; max-block-size: 82dvh; border-radius: 20px 20px 0 0; transform: translateY(105%); transition: transform .3s var(--ease); box-shadow: var(--shadow-lg); }
  .live-detail.open { transform: none; }
  .account-btn [data-account-label] { display: none; }
}
.grid-2 > *, .live-grid > *, .split > * { min-inline-size: 0; }
@media (max-width: 1200px) { .grid-2.wide-first { grid-template-columns: 1fr; } }
