/* Self-contained: no CDN, no external fonts. Production connectivity is not assumed. */
:root {
    --bg: #f6f7f9;
    --panel: #ffffff;
    --ink: #1c2024;
    --muted: #6b7280;
    --line: #dfe3e8;
    --accent: #1f5fa9;
    --open: #ffc000;      /* amber — row carries an open question */
    --settled: #ffff00;   /* yellow — settled. Same semantics as the workbook. */
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font: 14px/1.45 "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
    color: var(--ink);
    background: var(--bg);
}

.topbar {
    display: flex; align-items: center; gap: 1.5rem;
    padding: 0 1rem; height: 48px;
    background: var(--ink); color: #fff;
}
.topbar .brand { font-weight: 600; color: #fff; text-decoration: none; letter-spacing: .02em; }
.topbar nav { display: flex; gap: 1rem; }
.topbar nav a { color: #cfd6dd; text-decoration: none; }
.topbar nav a:hover { color: #fff; }
.topbar .env { margin-left: auto; color: #8a949e; font-size: 12px; }

main { padding: 1.25rem; }
footer { padding: 1rem; color: var(--muted); font-size: 12px; }

h1 { font-size: 20px; margin: 0 0 .25rem; }
h2 { font-size: 15px; margin: 1.5rem 0 .5rem; }
.sub { color: var(--muted); margin: 0 0 1rem; }

.panel {
    background: var(--panel); border: 1px solid var(--line);
    border-radius: 6px; padding: 1rem; margin-bottom: 1rem;
}

table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #eef1f4; font-weight: 600; position: sticky; top: 0; z-index: 1; }
tbody tr:hover { background: #f0f5fb; }

/* Status fills carry the same meaning as in the workbook, and are driven by data. */
td.status-open    { border-left: 4px solid var(--open); }
td.status-settled { border-left: 4px solid var(--settled); }

.pill {
    display: inline-block; padding: 1px 7px; border-radius: 10px;
    font-size: 11px; background: #eceff3; color: #45505c; border: 1px solid var(--line);
}
.pill.warn { background: #fff4d6; border-color: #f0d089; color: #6b4e00; }
.pill.miss { background: #ffe9e6; border-color: #f2b6ac; color: #8a2c1b; }

.filters { display: flex; gap: .5rem; flex-wrap: wrap; align-items: flex-end; margin-bottom: .75rem; }
.filters label { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); gap: 2px; }
select, input[type=text], textarea {
    font: inherit; padding: 5px 7px; border: 1px solid var(--line); border-radius: 4px; background: #fff;
}
button, .btn {
    font: inherit; padding: 6px 12px; border: 1px solid var(--accent);
    background: var(--accent); color: #fff; border-radius: 4px; cursor: pointer; text-decoration: none;
}
button.secondary { background: #fff; color: var(--accent); }
button:disabled { opacity: .5; cursor: default; }

.cards { display: flex; gap: .75rem; flex-wrap: wrap; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: .75rem 1rem; min-width: 150px; }
.card .n { font-size: 22px; font-weight: 600; }
.card .k { color: var(--muted); font-size: 12px; }

.route { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.route .stage { background: #fff; border: 1px solid var(--line); border-radius: 4px; padding: .4rem .7rem; }
.route .stage.holder { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.route .arrow { color: var(--muted); }

.empty { color: var(--muted); font-style: italic; }
.note { background: #f4f7fb; border-left: 3px solid var(--accent); padding: .5rem .75rem; margin: .5rem 0; font-size: 13px; }
.mono { font-family: Consolas, "Cascadia Mono", monospace; font-size: 12px; }
.scroll { max-height: 70vh; overflow: auto; }

/* --- workbench additions --- */
textarea[data-field=logic] { width: 100%; min-width: 220px; font: inherit; }
td.actions { white-space: nowrap; }
td.actions button { margin-right: 3px; }
tr.saved td:first-child { box-shadow: inset 3px 0 0 #2e7d32; }
tr.conflict td:first-child { box-shadow: inset 3px 0 0 #c62828; }
.btn.secondary-link { background: #fff; color: var(--accent); }

.pager { display: flex; gap: 4px; flex-wrap: wrap; margin: .5rem 0 1rem; }
.pager a {
    padding: 3px 9px; border: 1px solid var(--line); border-radius: 4px;
    background: #fff; color: var(--accent); text-decoration: none; font-size: 13px;
}
.pager a.on { background: var(--accent); color: #fff; border-color: var(--accent); }

.drawer {
    position: fixed; right: 0; top: 48px; bottom: 0; width: 420px; max-width: 92vw;
    background: #fff; border-left: 1px solid var(--line); box-shadow: -4px 0 16px rgba(0,0,0,.08);
    padding: 1rem; overflow: auto; z-index: 20;
}
.drawer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .75rem; }
.ann { border: 1px solid var(--line); border-radius: 5px; padding: .5rem .6rem; margin-bottom: .5rem; background: #fbfcfd; }
.ann-head { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; margin-bottom: .3rem; font-size: 12px; }
.ann-head .k { color: var(--muted); }
#annotate textarea { width: 100%; margin-bottom: .5rem; }

.whoami { display: flex; align-items: center; gap: .4rem; margin-left: auto; font-size: 12px; }
.whoami input { padding: 2px 6px; font-size: 12px; width: 120px; }
.whoami button { padding: 2px 8px; font-size: 12px; }
.topbar nav .sep { color: #4a545e; }
form p { margin: .5rem 0; }
form input[type=text], form select { min-width: 200px; }

/* Prototype is framed, not inlined: it styles :root/*/body and reuses .topbar/.mono. */
.proto-frame {
    width: 100%; height: 78vh; border: 1px solid var(--line);
    border-radius: 6px; background: #fff;
}
