/* Aztec Ops — same structure as intecs-ops, Aztec yellow as the brand accent.
   Themes: follows the system by default; the sidebar toggle stores
   light/dark in localStorage and sets html[data-theme]. */
:root {
  --bg: #f4f5f7; --surface: #ffffff; --surface-2: #eef0f3; --border: #e0e3e8;
  --text: #16181d; --muted: #667085;
  --accent: #2f6fed; --accent-soft: #e8efff;          /* actions, links */
  --btn: #2f6fed; --btn-danger: #c62828;              /* button fills (white text) */
  --brand: #f9cf0a; --brand-ink: #16181d; --brand-soft: #fff6cc; --brand-line: #e0b800;
  --ok: #138a52; --ok-soft: #e3f5ec; --warn: #a15c00; --warn-soft: #fff1d6; --bad: #c62828; --bad-soft: #fde8e8;
  --radius: 10px; --radius-lg: 16px;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  --flow-bg: #101318; --flow-text: #eef1f5; --flow-muted: #9aa3b0; --flow-line: #2b313b;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1014; --surface: #161a21; --surface-2: #1d222b; --border: #2a303a;
    --text: #e7eaee; --muted: #98a1ae; --accent: #6f9bff; --accent-soft: #1c2945; --btn: #3a6fe0; --btn-danger: #c93a3a;
    --brand-soft: #2e2806; --brand-line: #f9cf0a;
    --ok: #4cc38a; --ok-soft: #13301f; --warn: #f0b04a; --warn-soft: #33270f; --bad: #ff6b6b; --bad-soft: #3a1717;
    --shadow: none; --flow-bg: #0a0c10; --flow-line: #262c35; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1014; --surface: #161a21; --surface-2: #1d222b; --border: #2a303a;
  --text: #e7eaee; --muted: #98a1ae; --accent: #6f9bff; --accent-soft: #1c2945; --btn: #3a6fe0; --btn-danger: #c93a3a;
  --brand-soft: #2e2806; --brand-line: #f9cf0a;
  --ok: #4cc38a; --ok-soft: #13301f; --warn: #f0b04a; --warn-soft: #33270f; --bad: #ff6b6b; --bad-soft: #3a1717;
  --shadow: none; --flow-bg: #0a0c10; --flow-line: #262c35; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.5 "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
h2 { font-size: 20px; } h3 { font-size: 15px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hidden { display: none !important; }
.muted { color: var(--muted); } .small { font-size: 12px; }
.mono, code { font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace; font-size: 12.5px; }
.error-text { color: var(--bad); font-weight: 600; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- buttons ---------- */
/* .btn = primary action (blue); variants below are neutral, destructive or bare */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--btn);
  background: var(--btn); color: #fff; border-radius: 8px; padding: 7px 13px; font: inherit; font-weight: 500;
  cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn:hover { filter: brightness(1.07); text-decoration: none; }
.btn-secondary, .btn.wide { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary { color: var(--accent); }
.btn-secondary:hover, .btn.wide:hover { background: var(--surface-2); filter: none; }
.btn-danger { background: var(--btn-danger); border-color: var(--btn-danger); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text); }
.btn.ghost:hover { background: var(--surface-2); filter: none; }
.btn.small { padding: 4px 9px; font-size: 12px; }
.btn.icon { padding: 4px 10px; }
.btn.wide { width: 100%; padding: 10px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- logo ---------- */
.logo-plate { display: block; background: #000; border-radius: 12px; padding: 12px 14px; }
.logo-plate img { display: block; width: 100%; height: auto; }
.logo-plate--lg { width: 280px; max-width: 100%; padding: 18px 22px; border-radius: 16px; margin: 0 auto; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 32px;
  width: min(380px, 100%); text-align: center; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; }
.login-card h1 { font-size: 22px; margin-top: 10px; }
.login-card p { margin: 0; }
.auth-buttons { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh;
  background: linear-gradient(to right, var(--surface) 248px, var(--border) 248px, var(--border) 249px, var(--bg) 249px); }
.sidebar { background: var(--surface); border-right: 1px solid var(--border); padding: 16px 12px; display: flex; flex-direction: column;
  gap: 2px; position: sticky; top: 0; height: 100vh; overflow: auto; }
.product-name { font-weight: 600; font-size: 15px; padding: 12px 10px 8px; }
.side-label { font-size: 12px; color: var(--muted); padding: 14px 10px 4px; }
.sidebar nav a { display: block; padding: 7px 10px; border-radius: 8px; color: var(--text); border-left: 3px solid transparent; }
.sidebar nav a:hover { background: var(--surface-2); text-decoration: none; }
.sidebar nav a.active { background: var(--brand-soft); border-left-color: var(--brand-line); font-weight: 600; }
.side-foot { margin-top: auto; padding: 12px 6px 0; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; }
.who { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; word-break: break-all; }
.role { font-size: 11px; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.side-actions { display: flex; gap: 4px; }
main { min-width: 0; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 20px 28px 4px; }
#menu-btn { display: none; }
.view { padding: 16px 28px 56px; display: flex; flex-direction: column; gap: 16px; max-width: 1320px; }

/* ---------- generic blocks used across pages ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.card > h2 { font-size: 15px; margin-bottom: 12px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat .label { font-size: 12px; color: var(--muted); }
.stat .value { font-size: 22px; font-weight: 600; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .value.small { font-size: 13px; word-break: break-all; font-weight: 500; }
.stat .sub { font-size: 12px; color: var(--muted); margin-top: 4px; word-break: break-word; }
.stat.bad { border-color: var(--bad); background: var(--bad-soft); }
.stat.good { box-shadow: inset 3px 0 0 var(--ok), var(--shadow); }

.badge { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 2px 9px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--surface-2); color: var(--muted); }
.b-ok { background: var(--ok-soft); color: var(--ok); }
.b-warn { background: var(--warn-soft); color: var(--warn); }
.b-err { background: var(--bad-soft); color: var(--bad); }
.b-info { background: var(--accent-soft); color: var(--accent); }
.b-mute { background: var(--surface-2); color: var(--muted); }

.notice { border-radius: 8px; padding: 10px 14px; background: var(--surface-2); color: var(--muted); }
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.notice.err { background: var(--bad-soft); color: var(--bad); }
.notice.info { background: var(--accent-soft); color: var(--accent); }
.notice ul { margin: 6px 0 0 18px; padding: 0; }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--surface-2); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 12px; overflow-x: auto; }
.tabs button { background: none; border: none; padding: 9px 12px; cursor: pointer; font: inherit; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.active { color: var(--text); border-bottom-color: var(--brand-line); font-weight: 600; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px 20px; }
.field label { display: block; font-weight: 600; margin-bottom: 4px; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 3px; }
input[type=text], input[type=number], input[type=email], input[type=date], input[type=file], select, textarea {
  width: 100%; padding: 7px 9px; border: 1px solid var(--border); border-radius: 8px; font: inherit; color: var(--text); background: var(--surface); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
textarea { min-height: 90px; font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace; font-size: 12.5px; }
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.inline-form .field { min-width: 160px; flex: 1; }

.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px;
  border-radius: 8px; z-index: 60; max-width: calc(100% - 32px); box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.toast.err { background: var(--bad); color: #fff; }

/* ---------- Home ---------- */
.home-intro { max-width: 70ch; }
.home-intro h1 { font-size: 26px; line-height: 1.25; margin-bottom: 8px; }
.home-intro p { margin: 0; color: var(--muted); font-size: 15px; }

/* the live flow — the one dark, branded element on the page */
.flow { background: var(--flow-bg); color: var(--flow-text); border-radius: var(--radius-lg); padding: 22px 22px 18px; position: relative; overflow: hidden; }
.flow-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.flow-head h2 { font-size: 15px; color: var(--flow-text); }
.flow-live { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--flow-muted); }
.flow-live .pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 0 rgba(249,207,10,.6); animation: pulse 2.4s ease-out infinite; }
.flow-live.stale .pulse { background: #ff6b6b; animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(249,207,10,.55); } 70% { box-shadow: 0 0 0 9px rgba(249,207,10,0); } 100% { box-shadow: 0 0 0 0 rgba(249,207,10,0); } }
.flow-track { display: grid; grid-template-columns: 1fr 36px 1fr 36px 1fr 36px 1fr; align-items: stretch; }
.flow-node { border: 1px solid var(--flow-line); border-radius: 12px; padding: 14px; background: rgba(255,255,255,.02); min-width: 0; }
.flow-node.hub { border-color: var(--brand); background: rgba(249,207,10,.07); }
.flow-node .who { font-size: 12px; color: var(--flow-muted); display: block; }
.flow-node .what { font-size: 16px; font-weight: 600; margin: 2px 0 8px; color: var(--flow-text); }
.flow-node .fig { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--brand); line-height: 1.1; }
.flow-node .cap { font-size: 12px; color: var(--flow-muted); margin-top: 4px; }
.flow-link { position: relative; align-self: center; height: 2px; background: var(--flow-line); margin: 0 6px; }
.flow-link::after { content: ""; position: absolute; right: -1px; top: -4px; border-left: 7px solid var(--flow-line); border-top: 5px solid transparent; border-bottom: 5px solid transparent; }
.flow-link .dot { position: absolute; top: -3px; left: 0; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); opacity: 0; }
.flow.run .flow-link .dot { animation: travel 1.1s ease-in-out forwards; }
.flow.run .flow-link:nth-of-type(4) .dot { animation-delay: .9s; }
.flow.run .flow-link:nth-of-type(6) .dot { animation-delay: 1.8s; }
@keyframes travel { 0% { left: 0; opacity: 0; } 15% { opacity: 1; } 85% { opacity: 1; } 100% { left: calc(100% - 8px); opacity: 0; } }
.flow-foot { margin-top: 14px; font-size: 12px; color: var(--flow-muted); }

.impact { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.impact .stat .value { font-size: 28px; }
.impact .stat { box-shadow: inset 0 3px 0 var(--brand-line), var(--shadow); }

.two-col { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px; align-items: start; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 112px 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.timeline li:last-child { border-bottom: 0; }
.timeline .when { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.timeline .what { font-weight: 500; }
.timeline .what .muted { font-weight: 400; }
.guards { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.guards li { padding-left: 14px; border-left: 3px solid var(--brand-line); }
.guards b { display: block; font-weight: 600; }
.guards span { color: var(--muted); font-size: 13px; }
.toolkit { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.tool { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; background: var(--surface); }
.tool h3 { font-size: 14px; display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.tool p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }

@media (max-width: 1100px) {
  .flow-track { grid-template-columns: 1fr 1fr; gap: 12px; }
  .flow-link { display: none; }
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; background: var(--bg); }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.35); }
  #menu-btn { display: inline-flex; }
  .topbar { padding: 14px 16px 0; }
  .view { padding: 12px 16px 40px; }
  .flow-track { grid-template-columns: 1fr; }
  .timeline li { grid-template-columns: 1fr; gap: 2px; }
}
@media (prefers-reduced-motion: reduce) {
  .flow-live .pulse, .flow.run .flow-link .dot { animation: none; }
  .sidebar { transition: none; }
}
.view > h1 { font-size: 18px; }
.topbar.quiet { display: none; }
@media (max-width: 860px) { .topbar.quiet { display: flex; } }
