:root {
  --navy: #1f2b47;
  --navy-deep: #16203a;
  --maroon: #7b2233;
  --maroon-soft: #f4e4e7;
  --gold: #c99a2e;
  --gold-soft: #f6efd9;
  --green: #2f6b3a;
  --green-soft: #e3efe4;
  --ink: #1c2130;
  --ink-2: #5b6273;
  --line: #d9dbe2;
  --panel: #f3f4f7;
  --white: #ffffff;
  --radius: 6px;
}

* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0;
  font-family: "Segoe UI", "Helvetica Neue", Arial, system-ui, sans-serif;
  color: var(--ink);
  background: var(--white);
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
}
a { color: var(--navy); }
h1 { font-size: 1.5rem; font-weight: 600; margin: 0 0 .25rem; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; font-weight: 600; margin: 1.5rem 0 .5rem; }
p.lead { color: var(--ink-2); margin: 0 0 1rem; max-width: 60ch; }

/* Header */
.top {
  background: var(--navy);
  color: #fff;
  border-bottom: 3px solid var(--gold);
}
.top-inner {
  max-width: 1100px; margin: 0 auto; padding: .6rem 1rem;
  display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap;
}
.brand { font-weight: 600; letter-spacing: .02em; color: #fff; text-decoration: none; }
nav a { color: #dfe3ee; text-decoration: none; margin-right: 1rem; font-size: .95rem; }
nav a.active, nav a:hover { color: #fff; border-bottom: 2px solid var(--gold); padding-bottom: 2px; }
.top .spacer { flex: 1; }
.top .who { color: #c7cddc; font-size: .85rem; }
.top .who a { color: #fff; margin-left: .5rem; }

main { max-width: 1100px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
main.narrow { max-width: 560px; }

.flash {
  background: var(--gold-soft); border-left: 4px solid var(--gold);
  padding: .5rem .75rem; margin-bottom: 1rem; border-radius: var(--radius);
}

/* Forms */
form.inline { display: flex; gap: .5rem; flex-wrap: wrap; align-items: end; }
label { display: block; font-size: .85rem; color: var(--ink-2); margin-bottom: .2rem; }
input, select, textarea {
  font: inherit; padding: .45rem .55rem; border: 1px solid var(--line);
  border-radius: var(--radius); background: #fff; color: var(--ink); min-width: 0;
}
input:focus, select:focus, textarea:focus, button:focus-visible {
  outline: 2px solid var(--gold); outline-offset: 1px;
}
input[type="number"] { width: 6.5rem; }
input[type="checkbox"] { width: auto; }
button, .btn {
  font: inherit; padding: .5rem .9rem; border-radius: var(--radius); cursor: pointer;
  border: 1px solid var(--navy); background: var(--navy); color: #fff; text-decoration: none;
  display: inline-block;
}
button.quiet, .btn.quiet { background: #fff; color: var(--navy); }
button.danger { background: #fff; color: var(--maroon); border-color: var(--maroon); }
button.small { padding: .25rem .6rem; font-size: .85rem; }
.field { display: flex; flex-direction: column; }

/* Tables */
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { padding: .45rem .5rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--ink-2); font-weight: 500; font-size: .85rem; }
td.num, th.num { text-align: right; }
tr.muted td { color: var(--ink-2); }
.table-wrap { overflow-x: auto; }

/* Stat strip */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .75rem; margin: 1rem 0 1.5rem; }
.stat { background: var(--panel); padding: .75rem .9rem; border-radius: var(--radius); }
.stat .v { font-size: 1.6rem; font-weight: 600; line-height: 1.1; }
.stat .l { color: var(--ink-2); font-size: .85rem; }
.stat.warn .v { color: var(--maroon); }
.stat.gold .v { color: var(--gold); }

/* Excess semantics: short = maroon (compliance), extra = gold (cost), ok = navy */
.ex-short { background: var(--maroon-soft); color: var(--maroon); font-weight: 600; }
.ex-extra { background: var(--gold-soft); color: #8a6710; font-weight: 600; }
.ex-ok { background: var(--green-soft); color: var(--green); font-weight: 600; }
.ex-empty { color: var(--ink-2); }
.pill { display: inline-block; padding: .1rem .45rem; border-radius: 999px; font-size: .85rem; }

/* Walk screen (phone) */
.walk-head { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-bottom: .75rem; }
.walk-head .full { grid-column: 1 / -1; }
.room-card {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: .6rem .7rem; margin-bottom: .6rem; background: #fff;
}
.room-card .row { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.room-card .name { font-weight: 600; }
.room-card .meta { color: var(--ink-2); font-size: .8rem; }
.counters { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .4rem; margin-top: .5rem; }
.counter { display: flex; align-items: center; gap: .2rem; min-width: 0; }
.counter label { margin: 0 .25rem 0 0; min-width: 2.2rem; flex: none; }
.counter button {
  width: 2.1rem; height: 2.1rem; padding: 0; font-size: 1.15rem; line-height: 1; flex: none;
  background: var(--panel); color: var(--navy); border-color: var(--line);
}
.counter input { width: 2.6rem; min-width: 0; flex: 1 1 2.4rem; text-align: center; font-size: 1.1rem; padding: .3rem .1rem; }
.counter input::-webkit-outer-spin-button, .counter input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.counter input[type=number] { -moz-appearance: textfield; appearance: textfield; }
.verdict { margin-top: .5rem; font-size: .95rem; }
.verdict .pill { margin-left: .3rem; }
.room-card.short { border-color: var(--maroon); box-shadow: inset 4px 0 0 var(--maroon); }
.room-card.extra { border-color: var(--gold); box-shadow: inset 4px 0 0 var(--gold); }
.room-card.ok { border-color: var(--green); box-shadow: inset 4px 0 0 var(--green); }
.walk-total {
  position: sticky; bottom: 0; background: var(--navy); color: #fff;
  padding: .7rem .9rem; margin: .75rem -1rem 0; display: flex; align-items: center; gap: 1rem;
}
.walk-total .sum { flex: 1; font-size: .95rem; }
.walk-total .sum b { font-size: 1.15rem; }
.walk-total button { background: var(--gold); border-color: var(--gold); color: var(--navy-deep); font-weight: 600; }
.note-line input { width: 100%; margin-top: .4rem; font-size: .9rem; }

/* Grid */
.grid td, .grid th { padding: .35rem .4rem; white-space: nowrap; }
.grid td.cell { text-align: center; }
.grid td.cell small { display: block; color: var(--ink-2); font-weight: 400; font-size: .75rem; }
.grid tr.total td { border-top: 2px solid var(--navy); font-weight: 600; }
.daynav { display: flex; gap: .75rem; align-items: center; margin-bottom: .75rem; flex-wrap: wrap; }

/* Schedule */
.sched-grid td.cell { text-align: center; }
.sched-grid td.nodata { color: var(--line); }
.daytabs a { display: inline-block; padding: .35rem .7rem; border: 1px solid var(--line); border-radius: var(--radius); margin-right: .35rem; text-decoration: none; }
.daytabs a.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }

/* Login */
.login-box { margin: 4rem auto; max-width: 340px; }
.login-box input { width: 100%; font-size: 1.3rem; text-align: center; letter-spacing: .1em; }
.login-box button { width: 100%; margin-top: .75rem; }

.empty { color: var(--ink-2); padding: 1.5rem 0; }
details summary { cursor: pointer; color: var(--navy); margin: .5rem 0; }

@media (max-width: 640px) {
  .two-col { grid-template-columns: 1fr; }
  nav a { margin-right: .7rem; font-size: .9rem; }
  h1 { font-size: 1.3rem; }
}

/* Ratio sheet: earlier checks today */
.checks td, .checks th { padding: .4rem .35rem; }
.check-row { cursor: pointer; }
.check-row small { color: var(--ink-2); }
.check-detail td { background: var(--panel); padding: .5rem .35rem; }

/* Day plan timeline */
.timeline td, .timeline th { padding: .25rem .2rem; white-space: nowrap; font-size: .8rem; }
.timeline th.num { text-align: center; }
.timeline td.tl { text-align: center; min-width: 1.9rem; border-left: 1px solid #f0f0f3; }
.timeline td.tl.on { background: #e6e9f2; color: var(--navy); }
.timeline td.tl.lunch { background: var(--gold-soft); color: #8a6710; font-weight: 600; }
.timeline tr.out td { color: var(--ink-2); }
.timeline tr.out td.tl { background: none; }
.timeline tr.total td { border-top: 2px solid var(--navy); font-weight: 600; }
tr.adjusted > td:first-child { box-shadow: inset 4px 0 0 var(--gold); }

.check-rooms { font-size: .85rem; }
.check-rooms td { padding: .2rem .3rem; border: 0; }
.check-rooms td.num { white-space: nowrap; }

/* Add-a-check column on the day grid */
.grid th.newcol, .grid td.newcol { border-left: 2px solid var(--navy); min-width: 2.2rem; }
.grid td.newcol input { width: 3rem; padding: .2rem .1rem; text-align: center; font-size: .9rem; }
.grid td.newcol small { display: block; font-size: .7rem; }
.grid td.newcol input::-webkit-outer-spin-button, .grid td.newcol input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.grid td.newcol input[type=number] { -moz-appearance: textfield; appearance: textfield; }
#addcheck { font-size: 1.1rem; line-height: 1; padding: .1rem .5rem; }
