/* Palette sampled from the Bowser corporate site (warm), kept on a light background. */
:root {
  --ink: #2d232e;         /* Bowser deep plum — warm near-black text */
  --muted: #8a8780;       /* Bowser warm gray — also the Egan wordmark gray */
  --accent: #ffab40;      /* Bowser amber — active states / highlights */
  --accent-deep: #b45309; /* legible amber for chart data + hover on white */
  --warn: #b91c1c;
  --bg: #f1f0ea;          /* Bowser warm cream — light page background */
  --surface: #ffffff;     /* cards / plots / modal */
  --line: #e0ddcf;        /* Bowser tan — borders and dividers */
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font-family: "Raleway", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
       color: var(--ink); background: var(--bg); }
.dash-header { display: flex; align-items: center; gap: 1.25rem; padding: 1.25rem 2rem; }
.dash-logo { height: 42px; width: auto; display: block; }
.dash-title { font-size: 1.35rem; font-weight: 800; margin: 0;
              padding-left: 1.25rem; border-left: 2px solid var(--line); color: var(--ink); }
.freshness { color: var(--muted); font-size: 0.95rem; }
.freshness.stale { color: var(--warn); font-weight: 700; }
.freshness.stale::after { content: " (pipeline stale)"; }
.dash-brand { margin-left: auto; color: var(--muted); font-size: 0.8rem; letter-spacing: 0.04em; }
.state-banner { margin: 0 2rem 1rem; padding: 0.85rem 1.1rem; border-radius: 0.5rem; font-weight: 600; }
.state-info { background: #fdf1dc; color: #8a5a12; }
.state-error { background: #fae3e3; color: var(--warn); }
.window-selector, .grain-selector { display: flex; gap: 0.5rem; padding: 0 2rem 1rem; }
.window-selector button, .grain-selector button {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  padding: 0.5rem 1rem; border-radius: 0.5rem; cursor: pointer; }
.window-selector button.active, .grain-selector button.active {
  background: var(--accent); color: var(--ink); border-color: var(--accent); font-weight: 600; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
         gap: 1rem; padding: 0 2rem 2rem; }
.card { background: var(--surface); border-radius: 1rem; padding: 1.25rem 1.4rem;
        box-shadow: 0 1px 3px rgba(45,35,46,0.10); container-type: inline-size; overflow: hidden; }
.card-label { color: var(--muted); font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.05em;
              white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Scale the number with the card so long totals never spill past the box. */
.card-value { font-size: clamp(1.5rem, 17cqi, 2.6rem); font-weight: 800; line-height: 1.1; margin-top: 0.4rem;
              white-space: nowrap; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.plot-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
             gap: 1rem; padding: 0 2rem 3rem; }
.plot { position: relative; background: var(--surface); border-radius: 0.75rem; padding: 1rem; height: 240px;
        box-shadow: 0 1px 3px rgba(45,35,46,0.10); }
.plot-expand { position: absolute; top: 0.45rem; right: 0.5rem; z-index: 2;
               width: 1.7rem; height: 1.7rem; display: grid; place-items: center;
               border: 1px solid var(--line); background: rgba(255,255,255,0.85); color: var(--muted);
               border-radius: 0.4rem; font-size: 0.95rem; line-height: 1; cursor: pointer;
               transition: color 0.15s, border-color 0.15s, background 0.15s; }
.plot-expand:hover { color: var(--accent-deep); border-color: var(--accent-deep); background: #fff; }

/* Expand-to-modal */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(45,35,46,0.5); backdrop-filter: blur(2px); }
.modal-panel { position: relative; z-index: 1; background: var(--surface); border-radius: 1rem;
               padding: 2.75rem 1.5rem 1.5rem; width: min(92vw, 1040px); height: min(82vh, 640px);
               box-shadow: 0 24px 70px rgba(45,35,46,0.35); }
.modal-canvas-wrap { position: relative; height: 100%; }
.modal-close { position: absolute; top: 0.5rem; right: 0.7rem; z-index: 2;
               width: 2rem; height: 2rem; display: grid; place-items: center;
               border: none; background: transparent; color: var(--muted);
               font-size: 1.6rem; line-height: 1; cursor: pointer; border-radius: 0.4rem; }
.modal-close:hover { color: var(--ink); background: var(--line); }

/* Sign-in screen + sign-out control */
.login-screen { min-height: 100vh; display: flex; flex-direction: column;
                align-items: center; justify-content: center; gap: 1.1rem; text-align: center; }
.login-logo { height: 64px; width: auto; }
.login-title { font-size: 1.5rem; font-weight: 800; margin: 0; color: var(--ink); }
.login-btn { font: inherit; font-weight: 700; padding: 0.8rem 1.6rem; border: none;
             border-radius: 0.5rem; background: var(--ink); color: #fff; cursor: pointer; }
.login-btn:hover { background: #16101a; }
.login-error { color: var(--warn); margin: 0; }
.access-denied { display: flex; flex-direction: column; align-items: center; gap: 1.1rem;
                 max-width: 28rem; }
.login-screen .dash-brand { margin: 0.5rem 0 0; }
.signout-btn { font: inherit; margin-left: 0.75rem; padding: 0.4rem 0.9rem;
               border: 1px solid var(--line); border-radius: 0.4rem; background: transparent;
               color: var(--muted); cursor: pointer; }
.signout-btn:hover { color: var(--ink); border-color: var(--ink); }
