/* Colour and type are the web app's tokens (projects/ores.web/packages/web/src/styles.css),
   so the prototype is judged on its words and structure and not on a new look. Dark only, as the product is. */
:root {
  color-scheme: dark;
  --bg: #121214;
  --raised: #1a1a1e;
  --overlay: #26262b;
  --line-subtle: #21262d;
  --line: #30363d;
  --line-strong: #4a5568;
  --ink: #e3e3e6;
  --ink-muted: #a1a1aa;
  --ink-faint: #71717a;
  --ink-inverse: #0d1117;
  --accent: #58a6ff;
  --accent-bright: #8ab4f8;
  --accent-dim: #202835;
  --accent-line: #26364b;
  --up: #3fb950;
  --down: #f85149;
  --warn: #d29922;
  --stale: #e3b341;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --radius: 0.5rem;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { background: var(--bg); color: var(--ink); }
body { margin: 0; font: 14px/1.5 var(--sans); padding-bottom: 6rem; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-bright); text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 1.375rem; display: flex; align-items: center; gap: 0.625rem; }
h2 { font-size: 1rem; }
h3 { font-size: 0.875rem; }
h4 { font-size: 0.8125rem; }
p { margin: 0; }
.muted { color: var(--ink-muted); }
.faint { color: var(--ink-faint); }
.mono { font-family: var(--mono); font-size: 12px; }
.num { font-variant-numeric: tabular-nums; text-align: right; }
.small { font-size: 12px; }

/* The shell */
.top { position: sticky; top: 0; z-index: 5; background: var(--raised); border-bottom: 1px solid var(--line); }
.top-inner { max-width: 86rem; margin: 0 auto; padding: 0.5rem 1.25rem; display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; }
.brand { font-weight: 700; display: flex; align-items: center; gap: 0.5rem; white-space: nowrap; }
.brand-mark { width: 1.25rem; height: 1.25rem; border-radius: 50%; background: linear-gradient(135deg, var(--accent), #1f6feb); }
.tenant { color: var(--ink-muted); }
.menu { display: flex; gap: 0.25rem; flex: 1; flex-wrap: wrap; }
.menu span { padding: 0.375rem 0.625rem; border-radius: 6px; color: var(--ink-muted); }
.menu span[aria-current="page"] { color: var(--ink); background: var(--overlay); }
.me { width: 1.75rem; height: 1.75rem; border-radius: 50%; background: var(--accent-dim); color: var(--accent-bright); display: grid; place-items: center; font-size: 11px; font-weight: 700; }

main { max-width: 86rem; margin: 0 auto; padding: 1.25rem 1.25rem 2rem; display: grid; gap: 1rem; }
.crumbs { font-size: 12px; color: var(--ink-faint); display: flex; gap: 0.375rem; flex-wrap: wrap; }
.crumbs a { color: var(--accent); }
.head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.head > .titles { display: grid; gap: 0.25rem; min-width: 0; }
.lead { color: var(--ink-muted); }
.actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; justify-content: flex-end; }
.actions-col { display: grid; gap: 0.25rem; justify-items: end; }
.loaded { font-family: var(--mono); font-size: 11px; color: var(--ink-faint); }
.loaded.stale { color: var(--stale); }
.btn { display: inline-flex; align-items: center; gap: 0.4rem; border: 1px solid var(--line); background: var(--raised); padding: 0.4375rem 0.875rem; border-radius: 6px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--line-strong); background: var(--overlay); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--ink-inverse); font-weight: 600; }
.btn.primary:hover { background: var(--accent-bright); border-color: var(--accent-bright); }
.btn.danger { color: var(--down); }
.btn.gold { border-color: var(--stale); color: var(--stale); }
.btn.ghost { border-color: transparent; background: none; padding: 0.25rem 0.5rem; }
.btn.sm { padding: 0.25rem 0.625rem; font-size: 13px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; pointer-events: none; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 4rem; z-index: 30; }
.icon { width: 1em; height: 1em; display: inline-block; }
.mark { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 12px; padding: 0.125rem 0.625rem; border-radius: 999px; border: 1px solid var(--accent-line); background: var(--accent-dim); color: var(--accent-bright); }
.mark.ro { border-color: var(--line); background: var(--overlay); color: var(--ink-muted); }
.flag { display: inline-grid; place-items: center; width: 2.125rem; height: 1.5rem; border-radius: 3px; background: var(--overlay); border: 1px solid var(--line); font-size: 10px; font-weight: 700; color: var(--ink-muted); letter-spacing: 0.04em; flex: none; }
.flag.sm { width: 1.5rem; height: 1.0625rem; font-size: 8px; }
.card { background: var(--raised); border: 1px solid var(--line); border-radius: var(--radius); }
.pad { padding: 1rem 1.25rem; }
.notice { border: 1px solid var(--line); background: var(--raised); border-radius: 6px; padding: 0.625rem 0.875rem; font-size: 13px; color: var(--ink-muted); }
.notice.info { border-color: var(--accent-line); background: var(--accent-dim); color: var(--ink); }
.notice.warn { border-color: #6b4e12; background: #2a2008; color: #f2cc60; }
.notice.ok { border-color: #1f5d2b; background: #12361d; color: #7ee787; }
.notice.error { border-color: #7a2a28; background: #2a1414; color: #ffb4ad; }

/* Lists and tables */
.toolbar { display: flex; gap: 0.5rem; align-items: center; padding: 0.75rem; border-bottom: 1px solid var(--line); }
.search { flex: 1; display: flex; align-items: center; gap: 0.5rem; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 0.4375rem 0.75rem; color: var(--ink-faint); }
.search input { flex: 1; background: none; border: 0; outline: none; color: var(--ink); }
.search button { background: none; border: 0; color: var(--ink-muted); cursor: pointer; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-weight: 500; color: var(--ink-muted); font-size: 12px; padding: 0.625rem 1rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
th button { background: none; border: 0; padding: 0; color: inherit; cursor: pointer; font: inherit; }
th button[aria-sort] { color: var(--ink); }
td { padding: 0.625rem 1rem; border-bottom: 1px solid var(--line-subtle); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.open { cursor: pointer; }
tbody tr.open:hover { background: #1f1f24; }
td.code { font-family: var(--mono); font-size: 12px; }
td.actions-cell { white-space: nowrap; text-align: right; }
td.actions-cell .btn { margin-left: 0.25rem; }
.cell-flag { display: inline-flex; align-items: center; gap: 0.5rem; }
.foot { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; padding: 0.625rem 1rem; font-size: 13px; color: var(--ink-muted); flex-wrap: wrap; border-top: 1px solid var(--line); }
.pager { display: flex; gap: 0.375rem; align-items: center; }
.pager select { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 0.25rem 0.5rem; }
.empty { padding: 1rem; color: var(--ink-muted); font-size: 13px; display: flex; gap: 1rem; align-items: center; }
.under { padding: 0.75rem 1rem; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.badge { display: inline-flex; font-size: 11px; padding: 0.0625rem 0.5rem; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-muted); white-space: nowrap; }
.badge.holiday { border-color: #6b4e12; color: #f2cc60; background: #2a2008; }
.badge.business { border-color: #1f5d2b; color: #7ee787; background: #12361d; }

/* Tabs and details */
.tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tabs a { background: none; border: 0; border-bottom: 2px solid transparent; padding: 0.5rem 0.75rem; color: var(--ink-muted); margin-bottom: -1px; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
dl { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.25rem 1.5rem; margin: 0; }
@media (max-width: 64rem) { dl { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 40rem) { dl { grid-template-columns: 1fr; } }
dt { font-size: 12px; color: var(--ink-muted); }
dd { margin: 0.125rem 0 0; }
dd .help { display: block; font-size: 12px; color: var(--ink-faint); margin-top: 0.125rem; }
.last-changed { border-top: 1px solid var(--line); padding: 0.75rem 1.25rem; font-size: 13px; color: var(--ink-muted); }
.last-changed .mono { color: var(--ink); }

/* Business days */
.days-bar { display: flex; gap: 1rem; align-items: flex-end; flex-wrap: wrap; }
.days-bar .stepper { padding-bottom: 0.25rem; }
.stepper { display: inline-flex; align-items: center; gap: 0.25rem; }
.stepper .year { min-width: 3.5rem; text-align: center; font-weight: 500; }
.field { display: grid; gap: 0.375rem; }
.field > label, .field > .label { font-size: 13px; color: var(--ink-muted); }
.field input, .field select, .field textarea { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 0.4375rem 0.625rem; }
.field input[readonly] { color: var(--ink-faint); }
.field .help { font-size: 12px; color: var(--ink-faint); }
.field .error { font-size: 12px; color: var(--down); }
.field.w-18 { width: 18rem; }
.months { display: grid; gap: 0.75rem; grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 64rem) { .months { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 40rem) { .months { grid-template-columns: 1fr; } }
.month { border: 1px solid var(--line); border-radius: 6px; padding: 0.75rem; display: grid; gap: 0.375rem; align-content: start; }
.month ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.25rem; }
.month li { display: grid; grid-template-columns: 1.75rem 1fr auto; gap: 0.5rem; font-size: 12px; align-items: baseline; }
.month li .d { font-family: var(--mono); color: var(--ink-muted); }
.month li.other .w { color: var(--ink-muted); font-style: italic; }
.month li.unbuilt .w { color: var(--warn); }
.month li.business .w { color: #7ee787; }
.month li .from { font-size: 11px; color: var(--ink-faint); white-space: nowrap; }

/* History: the shared timeline, the chart then the rail */
.timeline { display: grid; gap: 1rem; }
.tl-bar { display: flex; justify-content: flex-end; }
.chart { padding: 0.75rem 1rem; display: grid; gap: 0.5rem; }
.bars { display: flex; gap: 0.25rem; align-items: flex-end; height: 5rem; overflow-x: auto; border-bottom: 1px solid var(--line); padding-bottom: 0.25rem; }
.bar { width: 0.75rem; flex: none; display: flex; flex-direction: column-reverse; height: calc(100% * var(--n) / var(--max)); gap: 1px; }
.bar span { display: block; min-height: 2px; border-radius: 1px; }
.chart-foot { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-faint); }
.legend { display: flex; gap: 1rem; font-size: 12px; color: var(--ink-muted); }
.legend i { display: inline-block; width: 0.5rem; height: 0.5rem; border-radius: 50%; margin-right: 0.375rem; }
.entries { list-style: none; margin: 0; padding: 0; display: grid; }
.entries .day { font-size: 11px; letter-spacing: 0.06em; color: var(--ink-faint); padding: 0.5rem 0 0.5rem 9.5rem; }
.entry { display: grid; grid-template-columns: 7.5rem 1.5rem 1fr; }
.entry .gutter { display: flex; justify-content: flex-end; align-items: flex-start; gap: 0.375rem; padding: 0.4rem 0.5rem 0 0; font-size: 11.5px; color: var(--ink-faint); }
.entry .current { color: var(--up); font-size: 12px; }
.entry .rail { position: relative; display: flex; justify-content: center; }
.entry .rail::before { content: ''; position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line); }
.entry .dot { position: relative; z-index: 1; margin-top: 0.55rem; width: 9px; height: 9px; border-radius: 50%; border: 1px solid var(--accent); background: var(--bg); }
.entry .body { display: grid; gap: 0.375rem; padding: 0.25rem 0 1rem 0.5rem; min-width: 0; }
.entry-head { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; font-size: 13px; }
.entry-head .when { margin-left: auto; }
.avatar { width: 1.75rem; height: 1.75rem; border-radius: 50%; background: var(--overlay); border: 1px solid var(--line); display: grid; place-items: center; font-size: 10px; font-weight: 700; color: var(--ink-muted); flex: none; }
.avatar.service { font-size: 13px; color: var(--ink-faint); }
.kind { display: inline-flex; font-size: 11px; padding: 0 0.5rem; border-radius: 999px; border: 1px solid; }
.reason { font-family: var(--mono); font-size: 11px; padding: 0 0.4rem; border-radius: 4px; border: 1px solid #6b4e12; color: #f2cc60; background: #2a2008; }
.actor { font-weight: 600; }
.entry .note { font-size: 13px; color: var(--ink-muted); font-style: italic; }
details summary { cursor: pointer; font-size: 13px; color: var(--ink-muted); }
details summary:hover { color: var(--ink); }
table.changes { width: auto; min-width: 24rem; margin-top: 0.375rem; font-size: 13px; }
table.changes th, table.changes td { padding: 0.25rem 0.75rem; }
table.changes td.old { background: rgba(248, 81, 73, 0.15); }
table.changes td.new { background: rgba(46, 160, 67, 0.15); }
.entry-actions { display: flex; justify-content: flex-end; }

/* Dialog */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: grid; place-items: center; padding: 1rem; z-index: 20; }
.dialog { width: min(48rem, 100%); max-height: calc(100vh - 2rem); overflow: auto; background: var(--raised); border: 1px solid var(--line); border-radius: var(--radius); display: grid; }
.dialog.narrow { width: min(32rem, 100%); }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); gap: 1rem; }
.dialog-head h2 { font-size: 1rem; }
.dialog-head .loaded { margin-top: 0.125rem; }
.dialog-head .x { background: none; border: 0; color: var(--ink-muted); cursor: pointer; font-size: 1rem; }
.dialog-body { padding: 1.25rem; display: grid; gap: 1rem; }
.form-grid { display: grid; gap: 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 40rem) { .form-grid { grid-template-columns: 1fr; } }
.form-grid .span { grid-column: 1 / -1; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 0.5rem; padding: 0.875rem 1.25rem; border-top: 1px solid var(--line); }
.still { font-size: 12px; color: var(--ink-faint); }
.guard { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; background: rgba(0,0,0,0.5); }
.guard .box { background: var(--overlay); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; display: grid; gap: 1rem; width: min(26rem, calc(100% - 2rem)); }

/* The prototype's own bar, not part of the product */
.proto { position: fixed; left: 0; right: 0; bottom: 0; background: #0b0b0d; border-top: 1px dashed var(--line-strong); padding: 0.5rem 1.25rem; z-index: 10; }
.proto-inner { max-width: 86rem; margin: 0 auto; display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: center; font-size: 12px; color: var(--ink-faint); }
.proto strong { color: var(--warn); letter-spacing: 0.06em; }
.proto .seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.proto .seg a { padding: 0.25rem 0.625rem; color: var(--ink-muted); }
.proto .seg a:hover { text-decoration: none; color: var(--ink); }
.proto .seg a[aria-pressed="true"] { background: var(--overlay); color: var(--ink); }
.footer-chips { display: flex; gap: 0.5rem; flex-wrap: wrap; font-size: 11px; color: var(--ink-faint); }
.footer-chips span { border: 1px solid var(--line); border-radius: 999px; padding: 0 0.5rem; }
