/* Dashboard in the GFK Biel look: pink accent, near-black text, soft pink tints, serif headings. */
:root {
  --bg: #faf7f8; --surface: #fff; --ink: #1f1f1f; --muted: #6b6b6b; --line: #eee9ea; --line-strong: #ddd6d8;
  --accent: #d90f3c;          /* GFK pink, darkened just enough for readable white text (5.1:1) */
  --accent-bright: #ff1e50;   /* the website's exact accent, for decoration */
  --accent-ink: #fff; --accent-soft: #ffe9ee; --accent-tint: #fff4f7;
  --green: #1d7a3a; --green-soft: #e7f5ec;
  --red: #c4271f; --red-soft: #fdecea; --amber: #8a5a00; --amber-soft: #fdf3dc;
  --blue: #2457a0; --blue-soft: #e8effa; --violet: #6a3fb0; --violet-soft: #f1ebfb; --grey-soft: #f2eff0;
  --radius: 14px; --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(31, 31, 31, .04), 0 6px 20px rgba(31, 31, 31, .05);
  --serif: "Gilda Display", Georgia, "Times New Roman", serif;
  --sans: "Work Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
h1 { font: 400 32px/1.15 var(--serif); margin: 0; letter-spacing: -.01em; }
h2 { font-size: 16px; font-weight: 600; margin: 0 0 12px; }
a { color: var(--accent); }
code { background: var(--grey-soft); padding: 1px 5px; border-radius: 5px; font-size: .92em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Layout */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { background: var(--surface); border-right: 1px solid var(--line); padding: 26px 14px 18px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { font: 400 21px/1.2 var(--serif); padding: 0 12px 22px; display: flex; align-items: center; gap: 9px; }
.brand::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--accent-bright); flex: none; }
.side a, .side button { display: flex; align-items: center; gap: 11px; color: #3d3d3d; text-decoration: none; padding: 9px 12px; border-radius: var(--radius-sm); font-size: 14.5px; }
.side svg { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; opacity: .8; }
.side a:hover { background: var(--accent-tint); color: var(--ink); }
.side a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.side a.on svg { opacity: 1; }
.side .spacer { flex: 1; min-height: 12px; }
.side button { all: unset; display: flex; align-items: center; gap: 11px; cursor: pointer; padding: 9px 12px; color: var(--muted); font-size: 14px; border-radius: var(--radius-sm); }
.side button:hover { background: var(--grey-soft); }
.main { padding: 34px 40px 80px; max-width: 1120px; width: 100%; min-width: 0; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 24px; flex-wrap: wrap; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; margin-bottom: 16px; box-shadow: var(--shadow); }
.banner { background: var(--amber-soft); color: var(--amber); border-radius: var(--radius-sm); padding: 12px 16px; margin-bottom: 16px; }
.mailbanner { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.mailbanner .link { color: var(--amber); text-decoration: underline; padding: 0; }
.maildlg .tablewrap { max-height: 50vh; overflow: auto; box-shadow: none; }

/* Controls */
button, .btn { font: inherit; font-size: 14.5px; cursor: pointer; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); padding: 9px 16px; border-radius: var(--radius-sm); text-decoration: none; display: inline-flex; align-items: center; gap: 6px; transition: background .15s, border-color .15s, box-shadow .15s; }
button:hover, .btn:hover { border-color: #c9c0c3; background: #fdfbfc; }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; box-shadow: 0 1px 2px rgba(217, 15, 60, .25); }
button.primary:hover, .btn.primary:hover { background: #bd0c34; border-color: #bd0c34; }
button.danger { color: var(--red); }
button.danger:hover { background: var(--red-soft); border-color: #f2c4c0; }
button.link { border: 0; background: none; color: var(--muted); padding: 5px 7px; box-shadow: none; }
button.link:hover { color: var(--accent); background: none; }
button:disabled { opacity: .5; cursor: default; }
:focus-visible { outline: 3px solid rgba(217, 15, 60, .35); outline-offset: 2px; }
label.f { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 500; color: var(--muted); min-width: 0; }
input, select, textarea { font: inherit; font-size: 14.5px; color: var(--ink); background: #fff; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); width: 100%; min-width: 0; transition: border-color .15s, box-shadow .15s; }
input:hover, select:hover, textarea:hover { border-color: #c9c0c3; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[readonly] { background: var(--grey-soft); }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); padding: 0; flex: none; box-shadow: none; }
textarea { resize: vertical; min-height: 70px; line-height: 1.45; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(6, minmax(0, 1fr)); }
.s1 { grid-column: span 1; } .s2 { grid-column: span 2; } .s3 { grid-column: span 3; } .s4 { grid-column: span 4; } .s6 { grid-column: span 6; }

/* Stats and filters */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 2px; }
.stat > span:first-child { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.stat b { display: block; font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.02em; margin: 2px 0; }
.stat.alert { border-color: #f6cdd5; background: linear-gradient(0deg, var(--accent-tint), #fff); }
.stat.alert b { color: var(--accent); }
.tabs { display: inline-flex; gap: 2px; flex-wrap: wrap; background: var(--grey-soft); padding: 3px; border-radius: 12px; }
.tabs button { border: 0; background: none; color: var(--muted); padding: 7px 14px; border-radius: 9px; font-size: 14px; box-shadow: none; }
.tabs button:hover { color: var(--ink); background: none; }
.tabs button.on { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(31, 31, 31, .1); }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar input[type=search] { width: 250px; border-radius: 99px; padding-left: 16px; }

/* Tables */
.tablewrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #fdfbfc; }
th.num { text-align: right; }
td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; transition: background .12s; }
tr.click:hover td { background: var(--accent-tint); }
.empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.pill.draft { background: var(--grey-soft); color: #5a5a5a; }
.pill.sent { background: var(--blue-soft); color: var(--blue); }
.pill.reminded { background: var(--amber-soft); color: var(--amber); }
.pill.overdue { background: var(--red-soft); color: var(--red); }
.pill.paid { background: var(--green-soft); color: var(--green); }
.pill.prepared { background: var(--violet-soft); color: var(--violet); }
.bulk { position: sticky; bottom: 16px; margin-top: 14px; background: var(--ink); color: #fff; border-radius: var(--radius); padding: 10px 14px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; box-shadow: 0 10px 30px rgba(31, 31, 31, .25); }
.bulk button { background: #ffffff18; border-color: transparent; color: #fff; }
.bulk button:hover { background: #ffffff30; }

/* Invoice lines */
.lines td { padding: 6px 5px; border: 0; vertical-align: top; }
.lines th { padding: 4px 5px; border: 0; background: none; }
.lines input { padding: 8px 10px; }
.lines .x { color: var(--muted); padding: 8px 10px; border: 0; background: none; box-shadow: none; }
.lines .x:hover { color: var(--red); }
.totals { margin-left: auto; width: 290px; max-width: 100%; margin-top: 14px; }
.totals div { display: flex; justify-content: space-between; padding: 3px 0; font-variant-numeric: tabular-nums; }
.totals .grand { font-weight: 700; font-size: 19px; border-top: 2px solid var(--ink); margin-top: 6px; padding-top: 9px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* Import */
.drop { border: 2px dashed #e2b9c3; border-radius: var(--radius); padding: 56px 20px; text-align: center; background: var(--accent-tint); cursor: pointer; display: block; transition: background .15s, border-color .15s; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.steps { display: flex; gap: 8px; margin-bottom: 20px; color: var(--muted); font-size: 14px; flex-wrap: wrap; }
.steps span { padding: 5px 12px; border-radius: 99px; background: var(--grey-soft); }
.steps .on { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.map { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px 18px; }
.sample { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 18px; }
details.inv { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 8px; box-shadow: var(--shadow); }
details.inv summary { padding: 12px 16px; display: flex; gap: 12px; align-items: center; cursor: pointer; list-style: none; }
details.inv summary::-webkit-details-marker { display: none; }
details.inv summary .who { flex: 1; min-width: 0; font-weight: 600; }
details.inv .body { padding: 4px 16px 16px; border-top: 1px solid var(--line); }
.warn { color: var(--amber); font-size: 13px; font-weight: 500; }

/* Sign-in */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(1200px 500px at 50% -10%, var(--accent-soft), transparent 70%), var(--bg); }
.auth form { width: 390px; max-width: 100%; background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--accent-bright); border-radius: 18px; padding: 32px 30px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 20px 50px rgba(31, 31, 31, .08); }
.auth h1 { font-size: 30px; }
.auth .link { align-self: center; }
.err { color: var(--red); font-size: 14px; }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 8px); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 12px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px); z-index: 9; box-shadow: 0 10px 30px rgba(31, 31, 31, .25); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.bad { background: var(--red); }

/* Dialogs: PDF preview and forms */
#pdfmodal { width: min(920px, calc(100vw - 24px)); height: calc(100vh - 24px); max-height: none; padding: 0; border: 0; border-radius: 16px; overflow: hidden; box-shadow: 0 30px 80px rgba(0, 0, 0, .3); }
#pdfmodal[open] { display: flex; flex-direction: column; }
#pdfmodal::backdrop, .maildlg::backdrop { background: rgba(31, 31, 31, .45); backdrop-filter: blur(3px); }
.pdfbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface); }
#pdfmodal iframe { flex: 1; width: 100%; border: 0; }
.maildlg { width: min(560px, calc(100vw - 24px)); border: 0; border-radius: 18px; padding: 26px; box-shadow: 0 30px 80px rgba(0, 0, 0, .25); }
.maildlg form { display: flex; flex-direction: column; gap: 12px; }
.maildlg h2 { font: 400 24px/1.2 var(--serif); }

/* Course calendar */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin-top: 14px; }
.cal-h { font-size: 11.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; text-align: center; padding: 4px 0; }
.cal-d { min-height: 92px; background: #fdfbfc; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 7px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-d.today { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.cal-n { font-size: 12px; color: var(--muted); font-weight: 600; }
.cal-e { display: block; font-size: 12px; background: var(--accent-soft); color: var(--accent); border-radius: 6px; padding: 3px 6px; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.cal-e:hover { background: #ffd5df; }
.cal-e.off { background: var(--grey-soft); color: var(--muted); text-decoration: line-through; }

/* Settings */
.settabs { margin-bottom: 12px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent-bright); vertical-align: middle; margin-left: 3px; }
.savebar { position: sticky; bottom: 12px; z-index: 2; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; margin: 6px 0 16px; box-shadow: 0 10px 30px rgba(31, 31, 31, .1); }
.dz { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 24px; align-items: start; }
.dz-controls { display: flex; flex-direction: column; gap: 10px; }
.dz-controls details { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 4px 14px 12px; background: #fdfbfc; }
.dz-controls summary { cursor: pointer; font-weight: 600; padding: 9px 0; }
.dz-controls details > label { margin-top: 10px; }
.crow { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0; font-size: 14px; }
.crow input[type=color] { width: 48px; height: 34px; padding: 3px; border-radius: 8px; cursor: pointer; }
.dz-preview iframe { width: 100%; height: 720px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; display: block; }

/* Dashboard (home page) */
.dash-head { align-items: flex-end; }
.eyebrow { margin: 0 0 4px; text-transform: capitalize; }
.dash-sec { margin-bottom: 20px; }
.dash-sec > h2, .sec-head h2, .chart-head h2 { font: 400 21px/1.2 var(--serif); margin: 0 0 12px; }
.todo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.todo { display: flex; align-items: center; gap: 12px; padding: 13px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s, border-color .15s; }
a.todo:hover { transform: translateY(-1px); border-color: var(--line-strong); box-shadow: 0 2px 4px rgba(31,31,31,.05), 0 10px 26px rgba(31,31,31,.08); }
.todo-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--muted); box-shadow: 0 0 0 4px var(--grey-soft); }
.todo.red .todo-dot { background: var(--red); box-shadow: 0 0 0 4px var(--red-soft); }
.todo.violet .todo-dot { background: var(--violet); box-shadow: 0 0 0 4px var(--violet-soft); }
.todo.blue .todo-dot { background: var(--blue); box-shadow: 0 0 0 4px var(--blue-soft); }
.todo.amber .todo-dot { background: #c98a0b; box-shadow: 0 0 0 4px var(--amber-soft); }
.todo.green .todo-dot, .todo.done .todo-dot { background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
.todo.grey .todo-dot { background: #8a8a8a; box-shadow: 0 0 0 4px var(--grey-soft); }
.bk-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.bk-opt { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px; background: #fdfbfc; }
.bk-opt button { margin-top: auto; }
.bk-opt span { margin-bottom: 8px; }
.todo-txt { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.todo-txt b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.todo-go { color: var(--muted); font-size: 22px; line-height: 1; }
.todo.done { max-width: 460px; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: var(--ink); position: relative; overflow: hidden; transition: border-color .15s; }
.kpi::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--accent-bright); opacity: .85; }
.kpi.warnk::before { background: var(--red); }
.kpi:hover { border-color: var(--line-strong); }
.kpi-l { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; color: var(--muted); }
.kpi b { font-size: 27px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.25; }
.kpi b small { font-size: 14px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.trend { font-weight: 600; color: var(--muted); }
.trend.up { color: var(--green); }
.trend.down { color: var(--red); }
.neg { color: var(--red); font-weight: 600; }
.ringrow { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ring { width: 40px; height: 40px; transform: rotate(-90deg); flex: none; }
.ring circle { fill: none; stroke-width: 5; }
.ring-bg { stroke: var(--accent-soft); }
.ring-fg { stroke: var(--accent); stroke-linecap: round; }

.chartcard { padding-bottom: 14px; }
.chart-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.chart-head h2 { margin: 0; }
.chart-sum { margin: 0 0 8px; }
.chart-sum b { font-size: 20px; }
.chartbox { position: relative; }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .gl { stroke: var(--line); stroke-width: 1; }
.chart .base { stroke: var(--line-strong); stroke-width: 1; }
.chart .ax { fill: var(--muted); font-size: 11px; font-family: var(--sans); }
.chart .ax.now { fill: var(--ink); font-weight: 700; }
.chart .lbl { fill: var(--ink); font-size: 11.5px; font-weight: 600; font-family: var(--sans); }
.chart .bar path { fill: var(--accent); transition: opacity .15s; }
.chart .bar .hit { fill: transparent; }
.chart .bar:hover .hit { fill: var(--accent-tint); }
.chart .bar.future text.ax { opacity: .55; }
.tip { position: absolute; top: 34px; transform: translateX(-50%); background: var(--ink); color: #fff; font-size: 12.5px; font-weight: 500; padding: 5px 10px; border-radius: 8px; pointer-events: none; white-space: nowrap; box-shadow: 0 6px 16px rgba(31,31,31,.2); }

.dash-cols { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.dash-cols .card { padding: 20px 20px 10px; }
.sec-head { display: flex; justify-content: space-between; align-items: baseline; }
.sec-head a { text-decoration: none; font-weight: 500; }
.ev-row, .bk-row { display: flex; align-items: center; gap: 14px; padding: 11px 8px; margin: 0 -8px; border-radius: var(--radius-sm); text-decoration: none; color: var(--ink); border-top: 1px solid var(--line); }
.ev-row:first-of-type, .bk-row:first-of-type { border-top: 0; }
.ev-row:hover, .bk-row:hover { background: var(--accent-tint); border-top-color: transparent; }
.ev-row:hover + .ev-row, .bk-row:hover + .bk-row { border-top-color: transparent; }
.datetile { width: 48px; height: 52px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); display: flex; flex-direction: column; align-items: center; justify-content: center; flex: none; line-height: 1.05; }
.datetile b { font-size: 19px; font-weight: 700; }
.datetile span { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.ev-main { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: 1px; }
.ev-main > b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seat { display: flex; align-items: center; gap: 10px; margin-top: 5px; }
.seatbar { position: relative; flex: 1; height: 7px; border-radius: 99px; background: var(--grey-soft); }
.seatbar i { position: absolute; inset: 0 auto 0 0; border-radius: 99px; background: var(--accent); }
.seatbar.low i { background: #d99a1e; }
.seatbar b { position: absolute; top: -3px; width: 2px; height: 13px; background: var(--ink); opacity: .45; border-radius: 1px; }
.seatnote { margin-top: 3px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 13px; display: grid; place-items: center; flex: none; letter-spacing: .02em; }
.bk-side { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex: none; text-align: right; }
@media (max-width: 1000px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-cols { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .kpi { padding: 14px; }
  .kpi b { font-size: 21px; }
  .todo-grid { grid-template-columns: 1fr; }
  .dash-head .row { width: 100%; }
}

/* the hidden attribute must win over display rules like .grid */
[hidden] { display: none !important; }

/* Phone and small tablet */
@media (max-width: 900px) {
  .dz { grid-template-columns: 1fr; }
  .dz-preview iframe { height: 560px; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .side { position: sticky; top: 0; z-index: 5; height: auto; flex-direction: row; overflow-x: auto; padding: 8px; gap: 4px; border-right: 0; border-bottom: 1px solid var(--line); }
  .side a, .side button { white-space: nowrap; padding: 8px 11px; font-size: 14px; }
  .brand, .side .spacer { display: none; }
  .main { padding: 20px 16px 70px; }
  h1 { font-size: 26px; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 12px 14px; }
  .stat b { font-size: 20px; }
  .card { padding: 18px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .s1, .s2, .s3, .s4, .s6 { grid-column: span 2; }
  .map { grid-template-columns: 1fr; }
  .hide-m { display: none; }
  .toolbar input[type=search] { width: 100%; }
  .cal-d { min-height: 60px; padding: 3px; }
  .cal-e { font-size: 10px; }
}
