/* Briefing Room HUD. Single dark theme by choice.
   Layout: Top bar → briefing (wide) + today rail → capture console → projects board → meetings + inbox → how it works */
:root {
  color-scheme: dark;
  --ink: #070c16;
  --panel: rgba(13, 22, 38, 0.86);
  --panel-solid: #0d1626;
  --line: rgba(98, 196, 255, 0.22);
  --line-strong: rgba(98, 196, 255, 0.55);
  --text: #dce8f6;
  --muted: #8296ae;
  --cyan: #5cc8ff;
  --cyan-dim: rgba(92, 200, 255, 0.12);
  --amber: #ffb547;
  --amber-dim: rgba(255, 181, 71, 0.14);
  --red: #ff6f5e;
  --red-dim: rgba(255, 111, 94, 0.14);
  --green: #5be3a4;
  --green-dim: rgba(91, 227, 164, 0.13);
  --font-display: "Chakra Petch", "Segoe UI", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { background: var(--ink); }
body {
  color: var(--text); font-family: var(--font-body); font-size: 15px; line-height: 1.5;
  background-color: var(--ink);
  background-image:
    radial-gradient(1200px 600px at 70% -10%, rgba(92, 200, 255, 0.10), transparent 60%),
    linear-gradient(rgba(92, 200, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(92, 200, 255, 0.035) 1px, transparent 1px);
  background-size: auto, 32px 32px, 32px 32px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 20px 56px;
}
.wrap { max-width: 1240px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
h1, h2, h3 { margin: 0; text-wrap: balance; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--cyan); }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.label { font-family: var(--font-display); font-weight: 600; font-size: 0.72rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
[hidden] { display: none !important; }

/* Top bar */
.top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; }
.brand { display: flex; align-items: center; gap: 12px; }
.reticle { width: 34px; height: 34px; border: 1.5px solid var(--cyan); border-radius: 50%; position: relative; flex: none; }
.reticle::before, .reticle::after { content: ""; position: absolute; background: var(--cyan); }
.reticle::before { left: 50%; top: -6px; bottom: -6px; width: 1.5px; transform: translateX(-50%); opacity: 0.7; }
.reticle::after { top: 50%; left: -6px; right: -6px; height: 1.5px; transform: translateY(-50%); opacity: 0.7; }
.brand h1 { font-family: var(--font-display); font-weight: 700; font-size: 1.45rem; letter-spacing: 0.22em; text-transform: uppercase; }
.brand small { display: block; font-family: var(--font-mono); font-size: 0.72rem; color: var(--muted); letter-spacing: 0.04em; }
.status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; font-family: var(--font-mono); font-size: 0.8rem; color: var(--muted); }
.clock { color: var(--text); font-size: 1.05rem; }
.conn { display: inline-flex; align-items: center; gap: 6px; }
.conn i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.conn.live i { background: var(--green); box-shadow: 0 0 8px var(--green); }
.conn.slow i, .conn.error i { background: var(--amber); }

/* Panels with HUD corners */
.panel { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 18px 20px; min-width: 0; backdrop-filter: blur(6px); }
.panel::before, .panel::after { content: ""; position: absolute; width: 14px; height: 14px; border-color: var(--cyan); border-style: solid; pointer-events: none; }
.panel::before { top: -1px; left: -1px; border-width: 2px 0 0 2px; }
.panel::after { bottom: -1px; right: -1px; border-width: 0 2px 2px 0; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-bottom: 14px; }
.panel-head h2 { font-family: var(--font-display); font-weight: 600; font-size: 0.95rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--cyan); }
.panel-head .hint { font-size: 0.82rem; color: var(--muted); }

.row-1 { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); gap: 18px; }
.row-4 { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 18px; }

/* Briefing */
.briefing { overflow: hidden; }
.briefing .scan { position: absolute; left: 0; right: 0; top: 0; height: 2px; background: linear-gradient(90deg, transparent, var(--cyan), transparent); opacity: 0; pointer-events: none; }
@media (prefers-reduced-motion: no-preference) {
  .briefing .scan { animation: scan 1.8s ease-out 0.2s 1; }
  @keyframes scan { 0% { top: 0; opacity: 0.9; } 100% { top: 100%; opacity: 0; } }
  .play.speaking .ring { animation: pulse 1.4s ease-out infinite; }
  @keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(92, 200, 255, 0.55); } 100% { box-shadow: 0 0 0 12px rgba(92, 200, 255, 0); } }
}
.greet { font-family: var(--font-display); font-weight: 600; font-size: 1.7rem; line-height: 1.2; letter-spacing: 0.01em; max-width: 34ch; }
.greet-sub { color: var(--muted); margin-top: 6px; max-width: 70ch; }
.briefing-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-top: 14px; }
.play { display: inline-flex; align-items: center; gap: 10px; background: var(--cyan-dim); border: 1px solid var(--line-strong); color: var(--text); border-radius: 999px; padding: 7px 16px 7px 8px; cursor: pointer; font-family: var(--font-display); font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; font-size: 0.78rem; }
.play .ring { width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--cyan); display: grid; place-items: center; }
.play .ring svg { width: 10px; height: 10px; fill: var(--cyan); }
.play:hover { border-color: var(--cyan); }
.ontable { list-style: none; margin: 18px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; counter-reset: item; }
.ontable li { counter-increment: item; display: grid; grid-template-columns: 2.2rem minmax(0, 1fr) auto; gap: 4px 14px; align-items: start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 4px; background: rgba(7, 12, 22, 0.55); }
.ontable li::before { content: counter(item, decimal-leading-zero); font-family: var(--font-mono); color: var(--cyan); font-size: 1.05rem; padding-top: 1px; }
.ontable li.is-priority { border-color: rgba(255, 181, 71, 0.5); }
.ontable li.is-priority::before { color: var(--amber); }
.ontable li.is-done { opacity: 0.55; }
.ontable li.is-done .t-title { text-decoration: line-through; }
.t-title { font-weight: 600; }
.t-why { color: var(--muted); font-size: 0.88rem; margin-top: 2px; }
.t-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.empty { color: var(--muted); font-size: 0.9rem; padding: 10px 0; }

/* Chips */
.chip { display: inline-flex; align-items: center; gap: 5px; font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.04em; padding: 2px 8px; border-radius: 3px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.chip.proj { color: var(--cyan); border-color: var(--line-strong); }
.chip.proj.priority { color: var(--amber); border-color: rgba(255, 181, 71, 0.55); background: var(--amber-dim); }
.chip.over { color: var(--red); border-color: rgba(255, 111, 94, 0.5); background: var(--red-dim); }
.chip.today { color: var(--amber); border-color: rgba(255, 181, 71, 0.5); }
.chip.hard { color: var(--red); border-color: rgba(255, 111, 94, 0.5); }
.chip.moved { color: var(--amber); border-color: rgba(255, 181, 71, 0.4); }
.chip.ok { color: var(--green); border-color: rgba(91, 227, 164, 0.45); background: var(--green-dim); }
.chip.wait { color: #c5a3ff; border-color: rgba(197, 163, 255, 0.45); }

/* Buttons */
.acts { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 32px; padding: 5px 12px; border-radius: 3px; border: 1px solid var(--line-strong); background: transparent; color: var(--text); cursor: pointer; font-size: 0.82rem; font-weight: 500; white-space: nowrap; }
.btn:hover:not(:disabled) { border-color: var(--cyan); background: var(--cyan-dim); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.primary { background: var(--cyan); border-color: var(--cyan); color: #04121f; font-weight: 600; }
.btn.primary:hover:not(:disabled) { background: #8bd9ff; }
.btn.done:hover:not(:disabled) { border-color: var(--green); background: var(--green-dim); }
.btn.drop:hover:not(:disabled) { border-color: var(--red); background: var(--red-dim); }
.btn.icon { padding: 5px 8px; min-width: 32px; }
.btn svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Today rail */
.rail { display: flex; flex-direction: column; gap: 18px; }
.cal { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.cal li { display: grid; grid-template-columns: 4.2rem minmax(0, 1fr); gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); }
.cal li:first-child { border-top: 0; }
.cal .when { font-family: var(--font-mono); color: var(--cyan); font-size: 0.85rem; }
.cal .what { font-size: 0.92rem; }
.cal .what small { display: block; color: var(--muted); font-size: 0.8rem; }
.count { display: grid; grid-template-columns: 3.6rem minmax(0, 1fr); gap: 12px; align-items: center; padding: 9px 0; border-top: 1px solid var(--line); }
.count:first-child { border-top: 0; }
.count .n { font-family: var(--font-mono); font-size: 1.6rem; line-height: 1; color: var(--cyan); text-align: right; }
.count .n small { display: block; font-size: 0.62rem; letter-spacing: 0.12em; color: var(--muted); margin-top: 3px; }
.count.hard .n { color: var(--red); }
.count .lbl { font-size: 0.9rem; }
.count .lbl small { display: block; color: var(--muted); font-size: 0.8rem; }
.waiting { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 0.88rem; }
.waiting b { font-weight: 600; color: #c5a3ff; }

/* Capture */
.capture-grid { display: grid; grid-template-columns: minmax(0, 1fr) 15rem; gap: 14px; }
.drop-zone { position: relative; border: 1px dashed var(--line-strong); border-radius: 4px; background: rgba(7, 12, 22, 0.6); transition: border-color 0.15s ease, background 0.15s ease; }
.drop-zone.over { border-color: var(--cyan); background: var(--cyan-dim); }
#capText { width: 100%; min-height: 150px; resize: vertical; border: 0; background: transparent; padding: 14px 16px; line-height: 1.55; color: var(--text); }
#capText::placeholder { color: #5f7290; }
#capText:focus { outline: none; }
.drop-zone:focus-within { border-color: var(--cyan); }
.partial { color: var(--cyan); font-style: italic; font-size: 0.88rem; padding: 0 16px 10px; min-height: 0; }
.files { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 12px 12px; }
.file { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 3px; padding: 4px 6px 4px 4px; font-size: 0.8rem; max-width: 100%; background: var(--panel-solid); }
.file img { width: 34px; height: 34px; object-fit: cover; border-radius: 2px; }
.file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 14rem; }
.file button { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 2px 4px; }
.cap-side { display: flex; flex-direction: column; gap: 10px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 0.75rem; color: var(--muted); letter-spacing: 0.04em; }
select, input[type="date"], input[type="text"] { background: var(--panel-solid); border: 1px solid var(--line-strong); border-radius: 3px; padding: 6px 8px; min-height: 34px; width: 100%; }
.cap-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.cap-bar .spacer { flex: 1; }
.cap-note { font-size: 0.82rem; color: var(--muted); }
.cap-note.warn { color: var(--amber); }
.proposal { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.prop { display: grid; grid-template-columns: auto minmax(0, 1fr) 11rem 9.5rem; gap: 8px 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 4px; background: rgba(7, 12, 22, 0.55); }
.prop input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--cyan); }
.prop .why { grid-column: 2 / -1; color: var(--muted); font-size: 0.83rem; }

/* Projects board */
.board-wrap { overflow-x: auto; padding-bottom: 6px; }
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 1fr); gap: 14px; }
.col { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.col-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--line-strong); }
.col-head h3 { font-family: var(--font-display); font-weight: 600; font-size: 0.95rem; letter-spacing: 0.06em; }
.col-head small { display: block; color: var(--muted); font-size: 0.75rem; font-family: var(--font-body); letter-spacing: 0; }
.col.priority .col-head { border-bottom-color: var(--amber); }
.col.priority .col-head h3 { color: var(--amber); }
.col-head .n { font-family: var(--font-mono); color: var(--muted); font-size: 0.8rem; }
.task { display: flex; flex-direction: column; gap: 6px; padding: 10px 10px 8px; border: 1px solid var(--line); border-radius: 4px; background: rgba(7, 12, 22, 0.55); }
.task .t-title { font-size: 0.9rem; font-weight: 500; }
.task .bottom { display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap; }
.task .acts { gap: 4px; }
.split-hint { font-size: 0.78rem; color: var(--amber); }

/* Check-in */
.checkin-list { display: flex; flex-direction: column; gap: 8px; }
.ci { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 14px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 4px; background: rgba(7, 12, 22, 0.55); }

/* Meetings + inbox */
.meet { padding: 12px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.meet:first-child { border-top: 0; padding-top: 0; }
.meet h3 { font-size: 0.95rem; font-weight: 600; }
.meet .sum { font-size: 0.88rem; color: var(--text); max-width: 70ch; }
.meet ul { margin: 0; padding-left: 1.1rem; font-size: 0.86rem; color: var(--muted); }
.inb { padding: 10px 0; border-top: 1px solid var(--line); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; align-items: start; }
.inb:first-child { border-top: 0; padding-top: 0; }
.inb .pv { font-size: 0.86rem; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.inb .when { font-family: var(--font-mono); font-size: 0.75rem; color: var(--muted); }

.how { font-size: 0.86rem; color: var(--muted); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.how b { color: var(--text); font-weight: 600; display: block; margin-bottom: 2px; }

/* Toast */
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(18px + env(safe-area-inset-bottom, 0px)); background: var(--panel-solid); border: 1px solid var(--line-strong); border-radius: 4px; padding: 10px 12px 10px 16px; display: flex; align-items: center; gap: 14px; font-size: 0.88rem; z-index: 20; max-width: calc(100vw - 32px); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45); }

@media (max-width: 900px) {
  .row-1, .row-4 { grid-template-columns: minmax(0, 1fr); }
  .capture-grid { grid-template-columns: minmax(0, 1fr); }
  .cap-side { display: grid; grid-template-columns: 1fr 1fr; }
  .how { grid-template-columns: minmax(0, 1fr); }
  .prop { grid-template-columns: auto minmax(0, 1fr); }
  .prop select, .prop input[type="date"] { grid-column: 2; }
}
@media (max-width: 560px) {
  .greet { font-size: 1.35rem; }
  .ontable li { grid-template-columns: 1.8rem minmax(0, 1fr); }
  .ontable li .acts { grid-column: 2; justify-content: flex-start; }
  .ci { grid-template-columns: minmax(0, 1fr); }
  .ci .acts { justify-content: flex-start; }
  .panel { padding: 16px; }
  .cap-side { grid-template-columns: minmax(0, 1fr); }
}

/* Additions for the Flask app */
.mt0 { margin-top: 0 !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.ask { display: flex; gap: 8px; margin-top: 16px; }
.ask input { flex: 1; min-width: 0; }
.answer { margin-top: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 4px; background: rgba(7, 12, 22, 0.55); white-space: pre-wrap; font-size: 0.92rem; }
.answer.thinking { color: var(--muted); font-style: italic; }
.thumbs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.thumbs img { width: 56px; height: 56px; object-fit: cover; border-radius: 3px; border: 1px solid var(--line); }
.thumbs a.doc { font-size: 0.78rem; }
.inb .acts { flex-direction: column; align-items: flex-end; }
.inb .proposal { grid-column: 1 / -1; }
.src { font-family: var(--font-mono); font-size: 0.7rem; color: var(--muted); }
.login-wrap { min-height: 80vh; display: grid; place-items: center; }
.login { width: min(380px, 100%); display: flex; flex-direction: column; gap: 14px; }
.login input[type="password"] { background: var(--panel-solid); border: 1px solid var(--line-strong); border-radius: 3px; padding: 10px 12px; width: 100%; color: var(--text); }
.err { color: var(--red); font-size: 0.88rem; }

.ontable li.empty { display: block; border: 0; background: none; padding: 0; }
.ontable li.empty::before { content: none; }
.sources-line { margin-top: 10px; font-family: var(--font-mono); font-size: 0.74rem; color: var(--muted); }
.sources-line .on { color: var(--green); }
.sources-line .off { color: var(--muted); text-decoration: line-through; }
#refreshBtn[disabled] { opacity: 0.7; }

/* Arc-reactor emblem: three rings, the outer two turning slowly */
.reactor { position: relative; width: 40px; height: 40px; flex: none; }
.reactor i { position: absolute; border-radius: 50%; }
.reactor i:nth-child(1) { inset: 0; border: 2px dashed var(--cyan); opacity: 0.55; }
.reactor i:nth-child(2) { inset: 6px; border: 2px solid transparent; border-top-color: var(--cyan); border-bottom-color: var(--cyan); }
.reactor i:nth-child(3) { inset: 13px; background: radial-gradient(circle, #e8f8ff 0%, var(--cyan) 45%, rgba(92, 200, 255, 0) 75%); box-shadow: 0 0 14px var(--cyan); }
@media (prefers-reduced-motion: no-preference) {
  .reactor i:nth-child(1) { animation: spin 18s linear infinite; }
  .reactor i:nth-child(2) { animation: spin 6s linear infinite reverse; }
  .reactor i:nth-child(3) { animation: glow 3.2s ease-in-out infinite; }
  @keyframes spin { to { transform: rotate(360deg); } }
  @keyframes glow { 50% { box-shadow: 0 0 22px var(--cyan); } }
}
.chip.new { color: #04121f; background: var(--cyan); border-color: var(--cyan); font-weight: 600; }
.count.soon .n { color: var(--amber); }
.count.hard.soon .n { color: var(--red); }
@media (prefers-reduced-motion: no-preference) {
  .count.soon .n { animation: glow-text 2.4s ease-in-out infinite; }
  @keyframes glow-text { 50% { text-shadow: 0 0 12px currentColor; } }
}

/* Systems strip: one light per project */
.systems { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.sys { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; text-align: left; padding: 10px 12px 10px 30px; position: relative;
  background: var(--panel); border: 1px solid var(--line); border-radius: 4px; color: var(--text); cursor: pointer; min-width: 0; }
.sys:hover { border-color: var(--line-strong); }
.sys .light { position: absolute; left: 12px; top: 15px; width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); }
.sys.amber .light { background: var(--amber); box-shadow: 0 0 9px var(--amber); }
.sys.red .light { background: var(--red); box-shadow: 0 0 10px var(--red); }
.sys.red { border-color: rgba(255, 111, 94, 0.45); }
.sys-name { font-family: var(--font-display); font-weight: 600; letter-spacing: 0.06em; font-size: 0.86rem; }
.sys.priority .sys-name::after { content: " ★"; color: var(--amber); }
.sys-line { font-family: var(--font-mono); font-size: 0.72rem; color: var(--muted); }
.sys-next { font-size: 0.74rem; color: var(--cyan); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
@media (prefers-reduced-motion: no-preference) {
  .sys.red .light { animation: blink 1.6s ease-in-out infinite; }
  @keyframes blink { 50% { opacity: 0.35; } }
}
@media (max-width: 560px) { .systems { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
