/* ============================================================================
   AI Request Console — "systems console" identity.
   Neutral slate base + a single signal-blue accent. Warm hues are reserved
   ONLY for priority/risk encoding, so colour always carries meaning.
   Display: Space Grotesk · Body: Inter · Data/labels: IBM Plex Mono
   ============================================================================ */
:root {
  --ink:        #0e1620;   /* near-black slate           */
  --ink-2:      #1b2735;   /* raised slate (sidebar)      */
  --surface:    #ffffff;
  --panel:      #f5f7fa;   /* app background              */
  --panel-2:    #eef2f7;   /* inset panels                */
  --line:       #dde4ec;   /* hairline borders            */
  --line-2:     #c8d2de;
  --text:       #16212e;
  --muted:      #5f6f80;
  --muted-2:    #8695a5;
  --accent:     #2f6fed;   /* signal blue — the one accent */
  --accent-ink: #1b4fc0;
  --accent-wash:#e8f0ff;

  /* Priority / risk semantics — the only warm colours in the system */
  --p-high:   #d7452a;
  --p-high-w: #fbe7e2;
  --p-med:    #c98a00;
  --p-med-w:  #fbf1d8;
  --p-low:    #2f8f57;
  --p-low-w:  #e2f3e9;

  --radius: 8px;
  --shadow: 0 1px 2px rgba(16,32,48,.06), 0 8px 24px rgba(16,32,48,.05);
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --display: "Space Grotesk", var(--sans);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--sans);
  color: var(--text);
  background: var(--panel);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.5;
}
a { color: var(--accent); text-decoration: none; }
button { font-family: inherit; }

/* ---- Layout ---- */
.app-shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }

.sidebar {
  background: var(--ink);
  color: #cdd8e4;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; gap: 12px; align-items: center; padding: 22px 20px 26px; }
.brand-mark {
  width: 30px; height: 30px; display: grid; place-items: center;
  color: var(--accent); font-size: 16px;
  border: 1px solid #33455a; border-radius: 6px; background: #12202f;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-family: var(--display); font-weight: 700; letter-spacing: .16em; color: #fff; font-size: 15px; }
.brand-sub  { font-family: var(--mono); font-size: 10px; letter-spacing: .06em; color: var(--muted-2); text-transform: uppercase; }

.nav { display: flex; flex-direction: column; gap: 2px; padding: 6px 12px; flex: 1; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 6px;
  color: #b6c3d2; font-weight: 500; font-size: 13.5px;
}
.nav a .ic { width: 16px; text-align: center; opacity: .8; font-size: 13px; }
.nav a:hover { background: #17273a; color: #fff; }
.nav a.active { background: var(--accent); color: #fff; }
.nav a.active .ic { opacity: 1; }

.sidebar-foot { border-top: 1px solid #22344a; padding: 14px 20px; }
.who { font-family: var(--mono); font-size: 11px; color: var(--muted-2); word-break: break-all; margin-bottom: 8px; }
.logout { color: #9fb0c2; font-size: 12.5px; }
.logout:hover { color: #fff; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 60px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; border-bottom: 1px solid var(--line); background: var(--surface);
  position: sticky; top: 0; z-index: 5;
}
.crumb { font-family: var(--display); font-weight: 600; font-size: 16px; letter-spacing: -.01em; }
.crumb small { font-family: var(--mono); font-weight: 400; color: var(--muted-2); font-size: 11px; margin-left: 10px; letter-spacing: .04em; }
.topbar-actions { display: flex; gap: 10px; }

.view { padding: 28px; max-width: 1180px; width: 100%; }
.loading { color: var(--muted); font-family: var(--mono); font-size: 13px; padding: 40px 0; }

/* ---- Reusable atoms ---- */
.eyebrow { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted-2); }
.section-title { font-family: var(--display); font-size: 18px; font-weight: 600; margin: 2px 0 18px; letter-spacing: -.01em; }

.btn {
  border: 1px solid var(--line-2); background: var(--surface); color: var(--text);
  padding: 9px 15px; border-radius: 6px; font-weight: 600; font-size: 13px; cursor: pointer;
  transition: border-color .12s, background .12s;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--accent); }
.btn:disabled { opacity: .5; cursor: default; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-pad { padding: 22px; }

/* Priority + risk chips (semantic colour) */
.chip { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono);
  font-size: 11px; padding: 3px 9px; border-radius: 100px; font-weight: 500; letter-spacing: .02em; }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip.high { color: var(--p-high); background: var(--p-high-w); }
.chip.medium { color: var(--p-med); background: var(--p-med-w); }
.chip.low { color: var(--p-low); background: var(--p-low-w); }

.pill { font-family: var(--mono); font-size: 11px; padding: 3px 9px; border-radius: 5px;
  background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); }
.pill.status-approved, .pill.status-done { color: var(--p-low); background: var(--p-low-w); border-color: transparent; }
.pill.status-under-review, .pill.status-in-development { color: var(--accent); background: var(--accent-wash); border-color: transparent; }
.pill.status-deferred, .pill.status-rejected { color: var(--muted); }

/* ---- Forms ---- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 22px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--text); }
.field label .req { color: var(--p-high); margin-left: 3px; }
.field .hint { font-size: 11.5px; color: var(--muted-2); }
input, select, textarea {
  font-family: var(--sans); font-size: 13.5px; color: var(--text);
  padding: 9px 11px; border: 1px solid var(--line-2); border-radius: 6px; background: var(--surface);
  width: 100%;
}
textarea { resize: vertical; min-height: 78px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; padding: 7px 11px;
  border: 1px solid var(--line-2); border-radius: 6px; cursor: pointer; background: var(--surface); }
.check input { width: auto; }
.check.sensitive { border-color: var(--p-high); color: var(--p-high); }

/* ---- Tables ---- */
table.grid { width: 100%; border-collapse: collapse; background: var(--surface); }
table.grid th { text-align: left; font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted-2); padding: 12px 14px; border-bottom: 1px solid var(--line); }
table.grid td { padding: 13px 14px; border-bottom: 1px solid var(--line); font-size: 13px; }
table.grid tr:hover td { background: var(--panel); }
table.grid tr { cursor: pointer; }
.id-cell { font-family: var(--mono); color: var(--muted); font-size: 12px; }

/* ---- Metric cards ---- */
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.metric { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.metric .num { font-family: var(--display); font-size: 30px; font-weight: 700; letter-spacing: -.02em; }
.metric .lbl { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted-2); margin-top: 2px; }
.metric.accent .num { color: var(--accent); }
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.chart-box { position: relative; height: 260px; }

/* ---- Empty / detail ---- */
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty .big { font-family: var(--display); font-size: 17px; color: var(--text); margin-bottom: 6px; }
.detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 20px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 28px; }
.kv { display: flex; flex-direction: column; gap: 3px; }
.kv .k { font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted-2); }
.kv .v { font-size: 13.5px; }
.comment { border-left: 2px solid var(--line-2); padding: 4px 0 4px 12px; margin-bottom: 12px; }
.comment .meta { font-family: var(--mono); font-size: 11px; color: var(--muted-2); margin-bottom: 3px; }

/* ============================================================================
   SIGNATURE ELEMENT — Priority Timeline (hand-built SVG Gantt)
   Swimlanes by priority; bars from start→end; a live "today" plumb line.
   ============================================================================ */
.gantt-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.gantt-legend { display: flex; gap: 18px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.gantt-legend .lg { display: inline-flex; align-items: center; gap: 7px; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.gantt-legend .sw { width: 12px; height: 12px; border-radius: 3px; }
.gantt-scroll { overflow-x: auto; }
.gantt svg { display: block; }
.gantt .lane-band { fill: var(--panel); }
.gantt .lane-label { font-family: var(--mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; fill: var(--muted); }
.gantt .grid-line { stroke: var(--line); stroke-width: 1; }
.gantt .month-label { font-family: var(--mono); font-size: 10.5px; fill: var(--muted-2); }
.gantt .today-line { stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 4 3; }
.gantt .today-tag { font-family: var(--mono); font-size: 10px; fill: var(--accent); }
.gantt .bar { rx: 4; cursor: pointer; }
.gantt .bar.proposed { opacity: .45; stroke-dasharray: 3 2; }
.gantt .bar-text { font-family: var(--sans); font-size: 11px; fill: #fff; font-weight: 600; pointer-events: none; }
.gantt .bar-text.out { fill: var(--text); }

/* ---- Toast ---- */
.toast { position: fixed; bottom: 22px; right: 22px; background: var(--ink); color: #fff;
  padding: 12px 16px; border-radius: 8px; font-size: 13px; box-shadow: var(--shadow); z-index: 50; max-width: 340px; }
.toast.err { background: var(--p-high); }

/* ---- Responsive ---- */
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; overflow-x: auto; }
  .nav { flex-direction: row; }
  .sidebar-foot { display: none; }
  .form-grid, .detail-grid, .dash-grid { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ============================================================================
   v2 components — work-item types, kanban, roadmap, activity, watchers,
   attachments, consent, admin tabs, split detail layout.
   ============================================================================ */

/* Work-item type tag */
.type-tag {
  font-family: var(--mono); font-size: 11px; letter-spacing: .04em;
  text-transform: uppercase; color: var(--muted);
  border: 1px solid var(--line-2); border-radius: 4px; padding: 1px 6px; background: var(--panel-2);
}

/* Two-column detail layout */
.split { display: grid; grid-template-columns: 1fr 320px; gap: 16px; align-items: start; }
.side-col { position: sticky; top: 16px; }
.detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } .side-col { position: static; } }

/* Kanban board */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr);
  gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.kcol { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; min-height: 120px; }
.kcol-head { font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.kcount { background: var(--surface); border: 1px solid var(--line-2); color: var(--muted);
  border-radius: 10px; padding: 0 7px; font-size: 11px; }
.kcol-body { padding: 10px; display: flex; flex-direction: column; gap: 10px; flex: 1; transition: background .12s; }
.kcol-body.over { background: var(--accent-wash); }
.kcard { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 10px;
  cursor: grab; box-shadow: 0 1px 1px rgba(16,32,48,.04); }
.kcard:hover { border-color: var(--line-2); }
.kcard.dragging { opacity: .5; }
.kcard-top { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; }
.kcard-title { font-weight: 600; font-size: 13.5px; line-height: 1.35; }
.kcard-foot { font-size: 11.5px; color: var(--muted); margin-top: 6px; }

/* Roadmap */
.roadmap { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 8px; }
.rq-col { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.rq-head { font-family: var(--display); font-weight: 600; display: flex; justify-content: space-between; align-items: center; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.rq-card { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 6px; padding: 10px; cursor: pointer; }
.rq-card:hover { border-color: var(--line-2); }

/* Activity feed */
.activity-list { display: flex; flex-direction: column; gap: 2px; }
.act { display: flex; gap: 10px; padding: 7px 0; align-items: flex-start; }
.activity-list.wide .act { border-bottom: 1px solid var(--line); }
.act-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-top: 6px; flex: none; }
.act-dot.created { background: var(--p-low); }
.act-dot.status_changed { background: var(--accent); }
.act-dot.gdpr_erasure, .act-dot.soft_deleted { background: var(--p-high); }
.act-dot.triaged, .act-dot.commented { background: var(--p-med); }
.act-main { font-size: 13px; }
.act-time { font-family: var(--mono); font-size: 11px; color: var(--muted-2); margin-top: 2px; }
.act-link { color: var(--accent); text-decoration: none; }
.act-link:hover { text-decoration: underline; }

/* Watchers + attachments */
.watcher { font-family: var(--mono); font-size: 12.5px; color: var(--text); padding: 4px 0; border-bottom: 1px dashed var(--line); }
.watcher:last-child { border-bottom: 0; }
.attach { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 5px 0; }
.attach a { color: var(--accent); text-decoration: none; font-size: 13px; word-break: break-all; }
.attach a:hover { text-decoration: underline; }

/* Consent box */
.consent-box { background: var(--accent-wash); border: 1px solid #cfe0ff; border-radius: var(--radius); padding: 14px 16px; margin-top: 18px; }
.consent-box .check { align-items: flex-start; font-size: 13.5px; }
.consent-box .hint { margin-top: 8px; }

/* Admin tabs */
.tabs { display: flex; gap: 4px; margin-bottom: 12px; }
.tab { background: transparent; border: 1px solid transparent; border-bottom: 2px solid transparent;
  padding: 8px 14px; font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); cursor: pointer; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent-ink); border-bottom-color: var(--accent); }
.tabpane { }

/* Sensitive data checkbox emphasis */
.check.sensitive { color: var(--p-high); font-weight: 600; }

/* ---- Tasks (breakdown + My work) ---- */
.task-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border, #23304a); }
.task-row:last-child { border-bottom: none; }
.task-main { flex: 1; min-width: 0; }
.task-title { font-weight: 600; }
.task-title.done, .task-open.done { text-decoration: line-through; color: var(--muted, #8aa0c6); }
.task-meta { display: flex; gap: 14px; font-size: 12px; color: var(--muted, #8aa0c6); margin-top: 3px; flex-wrap: wrap; }
.task-actions { display: flex; align-items: center; gap: 8px; }
.task-status { padding: 6px 8px; border-radius: 6px; background: var(--panel, #131c30); color: inherit; border: 1px solid var(--border, #23304a); font: inherit; }
.task-del { color: var(--muted, #8aa0c6); padding: 4px 8px; }
.task-del:hover { color: var(--p-high, #ef4444); }
.task-add { display: grid; grid-template-columns: 1fr 1fr auto auto; gap: 8px; align-items: center; margin-top: 8px; }
.task-add input { padding: 8px 10px; border-radius: 6px; background: var(--panel, #131c30); color: inherit; border: 1px solid var(--border, #23304a); font: inherit; }
.task-open { color: var(--text, #e6edf7); font-weight: 600; text-decoration: none; }
.task-open:hover { text-decoration: underline; }
.task-assignee { padding: 3px 6px; border-radius: 5px; background: var(--panel, #131c30); color: inherit; border: 1px solid var(--border, #23304a); font: inherit; font-size: 12px; min-width: 150px; }
.overdue { color: var(--p-high, #ef4444); font-weight: 600; }
@media (max-width: 640px) { .task-add { grid-template-columns: 1fr; } }

/* ---- Workload matrix ---- */
.matrix-wrap { overflow-x: auto; }
table.matrix { border-collapse: collapse; width: 100%; font-size: 13px; }
table.matrix th, table.matrix td { padding: 8px 12px; text-align: center; border-bottom: 1px solid var(--border, #23304a); white-space: nowrap; }
table.matrix th.who, table.matrix td.who { text-align: left; position: sticky; left: 0; background: var(--panel, #131c30); font-weight: 600; }
table.matrix thead th { color: var(--muted, #8aa0c6); font-weight: 600; }
table.matrix td.zero { color: var(--muted-2, #4a5b7a); }
table.matrix td.load { font-weight: 700; }
table.matrix tr.total-row td, table.matrix td.total-col { background: rgba(37,99,235,.08); font-weight: 700; }
.load-badge { display: inline-block; min-width: 22px; }
.load-badge.od { color: var(--p-high, #ef4444); }

/* ---- Per-project task board ---- */
.tboard { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.tcol { background: var(--panel-2, #0f1626); border: 1px solid var(--border, #23304a); border-radius: 8px; padding: 8px; }
.tcol-head { font-size: 12px; font-weight: 600; color: var(--muted, #8aa0c6); display: flex; justify-content: space-between; align-items: center; padding: 2px 4px 8px; }
.tcol-body { display: flex; flex-direction: column; gap: 8px; min-height: 44px; }
.tcol-body.over { outline: 2px dashed var(--accent, #2563eb); outline-offset: 2px; border-radius: 6px; }
.tcard { background: var(--panel, #131c30); border: 1px solid var(--border, #23304a); border-radius: 6px; padding: 8px 10px; cursor: grab; }
.tcard.locked { cursor: default; }
.tcard.dragging { opacity: .5; }
.tcard-title { font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.tcard-title.done { text-decoration: line-through; color: var(--muted, #8aa0c6); }
.tcard-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: 11px; color: var(--muted, #8aa0c6); }
.tcard .task-assignee { min-width: 0; width: 100%; }
.tcard-del { background: none; border: none; color: var(--muted, #8aa0c6); cursor: pointer; margin-left: auto; padding: 0 2px; font-size: 12px; }
.tcard-del:hover { color: var(--p-high, #ef4444); }
@media (max-width: 900px) { .tboard { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .tboard { grid-template-columns: 1fr; } }
