:root { --bg: #0f172a; --panel: #111c33; --text: #e2e8f0; --muted: #94a3b8; --pos: #10b981; --neg: #ef4444; --accent: #3b82f6; }
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--accent); text-decoration: none; }
.topbar { display: flex; align-items: center; gap: 1rem; padding: 0.8rem 1.5rem; background: #0b1224; border-bottom: 1px solid #1e293b; }
.brand { font-weight: 700; color: var(--text); margin-right: auto; }
.logout button, .ranges button, form button { background: #1e293b; color: var(--text); border: 1px solid #334155; border-radius: 6px; padding: 0.35rem 0.8rem; cursor: pointer; }
.ranges button.active { background: var(--accent); border-color: var(--accent); }
.container { max-width: 1200px; margin: 0 auto; padding: 1.5rem; }
h1 { margin: 0 0 1rem; }
h2 { font-size: 1.1rem; margin: 0 0 0.8rem; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0.8rem; }
.kpi { background: var(--panel); border: 1px solid #1e293b; border-radius: 10px; padding: 0.9rem; }
.kpi span { display: block; color: var(--muted); font-size: 0.85rem; }
.kpi strong { font-size: 1.3rem; }
.panel { background: var(--panel); border: 1px solid #1e293b; border-radius: 10px; padding: 1rem; margin-top: 1.2rem; overflow-x: auto; }
.panel-head { display: flex; justify-content: space-between; align-items: center; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0.8rem; }
.card { display: block; background: #0b1224; border: 1px solid #1e293b; border-radius: 10px; padding: 0.9rem; color: var(--text); }
.card:hover { border-color: var(--accent); }
.card h3 { margin: 0 0 0.5rem; font-size: 1rem; }
.card p { margin: 0.25rem 0; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: right; padding: 0.45rem 0.6rem; border-bottom: 1px solid #1e293b; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { color: var(--muted); font-weight: 600; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.muted { color: var(--muted); }
.small { font-size: 0.8rem; font-weight: normal; }
.badge { font-size: 0.7rem; padding: 0.1rem 0.4rem; border-radius: 4px; margin-left: 0.4rem; }
.badge.stale { background: #7c2d12; color: #fed7aa; }
.login-card { max-width: 360px; margin: 4rem auto; background: var(--panel); border: 1px solid #1e293b; border-radius: 10px; padding: 1.5rem; }
.login-card label { display: block; margin-bottom: 0.4rem; color: var(--muted); }
.login-card input { width: 100%; padding: 0.55rem; border-radius: 6px; border: 1px solid #334155; background: #0b1224; color: var(--text); margin-bottom: 1rem; }
.login-card button { width: 100%; background: var(--accent); border-color: var(--accent); padding: 0.55rem; }
.error { color: var(--neg); }
.footer { text-align: center; color: var(--muted); font-size: 0.8rem; padding: 2rem 0; }
.dashboard-tabs { display:flex; gap:.5rem; padding:.7rem 1.5rem; border-bottom:1px solid #1e293b; }
.dashboard-tabs a { padding:.45rem .85rem; border-radius:6px; color:var(--muted); }
.dashboard-tabs a.active { background:var(--accent); color:white; }
.activity-controls { display:flex; gap:.8rem; align-items:end; flex-wrap:wrap; }
.activity-controls label { display:flex; flex-direction:column; gap:.35rem; font-size:.85rem; }
.activity-controls input,.activity-controls select { padding:.5rem; color:var(--text); background:#1e293b; border:1px solid #334155; border-radius:6px; max-width:280px; }
.activity-controls button,.fill-toggle,#load-older { background:#1e293b; color:var(--text); border:1px solid #334155; padding:.45rem .7rem; border-radius:6px; cursor:pointer; }
.fill-toggle { font-weight:600; margin-bottom:.3rem; }
.fill-details { text-align:left; white-space:normal; padding:.5rem; overflow-wrap:anywhere; }
.health-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(240px,1fr)); gap:.7rem; }
.health-card { padding:.7rem; background:#0b1224; border-radius:6px; }
.warning,.status.deferred,.status.attention_required { color:#fbbf24; }
.status.hedged { color:var(--pos); }
[hidden] { display:none !important; }
@media(max-width:600px) { .topbar { padding:.8rem; flex-wrap:wrap; } .container { padding:.8rem; } .dashboard-tabs { padding:.6rem .8rem; } .activity-controls label { flex:1 1 150px; } .activity-controls input,.activity-controls select { width:100%; } }

.collection-health summary { cursor:pointer; font-weight:600; }
.collection-health[open] .health-grid { margin-top:.9rem; }
/* Each order reads as a sentence, with its latest-fill time at the end. */
.activity-feed { list-style:none; margin:0; padding:0; }
.activity-item { padding:1rem 0; border-bottom:1px solid #334155; }
.activity-item:last-child { border-bottom:0; }
.activity-line { display:flex; align-items:baseline; gap:1.5rem; }
.activity-sentence.fill-toggle { flex:1; min-width:0; margin:0; padding:0; border:0; border-radius:3px; background:transparent; color:var(--text); font:inherit; text-align:left; line-height:1.7; overflow-wrap:anywhere; cursor:pointer; }
.activity-sentence:hover { color:#fff; }
.activity-sentence:focus-visible { outline:2px solid var(--accent); outline-offset:5px; }
.activity-time { flex:none; white-space:nowrap; font-size:.85rem; text-align:right; }
.activity-item .fill-details { margin-top:.7rem; padding:.8rem 1rem; background:#0b1224; border-radius:6px; }
@media(max-width:600px) {
  .activity-line { flex-wrap:wrap; gap:.35rem; }
  .activity-sentence.fill-toggle { flex-basis:100%; }
  .activity-time { margin-left:auto; }
}
/* Diagnostics retain readable columns on narrow screens. */
.diagnostics-table-wrap { overflow-x:auto; max-width:100%; }
.diagnostics-card { margin-bottom:1rem; min-width:0; overflow-wrap:anywhere; }
