/* =========================================================
   BuildModelAI — Design System (RTL + LTR aware)
   ========================================================= */
:root {
  --bg: #f6f7fb;
  --bg-soft: #eef0f7;
  --surface: #ffffff;
  --surface-2: #f2f4fa;
  --border: #e3e7f0;
  --text: #101425;
  --text-soft: #5a6178;
  --text-faint: #8a91a6;
  --brand: #5b5ef4;
  --brand-2: #8b5cf6;
  --brand-soft: rgba(91, 94, 244, 0.1);
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #d97706;
  --shadow-sm: 0 1px 2px rgba(16, 20, 37, 0.05);
  --shadow: 0 8px 30px rgba(16, 20, 37, 0.08);
  --radius: 14px;
  --radius-sm: 10px;
  --font: 'Inter', 'Segoe UI', Tahoma, system-ui, sans-serif;
  --sidebar-w: 250px;
}
html.dark {
  --bg: #0b0d16;
  --bg-soft: #10131f;
  --surface: #151827;
  --surface-2: #1c2033;
  --border: #272c42;
  --text: #eef0f8;
  --text-soft: #a3a9c2;
  --text-faint: #6b7290;
  --brand-soft: rgba(122, 125, 255, 0.14);
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
}
html[dir="rtl"] body { font-family: 'Segoe UI', Tahoma, 'Noto Kufi Arabic', sans-serif; letter-spacing: 0; }

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 0.95rem; color: var(--text); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.container { width: min(1160px, 92%); margin-inline: auto; }
.hidden { display: none !important; }
.text-soft { color: var(--text-soft); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.mt-1{margin-top:8px}.mt-2{margin-top:16px}.mt-3{margin-top:24px}.mt-4{margin-top:40px}
.mb-1{margin-bottom:8px}.mb-2{margin-bottom:16px}.mb-3{margin-bottom:24px}
.center { text-align: center; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px; border-radius: var(--radius-sm);
  border: 1px solid transparent; font-weight: 600; font-size: 0.95rem;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
  text-decoration: none !important;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; box-shadow: 0 6px 18px rgba(91,94,244,.28); }
.btn-primary:hover { box-shadow: 0 8px 24px rgba(91,94,244,.4); }
.btn-outline { background: transparent; border-color: var(--border); color: var(--text); }
.btn-outline:hover { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--text-soft); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: .85rem; border-radius: 8px; }
.btn-lg { padding: 14px 30px; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn[disabled], .btn.disabled { opacity: .55; pointer-events: none; }

/* ---------- Navbar ---------- */
.navbar {
  position: sticky; top: 0; z-index: 60;
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.navbar-inner { display: flex; align-items: center; gap: 20px; height: 66px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.12rem; color: var(--text); text-decoration: none !important; }
.logo-badge {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 15px; font-weight: 800;
}
.nav-links { display: flex; align-items: center; gap: 4px; margin-inline-start: 12px; }
.nav-links a { color: var(--text-soft); font-weight: 500; padding: 8px 13px; border-radius: 8px; font-size: .94rem; }
.nav-links a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav-links a.active { color: var(--brand); background: var(--brand-soft); }
.nav-actions { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; }
.nav-toggle { display: none; background: transparent; border: 1px solid var(--border); border-radius: 8px; width: 40px; height: 40px; font-size: 18px; color: var(--text); }

.lang-switch, .theme-switch {
  border: 1px solid var(--border); background: var(--surface); color: var(--text-soft);
  border-radius: 8px; padding: 7px 12px; font-size: .88rem; font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px;
}
.lang-switch:hover, .theme-switch:hover { color: var(--brand); border-color: var(--brand); }
.theme-switch .sun { display: none; }
html.dark .theme-switch .sun { display: inline; }
html.dark .theme-switch .moon { display: none; }

/* ---------- Hero ---------- */
.hero { position: relative; padding: 96px 0 70px; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset-inline-start: 50%; top: -220px;
  width: 720px; height: 520px; transform: translateX(-50%);
  background: radial-gradient(closest-side, rgba(122,125,255,.18), transparent);
  pointer-events: none;
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--brand-soft); color: var(--brand);
  border: 1px solid color-mix(in srgb, var(--brand) 25%, transparent);
  padding: 6px 14px; border-radius: 999px; font-size: .84rem; font-weight: 600;
}
.hero h1 { font-size: clamp(2rem, 5vw, 3.3rem); line-height: 1.2; margin-top: 20px; font-weight: 800; letter-spacing: -.02em; }
.hero h1 .grad { background: linear-gradient(90deg, var(--brand), var(--brand-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.sub { margin-top: 18px; font-size: 1.12rem; color: var(--text-soft); max-width: 620px; }
.hero-cta { margin-top: 32px; display: flex; gap: 12px; flex-wrap: wrap; }
.hero-stats { margin-top: 48px; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; max-width: 760px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm); }
.stat-card b { font-size: 1.35rem; display: block; }
.stat-card span { color: var(--text-soft); font-size: .86rem; }

/* ---------- Sections ---------- */
.section { padding: 72px 0; }
.section-alt { background: var(--bg-soft); }
.section-head { max-width: 640px; margin-bottom: 40px; }
.section-head.center { margin-inline: auto; text-align: center; }
.section-head h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); font-weight: 800; letter-spacing: -.01em; }
.section-head p { color: var(--text-soft); margin-top: 10px; }
.eyebrow { color: var(--brand); font-weight: 700; font-size: .84rem; text-transform: uppercase; letter-spacing: .06em; }
html[dir="rtl"] .eyebrow { letter-spacing: 0; }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow-sm); transition: box-shadow .15s ease, transform .15s ease; }
.card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.card .icon {
  width: 44px; height: 44px; border-radius: 12px; margin-bottom: 14px;
  background: var(--brand-soft); color: var(--brand);
  display: inline-flex; align-items: center; justify-content: center; font-size: 20px;
}
.card h3 { font-size: 1.06rem; margin-bottom: 6px; }
.card p { color: var(--text-soft); font-size: .93rem; }

/* steps */
.step-num {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .95rem;
}
.step-row { display: flex; gap: 14px; align-items: flex-start; }

/* FAQ */
.faq-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.faq-item + .faq-item { margin-top: 12px; }
.faq-q {
  width: 100%; background: transparent; border: 0; text-align: start;
  padding: 18px 22px; font-size: 1rem; font-weight: 600; color: var(--text);
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.faq-q::after { content: "+"; font-size: 1.25rem; color: var(--brand); flex: none; transition: transform .2s ease; }
.faq-item.open .faq-q::after { transform: rotate(45deg); }
.faq-a { max-height: 0; overflow: hidden; transition: max-height .25s ease; }
.faq-a-inner { padding: 0 22px 18px; color: var(--text-soft); font-size: .94rem; }

/* ---------- Footer ---------- */
.footer { background: var(--surface); border-top: 1px solid var(--border); padding: 48px 0 32px; margin-top: 40px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 28px; }
.footer h4 { font-size: .95rem; margin-bottom: 12px; }
.footer a { display: block; color: var(--text-soft); font-size: .9rem; padding: 4px 0; }
.footer a:hover { color: var(--brand); }
.footer-bottom { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: var(--text-faint); font-size: .85rem; }

/* ---------- Auth ---------- */
.auth-wrap { min-height: calc(100vh - 66px); display: flex; align-items: center; justify-content: center; padding: 40px 16px; }
.auth-card { width: min(430px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 34px; box-shadow: var(--shadow); }
.auth-card h1 { font-size: 1.5rem; margin-bottom: 6px; }
.auth-card .lead { color: var(--text-soft); font-size: .94rem; margin-bottom: 24px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 7px; }
.field .hint { font-size: .8rem; color: var(--text-faint); margin-top: 5px; }
.input, select.input, textarea.input {
  width: 100%; padding: 11px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg); transition: border-color .12s ease, box-shadow .12s ease;
}
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
textarea.input { min-height: 110px; resize: vertical; }
.auth-alt { text-align: center; margin-top: 18px; font-size: .9rem; color: var(--text-soft); }

/* ---------- Alerts ---------- */
.alert { border-radius: var(--radius-sm); padding: 12px 16px; font-size: .92rem; margin-bottom: 16px; border: 1px solid transparent; }
.alert-success { background: rgba(22,163,74,.1); color: var(--success); border-color: rgba(22,163,74,.25); }
.alert-error { background: rgba(220,38,38,.08); color: var(--danger); border-color: rgba(220,38,38,.25); }
.alert-warning { background: rgba(217,119,6,.1); color: var(--warning); border-color: rgba(217,119,6,.25); }
.alert-info { background: var(--brand-soft); color: var(--brand); border-color: color-mix(in srgb, var(--brand) 25%, transparent); }

/* ---------- App layout (chat/dashboard) ---------- */
.app { display: flex; min-height: calc(100vh - 66px); }
.sidebar {
  width: var(--sidebar-w); flex: none; background: var(--surface);
  border-inline-end: 1px solid var(--border); padding: 18px 12px;
  display: flex; flex-direction: column; gap: 6px;
}
.sidebar .side-link {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: 10px; color: var(--text-soft); font-weight: 500; font-size: .94rem;
}
.sidebar .side-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.sidebar .side-link.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.sidebar .side-sep { margin: 10px 6px; border-top: 1px solid var(--border); }
.sidebar .side-label { font-size: .74rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-faint); padding: 6px 12px; }
.main { flex: 1; min-width: 0; padding: 26px; }
.page-title { font-size: 1.4rem; font-weight: 800; margin-bottom: 4px; }
.page-sub { color: var(--text-soft); margin-bottom: 24px; font-size: .95rem; }

.balance-pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--brand-soft); color: var(--brand); font-weight: 700;
  padding: 7px 14px; border-radius: 999px; font-size: .9rem;
}

/* ---------- Model picker v3 (refined pill + card dropdown) ---------- */
.model-picker-wrap { padding: 10px 20px; border-bottom: 1px solid var(--border); background: var(--surface); position: relative; z-index: 30; display: flex; align-items: center; gap: 10px; }
.model-picker-btn {
  display: inline-flex; align-items: center; gap: 10px;
  border: 1px solid var(--border); background: var(--surface);
  border-radius: 999px; padding: 7px 14px;
  color: var(--text); transition: border-color .15s ease, box-shadow .15s ease;
  box-shadow: var(--shadow-sm);
}
.model-picker-btn:hover { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.mp-dot { width: 8px; height: 8px; border-radius: 50%; background: linear-gradient(135deg, var(--brand), var(--brand-2)); flex: none; }
.mp-current { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.25; min-width: 0; }
.mp-current b { font-size: .88rem; font-weight: 700; }
.mp-current small { color: var(--text-faint); font-size: .72rem; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-caret { color: var(--text-faint); font-size: .7rem; transition: transform .18s ease; }
.model-picker-wrap.open .mp-caret { transform: rotate(180deg); }

.model-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(10,12,25,.25); backdrop-filter: blur(2px); }
.model-dropdown {
  position: absolute; top: calc(100% + 6px); inset-inline-start: 20px;
  width: min(400px, calc(100vw - 40px));
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow); padding: 8px; max-height: 420px; overflow-y: auto; z-index: 50;
  animation: mpIn .16s ease;
}
@keyframes mpIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.model-dropdown.hidden { display: none; }
.mp-title { font-size: .72rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-faint); padding: 6px 10px 8px; }
html[dir="rtl"] .mp-title { letter-spacing: 0; }
.model-option {
  display: flex; align-items: flex-start; gap: 12px; width: 100%; text-align: start;
  background: transparent; border: 0; border-radius: 12px; padding: 12px;
  color: var(--text); transition: background .1s ease; cursor: pointer;
}
.model-option:hover { background: var(--surface-2); }
.mo-icon {
  width: 38px; height: 38px; border-radius: 11px; flex: none;
  background: var(--brand-soft); color: var(--brand);
  display: inline-flex; align-items: center; justify-content: center; font-size: 17px;
}
.mo-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mo-body b { font-size: .92rem; font-weight: 700; }
.mo-body small { color: var(--text-soft); font-size: .78rem; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mo-meta { display: flex; gap: 5px; margin-top: 4px; flex-wrap: wrap; }
.mo-tag { font-size: .68rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-soft); }
.mo-check { color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-2)); width: 20px; height: 20px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; visibility: hidden; flex: none; margin-top: 2px; }
.model-option.selected .mo-check { visibility: visible; }
.model-option.selected { background: var(--brand-soft); }

/* attachment chips in composer */
.attach-chips { max-width: 860px; margin: 0 auto 6px; display: flex; gap: 8px; flex-wrap: wrap; }
.attach-chip { display: inline-flex; align-items: center; gap: 7px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 5px 12px; font-size: .78rem; color: var(--text-soft); }
.attach-chip .x { cursor: pointer; color: var(--danger); font-weight: 700; }
.attach-chip .x:hover { text-decoration: underline; }

/* chat */
.chat-layout { display: flex; height: calc(100vh - 66px); }
.chat-side { width: 280px; flex: none; background: var(--surface); border-inline-end: 1px solid var(--border); display: flex; flex-direction: column; }
.chat-side-head { padding: 14px; border-bottom: 1px solid var(--border); display: flex; gap: 8px; }
.chat-side-head .btn { flex: 1; }
.conv-list { flex: 1; overflow-y: auto; padding: 8px; }
.conv-item { display: block; padding: 10px 12px; border-radius: 10px; color: var(--text-soft); font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-item:hover { background: var(--surface-2); text-decoration: none; }
.conv-item.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.chat-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.mode-bar { padding: 12px 20px; border-bottom: 1px solid var(--border); display: flex; gap: 8px; overflow-x: auto; background: var(--surface); }
.mode-chip { border: 1px solid var(--border); background: var(--surface); color: var(--text-soft); padding: 7px 14px; border-radius: 999px; font-size: .86rem; font-weight: 600; white-space: nowrap; }
.mode-chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.chat-messages { flex: 1; overflow-y: auto; padding: 24px; }
.msg { display: flex; margin-bottom: 18px; gap: 12px; }
html[dir="rtl"] .msg { flex-direction: row-reverse; }
.msg .avatar {
  width: 34px; height: 34px; border-radius: 10px; flex: none; font-size: 14px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; color: #fff;
}
.msg.user .avatar { background: linear-gradient(135deg, var(--brand), var(--brand-2)); }
.msg.ai .avatar { background: linear-gradient(135deg, #0ea5e9, #16a34a); }
.msg .bubble {
  background: var(--surface); border: 1px solid var(--border);
  padding: 13px 17px; border-radius: 14px; max-width: min(760px, 85%);
  font-size: .95rem; overflow-wrap: anywhere;
}
.msg.ai .bubble { background: var(--surface-2); }
.msg .bubble pre { background: #0d1117; color: #e6edf3; padding: 14px; border-radius: 10px; overflow-x: auto; font-size: .85rem; margin: 10px 0; direction: ltr; text-align: left; }
.msg .bubble code { font-family: Consolas, Monaco, monospace; }
.msg .bubble :not(pre) > code { background: rgba(122,125,255,.14); padding: 2px 6px; border-radius: 5px; font-size: .85em; }
.msg .bubble table { border-collapse: collapse; margin: 10px 0; width: 100%; }
.msg .bubble th, .msg .bubble td { border: 1px solid var(--border); padding: 7px 11px; font-size: .88rem; }
.msg .bubble h1, .msg .bubble h2, .msg .bubble h3 { margin: 12px 0 6px; }
.msg .bubble ul, .msg .bubble ol { padding-inline-start: 22px; margin: 8px 0; }
.bubble-actions { display: flex; gap: 6px; margin-top: 8px; }
.bubble-actions button { background: transparent; border: 1px solid var(--border); color: var(--text-faint); font-size: .76rem; padding: 4px 10px; border-radius: 7px; }
.bubble-actions button:hover { color: var(--brand); border-color: var(--brand); }
.typing-dots { display: inline-flex; gap: 4px; padding: 6px 0; }
.typing-dots span { width: 7px; height: 7px; border-radius: 50%; background: var(--text-faint); animation: blink 1.2s infinite; }
.typing-dots span:nth-child(2) { animation-delay: .2s; }
.typing-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.chat-inputbar { border-top: 1px solid var(--border); background: var(--surface); padding: 14px 20px; }
.chat-input-row { display: flex; gap: 10px; align-items: flex-end; max-width: 860px; margin-inline: auto; }
.chat-input-row textarea {
  flex: 1; resize: none; border: 1px solid var(--border); background: var(--bg);
  border-radius: 12px; padding: 12px 15px; min-height: 48px; max-height: 180px; font-size: .95rem;
}
.chat-input-row textarea:focus { outline: none; border-color: var(--brand); }
.send-btn { width: 48px; height: 48px; border-radius: 12px; border: 0; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; font-size: 17px; flex: none; }
.send-btn:disabled { opacity: .5; }
.chat-meta { max-width: 860px; margin: 8px auto 0; display: flex; justify-content: space-between; font-size: .78rem; color: var(--text-faint); }

/* ---------- Tables ---------- */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { padding: 12px 16px; text-align: start; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table th { background: var(--surface-2); font-weight: 700; font-size: .82rem; color: var(--text-soft); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--bg-soft); }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .76rem; font-weight: 700; }
.badge-ok { background: rgba(22,163,74,.12); color: var(--success); }
.badge-err { background: rgba(220,38,38,.1); color: var(--danger); }
.badge-warn { background: rgba(217,119,6,.12); color: var(--warning); }
.badge-info { background: var(--brand-soft); color: var(--brand); }

/* ---------- Admin dashboard ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.stat-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; }
.stat-box .lbl { color: var(--text-soft); font-size: .82rem; font-weight: 600; }
.stat-box .val { font-size: 1.5rem; font-weight: 800; margin-top: 4px; }
.stat-box .delta { font-size: .78rem; color: var(--text-faint); }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; margin-bottom: 18px; }
.panel h3 { margin-bottom: 14px; font-size: 1.05rem; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.settings-nav { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.settings-nav a { padding: 8px 16px; border-radius: 999px; border: 1px solid var(--border); color: var(--text-soft); font-size: .88rem; font-weight: 600; }
.settings-nav a.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.chart-box { height: 300px; position: relative; }

/* ---------- Utility / misc ---------- */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-faint); }
.empty-state .big { font-size: 2rem; margin-bottom: 8px; }
.spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2.5px solid var(--border); border-top-color: var(--brand);
  animation: spin .7s linear infinite; display: inline-block; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }
.pill-note { font-size: .8rem; color: var(--text-faint); }
.ad-slot { margin: 18px 0; text-align: center; }
.ad-slot:empty { display: none; }
.copy-btn { background: transparent; border: 0; color: var(--text-faint); font-size: .8rem; }
.copy-btn:hover { color: var(--brand); }

/* announcement banner */
.announce { background: linear-gradient(90deg, var(--brand), var(--brand-2)); color: #fff; text-align: center; padding: 9px 16px; font-size: .9rem; font-weight: 600; }
.announce a { color: #fff; text-decoration: underline; }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .chat-side { position: fixed; inset-block: 66px 0; inset-inline-start: 0; z-index: 50; transform: translateX(-105%); transition: transform .2s ease; }
  html[dir="rtl"] .chat-side { transform: translateX(105%); }
  html[dir="rtl"] .chat-side.open, html[dir="ltr"] .chat-side.open { transform: translateX(0); }
  .sidebar { position: fixed; inset-block: 66px 0; inset-inline-start: 0; z-index: 50; transform: translateX(-105%); transition: transform .2s ease; }
  html[dir="rtl"] .sidebar { transform: translateX(105%); }
  .sidebar.open { transform: translateX(0) !important; }
}
@media (max-width: 780px) {
  .nav-links { display: none; position: absolute; top: 66px; inset-inline: 0; background: var(--surface); border-bottom: 1px solid var(--border); flex-direction: column; align-items: stretch; padding: 12px 16px; gap: 2px; }
  .nav-links.open { display: flex; }
  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .hero { padding: 60px 0 40px; }
  .section { padding: 48px 0; }
  .main { padding: 18px; }
  .footer-grid { grid-template-columns: 1fr; }
  .msg .bubble { max-width: 92%; }
}
