/* Holsteins Rule — phone first, comfortable on a computer. */
:root {
  --bg: #f4f5f2; --surface: #ffffff; --ink: #17201a; --muted: #5f6b63; --faint: #8a948c;
  --line: #e3e6e0; --line-strong: #d3d8d0;
  --brand: #1f5f35; --brand-ink: #ffffff; --brand-soft: #e8f1ea; --brand-text: #1f5f35;
  --warn: #b42318; --good: #1a7f3c; --head: #f7f8f5; --stripe: #fafbf8;
  --radius: 12px; --shadow: 0 1px 2px rgba(16, 24, 18, .05), 0 1px 3px rgba(16, 24, 18, .04);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1311; --surface: #171c19; --ink: #e7ece8; --muted: #a0aba3; --faint: #77827a;
    --line: #262d29; --line-strong: #323a35;
    --brand: #2e7d4a; --brand-ink: #ffffff; --brand-soft: #1c2b21; --brand-text: #8fd3a3;
    --warn: #f28b82; --good: #6fcf8e; --head: #1b211d; --stripe: #151a17;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--brand-text); }
h1 { margin: 0; font-size: 1.55rem; line-height: 1.2; letter-spacing: -.01em; }
h2 { margin: 0; font-size: .98rem; letter-spacing: -.005em; }

/* ---------- Login ---------- */
main.narrow { max-width: 24rem; margin: 12vh auto; padding: 0 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 24px; box-shadow: var(--shadow); }
.card h1 { font-size: 1.4rem; }
p.sub { margin: 4px 0 18px; color: var(--muted); }
label { display: block; font-weight: 600; font-size: .9rem; margin: 14px 0 6px; }
input[type=text], input[type=password], select {
  width: 100%; padding: 11px 12px; font: inherit; font-size: 16px;
  border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink);
}
input:focus, select:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: transparent; }
button { margin-top: 20px; width: 100%; padding: 12px; font: inherit; font-weight: 600; border: 0; border-radius: 8px; background: var(--brand); color: var(--brand-ink); cursor: pointer; }
.error { color: var(--warn); margin: 12px 0 0; font-size: .92rem; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; height: 54px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 16px; background: var(--brand); color: var(--brand-ink);
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--brand-ink); text-decoration: none; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; }
.brand svg { width: 24px; height: 24px; flex: none; }
.topbar nav { display: flex; align-items: center; gap: 2px; }
.topbar nav.tabs { flex: 1; justify-content: flex-end; }
@media (max-width: 640px) {
  /* Phone: brand + log out on the first line, the menu scrolls sideways underneath. */
  .topbar { height: auto; flex-wrap: wrap; padding-top: 8px; padding-bottom: 0; row-gap: 4px; }
  .topbar nav.tabs { order: 3; flex: 1 0 100%; justify-content: flex-start; overflow-x: auto; scrollbar-width: none; padding-bottom: 6px; margin: 0 -6px; }
  .topbar nav.tabs::-webkit-scrollbar { display: none; }
  .brand span { display: inline; }
}
.topbar nav a, .topbar button.link { color: var(--brand-ink); text-decoration: none; padding: 7px 11px; border-radius: 8px; font-size: .92rem; opacity: .85; white-space: nowrap; }
.topbar nav a:hover, .topbar button.link:hover { opacity: 1; background: rgba(255,255,255,.12); }
.topbar nav a[aria-current] { opacity: 1; background: rgba(255,255,255,.18); font-weight: 600; }
.topbar form.logout { margin: 0; }
button.link { margin: 0; width: auto; background: none; font-weight: 400; }

main.wrap { max-width: 76rem; margin: 0 auto; padding: 20px 16px 56px; }
@media (min-width: 760px) { main.wrap { padding: 28px 24px 64px; } }

/* ---------- Page header ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 6px 16px; margin: 0 0 18px; }
.eyebrow { font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--brand-text); margin-bottom: 2px; }
.meta { margin: 4px 0 0; color: var(--muted); font-size: .9rem; }
.stamp { margin: 0; color: var(--faint); font-size: .82rem; }
.back { display: inline-flex; align-items: center; gap: 4px; margin: 0 0 10px; text-decoration: none; font-size: .9rem; font-weight: 600; }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0 0 16px; }
@media (min-width: 760px) { .kpis { 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: 14px 16px; box-shadow: var(--shadow); }
.kpi-label { color: var(--muted); font-size: .8rem; font-weight: 500; }
.kpi-value { font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.25; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi-extra { color: var(--brand-text); font-size: .78rem; font-weight: 600; margin-top: 2px; }

/* ---------- Panels (cards) ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 13px 16px 11px; border-bottom: 1px solid var(--line); }
.panel-note { color: var(--faint); font-size: .78rem; margin-top: 1px; }
.more { font-size: .82rem; font-weight: 600; text-decoration: none; white-space: nowrap; padding: 2px 0; }
.more::after { content: " \2192"; }
.board { columns: 1; column-gap: 16px; }
@media (min-width: 900px) { .board { columns: 2; } }
@media (min-width: 1280px) { .board { columns: 3; } }
.board > .panel { break-inside: avoid; margin: 0 0 16px; display: inline-block; width: 100%; }

.facts { margin: 0; }
.fact { display: grid; grid-template-columns: minmax(0, 8.5rem) minmax(0, 1fr); gap: 2px 14px; padding: 9px 16px; border-top: 1px solid var(--line); }
.fact:first-child { border-top: 0; }
.fact dt { color: var(--muted); font-size: .84rem; font-weight: 500; padding-top: 1px; }
.fact dd { margin: 0; font-size: .92rem; min-width: 0; overflow-wrap: anywhere; }
.fact dd > div + div { margin-top: 2px; }
@media (max-width: 420px) { .fact { grid-template-columns: 1fr; } }
.intro { color: var(--muted); font-size: .82rem; margin-bottom: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { display: inline-flex; align-items: baseline; gap: 4px; padding: 2px 8px; border-radius: 999px; background: var(--brand-soft); color: var(--ink); font-size: .84rem; font-variant-numeric: tabular-nums; }
.chip b { font-weight: 650; }
.chip small { color: var(--muted); font-size: .72rem; }
.empty { padding: 28px; text-align: center; color: var(--muted); }

/* ---------- Day / week changes ---------- */
.deltas { display: flex; flex-wrap: wrap; gap: 2px 10px; margin-top: 4px; }
.delta { font-size: .78rem; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.delta-label { color: var(--faint); font-weight: 500; }
.delta.good { color: var(--good); }
.delta.bad { color: var(--warn); }
.delta.flat { color: var(--muted); }
td.muted { color: var(--faint); }

/* ---------- Trends ---------- */
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 2px; }
.seg a { padding: 5px 11px; border-radius: 7px; font-size: .84rem; text-decoration: none; color: var(--muted); white-space: nowrap; }
.seg a[aria-current] { background: var(--brand); color: var(--brand-ink); font-weight: 600; }
.trend-grid { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 700px) { .trend-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1150px) { .trend-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.trend { padding: 14px 16px 12px; overflow: visible; }
.trend h2 { font-size: .84rem; font-weight: 600; color: var(--muted); }
.trend-value { font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; margin-top: 2px; font-variant-numeric: tabular-nums; }
.trend-foot { margin-top: 6px; color: var(--muted); font-size: .8rem; }
.trend-foot .delta { font-size: .78rem; }
.chart { position: relative; margin-top: 10px; touch-action: pan-y; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .line { fill: none; stroke: var(--brand); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.chart .end { fill: var(--brand); stroke: var(--surface); stroke-width: 2; }
.chart .grid { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart .axis { fill: var(--faint); font-size: 10px; }
.chart .cross { stroke: var(--line-strong); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart .hover-dot { fill: var(--brand); stroke: var(--surface); stroke-width: 2; }
.chart .tip { position: absolute; top: -6px; transform: translate(-50%, -100%); background: var(--ink); color: var(--surface); border-radius: 6px; padding: 4px 8px; font-size: .76rem; line-height: 1.3; white-space: nowrap; pointer-events: none; text-align: center; }
.chart .tip b { display: block; font-size: .84rem; }
.table-scroll.flat { border: 0; border-radius: 0; box-shadow: none; max-height: none; }
table.compare th.num { text-align: right; }
table.compare td.delta { font-size: .82rem; }

/* ---------- Buttons, pills, notices ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; width: auto; margin: 0; padding: 9px 16px; border-radius: 8px; border: 1px solid transparent;
  background: var(--brand); color: var(--brand-ink); font: inherit; font-size: .92rem; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn.secondary:hover { background: var(--head); }
.btn.danger { background: var(--surface); color: var(--warn); border-color: var(--line-strong); }
.btn.small { padding: 5px 11px; font-size: .82rem; border-radius: 7px; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .74rem; font-weight: 650; background: var(--head); color: var(--muted); white-space: nowrap; vertical-align: 1px; }
.pill.good { background: #dcf3e3; color: #12632d; }
.pill.warn { background: #fdf0d2; color: #8a5a00; }
.pill.bad { background: #fde4e1; color: #a1251a; }
@media (prefers-color-scheme: dark) {
  .pill.good { background: #173a24; color: #8fe0a8; }
  .pill.warn { background: #3d3013; color: #f3c968; }
  .pill.bad { background: #3f1d1a; color: #f4a39b; }
}
.muted, small.muted { color: var(--faint); }
.notice { padding: 12px 16px; margin: 0 0 16px; font-size: .92rem; border-left: 4px solid var(--brand); }
.bad-notice { border-left-color: var(--warn); color: var(--ink); }
code { font-size: .88em; background: var(--head); padding: 1px 5px; border-radius: 4px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; }
.more.no-arrow::after { content: none; }
.kpi-extra.muted-extra { color: var(--faint); font-weight: 500; }

/* Attention list */
.attention { margin: 0 0 16px; border-color: #f1d7a8; }
.items { list-style: none; margin: 0; padding: 0; }
.items li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 11px 16px; border-top: 1px solid var(--line); font-size: .92rem; }
.items li:first-child { border-top: 0; }
.items li > span:nth-child(2) { flex: 1 1 16rem; }
.items .actions { display: flex; gap: 6px; }
.items form { margin: 0; }

/* Tables used for time and people */
table.compare tfoot th { position: static; background: var(--head); font-size: .84rem; color: var(--ink); border-top: 1px solid var(--line-strong); text-align: left; }
table.compare tfoot th.num { text-align: right; }
table.compare td a { font-weight: 600; text-decoration: none; }
table.sheet tr.flag td { background: #fff8e6 !important; }
@media (prefers-color-scheme: dark) { table.sheet tr.flag td { background: #2b2412 !important; } }
table.sheet tr.inactive td { color: var(--faint); }
table.sheet.compare td:first-child, table.sheet.compare th:first-child { white-space: nowrap; max-width: none; }
.cell-pills { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.cell-pills:empty { display: none; }
@media (max-width: 640px) {
  .hide-sm { display: none; }
  table.compare th, table.compare td { padding-left: 9px; padding-right: 9px; }
}
td.row-actions { white-space: nowrap; text-align: right; }
td.row-actions form { display: inline; margin: 0; }
table.shifts td:first-child { font-weight: 600; }

/* Forms */
.form-panel { padding: 0; max-width: 52rem; }
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px 18px; padding: 16px; }
@media (min-width: 700px) { .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.form-grid .wide { grid-column: 1 / -1; }
.form-grid label { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.form-grid input[type=text], .form-grid input[type=tel], .form-grid input[type=email], .form-grid input[type=password],
.form-grid input[type=datetime-local], .form-grid select {
  width: 100%; padding: 10px 12px; font: inherit; font-size: 16px; font-weight: 400;
  border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); }
.form-grid label.check { flex-direction: row; align-items: center; gap: 10px; font-weight: 500; align-self: end; padding-bottom: 10px; }
.form-grid label.check input { width: 20px; height: 20px; accent-color: var(--brand); }
.hint { color: var(--faint); font-size: .8rem; font-weight: 400; margin: 0; }
.input-prefix { display: flex; align-items: stretch; }
.input-prefix > span { display: flex; align-items: center; padding: 0 10px; border: 1px solid var(--line-strong); border-right: 0; border-radius: 8px 0 0 8px; background: var(--head); color: var(--muted); }
.input-prefix input { border-radius: 0 8px 8px 0 !important; }
.form-actions { display: flex; gap: 10px; }
.danger-row { padding: 0 16px 16px; margin: 0; }

.form-grid input[type=date], .form-grid input[type=time] {
  width: 100%; padding: 10px 12px; font: inherit; font-size: 16px; font-weight: 400;
  border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); }

/* ---------- Feed ---------- */
.feed-two { display: grid; gap: 16px; margin-top: 16px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 1000px) { .feed-two { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.error-sum { display: flex; gap: 18px; padding: 10px 16px; border-bottom: 1px solid var(--line); font-size: .9rem; color: var(--muted); }
.error-sum b { font-size: 1.05rem; color: var(--ink); }
.error-sum b.delta.bad { color: var(--warn); font-size: 1.05rem; }
.share-col { width: 34%; min-width: 10rem; }
.bar { display: inline-block; width: calc(100% - 3rem); height: 8px; background: var(--head); border-radius: 4px; vertical-align: middle; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--brand); border-radius: 4px; }

/* ---------- Messages ---------- */
.msg-layout { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 900px) { .msg-layout { grid-template-columns: 18rem minmax(0, 1fr); } }
.links a[aria-current] { background: var(--brand-soft); }
.thread { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; max-height: 60vh; overflow-y: auto; }
.bubble { max-width: 80%; padding: 8px 12px; border-radius: 12px; background: var(--head); align-self: flex-start; }
.bubble.outbound { align-self: flex-end; background: var(--brand-soft); }
.bubble-text { font-size: .92rem; overflow-wrap: anywhere; }
.bubble-meta { font-size: .72rem; color: var(--faint); margin-top: 3px; }
.composer { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); }
.composer textarea { flex: 1; font: inherit; font-size: 16px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); resize: vertical; }
.composer .btn[disabled], .composer textarea[disabled] { opacity: .55; }

.connect-panel { margin: 0 0 16px; max-width: none; border-left: 4px solid var(--brand); }
.steps { margin: 12px 16px 0 34px; padding: 0; font-size: .92rem; }
.steps li { margin: 4px 0; }
.bull-grid { display: grid; gap: 12px; padding: 14px 16px; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); }
.bull-card { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: var(--surface); }
.bull-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.bull-code { font-weight: 700; font-size: 1.02rem; letter-spacing: .01em; }
.bull-name { font-size: .86rem; margin-top: 2px; min-height: 1.2em; }
.bull-units { font-size: 2rem; font-weight: 700; line-height: 1.1; margin-top: 8px; font-variant-numeric: tabular-nums; }
.bull-units small { font-size: .85rem; font-weight: 500; color: var(--muted); }
.bull-foot { font-size: .8rem; color: var(--muted); margin-top: 4px; }
.semen-actions { display: flex; flex-wrap: wrap; gap: 10px; padding: 4px 16px 16px; }
.semen-actions details { flex: 1 1 100%; }
.semen-actions details:not([open]) { flex: 0 0 auto; }
.semen-actions summary { list-style: none; display: inline-flex; cursor: pointer; }
.semen-actions summary::-webkit-details-marker { display: none; }
.semen-actions details[open] { border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.semen-actions details[open] > form { margin-top: 12px; }
.count-form { display: flex; flex-direction: column; gap: 6px; }
.count-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 0; border-top: 1px solid var(--line); }
.count-row input { width: 6.5rem; font: inherit; font-size: 16px; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); text-align: right; }
.count-date input { font: inherit; font-size: 16px; margin-left: 6px; }
.untracked { padding: 12px 16px 16px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: .88rem; }
.untracked b:first-child { flex: 1 1 100%; font-weight: 600; }
.untracked a.chip { text-decoration: none; }
.untracked .chip, .fc-cows .chip { white-space: nowrap; }
.forecast { display: grid; gap: 16px; padding: 14px 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .forecast { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.fc-week { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.fc-head { padding: 10px 14px; background: var(--head); font-weight: 650; display: flex; justify-content: space-between; align-items: baseline; }
.fc-head small { color: var(--muted); font-weight: 500; }
.fc-big { padding: 12px 14px 8px; font-size: 2rem; font-weight: 700; }
.fc-big small { font-size: .9rem; font-weight: 500; color: var(--muted); }
.fc-group { border-top: 1px solid var(--line); }
.fc-group summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 14px; cursor: pointer; list-style: none; }
.fc-group summary::-webkit-details-marker { display: none; }
.fc-group summary > span:first-child { display: flex; flex-direction: column; min-width: 0; }
.fc-group summary small { color: var(--muted); font-size: .78rem; }
.fc-n { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.fc-group[open] summary { background: var(--head); }
.fc-cows { display: flex; flex-wrap: wrap; gap: 5px; padding: 10px 14px 12px; }
.fc-foot { padding: 0 16px 14px; }
.fc-group.missed { margin: 0 16px 14px; border: 1px solid var(--line); border-radius: 10px; }
.split-2 { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 1000px) { .split-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.day-chips { display: flex; gap: 6px; padding: 10px 16px; overflow-x: auto; border-bottom: 1px solid var(--line); scrollbar-width: thin; }
.day-chips a { flex: none; padding: 4px 10px; border: 1px solid var(--line-strong); border-radius: 999px; font-size: .84rem; text-decoration: none; color: var(--ink); white-space: nowrap; }
.day-chips a small { color: var(--muted); margin-left: 2px; }
.day-chips a[aria-current] { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 600; }
.day-chips a[aria-current] small { color: inherit; opacity: .8; }
td.cr { position: relative; min-width: 5.5rem; font-weight: 600; }
td.cr .cr-bar { position: absolute; left: 6px; bottom: 5px; height: 3px; width: calc((100% - 12px) * var(--w) / 100); max-width: calc(100% - 12px); background: var(--brand); border-radius: 2px; opacity: .55; }
td.cr.few { color: var(--faint); font-weight: 400; }
td.cr.few .cr-bar { opacity: .2; }
tr.subtotal td { background: var(--head); }
.only-sm { display: none; }
@media (max-width: 640px) { .only-sm { display: inline; } }
.wa-thumb { display: block; margin: 2px 0 4px; }
.wa-thumb img { display: block; max-width: min(260px, 100%); max-height: 260px; border-radius: 8px; border: 1px solid var(--line); object-fit: cover; }
.group-setup { padding: 14px 16px; font-size: .92rem; }
.group-setup p { margin: 0 0 10px; }
.checklist { list-style: none; margin: 0 0 12px; padding: 0; }
.checklist li { position: relative; padding: 5px 0 5px 26px; }
.checklist li::before { content: ""; position: absolute; left: 2px; top: 8px; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-strong); box-sizing: border-box; }
.checklist li.done::before { content: "\2713"; border: 0; background: var(--brand); color: var(--brand-ink); font-size: 10px; line-height: 14px; text-align: center; font-weight: 700; }
.group-list .group-name { display: flex; flex-direction: column; gap: 1px; flex: 1 1 12rem; min-width: 0; }
.group-list .group-name a { text-decoration: none; color: var(--ink); }
.group-list .group-name a[aria-current] b { color: var(--brand); }
.sub-head { border-top: 1px solid var(--line); background: var(--head); }
.group-msg > span:first-child { flex: 1 1 14rem; min-width: 0; overflow-wrap: anywhere; }

/* ---------- Payroll ---------- */
.status-ok { border-left-color: var(--good); }
td.strong { font-weight: 700; }
table.sheet th.wrap { white-space: normal; font-weight: 500; }
.downloads { font-size: .82rem; color: var(--faint); white-space: nowrap; }
.show-sm { display: none; }
@media (max-width: 640px) { .show-sm { display: flex; } .downloads { white-space: normal; text-align: right; } }
.section-title { margin: 22px 0 10px; font-size: 1.05rem; }
.people-detail { display: grid; gap: 10px; }
details.person > summary, details.settings-panel > summary { list-style: none; cursor: pointer; border-bottom: 0; }
details.person > summary::-webkit-details-marker, details.settings-panel > summary::-webkit-details-marker { display: none; }
details.person > summary { align-items: center; }
details.person > summary h2::before, details.settings-panel > summary h2::before { content: "\25B8"; display: inline-block; width: 1em; color: var(--faint); transition: transform .15s; }
details.person[open] > summary h2::before, details.settings-panel[open] > summary h2::before { transform: rotate(90deg); }
details.person[open] > summary { border-bottom: 1px solid var(--line); }
.person-gross { font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.approve-panel { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; padding: 16px; margin-top: 16px; }
.approve-panel > div { flex: 1 1 20rem; font-size: .92rem; }
.approve-panel form { margin: 0; }
.settings-panel { margin-top: 16px; }

@media print {
  .topbar, .no-print, .back { display: none !important; }
  body { background: #fff; font-size: 11pt; }
  main.wrap { max-width: none; padding: 0; }
  .panel, .kpi { box-shadow: none; break-inside: avoid; }
  .table-scroll { max-height: none; overflow: visible; border: 0; }
  table.sheet th, table.sheet td { position: static !important; padding: 4px 8px; }
  .hide-sm { display: table-cell !important; }
  .show-sm { display: none !important; }
  details.person { break-inside: avoid; }
  details.person > summary h2::before { content: none; }
  a { color: inherit; text-decoration: none; }
}

/* ---------- Breakroom tablet ---------- */
body.kiosk-page { background: var(--bg); }
main.kiosk { min-height: 100vh; max-width: 64rem; margin: 0 auto; padding: 20px 24px 40px; display: flex; flex-direction: column; }
.k-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.k-title { font-size: 1.4rem; font-weight: 700; }
.k-clock { font-size: 1.8rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--brand-text); }
.k-back { font-size: 1.1rem; font-weight: 600; text-decoration: none; padding: 10px 4px; }
.k-sub { color: var(--muted); font-size: 1.15rem; margin: 6px 0 18px; text-align: center; }
.k-sub.k-left { text-align: left; margin-top: 0; }
.k-names { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: 14px; }
.k-name { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 20px 12px 16px; background: var(--surface); border: 2px solid var(--line); border-radius: 16px;
  text-decoration: none; color: var(--ink); box-shadow: var(--shadow); -webkit-tap-highlight-color: transparent; }
.k-name:active { transform: scale(.98); }
.k-name.is-in { border-color: var(--brand); }
.k-initial, .k-avatar { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-text); font-size: 1.5rem; font-weight: 700; }
.k-name.is-in .k-initial { background: var(--brand); color: var(--brand-ink); }
.k-n { font-size: 1.15rem; font-weight: 650; text-align: center; }
.k-status { font-size: .85rem; color: var(--faint); }
.k-name.is-in .k-status { color: var(--brand-text); font-weight: 600; }
.k-name.is-missed { border-color: #e9b949; }
.k-name.is-missed .k-initial { background: #fdf0d2; color: #8a5a00; }
.k-name.is-missed .k-status { color: #8a5a00; font-weight: 600; }
@media (min-width: 900px) { .k-names { grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); } .k-name { padding: 26px 14px 20px; } }
.k-center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 10px 0 30px; }
.k-avatar { width: 80px; height: 80px; font-size: 2.2rem; margin-bottom: 8px; }
.k-big { font-size: 2.1rem; margin: 0; }
.k-btn { display: inline-flex; align-items: center; justify-content: center; min-width: 18rem; margin: 6px 0 0; padding: 22px 36px; border: 0; border-radius: 16px;
  background: var(--brand); color: var(--brand-ink); font: inherit; font-size: 1.5rem; font-weight: 700; text-decoration: none; cursor: pointer; }
.k-btn.k-out { background: #b54708; }
.k-btn.k-ghost { background: var(--surface); color: var(--ink); border: 2px solid var(--line-strong); font-size: 1.2rem; padding: 16px 30px; margin-top: 24px; }
.k-check { width: 96px; height: 96px; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: var(--brand-ink); font-size: 3rem; margin-bottom: 14px; }
.k-error { color: var(--warn); font-size: 1.1rem; font-weight: 600; margin: 4px 0 10px; }
.k-ok { color: var(--brand-text); font-size: 1.05rem; font-weight: 600; }
.k-card { background: var(--surface); border: 2px solid #f1d7a8; border-radius: 16px; padding: 20px 24px; max-width: 34rem; }
.k-q { font-size: 1.2rem; margin: 0 0 6px; }
.k-q.es { color: var(--muted); font-size: 1.05rem; }
.k-form { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: 12px; }
.k-form label { font-size: 1.05rem; }
.k-time { font: inherit; font-size: 2rem; padding: 10px 16px; border: 2px solid var(--line-strong); border-radius: 12px; background: var(--surface); color: var(--ink); }
.k-forgot { margin-top: 28px; color: var(--muted); }
.k-forgot summary { cursor: pointer; font-size: 1.05rem; padding: 8px; }
.k-pin { display: flex; flex-direction: column; align-items: center; }
.k-pin.busy { opacity: .5; pointer-events: none; }
.k-pin-input { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; }
.k-dots { display: flex; gap: 16px; margin: 4px 0 22px; }
.k-dots i { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line-strong); }
.k-dots i.on { background: var(--brand); border-color: var(--brand); }
.k-pad { display: grid; grid-template-columns: repeat(3, 84px); gap: 14px; }
.k-pad button { margin: 0; width: 84px; height: 84px; border-radius: 50%; border: 2px solid var(--line); background: var(--surface); color: var(--ink);
  font-size: 1.9rem; font-weight: 600; box-shadow: var(--shadow); -webkit-tap-highlight-color: transparent; }
.k-pad button:active { background: var(--brand-soft); }
.k-pad .k-pad-alt { font-size: 1rem; }
.k-pad .k-pad-go { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }

/* ---------- Reports list ---------- */
.groups { columns: 1; column-gap: 16px; }
@media (min-width: 760px) { .groups { columns: 2; } }
@media (min-width: 1150px) { .groups { columns: 3; } }
.groups > .panel { break-inside: avoid; margin: 0 0 16px; display: inline-block; width: 100%; }
.links { list-style: none; margin: 0; padding: 0; }
.links a { display: flex; justify-content: space-between; align-items: center; padding: 11px 16px; border-top: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.links li:first-child a { border-top: 0; }
.links a::after { content: "\203A"; color: var(--faint); font-size: 1.2rem; line-height: 1; }
.links a:hover { background: var(--head); }
.count { color: var(--faint); font-size: .8rem; font-weight: 500; }

/* ---------- Report table ---------- */
details.about { margin: 0 0 14px; color: var(--muted); font-size: .88rem; }
details.about summary { cursor: pointer; font-weight: 600; color: var(--brand-text); }
details.about p { margin: 8px 0 0; }
.table-scroll { overflow: auto; max-height: calc(100vh - 150px); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); -webkit-overflow-scrolling: touch; }
table.sheet { border-collapse: separate; border-spacing: 0; font-size: .84rem; min-width: 100%; }
table.sheet th, table.sheet td { padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: top; text-align: left; }
table.sheet td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.sheet td.long { white-space: normal; min-width: 16rem; max-width: 28rem; }
table.sheet thead th { position: sticky; top: 0; z-index: 2; background: var(--head); color: var(--muted); font-size: .76rem; font-weight: 600; white-space: pre-line; vertical-align: bottom; border-bottom: 1px solid var(--line-strong); }
table.sheet tbody tr:hover td { background: var(--brand-soft); }
table.sheet th:first-child, table.sheet td:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); border-right: 1px solid var(--line); max-width: 11rem; white-space: normal; font-weight: 600; }
table.sheet thead th:first-child { z-index: 3; background: var(--head); }
table.sheet tr.band td { background: var(--head) !important; color: var(--brand-text); font-size: .8rem; font-weight: 700; white-space: normal; position: static; max-width: none; padding-top: 14px; }
table.sheet tr.band td span { position: sticky; left: 12px; display: inline-block; max-width: calc(100vw - 72px); }
