/* Planathon — plain, fast, big targets. Paper + ink + one signal colour. */
:root {
  --paper: #f6f4ef; --card: #ffffff; --ink: #1d2733; --muted: #5d6875; --line: #dcd8cf;
  --brand: #1f4e79; --brand-ink: #ffffff; --accent: #c2571a;
  --ok: #2f7d4f; --ok-bg: #e5f3ea; --warn: #9a6a00; --warn-bg: #fff4d6; --bad: #b42318; --bad-bg: #fde8e6;
  --info-bg: #e8f0f8; --radius: 10px; --shadow: 0 1px 2px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.04);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--brand); }
h1 { font-size: 1.45rem; margin: 0 0 .25rem; }
h2 { font-size: 1.1rem; margin: 0 0 .6rem; }
h3 { font-size: 1rem; margin: 0 0 .4rem; }
small, .muted { color: var(--muted); }
code, .mono { font-family: ui-monospace, Consolas, monospace; font-size: .92em; }

/* top bar */
.top { background: var(--ink); color: #fff; display: flex; align-items: center; gap: 1rem; padding: .55rem 1rem; position: sticky; top: 0; z-index: 20; }
.top .brand { font-weight: 700; letter-spacing: .02em; color: #fff; text-decoration: none; font-size: 1.05rem; }
.top .brand span { color: #f4a261; }
.top nav { display: flex; gap: .15rem; flex-wrap: wrap; flex: 1; }
.top nav a { color: #d6dde5; text-decoration: none; padding: .4rem .6rem; border-radius: 7px; font-size: .95rem; }
.top nav a.on, .top nav a:hover { background: rgba(255,255,255,.12); color: #fff; }
.top form.search { display: flex; }
.top form.search input { width: 15rem; border: 0; border-radius: 7px; padding: .45rem .6rem; }
.top .me { color: #aab4bf; font-size: .85rem; display: flex; gap: .5rem; align-items: center; }
.top .me button { background: none; border: 1px solid #55616e; color: #d6dde5; border-radius: 6px; padding: .2rem .5rem; cursor: pointer; }

main { max-width: 1240px; margin: 0 auto; padding: 1rem; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }

/* cards + grid */
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); align-items: start; }
.grid.two { grid-template-columns: repeat(auto-fill, minmax(460px, 1fr)); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem; }
.card > h2 { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.card > h2 .count { background: var(--paper); border-radius: 99px; padding: 0 .55rem; font-size: .85rem; color: var(--muted); }
.card.alert { border-left: 5px solid var(--bad); }
.card.attention { border-left: 5px solid var(--accent); }
.card.calm { border-left: 5px solid var(--ok); }
.empty { color: var(--muted); font-size: .92rem; padding: .25rem 0; }

/* lists */
ul.rows { list-style: none; margin: 0; padding: 0; }
ul.rows li { padding: .55rem 0; border-top: 1px solid var(--line); display: flex; gap: .6rem; align-items: flex-start; justify-content: space-between; }
ul.rows li:first-child { border-top: 0; }
ul.rows .main { flex: 1; min-width: 0; }
ul.rows .sub { color: var(--muted); font-size: .88rem; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .5rem .45rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
tr.overdue td { background: var(--bad-bg); }
.table-wrap { overflow-x: auto; }

/* badges */
.badge { display: inline-block; font-size: .78rem; padding: .08rem .5rem; border-radius: 99px; background: var(--paper); border: 1px solid var(--line); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); border-color: #b8dcc6; color: var(--ok); }
.badge.warn { background: var(--warn-bg); border-color: #f0d68a; color: var(--warn); }
.badge.bad { background: var(--bad-bg); border-color: #f5b7b1; color: var(--bad); }
.badge.info { background: var(--info-bg); border-color: #bcd2e8; color: var(--brand); }
.badge.urgent { background: var(--bad); color: #fff; border-color: var(--bad); }
.overdue { color: var(--bad); font-weight: 600; }
.today { color: var(--accent); font-weight: 600; }

/* the four answers */
.four { display: grid; grid-template-columns: repeat(4, 1fr); gap: .75rem; margin: .5rem 0 1rem; }
.four > div { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem .9rem; }
.four .q { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.four .a { font-size: 1.02rem; font-weight: 600; margin-top: .2rem; }
.four .a.bad { color: var(--bad); }

/* buttons */
.btn, button.btn { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; background: var(--brand); color: var(--brand-ink); border: 0; border-radius: 8px; padding: .55rem .95rem; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; min-height: 42px; }
.btn.secondary { background: #fff; color: var(--brand); border: 1px solid #b9c7d6; }
.btn.accent { background: var(--accent); }
.btn.danger { background: var(--bad); }
.btn.small { min-height: 32px; padding: .3rem .65rem; font-size: .88rem; }
.btn.big { min-height: 56px; font-size: 1.05rem; padding: .7rem 1.2rem; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.linkbtn { background: none; border: 0; color: var(--brand); text-decoration: underline; cursor: pointer; font: inherit; padding: 0; }

/* forms */
form .field { margin-bottom: .8rem; }
label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: .25rem; }
label.inline { display: inline-flex; gap: .4rem; align-items: center; font-weight: 500; }
input[type=text], input[type=email], input[type=date], input[type=time], input[type=number], input[type=url], input[type=password], input[type=search], select, textarea {
  width: 100%; font: inherit; padding: .55rem .6rem; border: 1px solid #c9c4b8; border-radius: 8px; background: #fff; min-height: 42px; }
textarea { min-height: 70px; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .75rem; }
.hint { font-size: .84rem; color: var(--muted); margin-top: .2rem; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; margin: 0 0 1rem; background: #fff; }
legend { font-weight: 700; padding: 0 .35rem; }

.flash { padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; }
.flash.error { background: var(--bad-bg); color: var(--bad); border: 1px solid #f5b7b1; }
.flash.ok { background: var(--ok-bg); color: var(--ok); border: 1px solid #b8dcc6; }
.flash.info { background: var(--info-bg); color: var(--brand); border: 1px solid #bcd2e8; }

/* tabs */
.tabs { display: flex; gap: .25rem; border-bottom: 2px solid var(--line); margin: 1rem 0; overflow-x: auto; }
.tabs a { padding: .55rem .9rem; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.tabs a.on { color: var(--ink); border-color: var(--accent); }

/* visit cards (today) */
.visit-card { display: block; text-decoration: none; color: inherit; background: #fff; border: 1px solid var(--line); border-left: 6px solid var(--brand); border-radius: var(--radius); padding: .8rem 1rem; margin-bottom: .6rem; box-shadow: var(--shadow); }
.visit-card.collection { border-left-color: var(--accent); }
.visit-card.blocked { border-left-color: var(--bad); }
.visit-card .what { font-weight: 700; font-size: 1.05rem; }
.visit-card .where { color: var(--muted); }

/* the record-visit form: giant choice tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .5rem; }
.tiles input { position: absolute; opacity: 0; pointer-events: none; }
.tiles label { display: flex; align-items: center; justify-content: center; text-align: center; min-height: 64px; padding: .6rem; border: 2px solid #c9c4b8; border-radius: 10px; background: #fff; cursor: pointer; font-weight: 600; margin: 0; }
.tiles input:checked + label { border-color: var(--brand); background: var(--info-bg); box-shadow: inset 0 0 0 1px var(--brand); }
.tiles input:focus-visible + label { outline: 3px solid #f4a261; }
.photo-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .3rem; min-height: 110px; border: 2px dashed #9fb3c8; border-radius: 12px; background: #fafcff; cursor: pointer; font-weight: 700; color: var(--brand); text-align: center; padding: .6rem; }
.photo-btn.has { border-style: solid; border-color: var(--ok); background: var(--ok-bg); color: var(--ok); }
.photo-btn img { max-width: 100%; max-height: 140px; border-radius: 6px; }
.photo-btn input { display: none; }
.step { display: none; }
.step.show { display: block; }
label.confirm { display: flex; gap: .6rem; align-items: flex-start; font-size: 1.05rem; font-weight: 500; margin: .4rem 0 0; cursor: pointer; }
label.confirm input { width: 26px; height: 26px; flex: none; margin: 0; }
.sticky-save { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--paper) 30%); padding: 1rem 0 .5rem; }

.emptyday { padding: .45rem 1rem; margin-bottom: .4rem; border: 1px dashed var(--line); border-radius: var(--radius); font-size: .92rem; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 1rem; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 .9rem .6rem; }
.timeline li::before { content: ""; position: absolute; left: -1.43rem; top: .35rem; width: .7rem; height: .7rem; border-radius: 50%; background: var(--brand); border: 2px solid #fff; }
.timeline li.correction::before { background: var(--accent); }
.thumbs { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .3rem; }
.thumbs img { width: 84px; height: 84px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }

details summary { cursor: pointer; font-weight: 600; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .25rem 1rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* bottom nav on phones */
.bottom { display: none; }
@media (max-width: 760px) {
  body { font-size: 17px; padding-bottom: 70px; }
  .top nav, .top .me .who { display: none; }
  .top form.search { flex: 1; }
  .top form.search input { width: 100%; }
  main { padding: .75rem; }
  .four { grid-template-columns: 1fr 1fr; }
  .grid, .grid.two { grid-template-columns: 1fr; }
  .bottom { display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: var(--ink); z-index: 30; }
  .bottom a { flex: 1; color: #d6dde5; text-align: center; padding: .55rem 0 .65rem; text-decoration: none; font-size: .78rem; font-weight: 600; }
  .bottom a b { display: block; font-size: 1.25rem; line-height: 1.1; }
  .bottom a.on { color: #f4a261; }
  .hide-phone { display: none; }
  body.focus .bottom { display: none; }
  body.focus { padding-bottom: 0; }
}

/* printing */
@media print {
  .top, .bottom, .no-print, .flash { display: none !important; }
  body { background: #fff; font-size: 11pt; }
  main { max-width: none; padding: 0; }
  .card { box-shadow: none; border: 0; padding: 0; }
  a { color: inherit; text-decoration: none; }
  th, td { padding: 4px 5px; }
  .box { display: inline-block; width: 14px; height: 14px; border: 1.5px solid #000; }
  tr { page-break-inside: avoid; }
}
.box { display: inline-block; width: 16px; height: 16px; border: 1.5px solid var(--ink); border-radius: 3px; vertical-align: middle; }
.print-head { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 2px solid var(--ink); margin-bottom: .6rem; padding-bottom: .3rem; }
