/* MIZANIX — design system v2: formal & elegant. Light (day, default) · Dark (night) · Auto.
   Brand palette from the official logo: electric blue · violet · cyan on deep navy. */
:root {
  --blue: #2f6bff; --violet: #7b3ff2; --cyan: #19d3f5; --indigo: #4b3cf0; --navy: #0b1640; --gold: #c9a24a;
  --grad: linear-gradient(135deg, #19d3f5 0%, #2f6bff 45%, #7b3ff2 100%);
  --grad-btn: linear-gradient(135deg, #2f6bff 0%, #4b3cf0 55%, #7b3ff2 100%);
  --r: 16px; --r-sm: 11px;
  --font: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, sans-serif; --latin: 'Sora', 'IBM Plex Sans Arabic', sans-serif;
  --display: 'Noto Kufi Arabic', 'IBM Plex Sans Arabic', sans-serif;

  /* light (default) */
  --bg: #f3f5fa; --bg-art: radial-gradient(1100px 600px at 100% -10%, rgba(47,107,255,.07), transparent 60%), radial-gradient(900px 600px at -10% 110%, rgba(123,63,242,.06), transparent 60%);
  --surface: #ffffff; --surface-2: #f6f8fc; --surface-3: #eef2fa; --elev: #ffffff;
  --line: #e2e7f1; --line-2: #d3dbea; --line-strong: #c3cde2;
  --text: #13204a; --heading: #0b1640; --muted: #5a6683; --dim: #8b95ad;
  --shadow: 0 1px 2px rgba(16,28,72,.05), 0 10px 30px -18px rgba(16,28,72,.22);
  --shadow-lg: 0 30px 70px -24px rgba(16,28,72,.35);
  --top-bg: rgba(255,255,255,.86); --th-bg: #f4f6fb; --hover: rgba(47,107,255,.05);
  --input-bg: #ffffff; --focus: rgba(47,107,255,.16);
  --soft: linear-gradient(135deg, rgba(25,211,245,.08), rgba(47,107,255,.07) 45%, rgba(123,63,242,.09));
  --hero: linear-gradient(120deg, #0b1640 0%, #13275f 55%, #2a1f6e 100%); --hero-text: #ffffff;
  --side-bg: linear-gradient(180deg, #0b1640 0%, #0e1d52 60%, #14164a 100%); --side-text: #e7ecff; --side-muted: #9fadd8; --side-line: rgba(255,255,255,.08); --side-hover: rgba(255,255,255,.06); --side-on: rgba(255,255,255,.10);
  --ok: #0f9d6e; --warn: #c27a06; --bad: #d8314f; --info: #2f6bff;
  --ok-bg: rgba(15,157,110,.09); --warn-bg: rgba(194,122,6,.10); --bad-bg: rgba(216,49,79,.08); --violet-bg: rgba(123,63,242,.09); --blue-bg: rgba(47,107,255,.08);
  --ok-t: #0b7d58; --warn-t: #9a5f00; --bad-t: #b4223f; --violet-t: #5b2bc4; --blue-t: #1f4fd1;
  --toast-bg: #ffffff; --scrim: rgba(11,22,64,.38);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #050917; --bg-art: radial-gradient(1200px 700px at 85% -10%, rgba(47,107,255,.20), transparent 60%), radial-gradient(900px 600px at -10% 110%, rgba(123,63,242,.18), transparent 60%);
  --surface: rgba(17,27,66,.66); --surface-2: rgba(8,14,38,.7); --surface-3: rgba(30,45,100,.55); --elev: #0e1842;
  --line: rgba(120,150,255,.15); --line-2: rgba(120,150,255,.26); --line-strong: rgba(120,150,255,.38);
  --text: #e8eeff; --heading: #f3f6ff; --muted: #9eabd6; --dim: #6f7dab;
  --shadow: 0 18px 50px -20px rgba(0,0,0,.7), 0 0 0 1px var(--line) inset;
  --shadow-lg: 0 30px 80px -20px #000;
  --top-bg: rgba(5,9,23,.78); --th-bg: rgba(12,22,56,.92); --hover: rgba(47,107,255,.07);
  --input-bg: rgba(6,11,31,.7); --focus: rgba(47,107,255,.22);
  --soft: linear-gradient(135deg, rgba(25,211,245,.13), rgba(47,107,255,.12) 45%, rgba(123,63,242,.16));
  --hero: linear-gradient(120deg, rgba(25,211,245,.14), rgba(47,107,255,.16) 45%, rgba(123,63,242,.22)); --hero-text: #ffffff;
  --side-bg: linear-gradient(180deg, rgba(10,18,48,.96), rgba(6,11,32,.96)); --side-text: #e8eeff; --side-muted: #94a2d0; --side-line: rgba(120,150,255,.14); --side-hover: rgba(47,107,255,.10); --side-on: rgba(47,107,255,.16);
  --ok: #22d39a; --warn: #ffb547; --bad: #ff5d7a; --info: #4fa8ff;
  --ok-bg: rgba(34,211,154,.12); --warn-bg: rgba(255,181,71,.12); --bad-bg: rgba(255,93,122,.12); --violet-bg: rgba(123,63,242,.16); --blue-bg: rgba(47,107,255,.14);
  --ok-t: #8ff3cf; --warn-t: #ffd79a; --bad-t: #ffb3c1; --violet-t: #d2c0ff; --blue-t: #a9c3ff;
  --toast-bg: #101c4a; --scrim: rgba(2,5,15,.66);
  color-scheme: dark;
}

* { box-sizing: border-box; }
svg:not([width]) { width: 18px; height: 18px; flex: none; vertical-align: -3px; }
html, body { margin: 0; min-height: 100%; }
body { font-family: var(--font); color: var(--text); background: var(--bg); background-image: var(--bg-art); background-attachment: fixed; font-size: 15px; line-height: 1.65; -webkit-font-smoothing: antialiased; transition: background-color .3s, color .3s; }
body[dir="ltr"] { direction: ltr; }
a { color: var(--blue); text-decoration: none; }
:root[data-theme="dark"] a { color: var(--cyan); }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: rgba(47,107,255,.25); }
h1, h2, h3 { color: var(--heading); }
.latin { font-family: var(--latin); letter-spacing: .02em; }
.num { font-family: var(--latin); font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
::-webkit-scrollbar { width: 10px; height: 10px; } ::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }

/* ───────── intro (10 s, always cinematic dark) ───────── */
#intro { position: fixed; inset: 0; z-index: 1000; color: #eaf0ff; background: radial-gradient(circle at 50% 45%, #0d1a4d 0%, #050917 62%); display: grid; place-items: center; overflow: hidden; transition: opacity .7s ease, visibility .7s; }
#intro.done { opacity: 0; visibility: hidden; pointer-events: none; }
#intro:not(.play) { display: none; }
#intro-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.intro-stage { position: relative; width: min(92vw, 760px); height: min(92vh, 640px); display: grid; place-items: center; }
.intro-glow { position: absolute; width: 380px; height: 380px; border-radius: 50%; background: radial-gradient(circle, rgba(47,107,255,.55), rgba(123,63,242,.25) 45%, transparent 70%); filter: blur(30px); opacity: 0; animation: glow 10s ease forwards; }
.intro-logo { position: absolute; top: 18%; width: 190px; height: 190px; object-fit: contain; opacity: 0; transform: scale(.4) rotate(-25deg); filter: drop-shadow(0 0 30px rgba(47,107,255,.7)); animation: logoIn 10s cubic-bezier(.2,.9,.2,1) forwards; }
.intro-orbit { position: absolute; top: calc(18% + 95px); left: 50%; border: 2px solid transparent; border-radius: 50%; translate: -50% -50%; opacity: 0; }
.intro-orbit.o1 { width: 300px; height: 120px; border-top-color: var(--cyan); border-right-color: rgba(25,211,245,.4); animation: orbit 10s ease forwards, spin 4s linear infinite; }
.intro-orbit.o2 { width: 380px; height: 160px; border-bottom-color: var(--violet); border-left-color: rgba(123,63,242,.4); animation: orbit 10s .3s ease forwards, spin 6s linear infinite reverse; }
.intro-orbit.o3 { width: 460px; height: 200px; border-top-color: rgba(47,107,255,.7); animation: orbit 10s .6s ease forwards, spin 9s linear infinite; }
.intro-word { position: absolute; top: calc(18% + 220px); display: flex; gap: .06em; font-family: var(--latin); font-weight: 800; font-size: clamp(42px, 9vw, 78px); letter-spacing: .14em; direction: ltr; }
.intro-word span { display: inline-block; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; opacity: 0; transform: translateY(40px) scale(.7); filter: blur(10px); animation: letter 10s cubic-bezier(.2,.9,.2,1) forwards; }
.intro-word span:nth-child(1) { animation-delay: 0s; } .intro-word span:nth-child(2) { animation-delay: .1s; } .intro-word span:nth-child(3) { animation-delay: .2s; }
.intro-word span:nth-child(4) { animation-delay: .3s; } .intro-word span:nth-child(5) { animation-delay: .4s; } .intro-word span:nth-child(6) { animation-delay: .5s; } .intro-word span:nth-child(7) { animation-delay: .6s; }
.intro-tag { position: absolute; top: calc(18% + 320px); text-align: center; opacity: 0; animation: tag 10s ease forwards; }
.intro-tag .t1 { font-family: var(--display); font-size: clamp(17px, 3.4vw, 24px); font-weight: 600; }
.intro-tag .t2 { font-family: var(--latin); color: #9aa8d6; font-size: clamp(11px, 2.2vw, 14px); letter-spacing: .12em; text-transform: uppercase; margin-top: 4px; }
.intro-pills { position: absolute; top: calc(18% + 400px); display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: 92vw; }
.intro-pills span { padding: 6px 14px; border-radius: 999px; border: 1px solid rgba(120,150,255,.28); background: rgba(17,27,66,.6); font-size: 13px; opacity: 0; transform: translateY(12px); animation: pill 10s ease forwards; }
.intro-pills span:nth-child(1) { animation-delay: 0s; } .intro-pills span:nth-child(2) { animation-delay: .15s; } .intro-pills span:nth-child(3) { animation-delay: .3s; } .intro-pills span:nth-child(4) { animation-delay: .45s; } .intro-pills span:nth-child(5) { animation-delay: .6s; }
.intro-lines { position: absolute; inset: 0; pointer-events: none; }
.intro-lines i { position: absolute; height: 1px; width: 40%; background: linear-gradient(90deg, transparent, var(--cyan), transparent); opacity: 0; animation: sweep 10s ease forwards; }
.intro-lines i:nth-child(1) { top: 30%; left: -40%; } .intro-lines i:nth-child(2) { top: 62%; left: -40%; animation-delay: .4s; } .intro-lines i:nth-child(3) { top: 80%; left: -40%; animation-delay: .8s; }
#intro-skip { position: absolute; bottom: max(28px, env(safe-area-inset-bottom)); inset-inline-start: 50%; translate: 50% 0; padding: 11px 22px; border-radius: 999px; border: 1px solid rgba(120,150,255,.3); background: rgba(10,18,48,.7); color: #eaf0ff; backdrop-filter: blur(10px); cursor: pointer; font-size: 14px; display: flex; gap: 10px; align-items: center; transition: background .2s, transform .2s; }
body[dir="ltr"] #intro-skip { translate: -50% 0; }
#intro-skip b { font-family: var(--latin); font-weight: 600; color: #9aa8d6; font-size: 12px; }
#intro-skip:hover { background: rgba(47,107,255,.35); transform: translateY(-2px); }
@keyframes glow { 0% { opacity: 0; transform: scale(.4); } 12% { opacity: 1; transform: scale(1); } 80% { opacity: .9; transform: scale(1.15); } 100% { opacity: 0; transform: scale(1.6); } }
@keyframes logoIn { 0% { opacity: 0; transform: scale(.4) rotate(-25deg); } 14% { opacity: 1; transform: scale(1.06) rotate(0); } 20% { transform: scale(1); } 85% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(1.25); } }
@keyframes orbit { 0%, 8% { opacity: 0; } 20% { opacity: 1; } 85% { opacity: .8; } 100% { opacity: 0; } }
@keyframes spin { to { rotate: 360deg; } }
@keyframes letter { 0%, 22% { opacity: 0; transform: translateY(40px) scale(.7); filter: blur(10px); } 32% { opacity: 1; transform: none; filter: none; } 86% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-16px); } }
@keyframes tag { 0%, 40% { opacity: 0; transform: translateY(14px); } 50% { opacity: 1; transform: none; } 88% { opacity: 1; } 100% { opacity: 0; } }
@keyframes pill { 0%, 55% { opacity: 0; transform: translateY(12px); } 63% { opacity: 1; transform: none; } 88% { opacity: 1; } 100% { opacity: 0; } }
@keyframes sweep { 0%, 15% { opacity: 0; left: -40%; } 25% { opacity: .9; } 45% { opacity: 0; left: 110%; } 100% { opacity: 0; left: 110%; } }
@media (prefers-reduced-motion: reduce) { .intro-orbit { animation: orbit 10s ease forwards !important; } }

/* ───────── layout ───────── */
.shell { display: grid; grid-template-columns: 268px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 18px 14px 24px; background: var(--side-bg); color: var(--side-text); border-inline-end: 1px solid var(--side-line); }
.side::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); }
.brand { display: flex; align-items: center; gap: 12px; padding: 6px 8px 18px; border-bottom: 1px solid var(--side-line); margin-bottom: 10px; }
.brand img { width: 42px; height: 42px; filter: drop-shadow(0 0 12px rgba(47,107,255,.55)); }
.brand .bt { font-family: var(--latin); font-weight: 800; letter-spacing: .16em; font-size: 18px; color: #fff; }
.brand .bs { font-size: 11px; color: var(--side-muted); font-family: var(--display); }
.nav-group { margin: 16px 10px 6px; font-size: 11px; color: var(--side-muted); letter-spacing: .08em; font-weight: 600; opacity: .8; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; margin: 2px 0; border-radius: 10px; color: var(--side-muted); font-weight: 500; font-size: 14.5px; transition: background .2s, color .2s; position: relative; }
.nav a:hover { background: var(--side-hover); color: var(--side-text); }
.nav a.on { color: #fff; background: var(--side-on); box-shadow: 0 0 0 1px rgba(255,255,255,.06) inset; }
.nav a.on::before { content: ''; position: absolute; inset-inline-start: -14px; top: 9px; bottom: 9px; width: 3px; border-radius: 3px; background: var(--grad); }
.nav svg { width: 19px; height: 19px; flex: none; }
.nav .badge { margin-inline-start: auto; }
.side-foot { margin: 22px 8px 0; padding-top: 14px; border-top: 1px solid var(--side-line); font-size: 11px; color: var(--side-muted); display: flex; align-items: center; gap: 8px; }
.side-foot .dot { width: 8px; height: 8px; border-radius: 50%; background: #22d39a; box-shadow: 0 0 0 3px rgba(34,211,154,.18); }
.side-foot .dot.off { background: #ffb547; box-shadow: 0 0 0 3px rgba(255,181,71,.18); }
.main { min-width: 0; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 12px 26px; background: var(--top-bg); backdrop-filter: blur(14px) saturate(1.3); border-bottom: 1px solid var(--line); }
.top h1 { font-family: var(--display); font-size: 18px; margin: 0; font-weight: 700; }
.top .crumb { font-size: 12px; color: var(--dim); }
.top .sp { flex: 1; }
.top .who { display: flex; align-items: center; gap: 9px; padding: 4px 6px 4px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
body[dir="ltr"] .top .who { padding: 4px 12px 4px 6px; }
.icon-btn { position: relative; width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: 11px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer; transition: color .2s, border-color .2s, background .2s; }
.icon-btn:hover { color: var(--blue); border-color: var(--line-strong); }
.icon-btn .badge { position: absolute; top: -6px; inset-inline-end: -6px; padding: 0 6px; font-size: 10.5px; }
.icon-btn.spin svg { animation: spin .8s linear infinite; }
.page { padding: 24px 28px 64px; max-width: 1480px; animation: pageIn .35s ease; }
@keyframes pageIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.menu-btn { display: none; }

/* offline banner */
#netbar { position: sticky; top: 0; z-index: 60; display: none; align-items: center; justify-content: center; gap: 10px; padding: 8px 14px; font-size: 13px; font-weight: 600; background: #fff4dd; color: #7a4b00; border-bottom: 1px solid #f1d69a; }
:root[data-theme="dark"] #netbar { background: #2b2108; color: #ffd79a; border-color: rgba(255,181,71,.35); }
#netbar.show { display: flex; }
#netbar.back { background: #e3f7ee; color: #0b6b4b; border-color: #b4e6cf; }
:root[data-theme="dark"] #netbar.back { background: #0b2a20; color: #8ff3cf; border-color: rgba(34,211,154,.35); }
#netbar button { border: 0; background: rgba(0,0,0,.06); padding: 3px 10px; border-radius: 8px; cursor: pointer; font-size: 12px; }
.cached-note { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--warn-t); background: var(--warn-bg); padding: 3px 10px; border-radius: 999px; margin-bottom: 12px; }

/* ───────── components ───────── */
.card { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); border: 1px solid var(--line); padding: 18px 20px; position: relative; }
:root[data-theme="dark"] .card { border-color: transparent; backdrop-filter: blur(12px); }
.card h3 { margin: 0 0 14px; font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; font-family: var(--display); }
.card h3 svg { color: var(--blue); }
.card .sub { color: var(--muted); font-size: 13px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.hero-card { background: var(--hero); color: var(--hero-text); border: 0; overflow: hidden; }
.hero-card h2 { color: #fff; font-family: var(--display); }
.hero-card .muted { color: rgba(255,255,255,.72); }
.hero-card::after { content: ''; position: absolute; inset-inline-end: -60px; top: -80px; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(circle, rgba(25,211,245,.35), transparent 65%); pointer-events: none; }
.hero-card .btn:not(.primary) { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.2); color: #fff; }
.kpi { overflow: hidden; }
.kpi .k-label { color: var(--muted); font-size: 13px; font-weight: 500; }
.kpi .k-val { font-size: 26px; font-weight: 700; margin-top: 6px; font-family: var(--latin); color: var(--heading); }
.kpi .k-foot { font-size: 12px; color: var(--dim); margin-top: 6px; }
.kpi::before { content: ''; position: absolute; inset-inline-start: 0; top: 18px; bottom: 18px; width: 3px; border-radius: 3px; background: var(--grad); }
.kpi .k-ico { position: absolute; inset-inline-end: 16px; top: 16px; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--blue-bg); color: var(--blue); }
:root[data-theme="dark"] .kpi .k-ico { color: var(--cyan); }
.kpi .k-ico svg { width: 20px; height: 20px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 17px; border-radius: 11px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); cursor: pointer; font-weight: 600; font-size: 14px; transition: transform .15s, box-shadow .2s, background .2s, border-color .2s; white-space: nowrap; }
.btn:hover { border-color: var(--line-strong); background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--grad-btn); border-color: transparent; color: #fff; box-shadow: 0 8px 22px -10px rgba(47,107,255,.75); }
.btn.primary:hover { box-shadow: 0 12px 28px -10px rgba(75,60,240,.85); filter: brightness(1.05); }
.btn.danger { background: var(--bad-bg); border-color: transparent; color: var(--bad-t); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn.sm { padding: 6px 12px; font-size: 13px; border-radius: 9px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn svg { width: 17px; height: 17px; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--blue-bg); color: var(--blue-t); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok-t); }
.badge.warn { background: var(--warn-bg); color: var(--warn-t); }
.badge.bad { background: var(--bad-bg); color: var(--bad-t); }
.badge.violet { background: var(--violet-bg); color: var(--violet-t); }
.icon-btn .badge.bad, .nav .badge.bad { background: var(--bad); color: #fff; }
.badge.dot::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }
.muted { color: var(--muted); } .dim { color: var(--dim); } .small { font-size: 12.5px; }
.err-t { color: var(--bad-t); }
.empty { text-align: center; padding: 34px 10px; color: var(--muted); }
.empty svg { width: 44px; height: 44px; opacity: .45; display: block; margin: 0 auto 10px; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
.note-box { background: var(--blue-bg); border-radius: 12px; padding: 12px 14px; }
.warn-box { background: var(--warn-bg); color: var(--warn-t); border-radius: 12px; padding: 12px 14px; }

/* forms */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; color: var(--muted); font-weight: 600; }
.input, select.input, textarea.input { width: 100%; padding: 10px 13px; border-radius: 11px; border: 1px solid var(--line-2); background: var(--input-bg); outline: none; transition: border .2s, box-shadow .2s; }
.input:focus { border-color: var(--blue); box-shadow: 0 0 0 4px var(--focus); }
textarea.input { min-height: 90px; resize: vertical; line-height: 1.7; }
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.check input { width: 17px; height: 17px; accent-color: var(--blue); }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px 14px; max-height: 330px; overflow: auto; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.perm-grid .sec { grid-column: 1 / -1; color: var(--blue); font-size: 12px; font-weight: 700; margin-top: 6px; }

/* segmented control (theme / language) */
.seg { display: inline-flex; padding: 4px; border-radius: 13px; background: var(--surface-3); border: 1px solid var(--line); gap: 4px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 8px 16px; border-radius: 10px; cursor: pointer; color: var(--muted); font-weight: 600; font-size: 13.5px; display: inline-flex; align-items: center; gap: 7px; transition: background .2s, color .2s, box-shadow .2s; }
.seg button.on { background: var(--surface); color: var(--heading); box-shadow: 0 1px 3px rgba(16,28,72,.12), 0 0 0 1px var(--line) inset; }
:root[data-theme="dark"] .seg button.on { background: var(--grad-btn); color: #fff; box-shadow: none; }
.seg svg { width: 16px; height: 16px; }
.theme-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.theme-card { border: 1px solid var(--line-2); border-radius: 14px; padding: 10px; cursor: pointer; background: var(--surface); text-align: center; font-weight: 600; font-size: 13.5px; transition: border-color .2s, box-shadow .2s; }
.theme-card.on { border-color: var(--blue); box-shadow: 0 0 0 3px var(--focus); }
.theme-card .pv { height: 64px; border-radius: 10px; margin-bottom: 8px; display: grid; grid-template-columns: 30% 1fr; overflow: hidden; border: 1px solid var(--line); }
.theme-card .pv i { display: block; } .theme-card .pv b { display: block; padding: 8px; }
.theme-card .pv b::before, .theme-card .pv b::after { content: ''; display: block; height: 9px; border-radius: 4px; margin-bottom: 6px; }
.pv.light i { background: #0b1640; } .pv.light b { background: #f3f5fa; } .pv.light b::before { background: #fff; box-shadow: 0 0 0 1px #e2e7f1; } .pv.light b::after { background: #2f6bff; width: 50%; }
.pv.dark i { background: #08102a; } .pv.dark b { background: #050917; } .pv.dark b::before { background: #17245a; } .pv.dark b::after { background: #7b3ff2; width: 50%; }
.pv.auto i { background: linear-gradient(180deg, #0b1640 50%, #050917 50%); } .pv.auto b { background: linear-gradient(135deg, #f3f5fa 50%, #050917 50%); } .pv.auto b::before { background: #2f6bff; width: 60%; } .pv.auto b::after { background: #7b3ff2; width: 40%; }

/* tables */
.table-wrap { overflow-x: auto; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: start; font-weight: 700; color: var(--muted); font-size: 12px; padding: 11px 12px; background: var(--th-bg); position: sticky; top: 0; white-space: nowrap; letter-spacing: .02em; }
td { padding: 11px 12px; border-top: 1px solid var(--line); vertical-align: middle; }
tr:hover td { background: var(--hover); }
tr.click { cursor: pointer; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--grad-btn); color: #fff; font-size: 13px; flex: none; }

/* modal */
.modal-bg { position: fixed; inset: 0; z-index: 200; background: var(--scrim); backdrop-filter: blur(5px); display: grid; place-items: center; padding: 18px; animation: fade .2s; }
.modal { width: min(760px, 100%); max-height: 92vh; overflow: auto; background: var(--elev); border-radius: 20px; box-shadow: var(--shadow-lg), 0 0 0 1px var(--line-2) inset; padding: 22px 24px; animation: pop .25s cubic-bezier(.2,.9,.2,1); }
:root[data-theme="dark"] .modal { background: linear-gradient(180deg, #0f1a46, #0a1234); }
.modal h2 { margin: 0 0 16px; font-size: 18px; font-family: var(--display); }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
@keyframes fade { from { opacity: 0; } } @keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.98); } }

/* toasts */
#toasts { position: fixed; z-index: 500; bottom: 22px; inset-inline-start: 22px; display: flex; flex-direction: column; gap: 10px; }
.toast { min-width: 260px; max-width: 420px; padding: 12px 16px; border-radius: 13px; background: var(--toast-bg); color: var(--text); box-shadow: var(--shadow-lg), 0 0 0 1px var(--line-2) inset; animation: pop .25s; font-size: 14px; border-inline-start: 4px solid var(--blue); }
.toast.ok { border-inline-start-color: var(--ok); }
.toast.bad { border-inline-start-color: var(--bad); }
.toast.warn { border-inline-start-color: var(--warn); }

/* tabs */
.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 13px; background: var(--surface-3); border: 1px solid var(--line); width: fit-content; flex-wrap: wrap; }
.tabs button { border: 0; background: transparent; padding: 7px 14px; border-radius: 10px; cursor: pointer; color: var(--muted); font-weight: 600; font-size: 13.5px; }
.tabs button.on { background: var(--surface); color: var(--heading); box-shadow: 0 1px 3px rgba(16,28,72,.12), 0 0 0 1px var(--line) inset; }
:root[data-theme="dark"] .tabs button.on { background: var(--grad-btn); color: #fff; box-shadow: none; }

/* charts */
.bars { display: flex; align-items: flex-end; gap: 10px; height: 170px; padding-top: 10px; }
.bars .b { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.bars .b i { display: block; width: 100%; max-width: 44px; border-radius: 9px 9px 3px 3px; background: var(--grad-btn); transform-origin: bottom; animation: grow .8s cubic-bezier(.2,.9,.2,1) both; }
.bars .b span { font-size: 11px; color: var(--dim); font-family: var(--latin); }
@keyframes grow { from { transform: scaleY(0); } }
.meter { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--grad-btn); border-radius: 99px; }

/* ───────── login ───────── */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.login-art { position: relative; overflow: hidden; display: grid; place-items: center; color: #eaf0ff; background: radial-gradient(circle at 40% 40%, rgba(47,107,255,.35), transparent 55%), radial-gradient(circle at 70% 70%, rgba(123,63,242,.35), transparent 55%), #060b22; }
.login-art img { width: min(280px, 58%); filter: drop-shadow(0 0 50px rgba(47,107,255,.6)); animation: float 6s ease-in-out infinite; }
.login-art .ring { position: absolute; border-radius: 50%; border: 1px solid rgba(120,150,255,.18); animation: spin 30s linear infinite; }
.login-art h2 { position: absolute; bottom: 13%; margin: 0; font-family: var(--latin); letter-spacing: .32em; font-size: 30px; color: #fff; }
.login-art p { position: absolute; bottom: 8%; margin: 0; color: #9aa8d6; font-family: var(--display); }
@keyframes float { 50% { transform: translateY(-14px); } }
.login-form { display: grid; place-items: center; padding: 30px 20px; }
.login-box { width: min(420px, 100%); }
.login-box h1 { font-family: var(--display); font-size: 25px; margin: 0 0 6px; }
.pin-boxes { display: flex; gap: 10px; justify-content: center; direction: ltr; }
.pin-boxes input { width: 48px; height: 58px; text-align: center; font-size: 24px; font-family: var(--latin); border-radius: 13px; border: 1px solid var(--line-2); background: var(--input-bg); outline: none; }
.pin-boxes input:focus { border-color: var(--violet); box-shadow: 0 0 0 4px rgba(123,63,242,.2); }

/* ───────── AI assistant ───────── */
.ai { display: grid; grid-template-columns: 270px 1fr; gap: 16px; height: calc(100vh - 116px); }
.ai-list { overflow: auto; }
.ai-list .conv { padding: 10px 12px; border-radius: 11px; cursor: pointer; color: var(--muted); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ai-list .conv:hover, .ai-list .conv.on { background: var(--hover); color: var(--text); }
.ai-list .conv.on { box-shadow: 0 0 0 1px var(--line-2) inset; }
.ai-chat { display: flex; flex-direction: column; min-height: 0; padding: 0; overflow: hidden; }
.ai-msgs { flex: 1; overflow: auto; padding: 22px 26px; display: flex; flex-direction: column; gap: 18px; scroll-behavior: smooth; }
.msg { max-width: 860px; animation: pageIn .3s ease; }
.msg.user { align-self: flex-start; background: var(--blue-bg); padding: 11px 16px; border-radius: 18px 18px 18px 6px; color: var(--heading); }
body[dir="ltr"] .msg.user { align-self: flex-end; border-radius: 18px 18px 6px 18px; }
.msg.bot { align-self: stretch; display: grid; grid-template-columns: 38px 1fr; gap: 12px; }
.msg.bot .who { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); box-shadow: 0 0 0 1px var(--line) inset; }
.msg.bot .who img { width: 26px; }
.msg .body { line-height: 1.9; white-space: normal; word-wrap: break-word; }
.msg .body p { margin: 0 0 8px; } .msg .body ul { margin: 4px 0 8px; padding-inline-start: 22px; } .msg .body h4 { margin: 10px 0 6px; font-size: 15px; color: var(--heading); font-family: var(--display); }
.msg .body code { background: var(--surface-3); padding: 1px 6px; border-radius: 6px; font-family: var(--latin); font-size: 13px; }
.msg .meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; font-size: 12px; }
.think { margin-bottom: 10px; border-radius: 13px; border: 1px solid rgba(123,63,242,.28); background: var(--violet-bg); overflow: hidden; }
.think summary { cursor: pointer; padding: 9px 13px; font-size: 13px; color: var(--violet-t); list-style: none; display: flex; align-items: center; gap: 8px; font-weight: 600; }
.think summary::-webkit-details-marker { display: none; }
.think .tx { padding: 0 14px 12px; font-size: 13px; color: var(--muted); white-space: pre-wrap; max-height: 280px; overflow: auto; }
.thinking-live { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 14px; background: var(--violet-bg); border: 1px solid rgba(123,63,242,.28); width: fit-content; }
.thinking-live .orb { width: 26px; height: 26px; border-radius: 50%; background: conic-gradient(var(--cyan), var(--blue), var(--violet), var(--cyan)); animation: spin 1.1s linear infinite; -webkit-mask: radial-gradient(circle, transparent 6px, #000 7px); mask: radial-gradient(circle, transparent 6px, #000 7px); }
.thinking-live .steps { font-size: 13px; color: var(--violet-t); }
.thinking-live .steps b { display: inline-block; animation: blink 1.4s infinite; }
@keyframes blink { 50% { opacity: .35; } }
.ai-input { position: relative; border-top: 1px solid var(--line); padding: 14px 18px 16px; background: var(--surface-2); }
.ai-input .box { display: flex; gap: 8px; align-items: flex-end; border-radius: 22px; border: 1px solid var(--line-2); background: var(--input-bg); padding: 8px 10px; transition: box-shadow .3s, border-color .3s; }
.ai-input textarea { flex: 1; border: 0; background: transparent; outline: none; resize: none; min-height: 26px; max-height: 180px; line-height: 1.6; padding: 6px 4px; }
.ai-input .box.glow { border-color: var(--lvl-b); box-shadow: 0 0 calc(var(--lvl) * 5px) -3px var(--lvl-b), 0 0 0 1px var(--lvl-b) inset; }
.ai-input .send { width: 40px; height: 40px; padding: 0; border-radius: 50%; }
.ai-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; font-size: 12px; color: var(--dim); }

/* effort gauge button (inside the input box) */
.gauge { flex: none; height: 40px; min-width: 40px; display: inline-flex; align-items: center; gap: 7px; padding: 0 12px 0 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); color: var(--lvl-b); cursor: pointer; font-weight: 700; font-size: 13px; transition: background .2s, border-color .2s; }
.gauge:hover, .gauge.open { border-color: var(--lvl-b); background: var(--surface); }
.gauge svg { width: 20px; height: 20px; }
.gauge .gname { color: var(--text); font-weight: 600; }

/* effort popover: ChatGPT-style pill slider */
.effort-pop { position: absolute; inset-inline: 18px; bottom: calc(100% - 6px); z-index: 30; display: none; padding: 18px 18px 20px; border-radius: 22px; background: var(--elev); box-shadow: var(--shadow-lg), 0 0 0 1px var(--line-2) inset; animation: pop .22s cubic-bezier(.2,.9,.2,1); }
.effort-pop.open { display: block; }
.effort-head { text-align: center; margin-bottom: 14px; }
.effort-head .t { font-family: var(--display); font-size: 19px; font-weight: 700; color: var(--heading); }
.effort-head .t b { color: var(--lvl-b); transition: color .25s; }
.effort-head .s { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 4px; font-size: 12.5px; color: var(--muted); }
.effort-head .s .latin { font-weight: 700; color: var(--lvl-b); }
.pill { --k: 44px; position: relative; height: 54px; border-radius: 999px; background: var(--surface-3); box-shadow: 0 0 0 1px var(--line) inset; cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; outline: none; }
.pill:focus-visible { box-shadow: 0 0 0 1px var(--line) inset, 0 0 0 4px var(--focus); }
.pill .fill { position: absolute; top: 0; bottom: 0; inset-inline-start: 0; width: calc(var(--p) * (100% - 54px) + 54px); border-radius: 999px; background: linear-gradient(90deg, var(--lvl-a), var(--lvl-b)); box-shadow: 0 8px 26px -10px var(--lvl-b); transition: width .28s cubic-bezier(.2,.9,.2,1), background .25s; }
body[dir="rtl"] .pill .fill { background: linear-gradient(270deg, var(--lvl-a), var(--lvl-b)); }
.pill .dots { position: absolute; inset: 0; pointer-events: none; }
.pill .dots i { position: absolute; top: 50%; width: 7px; height: 7px; margin-top: -3.5px; margin-inline-start: -3.5px; border-radius: 50%; background: var(--dim); opacity: .55; inset-inline-start: calc(27px + var(--d) * (100% - 54px)); transition: background .2s, opacity .2s; }
.pill .dots i.in { background: #fff; opacity: .75; }
.pill .knob { position: absolute; top: 5px; width: var(--k); height: var(--k); border-radius: 50%; background: #fff; box-shadow: 0 4px 14px rgba(0,0,0,.28), 0 0 0 1px rgba(0,0,0,.04); inset-inline-start: calc(5px + var(--p) * (100% - 54px)); transition: inset-inline-start .28s cubic-bezier(.2,.9,.2,1); display: grid; place-items: center; }
.pill.drag .knob, .pill.drag .fill { transition: none; }
.pill .knob::after { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--lvl-b); opacity: .9; transition: background .25s; }
.effort-scale { display: flex; justify-content: space-between; margin: 10px 6px 0; font-size: 11px; color: var(--dim); }
.effort-scale span { flex: 1; text-align: center; cursor: pointer; line-height: 1.25; }
.effort-scale span:first-child { text-align: start; } .effort-scale span:last-child { text-align: end; }
.effort-scale span.on { color: var(--lvl-b); font-weight: 700; }
.effort-scale small { display: block; font-family: var(--latin); font-size: 10px; opacity: .8; }
.lvl-badge { font-size: 11px; padding: 2px 9px; border-radius: 99px; font-weight: 700; }
.lvl-badge.free { color: var(--ok-t); background: var(--ok-bg); }
.lvl-badge.paid { color: var(--warn-t); background: var(--warn-bg); }
.suggest { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; margin-top: 18px; }
.suggest button { text-align: start; padding: 13px 15px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; transition: border-color .2s, transform .15s, box-shadow .2s; font-size: 13.5px; color: var(--text); }
.suggest button:hover { border-color: var(--blue); transform: translateY(-2px); box-shadow: var(--shadow); }
.hero-ai { text-align: center; margin: auto; padding: 30px 10px; max-width: 760px; }
.hero-ai img { width: 82px; filter: drop-shadow(0 0 22px rgba(47,107,255,.5)); }
.hero-ai h2 { font-family: var(--display); font-size: 23px; margin: 12px 0 4px; }

/* calendar */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal .dname { text-align: center; font-size: 12px; color: var(--dim); padding: 4px 0; font-weight: 600; }
.cal .day { min-height: 92px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface); padding: 6px; font-size: 12px; }
.cal .day.today { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue) inset; }
.cal .day.out { opacity: .4; }
.cal .day .dn { font-family: var(--latin); color: var(--muted); font-size: 12px; }
.cal .ev { margin-top: 4px; padding: 2px 6px; border-radius: 6px; background: var(--blue-bg); color: var(--blue-t); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.cal .ev.od { background: var(--bad-bg); color: var(--bad-t); } .cal .ev.pd { background: var(--ok-bg); color: var(--ok-t); text-decoration: line-through; opacity: .75; }

/* notifications */
.notif { display: flex; gap: 12px; padding: 13px 14px; border-radius: 13px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; transition: border-color .2s, background .2s; color: var(--text); }
.notif.unread { border-color: rgba(47,107,255,.35); background: var(--blue-bg); }
.notif:hover { border-color: var(--blue); }
.notif .ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: none; background: var(--blue-bg); color: var(--blue); }
.notif .ic svg { width: 19px; height: 19px; }

/* ───────── archive ───────── */
.arch-compose textarea.input { min-height: 120px; }
.drop { border: 1.5px dashed var(--line-strong); border-radius: 13px; padding: 14px; text-align: center; color: var(--muted); cursor: pointer; transition: border-color .2s, background .2s; font-size: 13.5px; }
.drop.over, .drop:hover { border-color: var(--blue); background: var(--blue-bg); }
.file-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.file-chip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 10px; border-radius: 10px; background: var(--surface-3); border: 1px solid var(--line); font-size: 12.5px; max-width: 100%; color: var(--text); cursor: pointer; }
.file-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.file-chip .x { border: 0; background: none; cursor: pointer; color: var(--dim); padding: 0; display: inline-grid; }
.arch-list { display: grid; gap: 12px; }
.arch-item { padding: 16px 18px; cursor: pointer; transition: border-color .2s, transform .15s; }
.arch-item:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.arch-item.pinned { border-inline-start: 3px solid var(--gold); }
.arch-item h4 { margin: 0; font-size: 15.5px; color: var(--heading); font-family: var(--display); }
.arch-item .ex { color: var(--muted); font-size: 13.5px; margin: 6px 0 10px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.arch-meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; font-size: 12px; color: var(--dim); }
.arch-body { white-space: pre-wrap; line-height: 1.9; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; max-height: 50vh; overflow: auto; }
.tag { display: inline-flex; padding: 1px 9px; border-radius: 999px; background: var(--violet-bg); color: var(--violet-t); font-size: 11.5px; font-weight: 600; }
.pending-chip { background: var(--warn-bg); color: var(--warn-t); }

/* responsive */
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset-block: 0; inset-inline-start: 0; width: 280px; z-index: 100; transform: translateX(110%); transition: transform .3s ease; }
  body[dir="ltr"] .side { transform: translateX(-110%); }
  .side.open { transform: none !important; box-shadow: 0 0 80px rgba(0,0,0,.5); }
  .menu-btn { display: inline-grid; }
  .page { padding: 16px 14px 70px; }
  .top { padding: 10px 12px; gap: 8px; }
  .top .who .nm { display: none; }
  .top .who { padding: 3px; }
  .g2, .g3, .g4, .form-grid { grid-template-columns: 1fr; }
  .login { grid-template-columns: 1fr; }
  .login-art { min-height: 210px; }
  .login-art h2, .login-art p { display: none; }
  .ai { grid-template-columns: 1fr; height: calc(100vh - 96px); }
  .ai-list { display: none; }
  .ai-msgs { padding: 14px; }
  .ai-input { padding: 10px; }
  .effort-pop { inset-inline: 8px; }
  .gauge .gname { display: none; }
  .theme-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cal .day { min-height: 64px; font-size: 10.5px; }
}
.orb-mini { display: inline-block; width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(127,127,127,.35); border-top-color: currentColor; animation: spin .8s linear infinite; vertical-align: -2px; }
@media print { .side, .top, .btn, #netbar { display: none !important; } body { background: #fff; color: #000; } .card { box-shadow: none; border: 1px solid #ccc; background: #fff; } }
@media (max-width: 1250px) { .ai { grid-template-columns: 1fr; } .ai-list { display: none; } }
.top-logo { display: none; width: 34px; height: 34px; filter: drop-shadow(0 0 8px rgba(47,107,255,.45)); }
@media (max-width: 860px) { .top-logo { display: block; } }

/* update bar (green, top, mandatory) + "new" badge */
#updatebar { position: sticky; top: 0; z-index: 900; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px 14px; padding: 10px 16px; background: linear-gradient(90deg, #0f9d6e, #12b886); color: #fff; font-size: 14px; box-shadow: 0 6px 20px -8px rgba(15,157,110,.7); animation: pageIn .35s ease; }
#updatebar .ub-ic { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: rgba(255,255,255,.18); }
#updatebar .ub-ic svg { animation: spin 2.4s linear infinite; }
#updatebar .ub-sub { opacity: .85; font-size: 13px; }
#updatebar button { border: 0; background: #fff; color: #0b6b4b; font-weight: 800; padding: 7px 18px; border-radius: 999px; cursor: pointer; box-shadow: 0 4px 12px rgba(0,0,0,.15); }
#updatebar button:hover { transform: translateY(-1px); }
#updatebar .ub-count { font-size: 12px; opacity: .85; font-family: var(--latin); }
body.has-update .top { top: 50px; }
.badge.new { background: linear-gradient(135deg, #12b886, #0f9d6e); color: #fff; font-size: 10.5px; padding: 1px 8px; animation: blink 2.2s infinite; }
