/* Rainwater panel: a quiet corporate workspace. Navy rail, white sheets on a cool grey ground, Segoe at work sizes. */
:root {
  --rail: #003e6b;
  --rail-2: #0b4f80;
  --rail-text: #d3e4f0;
  --blue: #006fab;
  --blue-dark: #005a8c;
  --blue-wash: #e8f2f9;
  --ink: #17262f;
  --muted: #55656f;
  --line: #d9e0e5;
  --line-soft: #eaeef1;
  --field: #7f8e99;  /* 3.4:1 on white: a control edge needs 3:1 */
  --ground: #f3f5f7;
  --head: #f7f9fa;
  --sheet: #fff;
  --bad: #a4262c;
  --bad-bg: #fdf0ef;
  --good: #0a6b5f;
  --good-bg: #e6f4f1;
  --call: #107c41;
  --call-dark: #0c6334;
  --warn: #6b4e00;
  --warn-bg: #fff6d6;
  --warn-line: #f0d27a;
  --radius: 6px;
  --radius-sm: 4px;
  --lift: 0 1px 2px rgba(23, 38, 47, .06), 0 2px 6px rgba(23, 38, 47, .05);
  --lift-hover: 0 2px 4px rgba(23, 38, 47, .08), 0 6px 16px rgba(23, 38, 47, .08);
  --content: 1280px;
  --gap: 12px;
  --ease: cubic-bezier(.16, 1, .3, 1);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-color: #b3bfc7 var(--ground); }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 14px/1.5 "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  font-variant-numeric: tabular-nums;
  accent-color: var(--blue);
  caret-color: var(--blue);
}
::selection { background: var(--blue); color: #fff; }
a { color: var(--blue); text-underline-offset: 3px; }
a:hover { color: var(--blue-dark); }
h1, h2, p { margin: 0; }
h2 { margin: 28px 0 10px; color: var(--ink); font-size: 16px; font-weight: 600; line-height: 1.3; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.rail :focus-visible { outline-color: #fff; }

.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100dvh; }

/* Rail */
.rail {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  padding: 18px 10px 14px;
  overflow-y: auto;
  background: var(--rail);
  color: var(--rail-text);
}
.brand { padding: 2px 10px 20px; color: #fff; font-size: 19px; font-weight: 600; letter-spacing: .01em; line-height: 1.2; text-decoration: none; }
.brand:hover { color: #fff; }
.brand img { display: block; max-width: 150px; max-height: 36px; }
.rail nav { display: grid; gap: 2px; }
.rail nav a { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--rail-text); font-size: 14px; text-decoration: none; }
.rail nav a:hover { background: var(--rail-2); color: #fff; }
.rail nav a[aria-current="page"] { background: rgba(255, 255, 255, .14); color: #fff; font-weight: 600; }
.ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.menu-toggle { display: none; }
.who { display: grid; gap: 2px; margin-top: auto; padding: 14px 10px 0; border-top: 1px solid rgba(255, 255, 255, .14); font-size: 13px; }
.who strong { color: #fff; font-weight: 600; }
.who .link { color: var(--rail-text); }
.who .link:hover { color: #fff; }

/* Page */
.page { min-width: 0; padding: 22px 32px 56px; overflow-x: clip; }
.word { max-width: var(--content); margin: 0 0 18px; color: var(--ink); font-size: 24px; font-weight: 600; letter-spacing: -.01em; line-height: 1.25; overflow-wrap: anywhere; }
.crumb { margin: 0 0 12px; font-size: 13px; }

.flash { max-width: var(--content); margin-bottom: var(--gap); padding: 9px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--sheet); }
.flash.ok { border-color: #b5ddd5; background: var(--good-bg); color: var(--good); }
.flash.error { border-color: #efc4c0; background: var(--bad-bg); color: var(--bad); }
.flash.info { border-color: #c8dcea; background: var(--blue-wash); }
.flash a { color: inherit; font-weight: 600; }

/* Figure cards. The markup puts the figure before its label; the label reads first. */
.board { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); grid-auto-flow: dense; gap: var(--gap); flex: 1 1 560px; min-width: 0; }
.tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  min-height: 104px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--sheet);
  box-shadow: var(--lift);
  color: var(--ink);
  font: inherit;
  text-align: left;
  text-decoration: none;
}
.tile > span { color: var(--muted); font-size: 13px; line-height: 1.35; }
.tile > span::first-letter, .tile-note::first-letter { text-transform: uppercase; }
.tile > b + span { order: -1; }
.tile b { margin-top: auto; font-size: 30px; font-weight: 600; letter-spacing: -.01em; line-height: 1.15; }
a.tile:hover, button.tile:hover { border-color: #a9c6da; box-shadow: var(--lift-hover); color: var(--ink); }
.tile.big { background: var(--blue); border-color: var(--blue); color: #fff; }
.tile.big > span { color: #d9ebf6; }
.tile.big b { font-size: 40px; }
a.tile.big:hover { border-color: var(--blue-dark); background: var(--blue-dark); color: #fff; }
.tile.big:has(.tile-name) { grid-column: span 2; grid-row: span 2; min-height: 180px; padding: 18px 20px; }
.tile.teal b { color: var(--good); }
.tile.amber, a.tile.amber:hover { border-color: var(--warn-line); background: var(--warn-bg); color: var(--warn); }
.tile.amber > span { color: var(--warn); }
.tile.quiet { box-shadow: none; background: var(--head); }
.tile.quiet b { color: var(--muted); }
.tile.big.quiet { border-color: var(--line); background: var(--head); color: var(--ink); }
.tile.big.quiet > span { color: var(--muted); }
.tile-link { color: inherit; }
.tile-note { color: inherit; font-size: 13px; opacity: .9; }
.tile-name { margin-top: 2px; font-size: 22px; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.tile.big > strong + span {
  align-self: flex-start;
  margin-top: auto;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--blue);
  font-size: 14px;
  font-weight: 600;
}
.tile.big.amber { border-color: var(--warn-line); background: var(--warn-bg); color: var(--warn); }
.tile.big.amber > strong + span { background: var(--warn); color: #fff; }
a.tile.big.amber:hover { background: #ffefb8; color: var(--warn); }
.tile.big.quiet > strong + span { padding: 0; background: none; color: var(--muted); font-weight: 400; }
[data-num] { display: inline-block; }
[data-num].rolled { animation: roll 320ms var(--ease); }
@keyframes roll { from { opacity: 0; transform: translateY(30%); } }

.push { margin-left: auto; }
.row-gap { margin-top: var(--gap); }
.top { display: flex; flex-wrap: wrap; gap: var(--gap) 20px; align-items: flex-start; max-width: var(--content); margin-bottom: 8px; }
.board + .scroll { margin-top: 14px; }
.results { flex: 1 1 260px; min-width: 240px; max-width: 420px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--sheet); box-shadow: var(--lift); }
.results h2 { margin: 0 0 6px; }
.results h2 ~ h2 { margin-top: 18px; }
.results .empty { padding: 12px 0; background: none; border: 0; }

/* Period tabs */
.pivot { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 18px; max-width: var(--content); margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.pivot a { margin-bottom: -1px; padding: 6px 2px 8px; border-bottom: 2px solid transparent; color: var(--muted); font-size: 14px; text-decoration: none; }
.pivot a:hover { color: var(--ink); }
.pivot a[aria-current] { border-bottom-color: var(--blue); color: var(--ink); font-weight: 600; }
.pivot .report { margin-left: auto; color: var(--blue); }
.pivot .report ~ a { color: var(--blue); }

/* Setup steps */
.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); max-width: var(--content); margin-bottom: 16px; }
.step { flex-direction: row; align-items: center; gap: 12px; min-height: 64px; }
.step > b + span { order: 0; color: inherit; font-size: 14px; }
.step b { display: grid; place-items: center; flex: none; width: 30px; height: 30px; margin: 0; border-radius: 50%; background: var(--blue); color: #fff; font-size: 15px; }
.step.navy { border-color: #a9c6da; }
.step.done { box-shadow: none; background: var(--head); color: var(--muted); }
.step.done .ico { color: var(--good); }

/* Tables */
.scroll { max-width: var(--content); overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--sheet); box-shadow: var(--lift); }
table { width: 100%; border-collapse: collapse; }
th { padding: 9px 14px; border-bottom: 1px solid var(--line); background: var(--head); color: var(--muted); font-size: 12.5px; font-weight: 600; text-align: left; white-space: nowrap; }
td { padding: 9px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f7fafc; }
tr.off td { color: var(--muted); }
tr.promised { background: var(--warn-bg); }
tr.promised:hover { background: #ffefb8; }
.name { color: var(--ink); font-weight: 600; text-decoration: none; }
.name:hover { color: var(--blue); text-decoration: underline; }
td.num, th.num { text-align: right; }
.tel, .nowrap { white-space: nowrap; }
.check { width: 36px; padding-right: 0; }
.bars th { padding: 7px 10px 7px 0; border-bottom: 1px solid var(--line-soft); background: none; color: var(--ink); font-size: 13.5px; font-weight: 400; white-space: normal; }
.bars td { padding: 7px 10px; }
.bars tbody tr:hover { background: none; }
.bars tr:last-child th { border-bottom: 0; }
.bars .bar { width: 38%; padding-left: 0; padding-right: 0; }
.bars .bar span, .hourly .bar span { display: block; height: 8px; min-width: 2px; border-radius: 2px; background: var(--blue); }

/* Maintenance year: one square per month since the sale */
.maint { display: inline-grid; gap: 3px; white-space: nowrap; }
.maint-date { color: var(--ink); font-weight: 600; }
.maint-date small { color: var(--muted); font-size: 12.5px; font-weight: 400; }
.year { display: inline-grid; grid-template-columns: repeat(12, 8px); gap: 2px; vertical-align: middle; }
.year i { display: block; aspect-ratio: 1; border-radius: 1px; background: var(--line); }
.year i.on { background: #6aa6cc; }
.year.due i.on { background: var(--blue); }

/* Controls */
button, .button {
  display: inline-block;
  min-height: 34px;
  padding: 6px 14px;
  border: 1px solid var(--field);
  border-radius: var(--radius-sm);
  background: var(--sheet);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 120ms, border-color 120ms;
}
button:hover, .button:hover { border-color: #5f6e78; background: var(--ground); color: var(--ink); }
button.primary { border-color: var(--blue); background: var(--blue); color: #fff; }
button.primary:hover { border-color: var(--blue-dark); background: var(--blue-dark); color: #fff; }
button.link { min-height: 0; padding: 0; border: 0; background: none; font-weight: 400; text-align: left; text-decoration: underline; }
button.link:hover { background: none; }
button:disabled, button:disabled:hover { border-color: var(--line); background: var(--head); color: #8795a0; box-shadow: none; cursor: not-allowed; }

input, select, textarea {
  width: 100%;
  min-height: 34px;
  padding: 5px 10px;
  border: 1px solid var(--field);
  border-radius: var(--radius-sm);
  background: var(--sheet);
  color: var(--ink);
  font: inherit;
}
input:hover, select:hover, textarea:hover { border-color: #5f6e78; }
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--blue); outline: 0; box-shadow: 0 0 0 1px var(--blue); }
input[type="radio"], input[type="checkbox"] { width: 16px; height: 16px; min-height: 0; margin: 0; padding: 0; }
input[type="checkbox"]:focus-visible, input[type="radio"]:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; box-shadow: none; }
input[type="file"] { padding: 4px; }
label { display: grid; gap: 4px; color: var(--muted); font-size: 13px; font-weight: 600; }
label input, label select, label textarea { color: var(--ink); font-size: 14px; font-weight: 400; }
label.choice { display: flex; align-items: center; gap: 9px; color: var(--ink); font-size: 14px; font-weight: 400; }
::placeholder { color: #6b7a84; opacity: 1; }

.stack { display: grid; gap: 14px; }
.narrow { max-width: 460px; margin-bottom: 14px; }
.narrow button, .stack > button { justify-self: start; }
.hint { margin-top: -6px; color: var(--muted); font-size: 13px; }
.scroll + .hint { margin-top: 8px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; max-width: 800px; }
.actions { display: flex; align-items: end; }
form.narrow, .manage form, .grid:not(.board) { align-content: start; }
section > form.narrow, h2 + form.narrow, h2 + form.stack { padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--sheet); box-shadow: var(--lift); }

.tools { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; max-width: var(--content); margin-bottom: 14px; }
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin-right: auto; }
.filters input { width: 220px; }
.filters select { width: 185px; }
.import { position: relative; }
.import summary {
  display: inline-block;
  min-height: 34px;
  padding: 6px 14px;
  border: 1px solid var(--blue);
  border-radius: var(--radius-sm);
  background: var(--blue);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.import summary:hover, .import[open] summary { border-color: var(--blue-dark); background: var(--blue-dark); }
.import summary::-webkit-details-marker { display: none; }
.import form { position: absolute; z-index: 2; right: 0; width: 340px; margin-top: 6px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--sheet); box-shadow: var(--lift-hover); }
.bulk { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin-bottom: 10px; }
.cols { display: flex; align-items: stretch; gap: 2px; max-width: var(--content); height: 140px; padding: 12px 14px 0; border: 1px solid var(--line); border-bottom: 0; border-radius: var(--radius) var(--radius) 0 0; background: var(--sheet); }
.col { display: flex; flex: 1 1 0; align-items: flex-end; min-width: 3px; border-bottom: 1px solid var(--line); }
.col:hover { background: var(--ground); }
.col i { display: block; width: 100%; min-height: 1px; border-radius: 2px 2px 0 0; background: var(--blue); }
.cols-axis { display: flex; justify-content: space-between; max-width: var(--content); padding: 4px 14px 8px; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--radius) var(--radius); background: var(--sheet); color: var(--muted); font-size: 12.5px; }
.more { max-width: var(--content); margin-top: 8px; }
.more summary { margin-bottom: 8px; color: var(--blue); cursor: pointer; }
.limited { max-width: 640px; }
.hourly .bar { width: 38%; }
.bar-head { width: 38%; }
td.wrap { min-width: 240px; }
.facts-table th { border-bottom: 1px solid var(--line-soft); background: none; color: var(--ink); font-size: 13.5px; font-weight: 400; }

/* People cards */
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--gap); max-width: var(--content); }
.person { display: grid; align-content: start; gap: 8px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--sheet); box-shadow: var(--lift); }
.person.off { box-shadow: none; background: var(--head); }
.person h2 { margin: 0; }
.plain { color: inherit; text-decoration: none; }
.plain:hover { color: var(--blue); text-decoration: underline; }
.person-state, .person-last { color: var(--muted); font-size: 13px; }
.figures { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 4px 0; }
.figures dt { line-height: 1.3; }
.figures dd { font-size: 22px; font-weight: 600; line-height: 1.25; }
.person .flash { margin: 0; padding: 4px 10px; font-size: 13px; }
.give { display: flex; gap: 6px; }
.give input { width: 76px; }
.tile-form { display: grid; }
.tile-form .tile { width: 100%; height: 100%; justify-content: center; align-items: center; background: var(--blue); border-color: var(--blue); color: #fff; font-size: 15px; font-weight: 600; cursor: pointer; }
.tile-form .tile > span { color: inherit; font-size: 15px; }
.tile-form .tile:hover { background: var(--blue-dark); color: #fff; }
.tile-form .tile:disabled { background: var(--head); border-color: var(--line); color: #8795a0; box-shadow: none; }
.hint-line { max-width: var(--content); margin-top: 8px; color: var(--muted); font-size: 13px; }
.load { max-width: var(--content); margin-bottom: 12px; color: var(--muted); }
.manage { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); max-width: 800px; }
.manage form { padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--sheet); box-shadow: var(--lift); }
.bulk select { width: 220px; }
.pager { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; max-width: var(--content); margin-top: 10px; color: var(--muted); font-size: 13px; }
.pager button { min-height: 30px; padding: 3px 12px; font-size: 13px; }
.empty { max-width: var(--content); padding: 22px 16px; border: 1px dashed var(--field); border-radius: var(--radius); background: var(--sheet); color: var(--muted); }

/* Call page */
.call { display: grid; grid-template-columns: minmax(0, 1fr) 200px; gap: var(--gap); max-width: var(--content); }
.dial { padding: 16px 22px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--sheet); box-shadow: var(--lift); }
.dial h1 { color: var(--ink); font-size: 22px; font-weight: 600; line-height: 1.25; }
.number { margin-top: 4px; color: var(--blue-dark); font-size: clamp(30px, 3.4vw, 42px); font-weight: 600; letter-spacing: .01em; line-height: 1.2; white-space: nowrap; }
.note { margin-top: 8px; color: var(--muted); }
.ara { display: grid; }
.ara .tile {
  width: 100%;
  height: 100%;
  min-height: 96px;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-color: var(--call);
  background: var(--call);
  color: #fff;
  font-size: 20px;
  font-weight: 600;
  cursor: pointer;
}
.ara .tile > span { color: inherit; font-size: 20px; }
.ara .tile:hover { border-color: var(--call-dark); background: var(--call-dark); color: #fff; }
.big-ico { width: 24px; height: 24px; }
.facts { display: grid; grid-template-columns: minmax(0, 1fr) 200px; gap: var(--gap); max-width: var(--content); margin-top: var(--gap); }
.facts dl {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr) max-content minmax(0, 1fr);
  gap: 6px 18px;
  margin: 0;
  padding: 14px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--sheet);
}
dt { color: var(--muted); font-size: 13px; line-height: 21px; }
dd { margin: 0; }
.year-box { display: grid; gap: 6px; align-content: center; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--sheet); color: var(--muted); font-size: 13px; }
.script { max-width: var(--content); margin-top: var(--gap); padding: 12px 22px; border: 1px solid #c8dcea; border-radius: var(--radius); background: var(--blue-wash); }
.result { display: grid; gap: 12px; max-width: var(--content); }
.result h2 { margin-top: 20px; margin-bottom: 0; }
fieldset { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0; padding: 0; border: 0; }
fieldset .choice {
  position: relative;
  min-height: 50px;
  padding: 8px 14px;
  border: 1px solid var(--field);
  border-radius: var(--radius);
  background: var(--sheet);
  cursor: pointer;
  transition: background-color 120ms, border-color 120ms;
}
fieldset .choice:hover { border-color: var(--blue); background: #f5f9fc; }
fieldset .choice:has(:checked) { border-color: var(--blue); background: var(--blue-wash); box-shadow: inset 0 0 0 1px var(--blue); font-weight: 600; }
fieldset .choice:has(:focus-visible) { outline: 2px solid var(--blue); outline-offset: 2px; }
.choice input[type="radio"] { position: absolute; opacity: 0; }
.choice span { flex: 1; }
kbd { min-width: 20px; padding: 0 5px; border: 1px solid var(--line); border-radius: 3px; background: var(--head); color: var(--muted); font: 12px/18px "Segoe UI", system-ui, sans-serif; text-align: center; }
.choice:has(:checked) kbd { border-color: var(--blue); background: var(--blue); color: #fff; }
.when { display: none; max-width: 320px; }
form:has(input[value="tekrar"]:checked) .when { display: grid; gap: 8px; }
.soon { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.why { display: none; flex-wrap: wrap; gap: 8px 16px; }
.why legend { margin-bottom: 6px; color: var(--muted); font-size: 13px; font-weight: 600; }
form:has(input[value="istemiyor"]:checked) .why { display: flex; }
label.pick { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); font-size: 14px; font-weight: 400; }
.next { color: var(--muted); }
.hint-keys { margin-left: auto; color: var(--muted); font-size: 12.5px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

/* A table wider than its sheet reads as cards. app.js decides by measuring, and adds .stacked and the column names. */
table.stacked, .stacked tbody, .stacked tr, .stacked td { display: block; width: 100%; }
.stacked thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.scroll:has(.stacked) { overflow-x: visible; border: 0; background: none; box-shadow: none; }
.stacked tr { margin-bottom: var(--gap); padding: 6px 0; border: 1px solid var(--line); border-radius: var(--radius); }
.stacked tr:not(.promised) { background: var(--sheet); }
.stacked tr[hidden] { display: none; }
.stacked td { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 30px; padding: 4px 12px; border: 0; text-align: right; }
.stacked td::before { content: attr(data-label); flex: none; color: var(--muted); font-size: 12.5px; text-align: left; }
.stacked td:empty { display: none; }
.stacked td.bar { display: block; }
.stacked td.bar::before { display: none; }
.stacked td.wrap { min-width: 0; }
.stacked .nowrap, .stacked .tel { white-space: normal; }
.stacked .give { margin-left: auto; }
@media (min-width: 761px) {
  .stacked tbody { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); }
  .stacked tr { margin-bottom: 0; }
}

/* Login and error: one card on the ground, the name on top. */
body.login { display: grid; place-items: center; min-height: 100dvh; padding: 24px 16px; }
body.login main { width: 100%; max-width: 380px; padding: 28px 28px 30px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--sheet); box-shadow: var(--lift-hover); }
.login-brand { display: flex; align-items: center; gap: 10px; margin: -28px -28px 22px; padding: 16px 28px; border-radius: var(--radius) var(--radius) 0 0; background: var(--rail); color: #fff; font-size: 18px; font-weight: 600; }
body.login h1 { margin-bottom: 16px; color: var(--ink); font-size: 20px; font-weight: 600; line-height: 1.3; }
body.login h1.plain { font-size: 18px; }
body.login .stack > button { justify-self: stretch; min-height: 38px; }

@media (min-width: 1700px) {
  :root { --content: 1560px; }
}
/* Tablets: the rail becomes a top bar so tables keep their width. */
@media (max-width: 1000px) {
  .shell { display: block; }
  .rail { position: static; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 4px 16px; height: auto; padding: 8px 16px; }
  .brand { padding: 0; }
  .rail nav { display: flex; flex-wrap: wrap; }
  .rail nav a { flex: none; gap: 8px; padding: 7px 10px; }
  .who { display: flex; align-items: center; gap: 10px; margin-top: 0; padding: 0; border: 0; white-space: nowrap; }
  .who span, .who strong { display: none; }
  .page { padding: 18px 20px 48px; }
  .results { flex-basis: 100%; max-width: none; }
  .manage { max-width: none; }
  /* The tools wrap here, so the panel opens from the row's left edge instead of hanging off the button. */
  .tools { position: relative; }
  .import { position: static; }
  .import form { right: auto; left: 0; width: min(340px, 100%); }
  th, td { padding-right: 10px; padding-left: 10px; }
}
@media (pointer: coarse) {
  button, .button, input, select, .import summary { min-height: 44px; }
  input, select, textarea, label input, label select, label textarea { font-size: 16px; } /* iOS zooms into anything smaller */
  input[type="checkbox"], input[type="radio"] { width: 22px; height: 22px; min-height: 0; }
  .rail nav a { padding-top: 12px; padding-bottom: 12px; }
}
@media (max-width: 760px) {
  .rail { grid-template-columns: minmax(0, 1fr) auto; padding: 10px 16px 6px; }
  .rail nav { grid-column: 1 / -1; grid-row: 2; flex-wrap: nowrap; margin: 0 -16px; padding: 0 8px; overflow-x: auto; scrollbar-width: none; }
  /* Nine admin links do not fit a strip, and a hidden scroll hides most of them. */
  .rail.menu-ready { grid-template-columns: minmax(0, 1fr) auto auto; padding-bottom: 10px; }
  .rail.menu-ready nav { display: none; }
  .rail.menu-ready.open nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: -4px; padding: 6px 0 0; overflow: visible; }
  .menu-toggle:not([hidden]) { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border-color: rgba(255, 255, 255, .4); background: transparent; color: #fff; font-weight: 400; }
  .menu-toggle:hover { background: var(--rail-2); color: #fff; }
  .page { padding: 16px 16px 40px; }
  .word { font-size: 21px; }
  .tile-form { grid-column: span 2; }
  .tile-form .tile { min-height: 56px; }
  .cols { height: 110px; padding: 8px 8px 0; }
  .board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile { min-height: 92px; padding: 12px 14px; }
  .tile b { font-size: 26px; }
  .tile.big b { font-size: 32px; }
  .tile.big { grid-column: span 2; grid-row: auto; }
  .step { min-height: 56px; }
  .steps, .grid, .manage { grid-template-columns: minmax(0, 1fr); }
  .call, .facts { grid-template-columns: minmax(0, 1fr); }
  .ara .tile { min-height: 60px; }
  .facts dl { grid-template-columns: max-content minmax(0, 1fr); padding: 12px 16px; }
  .dial, .script { padding-right: 16px; padding-left: 16px; }
  .number { font-size: clamp(26px, 8.5vw, 34px); }
  fieldset { grid-template-columns: minmax(0, 1fr); }
  .filters input, .filters select, .bulk select { width: 100%; }
  .filters label { flex: 1 1 140px; }
  .hint-keys { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
