/* Renewals board: slate ink + teal on cool gray. Schibsted Grotesk + Spline Sans Mono. */
:root {
  --ink: #14262E;
  --ink-2: #3B505A;      /* secondary text, 7.6:1 on white */
  --ground: #EAEFF2;
  --card: #FFFFFF;
  --line: #CBD5DA;
  --line-2: #DDE4E8;
  --teal: #0B6E6E;       /* 6.1:1 with white text */
  --teal-dark: #085555;
  --teal-tint: #DCEFEE;

  --red: #A8231B;  --red-bg: #FBE8E6;  --red-line: #E5A8A3;
  --amber: #F4B92E; --amber-ink: #382600; --amber-bg: #FDF0CC; --amber-line: #E3B547;
  --green: #1B6A38; --green-bg: #E2F2E7; --green-line: #9CCDAB;
  --gray: #4F5F67;  --gray-bg: #E6EAEC; --gray-line: #B6C1C7;

  --r: 8px;
  --shadow: 0 1px 0 rgba(20,38,46,.06), 0 6px 18px -8px rgba(20,38,46,.18);
  --sans: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Spline Sans Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --gutter: clamp(16px, 4vw, 40px);
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 16px; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 1rem/1.55 var(--sans); overflow-wrap: break-word; }
h1, h2, p, ul { margin: 0; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { max-width: 1320px; margin-inline: auto; padding-inline: var(--gutter); }
.ico { width: 1.25em; height: 1.25em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.num, .date-t, .left, .tile-n, .today-d, .wk-when { font-variant-numeric: tabular-nums; }

/* banner + top bar */
.banner { background: var(--ink); color: #E8F0F3; }
.banner p { max-width: 1240px; margin: 0 auto; padding: 10px var(--gutter); font-size: .9375rem; }
.banner b { color: #fff; }
.topbar { background: var(--card); border-bottom: 1px solid var(--line); }
.topbar-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.0625rem; letter-spacing: -.005em; }
.brand-ico { width: 28px; height: 28px; color: var(--teal); stroke-width: 1.8; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 18px; border-radius: var(--r); border: 2px solid transparent; font-weight: 700; text-decoration: none; cursor: pointer; transition: background-color .15s, border-color .15s, transform .15s; }
.btn.primary { background: var(--teal); color: #fff; }
.btn.primary:hover { background: var(--teal-dark); }
.btn.ghost { background: transparent; border-color: var(--ink); color: var(--ink); }
.btn.ghost:hover { background: var(--ink); color: #fff; }
.btn.small { min-height: 44px; padding: 6px 12px; font-size: .9375rem; }
.btn.solid { background: var(--ink); color: #fff; }
.btn.solid:hover { background: #000; }
.btn.quiet { background: var(--card); border-color: var(--line); color: var(--ink); }
.btn.quiet:hover { border-color: var(--ink); }

/* hero */
.hero { padding: clamp(28px, 4.5vw, 52px) 0 clamp(20px, 3vw, 28px); }
.hero-in { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 32px; align-items: end; }
.eyebrow { font-family: var(--mono); font-size: .8125rem; letter-spacing: .14em; text-transform: uppercase; color: var(--teal); font-weight: 600; margin-bottom: 14px; }
h1 { font-size: clamp(2.75rem, 7vw, 5.25rem); line-height: .98; letter-spacing: -.035em; font-weight: 800; max-width: 16ch; margin-bottom: 20px; }
.lede { font-size: 1.1875rem; max-width: 52ch; color: var(--ink-2); margin-bottom: 26px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.today { display: grid; justify-items: start; border-left: 3px solid var(--teal); padding: 4px 0 4px 18px; min-width: 180px; }
.today-k { font-family: var(--mono); font-size: .8125rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); }
.today-d { font-size: 5rem; line-height: .95; font-weight: 800; letter-spacing: -.04em; }
.today-m { font-size: .9375rem; color: var(--ink-2); max-width: 16ch; }

/* layout */
.board { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 28px; align-items: start; padding-bottom: 64px; }
.board-main { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; min-width: 0; }
.board-side { position: sticky; top: 16px; outline-offset: 6px; border-radius: var(--r); }
.board-side.pulse .phone { animation: pulse .9s ease-out 1; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(11,110,110,.55); } 100% { box-shadow: 0 0 0 18px rgba(11,110,110,0); } }

/* tiles */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.tile { display: grid; grid-template-columns: auto 1fr; grid-template-areas: "ico n" "l l"; align-items: center; column-gap: 10px; row-gap: 2px; text-align: left; padding: 14px 16px; min-height: 96px; background: var(--card); border: 2px solid var(--line); border-radius: var(--r); cursor: pointer; box-shadow: var(--shadow); transition: transform .15s, border-color .15s; }
.tile:hover { transform: translateY(-2px); }
.tile .ico { grid-area: ico; width: 26px; height: 26px; }
.tile-n { grid-area: n; font-size: 2.5rem; font-weight: 800; line-height: 1; letter-spacing: -.03em; justify-self: end; }
.tile-l { grid-area: l; font-weight: 700; font-size: .9375rem; }
.tile[aria-pressed="true"] { border-color: var(--ink); box-shadow: 0 0 0 2px var(--ink); }
.t-expired { border-top: 6px solid var(--red); } .t-expired .ico { color: var(--red); }
.t-soon { border-top: 6px solid var(--amber); } .t-soon .ico { color: #8A5B00; }
.t-valid { border-top: 6px solid var(--green); } .t-valid .ico { color: var(--green); }
.t-missing { border-top: 6px dashed var(--gray-line); } .t-missing .ico { color: var(--gray); }
.tiles-note { margin-top: 10px; font-size: .9375rem; color: var(--ink-2); }

/* controls */
.controls { display: grid; gap: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-btn { min-height: 44px; padding: 6px 16px; border: 2px solid var(--line); border-radius: var(--r); background: var(--card); font-weight: 600; cursor: pointer; }
.chip-btn:hover { border-color: var(--ink); }
.chip-btn[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.ctl-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.search { position: relative; flex: 1 1 260px; }
.search .ico { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-2); pointer-events: none; }
.search input { width: 100%; min-height: 48px; padding: 8px 14px 8px 42px; border: 2px solid var(--line); border-radius: var(--r); background: var(--card); }
.search input::placeholder { color: #5A6B74; }
.seg { display: inline-flex; border: 2px solid var(--line); border-radius: var(--r); background: var(--card); padding: 3px; margin: 0; min-width: 0; }
.seg { position: relative; }
.seg input { position: absolute; left: 0; top: 0; opacity: 0; width: 1px; height: 1px; }
.seg label { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 4px 14px; border-radius: 5px; font-weight: 600; cursor: pointer; }
.seg input:checked + label { background: var(--teal); color: #fff; }
.seg input:focus-visible + label { outline: 3px solid var(--teal); outline-offset: 2px; }

/* table */
.grid { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.grid th { text-align: left; font-family: var(--mono); font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); font-weight: 600; padding: 12px 14px; background: #F4F7F8; border-bottom: 1px solid var(--line); }
.grid td { padding: 10px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.row:last-child td { border-bottom: 0; }
.row td:first-child { border-left: 6px solid transparent; }
.row.st-expired td:first-child { border-left-color: var(--red); }
.row.st-soon td:first-child { border-left-color: var(--amber); }
.row.st-valid td:first-child { border-left-color: var(--green); }
.row.st-missing td:first-child { border-left-color: var(--gray-line); }
.who { font-weight: 700; white-space: nowrap; }
.item { color: var(--ink); }
.date-wrap { display: grid; gap: 0; }
.left { font-family: var(--mono); font-size: .8125rem; color: var(--ink-2); white-space: nowrap; }
.act { display: grid; gap: 6px; width: 168px; margin-left: auto; }
.act .btn { white-space: nowrap; }
.group-row th { background: var(--teal-tint); color: var(--ink); font-family: var(--sans); font-size: 1rem; letter-spacing: 0; text-transform: none; font-weight: 800; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.g-n { font-weight: 500; color: var(--ink-2); font-size: .9375rem; margin-left: 6px; }
.empty-row td { padding: 28px 16px; color: var(--ink-2); }
.list-foot { margin-top: 10px; font-size: .9375rem; color: var(--ink-2); }

.date-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 4px 10px; margin-left: -10px; margin-bottom: -6px; border: 2px solid transparent; border-radius: var(--r); background: transparent; cursor: pointer; font-family: var(--mono); font-size: .875rem; font-weight: 500; white-space: nowrap; }
.date-btn .ico { width: 1.05em; height: 1.05em; color: var(--ink-2); }
.date-btn:hover { border-color: var(--line); background: #F4F7F8; }
.date-btn.empty { color: var(--teal-dark); text-decoration: underline; text-underline-offset: 3px; }
.date-input { min-height: 44px; padding: 4px 8px; border: 2px solid var(--teal); border-radius: var(--r); background: var(--card); font-family: var(--mono); font-size: .875rem; max-width: 100%; }

/* status chip: color + icon + text */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 8px; border-radius: 6px; border: 1.5px solid; font-weight: 700; font-size: .9375rem; white-space: nowrap; }
.chip .ico { width: 1.15em; height: 1.15em; }
.chip.st-expired { background: var(--red-bg); border-color: var(--red-line); color: var(--red); }
.chip.st-soon { background: var(--amber); border-color: var(--amber-line); color: var(--amber-ink); }
.chip.st-valid { background: var(--green-bg); border-color: var(--green-line); color: var(--green); }
.chip.st-missing { background: var(--gray-bg); border-color: var(--gray-line); color: var(--gray); border-style: dashed; }
.row.flash td { animation: flash 1.4s ease-out 1; }
@keyframes flash { 0% { background-color: #C9ECE9; } 100% { background-color: transparent; } }

/* add form */
.add { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 22px; box-shadow: var(--shadow); }
.add h2 { font-size: 1.375rem; letter-spacing: -.01em; margin-bottom: 14px; }
#add-form { display: grid; grid-template-columns: 1.1fr 1.4fr 1fr auto; gap: 14px; align-items: end; }
.field { display: grid; gap: 6px; min-width: 0; }
.field label { font-weight: 700; font-size: .9375rem; }
.opt { font-weight: 400; color: var(--ink-2); }
.field input { min-height: 48px; padding: 8px 12px; border: 2px solid var(--line); border-radius: var(--r); background: #fff; width: 100%; min-width: 0; }
.field input:focus { border-color: var(--teal); }
.form-msg { grid-column: 1 / -1; font-size: .9375rem; min-height: 1.4em; }
.form-msg.err { color: var(--red); font-weight: 700; }
.form-msg.ok { color: var(--green); font-weight: 700; }

/* weekly text phone */
.board-side h2 { font-size: 1.375rem; letter-spacing: -.01em; margin-bottom: 6px; }
.side-note { color: var(--ink-2); font-size: .9375rem; margin-bottom: 16px; }
.phone { position: relative; background: #0E1A20; border-radius: 34px; padding: 12px; box-shadow: 0 18px 40px -18px rgba(20,38,46,.55); max-width: 340px; }
.phone-notch { position: absolute; top: 12px; left: 50%; width: 92px; height: 18px; background: #0E1A20; border-radius: 0 0 12px 12px; transform: translateX(-50%); z-index: 2; }
.phone-head { display: flex; align-items: center; gap: 10px; background: #F4F7F8; border-radius: 24px 24px 0 0; padding: 30px 16px 10px; border-bottom: 1px solid var(--line); }
.avatar { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--teal); color: #fff; font-weight: 800; font-size: .8125rem; flex: none; }
.phone-who { display: grid; line-height: 1.2; min-width: 0; }
.phone-who b { font-size: .9375rem; }
.phone-who small { font-size: .8125rem; color: var(--ink-2); }
.phone-body { background: #fff; border-radius: 0 0 24px 24px; padding: 16px 12px 14px; }
.bubble { background: #E7ECEF; border-radius: 6px 20px 20px 20px; padding: 12px 14px; font-size: .9375rem; line-height: 1.45; color: var(--ink); }
.bubble p + ul, .bubble ul + p, .bubble p + p { margin-top: 8px; }
.bubble ul { list-style: none; padding: 0; display: grid; gap: 6px; }
.bubble li { padding-left: 12px; border-left: 3px solid var(--line); }
.wk-h { font-family: var(--mono); font-size: .8125rem; font-weight: 600; letter-spacing: .06em; }
.wk-red { color: var(--red); } .wk-amber { color: #7A5200; }
.wk-what { font-weight: 700; }
.wk-when { color: var(--ink-2); }
.wk-foot { color: var(--ink-2); font-size: .875rem; }
.phone-time { text-align: left; margin: 6px 0 0 6px; font-size: .75rem; color: var(--ink-2); }

/* toast */
.toast { position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 24px); max-width: min(92vw, 520px); background: var(--ink); color: #fff; padding: 14px 18px; border-radius: var(--r); font-weight: 600; box-shadow: 0 10px 30px -8px rgba(0,0,0,.45); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 20; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast:empty { display: none; }

.foot { border-top: 1px solid var(--line); padding: 24px 0 40px; color: var(--ink-2); font-size: .9375rem; }
.foot p { max-width: 70ch; }

/* medium: single column */
@media (max-width: 1100px) {
  .board { grid-template-columns: minmax(0, 1fr); }
  .board-side { position: static; max-width: 420px; }
  #add-form { grid-template-columns: 1fr 1fr; }
  #add-form .btn { grid-column: 1 / -1; }
}
/* small: rows become stacked cards */
@media (max-width: 860px) {
  .grid { background: transparent; border: 0; box-shadow: none; overflow: visible; }
  .grid thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .grid, .grid tbody { display: block; }
  .row { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "who status" "item item" "date date" "act act"; gap: 2px 12px; background: var(--card); border: 1px solid var(--line); border-left: 6px solid var(--line); border-radius: var(--r); padding: 14px 14px 12px; margin-bottom: 12px; box-shadow: var(--shadow); }
  .row.st-expired { border-left-color: var(--red); } .row.st-soon { border-left-color: var(--amber); }
  .row.st-valid { border-left-color: var(--green); } .row.st-missing { border-left-color: var(--gray-line); }
  .row td, .row td:first-child { display: block; padding: 0; border: 0; }
  .c-who { grid-area: who; align-self: center; } .c-status { grid-area: status; justify-self: end; }
  .c-item { grid-area: item; font-size: 1.125rem; font-weight: 700; line-height: 1.3; padding: 2px 0 8px; }
  .c-date { grid-area: date; align-self: center; }
  .date-wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  .date-btn { margin-bottom: 0; }
  .c-actions { grid-area: act; margin-top: 10px; padding-top: 12px !important; border-top: 1px dashed var(--line) !important; }
  .act { width: auto; grid-template-columns: 1fr 1fr; gap: 8px; }
  .act .btn { width: 100%; }
  .act .btn:only-child { grid-column: 1 / -1; }
  .who { font-family: var(--mono); font-size: .8125rem; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-2); }
  .group-row { display: block; margin: 16px 0 8px; }
  .group-row th { display: block; background: transparent; padding: 0 2px; border: 0; font-size: 1.125rem; }
  .empty-row, .empty-row td { display: block; background: var(--card); border-radius: var(--r); }
  .row.flash { animation: flash-card 1.4s ease-out 1; }
  .row.flash td { animation: none; }
}
@keyframes flash-card { 0% { background-color: #C9ECE9; } 100% { background-color: var(--card); } }
@media (max-width: 640px) {
  .hero-in { grid-template-columns: 1fr; gap: 24px; }
  .today { grid-template-columns: auto 1fr; align-items: center; column-gap: 14px; }
  .today-k { grid-column: 1 / -1; }
  .today-d { font-size: 3.5rem; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-actions .btn { flex: 1 1 100%; }
  .topbar-in .btn { min-height: 44px; padding: 6px 12px; font-size: .9375rem; }
  .brand { font-size: 1rem; }
  .seg { width: 100%; }
  .seg label { flex: 1; justify-content: center; }
  #add-form { grid-template-columns: 1fr; }
  .board-side { max-width: none; }
  .phone { margin-inline: auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
