/* Jobreport: plain, functional styling. System font, neutral greys, one accent; colour only where it
   carries meaning (status, night hours). Mobile first. */

:root {
  --bg: #f5f6f7;
  --surface: #ffffff;
  --surface-alt: #f8f9fa;
  --line: #dfe2e6;
  --text: #1f2328;
  --text-soft: #424a53;
  --muted: #646c75;
  --accent: #2c4a30;
  --accent-dark: #1f3622;
  --accent-soft: #edf2ee;
  --night: #3b4a7a;
  --ok: #1e6b34;
  --ok-soft: #e3f1e6;
  --warn: #7a5600;
  --warn-soft: #fbf0d4;
  --bad: #b02a1b;
  --bad-soft: #fbe5e2;
  --info-soft: #e8edf6;
  --radius: 8px;
  --gutter: 16px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 16px/1.5 var(--font); }
body.has-nav { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
a { color: var(--accent); }
h1, h2, h3 { font-weight: 650; margin: 0; letter-spacing: -0.005em; }
code { font-size: 0.9em; background: var(--surface-alt); border: 1px solid var(--line); padding: 0 5px; border-radius: 4px; }
.icon { width: 20px; height: 20px; flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 0.86rem; }
.clay { color: var(--warn); }
[hidden] { display: none !important; }

/* ---- Top bar --------------------------------------------------------------------------- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar-inner { max-width: 1240px; margin: 0 auto; padding: 8px var(--gutter); display: flex; align-items: center; gap: 20px; min-height: 56px; }
.brand { display: flex; flex-direction: column; line-height: 1.15; color: var(--text); text-decoration: none; min-width: 0; }
.brand-name { font-weight: 700; font-size: 1.1rem; }
.brand-logo { font-weight: 400; }
.brand-sub { font-size: 0.78rem; color: var(--muted); white-space: nowrap; }
.topnav { display: none; }
.userchip { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.userchip-text { display: none; flex-direction: column; line-height: 1.2; text-align: right; }
.userchip-name { font-weight: 600; font-size: 0.92rem; }
.userchip-role { font-size: 0.78rem; color: var(--muted); }
.avatar {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; flex: none;
  background: var(--surface-alt); border: 1px solid var(--line); color: var(--text-soft); font-weight: 600; font-size: 0.8rem;
}
.avatar-sm { width: 32px; height: 32px; font-size: 0.74rem; }
.logout-form { margin: 0; }

@media (min-width: 1000px) {
  body.has-nav { padding-bottom: 0; }
  .topnav { display: flex; gap: 2px; flex-wrap: wrap; }
  .topnav a { color: var(--text-soft); text-decoration: none; padding: 7px 11px; border-radius: 6px; font-size: 0.94rem; display: inline-flex; align-items: center; gap: 6px; }
  .topnav a:hover { background: var(--surface-alt); color: var(--text); }
  .topnav a.is-active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
  .userchip-text { display: flex; }
  .tabbar { display: none !important; }
}

/* ---- Bottom tab bar (phones/tablets) --------------------------------------------------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
  background: var(--surface); border-top: 1px solid var(--line);
  padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
}
.tabbar a {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); text-decoration: none; font-size: 0.72rem; font-weight: 500; min-height: 54px;
}
.tabbar a .icon { width: 24px; height: 24px; }
.tabbar .tab-add { width: 52px; height: 52px; min-height: 0; margin: 0 auto; border-radius: 50%; background: var(--accent); color: #fff; }
.tabbar .tab-add .icon { width: 26px; height: 26px; stroke-width: 2.2; }
.tabbar .dot {
  position: absolute; top: 4px; left: 50%; margin-left: 5px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--bad); color: #fff; font-size: 0.7rem; line-height: 18px; text-align: center;
}

/* ---- Layout ---------------------------------------------------------------------------- */
.main { max-width: 1240px; margin: 0 auto; padding: 16px var(--gutter) 40px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 4px 0 14px; }
.page-title { font-size: 1.5rem; line-height: 1.2; }
.page-head p { margin: 2px 0 0; }
.crumbs { margin: 0 0 6px; }
.crumbs a { display: inline-flex; align-items: center; gap: 2px; text-decoration: none; font-size: 0.92rem; }
.crumbs .icon { width: 16px; height: 16px; }
.split { display: grid; gap: 14px; margin-bottom: 14px; }
.stack { display: grid; gap: 14px; align-content: start; }
@media (min-width: 1000px) { .split { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); } }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.split > .card, .stack > .card { margin-bottom: 0; }
.card-flush { padding: 0; overflow: hidden; }
.card-pad { padding: 12px 16px; }
.card-title { font-size: 1.02rem; display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.card-pad.card-title, .card-head .card-title { margin-bottom: 0; }
.card-title .icon { color: var(--muted); width: 18px; height: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

/* ---- Buttons --------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0.55em 1.1em; border-radius: 6px; border: 1px solid var(--line);
  font: 600 0.96rem var(--font); text-decoration: none; cursor: pointer; white-space: nowrap;
  background: var(--surface); color: var(--text);
}
.btn small { font-weight: 400; opacity: 0.85; }
.btn:hover { background: var(--surface-alt); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-secondary { background: var(--surface); color: var(--text); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--accent); }
.btn-ghost:hover { background: var(--accent-soft); }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-ghost.btn-danger { background: transparent; border-color: transparent; color: var(--bad); }
.btn-sm { min-height: 36px; padding: 0.3em 0.8em; font-size: 0.88rem; }
.btn-lg { min-height: 50px; font-size: 1rem; padding: 0.65em 1.3em; }
.btn-block { width: 100%; }
.iconbtn {
  display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 6px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text-soft); cursor: pointer; text-decoration: none; padding: 0;
}
.iconbtn:hover { background: var(--surface-alt); }
.iconbtn-sm { width: 36px; height: 36px; }
.iconbtn-sm .icon { width: 18px; height: 18px; }
.iconbtn-ok { color: var(--ok); }
.iconbtn-ok:hover { background: var(--ok-soft); }
.iconbtn-no { color: var(--bad); }
.iconbtn-no:hover { background: var(--bad-soft); }

/* ---- Flash / alerts -------------------------------------------------------------------- */
.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 12px; background: var(--ok-soft); color: var(--ok); border: 1px solid rgba(30, 107, 52, 0.2); }
.flash-error { background: var(--bad-soft); color: var(--bad); border-color: rgba(176, 42, 27, 0.2); }
.flash-info { background: var(--info-soft); color: var(--night); border-color: rgba(59, 74, 122, 0.2); }
.alert { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 6px; margin-bottom: 10px; text-decoration: none; border: 1px solid transparent; }
.alert span { flex: 1; }
.alert-error { background: var(--bad-soft); color: var(--bad); border-color: rgba(176, 42, 27, 0.2); }
.alert-warn { background: var(--warn-soft); color: var(--warn); border-color: rgba(122, 86, 0, 0.2); }

/* ---- Badges & tags --------------------------------------------------------------------- */
.badge { display: inline-block; padding: 1px 8px; border-radius: 4px; font-size: 0.78rem; font-weight: 600; white-space: nowrap; }
.badge-draft { background: #eceef0; color: var(--text-soft); }
.badge-submitted { background: var(--warn-soft); color: var(--warn); }
.badge-approved { background: var(--ok-soft); color: var(--ok); }
.badge-rejected { background: var(--bad-soft); color: var(--bad); }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; border-radius: 4px; font-size: 0.8rem; background: var(--surface-alt); border: 1px solid var(--line); color: var(--text-soft); }
.tag .icon { width: 14px; height: 14px; }
.tag-night { color: var(--night); }
.tag-clay { color: var(--warn); }
.count { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--bad); color: #fff; font-size: 0.75rem; font-weight: 600; text-align: center; line-height: 20px; }
.count-lg { min-width: 26px; line-height: 26px; border-radius: 13px; font-size: 0.86rem; }
.night { display: inline-flex; align-items: center; gap: 3px; color: var(--night); }
.night .icon { width: 15px; height: 15px; }

/* ---- Dashboard header ------------------------------------------------------------------ */
.hero { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; margin: 4px 0 16px; }
.hero h1 { font-size: 1.5rem; line-height: 1.2; }
.hero-date { margin: 0 0 2px; color: var(--muted); font-size: 0.92rem; }
.hero-actions { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 520px) { .hero-actions, .hero-actions .btn { width: 100%; } }

/* ---- Tiles ----------------------------------------------------------------------------- */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
@media (min-width: 700px) { .tiles { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); } }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.tile-label { font-size: 0.8rem; color: var(--muted); }
.tile-value { font-size: 1.45rem; font-weight: 650; line-height: 1.25; font-variant-numeric: tabular-nums; }
.tile-sub { font-size: 0.8rem; color: var(--muted); }
.tone-night .tile-value { color: var(--night); }
.tone-clay .tile-value { color: var(--warn); }
.meter { display: block; height: 4px; border-radius: 2px; background: #e8eaed; margin: 6px 0 4px; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--accent); }

/* ---- Period navigation & pickers ------------------------------------------------------- */
.periodnav { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.periodnav-label { display: flex; flex-direction: column; line-height: 1.25; min-width: 150px; text-align: center; }
.periodnav-label strong { font-size: 1.05rem; }
.periodnav-label span { font-size: 0.84rem; color: var(--muted); }
.picker { margin: 0; max-width: 100%; }
.picker select { min-width: 220px; }
@media (max-width: 520px) { .picker, .picker select { width: 100%; min-width: 0; } }

/* ---- Forms ----------------------------------------------------------------------------- */
.form { display: block; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; min-width: 0; }
.field > span { font-weight: 600; font-size: 0.9rem; color: var(--text-soft); }
input, select, textarea {
  font: inherit; font-size: 16px; color: var(--text); background: #fff; border: 1px solid #c8cdd3; border-radius: 6px;
  padding: 9px 11px; min-height: 44px; width: 100%; max-width: 100%; min-width: 0;
}
input[type="date"], input[type="time"] { display: block; -webkit-appearance: none; appearance: none; }
input::-webkit-date-and-time-value { text-align: left; }
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(44, 74, 48, 0.35); outline-offset: 0; border-color: var(--accent); }
:focus-visible { outline: 2px solid rgba(44, 74, 48, 0.5); outline-offset: 2px; }
input[disabled], select[disabled], textarea[disabled] { background: var(--surface-alt); color: var(--text-soft); }
.has-error input, .has-error select { border-color: var(--bad); }
.field-error { color: var(--bad); font-size: 0.86rem; }
.grid-2 { display: grid; gap: 0 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 420px) { .grid-2 { grid-template-columns: 1fr; } .entry-form .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.check { display: flex; align-items: center; gap: 10px; padding: 8px 0; cursor: pointer; }
.check input { width: 22px; height: 22px; min-height: 0; accent-color: var(--accent); flex: none; }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.sticky-actions { position: sticky; bottom: calc(68px + env(safe-area-inset-bottom)); background: var(--bg); border-top: 1px solid var(--line); padding: 10px 0; margin: 0 calc(-1 * var(--gutter)); padding-left: var(--gutter); padding-right: var(--gutter); z-index: 5; }
.sticky-actions .btn { flex: 1 1 auto; }
@media (min-width: 1000px) { .sticky-actions { bottom: 0; margin: 0; padding-left: 0; padding-right: 0; border-top: 0; } .sticky-actions .btn { flex: 0 0 auto; } }
.entry-form { max-width: 760px; }
.entry-form .card { margin-bottom: 10px; }

.chips, .quickbar, .presets { display: flex; gap: 6px; flex-wrap: wrap; }
.quickbar { margin-bottom: 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; min-height: 38px; border-radius: 6px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); font: 500 0.88rem var(--font); cursor: pointer; text-decoration: none;
}
.chip:hover { background: var(--surface-alt); }
.chip.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip .icon { width: 16px; height: 16px; }

.segmented { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; margin-bottom: 12px; }
.segmented label { position: relative; cursor: pointer; }
.segmented label + label { border-left: 1px solid var(--line); }
.segmented input { position: absolute; opacity: 0; inset: 0; }
.segmented span { display: block; text-align: center; padding: 10px 8px; font-weight: 500; color: var(--text-soft); background: var(--surface); }
.segmented input:checked + span { background: var(--accent); color: #fff; }
.segmented input:focus-visible + span { outline: 2px solid rgba(44, 74, 48, 0.5); outline-offset: -2px; }

.calc { display: flex; gap: 20px; flex-wrap: wrap; margin-top: 12px; padding: 10px 12px; background: var(--surface-alt); border: 1px solid var(--line); border-radius: 6px; align-items: center; }
.calc > div:not(.calc-note) { display: flex; flex-direction: column; }
.calc span { font-size: 0.8rem; color: var(--muted); }
.calc strong { font-size: 1.35rem; line-height: 1.2; font-variant-numeric: tabular-nums; }
.calc [data-calc="night"] { color: var(--night); }
.calc-note { font-size: 0.86rem; color: var(--night); }

.danger-zone { display: flex; gap: 8px; flex-wrap: wrap; max-width: 760px; margin-top: 8px; }
.danger-zone form { margin: 0; }

/* ---- Week view ------------------------------------------------------------------------- */
.statusline { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; font-size: 0.9rem; }
.days { display: grid; gap: 10px; }
.day { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; scroll-margin-top: 70px; }
.day.is-today { border-color: var(--accent); }
.day-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 12px; background: var(--surface-alt); border-bottom: 1px solid var(--line); }
.day-head h2 { font-size: 1rem; }
.day-head h2 span { font-weight: 400; color: var(--muted); font-size: 0.92rem; }
.today { font-style: normal; font-size: 0.74rem; font-weight: 600; background: var(--accent); color: #fff; padding: 1px 6px; border-radius: 4px; vertical-align: 2px; }
.day-meta { display: flex; align-items: center; gap: 10px; font-size: 0.88rem; flex-wrap: wrap; justify-content: flex-end; }
.day-meta strong { font-size: 1rem; font-variant-numeric: tabular-nums; }
.day-empty { margin: 0; padding: 10px 12px; color: var(--muted); font-size: 0.92rem; }
.entry { display: flex; position: relative; }
.entry + .entry { border-top: 1px solid var(--line); }
.entry::before { content: ""; width: 3px; flex: none; background: transparent; }
.entry.status-submitted::before { background: #d9a400; }
.entry.status-approved::before { background: var(--ok); }
.entry.status-rejected::before { background: var(--bad); }
.entry-main { flex: 1; display: grid; grid-template-columns: 1fr auto; gap: 3px 10px; padding: 10px 12px; color: inherit; text-decoration: none; min-width: 0; }
.entry-main:hover { background: var(--surface-alt); }
.entry-time { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; grid-column: 1; }
.entry-time strong { font-variant-numeric: tabular-nums; }
.entry-time span { color: var(--muted); font-size: 0.86rem; }
.entry-body { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.entry-body > strong { font-weight: 600; }
.entry-body > span { color: var(--text-soft); font-size: 0.9rem; }
.entry-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.entry-remarks { font-style: italic; color: var(--muted) !important; }
.entry-reject { color: var(--bad) !important; display: inline-flex; gap: 6px; align-items: center; }
.entry-reject .icon { width: 16px; height: 16px; }
.entry-status { grid-column: 2; grid-row: 1; justify-self: end; }
.entry-copy { display: grid; place-items: center; width: 46px; flex: none; color: var(--muted); border-left: 1px solid var(--line); }
.entry-copy:hover { color: var(--accent); background: var(--surface-alt); }
@media (min-width: 760px) {
  .entry-main { grid-template-columns: 160px 1fr auto; }
  .entry-time { flex-direction: column; gap: 0; }
  .entry-body { grid-column: 2; grid-row: 1; }
  .entry-status { grid-column: 3; }
}
.week-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 16px; }
.week-actions form { margin: 0; }
.week-actions .icon { vertical-align: -4px; }
@media (max-width: 520px) { .week-actions form, .week-actions .btn { width: 100%; } }

/* ---- Tables ---------------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
.table th { text-align: left; font-size: 0.8rem; color: var(--muted); font-weight: 600; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--surface-alt); white-space: nowrap; }
.table td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-compact td { padding: 7px 12px; }
.table tfoot td { font-weight: 600; border-top: 1px solid var(--line); background: var(--surface-alt); }
.table tr.subtotal td { background: var(--surface-alt); font-weight: 600; font-size: 0.88rem; }
.table tr.is-weekend td, .table tr.is-empty td { color: var(--muted); }
.table tr.is-inactive td { opacity: 0.55; }
.table a { text-decoration: none; }
.row-actions { white-space: nowrap; text-align: right; }
.row-actions form, .row-actions details { display: inline-block; margin: 0; vertical-align: middle; }
.month-table td:first-child { white-space: nowrap; }
.lines-table td { white-space: nowrap; }

/* Tables marked with data-label become stacked cards on phones. */
@media (max-width: 759px) {
  .review-table thead, .stack-table thead { display: none; }
  .review-table, .review-table tbody, .review-table tr, .review-table td,
  .stack-table, .stack-table tbody, .stack-table tr, .stack-table td { display: block; width: 100%; }
  .review-table tr, .stack-table tr { border-bottom: 1px solid var(--line); padding: 8px 0; position: relative; }
  .review-table tbody tr:last-child, .stack-table tbody tr:last-child { border-bottom: 0; }
  .review-table td, .stack-table td { border: 0; padding: 2px 12px; text-align: left !important; white-space: normal; }
  .review-table td[data-label]::before, .stack-table td[data-label]::before { content: attr(data-label); display: inline-block; min-width: 92px; font-size: 0.8rem; color: var(--muted); }
  .review-table .row-actions, .stack-table .row-actions { text-align: left; padding-top: 6px; }
}
.reject-pop summary, .reject-week summary { list-style: none; }
.reject-pop summary::-webkit-details-marker, .reject-week summary::-webkit-details-marker { display: none; }
.reject-pop[open] .reject-form { position: absolute; right: 12px; z-index: 10; width: min(320px, calc(100vw - 48px)); background: #fff; border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12); padding: 12px; text-align: left; white-space: normal; }
.review-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-start; margin-top: 14px; }
.review-actions form { margin: 0; }
.reject-week[open] .reject-form { margin-top: 10px; min-width: min(380px, 100%); }
@media (max-width: 520px) { .review-actions > form, .review-actions .btn, .reject-week { width: 100%; } }

/* ---- Queue, lists ---------------------------------------------------------------------- */
.queue { display: grid; gap: 8px; }
.queue-item { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.queue-main { flex: 1 1 300px; display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; min-width: 0; flex-wrap: wrap; }
.queue-main > div:nth-child(2) { display: flex; flex-direction: column; min-width: 0; flex: 1 1 160px; }
.queue-figures { display: flex; gap: 12px; flex-wrap: wrap; font-size: 0.9rem; align-items: center; }
.queue-action { margin: 0; }
@media (max-width: 520px) { .queue-action, .queue-action .btn { width: 100%; } }
.list { list-style: none; margin: 0; padding: 0; }
.list li + li { border-top: 1px solid var(--line); }
.list a { display: flex; align-items: center; gap: 12px; padding: 10px 16px; color: inherit; text-decoration: none; }
.list a:hover { background: var(--surface-alt); }
.list a.is-today { background: var(--accent-soft); }
.list .icon { color: var(--muted); width: 18px; height: 18px; }
.list-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.list-main strong { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.daydot { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--surface-alt); border: 1px solid var(--line); color: var(--muted); font-weight: 600; font-size: 0.8rem; flex: none; }
.daydot.has { background: var(--accent); border-color: var(--accent); color: #fff; }

.empty { text-align: center; padding: 36px 16px; }
.empty h1, .empty h2 { margin-bottom: 6px; font-size: 1.2rem; }
.empty-icon { display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); margin-bottom: 8px; }
.empty-icon .icon { width: 24px; height: 24px; }

/* ---- Bars & charts --------------------------------------------------------------------- */
.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(0, 1fr) 64px; gap: 3px 10px; align-items: center; font-size: 0.9rem; }
.bar-row > span:first-child { grid-column: 1 / -1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { height: 8px; background: #e8eaed; border-radius: 4px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); }
.bar-row strong { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.daychart { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; height: 160px; align-items: end; }
.daychart-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.daychart-bar { width: 100%; max-width: 36px; background: var(--accent); border-radius: 3px 3px 0 0; min-height: 2px; }
.daychart-val { font-size: 0.78rem; color: var(--text-soft); }
.daychart-lbl { font-size: 0.8rem; color: var(--muted); }

/* ---- Filters, tabs, menu, misc --------------------------------------------------------- */
.filters .presets { margin-bottom: 12px; }
.filter-grid { display: grid; gap: 0 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 900px) { .filter-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tabs { display: flex; gap: 2px; overflow-x: auto; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.tabs a { padding: 9px 12px; text-decoration: none; color: var(--text-soft); white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.is-active { color: var(--accent); font-weight: 600; border-bottom-color: var(--accent); }
.menu-list { display: grid; gap: 0; margin-bottom: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.menu-list form { margin: 0; }
.menu-list > * + * { border-top: 1px solid var(--line); }
.menu-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 16px; background: var(--surface); border: 0; text-decoration: none; color: var(--text); font: 500 1rem var(--font); cursor: pointer; text-align: left; }
.menu-item span { flex: 1; }
.menu-item .icon { color: var(--muted); }
.menu-item-primary { color: var(--accent); font-weight: 600; }
.menu-item-primary .icon { color: var(--accent); }
.deflist { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0 0 14px; font-size: 0.92rem; }
.deflist dt { font-weight: 600; color: var(--text-soft); }
.deflist dd { margin: 0; }

/* ---- Login ----------------------------------------------------------------------------- */
.login { min-height: calc(100vh - 80px); display: grid; place-items: center; }
.login-card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 24px; }
.login-brand { margin-bottom: 20px; }
.login-brand h1 { font-size: 1.8rem; line-height: 1.1; }
.login-brand p { margin: 4px 0 0; color: var(--muted); }
.login-note { text-align: center; color: var(--muted); font-size: 0.82rem; margin: 16px 0 0; }

/* ---- Phone refinements ----------------------------------------------------------------- */
@media (max-width: 759px) {
  .day-head { padding: 6px 8px 6px 12px; }
  .day-head h2 { white-space: nowrap; }
  .day-meta { gap: 8px; flex-wrap: nowrap; }
  .day-meta .iconbtn { width: 34px; height: 34px; }
  .sticky-actions { flex-wrap: nowrap; }
  .sticky-actions .btn { flex: 1 1 0; min-width: 0; white-space: normal; line-height: 1.2; padding-left: 0.6em; padding-right: 0.6em; }
}
@media (max-width: 400px) { .day-km { display: none; } }
.single { max-width: 760px; }

/* ---- In-app confirmation dialog -------------------------------------------------------- */
.confirm { border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; width: min(420px, calc(100vw - 32px)); background: var(--surface); color: var(--text); box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2); }
.confirm::backdrop { background: rgba(31, 35, 40, 0.45); }
.confirm p { margin: 0 0 16px; font-size: 1rem; }
.confirm-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
@media (max-width: 520px) { .confirm-actions .btn { flex: 1 1 0; } }

/* ---- Login: centred in the visible area, also on phones with browser bars -------------- */
body.is-guest .main { min-height: 100vh; min-height: 100svh; display: grid; place-items: center; padding-top: 16px; padding-bottom: 16px; }
body.is-guest .login { min-height: 0; width: 100%; }
.langs { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 12px; margin-top: 18px; font-size: 0.9rem; }
.langs a { color: var(--muted); text-decoration: none; padding: 4px 2px; }
.langs a.is-active { color: var(--text); font-weight: 600; }

/* ---- Personal settings ----------------------------------------------------------------- */
.choice-list { display: grid; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; margin: 8px 0 4px; }
.choice { display: flex; align-items: center; gap: 12px; padding: 12px 14px; cursor: pointer; }
.choice + .choice { border-top: 1px solid var(--line); }
.choice input { width: 20px; height: 20px; min-height: 0; accent-color: var(--accent); flex: none; }
.userchip-link { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
