/* ============================================================
   Terminal — Linear-inspired dark design system
   - Near-black canvas, luminance-stepped surfaces
   - Whisper-thin white borders (rgba 255,255,255)
   - Inter w/ cv01,ss03; weights 400 / 510 / 590
   - Single indigo accent for interactive only
   ============================================================ */
:root {
  /* surfaces (Linear luminance steps) */
  --bg:        #08090a;
  --panel:     #0f1011;
  --surface:   rgba(255,255,255,0.02);
  --surface-2: rgba(255,255,255,0.04);
  --surface-3: rgba(255,255,255,0.05);
  --elevated:  #191a1b;

  /* borders (whisper white) */
  --border:        rgba(255,255,255,0.08);
  --border-subtle: rgba(255,255,255,0.05);
  --border-solid:  #23252a;

  /* text (cool grays) */
  --text:      #f7f8f8;
  --text-2:    #d0d6e0;
  --muted:     #8a8f98;
  --muted-2:   #62666d;

  /* accent — Linear indigo-violet, interactive only */
  --accent:     #5e6ad2;
  --accent-hi:  #7170ff;
  --accent-hov: #828fff;

  /* status */
  --ok:   #10b981;
  --bad:  #f87171;
  --warn: #fbbf24;
  --info: #60a5fa;

  --radius:    8px;
  --radius-lg: 12px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  /* publication fonts for the news briefing */
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: Georgia, "Times New Roman", Cambria, "Liberation Serif", serif;

  font-feature-settings: "cv01", "ss03";
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font-family: var(--font); background: var(--bg); color: var(--text);
  font-size: 14px; line-height: 1.6; -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility; font-feature-settings: "cv01", "ss03";
}
a { color: var(--accent-hi); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); background: var(--surface-3); padding: 1px 6px; border-radius: 5px; font-size: .85em; color: var(--text); }
.mono { font-family: var(--mono); }

/* layout */
.app { display: grid; grid-template-columns: 240px 1fr; min-height: calc(100vh - 45px); }

/* ---------------- sidebar ---------------- */
.side {
  background: var(--panel); border-right: 1px solid var(--border-subtle);
  padding: 20px 14px; display: flex; flex-direction: column; gap: 22px;
  position: sticky; top: 0; height: calc(100vh - 45px);
}
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 6px; }
.logo { width: 30px; height: 30px; flex: none; }
.brand-text { line-height: 1.25; }
.brand-name { font-weight: 590; letter-spacing: .12em; font-size: 13px; color: var(--text); }
.brand-sub { color: var(--muted-2); font-size: 11px; margin-top: 1px; }

.nav { display: flex; flex-direction: column; gap: 1px; }
.nav-item {
  background: transparent; border: 0; color: var(--muted); padding: 7px 10px;
  border-radius: 6px; cursor: pointer; font-size: 13.5px; font-weight: 510;
  text-align: left; transition: background .15s, color .15s; font-family: var(--font);
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--surface-3); color: var(--text); }

.side-section { flex: 1; overflow: auto; margin: 0 -4px; padding: 0 4px; }
.side-label {
  color: var(--muted-2); font-size: 11px; text-transform: uppercase;
  letter-spacing: .12em; margin: 4px 8px 10px; font-weight: 510;
}
.joblist { display: flex; flex-direction: column; gap: 1px; }
.job-row {
  display: flex; align-items: center; gap: 9px; padding: 7px 10px; border-radius: 6px;
  cursor: pointer; font-size: 13px; color: var(--text-2); transition: background .15s;
}
.job-row:hover { background: var(--surface-2); }
.job-row .dot { width: 6px; height: 6px; border-radius: 50%; flex: none; }
.job-row .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-row .ct { margin-left: auto; color: var(--muted-2); font-size: 11px; font-family: var(--mono); }

.side-foot {
  display: flex; align-items: center; gap: 8px; color: var(--muted-2);
  font-size: 11.5px; font-family: var(--mono); border-top: 1px solid var(--border-subtle); padding-top: 13px;
}
.dot-live { width: 6px; height: 6px; border-radius: 50%; background: var(--accent-hi); box-shadow: 0 0 7px var(--accent-hi); }

/* ---------------- main ---------------- */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  padding: 26px 32px 18px; border-bottom: 1px solid var(--border-subtle);
}
.topbar h1 { margin: 0; font-size: 22px; font-weight: 510; letter-spacing: -0.02em; }
.sub { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.topbar-right { display: flex; gap: 9px; align-items: center; }

.search {
  background: var(--surface-3); border: 1px solid var(--border); color: var(--text);
  border-radius: 6px; padding: 7px 12px; font-size: 13px; width: 200px; outline: none;
  font-family: var(--font); transition: border-color .15s, box-shadow .15s;
}
.search::placeholder { color: var(--muted-2); }
.search:focus { border-color: var(--accent-hi); box-shadow: 0 0 0 3px rgba(113,112,255,.18); }

.btn {
  background: var(--accent); color: #fff; border: 0; border-radius: 6px;
  padding: 7px 14px; font-weight: 510; cursor: pointer; font-size: 13px; font-family: var(--font);
  transition: background .15s;
}
.btn:hover { background: var(--accent-hov); }
.btn.ghost { background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border); font-weight: 510; }
.btn.ghost:hover { color: var(--text); border-color: var(--accent-hi); background: var(--surface-2); }

/* stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(124px, 1fr)); gap: 10px; padding: 20px 32px 6px; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 15px 16px;
}
.stat .num { font-size: 24px; font-weight: 590; letter-spacing: -.02em; line-height: 1; }
.stat .lbl { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; margin-top: 7px; font-weight: 510; }
.stat.accent-ok   .num { color: var(--ok); }
.stat.accent-bad  .num { color: var(--bad); }
.stat.accent-info .num { color: var(--info); }
.stat.accent-warn .num { color: var(--warn); }
.stat.accent-teal .num { color: var(--accent-hi); }

/* content */
.content { padding: 16px 32px 32px; }
.view { animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: none; } }

/* feed cards */
.feedlist { display: grid; gap: 10px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; transition: border-color .15s, background .15s;
}
.card:hover { border-color: var(--border); background: var(--surface-2); }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; }
.card .title { font-size: 14.5px; font-weight: 590; letter-spacing: -.01em; }
.card .time { color: var(--muted-2); font-size: 12px; white-space: nowrap; font-family: var(--mono); }
.card .meta { color: var(--muted); font-size: 12px; margin: 9px 0 10px; display: flex; gap: 14px; flex-wrap: wrap; }
.card .meta .k { color: var(--muted-2); }
.card .snippet { color: var(--text-2); font-size: 13px; opacity: .9; margin-bottom: 13px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card .actions { display: flex; gap: 8px; }

/* overview card (World Briefing) — calm, single-glance row */
.card.ov { padding: 16px 20px; }
.ov-mini { display: flex; align-items: flex-start; gap: 13px; margin-top: 11px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; flex: none;
  padding: 4px 11px; border-radius: 999px; font-size: 11.5px; font-weight: 590; letter-spacing: .03em;
  border: 1px solid var(--border-subtle); color: var(--muted); background: var(--surface);
}
.chip .cdot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted-2); }
.chip-critical { color: #ff7b74; border-color: rgba(255,86,77,.40); }
.chip-critical .cdot { background: #ff564d; }
.chip-high { color: #ffb259; border-color: rgba(255,156,46,.34); }
.chip-high .cdot { background: #ff9c2e; }
.chip-elevated { color: var(--accent); border-color: rgba(74,222,128,.30); }
.chip-elevated .cdot { background: var(--accent); }
.sitrep-mini { font-size: 13px; line-height: 1.5; color: var(--text-2); }

/* markdown body */
.full { margin-top: 14px; border-top: 1px solid var(--border-subtle); padding-top: 14px; font-size: 13.5px; color: var(--text-2); }
.full h1, .full h2, .full h3, .full h4 { margin: 15px 0 7px; line-height: 1.35; color: var(--text); }
.full h1 { font-size: 18px; font-weight: 590; } .full h2 { font-size: 16px; font-weight: 590; } .full h3 { font-size: 14px; font-weight: 590; }
.full p { margin: 8px 0; }
.full ul, .full ol { margin: 8px 0; padding-left: 22px; } .full li { margin: 3px 0; }
.full code { font-family: var(--mono); }
.full pre {
  background: #0a0b0e; border: 1px solid var(--border); border-radius: 8px; padding: 13px;
  overflow: auto; white-space: pre-wrap; word-break: break-word; font-size: 12.5px; color: #c3e9d2; font-family: var(--mono);
}
.full table { border-collapse: collapse; width: 100%; margin: 11px 0; font-size: 12.5px; }
.full th, .full td { border: 1px solid var(--border); padding: 7px 11px; text-align: left; }
.full th { background: var(--elevated); color: var(--text); font-weight: 510; }
.full tr:nth-child(even) td { background: rgba(255,255,255,.02); }

/* jobs grid */
.jobgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.jcard {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px;
}
.jcard .jname { font-size: 14px; font-weight: 590; letter-spacing: -.01em; margin-bottom: 5px; padding-right: 70px; }
.jcard .jsched { color: var(--muted); font-size: 12px; margin-bottom: 15px; display: flex; align-items: center; gap: 7px; }
.jcard .jstats { display: flex; gap: 24px; margin-bottom: 15px; }
.jcard .jstats .v { font-size: 18px; font-weight: 590; letter-spacing: -.02em; }
.jcard .jstats .l { color: var(--muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; margin-top: 3px; font-weight: 510; }
.jcard .jmeta { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  background: var(--surface-3); border: 1px solid var(--border); border-radius: 999px;
  padding: 3px 10px; font-size: 11px; color: var(--muted);
}
.tag.sk { color: var(--accent-hi); border-color: rgba(113,112,255,.3); }

/* history table */
.histtable {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
}
.histtable table { width: 100%; border-collapse: collapse; }
.histtable th, .histtable td { padding: 11px 16px; text-align: left; border-bottom: 1px solid var(--border-subtle); font-size: 12.5px; }
.histtable th {
  background: var(--surface-2); color: var(--muted); text-transform: uppercase;
  font-size: 10.5px; letter-spacing: .08em; font-weight: 510;
}
.histtable tbody tr:last-child td { border-bottom: 0; }
.histtable tbody tr:hover td { background: var(--surface-2); }
.histtable .mono { font-family: var(--mono); color: var(--muted); font-size: 12px; }

/* badges */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 510; }
.badge.ok, .badge.active, .badge.completed, .badge.success { background: rgba(16,185,129,.12); color: var(--ok); }
.badge.bad, .badge.failed, .badge.error, .badge.paused { background: rgba(248,113,113,.12); color: var(--bad); }
.badge.info, .badge.running, .badge.idle, .badge.pending { background: rgba(96,165,250,.12); color: var(--info); }
.badge.warn { background: rgba(251,191,36,.12); color: var(--warn); }

.empty { color: var(--muted); padding: 44px; text-align: center; border: 1px dashed var(--border-solid); border-radius: var(--radius); font-size: 13.5px; }

footer.foot {
  padding: 11px 28px; color: var(--muted-2); font-size: 11.5px; border-top: 1px solid var(--border-subtle);
  display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; background: var(--panel);
}

/* ---------------- reader (publication view) ----------------
   News reads like a publication, not a dashboard. Light paper, ink text,
   serif body (Georgia), sans labels, accent section rules, zebra tables.
   Full-screen overlay so the light/dark mix stays clean. */
.reader { position: fixed; inset: 0; z-index: 50; background: #f4f3ef; display: flex; flex-direction: column; color: #131313; }
.reader[hidden] { display: none; }
.reader-bar {
  display: flex; align-items: center; gap: 14px; padding: 12px 26px;
  background: #fff; border-bottom: 1px solid #e4e2db; flex: none;
}
.reader-bar .btn { color: #4a4a47; }
.reader-bar .btn:hover { background: #f0efea; }
.reader-meta { flex: 1; color: #8a8780; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--sans); letter-spacing: .01em; }
.reader-body { flex: 1; overflow: auto; display: grid; grid-template-columns: 230px 1fr; }

.reader-toc {
  position: sticky; top: 0; align-self: start; height: 100%; box-sizing: border-box;
  border-right: 1px solid #e4e2db; padding: 30px 18px; overflow: auto; background: #f4f3ef;
}
.reader-toc .toc-h { color: #a9a59b; font-size: 10px; text-transform: uppercase; letter-spacing: .16em; margin: 0 8px 14px; font-weight: 600; font-family: var(--sans); }
.reader-toc a {
  display: block; padding: 6px 9px; border-radius: 6px; color: #6f6c64; font-size: 12.5px;
  text-decoration: none; border-left: 2px solid transparent; transition: background .12s, color .12s;
  line-height: 1.4; font-family: var(--sans);
}
.reader-toc a:hover { background: #eceae3; color: #131313; }
.reader-toc a.active { color: #131313; border-left-color: #d8521f; background: #eceae3; font-weight: 600; }
.reader-toc a.lvl-3 { padding-left: 22px; font-size: 12px; }

.reader-doc {
  max-width: 680px; margin: 0 auto; padding: 52px 40px 120px;
  font-family: var(--serif); font-size: 18px; line-height: 1.62; color: #2a2926;
}
.reader-doc h1 { font-family: var(--sans); font-size: 30px; font-weight: 800; letter-spacing: -.02em; color: #131313; margin: 0 0 6px; line-height: 1.2; }
.reader-doc h2 {
  font-family: var(--sans); font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em;
  color: #d8521f; margin: 44px 0 14px; line-height: 1.3; padding-bottom: 9px;
  border-bottom: 2px solid #131313; scroll-margin-top: 20px;
}
.reader-doc h3 { font-family: var(--sans); font-size: 19px; font-weight: 700; color: #131313; margin: 28px 0 8px; scroll-margin-top: 20px; }
.reader-doc p { margin: 15px 0; }
.reader-doc strong { color: #131313; font-weight: 700; }
.reader-doc em { color: #131313; font-style: italic; font-weight: 700; }
.reader-doc ul, .reader-doc ol { margin: 15px 0; padding-left: 26px; }
.reader-doc li { margin: 9px 0; }
.reader-doc code { font-family: var(--mono); font-size: .82em; background: #ecebe5; padding: .12em .4em; border-radius: 4px; color: #b3245b; }
.reader-doc pre { background: #1d1c1a; color: #e8e6df; border-radius: 8px; padding: 16px; overflow: auto; white-space: pre-wrap; word-break: break-word; font-size: 13px; font-family: var(--mono); }
.reader-doc table { border-collapse: collapse; width: 100%; margin: 20px 0; font-size: 14.5px; font-family: var(--sans); }
.reader-doc th, .reader-doc td { border-bottom: 1px solid #dcd9d0; padding: 11px 13px; text-align: left; vertical-align: top; }
.reader-doc th { color: #8a8780; font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; border-bottom: 2px solid #131313; }
.reader-doc tr:nth-child(even) td { background: #eceae3; }
.reader-doc blockquote { margin: 20px 0; padding: 4px 0 4px 20px; border-left: 3px solid #d8521f; color: #131313; font-style: italic; }

/* ---------------- briefing feed card ---------------- */
.card.brief { display: grid; grid-template-columns: 5px 1fr; gap: 0; padding: 0; overflow: hidden; background: #fffdfa; border: 1px solid #e7e4dc; }
.card.brief .rail { background: var(--cat, #d8521f); }
.card.brief .inner { padding: 17px 20px 16px 19px; }
.card.brief .kicker { font-family: var(--sans); font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .14em; color: var(--cat, #d8521f); margin-bottom: 7px; display: flex; align-items: center; gap: 9px; }
.card.brief .kicker .when { color: #b7b3a9; font-weight: 500; letter-spacing: .04em; }
.card.brief .hl { font-family: var(--sans); font-size: 17px; font-weight: 700; letter-spacing: -.01em; color: #131313; line-height: 1.3; margin-bottom: 8px; }
.card.brief .stand { font-family: var(--serif); font-size: 14px; line-height: 1.55; color: #5b5852; margin-bottom: 13px; }
.card.brief .pillrow { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 13px; }
.card.brief .pill { font-family: var(--sans); font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 999px; border: 1px solid #e4e2db; color: #6f6c64; background: #fff; }
.card.brief .pill.crit { color: #c0392b; border-color: #e9b7b0; }
.card.brief .pill.major { color: #b9760f; border-color: #eccf9a; }
.card.brief .pill.watch { color: #3f7a4f; border-color: #bcdcc4; }
.card.brief .open { font-family: var(--sans); font-size: 12.5px; font-weight: 600; color: #d8521f; background: none; border: none; padding: 0; cursor: pointer; }
.card.brief .open:hover { text-decoration: underline; }

@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 14px; }
  .side-section, .side-foot { display: none; }
  .search { width: 140px; }
  .topbar { flex-wrap: wrap; }
  .reader-body { grid-template-columns: 1fr; }
  .reader-toc { display: none; }
}
