/* WDI Subscription Tracker — hand-written CSS, no build step needed. */
:root {
  --ink: #16202e;
  --ink-2: #3c4a5c;
  --muted: #6b7686;
  --line: #e3e0d9;
  --bg: #f5f3ee;
  --card: #ffffff;
  --side: #121a26;
  --side-ink: #c9d1dc;
  --accent: #1f7a6d;
  --accent-ink: #ffffff;
  --accent-soft: #e2f1ee;
  --warn: #b26a00;
  --warn-soft: #fff1d6;
  --danger: #b3261e;
  --danger-soft: #fde8e6;
  --radius: 10px;
  --font: ui-sans-serif, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 15px/1.5 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; letter-spacing: -0.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: .95rem; }
p { margin: 0 0 1rem; }
.num { font-variant-numeric: tabular-nums; }

/* Layout */
.shell { display: grid; grid-template-columns: 228px 1fr; min-height: 100vh; }
.side { background: var(--side); color: var(--side-ink); padding: 22px 16px; display: flex; flex-direction: column; gap: 24px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 650; font-size: .98rem; line-height: 1.2; padding: 0 6px; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; font-size: .8rem; font-weight: 800; color: #fff; flex: none; }
.brand small { display: block; color: var(--side-ink); font-weight: 400; font-size: .75rem; opacity: .8; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { color: var(--side-ink); padding: 8px 10px; border-radius: 7px; font-size: .92rem; }
.nav a:hover { background: rgba(255,255,255,.06); text-decoration: none; color: #fff; }
.nav a.on { background: rgba(255,255,255,.1); color: #fff; font-weight: 600; }
.side-foot { margin-top: auto; font-size: .8rem; padding: 0 6px; }
.side-foot form { margin: 6px 0 0; }
.side-foot button { background: none; border: 0; color: var(--side-ink); padding: 0; cursor: pointer; font: inherit; text-decoration: underline; }
.main { padding: 28px 36px 60px; max-width: 1180px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { color: var(--muted); margin: 0; }
.crumb { font-size: .85rem; color: var(--muted); margin-bottom: 4px; }

/* Cards & grids */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card + .card { margin-top: 18px; }
.grid > .card + .card, .grid > * > .card + .card { margin-top: 0; }
.stack > .card + .card { margin-top: 18px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; gap: 12px; }
.card-head a { font-size: .88rem; }
.grid { display: grid; gap: 18px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-main { grid-template-columns: 1.6fr 1fr; align-items: start; }
.stat .label { color: var(--muted); font-size: .82rem; text-transform: uppercase; letter-spacing: .05em; }
.stat .value { font-size: 1.7rem; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .sub { color: var(--muted); font-size: .85rem; }
.stack > * + * { margin-top: 18px; }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
td.r, th.r { text-align: right; }
tbody tr:hover { background: #faf9f6; }
.cell-title { font-weight: 600; color: var(--ink); }
.cell-sub { color: var(--muted); font-size: .85rem; }
.table-wrap { overflow-x: auto; margin: -6px -10px; }

/* Chips */
.chip { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: #eef0f3; color: var(--ink-2); white-space: nowrap; }
.chip.ok { background: var(--accent-soft); color: var(--accent); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.danger { background: var(--danger-soft); color: var(--danger); }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }

/* Forecast bars */
.bars { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; align-items: end; height: 150px; }
.bar { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 4px; }
.bar span.fill { width: 100%; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; opacity: .85; }
.bar:hover span.fill { opacity: 1; }
.bar small { font-size: .7rem; color: var(--muted); }

/* Forms */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 18px; }
.form-grid .full { grid-column: 1 / -1; }
label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 5px; }
.hint { color: var(--muted); font-size: .8rem; font-weight: 400; margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=url], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: #fff; border: 1px solid #cfcbc2; border-radius: 7px; padding: 8px 10px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
textarea { min-height: 90px; resize: vertical; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.inline { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.inline > div { min-width: 140px; }
.field-error { color: var(--danger); font-size: .82rem; margin-top: 4px; }
.picker { border: 1px solid #cfcbc2; border-radius: 7px; max-height: 240px; overflow: auto; padding: 6px 10px; background: #fff; }
.picker .check { padding: 4px 0; }
.picker-filter { margin-bottom: 8px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-weight: 600; font-size: .9rem; padding: 8px 14px; border-radius: 7px; border: 1px solid transparent; background: var(--accent); color: var(--accent-ink); cursor: pointer; text-decoration: none; }
.btn:hover { filter: brightness(1.07); text-decoration: none; }
.btn.ghost { background: #fff; color: var(--ink); border-color: #cfcbc2; }
.btn.danger { background: #fff; color: var(--danger); border-color: #e6b4af; }
.btn.small { padding: 5px 10px; font-size: .82rem; }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* Messages */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 18px; font-size: .92rem; }
.flash.ok { background: var(--accent-soft); color: #145247; }
.flash.err { background: var(--danger-soft); color: #7d1a14; }
.flash.warn { background: var(--warn-soft); color: #6e4200; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }
.empty p { margin-bottom: 12px; }
dl.facts { display: grid; grid-template-columns: 160px 1fr; gap: 8px 16px; margin: 0; }
dl.facts dt { color: var(--muted); font-size: .88rem; }
dl.facts dd { margin: 0; }
pre.out { background: #f1efe9; padding: 12px; border-radius: 8px; font: .8rem/1.5 var(--mono); white-space: pre-wrap; }

/* Filter bar */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 16px; }
.filters > div { min-width: 150px; }
.filters .grow { flex: 1; min-width: 200px; }

/* Login */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--side); }
.auth .card { width: 100%; max-width: 380px; padding: 28px; }
.auth .brand { color: var(--ink); margin-bottom: 20px; padding: 0; }
.auth .brand small { color: var(--muted); }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 12px 16px; gap: 12px; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .side-foot { margin: 0 0 0 auto; }
  .main { padding: 20px 16px 40px; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .grid-2, .grid-main, .form-grid { grid-template-columns: 1fr; }
  dl.facts { grid-template-columns: 1fr; }
}

/* Keep grid children from forcing the page wider than the screen. */
.main, .grid > * { min-width: 0; }
.nowrap { white-space: nowrap; }
@media (max-width: 900px) {
  .stat .value { font-size: 1.3rem; }
  .card { padding: 16px; }
}
