/* Projects: the same strict terminal page as Maestro. One monospace face, one weight; hierarchy by colour and inverse video.
   Status colours follow the ANSI-256 palette: green done, yellow stale, red offline, blue in progress. */
:root {
  --bg: #000000;
  --fg: #c6c6c6;
  --hi: #f0f0f0;
  --dim: #767676;
  --line: #2b2b2b;
  --line-hi: #575757;
  --sel: #161616;
  --green: #5fd75f;
  --yellow: #ffaf00;
  --red: #ff5f5f;
  --blue: #5fafff;
  --magenta: #d787ff;
  --clawd: #d97757;
  --veil: rgba(0, 0, 0, .72);
  --font: "PT Mono", "Cascadia Mono", Consolas, "Courier New", monospace;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #ffffff;
  --fg: #2b2b2b;
  --hi: #000000;
  --dim: #6b6b6b;
  --line: #d6d6d6;
  --line-hi: #8c8c8c;
  --sel: #f0f0f0;
  --green: #16821b;
  --yellow: #9a5800;
  --red: #c12a2a;
  --blue: #1a5fb4;
  --magenta: #8034c0;
  --clawd: #c15f3c;
  --veil: rgba(0, 0, 0, .3);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); font: 14px/1.5 var(--font); }
button, input, select, textarea { font: inherit; color: inherit; }
b, strong { font-weight: 400; color: var(--hi); }
a { color: var(--blue); text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 1px solid var(--hi); outline-offset: 2px; }
.dim { color: var(--dim); }
.hi { color: var(--hi); }
.ok { color: var(--green); }
.warn { color: var(--yellow); }
.bad { color: var(--red); }
.info { color: var(--blue); }

/* keys: bordered, inverse when primary or hovered */
.key { background: none; border: 1px solid var(--line-hi); color: var(--hi); padding: 2px 10px; cursor: pointer; border-radius: 0; white-space: nowrap; }
.key:hover { background: var(--hi); color: var(--bg); border-color: var(--hi); }
.key.primary { background: var(--hi); color: var(--bg); border-color: var(--hi); }
.key.primary:hover { background: var(--bg); color: var(--hi); }
a.key { display: inline-block; text-decoration: none; }

/* ---------- status line ---------- */
.topbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 0; padding: 8px 16px; border-bottom: 1px solid var(--line); }
.brand { color: var(--hi); padding-right: 14px; white-space: nowrap; }
.segs { display: flex; flex-wrap: wrap; flex: 1; min-width: 0; gap: 4px 0; }
.seg { padding: 0 14px; border-left: 1px solid var(--line); white-space: nowrap; }
.seg b { font-variant-numeric: tabular-nums; }
.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
#clock { color: var(--hi); padding-left: 8px; font-variant-numeric: tabular-nums; }

/* ---------- panes: the title sits in the top border, as in tmux and lazygit ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 28px 20px; padding: 28px 16px 40px; align-items: stretch; }
.pane { position: relative; border: 1px solid var(--line); padding: 20px 16px 14px; min-width: 0; background: var(--bg); }
.pane > h2 { position: absolute; top: -11px; left: 12px; max-width: 60%; margin: 0; padding: 0 6px; background: var(--bg); color: var(--hi); font: inherit; line-height: 21px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pane-meta { position: absolute; top: -11px; right: 12px; max-width: calc(40% - 36px); padding: 0 6px; background: var(--bg); color: var(--dim); line-height: 21px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.note { color: var(--dim); margin: 10px 0 0; }
.empty { grid-column: 1 / -1; color: var(--dim); margin: 6px 0 2px; max-width: 72ch; }
.kv { display: flex; justify-content: space-between; gap: 12px; }
.kv > * { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kv > :first-child { flex: none; max-width: 45%; }
.kv b { font-variant-numeric: tabular-nums; text-align: right; }
.sub-h { color: var(--dim); margin: 14px 0 4px; }

/* ---------- project card ---------- */
.card { display: flex; flex-direction: column; cursor: pointer; }
.card:hover { border-color: var(--line-hi); }
.stage { margin: 0 0 10px; color: var(--fg); display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.desc { margin: 0 0 12px; display: -webkit-box; -webkit-line-clamp: 4; line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.card .row-btns { margin-top: auto; padding-top: 14px; }

/* ---------- meters ---------- */
.meter { display: grid; grid-template-columns: 9ch minmax(0, 1fr) 9ch; gap: 10px; align-items: center; }
.meter .num { text-align: right; color: var(--hi); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar { --c: var(--green); position: relative; height: 11px; border: 1px solid var(--line-hi); }
.bar.warn { --c: var(--yellow); } .bar.bad { --c: var(--red); } .bar.rel { --c: var(--blue); }
.bar i { position: absolute; inset: 1px auto 1px 1px; max-width: calc(100% - 2px); background: repeating-linear-gradient(90deg, var(--c) 0 6px, transparent 6px 8px); }
.tlist { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
.tlist li { display: grid; grid-template-columns: 2ch minmax(0, 1fr); gap: 1ch; }
.tlist .tt { overflow-wrap: anywhere; }

/* ---------- project drawer ---------- */
.drawer { position: fixed; inset: 0; z-index: 100; pointer-events: none; }
.veil { position: absolute; inset: 0; background: var(--veil); opacity: 0; transition: opacity .15s; }
.drawer.open { pointer-events: auto; }
.drawer.open .veil { opacity: 1; }
.drawer-in { position: absolute; top: 16px; right: 16px; bottom: 16px; width: min(560px, calc(100vw - 32px)); overflow-y: auto; border-color: var(--line-hi); transform: translateX(calc(100% + 24px)); transition: transform .2s ease-out; }
.drawer.open .drawer-in { transform: none; }
/* a scrolling dialog would clip a title sitting on the border, so its title sits inside */
.drawer-in > h2 { position: static; max-width: none; padding: 0 90px 0 0; margin: 0 0 6px; background: none; white-space: normal; overflow-wrap: anywhere; }
.drawer-in { padding-top: 14px; }
.x { position: absolute; top: 10px; right: 12px; }
.content { padding-top: 4px; }
.d-sec { margin-top: 16px; }
.d-sec h3 { margin: 0 0 4px; font: inherit; color: var(--hi); }
.d-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; border-left: 1px solid var(--line-hi); padding-left: 10px; }
.d-sec .kv > * { white-space: normal; overflow-wrap: anywhere; }
.row-btns { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 14px; }

.offline { position: fixed; left: 0; right: 0; bottom: 0; z-index: 120; background: var(--red); color: var(--bg); padding: 4px 16px; }

@media (max-width: 640px) {
  .topbar { padding-left: 12px; padding-right: 12px; }
  .segs { order: 3; flex-basis: 100%; }
  .seg:first-child { border-left: 0; padding-left: 0; }
  .cards { grid-template-columns: minmax(0, 1fr); padding: 28px 12px 32px; }
  .pane { padding: 20px 12px 12px; }
  .meter { grid-template-columns: 8ch minmax(0, 1fr) 8ch; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .001s !important; animation: none !important; }
}
