/* SYC Mas — one stylesheet, one design system (v9, 2026-09-24).
   Rebuilt from zero instead of layering overrides. Principles:
   · neutral graphite surfaces, elevation = a lighter surface, never glows
   · one accent (SYC indigo) for actions and focus only; the logo's gradient is the
     single signature: the active-session mark and the "Claude is working" thread
   · Persian first: Estedad, line-height 1.85 for reading, 1.45 for UI, no letter-spacing
   · one type scale, a 4-px spacing rhythm, radii by role (chips 999, controls 10,
     cards 14, the message box 22) */

/* ---------------------------------------------------------------- fonts -- */
@font-face { font-family: "Estedad"; src: url("/fonts/Estedad-var.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Vazirmatn"; src: url("/fonts/Vazirmatn-var.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "IBM Plex Sans Arabic"; src: url("/fonts/PlexArabic-ar-400.woff2") format("woff2"); font-weight: 400; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+200C-200E, U+2010-2011, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: "IBM Plex Sans Arabic"; src: url("/fonts/PlexArabic-ar-500.woff2") format("woff2"); font-weight: 500; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+200C-200E, U+2010-2011, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: "IBM Plex Sans Arabic"; src: url("/fonts/PlexArabic-ar-600.woff2") format("woff2"); font-weight: 600; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+200C-200E, U+2010-2011, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: "IBM Plex Sans Arabic"; src: url("/fonts/PlexArabic-ar-700.woff2") format("woff2"); font-weight: 700 900; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+200C-200E, U+2010-2011, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: "IBM Plex Sans Arabic"; src: url("/fonts/PlexArabic-la-400.woff2") format("woff2"); font-weight: 400; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2190-2193, U+2212; }
@font-face { font-family: "IBM Plex Sans Arabic"; src: url("/fonts/PlexArabic-la-500.woff2") format("woff2"); font-weight: 500; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2190-2193, U+2212; }
@font-face { font-family: "IBM Plex Sans Arabic"; src: url("/fonts/PlexArabic-la-600.woff2") format("woff2"); font-weight: 600; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2190-2193, U+2212; }
@font-face { font-family: "IBM Plex Sans Arabic"; src: url("/fonts/PlexArabic-la-700.woff2") format("woff2"); font-weight: 700 900; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2190-2193, U+2212; }
@font-face { font-family: "JetBrains Mono"; src: url("/fonts/jetbrains-mono-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("/fonts/jetbrains-mono-600.woff2") format("woff2"); font-weight: 500 700; font-display: swap; }
@font-face { font-family: "DejaVu Sans Mono"; src: url("/fonts/DejaVuSansMono.ttf") format("truetype"); font-weight: 400 700; font-display: swap; }

/* --------------------------------------------------------------- tokens -- */
:root {
  color-scheme: dark;
  /* surfaces: canvas → raised → hover */
  --bg: #131316;
  --side: #0f0f12;
  --surf: #1c1c21;
  --surf-2: #25252c;
  --surf-3: #2e2e36;
  --line: #2b2b33;
  --line-soft: rgba(255, 255, 255, .055);
  --code-bg: #0d0d10;
  --term-bg: #0b0b0d;
  --term-fg: #d8d8de;
  /* text */
  --text: #ececf1;
  --text-2: #a4a4ae;
  --text-3: #6f6f7a;
  /* accent (SYC indigo), states */
  --accent: #8c8ff7;
  --accent-fill: #5b5ee9;
  --accent-soft: rgba(124, 127, 245, .14);
  --accent-line: rgba(124, 127, 245, .42);
  --ok: #4fc58c;
  --warn: #e3aa3c;
  --bad: #ef6b6b;
  --info: #6aaee6;
  --skill: #e2b441;
  --brand: linear-gradient(90deg, #6366f1, #a855f7 55%, #ec4899);
  --shadow: 0 16px 48px rgba(0, 0, 0, .45);
  --shadow-sm: 0 4px 14px rgba(0, 0, 0, .28);
  /* type */
  --ui-font: "Estedad", "Vazirmatn", system-ui, sans-serif;
  --code-font: "JetBrains Mono", "DejaVu Sans Mono", ui-monospace, monospace;
  --mono: "DejaVu Sans Mono", "JetBrains Mono", ui-monospace, monospace;
  --fs: 15px;           /* message text (the look dialog can change it) */
  --lh: 1.85;
  --t-xs: 11.5px;
  --t-sm: 12.5px;
  --t-ui: 13.5px;
  --t-h3: 16px;
  --t-h2: 18px;
  --t-h1: 20px;
  /* layout */
  --sidebar-w: 288px;
  --chat-w: 780px;
  --r-ctl: 10px;
  --r-card: 14px;
  --gut: 20px;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff;
  --side: #f6f6f8;
  --surf: #f3f3f6;
  --surf-2: #eaeaef;
  --surf-3: #e1e1e8;
  --line: #e2e2e8;
  --line-soft: rgba(20, 20, 40, .07);
  --code-bg: #f6f6f9;
  --text: #18181d;
  --text-2: #5b5b67;
  --text-3: #8c8c98;
  --accent: #4f46e5;
  --accent-fill: #4f46e5;
  --accent-soft: rgba(79, 70, 229, .09);
  --accent-line: rgba(79, 70, 229, .38);
  --ok: #1f9d63;
  --warn: #b7791f;
  --bad: #d64545;
  --info: #2f7fc1;
  --skill: #a87a06;
  --shadow: 0 16px 48px rgba(20, 20, 40, .16);
  --shadow-sm: 0 3px 12px rgba(20, 20, 40, .08);
}
:root[data-accent="blue"]  { --accent: #6aa6f8; --accent-fill: #2f74e0; --accent-soft: rgba(106, 166, 248, .14); --accent-line: rgba(106, 166, 248, .42); }
:root[data-accent="teal"]  { --accent: #4fc9b4; --accent-fill: #16876f; --accent-soft: rgba(79, 201, 180, .13); --accent-line: rgba(79, 201, 180, .4); }
:root[data-accent="rose"]  { --accent: #f07fb0; --accent-fill: #c2407e; --accent-soft: rgba(240, 127, 176, .13); --accent-line: rgba(240, 127, 176, .4); }
:root[data-accent="amber"] { --accent: #e9ae4a; --accent-fill: #b26f0c; --accent-soft: rgba(233, 174, 74, .13); --accent-line: rgba(233, 174, 74, .4); }
:root[data-theme="light"][data-accent="blue"]  { --accent: #1d64d8; --accent-fill: #1d64d8; }
:root[data-theme="light"][data-accent="teal"]  { --accent: #0f7a64; --accent-fill: #0f7a64; }
:root[data-theme="light"][data-accent="rose"]  { --accent: #b8336f; --accent-fill: #b8336f; }
:root[data-theme="light"][data-accent="amber"] { --accent: #9a5d05; --accent-fill: #9a5d05; }

/* ----------------------------------------------------------------- base -- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; overflow: hidden;
  background: var(--bg); color: var(--text);
  font-family: var(--ui-font); font-size: var(--t-ui); line-height: 1.45; letter-spacing: 0;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
svg { display: block; }
a { color: var(--accent); }
.bg-glow { display: none; }
* { scrollbar-width: thin; scrollbar-color: rgba(127, 127, 140, .32) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(127, 127, 140, .3); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes flow { to { background-position: -200% 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.enter { animation: rise .2s ease-out both; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition: none !important; } }

/* -------------------------------------------------------------- buttons -- */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 18px; border: 0; border-radius: var(--r-ctl);
  background: var(--accent-fill); color: #fff; font-size: 14px; font-weight: 600;
  transition: filter .15s;
}
.btn-primary:hover { filter: brightness(1.1); }
.btn-primary:disabled { opacity: .55; }
.btn-primary.wide { width: 100%; }
.btn-ghost {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: var(--r-ctl); background: transparent;
  color: var(--text); font-size: var(--t-ui); white-space: nowrap;
}
.btn-ghost:hover { background: var(--surf-2); }
.btn-ghost.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.btn-ghost.danger:hover { background: color-mix(in srgb, var(--bad) 10%, transparent); }
.icon-btn {
  width: 34px; height: 34px; flex: none; display: inline-grid; place-items: center;
  border: 0; border-radius: var(--r-ctl); background: transparent; color: var(--text-2);
}
.icon-btn:hover { background: var(--surf-2); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }
.btn-sm {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 32px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surf-2); color: var(--text); font-size: var(--t-sm); font-weight: 500; white-space: nowrap;
}
.btn-sm:hover { background: var(--surf-3); }
.btn-sm.primary { background: var(--accent-fill); border-color: transparent; color: #fff; }
.btn-sm.primary:hover { filter: brightness(1.1); }
.btn-sm.yellow { background: var(--skill); border-color: transparent; color: #1d1600; font-weight: 600; }
.btn-sm.yellow:hover { filter: brightness(1.06); }
.btn-sm.danger { background: transparent; color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.btn-sm.danger:hover { background: color-mix(in srgb, var(--bad) 10%, transparent); }

.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--r-ctl); background: var(--surf); border: 1px solid var(--line-soft); }
.seg button { height: 28px; padding: 0 12px; border: 0; border-radius: 7px; background: transparent; color: var(--text-2); font-size: var(--t-ui); white-space: nowrap; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surf-3); color: var(--text); font-weight: 500; }
:root[data-theme="light"] .seg button.on { background: #fff; box-shadow: var(--shadow-sm); }

/* inputs */
.inp, .field input {
  width: 100%; min-height: 38px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); color: var(--text); font-size: var(--t-ui); line-height: 1.5;
  transition: border-color .15s, box-shadow .15s;
}
.inp:focus, .field input:focus { outline: none; border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.inp.ltr { direction: ltr; text-align: left; }
textarea.inp { min-height: 76px; resize: vertical; line-height: 1.75; }
select.inp, .ctl select, .usage-head select {
  appearance: none; -webkit-appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238f8f9a' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-size: 14px; background-position: left 10px center; padding-left: 30px;
}
label.chk { display: inline-flex; align-items: center; gap: 8px; font-size: var(--t-ui); line-height: 1.6; color: var(--text); cursor: pointer; }
label.chk input { flex: none; }
input[type="checkbox"], input[type="radio"], input[type="range"] { accent-color: var(--accent-fill); }
input[type="checkbox"] { width: 16px; height: 16px; margin: 0; }

/* ---------------------------------------------------------------- login -- */
.login { position: relative; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; overflow: auto; background: var(--bg); }
.login::before {   /* the brand behind the sign-in */
  content: ""; position: fixed; inset: 0; pointer-events: none;
  background: url("/logo.svg") center 46% / min(620px, 92vw) no-repeat; opacity: .04;
}
.login-card {
  position: relative; width: min(380px, 100%); display: grid; gap: 14px; padding: 32px 28px 26px;
  border-radius: 20px; background: var(--surf); border: 1px solid var(--line-soft); box-shadow: var(--shadow);
}
.login-logo { width: 88px; height: 88px; margin: 0 auto; display: grid; place-items: center; }
.login-logo img { width: 88px; height: 88px; }
.login-card h1 { margin: 2px 0 0; text-align: center; font-size: 22px; font-weight: 700; }
.login-sub { margin: -8px 0 6px; text-align: center; color: var(--text-2); font-size: var(--t-ui); }
.field { display: grid; gap: 6px; font-size: var(--t-sm); color: var(--text-2); }
.field input { min-height: 44px; font-size: 15px; text-align: left; }
.login-error { min-height: 1.3em; margin: 0; color: var(--bad); font-size: var(--t-sm); text-align: center; }
.login .btn-primary { height: 44px; font-size: 15px; }

/* --------------------------------------------------------------- layout -- */
.app { position: relative; height: var(--app-h, 100dvh); display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
html.kb-open, html.kb-open body { overflow: hidden; }
.scrim { position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, .55); }
.only-mobile { display: none !important; }

/* -------------------------------------------------------------- sidebar -- */
.sidebar {
  display: flex; flex-direction: column; min-height: 0; padding: 12px 10px 8px;
  background: var(--side); border-inline-end: 1px solid var(--line-soft);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 6px 14px; }
.brand-logo { width: 34px; height: 34px; flex: none; display: grid; place-items: center; }
.brand-logo img { width: 34px; height: 34px; }
.brand-text { display: grid; flex: 1; min-width: 0; line-height: 1.3; }
.brand-text strong { font-size: 15px; font-weight: 700; }
.brand-text small { font-size: var(--t-xs); color: var(--text-3); }

.new-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 4px 14px; }
.new-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: var(--r-ctl); background: var(--surf); color: var(--text);
  font-size: var(--t-ui); font-weight: 500; white-space: nowrap; transition: background .15s, border-color .15s;
}
.new-btn:hover { background: var(--surf-2); }
.new-btn span {   /* the green / yellow "+" */
  width: 18px; height: 18px; flex: none; display: grid; place-items: center; border-radius: 50%;
  background: var(--ok); color: #07140d; font-size: 15px; font-weight: 700; line-height: 1;
}
.new-btn.skill span { background: var(--skill); color: #1d1600; }
.new-btn.skill:hover { border-color: color-mix(in srgb, var(--skill) 45%, var(--line)); }

.power-mini, .head-adds { display: none !important; }
.section-head { display: flex; align-items: center; gap: 8px; padding: 0 10px 6px; font-size: var(--t-sm); font-weight: 500; color: var(--text-3); }
.count { min-width: 22px; height: 18px; padding: 0 6px; display: inline-grid; place-items: center; border-radius: 999px; background: var(--surf); color: var(--text-2); font-size: var(--t-xs); }

.session-list { list-style: none; margin: 0; padding: 0 2px; flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 1px; }
.srow { position: relative; display: flex; align-items: center; border-radius: var(--r-ctl); transition: background .12s; }
.srow:hover { background: var(--surf); }
.srow.active { background: var(--surf-2); }
.srow.active::before {
  content: ""; position: absolute; inset-inline-start: 0; top: 9px; bottom: 9px; width: 3px;
  border-radius: 0 3px 3px 0; background: linear-gradient(180deg, #6366f1, #a855f7, #ec4899);
}
.srow-main {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  border: 0; background: transparent; text-align: start; border-radius: var(--r-ctl);
}
.srow-ico { display: none; }
.srow-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.srow-top { display: flex; align-items: center; min-width: 0; font-size: var(--t-ui); font-weight: 600; }
.srow-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: ltr; unicode-bidi: isolate; }
.srow-sub { display: flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; white-space: nowrap; font-size: var(--t-xs); color: var(--text-3); }
.srow-dot { width: 7px; height: 7px; flex: none; border-radius: 50%; background: transparent; box-shadow: inset 0 0 0 1.5px var(--text-3); }
.srow-dot[data-state="ready"] { background: var(--ok); box-shadow: none; }
.srow-dot[data-state="busy"] { background: var(--accent); box-shadow: none; animation: pulse 1.3s ease-in-out infinite; }
.srow-dot[data-state="waiting"] { background: var(--warn); box-shadow: none; animation: pulse 1.3s ease-in-out infinite; }
.srow-dot[data-state="booting"] { background: var(--warn); box-shadow: none; opacity: .7; }
.srow-dot[data-state="elsewhere"] { background: var(--info); box-shadow: none; }
.srow.running .srow-sub > span:nth-child(2) { color: var(--accent); }
.tag { flex: none; }
.tag-full { display: inline-grid; place-items: center; color: var(--text-3); }
.tag-full svg { width: 12px; height: 12px; }
.srow-cost { margin-inline-start: auto; padding-inline-start: 6px; direction: ltr; }
.srow-power {
  width: 30px; height: 30px; flex: none; margin-inline-end: 6px; display: grid; place-items: center;
  border: 0; border-radius: 8px; background: transparent; color: var(--text-3); opacity: 0; transition: opacity .12s;
}
.srow-power svg { width: 15px; height: 15px; }
.srow:hover .srow-power, .srow.active .srow-power, .srow-power:focus-visible { opacity: 1; }
.srow-power[data-on="1"] { color: var(--text-2); }
.srow-power:hover { background: var(--surf-3); color: var(--text); }
@media (hover: none) { .srow-power { opacity: .6; } }
/* ⋯ menu of a session row */
.srow-more {
  width: 30px; height: 30px; flex: none; margin-inline-end: 6px; display: grid; place-items: center;
  border: 0; border-radius: 8px; background: transparent; color: var(--text-3); opacity: 0; transition: opacity .12s, background .12s;
}
.srow-more svg { width: 16px; height: 16px; }
.srow:hover .srow-more, .srow.active .srow-more, .srow-more:focus-visible, .srow-more.on { opacity: 1; }
.srow-more:hover, .srow-more.on { background: var(--surf-3); color: var(--text); }
@media (hover: none) { .srow-more { opacity: .7; } }
.row-menu {
  position: fixed; z-index: 45; min-width: 232px; padding: 5px; display: grid; gap: 1px;
  border-radius: 12px; background: var(--surf-2); border: 1px solid var(--line); box-shadow: var(--shadow); animation: rise .14s ease-out both;
}
.rm-item { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: var(--text); font-size: var(--t-ui); text-align: start; white-space: nowrap; }
.rm-item svg { width: 16px; height: 16px; flex: none; color: var(--text-2); }
.rm-item:hover, .rm-item:focus-visible { background: var(--surf-3); outline: none; }
.rm-item.danger, .rm-item.danger svg { color: var(--bad); }
.rm-sep { height: 1px; margin: 4px 6px; background: var(--line-soft); }
.srow.scheduled { border: 1px dashed color-mix(in srgb, var(--skill) 40%, transparent); margin: 2px 0; }
.srow.scheduled .srow-ico { display: grid; place-items: center; width: 22px; font-size: 15px; }
.srow.scheduled .srow-top { font-weight: 500; }
.srow.scheduled .srow-power { opacity: .8; font-size: 18px; line-height: 1; }

/* account quota (2026-09-30): one single line per Claude account — «۵ ساعته · هفتگی · ریست · کردیت», boxes at the
   right end, the account's first 5 letters at the left end. Numbers are percent LEFT. */
.quota {
  display: grid; margin: 16px 0 6px; padding: 8px 6px 11px;
  border-radius: 12px; background: var(--surf); border: 1px solid var(--line-soft);
}
/* the quota table: header + one line per account, every word in its column */
#quotaRows { display: grid; column-gap: 0; row-gap: 0; min-width: 0; align-items: stretch; }
#quotaRows > span { display: grid; justify-items: center; align-content: center; min-width: 0; padding: 5px 2px; white-space: nowrap; }
#quotaRows > span + span { border-inline-start: 1px solid color-mix(in srgb, var(--line-soft) 55%, transparent); }
#quotaRows .q-h { font-size: 11.5px; font-weight: 600; color: var(--text-2); padding-top: 1px; padding-bottom: 7px; border-bottom: 1px solid var(--line-soft); letter-spacing: -.1px; }
#quotaRows .q-v b { font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text); line-height: 1.2; }
#quotaRows .q-v b i { font-style: normal; font-size: 8.5px; font-weight: 500; opacity: .7; margin-inline-start: 1px; }
#quotaRows .q-p { gap: 3px; }
#quotaRows .q-bar { display: block; width: 72%; height: 2.5px; border-radius: 3px; background: linear-gradient(90deg, var(--q-c, var(--ok)) calc(var(--p, 0) * 1%), var(--surf-3) 0); transform: scaleX(-1); }
#quotaRows .q-p[data-level="low"] { --q-c: var(--warn); }
#quotaRows .q-p[data-level="out"] { --q-c: var(--bad); }
#quotaRows .q-p[data-level="low"] b { color: var(--warn); }
#quotaRows .q-p[data-level="out"] b { color: var(--bad); }
#quotaRows .q-who { padding-inline: 6px 2px; }
#quotaRows .q-who b { font-size: 10px; font-weight: 700; color: var(--text-2); direction: ltr; unicode-bidi: isolate; padding: 1px 6px; border-radius: 6px; background: var(--surf-2); letter-spacing: .2px; }
#quotaRows .q-off { opacity: .5; }
/* the header's column lines stop at the header's bottom rule; data lines get a quiet divider between accounts */
#quotaRows > .q-first { border-inline-start: 0; }
#quotaRows > .q-sep { border-top: 1px solid color-mix(in srgb, var(--line-soft) 60%, transparent); }
.q-cell { display: grid; justify-items: center; gap: 3px; padding: 0 8px; }
.q-cell + .q-cell { border-inline-start: 1px solid var(--line-soft); }
.q-cell b { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text); }
.q-cell small { font-size: var(--t-xs); color: var(--text-3); }
.q-cell::after {
  content: ""; width: 100%; height: 3px; border-radius: 3px; margin-top: 2px;
  background: linear-gradient(90deg, var(--q-c, var(--ok)) calc(var(--p, 0) * 1%), var(--surf-3) 0);
  transform: scaleX(-1);   /* fills from the right, like the reading direction */
}
.q-cell[data-level="low"] { --q-c: var(--warn); }
.q-cell[data-level="out"] { --q-c: var(--bad); }
.q-cell[data-level="low"] b { color: var(--warn); }
.q-cell[data-level="out"] b { color: var(--bad); }
.q-cell.time::after { background: var(--surf-3); }

.sidebar-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 4px 2px; border-top: 1px solid var(--line-soft); }
.user-chip { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: var(--t-ui); color: var(--text-2); }
.user-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
#userName { direction: ltr; font-weight: 500; }
.role-badge { font-size: var(--t-xs); padding: 1px 8px; border-radius: 999px; background: var(--surf-2); color: var(--text-2); }
.foot-actions { display: flex; gap: 2px; }
.foot-actions .icon-btn { width: 32px; height: 32px; }

/* hidden legacy power block (kept for the script) */
.power { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 38px; border: 1px solid var(--line); border-radius: var(--r-ctl); background: var(--surf); }
.power .power-icon svg { width: 16px; height: 16px; }
.power-note { margin: 4px 2px 0; color: var(--text-3); font-size: var(--t-xs); }

/* ----------------------------------------------------------------- main -- */
.main { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.topbar { position: relative; display: flex; align-items: center; gap: 10px; min-height: 54px; padding: 8px var(--gut); }
.top-title { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.top-title strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; font-weight: 600; direction: ltr; unicode-bidi: isolate; }
.top-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.state-chip { display: inline-flex; align-items: center; gap: 6px; flex: none; font-size: var(--t-sm); color: var(--text-3); white-space: nowrap; }
.state-chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.state-chip[data-state="ready"] { color: var(--ok); }
.state-chip[data-state="busy"] { color: var(--accent); }
.state-chip[data-state="busy"]::before, .state-chip[data-state="waiting"]::before { animation: pulse 1.3s ease-in-out infinite; }
.state-chip[data-state="waiting"], .state-chip[data-state="booting"] { color: var(--warn); }
.state-chip[data-state="elsewhere"] { color: var(--info); }
.i-stop svg { width: 12px; height: 12px; }

/* the session's switches: one quiet row of pills, never wider than the screen */
.session-bar {
  position: relative; display: flex; align-items: center; gap: 6px; flex-wrap: nowrap;
  padding: 0 var(--gut) 10px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
  border-bottom: 1px solid var(--line-soft);
}
.session-bar::-webkit-scrollbar { display: none; }
.session-bar > * { flex: none; }
.ctl { display: inline-flex; align-items: center; }
.ctl > span { display: none; }
.ctl select {
  height: 28px; max-width: 200px; padding: 0 10px 0 28px; border: 1px solid var(--line-soft); border-radius: 999px;
  background-color: var(--surf); color: var(--text); font-size: var(--t-sm); font-weight: 500;
  background-position: left 9px center; background-size: 12px;
}
.ctl select:hover:not(:disabled) { background-color: var(--surf-2); }
.ctl select:disabled { opacity: .7; cursor: default; }
.ctl-mode select { color: var(--text); }
.ctl .lock-ico { display: none; }
.totals { display: flex; align-items: center; gap: 6px; margin-inline-start: auto; font-size: var(--t-sm); color: var(--text-3); white-space: nowrap; }
.totals span { unicode-bidi: isolate; }
.totals span.tok { display: none; }
.totals span.usd { direction: ltr; padding: 3px 10px; border-radius: 999px; color: var(--text-2); background: transparent; border: 1px solid var(--line-soft); cursor: pointer; }
.totals span.usd:hover { color: var(--text); background: var(--surf); }
.totals span.limited { color: var(--bad); }
.totals span.bg { color: var(--warn); direction: rtl; }
@media (min-width: 1280px) { .totals span.tok { display: inline; } }

/* the brand thread: only while the open session is working */
.main.is-busy .session-bar { border-bottom-color: transparent; }
.main.is-busy .session-bar::after {
  content: ""; position: absolute; inset-inline: 0; bottom: 0; height: 2px; z-index: 3;
  background: linear-gradient(90deg, transparent, #6366f1, #a855f7, #ec4899, transparent, #6366f1, #a855f7, #ec4899, transparent);
  background-size: 200% 100%; animation: flow 2.4s linear infinite;
}

/* ---------------------------------------------------------------- empty -- */
.empty { flex: 1; display: grid; place-content: center; justify-items: center; gap: 8px; padding: 24px 16px; text-align: center; }
.empty-logo { width: 96px; height: 96px; margin-bottom: 8px; }
.empty h2 { margin: 0; font-size: var(--t-h1); font-weight: 600; }
.empty p { margin: 0; max-width: 420px; color: var(--text-2); font-size: 14px; line-height: 1.8; }

/* ----------------------------------------------------------------- chat -- */
.chat-view { position: relative; flex: 1; min-height: 0; display: flex; isolation: isolate; }
.watermark { position: absolute; inset: 0; z-index: -1; display: grid; place-items: center; pointer-events: none; }
.watermark img { width: min(520px, 70%); opacity: .055; }
:root[data-theme="light"] .watermark img { opacity: .045; }
.chat-scroll { flex: 1; min-width: 0; overflow-y: auto; overflow-x: hidden; }
.chat-inner { width: min(var(--chat-w), 100%); margin: 0 auto; padding: 24px var(--gut) 16px; }
.load-more { display: block; margin: 0 auto 20px; height: 30px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--text-2); font-size: var(--t-sm); }
.load-more:hover { background: var(--surf); }
.messages { display: flex; flex-direction: column; gap: 24px; }
.messages > .turn, .messages > .msg-user { content-visibility: auto; contain-intrinsic-size: auto 120px; }

/* the owner's message */
.msg-user { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.bubble {   /* Codex Web's bubble */
  max-width: min(78%, 760px); min-width: 44px; padding: 12px 16px; border-radius: 18px 18px 5px 18px;
  background: linear-gradient(135deg, rgba(119, 101, 235, .92), rgba(99, 93, 205, .9)); color: #f7f6ff;
  border: 1px solid rgba(255, 255, 255, .12); box-shadow: 0 10px 32px rgba(75, 59, 180, .16);
  font-size: var(--fs); line-height: 1.95; white-space: pre-wrap; overflow-wrap: anywhere; text-align: start;
}
:root[data-accent]:not([data-accent="violet"]) .bubble { background: linear-gradient(135deg, color-mix(in srgb, var(--accent-fill) 94%, #fff 6%), var(--accent-fill)); box-shadow: 0 10px 32px color-mix(in srgb, var(--accent-fill) 18%, transparent); }
.bubble.pending { opacity: .7; }
.msg-user.queued .bubble { opacity: .75; border-style: dashed; }
.meta { display: flex; align-items: center; gap: 8px; padding: 0 6px; font-size: var(--t-xs); color: var(--text-3); }
.meta button { border: 0; background: none; padding: 0 2px; color: var(--text-3); font-size: 14px; line-height: 1; }
.meta button:hover { color: var(--text); }
.msg-user .img-grid { max-width: min(85%, 640px); }

/* Claude's turn: Codex Web's avatar square beside the text (no bubble) */
.turn { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; align-items: start; }
.turn-avatar {
  display: grid; place-items: center; width: 34px; height: 34px; margin-top: 2px; border-radius: 12px; color: #c6bdff;
  background: linear-gradient(145deg, rgba(139, 124, 248, .2), rgba(90, 215, 197, .09)); border: 1px solid rgba(165, 151, 255, .25);
  box-shadow: inset 0 0 24px rgba(139, 124, 248, .08), 0 8px 26px rgba(0, 0, 0, .2);
}
.turn-avatar svg { width: 19px; height: 19px; }
:root[data-theme="light"] .turn-avatar { color: var(--accent); box-shadow: none; }
.turn-body { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.turn-body > * { min-width: 0; max-width: 100%; }
.md-wrap { position: relative; min-width: 0; }
.turn-cost { order: 999; align-self: flex-end; font-size: var(--t-xs); color: var(--text-3); direction: ltr; font-variant-numeric: tabular-nums; }
.turn-cost:empty { display: none; }
/* end of a finished answer — Codex Web's "✓ تمام" between two fading lines */
.done-mark { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 14px 0 0; font-size: 11px; color: #48d7a8; }
:root[data-theme="light"] .done-mark { color: var(--ok); }
.done-mark::before, .done-mark::after { content: ""; width: min(90px, 12vw); height: 1px; background: linear-gradient(90deg, transparent, rgba(72, 215, 168, .3)); }
.done-mark::after { background: linear-gradient(90deg, rgba(72, 215, 168, .3), transparent); }
.msg-actions { display: flex; align-items: center; gap: 10px; margin-top: 6px; opacity: 0; transition: opacity .15s; }
.turn:hover .msg-actions, .msg-actions:focus-within { opacity: 1; }
@media (hover: none) { .msg-actions { opacity: 1; } }
.msg-actions button { height: 26px; padding: 0 10px; border: 1px solid var(--line-soft); border-radius: 8px; background: transparent; color: var(--text-2); font-size: var(--t-xs); }
.msg-actions button:hover { background: var(--surf); color: var(--text); }
.msg-actions .meta { padding: 0; }

/* Markdown */
.md { font-size: var(--fs); line-height: 1.95; color: #e5e8f0; overflow-wrap: anywhere; unicode-bidi: plaintext; }
:root[data-theme="light"] .md { color: var(--text); }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 13px; text-wrap: pretty; }
.md h1, .md h2, .md h3, .md h4 { margin: 24px 0 10px; line-height: 1.55; font-weight: 700; color: #fafbff; }
:root[data-theme="light"] .md :is(h1, h2, h3, h4) { color: var(--text); }
.md h1 { font-size: 21px; } .md h2 { font-size: 18px; } .md h3 { font-size: 16px; } .md h4 { font-size: 15px; font-weight: 600; }
.md strong { font-weight: 650; color: var(--text); }
.md em { font-style: normal; color: var(--text-2); }
.md mark { background: color-mix(in srgb, var(--warn) 28%, transparent); color: inherit; padding: 0 .25em; border-radius: 4px; }
.md del { color: var(--text-3); }
.md a { color: #a99cff; text-decoration: none; border-bottom: 1px solid rgba(169, 156, 255, .35); }
:root[data-theme="light"] .md a { color: var(--accent); border-bottom-color: var(--accent-line); }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 1.4em 0; }
.md ul, .md ol { margin: 9px 0 15px; padding-inline-start: 23px; }
.md li { margin: 5px 0; }
.md li::marker { color: var(--text-3); }
.md ol > li::marker { font-weight: 600; font-variant-numeric: tabular-nums; }
.md li > ul, .md li > ol { margin: .2em 0; }
.md li.task { list-style: none; margin-inline-start: -1.2em; display: flex; gap: 8px; align-items: baseline; }
.md li.task .box, .todo .box { width: 15px; height: 15px; flex: none; border-radius: 4px; border: 1.5px solid var(--text-3); transform: translateY(2px); }
.md li.task.done .box, .todo .done .box { background: var(--ok); border-color: var(--ok); }
.md li.task.done > span:last-child, .todo .done span:last-child { color: var(--text-3); text-decoration: line-through; }
.md blockquote { margin: 15px 0; padding: 8px 14px; border-inline-start: 3px solid var(--accent); border-radius: 8px 0 0 8px; background: rgba(255, 255, 255, .025); color: #b9c0d0; }
:root[data-theme="light"] .md blockquote { color: var(--text-2); background: var(--surf); }
.md blockquote > :last-child { margin-bottom: 0; }
.md code { font-family: "DejaVu Sans Mono", var(--code-font); font-size: .86em; padding: 2px 6px; border-radius: 6px; background: rgba(139, 124, 248, .1); border: 1px solid rgba(139, 124, 248, .12); color: #c6bdff; direction: ltr; unicode-bidi: isolate; }
:root[data-theme="light"] .md code { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.md.ltr-only { direction: ltr; text-align: left; }
.md img.inline-img { max-width: min(360px, 100%); border-radius: 12px; cursor: zoom-in; }

/* code blocks */
.codeblock { margin: 16px 0; border: 1px solid rgba(255, 255, 255, .09); border-radius: 13px; overflow: hidden; background: #080c14; box-shadow: inset 0 1px rgba(255, 255, 255, .02); direction: ltr; }
:root[data-theme="light"] .codeblock { background: var(--code-bg); border-color: var(--line); }
.code-head { display: flex; align-items: center; justify-content: space-between; height: 32px; padding: 0 12px; border-bottom: 1px solid rgba(255, 255, 255, .09); background: rgba(255, 255, 255, .025); font-family: var(--code-font); font-size: 10.5px; color: var(--text-3); }
.code-head button { height: 24px; padding: 0 8px; border: 0; border-radius: 6px; background: transparent; color: var(--text-2); font-family: var(--ui-font); font-size: var(--t-xs); }
.code-head button:hover { background: var(--surf-2); color: var(--text); }
.codeblock pre { margin: 0; padding: 15px; overflow-x: auto; font-family: var(--code-font); font-size: 12px; line-height: 1.7; text-align: left; color: #cdd4e3; }
.md .codeblock code, .md pre code, .io code { padding: 0; border: 0; background: none; color: inherit; font-size: 1em; }
.md .codeblock pre code.hljs { color: #d9d9e0; }
:root[data-theme="light"] .md .codeblock pre code.hljs { color: #24242b; }
.hljs-keyword, .hljs-selector-tag, .hljs-built_in, .hljs-literal { color: #c49bf2; }
.hljs-string, .hljs-attr-value, .hljs-template-tag, .hljs-regexp { color: #9fd49a; }
.hljs-number, .hljs-symbol, .hljs-bullet { color: #eeb37a; }
.hljs-comment, .hljs-quote { color: #6f6f7a; }
.hljs-title, .hljs-title.function_, .hljs-section { color: #86b4f7; }
.hljs-attr, .hljs-attribute, .hljs-property, .hljs-variable, .hljs-params { color: #e7c77d; }
.hljs-type, .hljs-class .hljs-title, .hljs-title.class_ { color: #f0cf85; }
.hljs-meta, .hljs-meta .hljs-keyword { color: #7fd0e0; }
.hljs-tag, .hljs-name { color: #ef8b8b; }
.hljs-deletion { color: #f39a9a; background: rgba(239, 107, 107, .1); }
.hljs-addition { color: #8fdcb2; background: rgba(79, 197, 140, .1); }
:root[data-theme="light"] .hljs-keyword, :root[data-theme="light"] .hljs-built_in, :root[data-theme="light"] .hljs-literal { color: #7c3aed; }
:root[data-theme="light"] .hljs-string, :root[data-theme="light"] .hljs-regexp { color: #1a7f45; }
:root[data-theme="light"] .hljs-number { color: #b45309; }
:root[data-theme="light"] .hljs-comment { color: #8c8c98; }
:root[data-theme="light"] .hljs-title, :root[data-theme="light"] .hljs-title.function_ { color: #1d4ed8; }
:root[data-theme="light"] .hljs-attr, :root[data-theme="light"] .hljs-variable, :root[data-theme="light"] .hljs-property { color: #a16207; }

/* tables: sideways scroll inside their own frame, first column pinned */
.table-wrap { max-width: 100%; margin: 4px 0 1em; overflow-x: auto; scrollbar-width: thin; overscroll-behavior-x: contain; border: 1px solid var(--line); border-radius: 12px; -webkit-overflow-scrolling: touch; }
.md table.md-table { width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0; font-size: .9em; line-height: 1.65; }
.md table.md-table th, .md table.md-table td { padding: 8px 12px; text-align: start; vertical-align: top; border-bottom: 1px solid var(--line-soft); overflow-wrap: break-word; }
.md table.md-table tbody tr:last-child td { border-bottom: 0; }
.md table.md-table thead th { position: sticky; top: 0; z-index: 1; background: var(--surf); font-weight: 600; color: var(--text); border-bottom-color: var(--line); }
.md table.md-table tbody tr:hover td { background: color-mix(in srgb, var(--surf) 60%, var(--bg)); }
.md table.md-table.stick1 th:first-child, .md table.md-table.stick1 td:first-child { position: sticky; inset-inline-start: 0; z-index: 1; background: var(--bg); box-shadow: inset -1px 0 0 var(--line-soft); }
.md table.md-table.stick1 thead th:first-child { z-index: 2; background: var(--surf); }
.md table.md-table .c-s { white-space: nowrap; }
.md table.md-table .tbl-pin { display: inline-grid; place-items: center; width: 22px; height: 22px; margin-inline-end: 6px; vertical-align: -5px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: transparent; color: var(--text-3); cursor: pointer; opacity: .75; }
.md table.md-table .tbl-pin[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); opacity: 1; }
.md table.md-table .tbl-pin[aria-pressed="false"] svg { transform: rotate(45deg); }
.md table.md-table code { white-space: normal; overflow-wrap: anywhere; }

/* Claude's work (thinking + tools), folded under one quiet row */
.workgroup { align-self: flex-start; max-width: 100%; }
.workgroup > summary {
  display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px; list-style: none; cursor: pointer; user-select: none;
  border: 1px solid var(--line-soft); border-radius: 999px; font-size: var(--t-sm); color: var(--text-2); transition: background .12s;
}
.workgroup > summary::-webkit-details-marker { display: none; }
.workgroup > summary:hover { background: var(--surf); color: var(--text); }
.workgroup > summary::after {
  content: ""; width: 12px; height: 12px; flex: none; opacity: .7; transition: transform .15s;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238f8f9a' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / 12px no-repeat;
}
.workgroup[open] > summary::after { transform: rotate(180deg); }
.wg-ico { display: grid; place-items: center; color: var(--text-3); }
.wg-title { font-weight: 500; color: var(--text-2); }
.wg-count { color: var(--text-3); }
.wg-body { display: grid; gap: 2px; margin-top: 8px; padding: 6px; border: 1px solid var(--line-soft); border-radius: 12px; background: color-mix(in srgb, var(--surf) 55%, transparent); }
.workgroup[open] { align-self: stretch; }

.tools { display: grid; gap: 1px; }
.tool { border-radius: 8px; }
.tool > summary { display: flex; align-items: center; gap: 10px; min-height: 34px; padding: 4px 8px; list-style: none; cursor: pointer; border-radius: 8px; font-size: var(--t-sm); }
.tool > summary::-webkit-details-marker, .thinking > summary::-webkit-details-marker, .summary > summary::-webkit-details-marker { display: none; }
.tool > summary:hover { background: var(--surf-2); }
.tool[open] { background: var(--surf); }
.t-icon { width: 20px; height: 20px; flex: none; display: grid; place-items: center; color: var(--text-3); }
.t-icon svg { width: 15px; height: 15px; }
.t-name { flex: none; font-family: var(--code-font); font-size: 12px; font-weight: 500; color: var(--text); direction: ltr; }
.t-desc { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-3); }
.t-desc.ltr { direction: ltr; text-align: right; font-family: var(--code-font); font-size: 11.5px; }
.t-status { width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
.t-status.ok { background: var(--ok); animation: none; opacity: .8; }
.t-status.err { background: var(--bad); animation: none; }
.tool-body { display: grid; gap: 8px; padding: 4px 8px 10px; }
.io-label { font-size: var(--t-xs); color: var(--text-3); }
.io {
  margin: 0; padding: 10px 12px; max-height: 340px; overflow: auto; border-radius: 8px; border: 1px solid var(--line-soft);
  background: var(--code-bg); font-family: var(--code-font); font-size: 12px; line-height: 1.6;
  white-space: pre-wrap; word-break: break-word; direction: ltr; text-align: left; color: var(--text-2);
}
.io.err { border-color: color-mix(in srgb, var(--bad) 40%, transparent); color: color-mix(in srgb, var(--bad) 70%, var(--text)); }
.turn-body > pre.io { max-height: 240px; }
.diff { margin: 0; padding: 6px 0; max-height: 360px; overflow: auto; border-radius: 8px; border: 1px solid var(--line-soft); background: var(--code-bg); font-family: var(--code-font); font-size: 12px; line-height: 1.6; direction: ltr; text-align: left; }
.diff div { padding: 0 12px; white-space: pre-wrap; word-break: break-word; }
.diff .del { background: rgba(239, 107, 107, .1); color: #f2a6a6; }
.diff .add { background: rgba(79, 197, 140, .1); color: #9adbb8; }
:root[data-theme="light"] .diff .del { color: #9f1239; }
:root[data-theme="light"] .diff .add { color: #166534; }

.thinking > summary { display: flex; align-items: center; gap: 8px; min-height: 32px; padding: 4px 8px; list-style: none; cursor: pointer; border-radius: 8px; font-size: var(--t-sm); color: var(--text-3); }
.thinking > summary svg { color: var(--text-3); }
.thinking > summary:hover { background: var(--surf-2); color: var(--text-2); }
.thinking .md { padding: 2px 10px 10px; font-size: .92em; line-height: 1.8; color: var(--text-2); }
.hide-thinking .thinking { display: none; }

.todo { list-style: none; margin: 0; padding: 10px 14px; display: grid; gap: 6px; border: 1px solid var(--line-soft); border-radius: 12px; font-size: .94em; }
.todo li { display: flex; gap: 10px; align-items: baseline; }
.todo .doing .box { border-color: var(--accent); background: var(--accent-soft); }
.todo .doing span:last-child { color: var(--accent); }

/* images */
.img-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.img-grid img { max-width: min(300px, 100%); max-height: 240px; border-radius: 12px; border: 1px solid var(--line-soft); cursor: zoom-in; object-fit: cover; background: var(--surf); display: block; }
.path-previews { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.path-previews figure { margin: 0; display: grid; gap: 4px; }
.path-previews img { max-width: 240px; max-height: 180px; border-radius: 10px; border: 1px solid var(--line-soft); cursor: zoom-in; object-fit: cover; }
.path-previews figcaption { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--code-font); font-size: 11px; color: var(--text-3); direction: ltr; text-align: left; }

/* timeline markers */
.cmd { align-self: flex-start; display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 999px; background: var(--surf); border: 1px solid var(--line-soft); font-family: var(--code-font); font-size: 12px; color: var(--text-2); direction: ltr; }
.note { align-self: center; max-width: 90%; text-align: center; white-space: pre-wrap; font-size: var(--t-sm); color: var(--text-3); }
.intro-note { align-self: center; font-size: var(--t-xs); color: var(--text-3); }
.intro-card { align-self: stretch; border: 1px dashed var(--line); border-radius: 12px; background: color-mix(in srgb, var(--surf) 55%, transparent); }
.intro-card > summary { padding: 8px 14px; list-style: none; cursor: pointer; font-size: var(--t-sm); color: var(--text-3); }
.intro-card > summary:hover { color: var(--text-2); }
.intro-card .md { padding: 2px 14px 12px; font-size: .9em; color: var(--text-2); overflow-wrap: anywhere; }
.divider { display: flex; align-items: center; gap: 12px; font-size: var(--t-sm); color: var(--text-3); }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.divider small { font-family: var(--code-font); font-size: 11px; direction: ltr; }
.summary { border: 1px solid var(--line-soft); border-radius: 12px; }
.summary > summary { padding: 9px 14px; list-style: none; cursor: pointer; font-size: var(--t-sm); color: var(--text-2); }
.summary > summary:hover { color: var(--text); }
.summary .md { padding: 2px 14px 12px; font-size: .93em; color: var(--text-2); }

.pending-box { display: flex; flex-direction: column; gap: 12px; margin-top: 22px; }
.pending-box:empty { display: none; }
.activity { display: flex; align-items: center; gap: 10px; margin-top: 18px; font-family: var(--code-font); font-size: 12px; color: var(--text-2); direction: ltr; }
.pulse { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--accent); animation: pulse 1.1s ease-in-out infinite; }
.to-bottom {
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); z-index: 3; width: 36px; height: 36px;
  display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: var(--surf-2); color: var(--text); box-shadow: var(--shadow-sm);
}
.to-bottom svg { width: 17px; height: 17px; }

/* ------------------------------------------------------------ terminal -- */
.term-view { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; padding: 12px var(--gut) 10px; }
.term-wrap { flex: 1; min-height: 0; overflow: auto; border-radius: 12px; border: 1px solid var(--line-soft); background: var(--term-bg); }
:root[data-theme="light"] .term-wrap { --term-bg: #16161a; --term-fg: #dcdce2; }
.term { margin: 0; padding: 14px 16px; width: max-content; min-width: 100%; color: var(--term-fg); font-family: var(--mono); font-size: 13px; line-height: 1.22; white-space: pre; text-align: left; font-variant-ligatures: none; }
.keybar, .keystrip { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; direction: ltr; }
.keybar button, .keystrip .k {
  min-width: 40px; height: 30px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surf); color: var(--text); font-family: var(--code-font); font-size: 12px; box-shadow: 0 1px 0 var(--line);
}
.keybar button:hover, .keystrip .k:hover { background: var(--surf-2); }
.keybar button:active, .keystrip .k:active { transform: translateY(1px); box-shadow: none; }
.keystrip { width: min(var(--chat-w), 100%); margin: 0 auto 8px; }
.keystrip .k-esc, .keystrip .k-ctrlc { color: var(--bad); }
.keystrip .k-enter { background: var(--accent-fill); border-color: transparent; color: #fff; }

/* -------------------------------------------------------- files view -- */
.files-view { flex: 1; min-height: 0; overflow: auto; padding: 12px var(--gut) 32px; }
.files-cats { position: sticky; top: 0; z-index: 2; display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 0 12px; background: var(--bg); }
.files-cats button, .quick button {
  height: 30px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: transparent;
  color: var(--text-2); font-size: var(--t-sm); white-space: nowrap;
}
.files-cats button:hover, .quick button:hover { color: var(--text); background: var(--surf); }
.files-cats button.on { background: var(--text); color: var(--bg); border-color: transparent; }
.files-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; margin-bottom: 14px; }
.files-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; border: 1px solid var(--line-soft); background: var(--surf); cursor: zoom-in; }
.files-list { display: grid; gap: 4px; }
.file-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "cat name" "cat meta"; gap: 2px 12px;
  padding: 9px 12px; border: 0; border-radius: var(--r-ctl); background: transparent; text-align: start; color: inherit;
}
.file-row:hover { background: var(--surf); }
.file-row.gone { opacity: .5; }
.file-row .f-cat { grid-area: cat; align-self: center; min-width: 52px; padding: 3px 8px; border-radius: 6px; background: var(--surf-2); color: var(--text-2); font-size: var(--t-xs); text-align: center; }
.file-row .f-name { grid-area: name; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--code-font); font-size: 12.5px; direction: ltr; text-align: right; }
.file-row .f-meta { grid-area: meta; font-size: var(--t-xs); color: var(--text-3); }

/* ------------------------------------------------ CLI question card -- */
.dialog-card {
  display: grid; gap: 10px; width: min(var(--chat-w), calc(100% - 2 * var(--gut))); margin: 0 auto 8px; padding: 14px 16px;
  border-radius: var(--r-card); background: var(--surf); border: 1px solid color-mix(in srgb, var(--warn) 35%, var(--line));
  border-inline-start: 3px solid var(--warn); box-shadow: var(--shadow-sm); animation: rise .2s ease-out both;
}
.dialog-q { font-size: 14px; font-weight: 600; text-align: start; unicode-bidi: plaintext; }
.dialog-q:empty { display: none; }
.dialog-d { font-size: var(--t-sm); line-height: 1.7; color: var(--text-2); text-align: start; unicode-bidi: plaintext; }
.dialog-opts { display: grid; gap: 6px; direction: ltr; }
.dialog-opts .opt {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 40px; padding: 6px 12px;
  border: 1px solid var(--line); border-radius: var(--r-ctl); background: var(--bg); text-align: left; font-size: var(--t-ui);
}
.dialog-opts .opt:hover, .dialog-opts .opt.sel { border-color: var(--accent-line); background: var(--accent-soft); }
.opt-n { width: 24px; height: 24px; flex: none; display: grid; place-items: center; border-radius: 6px; background: var(--surf-3); color: var(--text); font-family: var(--code-font); font-size: 12px; font-weight: 600; }
.dialog-opts .opt.sel .opt-n { background: var(--accent-fill); color: #fff; }
.dialog-opts .opt.no .opt-n { background: color-mix(in srgb, var(--bad) 22%, transparent); color: var(--bad); }
.opt-l { flex: 1; white-space: normal; }
.opt-tools { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.opt-tools button { height: 28px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--text-2); font-family: var(--code-font); font-size: 12px; }
.opt-tools button:hover { background: var(--surf-2); color: var(--text); }
.opt-tools button.esc { color: var(--bad); }
.elsewhere-bar { margin: 0 var(--gut) 10px; padding: 10px 14px; border-radius: 12px; background: color-mix(in srgb, var(--info) 11%, transparent); border: 1px solid color-mix(in srgb, var(--info) 30%, transparent); font-size: var(--t-ui); line-height: 1.8; }

/* ------------------------------------------------------------ composer -- */
.composer { padding: 6px var(--gut) calc(12px + env(safe-area-inset-bottom)); }
.composer > * { width: min(var(--chat-w), 100%); margin-inline: auto; }
.quick { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 0 0 8px; mask-image: linear-gradient(to left, #000 88%, transparent); -webkit-mask-image: linear-gradient(to left, #000 88%, transparent); }
.quick::-webkit-scrollbar { display: none; }
.quick button { flex: none; height: 28px; }
.quick:empty { display: none; }
.ctxbar { display: flex; align-items: center; gap: 10px; padding: 0 6px 8px; }
.ctx-label { flex: none; max-width: 70%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--t-xs); color: var(--text-3); }
.ctx-track { flex: 1; height: 3px; border-radius: 3px; background: var(--surf-2); overflow: hidden; }
.ctx-track i { display: block; height: 100%; border-radius: 3px; background: var(--text-3); transition: width .4s ease; margin-inline-start: 0; }
.ctxbar.warn .ctx-track i { background: var(--warn); }
.ctxbar.full .ctx-track i { background: var(--bad); }
.ctxbar.warn .ctx-label { color: var(--warn); }
.ctxbar.full .ctx-label { color: var(--bad); }
.composer-box {
  display: grid; gap: 4px; padding: 10px 10px 8px 12px; border-radius: 22px;
  background: var(--surf); border: 1px solid var(--line); transition: border-color .15s, box-shadow .15s;
}
.composer-box:focus-within { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); box-shadow: 0 0 0 3px var(--accent-soft); }
.composer textarea {
  display: block; width: 100%; min-height: 28px; max-height: 40dvh; margin: 0; padding: 2px 6px;
  border: 0; outline: 0; resize: none; background: transparent; color: var(--text);
  font-size: var(--fs); line-height: 1.7;
}
.composer textarea::placeholder { color: var(--text-3); }
.composer-row { display: flex; align-items: center; gap: 2px; min-height: 36px; }
.composer-spacer { flex: 1; }
.attach-btn { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--text-2); }
.attach-btn:hover { background: var(--surf-2); color: var(--text); }
.attach-btn svg { width: 18px; height: 18px; }
.keys-btn.on { background: var(--accent-soft); color: var(--accent); }
.send-btn { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--accent-fill); color: #fff; transition: filter .15s, background .15s; }
.send-btn:hover:not(:disabled) { filter: brightness(1.12); }
.send-btn:disabled { background: var(--surf-3); color: var(--text-3); }
.send-btn svg { width: 18px; height: 18px; }
.attach-tray { display: flex; flex-wrap: wrap; gap: 8px; padding: 2px 2px 4px; }
.attach-chip { position: relative; width: 60px; height: 60px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--surf-2); }
.attach-chip img { width: 100%; height: 100%; object-fit: cover; display: block; }
.attach-chip.loading { opacity: .5; }
.attach-chip button { position: absolute; top: 3px; inset-inline-end: 3px; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%; background: rgba(0, 0, 0, .7); color: #fff; font-size: 12px; line-height: 20px; }
.composer-hint { display: flex; justify-content: space-between; gap: 10px; padding: 6px 10px 0; font-size: var(--t-xs); color: var(--text-3); }
html.kb-open .composer { padding-bottom: 4px; }
html.kb-open .composer-hint, html.kb-open .quick, html.kb-open .keystrip { display: none !important; }
.drop-hint { position: absolute; inset: 12px; z-index: 40; display: grid; place-items: center; border: 2px dashed var(--accent); border-radius: 20px; background: color-mix(in srgb, var(--bg) 85%, transparent); color: var(--accent); font-size: 16px; pointer-events: none; }

/* ------------------------------------------------------------- dialogs -- */
dialog { padding: 0; border: 1px solid var(--line); border-radius: 16px; background: var(--surf); color: var(--text); box-shadow: var(--shadow); max-height: calc(100dvh - 32px); }
dialog::backdrop { background: rgba(0, 0, 0, .6); backdrop-filter: blur(2px); }
:root[data-theme="light"] dialog::backdrop { background: rgba(20, 20, 40, .35); }
dialog h3 { margin: 0; font-size: var(--t-h2); font-weight: 650; }

dialog.handoff { width: min(560px, calc(100vw - 24px)); padding: 20px; overflow: auto; }
dialog.handoff > form { display: grid; gap: 14px; }
dialog.handoff.skilled { border-top: 3px solid var(--skill); }
dialog.handoff .row-actions { justify-content: flex-start; padding-top: 4px; }
dialog.handoff.small { width: min(420px, calc(100vw - 24px)); }
.sq-info { display: grid; gap: 6px; padding: 12px 14px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line-soft); }
.sq-row { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 10px; align-items: baseline; font-size: var(--t-sm); }
.sq-row > span { color: var(--text-3); }
.sq-row > b { font-weight: 500; color: var(--text); overflow-wrap: anywhere; }
.sq-row.warn > b { color: var(--warn); }
.sq-preview { padding: 12px 14px; border-radius: 12px; border: 1px dashed var(--line); background: transparent; color: var(--text-2); font-size: var(--t-sm); line-height: 1.8; white-space: pre-wrap; overflow-wrap: anywhere; }
dialog.handoff textarea { width: 100%; }

.look { width: min(480px, calc(100vw - 24px)); overflow: auto; }
.look-inner { display: grid; gap: 18px; padding: 20px; }
.look-head { display: grid; gap: 4px; }
.look-head strong { font-size: var(--t-h2); font-weight: 650; }
.look-head small { color: var(--text-2); font-size: var(--t-sm); }
.look-grid { display: grid; gap: 14px; }
.look-row { display: grid; gap: 8px; }
.look-row > span { font-size: var(--t-sm); color: var(--text-2); }
.look-row .seg { flex-wrap: wrap; justify-self: start; }
.range-line { display: flex; align-items: center; gap: 12px; }
.range-line input { flex: 1; }
.range-line output { min-width: 44px; text-align: center; font-size: var(--t-sm); color: var(--text-2); font-variant-numeric: tabular-nums; }
.swatches { display: flex; gap: 10px; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 0; box-shadow: 0 0 0 2px var(--surf), 0 0 0 3px transparent; }
.swatch.on { box-shadow: 0 0 0 2px var(--surf), 0 0 0 4px var(--text); }
.look-foot { display: flex; justify-content: space-between; gap: 10px; }

dialog.viewer { width: min(980px, calc(100vw - 16px)); max-height: 90dvh; overflow: hidden; }
.viewer-head { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line-soft); background: var(--surf); }
.viewer-head b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--code-font); font-size: 12px; font-weight: 500; color: var(--text-2); }
.viewer-body { max-height: calc(90dvh - 56px); overflow: auto; padding: 16px; }
.viewer-body img { display: block; max-width: 100%; margin: auto; border-radius: 10px; }
.viewer-pre { margin: 0; white-space: pre-wrap; word-break: break-word; font-family: var(--code-font); font-size: 12.5px; line-height: 1.65; direction: ltr; text-align: left; }

/* usage report */
dialog.usage-dlg { width: min(1100px, calc(100vw - 16px)); max-height: 92dvh; overflow: hidden; }
.usage-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); }
.usage-head b { margin-inline-end: auto; font-size: var(--t-h2); font-weight: 650; }
.usage-head select { width: auto; min-width: 150px; min-height: 32px; padding-top: 4px; padding-bottom: 4px; border: 1px solid var(--line); border-radius: 8px; background-color: var(--bg); font-size: var(--t-sm); }
.usage-body { max-height: calc(92dvh - 62px); overflow: auto; padding: 14px 16px 20px; font-size: var(--t-sm); }
.usage-body > .table-wrap { margin-bottom: 18px; }
.utbl { width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--t-sm); font-variant-numeric: tabular-nums; }
.utbl th, .utbl td { padding: 8px 12px; text-align: start; white-space: nowrap; border-bottom: 1px solid var(--line-soft); }
.utbl thead th { position: sticky; top: 0; z-index: 1; background: var(--surf-2); color: var(--text-2); font-weight: 600; }
.utbl td { direction: ltr; unicode-bidi: isolate; }
.utbl .u-n { color: var(--accent); font-weight: 700; cursor: help; }
.utbl .u-usd { color: var(--text); font-weight: 650; }
.utbl .u-extra { color: var(--warn); direction: rtl; }
.utbl .u-none { color: var(--text-3); }
.utbl tr.u-text td { direction: rtl; max-width: 60ch; padding-top: 0; white-space: normal; color: var(--text-3); font-size: var(--t-xs); }
.utbl tr:has(+ tr.u-text) td { border-bottom: 0; }
.utbl tr.u-total td { background: var(--surf-2); font-weight: 650; border-bottom: 0; }
.usage-shares { display: grid; gap: 8px; max-width: 560px; }
.usage-shares h4 { margin: 10px 0 0; font-size: var(--t-ui); font-weight: 600; color: var(--text); }
.us-row { display: grid; grid-template-columns: 130px 1fr 52px; align-items: center; gap: 12px; color: var(--text-2); }
.us-track { height: 6px; border-radius: 6px; background: var(--surf-3); overflow: hidden; }
.us-track i { display: block; height: 100%; border-radius: 6px; }
.us-row b { text-align: end; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.c-in { background: #8c8ff7; } .c-cr { background: #5fb7a8; } .c-out { background: #e3aa3c; } .c-ex { background: #ef6b6b; }
.cc-top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; font-size: var(--t-ui); }
.cc-parts { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.cc-parts span { padding: 4px 10px; border-radius: 999px; background: var(--surf-2); color: var(--text-2); direction: ltr; font-size: var(--t-xs); }
.utbl.cc td { max-width: 46ch; white-space: normal; direction: rtl; vertical-align: top; line-height: 1.65; }
.utbl.cc .cc-name { direction: ltr; text-align: left; font-weight: 600; color: var(--text); }
.score { display: inline-grid; place-items: center; min-width: 26px; height: 22px; border-radius: 6px; font-weight: 700; font-size: 12px; color: #fff; }
.score.s0 { background: var(--surf-3); color: var(--text-2); }
.score.s1 { background: #2f7d5c; } .score.s2 { background: #5f8a33; } .score.s3 { background: #a4812a; } .score.s4 { background: #b8622c; } .score.s5 { background: #b8404f; }

/* progress + toast + lightbox */
.progress-card { position: fixed; left: 50%; bottom: 24px; z-index: 70; transform: translateX(-50%); width: min(400px, calc(100% - 24px)); display: grid; gap: 8px; padding: 14px 16px; border-radius: var(--r-card); background: var(--surf-2); border: 1px solid var(--line); box-shadow: var(--shadow); }
.progress-title { font-size: var(--t-ui); font-weight: 600; }
.progress-bar { height: 6px; border-radius: 6px; background: var(--surf-3); overflow: hidden; }
.progress-bar i { display: block; width: 0; height: 100%; border-radius: 6px; background: var(--accent-fill); transition: width .35s ease; }
.progress-card.done .progress-bar i { background: var(--ok); }
.progress-card { touch-action: none; user-select: none; }
.progress-card.drag { transition: none; }
.progress-card:not(.drag) { transition: transform .18s ease, opacity .18s ease; }
.progress-x { position: absolute; top: 6px; inset-inline-end: 8px; width: 28px; height: 28px; border: 0; border-radius: 50%; background: transparent; color: var(--text-3); font-size: 20px; line-height: 1; cursor: pointer; }
.progress-x:hover { background: var(--surf-3); color: var(--text); }
.progress-card .progress-title { padding-inline-end: 30px; }
/* a bare link in a reply: its own box, the whole address visible, one tap opens it, «کپی» copies it exactly */
.link-box { display: flex; align-items: flex-start; gap: 8px; margin: 6px 0; padding: 7px 8px 7px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surf-2); direction: ltr; text-align: left; max-width: 100%; }
.link-box a { flex: 1; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; line-height: 1.45; word-break: break-all; overflow-wrap: anywhere; unicode-bidi: plaintext; }
.link-box button { flex: none; border: 1px solid var(--line); border-radius: 8px; background: var(--surf); color: var(--text-2); font: inherit; font-size: 11.5px; padding: 3px 10px; cursor: pointer; }
.link-box button.ok, .link-box button.copied { color: var(--ok); border-color: var(--ok); }
.progress-card.err .progress-bar i { background: var(--bad); }
.progress-msg { min-height: 1.2em; font-size: var(--t-sm); color: var(--text-2); }
.toast { position: fixed; left: 50%; bottom: 96px; z-index: 80; transform: translateX(-50%); max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 12px; background: var(--surf-3); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: var(--t-ui); animation: rise .2s ease-out both; }
.toast.err { color: #fff; background: #b8404f; border-color: transparent; }
.lightbox { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: rgba(0, 0, 0, .9); cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 12px; }

/* ---------------------------------------------------------------- admin -- */
.admin-view { overflow: hidden; }
.admin-view .topbar { border-bottom: 1px solid var(--line-soft); }
.admin-scroll { position: relative; flex: 1; min-height: 0; overflow-y: auto; isolation: isolate; }
.admin-scroll::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; background: url("/logo.svg") calc(50% - var(--sidebar-w) / 2) 55% / min(460px, 60vw) no-repeat; opacity: .025; }
.admin-inner { width: min(1000px, 100%); margin: 0 auto; padding: 18px var(--gut) 64px; display: grid; gap: 16px; }
.admin-tabs { justify-self: start; flex-wrap: wrap; }
.admin-body { display: grid; gap: 14px; }
.admin-body > p.hint { margin: 0; }
.card { display: grid; gap: 12px; padding: 16px; border-radius: var(--r-card); background: var(--surf); border: 1px solid var(--line-soft); }
.card h3 { margin: 0; font-size: var(--t-h3); font-weight: 650; }
.hint, p.hint { margin: 0; color: var(--text-2); font-size: var(--t-sm); line-height: 1.75; }
.card-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.card-inner .hint, .card-inner label.chk { width: 100%; }
.card-inner .inp { width: auto; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; align-items: end; }
.form-grid label:not(.chk), .card > label:not(.chk), dialog label:not(.chk) { display: grid; gap: 6px; font-size: var(--t-sm); color: var(--text-2); }
.form-grid .wide { grid-column: 1 / -1; }
.name-inputs { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.card > .btn-sm { justify-self: start; }
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line-soft); border-radius: 12px; background: var(--surf); }
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--t-sm); }
.tbl th, .tbl td { padding: 9px 12px; text-align: start; vertical-align: middle; white-space: nowrap; border-bottom: 1px solid var(--line-soft); }
.tbl th { background: var(--surf-2); color: var(--text-2); font-weight: 600; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td:last-child { white-space: normal; min-width: 170px; }
.tbl .mono { font-family: var(--code-font); font-size: 12px; direction: ltr; }
.tbl .inp { width: 120px; min-height: 32px; padding: 4px 8px; font-size: var(--t-sm); }
.tbl select.inp { width: auto; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0; font-size: var(--t-ui); }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; font-family: var(--code-font); font-size: 12.5px; direction: ltr; text-align: left; }
.health-list { display: grid; gap: 4px; }
.health-item { display: flex; align-items: baseline; gap: 10px; padding: 9px 12px; border-radius: var(--r-ctl); background: var(--bg); font-size: var(--t-ui); }
.health-item .ok { color: var(--ok); font-weight: 700; }
.health-item .bad { color: var(--bad); font-weight: 700; }
.health-item .hd { margin-inline-start: auto; color: var(--text-3); font-family: var(--code-font); font-size: 12px; direction: ltr; text-align: left; }
.rules { display: grid; gap: 12px; }
.rule-row { display: grid; gap: 6px; }
.rule-row .warn { font-size: var(--t-xs); color: var(--warn); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { height: 28px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: transparent; font-family: var(--code-font); font-size: 12px; direction: ltr; }
.chip.on { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.chip:disabled { opacity: .4; }
.inherit { font-size: var(--t-xs); color: var(--text-3); }
.ucard { border: 1px solid var(--line-soft); border-radius: var(--r-card); background: var(--surf); overflow: hidden; }
.ucard > summary { display: flex; align-items: center; gap: 12px; padding: 12px 16px; list-style: none; cursor: pointer; }
.ucard > summary::-webkit-details-marker { display: none; }
.ucard .uname { font-weight: 700; direction: ltr; }
.ucard .umeta { margin-inline-start: auto; display: flex; flex-wrap: wrap; gap: 10px; font-size: var(--t-sm); color: var(--text-2); }
.ucard .ubody { display: grid; gap: 14px; padding: 16px; border-top: 1px solid var(--line-soft); }
.s-cost { color: var(--text-2); direction: ltr; }
.umeta .tf { color: var(--ok); }
.twofa { display: grid; gap: 10px; justify-items: start; }
.qr { width: 210px; padding: 10px; border-radius: 12px; background: #fff; }
.qr svg { width: 100%; height: auto; }
.twofa code { padding: 4px 10px; border-radius: 8px; background: var(--surf-2); font-family: var(--code-font); letter-spacing: .06em; }
.admin-off { position: absolute; inset: 54px 0 0; z-index: 5; display: grid; place-content: center; justify-items: center; gap: 10px; padding: 16px; text-align: center; background: var(--bg); }
.admin-off img { width: 88px; }
.admin-off h2 { margin: 0; font-size: var(--t-h1); }
.admin-off p { margin: 0 0 8px; color: var(--text-2); }
.srow-open td { background: var(--accent-soft); }
.srow-detail td { background: var(--surf); white-space: normal; }
.lock { color: var(--text-3); }
.lock svg, .lock-ico svg { width: 13px; height: 13px; }

/* --------------------------------------------------------------- phone -- */
@media (max-width: 900px) {
  :root { --gut: 14px; }
  .app { grid-template-columns: minmax(0, 1fr); }
  .only-mobile { display: inline-grid !important; }
  .sidebar {
    position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 30; width: min(320px, 86vw);
    transform: translateX(105%); transition: transform .22s ease; box-shadow: var(--shadow);
  }
  .sidebar.open { transform: none; }
  .topbar { min-height: 52px; padding: 6px 10px; gap: 6px; }
  .top-title { gap: 8px; }
  .top-title strong { font-size: 14.5px; }
  .seg button { height: 28px; padding: 0 10px; }
  .btn-ghost.danger span:last-child { display: none; }
  .btn-ghost.danger { width: 34px; padding: 0; justify-content: center; }
  .session-bar { padding: 0 12px 8px; gap: 5px; }
  .ctl select { height: 28px; padding: 0 8px 0 22px; font-size: 12px; background-position: left 7px center; background-size: 11px; max-width: 150px; }
  .chat-inner { padding: 16px var(--gut) 12px; }
  .messages { gap: 20px; }
  .bubble { max-width: 88%; padding: 10px 13px; }
  .turn { grid-template-columns: 30px minmax(0, 1fr); gap: 9px; }
  .turn-avatar { width: 30px; height: 30px; border-radius: 10px; }
  .turn-avatar svg { width: 17px; height: 17px; }
  .messages { gap: 19px; }
  .composer { padding: 4px 10px calc(8px + env(safe-area-inset-bottom)); }
  .composer-box { border-radius: 20px; padding: 8px 8px 6px 10px; }
  .composer-hint { display: none; }
  .keystrip { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; scrollbar-width: none; }
  .keystrip::-webkit-scrollbar { display: none; }
  .keystrip .k { flex: none; }
  .toast { bottom: 88px; }
  .admin-scroll::before { background-position: center 55%; }
}
@media (max-width: 480px) {
  :root { --t-ui: 13px; }
  .md { font-size: calc(var(--fs) - .5px); line-height: calc(var(--lh) - .03); }
  .bubble { font-size: calc(var(--fs) - .5px); }
  .totals span.usd { display: none; }
  .state-chip { font-size: 0; gap: 0; }   /* just the coloured dot next to the name */
  .state-chip::before { width: 8px; height: 8px; }
  .seg button { padding: 0 9px; font-size: 12.5px; }
  .us-row { grid-template-columns: 96px 1fr 46px; }
  .usage-head b { width: 100%; }
  dialog.handoff { padding: 16px; }
  .form-grid { grid-template-columns: 1fr 1fr; }
}
@media (pointer: coarse) { .composer textarea { font-size: 16px; } }

/* ---------------------------------------------- cold memory (cache expired) -- */
.ctxbar.cold .ctx-label { color: var(--info); }
dialog.handoff.cold { width: min(560px, calc(100vw - 24px)); border-top: 3px solid var(--info); }
.cold-opts { display: grid; gap: 8px; }
.cold-opt {
  display: grid; gap: 4px; width: 100%; padding: 12px 14px; text-align: start;
  border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--text); transition: border-color .12s, background .12s;
}
.cold-opt:hover { border-color: var(--accent-line); background: var(--accent-soft); }
.cold-opt.best { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.cold-opt.best:hover { background: color-mix(in srgb, var(--ok) 9%, var(--bg)); }
.cold-opt.plain b { font-weight: 500; }
.co-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.co-top b { font-size: var(--t-ui); font-weight: 600; }
.co-cost { font-size: var(--t-sm); color: var(--text-2); direction: rtl; unicode-bidi: plaintext; }
.cold-opt.best .co-cost { color: var(--ok); }
.co-note { font-size: var(--t-sm); line-height: 1.7; color: var(--text-3); }
.cold-cost { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 14px; padding: 12px 14px; border-radius: 12px; background: color-mix(in srgb, var(--warn) 10%, var(--bg)); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); }
.cold-cost b { font-size: 20px; font-weight: 700; color: var(--warn); }
.cold-cost span { font-size: var(--t-ui); color: var(--text-2); direction: rtl; unicode-bidi: plaintext; }
dialog.handoff.cold { border-top-color: var(--warn); }

/* ------------------------------------------------ v12 (2026-09-24): list, market, media -- */
/* sidebar: three nav rows where the two «new session» boxes were */
.nav-rows { display: grid; gap: 1px; padding: 0 2px 12px; }
.nav-row {
  display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; width: 100%;
  border: 0; border-radius: var(--r-ctl); background: transparent; color: var(--text-2);
  font-size: var(--t-ui); font-weight: 500; text-align: start; transition: background .12s, color .12s;
}
.nav-row:hover { background: var(--surf); color: var(--text); }
.nav-row.on { background: var(--surf-2); color: var(--text); }
.nav-ico { width: 18px; height: 18px; flex: none; display: grid; place-items: center; color: var(--text-3); }
.nav-ico svg { width: 17px; height: 17px; }
.nav-row.on .nav-ico, .nav-row:hover .nav-ico { color: var(--accent); }
.nav-label { flex: 1; }
.nav-meta { font-size: var(--t-xs); color: var(--text-3); }
.nav-meta:empty { display: none; }

/* «سشن‌ها +»: the plus is the same size as the word */
.section-head { padding-top: 6px; border-top: 1px solid var(--line-soft); margin: 0 4px; padding-inline: 6px; }
.sh-label { font-size: var(--t-sm); }
.add-plus {
  width: 20px; height: 20px; padding: 0; display: inline-grid; place-items: center; border: 0; border-radius: 6px;
  background: transparent; color: var(--text-2); font-size: 17px; font-weight: 500; line-height: 1; font-family: system-ui, sans-serif;
}
.add-plus:hover, .add-plus.on { background: var(--surf-2); color: var(--text); }
.section-head .count { margin-inline-start: auto; }
.add-menu { min-width: 220px; }
.rm-title { padding: 6px 10px 8px; font-size: var(--t-xs); color: var(--text-3); }
.rm-kind { height: auto; padding: 8px 10px; align-items: center; }
.rm-kind-text { display: grid; gap: 1px; }
.rm-kind-text b { font-weight: 600; font-size: var(--t-ui); }
.rm-kind-text small { font-size: var(--t-xs); color: var(--text-3); }
.kind-dot { width: 10px; height: 10px; flex: none; border-radius: 50%; }
.kind-dot.plain { background: var(--ok); }
.kind-dot.skill { background: var(--skill); }

/* list: groups, hidden / archived, cache hint */
.srow-group { list-style: none; padding: 10px 10px 4px; font-size: var(--t-xs); color: var(--text-3); }
.srow.muted .srow-name { color: var(--text-2); font-weight: 500; }
.tag-arc { color: var(--text-3); }
.srow-cache { flex: none; font-size: var(--t-xs); }
.srow-cache.warm { color: color-mix(in srgb, var(--ok) 80%, var(--text-3)); }
.srow-cache.cold { color: color-mix(in srgb, var(--warn) 75%, var(--text-3)); }
.list-toggles { display: flex; gap: 4px; padding: 6px 4px 8px; }
.lt {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border: 1px solid var(--line-soft);
  border-radius: 999px; background: transparent; color: var(--text-3); font-size: var(--t-xs);
}
.lt svg { width: 14px; height: 14px; }
.lt b { font-weight: 500; color: var(--text-2); }
.lt:hover { color: var(--text); background: var(--surf); }
.lt.on { color: var(--text); background: var(--surf-2); border-color: var(--line); }

/* media in the chat: small preview, «نمایش» / «دانلود» under it */
.media-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 6px 0 2px; }
.msg-user .media-row { justify-content: flex-start; }
.media-thumb { margin: 0; width: 176px; display: grid; gap: 4px; }
.mt-box { position: relative; display: block; width: 176px; height: 124px; padding: 0; border: 1px solid var(--line-soft); border-radius: 12px; overflow: hidden; background: var(--surf); cursor: zoom-in; }
.mt-box img, .mt-box video { width: 100%; height: 100%; object-fit: cover; display: block; }
.mt-play, .attach-chip .mt-play { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.mt-play svg { width: 30px; height: 30px; padding: 8px; border-radius: 50%; color: #fff; background: rgba(0, 0, 0, .55); box-sizing: content-box; }
.mt-bar { display: flex; gap: 6px; }
.mt-bar button, .mt-bar a {
  flex: 1; height: 26px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surf); color: var(--text-2); font-size: var(--t-xs); text-decoration: none;
}
.mt-bar button:hover, .mt-bar a:hover { color: var(--text); background: var(--surf-2); }
.media-thumb figcaption { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--code-font); font-size: 10.5px; color: var(--text-3); direction: ltr; text-align: left; }
.media-thumb.broken .mt-box { display: grid; place-items: center; }
.lightbox { gap: 12px; }
.lightbox video { max-width: 100%; max-height: calc(100% - 60px); border-radius: 12px; background: #000; cursor: default; }
.lb-dl { position: absolute; top: 14px; inset-inline-start: 14px; height: 34px; padding: 0 14px; display: grid; place-items: center; border-radius: 10px; background: rgba(255, 255, 255, .12); color: #fff; text-decoration: none; font-size: var(--t-ui); }
.lb-dl:hover { background: rgba(255, 255, 255, .2); }

/* attachments: a filling bar, then a tick; send waits for every tick */
.attach-chip { width: 64px; height: 64px; }
.attach-chip video { width: 100%; height: 100%; object-fit: cover; display: block; }
.attach-chip.loading { opacity: 1; }
.attach-chip.loading img, .attach-chip.loading video { opacity: .55; }
.ac-bar { position: absolute; inset-inline: 5px; bottom: 5px; height: 4px; border-radius: 4px; background: rgba(0, 0, 0, .55); overflow: hidden; }
.ac-bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 4px; transition: width .2s; }
.attach-chip.done .ac-bar { display: none; }
.ac-ok { position: absolute; bottom: 4px; inset-inline-start: 4px; width: 18px; height: 18px; display: none; place-items: center; border-radius: 50%; background: var(--ok); color: #06140c; }
.ac-ok svg { width: 11px; height: 11px; stroke-width: 3; }
.attach-chip.done .ac-ok { display: grid; }
.attach-chip .ac-x { position: absolute; top: 3px; inset-inline-end: 3px; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%; background: rgba(0, 0, 0, .7); color: #fff; font-size: 12px; line-height: 20px; }

/* market: plugins · skills · connectors */
.market-view { overflow: hidden; }
.market-view .topbar { border-bottom: 1px solid var(--line-soft); }
.market-inner { width: min(1120px, 100%); margin: 0 auto; padding: 18px var(--gut) 64px; display: grid; gap: 14px; }
.market-tabs { justify-self: start; }
.market-body { display: grid; gap: 14px; }
.mk-src { margin: 0; font-size: var(--t-sm); line-height: 1.8; color: var(--text-2); }
.mk-h { margin: 8px 0 0; font-size: var(--t-h3); font-weight: 650; }
.mk-tools { display: grid; gap: 10px; position: sticky; top: 0; z-index: 3; padding: 10px 0; background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(6px); }
.mk-search { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-ctl); background: var(--surf); color: var(--text-3); }
.mk-search:focus-within { border-color: var(--accent-line); }
.mk-search svg { width: 16px; height: 16px; flex: none; }
.mk-search input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; color: var(--text); font-size: var(--t-ui); }
.mk-chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 1px; }
.mk-chips::-webkit-scrollbar { display: none; }
.mk-chip { flex: none; height: 30px; padding: 0 13px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--text-2); font-size: var(--t-sm); white-space: nowrap; }
.mk-chip:hover { color: var(--text); background: var(--surf); }
.mk-chip.on { background: var(--accent-soft); border-color: var(--accent-line); color: var(--text); }
.mk-chips.small .mk-chip { height: 26px; padding: 0 10px; font-size: var(--t-xs); }
.mk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; align-items: start; }
.mk-card { display: grid; gap: 10px; padding: 14px; border-radius: var(--r-card); background: var(--surf); border: 1px solid var(--line-soft); transition: border-color .15s; }
.mk-card:hover { border-color: var(--line); }
.mk-card.installed { border-color: color-mix(in srgb, var(--ok) 30%, var(--line-soft)); }
.mk-card.working { border-color: var(--accent-line); }
.mk-card-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mk-ico { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 10px; background: var(--surf-2); color: var(--accent); }
.mk-ico svg { width: 18px; height: 18px; }
.mk-card.skill .mk-ico { color: var(--skill); }
.mk-title { flex: 1; min-width: 0; display: grid; gap: 1px; }
.mk-title b { font-size: var(--t-h3); font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: start; }
.mk-title small { font-size: var(--t-xs); color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: start; }
.mk-badge { flex: none; height: 22px; padding: 0 9px; display: inline-grid; place-items: center; border-radius: 999px; background: var(--surf-2); color: var(--text-2); font-size: var(--t-xs); }
.mk-badge.ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.mk-stats { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: var(--t-xs); color: var(--text-2); }
.mk-stats .up { color: var(--ok); }
.mk-stats .tok { color: var(--text-3); }
.mk-fa { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line-soft); font-size: var(--t-ui); line-height: 1.9; color: var(--text); }
.mk-card.top .mk-fa { border-inline-start: 3px solid var(--accent-line); }
.mk-desc { margin: 0; font-size: var(--t-sm); line-height: 1.7; color: var(--text-2); overflow-wrap: anywhere; text-align: start; unicode-bidi: plaintext; }
.mk-desc.sub { font-size: var(--t-xs); color: var(--text-3); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mk-parts { display: flex; flex-wrap: wrap; gap: 5px; }
.mk-parts span { height: 22px; padding: 0 8px; display: inline-grid; place-items: center; border-radius: 6px; background: var(--surf-2); color: var(--text-2); font-size: var(--t-xs); }
.mk-parts .warn { color: var(--warn); }
.mk-parts .mcp { color: var(--info); direction: rtl; }
.mk-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.btn-sm.link { display: inline-flex; align-items: center; gap: 5px; text-decoration: none; color: var(--text-2); }
.btn-sm.link svg { width: 13px; height: 13px; }
.mk-confirm, .mk-note { display: grid; gap: 8px; padding: 10px 12px; border-radius: 10px; background: var(--bg); border: 1px dashed var(--line); font-size: var(--t-sm); line-height: 1.8; color: var(--text-2); }
.mk-confirm p, .mk-note p { margin: 0; }
.mk-confirm .warn { color: var(--warn); }
.mk-prog { display: grid; gap: 5px; }
.mk-prog-track { height: 6px; border-radius: 6px; background: var(--surf-3); overflow: hidden; }
.mk-prog-track i { display: block; height: 100%; width: 0; border-radius: 6px; background: var(--accent-fill); transition: width .35s ease; }
.mk-prog.ok .mk-prog-track i { background: var(--ok); }
.mk-prog.err .mk-prog-track i { background: var(--bad); }
.mk-prog-msg { font-size: var(--t-xs); color: var(--text-2); }
.mk-prog.ok .mk-prog-msg { color: var(--ok); font-weight: 600; }
.mk-prog.err .mk-prog-msg { color: var(--bad); }
.mk-loading { display: flex; align-items: center; gap: 10px; padding: 30px 4px; color: var(--text-2); }
.spinner { width: 16px; height: 16px; flex: none; border: 2px solid var(--surf-3); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
.mk-detail:empty { display: none; }
.mk-detail { display: grid; gap: 8px; }
.mk-body { margin: 0; max-height: 260px; overflow: auto; padding: 10px 12px; border-radius: 10px; background: var(--code-bg); font-family: var(--code-font); font-size: 12px; line-height: 1.65; white-space: pre-wrap; color: var(--text-2); }
.mk-how { display: grid; gap: 6px; margin: 0; font-size: var(--t-xs); color: var(--text-3); }
.mk-how code, .mk-cmd { display: block; padding: 8px 10px; border-radius: 8px; background: var(--code-bg); font-family: var(--code-font); font-size: 12px; color: var(--text); overflow-x: auto; white-space: nowrap; text-align: left; }
.mk-conn { display: grid; grid-template-columns: 10px minmax(90px, auto) minmax(0, 1fr) auto; align-items: center; gap: 4px 10px; padding: 8px 0; border-top: 1px solid var(--line-soft); font-size: var(--t-sm); }
.mk-conn code { grid-column: 2 / -1; font-family: var(--code-font); font-size: 11.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.mk-scope { color: var(--text-3); font-size: var(--t-xs); }
.mk-state { font-size: var(--t-xs); color: var(--text-2); }
.mk-dot { width: 8px; height: 8px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--text-3); }
.mk-dot.on { background: var(--ok); box-shadow: none; }
@media (max-width: 720px) {
  .market-inner { padding: 12px 12px 48px; gap: 10px; }
  .mk-grid { grid-template-columns: minmax(0, 1fr); }
  .media-thumb, .mt-box { width: 150px; }
  .mt-box { height: 106px; }
}
.ac-bar { height: 6px; inset-inline: 6px; bottom: 6px; background: rgba(0, 0, 0, .6); box-shadow: 0 0 0 1px rgba(255, 255, 255, .15); }
.ac-bar i { background: #fff; }
.ac-pct { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 13px; font-weight: 700; text-shadow: 0 1px 3px rgba(0, 0, 0, .8); pointer-events: none; }
.attach-chip.loading .mt-play { display: none; }
.attach-chip.loading img, .attach-chip.loading video { opacity: .4; }
.srow-cache.cold { color: color-mix(in srgb, var(--info) 70%, var(--text-3)); }
/* the three market entries sit side by side in one row (owner, 2026-09-24) */
.nav-rows { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding: 0 4px 12px; }
.nav-row {
  justify-content: center; gap: 6px; height: 36px; padding: 0 6px;
  border: 1px solid var(--line); background: var(--surf); color: var(--text); font-size: var(--t-sm);
}
.nav-row:hover { background: var(--surf-2); }
.nav-row.on { border-color: var(--accent-line); background: var(--accent-soft); }
.nav-label { flex: none; white-space: nowrap; }
.nav-ico { width: 16px; height: 16px; }
.nav-ico svg { width: 15px; height: 15px; }
.nav-meta { display: none; }
.keystrip .k.armed { background: var(--bad); color: #fff; border-color: transparent; font-family: var(--ui-font); }
/* checkup 2026-09-24 */
.health-item .warn { color: var(--warn); font-weight: 700; }
.leftover { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; margin-bottom: 6px; padding: 8px 12px; border-radius: 12px; background: color-mix(in srgb, var(--warn) 9%, var(--surf)); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); font-size: var(--t-sm); }
.leftover.suggest { background: color-mix(in srgb, var(--accent, #7c6cff) 9%, var(--surf)); border-color: color-mix(in srgb, var(--accent, #7c6cff) 30%, transparent); }
.lo-label { grid-column: 1 / -1; color: var(--warn); font-size: var(--t-xs); }
.lo-text { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lo-actions { display: flex; gap: 6px; }
/* unread: the answer finished after you last looked */
.srow-new { flex: none; margin-inline-start: 6px; height: 17px; padding: 0 7px; display: inline-grid; place-items: center; border-radius: 999px; background: var(--accent-fill); color: #fff; font-size: 10.5px; font-weight: 600; }
.srow.unread .srow-name { color: var(--text); }

/* ------------------------------------------- v13 background (owner, 2026-09-24) --
   The SYC logo behind the chat and a deep navy instead of near-black, in Codex Web's language:
   a faint violet glow from the top, a 48-px grid that fades out, the logo softly masked. */
:root:not([data-theme="light"]) {
  --bg: #0a0f1b;
  --side: #080c16;
  --surf: #111829;
  --surf-2: #172036;
  --surf-3: #1f2942;
  --line: #243049;
  --line-soft: rgba(255, 255, 255, .065);
  --code-bg: #070b13;
  --term-bg: #060910;
}
:root:not([data-theme="light"]) body {
  background:
    radial-gradient(circle at 50% -20%, rgba(84, 75, 170, .22), transparent 42%),
    linear-gradient(145deg, #070b13 0%, #0a0f1b 55%, #070b13 100%);
}
:root:not([data-theme="light"]) body::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, .014) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .014) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, .75), transparent 86%);
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, .75), transparent 86%);
}
.app, .login { z-index: 1; }
:root:not([data-theme="light"]) .main { background: transparent; }
:root:not([data-theme="light"]) .sidebar { background: rgba(8, 12, 22, .84); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.watermark img { display: none; }
.watermark {
  inset: 8% 6%;
  background: url("/syc-logo.webp") center / min(62%, 520px) no-repeat;
  opacity: .09;
  -webkit-mask-image: radial-gradient(ellipse 72% 68% at center, #000 42%, transparent 100%);
  mask-image: radial-gradient(ellipse 72% 68% at center, #000 42%, transparent 100%);
}
:root[data-theme="light"] .watermark { opacity: .06; }
.login::before, .admin-scroll::before { background-image: url("/syc-logo.webp"); opacity: .07; -webkit-mask-image: radial-gradient(ellipse 60% 55% at center, #000 40%, transparent 100%); mask-image: radial-gradient(ellipse 60% 55% at center, #000 40%, transparent 100%); }
.empty-logo { width: 112px; height: 112px; border-radius: 28px; box-shadow: 0 10px 40px rgba(90, 80, 220, .25); }
@media (max-width: 720px) { .watermark { inset: 16% 2%; background-size: min(82%, 340px); opacity: .08; } }
/* phone (Mas app) tab */
.phone-box { display: grid; gap: 14px; }
.phone-dl { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.phone-dl a { text-decoration: none; }
.phone-sha { font-family: var(--code-font); font-size: 11.5px; color: var(--text-3); }
.phone-steps { margin: 0; padding-inline-start: 20px; display: grid; gap: 6px; font-size: var(--t-sm); line-height: 1.8; color: var(--text-2); }
.phone-state { display: grid; gap: 8px; padding: 12px 14px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line-soft); font-size: var(--t-sm); }
.phone-state b.on { color: var(--ok); }
.phone-state b.off { color: var(--text-3); }
.phone-perms { display: flex; flex-wrap: wrap; gap: 6px; }
.pp { height: 24px; padding: 0 10px; display: inline-grid; place-items: center; border-radius: 999px; background: var(--surf-2); font-size: var(--t-xs); color: var(--text-2); }
.pp.off { color: var(--text-3); }
.pp.full { color: var(--ok); }
.phone-log { display: grid; gap: 4px; }
.phone-log h4 { margin: 0 0 4px; font-size: var(--t-ui); }
.pl-row { font-size: var(--t-xs); color: var(--text-2); padding: 5px 0; border-top: 1px solid var(--line-soft); }
/* live preview of the text Claude is writing (from its terminal, before the transcript has it) */
.live-box { margin: 4px 0 8px; padding: 10px 14px; border-inline-start: 2px solid var(--accent-line); border-radius: 4px 12px 12px 4px; background: color-mix(in srgb, var(--accent) 5%, transparent); animation: rise .15s ease-out both; }
.live-label { font-size: var(--t-xs); color: var(--accent); margin-bottom: 4px; }
.live-label::after { content: ""; display: inline-block; width: 6px; height: 6px; margin-inline-start: 6px; border-radius: 50%; background: var(--accent); animation: pulse 1s ease-in-out infinite; vertical-align: middle; }
.live-md { opacity: .9; }
.tier-h { margin-top: 4px; font-size: var(--t-xs); font-weight: 600; }
.tier-h.normal { color: var(--ok); }
.tier-h.important { color: var(--warn); }
.tier-h.danger { color: var(--bad); }

/* «فوری برسان» on a message waiting in Claude's queue (2026-09-24). */
.meta button.deliver-now { margin-inline-start: 8px; padding: 2px 10px; border: 1px solid var(--accent, #8b7cf6); border-radius: 999px; color: var(--accent, #8b7cf6); font-size: 11.5px; }
.meta button.deliver-now:disabled { opacity: .5; }

/* Per-session extras (2026-09-24) */
.ctl-extras .extras-btn { border: 1px solid var(--line, #2a3350); background: rgba(139,124,246,.1); color: var(--text, #e8ebf5); border-radius: 999px; padding: 4px 12px; font: inherit; font-size: 12.5px; cursor: pointer; }
.extras-list .extras-group { margin: 14px 0 4px; font-weight: 800; font-size: 13px; color: var(--accent, #8b7cf6); }
.extras-list .extras-row, .cloud-access.extras-row { display: flex; align-items: center; gap: 10px; padding: 7px 2px; border-bottom: 1px solid var(--line, #2a3350); cursor: pointer; }
.extras-row input[type=checkbox], .extras-row input[type=radio] { flex: none; margin: 0; width: 18px; height: 18px; accent-color: var(--accent, #8b7cf6); }
.extras-list .extras-st { margin-inline-start: auto; font-style: normal; font-size: 11.5px; color: var(--text-3, #8e97b3); }
.extras-list .extras-st.connected { color: #48d7a8; }
.extras-list .extras-st.needs-auth, .extras-list .extras-st.failed { color: #e0a838; }
.extras-dialog .extras-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

/* A message Claude took in mid-work (queued_command) — 2026-09-25 */
.meta .mid-mark { margin-inline-start: 8px; color: #48d7a8; font-size: 11.5px; }

/* Progress updates Claude writes between two steps (Opus 5.5) — 2026-09-25 */
.md-wrap.progress-note { border-inline-start: 2px solid rgba(139, 124, 246, .45); padding-inline-start: 10px; margin-block: 6px; opacity: .92; }
.md-wrap.progress-note .md { font-size: .95em; }
.md-wrap.progress-note .progress-tag { font-size: 11px; color: var(--text-3, #8e97b3); margin-bottom: 2px; }

/* Tool cards: long unbreakable lines (heredocs, paths, command output) grew the
   grid track past the chat, so in RTL the card spilled off the left edge and the
   start of each line was cut (SkyrimRoom3, 2026-09-25). Grid tracks may now
   shrink below their content, and code wraps inside its own box. */
.wg-body, .tools, .tool-body { grid-template-columns: minmax(0, 1fr); min-width: 0; max-width: 100%; }
.wg-body > *, .tools > *, .tool-body > *, details.tool, details.workgroup { min-width: 0; max-width: 100%; }
.tool-body pre.io { max-width: 100%; overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }
.tool-body pre.io code { white-space: inherit; overflow-wrap: inherit; word-break: inherit; }

/* sub-agents under their session */
.srow-agents { list-style: none; margin: -2px 0 4px; padding: 0; }
.srow-agents ul { list-style: none; margin: 0; padding: 0 0 0 0; margin-inline-start: 18px; border-inline-start: 1.5px solid var(--surf-3, #333); }
.agrow { display: flex; align-items: center; gap: 6px; min-width: 0; padding: 3px 8px; font-size: var(--t-xs); color: var(--text-3); white-space: nowrap; }
.agrow-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--text-2, inherit); }
.agrow-meta { flex: none; }
.agrow-cost { flex: none; direction: ltr; }
.agrow.ag-run .agrow-meta { color: var(--accent); }
.agrow.ag-cut .agrow-meta { color: var(--warn); }
.agrow.ag-done, .agrow.ag-cut { opacity: .75; }

/* credit (cloud) sessions and the x+y cost */
.cost-credit { color: #fff; font-weight: 700; }
:root[data-theme="light"] .cost-credit { color: var(--text); }
.cost-usage { color: inherit; }
.tag-cloud { background: rgba(255,255,255,.12); color: #fff; font-weight: 600; }
:root[data-theme="light"] .tag-cloud { background: var(--surf-3); color: var(--text); }
.q-credit b { color: #fff; }
.kind-dot.cloud { background: #fff; }
.agrow-plus { flex: none; width: 18px; height: 18px; line-height: 16px; padding: 0; border-radius: 50%; border: 1px solid var(--line-soft, #444); background: transparent; color: var(--text-2, #ccc); font-size: 13px; cursor: pointer; }
.agrow-plus:hover { background: var(--surf-3, #333); color: var(--text); }
dialog.agents-sheet { width: min(760px, 100vw); max-width: 100vw; height: 50vh; max-height: 50vh; margin: auto 0 0 auto; margin-inline: auto; bottom: 0; top: auto; border-radius: 14px 14px 0 0; padding: 0; display: flex; flex-direction: column; }
dialog.agents-sheet:not([open]) { display: none; }
.agents-body { overflow: auto; padding: 8px 14px 16px; flex: 1; }
.ag-card { border-bottom: 1px solid var(--line-soft, #333); padding: 6px 0; }
.ag-card summary { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: var(--t-ui); list-style: none; }
.ag-card summary b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.ag-card h5 { margin: 8px 0 4px; font-size: var(--t-xs); color: var(--text-3); }
.ag-text { white-space: pre-wrap; word-break: break-word; max-height: 220px; overflow: auto; font-size: 12px; background: var(--surf, #1a1a1a); padding: 8px; border-radius: 8px; margin: 0; direction: auto; }
.ag-card.ag-run summary .agrow-meta { color: var(--accent); }
.ctl-extras { display: flex; align-items: center; gap: 6px; }
.acct-pick { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line, #2a3350); border-radius: 999px; padding: 2px 4px 2px 10px; font-size: 11.5px; color: var(--text-3, #8e97b3); white-space: nowrap; }
.acct-pick select { border: 0; background: transparent; color: var(--text, #e8ebf5); font: inherit; font-size: 12px; font-weight: 600; padding: 2px 2px; max-width: 92px; cursor: pointer; direction: ltr; }
.acct-pick select option { background: var(--surf, #1a1a1a); color: var(--text, #e8ebf5); }
.acct-pick.on { border-color: var(--accent-line, #8b7cf6); background: rgba(139,124,246,.1); }
.acct-pick.on span::before { content: '● '; color: var(--ok); }
.acct-pick.pend { border-color: var(--warn); }
.acct-pick.pend span::before { color: var(--warn); }
/* phones: columns keep their content-measured widths (set inline by renderTable, capped at 80vw)
   and the table scrolls sideways instead of squeezing every column into the screen */
@media (max-width: 760px) {
  .md table.md-table th, .md table.md-table td { padding: 7px 9px; }
  .md table.md-table code { white-space: normal; overflow-wrap: anywhere; word-break: break-word; }
}
/* the phone tab (Mas app 2.0) */
.phone-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.phone-chip { font-size: 11.5px; padding: 3px 9px; border-radius: 99px; background: var(--surface-2, #1c1c21); border: 1px solid var(--line-soft); color: var(--text-2); }
.phone-chip.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.phone-chip.warn { color: var(--warn, #e3aa3c); border-color: color-mix(in srgb, var(--warn, #e3aa3c) 40%, transparent); }
.phone-meta { color: var(--text-3); font-size: 12px; }
.phone-upd { font-size: 12px; color: var(--warn, #e3aa3c); }
.phone-live { display: grid; gap: 10px; padding: 12px; border-radius: 14px; border: 1px solid color-mix(in srgb, var(--bad, #ef6b6b) 45%, transparent); background: var(--bg); }
.phone-live-h { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.phone-live-h b { color: var(--bad, #ef6b6b); }
.phone-live-h .btn-sm, .phone-live-h button { margin-inline-start: auto; }
.phone-live-img { max-width: min(100%, 340px); max-height: 70vh; border-radius: 12px; border: 1px solid var(--line-soft); justify-self: center; background: #000; }
.phone-thumbs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.phone-thumb img { width: 72px; height: 72px; object-fit: cover; border-radius: 9px; border: 1px solid var(--line-soft); display: block; }
.pl-item { padding: 6px 0; border-bottom: 1px solid var(--line-soft); }
.pl-item:last-child { border-bottom: 0; }
.pl-answer { color: var(--ok); font-size: 12.5px; margin-top: 3px; }
.pl-file { display: inline-block; font-size: 12px; margin-top: 4px; margin-inline-end: 8px; }

/* ---- Settings → API (api keys) ---- */
.api-base { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: var(--t-sm); color: var(--text-2); }
.api-base code, .api-prefix { padding: 3px 8px; border-radius: 7px; background: var(--code-bg); color: var(--text); font-family: var(--code-font); font-size: 12.5px; }
.api-key { border-inline-start: 3px solid var(--ok); }
.api-key.expired { border-inline-start-color: var(--warn); opacity: .82; }
.api-key.revoked { border-inline-start-color: var(--bad); opacity: .7; }
.api-key-h { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.api-key-h b { font-size: var(--t-h3); }
.api-st { padding: 2px 9px; border-radius: 99px; font-size: 12px; background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.api-st.expired { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.api-st.revoked { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); }
.api-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: var(--t-sm); color: var(--text-2); }
.api-meta .warn { color: var(--warn); font-weight: 600; }
.api-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.api-chip { padding: 3px 9px; border-radius: 99px; font-size: 12px; background: var(--accent-soft); color: var(--text); border: 1px solid var(--accent-line); }
.api-chip.read { background: color-mix(in srgb, var(--info) 12%, transparent); border-color: color-mix(in srgb, var(--info) 40%, transparent); }
.api-chip.danger { background: color-mix(in srgb, var(--bad) 12%, transparent); border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.api-sum { padding: 10px 12px; border-radius: 10px; background: var(--surf-2); font-size: var(--t-sm); }
.api-sec { margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--line-soft); font-weight: 650; }
.api-scopes { display: grid; gap: 6px; }
.api-scope { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; padding: 10px 12px; border-radius: 10px; background: var(--surf-2); border: 1px solid transparent; }
.api-scope.on { border-color: var(--accent-line); }
.api-scope.danger.on { border-color: color-mix(in srgb, var(--bad) 55%, transparent); }
.api-scope-t { display: grid; gap: 2px; flex: 1 1 260px; min-width: 0; }
.api-scope-t b { font-size: var(--t-ui); }
.api-scope-t small { color: var(--text-2); font-size: 12.5px; line-height: 1.7; }
.api-flag { justify-self: start; padding: 0 7px; border-radius: 6px; font-size: 11px; color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); }
.api-seg { flex: none; }
.api-seg button.on { background: var(--accent-fill); color: #fff; }
.api-scope.danger .api-seg button.on:not(:first-child) { background: var(--bad); }
.api-never { padding: 10px 12px; border-radius: 10px; border: 1px dashed var(--line); font-size: var(--t-sm); color: var(--text-2); }
.api-never ul { margin: 6px 0 0; padding-inline-start: 18px; line-height: 1.8; }
.api-pick { display: flex; flex-wrap: wrap; gap: 8px 16px; padding: 10px 12px; border-radius: 10px; background: var(--surf-2); max-height: 200px; overflow: auto; }
.api-sudo { display: grid; gap: 8px; padding: 12px; border-radius: 10px; background: color-mix(in srgb, var(--warn) 8%, transparent); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); }
dialog.api-secret { width: min(620px, calc(100vw - 24px)); }
.api-warn { margin: 0; padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--warn) 12%, transparent); color: var(--text); font-size: var(--t-sm); line-height: 1.8; }
.api-secret-code { display: block; padding: 12px 14px; border-radius: 10px; background: var(--code-bg); color: var(--ok); font-family: var(--code-font); font-size: 13.5px; word-break: break-all; user-select: all; }
.tbl td.ok { color: var(--ok); }
.tbl td.bad { color: var(--bad); }
.tbl td.ltr { direction: ltr; text-align: left; font-family: var(--code-font); font-size: 12px; }
@media (max-width: 640px) { .api-seg { width: 100%; } .api-seg button { flex: 1; padding: 0 6px; } }
.create-extras { margin-top: 10px; border: 1px solid var(--line-soft); border-radius: 12px; }
.create-extras > summary { padding: 8px 12px; cursor: pointer; font-size: var(--t-sm); color: var(--text-2); }
.create-extras .extras-list { padding: 0 12px 10px; max-height: 44vh; overflow: auto; }
.extras-row small.hint { font-size: 11.5px; color: var(--text-3); }
.extras-row > span { flex: 1; min-width: 0; line-height: 1.6; }
.cloud-access.extras-row { margin-top: 10px; border-bottom: 0; }

.md a.dl-file { text-decoration: none; cursor: pointer; white-space: nowrap; } .md a.dl-file code { border-color: var(--accent-line); } .md a.dl-file:active code { filter: brightness(1.3); }

#input.has-suggest::placeholder { opacity: .55; font-style: italic; }

.msg-tools { display: flex; gap: 6px; margin-bottom: 4px; }
.msg-tools button { width: 28px; height: 26px; display: grid; place-items: center; padding: 0; border: 1px solid var(--line-soft); border-radius: 8px; background: transparent; color: var(--text-2); cursor: pointer; }
.msg-tools button:hover { background: var(--surf); color: var(--text); }

/* credit session: GitHub repo + branch picker (same choices as claude.ai/code) */
.cloud-repos { margin-top: 8px; }
.cloud-repo-list { max-height: 34vh; overflow: auto; border: 1px solid var(--line-soft); border-radius: 12px; padding: 4px 8px; margin-top: 6px; }
.cloud-repo { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 0; border-bottom: 1px solid var(--line-soft); }
.cloud-repo:last-child { border-bottom: 0; }
.cloud-repo-name { direction: ltr; font-family: ui-monospace, monospace; font-size: var(--t-sm); }
.cloud-repo select.inp { width: auto; min-width: 140px; margin-inline-start: auto; direction: ltr; }

/* ---------------------------------------- Codex sessions inside Mas (2026-09-29, TwoMas) -- */
/* 6-column grid: market pills 2 each, the «سشن کدکس» row full width («مغز» removed 2026-10-01) */
.nav-rows { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.nav-row { grid-column: span 2; }
.nav-row.nav-codex, .nav-row.nav-extras { grid-column: span 3; }
.nav-row.nav-extras .nav-ico { color: var(--accent); }
.nav-row.nav-codex { position: relative; }
.nav-row.nav-codex .nav-ico { color: #10a37f; }
.list-toggles { flex-wrap: wrap; }
.lt.lt-cx { gap: 5px; }
.lt.lt-cx b { direction: ltr; unicode-bidi: isolate; }
.lt.lt-cx.low b { color: var(--warn); }
.lt.lt-cx.out b { color: var(--danger, #e5484d); }
.tag.tag-cx { background: color-mix(in srgb, #10a37f 18%, transparent); color: #3ecf9e; border-color: color-mix(in srgb, #10a37f 40%, transparent); }
.cx-accts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 4px 0 10px; }
.cx-acct { display: grid; gap: 4px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surf); cursor: pointer; text-align: start; color: var(--text); }
.cx-acct:hover { background: var(--surf-2); }
.cx-acct.on { border-color: #10a37f; box-shadow: 0 0 0 1px #10a37f inset; background: color-mix(in srgb, #10a37f 10%, var(--surf)); }
.cx-acct.dead { opacity: .72; }
.cx-acct .cx-h { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-weight: 600; }
.cx-acct .cx-mail { color: var(--text-3); font-size: var(--t-xs); direction: ltr; text-align: start; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cx-acct .cx-l { display: flex; justify-content: space-between; font-size: var(--t-sm); color: var(--text-2); }
.cx-acct .cx-l b { color: var(--text); }
.cx-acct .cx-bar { height: 5px; border-radius: 99px; background: var(--surf-2); overflow: hidden; }
.cx-acct .cx-bar i { display: block; height: 100%; background: #10a37f; }
.cx-acct .cx-bar i.low { background: var(--warn); }
.cx-acct .cx-bar i.out { background: var(--danger, #e5484d); }
.cx-acct small { color: var(--text-3); font-size: 11px; }
.cx-quota-dlg { max-width: 560px; width: calc(100vw - 32px); }
@media (max-width: 420px) { .cx-accts { grid-template-columns: minmax(0, 1fr); } }

/* session heat: the name's colour = memory re-read on every call (owner, 2026-09-29) */
.srow.heat-1 .srow-name, .srow.muted.heat-1 .srow-name { color: #f5c542; }
.srow.heat-2 .srow-name, .srow.muted.heat-2 .srow-name { color: #ff5a5f; }
.srow.heat-3 .srow-name, .srow.muted.heat-3 .srow-name { color: #c07bff; }
.srow.muted.heat-1 .srow-name, .srow.muted.heat-2 .srow-name, .srow.muted.heat-3 .srow-name { opacity: .75; }
/* owner 2026-09-30: the extra-burn percent beside the name replaces the colours */
.srow-pct { flex: none; margin: 0 8px 0 0; /* physical: the span is ltr and sits left of the name */ font-size: 11px; font-weight: 500; color: var(--text-3); direction: ltr; unicode-bidi: isolate; white-space: nowrap; }

/* compaction «here» (2026-09-30): chips while typing /compact, and the 4-level chooser */
.compact-chips { align-items: center; }
.compact-chips-lbl { flex: none; font-size: var(--t-sm); color: var(--text-3); }
.compact-chips button { border-color: var(--accent-line); }
dialog.handoff.compact-pick { width: min(560px, calc(100vw - 24px)); }

/* rows are re-used and re-ordered in place: the browser's scroll anchoring slid the list to the bottom (2026-09-30) */
#sessionList, #sessionList li { overflow-anchor: none; }

/* «مانده» in the quota table = the way into the usage page */
#quotaRows .q-more { padding: 0 2px 4px; }
#quotaRows .q-more button { border: 1px solid var(--accent-line, #8b7cf6); background: rgba(139,124,246,.12); color: var(--text); border-radius: 8px; font: inherit; font-size: 11.5px; font-weight: 700; padding: 3px 9px; cursor: pointer; min-height: 26px; }
#quotaRows .q-more button:hover { background: rgba(139,124,246,.22); }

/* the usage page (2026-10-01) */
dialog.usage-page { width: min(860px, calc(100vw - 16px)); max-height: 92dvh; overflow: auto; padding: 14px 16px 18px; border-radius: var(--r-card); background: var(--surf); color: var(--text); border: 1px solid var(--line); }
.usage-page .up-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.usage-page .up-head h3 { margin: 0; font-size: 16px; }
.usage-page .up-x { width: 34px; height: 34px; border: 0; border-radius: 50%; background: var(--surf-2); color: var(--text-2); font-size: 22px; line-height: 1; cursor: pointer; }
.usage-page .up-sub { margin: 18px 0 8px; font-size: 13px; color: var(--text-2); }
.up-scroll { overflow-x: auto; border: 1px solid var(--line-soft); border-radius: 12px; }
.up-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }

.up-table th { position: sticky; top: 0; background: var(--surf-2); color: var(--text-2); font-weight: 600; font-size: 11.5px; padding: 9px 8px; text-align: center; white-space: nowrap; border-bottom: 1px solid var(--line); }
.up-table th.sort { cursor: pointer; user-select: none; }
.up-table th.sort:hover { color: var(--text); }
.up-table th.on { color: var(--accent, #8b7cf6); }
.up-table th.on::after { content: attr(data-dir); font-size: 9px; margin-inline-start: 4px; }
.up-table td { padding: 8px; text-align: center; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
.up-table tbody tr:last-child td { border-bottom: 0; }
.up-table tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--surf-2) 45%, transparent); }
.up-table td.num { font-variant-numeric: tabular-nums; }
.up-table td.tok { direction: ltr; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.up-table td.usd { font-weight: 700; }
.up-table td.dim { color: var(--text-3); }
.up-table td.date { color: var(--text-2); }
.up-table tr.off td { opacity: .5; }
.up-name { display: grid; justify-items: center; gap: 2px; }
.up-name input { width: 110px; text-align: center; font: inherit; font-weight: 700; font-size: 13px; color: var(--text); background: transparent; border: 1px dashed var(--line); border-radius: 8px; padding: 3px 6px; }
.up-name input:focus { outline: none; border-style: solid; border-color: var(--accent, #8b7cf6); }
.up-name small { font-size: 10px; color: var(--text-3); direction: ltr; }

/* session account button + sheet (2026-10-01 rebuild) */
.ctl-extras .acct-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; direction: ltr; unicode-bidi: isolate; font-weight: 600; }
.ctl-extras .acct-btn small { font-weight: 500; color: var(--text-3); font-size: 11px; }
.acct-btn .acct-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex: none; }
.ctl-extras .acct-btn.pend { border-color: var(--warn); }
.acct-btn.pend .acct-dot { background: var(--warn); animation: pulse 1.3s ease-in-out infinite; }
dialog.acct-sheet { width: min(520px, calc(100vw - 16px)); max-height: 90dvh; overflow: auto; padding: 0; border-radius: var(--r-card); background: var(--surf); color: var(--text); border: 1px solid var(--line); }
@media (max-width: 760px) { dialog.acct-sheet { margin: auto auto 0; width: 100vw; max-width: 100vw; border-radius: 18px 18px 0 0; } }
.acct-sheet .as-body { padding: 14px 16px 18px; display: grid; gap: 10px; }
.acct-sheet .as-head { display: flex; align-items: center; justify-content: space-between; }
.acct-sheet .as-head h3 { margin: 0; font-size: 15px; }
.acct-sheet .up-x { width: 34px; height: 34px; border: 0; border-radius: 50%; background: var(--surf-2); color: var(--text-2); font-size: 22px; line-height: 1; cursor: pointer; }
.as-state { display: grid; gap: 8px; padding: 10px 12px; border-radius: 12px; background: var(--surf-2); font-size: 13px; line-height: 1.6; border: 1px solid var(--line-soft); }
.as-state.pend { border-color: var(--warn); }
.as-now { justify-self: start; border: 0; border-radius: 10px; background: var(--warn); color: #111; font: inherit; font-weight: 700; font-size: 13px; padding: 8px 14px; min-height: 40px; cursor: pointer; }
.as-sub { margin: 6px 0 0; font-size: 12.5px; color: var(--text-2); font-weight: 600; }
.as-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px; }
.as-card { position: relative; display: grid; gap: 8px; text-align: start; min-height: 64px; padding: 11px 12px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surf-2); color: var(--text); font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: border-color .12s, background .12s; }
.as-card:hover { border-color: var(--accent-line, #8b7cf6); }
.as-card.on { border-color: var(--accent, #8b7cf6); background: rgba(139,124,246,.13); }
.as-card:disabled { opacity: .6; cursor: progress; }
.as-card.empty { align-content: center; }
.as-card .as-top { display: grid; gap: 1px; padding-inline-end: 24px; }
.as-card b { font-size: 14px; direction: ltr; unicode-bidi: isolate; text-align: start; }
.as-card small { font-size: 10.5px; color: var(--text-3); direction: ltr; unicode-bidi: isolate; text-align: start; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.as-card.empty b { direction: rtl; }
.as-card.empty small { direction: rtl; white-space: normal; }
.as-check { position: absolute; top: 9px; inset-inline-end: 10px; width: 20px; height: 20px; border-radius: 50%; background: var(--accent, #8b7cf6); color: #fff; font-size: 12px; display: grid; place-items: center; }
.as-bars { display: grid; gap: 5px; }
.as-bar { display: grid; grid-template-columns: 48px 1fr 34px; align-items: center; gap: 6px; font-size: 10.5px; color: var(--text-3); }
.as-bar i { height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--q-c, var(--ok)) calc(var(--p, 0) * 1%), var(--surf-3) 0); transform: scaleX(-1); }
.as-bar em { font-style: normal; font-weight: 700; color: var(--text); text-align: end; font-variant-numeric: tabular-nums; }
.as-bar[data-level="low"] { --q-c: var(--warn); }
.as-bar[data-level="out"] { --q-c: var(--bad); }

/* «اضافات» chapters (2026-10-01, session Owow): one collapsible section per kind, active count in the title */
.extras-list .xch { border: 1px solid var(--line-soft); border-radius: 12px; margin: 8px 0; background: var(--surf); }
.extras-list .xch > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; padding: 10px 12px; font-weight: 700; font-size: 13.5px; }
.extras-list .xch > summary::-webkit-details-marker { display: none; }
.extras-list .xch > summary::after { content: "▾"; margin-inline-start: auto; color: var(--text-3); transition: transform .15s; }
.extras-list .xch:not([open]) > summary::after { transform: rotate(90deg); }
.extras-list .xch > summary .xn { color: var(--accent); font-weight: 600; }
.extras-list .xch > summary .xn.zero { color: var(--text-3); }
.extras-list .xch-body { padding: 0 12px 8px; }
.extras-list .xch-body .extras-group { margin: 8px 0 2px; font-size: 12px; }
.extras-cost { margin: 6px 0 10px; padding: 10px 12px; border-radius: 12px; background: var(--bg); border: 1px dashed var(--line-soft); font-size: 13px; line-height: 1.8; }
.extras-cost b { color: var(--accent); font-size: 15px; }
.extras-cost ul { margin: 4px 0 0; padding-inline-start: 18px; font-size: 12px; color: var(--text-2); }
.extras-cost .xc-act { margin-inline-start: 8px; font-size: 12px; }

/* ---- SYC Mas Free additions ---- */
.add-plus { border-radius: 50%; background: var(--ok); color: #07140d; font-weight: 700; font-size: 16px; }
.add-plus:hover, .add-plus.on { background: color-mix(in srgb, var(--ok) 85%, #fff); color: #07140d; }
.engine-note { margin: 2px 4px 8px; padding: 8px 10px; border-radius: 10px; font-size: var(--t-xs); line-height: 1.8;
  color: var(--text-2); background: rgba(234, 179, 8, .08); border: 1px dashed rgba(234, 179, 8, .45); }
.engine-notice { align-self: center; display: flex; gap: 10px; align-items: flex-start; max-width: min(560px, 94%);
  padding: 10px 14px; border-radius: 12px; background: rgba(234, 179, 8, .09); border: 1px solid rgba(234, 179, 8, .45);
  color: var(--text); font-size: var(--t-sm); line-height: 1.9; white-space: pre-wrap; }
.engine-notice .en-ico { flex: none; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  background: rgba(234, 179, 8, .9); color: #111; font-weight: 800; font-size: 13px; margin-top: 2px; }
