/* Bidroom — AI pre-sales. Vanilla CSS, logical properties for RTL, tokens on :root. */
:root {
  --sb: #0b3b2c; --sb-2: #0f4a37; --sb-3: #155e46; --sb-ink: #e6f4ee; --sb-muted: #a7cbbd; --sb-line: rgba(255,255,255,.1);
  --accent: #047857; --accent-2: #059669; --accent-soft: #e3f4ec; --accent-ink: #065f46; --mint: #34d399;
  --bg: #f3f5f4; --card: #ffffff; --ink: #0f172a; --ink-2: #334155; --muted: #586474; --line: #e2e8e5; --line-2: #eef2f0;
  --hover: #f1f5f3; --focus: #2563eb;
  --red: #b91c1c; --red-soft: #fdecec; --amber: #92400e; --amber-soft: #fef3c7; --green: #15803d; --green-soft: #e3f5e9;
  --blue: #1d4ed8; --blue-soft: #e5edff; --slate: #475569; --slate-soft: #eef1f5; --teal: #0f766e; --teal-soft: #ddf3f0;
  --r: 10px; --r-sm: 7px; --sh: 0 1px 2px rgba(15,23,42,.06), 0 1px 1px rgba(15,23,42,.03); --sh-lg: 0 18px 50px rgba(15,23,42,.22);
  --font: "Cairo", system-ui, sans-serif;
  --font-ar: "Cairo", system-ui, sans-serif;
  --sbw: 300px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
html[lang="ar"] body { font-family: var(--font-ar); }
:lang(ar), [dir="rtl"] { font-family: var(--font-ar); }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h2 { font-size: 15px; } h3 { font-size: 14px; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .86em; background: var(--line-2); padding: .05em .35em; border-radius: 4px; }
pre { white-space: pre-wrap; word-break: break-word; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); } .small { font-size: 13px; } .tiny { font-size: 12px; } .pad { padding: 12px; }
.late, .err { color: var(--red); }
[dir="rtl"] .flip-rtl { transform: scaleX(-1); }
.skip { position: absolute; inset-inline-start: 8px; top: -40px; background: var(--card); padding: 8px 12px; border-radius: 6px; z-index: 100; }
.skip:focus { top: 8px; }

/* ---------- atoms ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--card); color: var(--ink); padding: 7px 13px; border-radius: var(--r-sm); cursor: pointer; font-weight: 500; text-decoration: none; white-space: nowrap; min-height: 34px; }
.btn:hover { background: var(--hover); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-ink); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-sm { padding: 4px 10px; font-size: 13px; min-height: 30px; }
.btn-block { width: 100%; justify-content: center; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 34px; height: 34px; padding: 0 6px; border: 0; border-radius: var(--r-sm); background: transparent; color: inherit; cursor: pointer; }
.icon-btn:hover { background: var(--hover); }
.icon-btn.sm { min-width: 28px; height: 28px; } .icon-btn.xs { min-width: 20px; height: 22px; padding: 0; font-size: 12px; }
.linkbtn { border: 0; background: none; color: var(--accent); cursor: pointer; padding: 0 2px; font-size: 12px; text-decoration: underline; text-underline-offset: 2px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.6; white-space: nowrap;
  --c: #64748b; color: color-mix(in srgb, var(--c) 78%, #000); background: color-mix(in srgb, var(--c) 13%, #fff); }
.tone-green { --c: #15803d; } .tone-red { --c: #b91c1c; } .tone-amber { --c: #b45309; } .tone-blue { --c: #1d4ed8; } .tone-slate { --c: #64748b; } .tone-teal { --c: #0f766e; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--c); margin-inline-end: 6px; vertical-align: -1px; }
.yes { color: var(--green); font-weight: 700; }
.av { --av: #475569; display: inline-flex; align-items: center; justify-content: center; flex: none; border-radius: 50%; background: var(--av); color: #fff; font-weight: 700; letter-spacing: .02em; user-select: none; font-family: var(--font); }
.av-xs { width: 22px; height: 22px; font-size: 9.5px; } .av-sm { width: 28px; height: 28px; font-size: 11px; } .av-md { width: 36px; height: 36px; font-size: 13px; }
.av-lg { width: 44px; height: 44px; font-size: 15px; } .av-xl { width: 64px; height: 64px; font-size: 22px; }
.av-stack { display: inline-flex; } .av-stack .av { box-shadow: 0 0 0 2px var(--card); } .av-stack .av + .av { margin-inline-start: -6px; }
.av-more { background: #94a3b8; }
.spin, .spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid color-mix(in srgb, currentColor 25%, transparent); border-top-color: currentColor; border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px; flex: none; }
.spin.slow { animation-duration: 2s; opacity: .7; }
.spinner { width: 28px; height: 28px; border-width: 3px; color: var(--accent); }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin, .spinner { animation-duration: 3s; } }
.loading { display: flex; gap: 10px; align-items: center; color: var(--muted); padding: 24px; }
.boot { min-height: 100vh; display: flex; gap: 12px; align-items: center; justify-content: center; color: var(--muted); }
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty-ico { display: inline-flex; padding: 12px; border-radius: 50%; background: var(--line-2); color: var(--muted); }
.empty-ico svg { width: 26px; height: 26px; }
.empty-title { font-weight: 600; color: var(--ink-2); margin: 10px 0 4px; }
.error-box { border: 1px solid #f3c2c2; background: var(--red-soft); color: #7f1d1d; padding: 12px 14px; border-radius: var(--r-sm); margin: 12px 0; }
.error-box p, .error-box pre { margin: 4px 0 8px; }
.form-error { color: var(--red); margin: 4px 0; font-size: 13px; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field input, .field select, .field textarea, .toolbar select, .panel-h select, .panel-h input, .search input {
  border: 1px solid #cfd8d4; border-radius: var(--r-sm); padding: 8px 10px; background: #fff; font-weight: 400; color: var(--ink); min-height: 36px; }
.field input:focus, .field select:focus, .field textarea:focus, textarea:focus, .search input:focus { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); border-color: var(--accent); }
.field.inline { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
.field.inline select { padding: 5px 8px; min-height: 32px; }
.req { color: var(--red); }
.search { position: relative; display: inline-flex; align-items: center; }
.search svg { position: absolute; inset-inline-start: 9px; color: var(--muted); pointer-events: none; }
.search input { padding-inline-start: 32px; min-width: 220px; }

/* ---------- toasts ---------- */
.toasts { position: fixed; bottom: 18px; inset-inline-end: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 300; }
.toast { background: #0f172a; color: #fff; padding: 10px 14px; border-radius: 8px; box-shadow: var(--sh-lg); max-width: 380px; font-size: 13px; transition: opacity .4s, transform .4s; }
.toast-error { background: #991b1b; }
.toast.out { opacity: 0; transform: translateY(8px); }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--bg); }
.login-side { background: radial-gradient(1200px 600px at 10% 10%, #13563f 0%, var(--sb) 55%, #072a1f 100%); color: var(--sb-ink); padding: 56px; display: flex; flex-direction: column; justify-content: space-between; }
.login-pitch { font-size: 26px; font-weight: 600; max-width: 460px; line-height: 1.35; margin: 0 0 40px; }
.login-card { align-self: center; justify-self: center; width: min(400px, calc(100vw - 32px)); background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 28px; display: flex; flex-direction: column; gap: 14px; box-shadow: var(--sh); }
.login-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.login-top h1 { font-size: 19px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-text { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.brand-text strong { font-size: 18px; letter-spacing: -.01em; }
.brand-text span { color: var(--sb-muted); font-size: 13px; }
.brand.big .brand-text strong { font-size: 26px; }

/* ---------- shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: var(--sbw); flex: none; background: var(--sb); color: var(--sb-ink); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.sidebar .brand { padding: 16px 16px 10px; }
.sb-close { display: none; margin-inline-start: auto; color: var(--sb-ink); }
.sb-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 16px; }
.sb-head h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--sb-muted); }
.btn-new { background: var(--mint); border-color: var(--mint); color: #053b2a; font-weight: 700; padding: 5px 10px; min-height: 30px; font-size: 13px; }
.btn-new:hover { background: #6ee7b7; }
.sb-search { margin: 4px 16px 8px; position: relative; display: flex; align-items: center; }
.sb-search svg { position: absolute; inset-inline-start: 10px; color: var(--sb-muted); }
.sb-search input { width: 100%; background: var(--sb-2); border: 1px solid var(--sb-line); color: var(--sb-ink); border-radius: 8px; padding: 8px 10px; padding-inline-start: 34px; min-height: 36px; }
.sb-search input::placeholder { color: var(--sb-muted); }
.seg { display: inline-flex; gap: 2px; padding: 2px; background: var(--line-2); border-radius: 8px; flex-wrap: nowrap; }
.seg.wrap { flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 5px 10px; border-radius: 6px; cursor: pointer; color: var(--ink-2); font-size: 13px; font-weight: 500; white-space: nowrap; min-height: 30px; display: inline-flex; align-items: center; gap: 4px; }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: var(--sh); font-weight: 600; }
.sidebar .seg { margin: 0 16px 8px; background: var(--sb-2); display: flex; }
.sidebar .seg button { flex: 1; color: var(--sb-muted); }
.sidebar .seg button.on { background: var(--sb-3); color: #fff; box-shadow: none; }
.plist { flex: 1; overflow-y: auto; padding: 4px 8px 12px; }
.pitem { display: flex; flex-direction: column; gap: 3px; padding: 10px; border-radius: 9px; color: var(--sb-ink); text-decoration: none; border: 1px solid transparent; margin-bottom: 4px; }
.pitem:hover { background: var(--sb-2); }
.pitem.on { background: var(--sb-3); border-color: rgba(52,211,153,.35); }
.pname { font-weight: 600; font-size: 13.5px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pclient { color: var(--sb-muted); font-size: 12px; }
.pmeta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.pval { font-weight: 700; font-size: 12.5px; color: #fff; }
.sidebar .chip { --c: #6ee7b7; color: #d1fae5; background: rgba(110,231,183,.14); }
.sidebar .chip.tone-blue { --c: #93c5fd; color: #dbeafe; background: rgba(147,197,253,.16); }
.sidebar .chip.tone-red { color: #fecaca; background: rgba(252,165,165,.16); }
.pstat { font-size: 11.5px; color: var(--sb-muted); display: inline-flex; align-items: center; gap: 5px; margin-inline-start: auto; }
.pstat i { width: 7px; height: 7px; border-radius: 50%; background: #6b8f81; }
.pstat.working { color: #a7f3d0; } .pstat.working i { background: var(--mint); box-shadow: 0 0 0 3px rgba(52,211,153,.25); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(52,211,153,0); } }
.sb-empty { color: var(--sb-muted); padding: 12px; font-size: 13px; }
.sb-foot { border-top: 1px solid var(--sb-line); padding: 10px 12px; display: flex; align-items: center; gap: 8px; }
.sb-foot .who { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.sb-foot .who strong { font-size: 13px; } .sb-foot .who span { font-size: 11.5px; color: var(--sb-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-foot .icon-btn { color: var(--sb-ink); } .sb-foot .icon-btn:hover { background: var(--sb-2); }
.lang-lbl { font-size: 12px; font-weight: 700; }
.sidebar .error-box { margin: 8px; }
.scrim { display: none; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; outline: none; }
.topbar { display: flex; align-items: center; gap: 10px; padding: 10px 24px; border-bottom: 1px solid var(--line); background: var(--card); position: sticky; top: 0; z-index: 20; min-height: 50px; }
.menu-btn { display: none; }
.crumbs { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); min-width: 0; }
.crumbs a { color: var(--muted); text-decoration: none; } .crumbs a:hover { color: var(--ink); text-decoration: underline; }
.crumb-cur { color: var(--ink); font-weight: 600; white-space: nowrap; }
.live-dot { margin-inline-start: auto; font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.live-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #94a3b8; }
.live-dot.live::before { background: #16a34a; } .live-dot.polling::before { background: #d97706; } .live-dot.offline::before { background: #dc2626; }
.project { padding: 18px 24px 24px; display: flex; flex-direction: column; gap: 14px; min-width: 0; flex: 1; }

/* ---------- project header ---------- */
.pcard { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; display: flex; gap: 20px; box-shadow: var(--sh); }
.pcard-main { flex: 1; min-width: 0; }
.pcard-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pcode { font-weight: 700; font-size: 12px; letter-spacing: .04em; color: var(--accent-ink); background: var(--accent-soft); padding: 2px 8px; border-radius: 6px; }
.working-badge { display: inline-flex; gap: 6px; align-items: center; color: var(--blue); font-size: 12.5px; font-weight: 600; }
.pclient-lg { margin: 10px 0 2px; font-weight: 600; color: var(--accent-ink); }
.ptitle { font-size: 20px; letter-spacing: -.01em; }
.pfacts { display: flex; gap: 28px; flex-wrap: wrap; margin: 14px 0 0; }
.pfacts div { min-width: 0; }
.pfacts dt { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.pfacts dd { margin: 2px 0 0; font-weight: 600; display: flex; align-items: center; gap: 4px; }
.mailbox code { background: none; padding: 0; font-size: 13px; }
.aiprice { flex: none; width: 250px; border-radius: 12px; padding: 14px 16px; background: linear-gradient(160deg, #0f4a37, #0b3b2c); color: #ecfdf5; display: flex; flex-direction: column; gap: 4px; justify-content: center; }
.aiprice-lbl { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: #a7f3d0; display: inline-flex; gap: 6px; align-items: center; }
.aiprice-val { font-size: 24px; font-weight: 700; letter-spacing: -.01em; }
.aiprice-val small { font-size: 13px; font-weight: 600; color: #a7f3d0; }
.aiprice-sub { font-size: 12.5px; color: #c9eedd; }
.stagebar { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: thin; }
.stagebar li { flex: 1 1 0; min-width: 92px; position: relative; padding-top: 10px; }
.stagebar li::before { content: ""; position: absolute; top: 0; inset-inline: 0; height: 6px; border-radius: 4px; background: #dfe6e2; }
.stagebar li.past::before { background: var(--accent-2); }
.stagebar li.cur::before { background: var(--accent); box-shadow: 0 0 0 3px rgba(4,120,87,.18); }
.stagebar li.cur.lost::before { background: var(--red); } .stagebar li.cur.won::before { background: var(--green); }
.stagebar .dot { display: none; }
.stagebar .lbl { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.stagebar li.cur .lbl { color: var(--ink); font-weight: 700; } .stagebar li.past .lbl { color: var(--ink-2); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; position: sticky; top: 50px; background: var(--bg); z-index: 10; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { padding: 10px 12px; color: var(--ink-2); text-decoration: none; font-weight: 500; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; align-items: center; gap: 6px; }
.tabs a:hover { color: var(--ink); }
.tabs a.on { color: var(--accent-ink); border-bottom-color: var(--accent); font-weight: 700; }
.tcount { font-size: 11px; background: var(--line-2); color: var(--muted); border-radius: 999px; padding: 0 6px; font-weight: 600; }
.tcount:empty { display: none; } .tcount.alert { background: var(--red-soft); color: var(--red); }
.tabpanel { min-width: 0; flex: 1; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.subtabs { display: flex; gap: 4px; margin-bottom: 12px; flex-wrap: wrap; }
.subtabs button { border: 1px solid var(--line); background: var(--card); padding: 6px 12px; border-radius: 999px; cursor: pointer; font-weight: 500; color: var(--ink-2); }
.subtabs button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; margin-bottom: 14px; box-shadow: var(--sh); }
.panel > h2 { margin-bottom: 10px; }
.panel h3 { margin: 16px 0 8px; }
.panel.warn { border-color: #f5d48a; background: #fffbeb; }
.panel-h { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.panel-h h2 { margin-inline-end: auto; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.kpi span { font-size: 12px; color: var(--muted); } .kpi strong { font-size: 18px; }
.kpi.accent { background: var(--accent-soft); border-color: #bfe6d3; } .kpi.accent strong { color: var(--accent-ink); }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px 16px; margin: 8px 0; }
.kv dt { font-size: 11.5px; color: var(--muted); } .kv dd { margin: 0; font-weight: 500; }

/* ---------- tables ---------- */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--card); }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: start; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: #f8faf9; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: #fafcfb; }
.tbl .num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .wide { min-width: 280px; }
.tbl tfoot th, .tbl tfoot td { border-top: 2px solid var(--line); background: #f8faf9; }
.row-late td:first-child { box-shadow: inset 3px 0 0 var(--red); }
[dir="rtl"] .row-late td:first-child { box-shadow: inset -3px 0 0 var(--red); }
.tot-row { display: flex; gap: 24px; justify-content: flex-end; flex-wrap: wrap; padding: 10px 4px 0; font-size: 13px; }

/* compliance */
.cbar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; margin-bottom: 12px; background: var(--line-2); }
.cbar span { background: var(--c); }
.matrix .mcol { text-align: center; width: 44px; padding: 6px 2px; }
.vlabel { display: inline-block; max-width: 70px; white-space: normal; line-height: 1.15; font-size: 10.5px; }
.mcell { text-align: center; }
.mdot { display: inline-block; width: 16px; height: 16px; border-radius: 4px; background: var(--c); }
.matrix tr.cs-non_compliant td { background: #fff7f7; } .matrix tr.cs-partial td { background: #fffcf2; }
.dev { color: var(--red); font-size: 12.5px; margin-bottom: 2px; }

/* tasks board */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.bcol { background: #eaefec; border-radius: var(--r); padding: 10px; min-height: 120px; }
.bcol h3 { font-size: 12.5px; margin: 0 0 8px; display: flex; align-items: center; }
.bcol h3 .muted { margin-inline-start: 6px; }
.bcol-body { display: flex; flex-direction: column; gap: 8px; }
.tcard { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 6px; box-shadow: var(--sh); }
.tcard.overdue { border-color: #f1b4b4; box-shadow: inset 3px 0 0 var(--red), var(--sh); }
[dir="rtl"] .tcard.overdue { box-shadow: inset -3px 0 0 var(--red), var(--sh); }
.tcard-h { display: flex; gap: 6px; align-items: flex-start; justify-content: space-between; font-size: 13px; }
.tcard-f { display: flex; align-items: center; gap: 6px; }
.due { margin-inline-start: auto; font-size: 12px; color: var(--muted); white-space: nowrap; }
.due.late { color: var(--red); font-weight: 700; }
.prio { font-size: 10.5px; font-weight: 700; border-radius: 4px; padding: 0 5px; background: var(--slate-soft); color: var(--slate); }
.prio.p1 { background: var(--red-soft); color: var(--red); } .prio.p2 { background: var(--amber-soft); color: var(--amber); }

/* suppliers */
.approval { border-top: 1px solid #f3e1ae; padding: 10px 0; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.approval:first-of-type { border-top: 0; }
.approval-h { display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; }
.qcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.qcard { border: 1px solid var(--line); border-radius: var(--r); padding: 12px; }
.qcard header { display: flex; justify-content: space-between; gap: 8px; }
.qtotal { display: block; font-size: 19px; margin: 6px 0 2px; }
.cmp td.best { background: var(--green-soft); color: var(--green); font-weight: 700; }

/* pricing */
.bids { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.bids li { display: grid; grid-template-columns: 34px minmax(160px, 1.4fr) 1fr auto; gap: 10px; align-items: center; padding: 7px 8px; border-radius: 8px; }
.bids li:nth-child(odd) { background: #f8faf9; }
.bids li.us { background: var(--accent-soft); outline: 1px solid #bfe6d3; }
.bids li.excl { opacity: .75; }
.bid-rank { font-weight: 700; color: var(--muted); text-align: center; }
.bid-name { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; min-width: 0; }
.bid-bar { height: 8px; background: var(--line-2); border-radius: 4px; overflow: hidden; }
.bid-bar i { display: block; height: 100%; background: #94a3b8; border-radius: 4px; }
.bids li.us .bid-bar i { background: var(--accent-2); } .bids li.win .bid-bar i { background: var(--blue); }
.bid-amt { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* files */
.files { display: grid; grid-template-columns: minmax(300px, 420px) 1fr; gap: 14px; align-items: start; }
.files-left, .files-right { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; box-shadow: var(--sh); }
.files-right { min-height: 300px; position: sticky; top: 104px; max-height: calc(100vh - 120px); overflow: auto; }
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 18px; border: 2px dashed #c6d3cd; border-radius: var(--r); color: var(--ink-2); cursor: pointer; text-align: center; background: #fafcfb; }
.dropzone.sm { padding: 12px; margin-bottom: 10px; flex-direction: row; justify-content: center; }
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone.busy { opacity: .7; pointer-events: none; }
.dropzone:focus-within { outline: 2px solid var(--focus); }
.ftree, .ftree ul { list-style: none; margin: 0; padding: 0; }
.fnode { display: flex; align-items: center; gap: 4px; padding: 3px 4px; padding-inline-start: calc(var(--d) * 16px + 4px); border-radius: 6px; }
.fnode.on { background: var(--accent-soft); }
.fnode:hover { background: var(--hover); }
.tog-sp { width: 20px; flex: none; }
.fname { border: 0; background: none; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; text-align: start; padding: 4px 2px; min-width: 0; flex: 1; color: var(--ink); }
.fname span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fname svg { flex: none; color: var(--muted); }
.fmeta { display: inline-flex; gap: 6px; align-items: center; flex: none; }
.fv-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; border-bottom: 1px solid var(--line); padding-bottom: 10px; margin-bottom: 10px; }
.fv-head h2 { word-break: break-word; }
.fv-actions { display: flex; gap: 8px; align-items: center; }
.digest { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px 14px; margin-bottom: 12px; background: #fbfcfb; display: flex; flex-direction: column; gap: 8px; }
.digest.none { flex-direction: row; justify-content: space-between; align-items: center; }
.dg-top { display: flex; justify-content: space-between; gap: 10px; align-items: center; flex-wrap: wrap; }
.dg-chips { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dg-cov { display: flex; gap: 10px; align-items: center; }
.dg-cov .bar { flex: 1; height: 8px; border-radius: 99px; background: var(--line-2); overflow: hidden; max-width: 360px; }
.dg-cov .bar span { display: block; height: 100%; background: var(--accent-2); border-radius: 99px; }
.dg-warn { background: var(--amber-soft); color: var(--amber); border-radius: 6px; padding: 6px 10px; font-size: 13px; }
.dg-warn .linkbtn { color: var(--amber); font-size: 13px; }
.dg-sum { margin: 0; color: var(--ink-2); line-height: 1.5; }
.dg-counts { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.dg-counts li { border: 1px solid var(--line); border-radius: 99px; padding: 2px 10px; font-size: 13px; background: var(--card); }
.dg-counts a { text-decoration: none; color: var(--accent-ink); }
.dg-outline summary { cursor: pointer; font-size: 13px; color: var(--muted); }
.dg-outline ol { margin: 6px 0 0; padding-inline-start: 22px; font-size: 13px; }
.dg-lowdot { color: var(--amber); font-size: 12px; margin-inline-start: 2px; }
.src-filter { background: var(--accent-soft); color: var(--accent-ink); border-radius: 6px; padding: 6px 10px; margin: 8px 0; display: inline-block; }
.chunk { margin-bottom: 12px; }
.chunk pre { background: #f8faf9; border: 1px solid var(--line-2); padding: 10px; border-radius: 6px; font: 12.5px/1.55 ui-monospace, Menlo, Consolas, monospace; margin: 4px 0 0; }
.filelist { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-direction: column; gap: 4px; }
.filelist li { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.filelist li span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* timeline + activity */
.timeline, .feed { list-style: none; margin: 0; padding: 0; }
.daysep { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; font-weight: 600; margin: 14px 0 8px; }
.daysep::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.tev { display: grid; grid-template-columns: 54px 14px 1fr; gap: 10px; padding: 6px 0; align-items: start; }
.tev time { font-size: 12px; color: var(--muted); text-align: end; padding-top: 2px; font-variant-numeric: tabular-nums; }
.ev-dot { width: 10px; height: 10px; border-radius: 50%; background: #cbd5e1; margin-top: 6px; }
.imp-3 .ev-dot { background: #60a5fa; } .imp-4 .ev-dot { background: var(--accent-2); } .imp-5 .ev-dot { background: #f59e0b; box-shadow: 0 0 0 3px #fde68a; }
.imp-4 > div, .imp-5 > div { font-weight: 500; }
.act { display: flex; gap: 10px; padding: 10px 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 8px; }
.act-ev { background: transparent; border-style: dashed; }
.act-body { flex: 1; min-width: 0; }
.act-h { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.act-h time { margin-inline-start: auto; font-size: 12px; color: var(--muted); }
.act-msg { border-inline-start: 3px solid var(--teal); }
.run-meta { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; color: var(--ink-2); margin-top: 4px; }
.run-meta span { display: inline-flex; align-items: center; gap: 4px; }
.run-meta svg { width: 14px; height: 14px; color: var(--muted); }
.dates { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.dates li { display: grid; grid-template-columns: 190px 1fr; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; }
.dates li.done { opacity: .72; } .dates li.overdue { border-color: #f1b4b4; }
.dates time { font-weight: 600; font-variant-numeric: tabular-nums; }

/* memory */
.memory { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.brief .md { max-height: none; }
.facts, .rules { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.fact, .rule { border: 1px solid var(--line-2); border-radius: 8px; padding: 9px 10px; }
.fact-h { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 2px; }
.rule p { margin: 4px 0; }
.rule.st-proposed { border-color: #f5d48a; background: #fffbeb; }
#cfacts, #facts { max-height: 520px; overflow: auto; }

/* team */
.dept { margin-bottom: 18px; }
.dept-h { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); margin-bottom: 8px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 10px; }
.acard { text-align: start; display: flex; flex-direction: column; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; cursor: pointer; box-shadow: var(--sh); transition: border-color .15s, transform .15s; color: var(--ink); }
.acard:hover { border-color: #9fd3bd; transform: translateY(-1px); }
.acard.st-working { border-color: #93c5fd; box-shadow: 0 0 0 3px #e0ecff; }
.acard-top { display: flex; gap: 10px; align-items: flex-start; }
.acard-id { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.acard-id strong { font-size: 14.5px; }
.acard-full { font-size: 12px; }
.acard-title { font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
.acard-spec { font-size: 12.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.acard-task { font-size: 12.5px; background: #f8faf9; border-radius: 6px; padding: 6px 8px; }
.status-pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--slate-soft); color: var(--slate); white-space: nowrap; }
.status-pill i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-pill.st-working { background: var(--blue-soft); color: var(--blue); } .status-pill.st-queued { background: var(--amber-soft); color: var(--amber); }
.status-pill.st-waiting { background: #fde8d7; color: #9a3412; } .status-pill.st-done { background: var(--green-soft); color: var(--green); }
.status-pill .spin { width: 10px; height: 10px; }

/* dialogs & drawer */
dialog.dlg { border: 0; padding: 0; border-radius: 14px; box-shadow: var(--sh-lg); width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 32px); color: var(--ink); background: var(--card); }
dialog.dlg::backdrop { background: rgba(15,23,42,.45); }
dialog.dlg-md { width: min(680px, calc(100vw - 24px)); } dialog.dlg-lg { width: min(820px, calc(100vw - 24px)); }
.dlg-form { display: flex; flex-direction: column; max-height: calc(100vh - 32px); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.dlg-head h2 { font-size: 16px; }
.dlg-body { padding: 16px 18px; overflow: auto; display: flex; flex-direction: column; gap: 12px; }
.dlg-body.grid2, .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid2.tight { gap: 8px; }
.span2 { grid-column: 1 / -1; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); background: #fafcfb; border-radius: 0 0 14px 14px; }
dialog.drawer { margin: 0; margin-inline-start: auto; height: 100vh; max-height: 100vh; width: min(760px, 100vw); border-radius: 0; }
dialog.drawer { overflow: hidden; }
[dir="rtl"] dialog.drawer { margin-inline-start: 0; margin-inline-end: auto; }
.drawer-inner { display: flex; flex-direction: column; height: 100%; }
.drawer-body { padding: 16px 18px; overflow: auto; flex: 1; }
.pd-hero { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.pd-name { font-size: 17px; }
.pd-tags { display: flex; gap: 6px; align-items: center; margin: 6px 0; flex-wrap: wrap; }
.toollist { columns: 2; padding-inline-start: 18px; } .toollist li { margin-bottom: 4px; }
.kb { display: grid; grid-template-columns: 220px 1fr; gap: 12px; }
.kb-files { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.kb-file { width: 100%; border: 0; background: none; text-align: start; display: grid; grid-template-columns: 18px 1fr; gap: 2px 6px; padding: 7px 8px; border-radius: 6px; cursor: pointer; color: var(--ink); }
.kb-file small { grid-column: 2; }
.kb-file:hover { background: var(--hover); } .kb-file.on { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.kb-doc { border-inline-start: 1px solid var(--line); padding-inline-start: 14px; min-width: 0; }
.sources { padding-inline-start: 18px; } .sources li { margin-bottom: 8px; } .sources p { margin: 2px 0; }
.kinds { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.kinds legend { font-weight: 600; font-size: 13px; margin-bottom: 6px; color: var(--ink-2); }
.kind { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 10px; cursor: pointer; }
.kind input { position: absolute; opacity: 0; }
.kind.on { border-color: var(--accent); background: var(--accent-soft); }
.kind:focus-within { outline: 2px solid var(--focus); }
.kind strong { display: block; } .kind small { color: var(--muted); font-size: 12px; line-height: 1.35; display: block; }
.agent-picker { border: 1px solid var(--line); border-radius: 10px; }
.ap-search { display: flex; align-items: center; gap: 8px; padding: 8px; border-bottom: 1px solid var(--line); }
.ap-search input { flex: 1; border: 1px solid #cfd8d4; border-radius: 7px; padding: 7px 10px; min-height: 34px; }
.ap-groups { max-height: 340px; overflow: auto; padding: 4px 8px 8px; }
.ap-group { border: 0; padding: 0; margin: 8px 0 0; }
.ap-group legend { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: 4px 0; }
.ap-group { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px; }
.ap-group legend { grid-column: 1 / -1; }
.ap-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; cursor: pointer; border: 1px solid transparent; }
.ap-item:hover { background: var(--hover); } .ap-item.on { background: var(--accent-soft); border-color: #bfe6d3; }
.ap-item input { accent-color: var(--accent); }
.ap-txt { display: flex; flex-direction: column; min-width: 0; } .ap-txt small { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toolcalls { padding-inline-start: 20px; } .toolcalls li { margin-bottom: 8px; } .toolcalls li.err b { color: var(--red); }
.toolcalls pre { background: #f8faf9; border: 1px solid var(--line-2); padding: 6px 8px; border-radius: 6px; font-size: 12px; margin: 4px 0; max-height: 220px; overflow: auto; }

/* ---------- markdown ---------- */
.md { line-height: 1.6; overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; } .md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 .6em; }
.md h2, .md h3, .md h4, .md h5, .md h6, .md h7 { margin: 1em 0 .4em; font-size: 15px; }
.md h2 { font-size: 17px; } .md h3 { font-size: 15.5px; }
.md ul, .md ol { margin: 0 0 .6em; padding-inline-start: 0; }
/* direction is per block (bidi.js): each li carries its own dir, so the marker indent is on the li's own start side */
.md li { margin-block: .15em; margin-inline-start: 1.4em; }
.md [dir] { text-align: start; }
.md code, .md pre { direction: ltr; unicode-bidi: isolate; }
.md bdi, bdi { unicode-bidi: isolate; }
.md-ltr-line { display: block; direction: ltr; text-align: left; }
.md blockquote { margin: .5em 0; padding: .2em .9em; border-inline-start: 3px solid #c6d3cd; color: var(--ink-2); background: #f8faf9; }
.md pre.md-code { background: #0f172a; color: #e2e8f0; padding: 10px 12px; border-radius: 8px; overflow: auto; font-size: 12.5px; white-space: pre; }
.md pre.md-code code { background: none; padding: 0; color: inherit; }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 1em 0; }
.md-table { overflow-x: auto; margin: .5em 0 .8em; }
.md table { border-collapse: collapse; font-size: 13px; min-width: 50%; }
.md th, .md td { border: 1px solid var(--line); padding: 5px 8px; text-align: start; vertical-align: top; }
.md th { background: #f3f6f4; font-weight: 600; }
.md-box { display: inline-block; width: 13px; height: 13px; border: 1.5px solid var(--muted); border-radius: 3px; margin-inline-end: 6px; vertical-align: -2px; }
.md-box.on { background: var(--accent); border-color: var(--accent); }
.mention { color: var(--blue); font-weight: 600; background: var(--blue-soft); border-radius: 4px; padding: 0 3px; }

/* ---------- chat ---------- */
.tab-chat { display: flex; }
.chat { display: grid; grid-template-columns: 320px 1fr; gap: 0; background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; height: calc(100vh - 372px); min-height: 480px; width: 100%; box-shadow: var(--sh); }
.tlist { border-inline-end: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; background: #fbfcfb; min-width: 0; }
.tlist-head { display: flex; justify-content: space-between; align-items: center; padding: 12px; border-bottom: 1px solid var(--line); gap: 8px; }
.tlist-body { overflow-y: auto; flex: 1; }
.threads { list-style: none; margin: 0; padding: 6px; }
.thread { display: flex; gap: 10px; padding: 10px; border-radius: 10px; text-decoration: none; color: var(--ink); }
.thread:hover { background: var(--hover); }
.thread.on { background: var(--accent-soft); }
.t-ico { flex: none; width: 32px; height: 32px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; background: var(--slate-soft); color: var(--slate); }
.t-ico.k-main { background: #e3f4ec; color: var(--accent-ink); } .t-ico.k-direct { background: var(--blue-soft); color: var(--blue); }
.t-ico.k-group { background: #f3e8ff; color: #6d28d9; } .t-ico.k-loop { background: var(--amber-soft); color: var(--amber); }
.t-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.t-row { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.t-title { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-time { font-size: 11.5px; color: var(--muted); flex: none; }
.t-last { font-size: 12.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.t-last b { color: var(--ink-2); font-weight: 600; }
.t-working { color: var(--blue); }
.conv { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.conv-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.conv-back { display: none; }
.conv-title { flex: 1; min-width: 0; } .conv-title h2 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-title span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-members { display: flex; align-items: center; gap: 4px; }
.msgs { flex: 1; overflow-y: auto; padding: 14px 18px; display: flex; flex-direction: column; gap: 14px; background: linear-gradient(#fff, #fcfdfc); }
.msgs:focus-visible { outline-offset: -2px; }
.msg { display: flex; gap: 10px; max-width: 920px; }
.msg-body { flex: 1; min-width: 0; }
.msg header { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 2px; }
.msg header strong { font-size: 14px; }
.msg-title { font-size: 12px; color: var(--muted); }
.msg header time { font-size: 11.5px; color: var(--muted); margin-inline-start: auto; }
.msg .md { background: #f4f7f5; border: 1px solid var(--line-2); border-radius: 4px 12px 12px 12px; padding: 9px 12px; }
[dir="rtl"] .msg .md { border-radius: 12px 4px 12px 12px; }
.msg.mine .md { background: #eef7f2; border-color: #d5ebdf; }
.msg.agent .md { background: #fff; border-color: var(--line); }
.msg-sys { align-self: center; display: inline-flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--muted); background: var(--line-2); border-radius: 999px; padding: 4px 12px; max-width: 90%; }
.msg-sys.err { background: var(--red-soft); color: #7f1d1d; } .msg-sys.warn { background: var(--amber-soft); color: var(--amber); }
.msg-sys svg { width: 14px; height: 14px; flex: none; }
.msg-files { list-style: none; padding: 0; margin: 6px 0 0; display: flex; gap: 6px; flex-wrap: wrap; }
.msg-files a { display: inline-flex; gap: 4px; align-items: center; border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px; text-decoration: none; font-size: 12.5px; }
.msg-files svg { width: 14px; height: 14px; }
.email-card { border: 1px solid #f5d48a; background: #fffbeb; border-radius: 8px; padding: 8px 10px; margin-bottom: 6px; display: flex; flex-direction: column; gap: 4px; }
.email-actions { display: flex; gap: 8px; align-items: center; }
.footnote { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; margin-top: 5px; font-size: 12px; color: var(--muted); }
.fn-tools { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.fn-tools svg { width: 13px; height: 13px; }
.fn-tools .err { color: var(--red); }
.runbar { border-top: 1px solid var(--line); padding: 6px 14px; background: #f5f9ff; display: flex; flex-direction: column; gap: 4px; }
.runrow { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--blue); }
.runrow .muted { margin-inline-start: auto; }
.composer { border-top: 1px solid var(--line); padding: 8px 12px 10px; display: flex; flex-direction: column; gap: 6px; background: var(--card); }
.quick { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.quick::-webkit-scrollbar { display: none; }
.qchip { border: 1px solid #cfe5da; background: var(--accent-soft); color: var(--accent-ink); border-radius: 999px; padding: 4px 11px; font-size: 12.5px; font-weight: 600; cursor: pointer; white-space: nowrap; min-height: 30px; }
.qchip:hover { background: #cdeedd; }
.att { display: flex; gap: 6px; flex-wrap: wrap; } .att:empty { display: none; }
.attchip { display: inline-flex; align-items: center; gap: 4px; background: var(--line-2); border-radius: 6px; padding: 2px 4px 2px 8px; font-size: 12.5px; }
.attchip svg { width: 14px; height: 14px; }
.comp-row { display: flex; gap: 8px; align-items: flex-end; }
.attach { cursor: pointer; height: 40px; min-width: 40px; color: var(--muted); }
.attach:focus-within { outline: 2px solid var(--focus); }
.comp-wrap { flex: 1; position: relative; min-width: 0; }
.comp-wrap textarea { width: 100%; resize: none; border: 1px solid #cfd8d4; border-radius: 10px; padding: 9px 12px; min-height: 40px; max-height: 200px; line-height: 1.45; background: #fff; display: block; }
.comp-wrap textarea::placeholder { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.send { height: 40px; }
.comp-hint { margin: 0; } .comp-hint:empty { display: none; }
.mention-pop { position: absolute; bottom: calc(100% + 6px); inset-inline-start: 0; width: min(420px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--sh-lg); z-index: 30; overflow: hidden; }
.mention-pop ul { list-style: none; margin: 0; padding: 4px; max-height: 290px; overflow: auto; }
.mopt { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 7px; cursor: pointer; }
.mopt.on, .mopt:hover { background: var(--accent-soft); }
.mo-txt { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: 0 6px; align-items: baseline; }
.mo-txt small { flex-basis: 100%; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mo-tag { font-size: 11px; color: var(--amber); white-space: nowrap; } .mo-tag.in { color: var(--green); }
.mention-hint { margin: 0; padding: 5px 10px; font-size: 11.5px; color: var(--muted); border-top: 1px solid var(--line-2); background: #fafcfb; }

/* ---------- team room (§3.7) ---------- */
.btn-xs { min-height: 26px; padding: 2px 8px; font-size: 12px; gap: 4px; }
.btn-xs svg { width: 13px; height: 13px; }
.btn-danger { border-color: #f3c2c2; color: var(--red); background: #fff; } .btn-danger:hover { background: var(--red-soft); }
.linkbtn.danger { color: var(--red); }
.check { display: flex; gap: 8px; align-items: center; font-size: 13px; }
.tlist-btns { display: inline-flex; gap: 6px; align-items: center; }
@media (min-width: 761px) { .tlist .tr-toggle { display: none; } }
.tr-toggle { position: relative; gap: 5px; border: 1px solid var(--line); padding: 0 9px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.tr-toggle.on { background: var(--accent-soft); border-color: #cfe5da; color: var(--accent-ink); }
.tr-toggle svg { width: 17px; height: 17px; }
.tr-badge { position: absolute; top: -6px; inset-inline-end: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 0 0 2px var(--card); }
.tr-badge[hidden] { display: none; }
.chat-paused { display: flex; align-items: center; gap: 10px; padding: 7px 14px; background: var(--amber-soft); color: var(--amber); border-bottom: 1px solid #f5d48a; font-size: 13px; }
.chat-paused[hidden] { display: none; } .chat-paused svg { width: 16px; height: 16px; flex: none; } .chat-paused .btn { margin-inline-start: auto; }
.chat.tr-open { grid-template-columns: 270px minmax(0, 1fr) 380px; }
.troom { display: none; flex-direction: column; min-height: 0; min-width: 0; border-inline-start: 1px solid var(--line); background: #fbfcfb; }
.chat.tr-open .troom { display: flex; }
.tr-scrim { display: none; }
.tr-head { display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 12px; border-bottom: 1px solid var(--line); }
.tr-title { flex: 1; min-width: 0; } .tr-title h2 { font-size: 15px; } .tr-title span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tr-actions { display: flex; gap: 4px; align-items: center; }
.t-ico.sm { width: 22px; height: 22px; border-radius: 6px; } .t-ico.sm svg { width: 13px; height: 13px; }
.t-ico.k-team_internal { background: var(--teal-soft); color: var(--teal); }
.tr-paused { display: flex; gap: 10px; align-items: flex-start; margin: 8px 10px 0; padding: 9px 11px; border-radius: 9px; background: var(--amber-soft); color: var(--amber); border: 1px solid #f5d48a; font-size: 12.5px; }
.tr-paused svg { flex: none; width: 16px; height: 16px; margin-top: 2px; } .tr-paused b { display: block; font-size: 13px; }
.tr-filters { display: flex; gap: 6px; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.tr-filters .seg button { padding: 4px 8px; font-size: 12px; min-height: 26px; }
.tr-filters select { flex: 1; min-width: 120px; border: 1px solid #cfd8d4; border-radius: 7px; padding: 4px 6px; font-size: 12.5px; background: #fff; min-height: 30px; }
.tr-top { flex: none; max-height: 44%; overflow-y: auto; padding: 0 10px 6px; border-bottom: 1px solid var(--line); background: #f6f9f7; }
.tr-scroll { flex: 1; overflow-y: auto; min-height: 0; padding: 0 10px 10px; }
.tr-sec { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 12px 2px 6px; }
.tr-none { margin: 0 2px; }
.tr-chain { border: 1px solid var(--line); border-radius: 10px; background: var(--card); padding: 7px 8px; margin-bottom: 8px; }
.tr-chain.on { border-color: #bfd3fb; box-shadow: 0 0 0 3px #eef3ff; }
.tr-chain.done { opacity: .8; }
.tr-chain-h { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12.5px; margin-bottom: 4px; }
.tr-chain-h .btn { margin-inline-start: auto; }
.tr-tree { list-style: none; margin: 0; padding: 0; }
.tr-tree .tr-tree { margin-inline-start: 11px; padding-inline-start: 10px; border-inline-start: 2px solid var(--line); }
.tr-node { padding: 2px 0; }
.tr-node-row { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; font-size: 12.5px; }
.tr-node-act { margin-inline-start: auto; display: inline-flex; gap: 6px; }
.tr-node.s-running > .tr-node-row .tr-who { color: var(--blue); }
.tr-asked { margin: 1px 0 3px 26px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; }
[dir="rtl"] .tr-asked { margin: 1px 26px 3px 0; }
.tr-who { border: 0; background: none; padding: 0; font: inherit; font-weight: 600; color: var(--ink); cursor: pointer; }
.tr-who:hover { color: var(--accent); text-decoration: underline; }
.tr-appr-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.tr-appr-list li { border: 1px solid #f5d48a; background: #fffbeb; border-radius: 9px; padding: 7px 9px; font-size: 12.5px; }
.tr-appr-subj { margin: 3px 0 5px; color: var(--ink-2); }
.tr-appr-act { display: flex; gap: 6px; margin-top: 4px; }
.tr-feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.tr-it { display: flex; gap: 8px; }
.tr-it-b { flex: 1; min-width: 0; }
.tr-h { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; font-size: 12.5px; }
.tr-h time { margin-inline-start: auto; font-size: 11px; color: var(--muted); }
.tr-arrow { color: var(--muted); }
.tr-text { margin-top: 3px; background: #fff; border: 1px solid var(--line); border-radius: 4px 10px 10px 10px; padding: 6px 9px; }
[dir="rtl"] .tr-text { border-radius: 10px 4px 10px 10px; }
.tr-it.k-owner .tr-text { background: #fff8e6; border-color: #f5d48a; }
.tr-it.k-ask .tr-text { border-inline-start: 3px solid #93c5fd; }
.tr-it.k-answer .tr-text { border-inline-start: 3px solid #86efac; }
.tr-it.k-delegation .tr-text { border-inline-start: 3px solid #5eead4; }
.tr-it.k-note .tr-text { background: var(--line-2); }
.tr-text.clamp { max-height: 6.4em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 60%, transparent); mask-image: linear-gradient(#000 60%, transparent); }
.tr-foot { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.tr-it.ev { align-items: flex-start; }
.tr-ev-ico { flex: none; width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--line-2); color: var(--slate); }
.tr-ev-ico svg { width: 14px; height: 14px; }
.tr-it.et-team_paused .tr-ev-ico { background: var(--amber-soft); color: var(--amber); }
.tr-it.et-team_resumed .tr-ev-ico { background: var(--green-soft); color: var(--green); }
.tr-it.et-chain_cancelled .tr-ev-ico, .tr-it.et-run_cancelled .tr-ev-ico, .tr-it.et-run_blocked .tr-ev-ico { background: var(--red-soft); color: var(--red); }
.tr-comp { display: flex; gap: 6px; align-items: flex-end; padding: 8px 10px; border-top: 1px solid var(--line); background: var(--card); }
.tr-comp[hidden] { display: none; }
.tr-comp textarea { flex: 1; resize: none; border: 1px solid #cfd8d4; border-radius: 9px; padding: 7px 10px; font: inherit; font-size: 13px; min-height: 40px; max-height: 120px; }
.tr-comp .btn { height: 40px; }
@media (max-width: 1100px) {
  .chat.tr-open { grid-template-columns: 300px minmax(0, 1fr); }
  .troom { position: fixed; z-index: 70; inset-inline: 0; bottom: 0; height: min(82dvh, 720px); border: 1px solid var(--line); border-radius: 16px 16px 0 0; box-shadow: var(--sh-lg); display: flex; transform: translateY(105%); transition: transform .22s ease; }
  .chat.tr-open .troom { transform: none; }
  .troom::before { content: ""; display: block; width: 44px; height: 4px; border-radius: 4px; background: #cbd5d1; margin: 7px auto 0; flex: none; }
  .chat.tr-open .tr-scrim { display: block; position: fixed; inset: 0; background: rgba(15,23,42,.4); z-index: 65; }
}
@media (max-width: 760px) {
  .chat.tr-open { grid-template-columns: minmax(0, 1fr); }
  .tr-top { max-height: 36%; }
  .hide-xs { display: none; }
  .tr-toggle { padding: 0 7px; }
}

/* ---------- responsive ---------- */
@media (max-width: 1280px) { .memory { grid-template-columns: 1fr; } }
@media (max-width: 1100px) { .aiprice { width: 210px; } .files { grid-template-columns: 1fr; } .files-right { position: static; max-height: none; } }
@media (max-width: 900px) {
  .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 60; transform: translateX(-105%); transition: transform .2s; width: min(320px, 88vw); }
  [dir="rtl"] .sidebar { transform: translateX(105%); }
  body.sb-open .sidebar { transform: none; box-shadow: var(--sh-lg); }
  body.sb-open .scrim { display: block; position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 50; }
  .sb-close, .menu-btn { display: inline-flex; }
  .topbar { padding: 8px 12px; }
  .project { padding: 12px 16px 16px; }
  .pcard { flex-direction: column; gap: 12px; }
  .aiprice { width: auto; }
  .login { grid-template-columns: 1fr; } .login-side { display: none; }
  .kb { grid-template-columns: 1fr; } .kb-doc { border: 0; padding: 0; }
}
@media (max-width: 760px) {
  .hide-sm { display: none !important; }
  .project { padding: 10px 16px 12px; gap: 10px; }
  .pcard { padding: 12px 14px; }
  .ptitle { font-size: 16px; }
  .pfacts { gap: 14px; margin-top: 8px; }
  .aiprice { padding: 10px 12px; flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
  .aiprice-val { font-size: 18px; }
  .stagebar li { min-width: 74px; }
  .tabs { top: 50px; }
  .chat { grid-template-columns: minmax(0, 1fr); height: calc(100dvh - 120px); min-height: 460px; border-radius: 10px; }
  .chat .conv { display: none; } .chat.show-conv .conv { display: flex; } .chat.show-conv .tlist { display: none; }
  .conv-back { display: inline-flex; }
  .msgs { padding: 10px; }
  .msg .av-md { width: 30px; height: 30px; font-size: 11px; }
  .grid2, .dlg-body.grid2 { grid-template-columns: 1fr; }
  .kinds { grid-template-columns: 1fr; }
  .toolbar .search input { min-width: 0; width: 100%; } .toolbar .search { flex: 1; }
  .dates li { grid-template-columns: 1fr; gap: 2px; }
  .bids li { grid-template-columns: 28px 1fr auto; } .bid-bar { display: none; }
  .toollist { columns: 1; }
  .tev { grid-template-columns: 44px 12px 1fr; gap: 8px; }
}
/* In a chat-focused phone view the header card is condensed so the conversation keeps the screen. */
@media (max-width: 760px) {
  .tab-chat-active #phead { display: none; }
  .tab-chat-active .chat { height: calc(100dvh - 128px); min-height: 400px; }
}
.tbl code { white-space: nowrap; }
.kpi span::first-letter { text-transform: uppercase; }
html:has(dialog[open]) { overflow: hidden; }
