@import 'tokens.css';

@font-face { font-family: 'Inter'; font-style: normal; font-weight: 100 900; font-display: swap; src: url('../fonts/inter-latin-wght.woff2') format('woff2'); }

/* Espresso brand (Espresso Cloud Brand Direction): caramel and roast accents, steamed-milk surfaces, espresso text. */
:root {
  --espresso: #3b2412; --caramel: #c98a2b; --roast: #a5681a; --milk: #fbf0c8; --foam: #fff9e6;
  --ok: #2e9e5e; --warn: #d9821f; --bad: #d8453b;
  --accent: var(--caramel); --accent-strong: var(--roast);
  --text: var(--espresso); --text-dim: rgba(59, 36, 18, 0.68);
  --bg-a: #f6d9a0; --bg-b: #fbe9c4; --bg-c: #f1c79a; --bg-base: var(--foam);
  --radius-brand: 12px;
  /* Liquid Glass tokens, tinted with steamed milk */
  --lg-bg-primary: rgba(251, 240, 200, 0.62);
  --lg-bg-elevated: rgba(255, 249, 230, 0.86);
  --lg-bg-toolbar: rgba(255, 249, 230, 0.7);
  --lg-bg-interactive: rgba(255, 249, 230, 0.6);
  --lg-bg-pressed: rgba(59, 36, 18, 0.08);
  --lg-border-color: rgba(255, 255, 255, 0.65);
  --lg-border-subtle: rgba(59, 36, 18, 0.1);
  --lg-shadow-elevated: 0 4px 18px rgba(59, 36, 18, 0.1);
  --lg-radius-xl: 16px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --text: var(--milk); --text-dim: rgba(251, 240, 200, 0.68);
    --ok: #4cc17f; --warn: #e8a13a; --bad: #f0645a;
    --accent: var(--caramel); --accent-strong: #e0a54c;
    --bg-a: #6b4520; --bg-b: #3b2412; --bg-c: #5a3a1c; --bg-base: #25160a;
    --lg-bg-primary: rgba(59, 36, 18, 0.62);
    --lg-bg-elevated: rgba(74, 46, 22, 0.8);
    --lg-bg-toolbar: rgba(37, 22, 10, 0.7);
    --lg-bg-interactive: rgba(251, 240, 200, 0.09);
    --lg-bg-pressed: rgba(251, 240, 200, 0.06);
    --lg-border-color: rgba(251, 240, 200, 0.14);
    --lg-border-subtle: rgba(251, 240, 200, 0.09);
    --lg-shadow-elevated: 0 4px 18px rgba(0, 0, 0, 0.35);
  }
}
/* Each product keeps its own accent: Tocsin is green, as in its brand guide. */
body[data-page='tocsin'] { --accent: #16a34a; --accent-strong: #15803d; }
@media (prefers-color-scheme: dark) { body[data-page='tocsin'] { --accent: #4ade80; --accent-strong: #4ade80; } }

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-feature-settings: 'tnum' 1, 'cv11' 1;
  color: var(--text);
  background:
    radial-gradient(60vw 60vw at 10% 0%, var(--bg-a), transparent 60%),
    radial-gradient(55vw 55vw at 95% 10%, var(--bg-b), transparent 60%),
    radial-gradient(60vw 60vw at 50% 110%, var(--bg-c), transparent 60%),
    var(--bg-base);
  background-attachment: fixed;
}

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 28px; position: sticky; top: 0; z-index: 5;
  background: var(--lg-bg-toolbar);
  backdrop-filter: blur(var(--lg-blur-lg)) saturate(var(--lg-saturate));
  -webkit-backdrop-filter: blur(var(--lg-blur-lg)) saturate(var(--lg-saturate));
  border-bottom: 1px solid var(--lg-border-subtle);
}
.topbar h1 { font-size: 18px; margin: 0; font-weight: 600; letter-spacing: -0.01em; }
.topbar .meta { font-size: 13px; color: var(--text-dim); font-variant-numeric: tabular-nums; }

main { padding: 24px 28px 48px; display: grid; gap: 24px; max-width: 1800px; margin: 0 auto; }

/* One <section class="project"> per project. */
.project-head { display: flex; align-items: center; gap: 12px; margin: 0 0 12px; }
.project-head h2 { margin: 0; font-size: 26px; font-weight: 600; letter-spacing: -0.015em; }
.project-head .sub { color: var(--text-dim); font-size: 14px; }

.grid { display: grid; gap: 16px; grid-template-columns: repeat(12, 1fr); }
.card {
  background: var(--lg-bg-primary);
  backdrop-filter: blur(var(--lg-blur-md)) saturate(var(--lg-saturate));
  -webkit-backdrop-filter: blur(var(--lg-blur-md)) saturate(var(--lg-saturate));
  border: 1px solid var(--lg-border-color);
  border-radius: var(--lg-radius-xl);
  box-shadow: var(--lg-shadow-elevated);
  padding: 20px 22px; min-width: 0;
  animation: glass-enter var(--lg-duration-normal) var(--lg-easing-spring) both;
}
@keyframes glass-enter { from { opacity: 0; transform: scale(.97) translateY(8px); } to { opacity: 1; transform: none; } }
.c3 { grid-column: span 3; } .c4 { grid-column: span 4; } .c6 { grid-column: span 6; } .c8 { grid-column: span 8; } .c12 { grid-column: span 12; }
@media (max-width: 1100px) { .c3, .c4 { grid-column: span 6; } .c6, .c8 { grid-column: span 12; } }
@media (max-width: 640px) { .grid > * { grid-column: span 12 !important; } main, .topbar { padding-inline: 16px; } }

.label { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-dim); margin-bottom: 8px; font-weight: 600; }
.big { font-size: 44px; font-weight: 600; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1.05; }
.mid { font-size: 28px; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.dim { color: var(--text-dim); font-size: 13px; margin-top: 6px; }

.pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; font-size: 14px; font-weight: 600;
  background: var(--lg-bg-interactive); border: 1px solid var(--lg-border-color); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--dotc, var(--ok)); box-shadow: 0 0 0 4px color-mix(in srgb, var(--dotc, var(--ok)) 25%, transparent); }
.ok { --dotc: var(--ok); } .warn { --dotc: var(--warn); } .bad { --dotc: var(--bad); }
.bad .dot { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--bad) 10%, transparent); } }

.delta.up { color: var(--bad); } .delta.down { color: var(--ok); }

.bar { height: 10px; border-radius: 99px; background: var(--lg-bg-pressed); overflow: hidden; position: relative; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: var(--barc, var(--accent)); width: var(--w, 0%); transition: width var(--lg-duration-slow) var(--lg-easing-spring); }

.row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; padding: 8px 0; border-top: 1px solid var(--lg-border-subtle); font-size: 14px; }
.row:first-of-type { border-top: 0; }
.row .v { font-variant-numeric: tabular-nums; font-weight: 600; }
.row .bar { grid-column: 1 / -1; height: 6px; }

.counts { display: flex; gap: 22px; flex-wrap: wrap; }
.counts b { display: block; font-size: 30px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }

svg.spark { width: 100%; height: 150px; display: block; overflow: visible; }
svg.spark .area { fill: color-mix(in srgb, var(--accent) 22%, transparent); }
svg.spark .line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
svg.spark text { fill: var(--text-dim); font-size: 11px; }

.err { color: var(--warn); font-size: 14px; }
.firing { margin-top: 10px; font-size: 13px; }
.firing div { padding: 6px 0; border-top: 1px solid var(--lg-border-subtle); }

@media (prefers-reduced-motion: reduce) { .card { animation: none; } .bad .dot { animation: none; } }

/* Rotating pages: one project visible at a time */
.project { display: none; }
.project.active { display: block; animation: page-in var(--lg-duration-slow) ease both; }
@keyframes page-in { from { opacity: 0; } to { opacity: 1; } }
.pager { display: flex; gap: 8px; flex-wrap: wrap; }
.pager button { font: inherit; font-size: 13px; font-weight: 600; color: var(--text); cursor: pointer; padding: 6px 14px; border-radius: 999px;
  background: var(--lg-bg-interactive); border: 1px solid var(--lg-border-color); position: relative; overflow: hidden; }
.pager button[aria-current="true"] { background: var(--lg-bg-elevated); box-shadow: var(--lg-shadow-subtle); }
.pager button[aria-current="true"]::after { content: ''; position: absolute; left: 0; bottom: 0; height: 3px; background: var(--accent); width: 100%;
  transform-origin: left; animation: dwell var(--dwell, 20s) linear both; }
.pager.paused button::after { animation-play-state: paused; }
@keyframes dwell { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@media (prefers-reduced-motion: reduce) { .project.active, .pager button::after { animation: none; } }

/* Bar chart (Espresso Cloud sales) */
.bars { display: flex; gap: 14px; align-items: flex-end; height: 130px; padding-top: 8px; }
.barcol { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; min-width: 0; font-size: 12px; color: var(--text-dim); }
.barcol b { color: var(--text); font-variant-numeric: tabular-nums; font-size: 13px; }
.stack { position: relative; flex: 1; width: 100%; max-width: 64px; display: flex; align-items: flex-end; }
.stack i { position: absolute; bottom: 0; left: 0; right: 0; border-radius: 8px 8px 4px 4px; }
.b-sales { background: color-mix(in srgb, var(--accent) 45%, transparent); }
.b-profit { background: var(--ok); width: 55%; margin: 0 auto; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--text-dim); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }

/* Brand details */
:focus-visible { outline: 3px solid var(--roast); outline-offset: 2px; }
@media (prefers-color-scheme: dark) { :focus-visible { outline-color: #e0a54c; } }
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand-logo { width: 72px; height: 72px; border-radius: 50%; flex: none; box-shadow: 0 4px 14px rgba(59, 36, 18, 0.25); }
.topbar { padding-block: 8px; }
@media (max-width: 760px) { .brand-logo { width: 48px; height: 48px; } .topbar h1 { font-size: 15px; } }
.pager button { border-radius: 999px; }
.pager button:hover { background: var(--lg-bg-elevated); }
.project-head { flex-wrap: wrap; }
.brandmark { display: block; flex: none; }
.brandmark.roundel { width: 96px; height: 96px; border-radius: 50%; box-shadow: 0 6px 18px rgba(59, 36, 18, 0.22); } /* whole, never recoloured: 96px is the logo's minimum */
.brandmark.mark { width: 44px; height: 44px; }
.project-head .titles { display: grid; gap: 2px; }
.project-head .titles .sub { margin: 0; }
.card, .login-card input, .login-card button { border-radius: var(--radius-brand); }

/* Vendor logos sit whole on a neutral tile, as the brand direction asks; the AWS logo is never recoloured. */
.logo-tile { display: inline-flex; align-items: center; justify-content: center; padding: 10px 18px; border-radius: var(--radius-brand);
  background: #fff; box-shadow: var(--lg-shadow-elevated); border: 1px solid var(--lg-border-subtle); }
.logo-tile img { display: block; height: 40px; width: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* Alerts: a strip of chips for warnings, and a full-screen overlay for things that need action now. */
.alert-strip[hidden], .alert-overlay[hidden] { display: none !important; }
.alert-strip { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 28px 0; max-width: 1800px; margin: 0 auto; }
.chip { font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; padding: 6px 14px; border-radius: 999px; color: var(--text);
  background: color-mix(in srgb, var(--warn) 20%, transparent); border: 1px solid color-mix(in srgb, var(--warn) 55%, transparent); }
.chip.bad { background: color-mix(in srgb, var(--bad) 20%, transparent); border-color: color-mix(in srgb, var(--bad) 55%, transparent); }
.chip-page { font-weight: 400; color: var(--text-dim); }
.alert-overlay { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px;
  background: rgba(37, 22, 10, 0.74); backdrop-filter: blur(var(--lg-blur-lg)) saturate(1.3); -webkit-backdrop-filter: blur(var(--lg-blur-lg)) saturate(1.3); }
.alert-panel { width: min(760px, 100%); max-height: 90vh; overflow: auto; padding: 30px 32px; border-radius: var(--radius-brand);
  background: var(--lg-bg-elevated); color: var(--text); border: 2px solid var(--bad); box-shadow: 0 0 0 6px color-mix(in srgb, var(--bad) 28%, transparent), var(--lg-shadow-high);
  animation: alert-pulse 2s ease-in-out infinite; }
@keyframes alert-pulse { 50% { box-shadow: 0 0 0 14px color-mix(in srgb, var(--bad) 10%, transparent), var(--lg-shadow-high); } }
.alert-head { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.alert-head h2 { margin: 0; font-size: 34px; font-weight: 600; letter-spacing: -0.02em; }
.alert-icon { font-size: 34px; }
.alert-item { padding: 16px 0; border-top: 1px solid var(--lg-border-subtle); }
.alert-title { font-size: 24px; font-weight: 600; }
.alert-detail { margin-top: 4px; color: var(--text-dim); font-size: 16px; }
.alert-page { margin-top: 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-dim); font-weight: 600; }
.alert-actions { display: grid; gap: 10px; margin-top: 18px; }
.alert-btn { font: inherit; font-size: 18px; font-weight: 600; padding: 14px 20px; border: 0; border-radius: var(--radius-brand); cursor: pointer; background: var(--caramel); color: var(--espresso); }
.alert-btn:hover { background: var(--roast); color: #fff; }
@media (max-width: 760px) { .alert-strip { padding-inline: 16px; } .alert-panel { padding: 22px; } .alert-head h2 { font-size: 26px; } .alert-title { font-size: 20px; } }
@media (prefers-reduced-motion: reduce) { .alert-panel { animation: none; } }

/* Work queue */
.section-title { grid-column: span 12; display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.section-title h3 { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.num-bad { color: var(--bad); } .num-warn { color: var(--warn); }

/* Site health */
.site-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--lg-border-subtle); font-size: 14px; }
.site-row:first-of-type { border-top: 0; }
.site-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 600; }
.site-meta { display: flex; align-items: baseline; gap: 10px; font-variant-numeric: tabular-nums; }
.site-meta .dim { margin: 0; }
.spark-mini { grid-column: 1 / -1; width: 100%; height: 26px; }
.sp-ok { fill: var(--ok); opacity: .85; } .sp-slow { fill: var(--warn); } .sp-down { fill: var(--bad); } .sp-none { fill: var(--text-dim); opacity: .35; }

/* Helpdesk */
.pairs { display: flex; gap: 14px; align-items: flex-end; height: 170px; padding-top: 6px; }
.pair { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; min-width: 0; font-size: 12px; color: var(--text-dim); }
.pair b { color: var(--text); font-size: 13px; font-variant-numeric: tabular-nums; }
.pair-bars { flex: 1; width: 100%; max-width: 70px; display: flex; gap: 4px; align-items: flex-end; }
.pair-bars i, .legend i.p-created, .legend i.p-resolved { border-radius: 6px 6px 3px 3px; }
.pair-bars i { flex: 1; }
.p-created { background: var(--accent); } .p-resolved { background: var(--ok); }
code { font-family: ui-monospace, Menlo, monospace; font-size: 0.92em; padding: 1px 6px; border-radius: 6px; background: var(--lg-bg-pressed); }

/* Fit to screen (see fitActive in app.js): no scrolling, tighter header and padding */
html.fit, html.fit body { height: 100%; overflow: hidden; }
html.fit main { padding: 12px 28px 0; max-width: none; }
html.fit .project.active { transform-origin: top left; }
html.fit .topbar { padding-block: 6px; }
html.fit .brand-logo { width: 60px; height: 60px; }
html.fit .topbar, html.fit .alert-strip { zoom: var(--chrome, 1); }
html.fit .alert-panel { zoom: var(--chrome, 1); }
.row5 { grid-column: span 12; display: grid; gap: 16px; grid-template-columns: repeat(5, 1fr); }
@media (max-width: 1100px) { .row5 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .row5 { grid-template-columns: 1fr; } }
