/* ai-helper requests tracker — Hebrew RTL SPA */

:root {
  --paper:      #f3f5f9;
  --surface:    #ffffff;
  --surface-2:  #f8f9fc;
  --ink:        #111827;
  --ink-soft:   #374151;
  --muted:      #6b7280;
  --faint:      #9ca3af;
  --line:       #e5e7eb;
  --line-firm:  #d1d5db;

  --accent:     #0b5fff;
  --accent-ink: #0a3fb0;
  --accent-wash:#e8f0ff;

  --st-new:        #6b7280;  --st-new-wash:        #f1f2f4;
  --st-progress:   #0b5fff;  --st-progress-wash:   #e8f0ff;
  --st-blocked:    #c2410c;  --st-blocked-wash:    #fff1e8;
  --st-done:       #15803d;  --st-done-wash:       #e7f6ec;
  --st-rejected:   #9ca3af;  --st-rejected-wash:   #f3f4f6;

  --danger: #b42318;
  --shadow: 0 1px 2px rgba(17,24,39,.05), 0 1px 3px rgba(17,24,39,.04);
  --shadow-lg: 0 10px 30px rgba(17,24,39,.18);
  --r: 10px;

  --font: system-ui, -apple-system, "Segoe UI Variable Text", "Segoe UI", Assistant, Rubik,
          "Noto Sans Hebrew", "Arial Hebrew", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0b1020; --surface: #141a2b; --surface-2: #10162a;
    --ink: #e8ecf5; --ink-soft: #c6cddd; --muted: #95a0b8; --faint: #6b7690;
    --line: #242d45; --line-firm: #34405e;
    --accent: #6ea3ff; --accent-ink: #a9c6ff; --accent-wash: #16264a;
    --st-new-wash: #1c2336; --st-progress: #6ea3ff; --st-progress-wash: #16264a;
    --st-blocked: #fb923c; --st-blocked-wash: #3a2213; --st-done: #4ade80; --st-done-wash: #13301f;
    --st-rejected-wash: #1c2336;
  }
}
:root[data-theme="dark"] {
  --paper: #0b1020; --surface: #141a2b; --surface-2: #10162a;
  --ink: #e8ecf5; --ink-soft: #c6cddd; --muted: #95a0b8; --faint: #6b7690;
  --line: #242d45; --line-firm: #34405e;
  --accent: #6ea3ff; --accent-ink: #a9c6ff; --accent-wash: #16264a;
  --st-new-wash: #1c2336; --st-progress: #6ea3ff; --st-progress-wash: #16264a;
  --st-blocked: #fb923c; --st-blocked-wash: #3a2213; --st-done: #4ade80; --st-done-wash: #13301f;
  --st-rejected-wash: #1c2336;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--paper); color: var(--ink);
  font: 15px/1.5 var(--font);
  -webkit-text-size-adjust: 100%;
}
body.no-scroll { overflow: hidden; }
[hidden] { display: none !important; }
bdi { unicode-bidi: isolate; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { margin: 0; line-height: 1.3; }
.muted, .none { color: var(--faint); }
.none { font-size: 13px; }

/* ------------------------------------------------------------ boot */
.boot { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.boot-card { background: var(--surface); border: 1px solid var(--danger); border-radius: var(--r); padding: 24px; max-width: 32rem; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------ buttons & inputs */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid transparent;
  background: none; font-weight: 600; font-size: 14px; white-space: nowrap;
}
.btn:disabled { opacity: .55; cursor: default; }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover:not(:disabled) { background: var(--accent-ink); }
:root[data-theme="dark"] .btn--primary { color: #0b1020; }
.btn--quiet { color: var(--ink-soft); border-color: var(--line-firm); background: var(--surface); }
.btn--quiet:hover { background: var(--surface-2); }
.btn--danger-quiet { color: var(--danger); }
.btn--danger-quiet:hover { background: var(--st-blocked-wash); }
.btn--icon { width: 36px; padding: 0; color: var(--muted); }
.btn--icon:hover { background: var(--surface-2); color: var(--ink); }
.btn--sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn--block { width: 100%; }

input[type=text], input[type=email], input[type=password], input[type=search], input[type=date], select, textarea {
  width: 100%; height: 38px; padding: 0 10px;
  background: var(--surface); border: 1px solid var(--line-firm); border-radius: 8px;
}
textarea { height: auto; padding: 8px 10px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
input:disabled { background: var(--surface-2); color: var(--muted); }

.field { display: flex; flex-direction: column; gap: 4px; }
.label { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.hint { font-size: 12px; color: var(--muted); }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-soft); }
.check input { width: 16px; height: 16px; margin: 0; }
.form-error { color: var(--danger); background: var(--st-blocked-wash); padding: 8px 10px; border-radius: 8px; font-size: 14px; margin: 0; }
.note { font-size: 13px; color: var(--ink-soft); background: var(--accent-wash); padding: 8px 10px; border-radius: 8px; margin: 0; }

/* ------------------------------------------------------------ login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card {
  width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 28px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 16px;
}
.login-card #login-newpass { display: flex; flex-direction: column; gap: 12px; }
.login-head { display: flex; gap: 12px; align-items: center; margin-bottom: 4px; }
.login-head h1 { font-size: 20px; }
.login-head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }

/* ------------------------------------------------------------ top bar */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar-in { max-width: 1180px; margin: 0 auto; padding: 0 20px; height: 56px; display: flex; align-items: center; gap: 24px; }
.brand { display: flex; align-items: center; gap: 8px; font-size: 15px; white-space: nowrap; }
.tabs { display: flex; gap: 2px; height: 100%; }
.tab {
  border: 0; background: none; padding: 0 14px; height: 100%; color: var(--muted); font-weight: 600;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--accent); border-bottom-color: var(--accent); }
.whoami { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; font-size: 14px; }
.role { font-size: 11px; font-weight: 700; color: var(--accent); background: var(--accent-wash); padding: 2px 8px; border-radius: 99px; }

/* ------------------------------------------------------------ page */
.page { max-width: 1180px; margin: 0 auto; padding: 20px 20px 60px; }
.view-head { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.view-lede { margin: 0; color: var(--muted); font-size: 14px; flex: 1; }
.empty { padding: 48px 16px; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--line-firm); border-radius: var(--r); }
.alert { color: var(--danger); background: var(--st-blocked-wash); padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; }

/* people */
.person { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.person bdi { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.av {
  flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--faint); color: #fff;
  display: inline-grid; place-items: center; font-size: 11px; font-weight: 700; letter-spacing: -.02em;
}

/* status pills: the only colour-by-status in the app */
.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 99px; white-space: nowrap; }
.pill--new { color: var(--st-new); background: var(--st-new-wash); }
.pill--in_progress { color: var(--st-progress); background: var(--st-progress-wash); }
.pill--blocked { color: var(--st-blocked); background: var(--st-blocked-wash); }
.pill--done, .pill--v-released { color: var(--st-done); background: var(--st-done-wash); }
.pill--rejected { color: var(--st-rejected); background: var(--st-rejected-wash); text-decoration: line-through; }
.pill--v-planned { color: var(--st-new); background: var(--st-new-wash); }
.pill--v-in_dev, .pill--v-testing { color: var(--st-progress); background: var(--st-progress-wash); }
.tag { display: inline-block; font-size: 12px; padding: 2px 10px; border-radius: 99px; border: 1px solid var(--line-firm); color: var(--ink-soft); }
.is-soft { font-style: italic; color: var(--muted); }

/* next version banner */
.next-version {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px;
  background: var(--surface); border: 1px solid var(--line); border-inline-start: 4px solid var(--accent);
  border-radius: var(--r); padding: 12px 16px; margin-bottom: 16px; cursor: pointer; box-shadow: var(--shadow);
}
.next-version:hover { border-color: var(--accent); }
.nv-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.nv-version { font: 700 18px var(--mono); }
.nv-date { font-size: 14px; }
.nv-count { margin-inline-start: auto; font-size: 14px; color: var(--ink-soft); }

/* toolbar */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; }
.toolbar .search { width: 260px; }
.toolbar select { width: auto; min-width: 120px; }
.toolbar-gap { flex: 1; }
.segmented { display: inline-flex; border: 1px solid var(--line-firm); border-radius: 8px; overflow: hidden; background: var(--surface); height: 38px; }
.seg { border: 0; background: none; padding: 0 14px; color: var(--muted); font-weight: 600; font-size: 14px; }
.seg + .seg { border-inline-start: 1px solid var(--line-firm); }
.seg.is-on { background: var(--accent-wash); color: var(--accent); }
.filter-pill { height: 32px; border-radius: 99px; border: 1px solid var(--accent); background: var(--accent-wash); color: var(--accent); padding: 0 12px; font-size: 13px; font-weight: 600; white-space: pre; }

/* ------------------------------------------------------------ groups & rows */
.group { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 18px; overflow: hidden; box-shadow: var(--shadow); }
.group-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.group-head h2 { font-size: 16px; }
.group-head h2 bdi { font-family: var(--mono); }
.group-date { font-size: 13px; color: var(--ink-soft); }
.group-count { margin-inline-start: auto; font-size: 12px; font-weight: 700; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); border-radius: 99px; padding: 1px 9px; }
/* Nothing is committed for the unscheduled pile, and it should read that way. */
.group--unscheduled { background: var(--surface-2); box-shadow: none; }
.group--unscheduled .group-head h2 { color: var(--ink-soft); }

.row {
  display: grid; grid-template-columns: minmax(0, 1fr) 190px 150px 88px; align-items: center; gap: 16px;
  width: 100%; text-align: start; border: 0; background: none;
  padding: 11px 16px; border-top: 1px solid var(--line); border-inline-start: 3px solid transparent;
}
.group-head + .row { border-top: 0; }
button.row:hover { background: var(--accent-wash); }
.row--head { padding-top: 7px; padding-bottom: 7px; font-size: 12px; font-weight: 600; color: var(--faint); background: var(--surface-2); }
.row--compact { grid-template-columns: minmax(0, 1fr) 190px; }
.row-main { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.row-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-person { min-width: 0; font-size: 14px; color: var(--ink-soft); overflow: hidden; }
.row-status { text-align: end; }

.band { padding: 6px 16px; font-size: 12px; font-weight: 700; color: var(--muted); background: var(--surface-2); border-top: 1px solid var(--line); }
.band--active { color: var(--st-progress); }
.band + .row { border-top-color: transparent; }

/* Focus without numbers: work that is moving is marked and set first; "new" reads quieter. */
.row--in_progress { border-inline-start-color: var(--st-progress); }
.row--in_progress .row-title { font-weight: 650; }
.row--blocked { border-inline-start-color: var(--st-blocked); }
.row--blocked .row-title { font-weight: 650; }
.row--new .row-title { color: var(--ink-soft); font-weight: 400; }
.row--done .row-title, .row--rejected .row-title { color: var(--muted); font-weight: 400; }

/* ------------------------------------------------------------ versions */
.vcard {
  display: flex; align-items: flex-start; gap: 12px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 14px 16px; margin-bottom: 12px; box-shadow: var(--shadow);
}
.vcard:not(.vcard--released) { border-inline-start: 4px solid var(--accent); }
.vcard--released { background: var(--surface-2); box-shadow: none; }
.vcard-main { flex: 1; min-width: 0; max-width: 100%; display: flex; flex-direction: column; gap: 8px; text-align: start; border: 0; background: none; padding: 0; }
.vcard-top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.vcard-num { font: 700 18px var(--mono); }
.vcard-date { font-size: 14px; color: var(--ink-soft); }
.vcard-count { margin-inline-start: auto; font-size: 13px; color: var(--muted); }
.vcard-notes { font-size: 13.5px; color: var(--ink-soft); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.vcard-items { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.vcard-item { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.vcard-item .pill { min-width: 58px; text-align: center; }
.vcard-item-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vcard-item .av { width: 22px; height: 22px; font-size: 10px; }
.vcard-main:hover .vcard-num { color: var(--accent); }

/* ------------------------------------------------------------ drawer */
.drawer { position: fixed; inset: 0; z-index: 50; }
.drawer-overlay { position: absolute; inset: 0; background: rgba(15,23,42,.38); }
.drawer-panel {
  position: absolute; inset-block: 0; inset-inline-end: 0; width: min(560px, 100%);
  background: var(--surface); box-shadow: var(--shadow-lg); display: flex; flex-direction: column;
}
.drawer-head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px 12px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { flex: 1; font-size: 18px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px 20px 24px; display: flex; flex-direction: column; gap: 14px; }
.drawer-body h3 { font-size: 13px; color: var(--muted); font-weight: 600; margin-top: 4px; }
.drawer-foot { display: flex; align-items: center; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); background: var(--surface-2); }
.drawer-foot p { margin: 0; font-size: 13px; }
.drawer-foot:empty { display: none; }
.drawer-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.drawer-pills .tag bdi { font-family: var(--mono); }
.kvs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 20px; margin: 0; padding: 14px; background: var(--surface-2); border-radius: var(--r); }
.kv dt { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.kv dd { margin: 0; font-size: 14px; }
.prose { display: block; white-space: pre-wrap; font-size: 14.5px; color: var(--ink-soft); }
.history summary { cursor: pointer; font-size: 13px; color: var(--muted); font-weight: 600; }
.history-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.history-list li { display: flex; gap: 10px; flex-wrap: wrap; }
.history-when { color: var(--muted); font-variant-numeric: tabular-nums; }
.history-who { font-weight: 600; }

.form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.field--wide { grid-column: 1 / -1; }

/* ------------------------------------------------------------ phone */
@media (max-width: 720px) {
  .topbar-in { height: auto; flex-wrap: wrap; gap: 0 12px; padding: 8px 14px 0; }
  .brand strong { font-size: 14px; }
  .tabs { order: 3; width: 100%; height: 42px; }
  .tab { flex: 1; padding: 0 6px; }
  .whoami .person bdi { display: none; }
  .page { padding: 14px 12px 48px; }
  .toolbar .search { width: 100%; }
  .toolbar select { flex: 1; min-width: 0; }
  .toolbar-gap { display: none; }
  #new-request-btn { width: 100%; }
  .nv-count { margin-inline-start: 0; }

  .row--head { display: none; }
  .row, .row--compact { grid-template-columns: 1fr auto; gap: 6px 10px; padding: 12px 14px; }
  .row-main { grid-column: 1 / -1; }
  .row-title { white-space: normal; }
  .row-status { grid-row: 1; grid-column: 2; align-self: start; }
  .row:not(.row--compact) .row-main { grid-column: 1; }
  .row-person { font-size: 13px; }
  .row-person::before { content: attr(data-label) ": "; color: var(--faint); font-size: 12px; }
  .row-person .av { width: 20px; height: 20px; font-size: 9px; }

  .vcard { flex-direction: column; }
  .vcard-main { width: 100%; }
  .vcard-item-title { white-space: normal; }
  .vcard-count { margin-inline-start: 0; }
  .kvs, .form { grid-template-columns: 1fr; }
  .drawer-panel { width: 100%; }
}

/* dir="auto" makes a title that starts with a Latin word (MCP, Python) an LTR block, which
   aligns it to the left edge of an RTL column. Keep the direction, pin the edge. */
.row-title, .prose, .vcard-notes, .vcard-item-title, #drawer-title bdi { text-align: right; }
