:root {
  --ink: #18211d;
  --muted: #66706a;
  --faint: #9aa19d;
  --paper: #f3f1eb;
  --panel: #fbfaf6;
  --line: #dcded7;
  --green: #1e7563;
  --green-soft: #dcebe5;
  --orange: #ef6a45;
  --orange-dark: #ce4f2d;
  --yellow: #d9a42c;
  --red: #b64838;
  --shadow: 0 24px 70px rgba(21, 31, 27, .12);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--paper); }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 32px; background: radial-gradient(circle at 70% 20%, #e8e2d4 0, transparent 32%), var(--paper); }
.auth-card { width: min(600px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: clamp(32px, 7vw, 70px); box-shadow: var(--shadow); }
.brand-mark { width: 44px; height: 44px; border-radius: 12px; background: var(--ink); color: white; display: grid; place-items: center; font-family: Georgia, serif; font-weight: 700; letter-spacing: -.05em; position: relative; overflow: hidden; }
.brand-mark::after { content: ""; position: absolute; width: 12px; height: 12px; background: var(--orange); border-radius: 50%; right: -3px; top: -3px; }
.auth-card .brand-mark { margin-bottom: 48px; }
.eyebrow { margin: 0 0 9px; color: var(--green); font-size: 11px; font-weight: 750; letter-spacing: .14em; text-transform: uppercase; }
.auth-card h1 { margin: 0; font: 400 clamp(38px, 7vw, 60px)/.98 Georgia, serif; letter-spacing: -.045em; }
.auth-copy { max-width: 470px; color: var(--muted); font-size: 16px; line-height: 1.55; margin: 24px 0 34px; }
label { color: var(--ink); font-size: 13px; font-weight: 700; }
.auth-input-row { display: flex; gap: 10px; margin-top: 9px; }
input { width: 100%; min-height: 44px; border: 1px solid #c9cec8; border-radius: 6px; padding: 0 13px; background: white; color: var(--ink); outline: none; }
input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(30, 117, 99, .12); }
.quiet-link { display: inline-block; margin-top: 38px; color: var(--muted); font-size: 13px; text-decoration: none; }
.quiet-link:hover { color: var(--ink); }
.form-error { min-height: 20px; margin: 10px 0 0; color: var(--red); font-size: 13px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 238px 1fr; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 238px; background: #e8e7e1; border-right: 1px solid #d1d3cd; padding: 25px 17px 20px; display: flex; flex-direction: column; z-index: 10; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 9px 30px; }
.brand-name, .brand-subtitle { display: block; }
.brand-name { font-family: Georgia, serif; font-size: 17px; font-weight: 700; }
.brand-subtitle { margin-top: 2px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
nav { display: grid; gap: 5px; }
.nav-item { display: flex; align-items: center; gap: 11px; width: 100%; border: 0; border-radius: 5px; background: transparent; color: #53605a; padding: 11px 12px; cursor: pointer; text-align: left; font-size: 13px; font-weight: 650; }
.nav-item:hover { background: rgba(255,255,255,.5); color: var(--ink); }
.nav-item.is-active { background: var(--panel); color: var(--ink); box-shadow: 0 1px 3px rgba(20,30,25,.07); }
.nav-icon { width: 18px; color: var(--green); text-align: center; font-size: 17px; }
.sidebar-foot { margin-top: auto; border-top: 1px solid #d1d3cd; padding: 18px 10px 0; display: grid; gap: 13px; }
.sidebar-foot a, .sidebar-foot button { color: var(--muted); font-size: 12px; text-decoration: none; background: none; border: 0; padding: 0; text-align: left; cursor: pointer; }
.sidebar-foot a:hover, .sidebar-foot button:hover { color: var(--ink); }

.main { grid-column: 2; width: min(1480px, 100%); margin: 0 auto; padding: 31px clamp(26px, 4vw, 62px) 70px; }
.topbar { display: flex; justify-content: space-between; align-items: flex-end; min-height: 77px; padding-bottom: 25px; border-bottom: 1px solid var(--line); }
.topbar h1 { font: 400 34px/1.05 Georgia, serif; margin: 0; letter-spacing: -.035em; }
.topbar-actions { display: flex; gap: 9px; align-items: center; }
.button, .icon-button { min-height: 42px; border-radius: 5px; border: 1px solid transparent; padding: 0 17px; font-size: 13px; font-weight: 750; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 7px; transition: transform .15s ease, background .15s ease; }
.button:hover, .icon-button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .55; cursor: wait; transform: none; }
.button-primary { color: white; background: var(--orange); border-color: var(--orange); }
.button-primary:hover { background: var(--orange-dark); }
.button-secondary { background: transparent; color: var(--ink); border-color: var(--line); }
.icon-button { width: 42px; padding: 0; background: var(--panel); border-color: var(--line); color: var(--ink); font-size: 19px; }
.text-button { border: 0; background: none; color: var(--green); padding: 6px 0; font-size: 12px; font-weight: 750; cursor: pointer; }
.text-button:hover { color: var(--ink); }
.system-banner { margin: 22px 0 -6px; padding: 13px 15px; border-left: 3px solid var(--yellow); background: #f7edcf; color: #6f5b21; font-size: 13px; line-height: 1.45; }
.view { display: none; }
.view.is-active { display: block; }

.hero-grid { display: grid; grid-template-columns: 1.35fr 1fr 1fr; gap: 14px; margin: 28px 0 47px; }
.hero-card { min-height: 168px; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 23px 24px; display: flex; flex-direction: column; justify-content: space-between; }
.hero-card-dark { color: white; background: var(--ink); border-color: var(--ink); flex-direction: row; align-items: flex-end; }
.card-label { margin: 0 0 22px; color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .14em; }
.hero-card-dark .card-label { color: #91aaa0; }
.hero-card h2 { margin: 0; font: 400 29px/1.08 Georgia, serif; letter-spacing: -.03em; }
.hero-caption { margin: 10px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.hero-card-dark .hero-caption { color: #a9b9b2; }
.signal { height: 60px; display: flex; align-items: flex-end; gap: 5px; padding-right: 4px; }
.signal i { display: block; width: 5px; background: #4a7566; border-radius: 5px; }
.signal i:nth-child(1) { height: 15px; }.signal i:nth-child(2) { height: 29px; }.signal i:nth-child(3) { height: 21px; }.signal i:nth-child(4) { height: 45px; background: var(--orange); }.signal i:nth-child(5) { height: 55px; }
.status-line { display: flex; gap: 10px; align-items: center; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--faint); box-shadow: 0 0 0 4px rgba(154,161,157,.13); flex: 0 0 auto; }
.status-dot.good { background: var(--green); box-shadow: 0 0 0 4px rgba(30,117,99,.13); }
.status-dot.warn { background: var(--yellow); box-shadow: 0 0 0 4px rgba(217,164,44,.14); }
.status-dot.bad { background: var(--red); box-shadow: 0 0 0 4px rgba(182,72,56,.12); }

.section-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 15px; }
.section-heading h2, .panel h2 { font: 400 24px/1.1 Georgia, serif; margin: 0; letter-spacing: -.025em; }
.section-heading-page { margin: 35px 0 23px; align-items: start; }
.section-heading-page h2 { font-size: 32px; }
.section-heading-page p:last-child { color: var(--muted); margin: 10px 0 0; font-size: 13px; }
.council-table-wrap { border-top: 1px solid var(--ink); }
.council-table { border-collapse: collapse; width: 100%; }
.council-table th { padding: 11px 12px; color: var(--faint); font-size: 9px; font-weight: 800; text-align: left; text-transform: uppercase; letter-spacing: .12em; border-bottom: 1px solid var(--line); }
.council-table td { padding: 15px 12px; border-bottom: 1px solid var(--line); font-size: 12px; vertical-align: middle; }
.council-name { display: flex; align-items: center; gap: 12px; }
.council-monogram { width: 31px; height: 31px; border-radius: 50%; display: grid; place-items: center; background: var(--green-soft); color: var(--green); font-family: Georgia, serif; font-weight: 700; font-size: 11px; }
.council-name strong { display: block; font-size: 13px; }
.council-name span { display: block; color: var(--muted); font-size: 10px; margin-top: 3px; }
.status-badge { display: inline-flex; align-items: center; gap: 6px; border-radius: 100px; padding: 5px 8px; font-size: 10px; font-weight: 800; background: var(--green-soft); color: var(--green); text-transform: capitalize; }
.status-badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status-badge.partial, .status-badge.waiting { background: #f4ead0; color: #927017; }
.status-badge.failed, .status-badge.errored, .status-badge.terminated { background: #f3dcda; color: var(--red); }
.coverage { min-width: 150px; }
.coverage-line { display: flex; justify-content: space-between; color: var(--muted); font-size: 10px; margin-bottom: 6px; }
.coverage-bar { height: 3px; background: #dfe2dc; overflow: hidden; }
.coverage-bar i { display: block; height: 100%; background: var(--green); }
.row-actions { text-align: right; white-space: nowrap; }
.row-actions button, .row-actions a { border: 0; background: none; padding: 6px; color: var(--muted); text-decoration: none; cursor: pointer; font-size: 15px; }
.row-actions button:hover, .row-actions a:hover { color: var(--orange); }
.loading-cell { padding: 35px !important; text-align: center; color: var(--muted); }

.overview-lower { display: grid; grid-template-columns: 1.6fr .8fr; gap: 16px; margin-top: 45px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 21px; }
.panel-heading { display: flex; align-items: end; justify-content: space-between; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.run-item { display: grid; grid-template-columns: 13px 1fr auto; gap: 12px; padding: 15px 2px; border-bottom: 1px solid var(--line); align-items: start; }
.run-item:last-child { border-bottom: 0; }
.run-item h3 { margin: 0 0 5px; font-size: 12px; }
.run-item p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.run-time { color: var(--faint); font-size: 10px; white-space: nowrap; }
.run-actions { display: flex; align-items: center; gap: 8px; }
.cancel-run { border: 0; background: none; color: var(--red); cursor: pointer; font-size: 10px; font-weight: 750; padding: 3px; }
.empty-state { color: var(--muted); font-size: 12px; text-align: center; padding: 26px 10px; }
.model-panel { text-align: center; }
.model-orbit { width: 78px; height: 78px; margin: 7px auto 18px; border: 1px solid #b9c9c2; border-radius: 50%; display: grid; place-items: center; position: relative; }
.model-orbit::before { content: ""; position: absolute; inset: 9px -12px; border: 1px solid #d0d8d4; border-radius: 50%; transform: rotate(32deg); }
.model-orbit span { width: 45px; height: 45px; border-radius: 50%; display: grid; place-items: center; background: var(--ink); color: white; font-family: Georgia, serif; }
.model-panel > p:not(.eyebrow) { color: var(--muted); font-size: 11px; line-height: 1.5; overflow-wrap: anywhere; }
.mini-details { margin: 22px 0 0; border-top: 1px solid var(--line); text-align: left; }
.mini-details div { display: flex; justify-content: space-between; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 10px; }
.mini-details dt { color: var(--muted); }.mini-details dd { margin: 0; font-weight: 750; }

.council-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.council-card { background: var(--panel); border: 1px solid var(--line); padding: 22px; border-radius: 4px; }
.council-card-head { display: flex; justify-content: space-between; gap: 20px; align-items: start; }
.council-card h3 { font: 400 22px/1.1 Georgia, serif; margin: 0 0 6px; }
.council-card-sub { color: var(--muted); font-size: 11px; }
.metric-row { display: grid; grid-template-columns: repeat(3, 1fr); margin: 22px 0; border-block: 1px solid var(--line); }
.metric { padding: 14px 8px; border-right: 1px solid var(--line); }
.metric:first-child { padding-left: 0; }.metric:last-child { border-right: 0; }
.metric strong { display: block; font: 400 22px Georgia, serif; }
.metric span { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .1em; }
.council-card-foot { display: flex; justify-content: space-between; align-items: center; }
.warning-note { color: #8a6819; font-size: 10px; max-width: 68%; }
.warning-note.clean { color: var(--muted); }
.runs-panel { padding: 8px 20px; }
.runs-panel .run-item { padding: 18px 4px; grid-template-columns: 14px minmax(0, 1fr) auto; }

dialog { width: min(580px, calc(100vw - 32px)); border: 0; border-radius: 5px; padding: 0; background: var(--panel); color: var(--ink); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(20, 29, 25, .52); backdrop-filter: blur(3px); }
#run-form { padding: 29px; }
.dialog-head { display: flex; justify-content: space-between; align-items: start; }
.dialog-head h2 { margin: 0; font: 400 29px Georgia, serif; }
.dialog-close { border: 0; background: transparent; font-size: 27px; color: var(--muted); cursor: pointer; line-height: 1; }
.dialog-copy { color: var(--muted); font-size: 12px; line-height: 1.5; margin: 17px 0 24px; }
fieldset { border: 0; padding: 0; margin: 0 0 23px; }
legend { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 10px; }
.check-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; }
.check-option { display: flex; align-items: center; gap: 9px; border: 1px solid var(--line); border-radius: 4px; padding: 10px; cursor: pointer; font-size: 12px; }
.check-option:has(input:checked) { border-color: var(--green); background: var(--green-soft); }
.check-option input { width: 15px; min-height: 15px; accent-color: var(--green); padding: 0; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-grid label { display: grid; gap: 7px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; padding: 18px 0 3px; margin-top: 19px; border-top: 1px solid var(--line); }
.switch-row strong, .switch-row small { display: block; }
.switch-row small { margin-top: 4px; color: var(--muted); font-weight: 400; }
.switch-row input { appearance: none; width: 39px; min-height: 22px; height: 22px; border: 0; border-radius: 20px; background: #c9ceca; padding: 2px; cursor: pointer; transition: background .15s; }
.switch-row input::before { content: ""; display: block; width: 18px; height: 18px; background: white; border-radius: 50%; transition: transform .15s; }
.switch-row input:checked { background: var(--green); }
.switch-row input:checked::before { transform: translateX(17px); }
.switch-row input:disabled { opacity: .45; cursor: not-allowed; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.toast { position: fixed; right: 24px; bottom: 24px; max-width: 360px; padding: 13px 16px; background: var(--ink); color: white; border-radius: 5px; box-shadow: var(--shadow); font-size: 12px; opacity: 0; transform: translateY(15px); pointer-events: none; transition: .2s ease; z-index: 50; }
.toast.is-visible { opacity: 1; transform: none; }

@media (max-width: 960px) {
  .app-shell { grid-template-columns: 76px 1fr; }
  .sidebar { width: 76px; padding-inline: 10px; }
  .brand { padding-inline: 6px; }.brand > div:last-child, .nav-item:not(.is-active) span + *, .nav-item { font-size: 0; }
  .nav-item { justify-content: center; padding: 12px; }.nav-icon { font-size: 18px; }
  .sidebar-foot { padding-inline: 4px; }.sidebar-foot a, .sidebar-foot button { font-size: 0; }.sidebar-foot a::before { content: "↗"; font-size: 18px; }.sidebar-foot button::before { content: "⌾"; font-size: 18px; }
  .main { grid-column: 2; }
  .hero-grid { grid-template-columns: 1fr 1fr; }.hero-card-dark { grid-column: 1 / -1; }
  .overview-lower { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .app-shell { display: block; padding-bottom: 70px; }
  .sidebar { inset: auto 0 0; width: 100%; height: 62px; flex-direction: row; padding: 8px 12px; border-right: 0; border-top: 1px solid var(--line); }
  .sidebar .brand, .sidebar-foot { display: none; }
  .sidebar nav { width: 100%; grid-template-columns: repeat(3, 1fr); }
  .nav-item, .nav-item:not(.is-active) { font-size: 9px; flex-direction: column; gap: 2px; padding: 5px; }
  .nav-icon { font-size: 16px; }
  .main { padding: 22px 16px 38px; }
  .topbar { align-items: center; }.topbar h1 { font-size: 27px; }.icon-button { display: none; }
  .hero-grid { grid-template-columns: 1fr; margin-top: 18px; }.hero-card-dark { grid-column: auto; }
  .council-table th:nth-child(3), .council-table td:nth-child(3), .council-table th:nth-child(4), .council-table td:nth-child(4) { display: none; }
  .council-grid { grid-template-columns: 1fr; }
  .field-grid, .check-grid { grid-template-columns: 1fr; }
  .auth-input-row { flex-direction: column; }
}
