/* Marty — "Nickel City" theme.
   Built off the Bills' 2026 Nickel City alternate: all-gray (Buffalo nickel / steel / grain elevators),
   royal-blue block numerals outlined red + white, the red "charge". */
:root {
  --royal: #00338D;
  --royal-hi: #2c62d8;
  --red: #C60C30;
  --white: #ffffff;
  --graphite: #16181b;
  --steel-900: #1d2024;
  --steel-800: #25292e;
  --steel-700: #30353b;
  --steel-600: #3d434a;
  --nickel-500: #7b828a;
  --nickel-400: #9aa1a8;
  --nickel-300: #b9bec4;
  --nickel-200: #d3d6da;
  --nickel-100: #e9ebed;

  --bg: var(--graphite);
  --surface: var(--steel-800);
  --surface-2: var(--steel-700);
  --line: #3a4046;
  --text: var(--nickel-100);
  --muted: var(--nickel-400);
  --accent: var(--royal-hi);
  --radius: 14px;
  --display: "Oswald", "Arial Narrow", "Roboto Condensed", Impact, sans-serif;
  --body: "Inter", -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #cfd3d7;
    --surface: #eceef0;
    --surface-2: #dfe2e5;
    --line: #b9bec4;
    --text: #15181b;
    --muted: #5b626a;
    --accent: var(--royal);
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 15px/1.45 var(--body);
  color: var(--text);
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,.018) 0 1px, transparent 1px 3px),
    linear-gradient(180deg, var(--bg), color-mix(in srgb, var(--bg) 85%, #000));
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: var(--accent); text-decoration: none; }
button, input { font: inherit; color: inherit; }

/* ───────── brand ───────── */
.wordmark {
  font: 700 22px/1 var(--display);
  letter-spacing: .22em;
  color: var(--text);
  text-transform: uppercase;
}
.wordmark.big { font-size: clamp(48px, 13vw, 72px); letter-spacing: .16em; }
.charge {
  height: 10px; width: 120px; margin: 0 auto 14px;
  background: linear-gradient(100deg, transparent 0 8%, var(--red) 8% 78%, transparent 78%);
  clip-path: polygon(0 60%, 70% 0, 100% 40%, 30% 100%);
  filter: drop-shadow(0 0 0 var(--white));
}
.charge.small { position: absolute; left: 0; top: 0; width: 90px; height: 5px; margin: 0; opacity: .9; }
.boot { display: grid; place-items: center; min-height: 100vh; opacity: .25; }

/* ───────── buttons / inputs ───────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  border: 1px solid var(--line); background: var(--surface-2);
  padding: .7em 1.1em; border-radius: 10px; cursor: pointer; font-weight: 600;
}
.btn:hover { border-color: var(--nickel-500); }
.btn.primary { background: var(--royal); border-color: var(--royal); color: #fff; box-shadow: inset 0 -3px 0 var(--red); }
.btn.primary:hover { background: #0a3fa6; }
.btn.wide { width: 100%; padding: .85em; }
.btn svg { width: 18px; height: 18px; fill: currentColor; }
.btn:disabled { opacity: .55; cursor: default; }
.link { background: none; border: 0; color: var(--accent); cursor: pointer; padding: .3em 0; }
input[type=text], input[type=search], input[type=date], input:not([type]), .add-row input {
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: .7em .85em; width: 100%; outline: none;
}
input:focus { border-color: var(--royal-hi); box-shadow: 0 0 0 3px color-mix(in srgb, var(--royal-hi) 35%, transparent); }
label { font-size: 13px; color: var(--muted); }
.msg { min-height: 1.4em; color: var(--muted); font-size: 14px; }
.msg.err { color: #ff6b81; }
.muted { color: var(--muted); }

/* ───────── sign in ───────── */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card {
  width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line);
  border-radius: 20px; padding: 32px 26px 22px; box-shadow: 0 30px 60px rgba(0,0,0,.35);
  border-top: 4px solid var(--royal);
}
.brand { text-align: center; margin-bottom: 26px; }
.tagline { color: var(--muted); letter-spacing: .3em; text-transform: uppercase; font-size: 11px; margin-top: 10px; }
.stack { display: grid; gap: 10px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; margin: 18px 0; text-transform: uppercase; letter-spacing: .15em; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.code-input { font: 700 28px/1 var(--display) !important; letter-spacing: .5em; text-align: center; }

/* ───────── app chrome ───────── */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5;
  display: flex; align-items: center; gap: 22px; padding: 14px max(16px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--steel-900) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
@media (prefers-color-scheme: light) { .topbar { background: color-mix(in srgb, #e3e6e9 90%, transparent); } }
.tabs { display: flex; gap: 4px; }
.tabs a { color: var(--muted); padding: .45em .9em; border-radius: 8px; font: 600 14px/1 var(--display); letter-spacing: .12em; text-transform: uppercase; }
.tabs a.on { color: var(--text); background: var(--surface-2); box-shadow: inset 0 -2px 0 var(--red); }
.me {
  margin-left: auto; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: var(--royal); color: #fff; font: 700 15px/1 var(--display); border: 2px solid var(--nickel-300);
}
main { max-width: 860px; margin: 0 auto; padding: 18px 16px 110px; }
.bottombar { display: none; }
@media (max-width: 640px) {
  .tabs { display: none; }
  .bottombar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px));
    background: color-mix(in srgb, var(--steel-900) 94%, transparent); backdrop-filter: blur(10px);
    border-top: 1px solid var(--line);
  }
  .bottombar a { display: grid; justify-items: center; gap: 2px; font-size: 11px; color: var(--muted); padding: 6px 0; }
  .bottombar svg { width: 22px; height: 22px; fill: currentColor; }
  .bottombar a.on { color: var(--text); }
  .bottombar a.on svg { fill: var(--royal-hi); }
}

/* ───────── calendar ───────── */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.toolbar input[type=search] { flex: 1 1 180px; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: none; padding: .45em .9em; border-radius: 7px; cursor: pointer; color: var(--muted); font-weight: 600; }
.seg button.on { background: var(--royal); color: #fff; }
.dates { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dates label { display: flex; align-items: center; gap: 6px; }
.dates input { width: auto; padding: .45em .6em; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.chip {
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  padding: .35em .8em; border-radius: 999px; cursor: pointer; font-size: 13px; font-weight: 600;
}
.chip.on { color: #fff; background: var(--steel-600); border-color: var(--nickel-500); }
.chip.bills.on { background: var(--royal); border-color: var(--red); }

.day { margin-bottom: 18px; }
.day-head {
  position: sticky; top: 63px; z-index: 2; display: flex; align-items: center; gap: 14px;
  padding: 8px 0; background: linear-gradient(var(--bg) 70%, transparent);
}
.jersey {
  font: 700 40px/1 var(--display); color: var(--royal); min-width: 58px; text-align: center;
  -webkit-text-stroke: 1.5px var(--red); paint-order: stroke fill;
  text-shadow: 2px 2px 0 var(--white), -1px -1px 0 var(--white), 1px -1px 0 var(--white), -1px 1px 0 var(--white);
}
.day-name { font: 600 15px/1.1 var(--display); letter-spacing: .14em; text-transform: uppercase; }
.day-sub { color: var(--muted); font-size: 12px; letter-spacing: .08em; }
.today-tag { margin-left: auto; font: 700 11px/1 var(--display); letter-spacing: .2em; color: #fff; background: var(--red); padding: 4px 8px; border-radius: 4px; }
.ev {
  display: grid; grid-template-columns: 78px 1fr; gap: 12px; align-items: start;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; margin: 8px 0 8px 0;
}
.ev .time { font: 600 15px/1.2 var(--display); letter-spacing: .04em; color: var(--text); }
.ev .time small { display: block; color: var(--muted); font: 500 12px/1.3 var(--body); letter-spacing: 0; }
.ev .title { font-weight: 600; }
.ev .meta { color: var(--muted); font-size: 13px; margin-top: 3px; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.tag { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 2px 7px; border-radius: 5px; background: var(--surface-2); color: var(--muted); }
.tag.warn { background: color-mix(in srgb, #f5b100 20%, transparent); color: #f5c542; }
.tag.win { background: color-mix(in srgb, #1e9e5a 25%, transparent); color: #4fd18b; }
.tag.loss { background: color-mix(in srgb, var(--red) 25%, transparent); color: #ff7a8f; }
.ev.bills { border-left: 5px solid var(--royal); background: linear-gradient(90deg, color-mix(in srgb, var(--royal) 18%, var(--surface)), var(--surface) 55%); }
.ev.bills .title::before { content: ""; display: inline-block; width: 18px; height: 6px; margin-right: 8px; vertical-align: middle;
  background: var(--red); clip-path: polygon(0 60%, 70% 0, 100% 40%, 30% 100%); }
.ev.past { opacity: .72; }
.empty { text-align: center; color: var(--muted); padding: 50px 10px; border: 1px dashed var(--line); border-radius: var(--radius); }

/* ───────── lists ───────── */
.add-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-bottom: 16px; }
.add-row .note-in { grid-column: 1 / -1; order: 3; }
@media (min-width: 641px) { .add-row { grid-template-columns: 2fr 2fr auto; } .add-row .note-in { grid-column: auto; order: 0; } }
.items { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.item {
  display: grid; grid-template-columns: 34px 1fr; gap: 12px; align-items: start;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px;
}
.tick {
  width: 30px; height: 30px; border-radius: 8px; border: 2px solid var(--nickel-500); background: none; cursor: pointer;
  display: grid; place-items: center; color: #fff;
}
.tick:hover { border-color: var(--royal-hi); }
.item.done .tick { background: var(--royal); border-color: var(--red); }
.tick svg { width: 18px; height: 18px; fill: currentColor; }
.item .name { font-weight: 600; overflow-wrap: anywhere; }
.item.done .name { text-decoration: line-through; text-decoration-color: var(--red); color: var(--muted); }
.item .note { font-size: 13px; color: var(--text); opacity: .85; margin-top: 2px; overflow-wrap: anywhere; }
.item .by { font-size: 12px; color: var(--muted); margin-top: 4px; }
.item details { font-size: 12px; color: var(--muted); margin-top: 4px; }
.item details summary { cursor: pointer; }
.done-block { margin-top: 22px; }
.done-block > summary { cursor: pointer; font: 600 14px/1 var(--display); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); padding: 8px 0 12px; }
.section-title { font: 600 14px/1 var(--display); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }

/* ───────── account ───────── */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.panel h2 { font: 600 22px/1.2 var(--display); letter-spacing: .06em; margin: 0 0 14px; }
.panel h3 { font: 600 14px/1 var(--display); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.panel hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
.pk-list { list-style: none; padding: 0; display: grid; gap: 8px; }
.pk-list li { display: flex; align-items: center; gap: 10px; background: var(--surface-2); padding: 10px 12px; border-radius: 10px; }
.pk-list li span { flex: 1; }
.pk-list small { color: var(--muted); display: block; }

dialog.sheet { border: 1px solid var(--line); border-top: 4px solid var(--royal); border-radius: 18px; background: var(--surface); color: var(--text); max-width: 380px; padding: 22px; }
dialog.sheet::backdrop { background: rgba(0,0,0,.55); }
dialog.sheet h3 { font: 600 20px/1.2 var(--display); margin: 0 0 8px; }
dialog .row { display: flex; gap: 8px; margin-top: 14px; }

/* ───────── photos & files ───────── */
.small { font-size: 13px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.tile .thumb { aspect-ratio: 1 / 1; width: 100%; object-fit: cover; background: var(--surface-2); display: block; }
.tile .doc { aspect-ratio: 1 / 1; display: grid; place-items: center; background: var(--surface-2);
  font: 700 22px/1 var(--display); letter-spacing: .1em; color: var(--muted); }
.tile .cap { padding: 8px 10px 4px; font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.tile .sub { padding: 0 10px 8px; font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; gap: 6px; }
.tile .sub a { font-weight: 600; }
.attach { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.attach a { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); }
.snooze-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.snooze-row button { font-size: 12px; padding: .35em .7em; }
.snooze-row input { width: auto; padding: .3em .5em; font-size: 12px; }
.tag.back { background: color-mix(in srgb, var(--royal-hi) 25%, transparent); color: #8fb0ff; }
.item .actions { display: flex; gap: 12px; margin-top: 6px; font-size: 12px; }
.ml { margin-left: 8px; }
.span-all { grid-column: 1 / -1; }
