:root {
  color-scheme: light;
  --ink: #202421;
  --muted: #555f56;
  --dark: #171a18;
  --lime: #e0ea35;
  --paper: #fff;
  --shell: #f1f3ef;
  --line: #d9ded6;
  --width: 960px;
  background: var(--shell);
  color: var(--ink);
  font: 100%/1.4 system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-text-size-adjust: 100%;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body, h1, h2, h3, p, dl, dd { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; min-width: 0; }
a { color: inherit; text-decoration: none; }
button, a, summary, select { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #687200; outline-offset: 3px; }
h1 { font-size: clamp(1.85rem, 5vw, 2.5rem); line-height: 1.12; letter-spacing: -.045em; }
h2 { font-size: 1.18rem; letter-spacing: -.016em; }
h3 { font-size: 1.04rem; line-height: 1.25; }
.skip { position: fixed; top: -5rem; left: 1rem; z-index: 10; padding: .75rem; background: white; }
.skip:focus { top: 1rem; }
.topbar { background: var(--dark); color: white; border-bottom: 4px solid var(--lime); padding-top: env(safe-area-inset-top, 0px); }
.topbar-inner {
  min-height: 74px; max-width: var(--width); margin: auto; padding: 8px 18px; display: flex;
  align-items: center; justify-content: space-between; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 9px; font-size: clamp(1.25rem, 5vw, 1.7rem); font-weight: 820; letter-spacing: -.055em; }
.brand img { border-radius: 10px; }
.preview-label { color: #d2d8d0; font-size: .76rem; font-weight: 550; white-space: nowrap; }
.topbar-actions { display: grid; justify-items: end; gap: 2px; }
.topbar-actions button { min-height: 44px; padding: 3px 8px; border: 0; border-radius: 6px; background: transparent; color: white; font-size: .8rem; cursor: pointer; }
.topbar-actions button:hover { background: #394039; }
.login-layout { max-width: 470px; padding-top: 40px; }
.login-layout form { width: 100%; }
.layout { width: min(100%, var(--width)); margin: auto; padding: 22px 18px 36px; }
nav { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 13px; background: var(--paper); }
nav a { display: grid; place-items: center; text-align: center; min-height: 44px; padding: 6px 2px; border-radius: 9px; font-weight: 650; font-size: .88rem; }
nav a[aria-current] { background: var(--lime); color: var(--dark); }
nav a:hover:not([aria-current]) { background: var(--shell); }
main { display: grid; align-content: start; gap: 18px; min-width: 0; margin-top: 24px; }
main:focus { outline: none; }
.page-head { display: grid; gap: 4px; }
.page-head p, .records p, .record p, .wheel-card p { color: var(--muted); }
.date { font-variant-numeric: tabular-nums; font-size: .8rem; font-weight: 650; }
.back { width: max-content; min-height: 44px; display: flex; align-items: center; gap: 8px; margin-block-end: 3px; padding-right: 8px; font-weight: 620; font-size: .86rem; }
.back::before { content: '‹'; font-size: 1.45rem; line-height: 1; }
.search-panel { padding: 13px 15px; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; }
.search, .field { display: grid; gap: 6px; }
.search span, .field span { font-size: .86rem; font-weight: 650; }
.search input, .field :is(input,select,textarea) {
  min-height: 48px; width: 100%; padding: 9px 11px; border: 1px solid #cbd2c9; border-radius: 8px; background: #fafbf9;
}
.search-panel [data-results] { display: grid; gap: 6px; margin-top: 10px; }
.search-panel [data-results] .record { background: #f9faf8; }
.list-section { display: grid; gap: 10px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.section-head span { color: var(--muted); font-size: .8rem; }
.day-controls { display: grid; grid-template-columns: 52px minmax(0, 1fr) 52px; gap: 7px; }
.day-controls .action { justify-content: center; min-height: 46px; }
.day-controls .action:not(.day-today) { font-size: 1.4rem; }
.day-today[aria-current] { background: #e9f0b8; }
.info-panel { display: grid; gap: 10px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 13px; background: var(--paper); }
.info-panel p { color: var(--muted); }
.info-panel p.error { color: #802f21; }
.photo-panel { border-color: #b6bf80; }
.photo-actions button { min-height: 48px; }
.photo-panel [data-photo-feedback]:empty { display: none; }
.photo-grid, .missing-panel ul, .change-list { margin: 0; }
.photo-grid, .change-list { padding: 0; list-style: none; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 10px; }
.photo-grid a { display: block; }
.photo-grid img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--shell); border-radius: 8px; }
.photo-grid time { display: block; margin-top: 4px; color: var(--muted); font-size: .75rem; }
.missing-panel .action { justify-self: start; }
.missing-panel ul { padding-inline-start: 20px; color: var(--muted); font-size: .9rem; }
.storage-fields { display: grid; gap: 8px; }
.change-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 8px; padding-block: 8px; border-top: 1px solid var(--line); font-size: .86rem; }
.change-list li p { grid-column: 1/-1; }
.duration { font-variant-numeric: tabular-nums; }
.info-panel .running-time { color: var(--ink); font-size: 1.85rem; line-height: 1; font-weight: 750; }
.time-totals { display: grid; gap: 5px; }
.time-totals > div { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.time-totals > div:last-child { border-top: 1px solid var(--line); padding-top: 7px; }
.time-history { display: grid; list-style: none; margin: 0; padding: 0; }
.time-history li { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: .86rem; }
.time-history li span { color: var(--muted); }
.travel-editor > summary { cursor: pointer; font-weight: 650; padding-block: 6px; }
.travel-editor form { gap: 8px; }
.travel-editor .field { padding: 0; border: 0; background: transparent; }
.travel-leg { display: grid; grid-template-columns: minmax(0, 1fr) minmax(105px, 1fr); align-items: center; gap: 8px; }
.travel-leg > label:first-child { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.travel-leg input[type=checkbox] { width: 19px; height: 19px; margin: 0; accent-color: #728000; }
.travel-leg input:disabled { color: var(--muted); background: var(--shell); }
.winter-position { display: flex; justify-content: space-between; gap: 10px; padding: 10px; border-radius: 8px; background: #e9f0b8; font-size: .86rem; }
.winter-position span { flex: none; font-weight: 700; }
.preserve { white-space: pre-wrap; overflow-wrap: anywhere; }
.actions { display: flex; flex-wrap: wrap; gap: 7px; }
.action {
  display: inline-flex; align-items: center; min-height: 44px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: #f9faf8; font-size: .86rem; font-weight: 650;
}
.action:hover { border-color: #aab4a6; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.wide { grid-column: 1/-1; }
.field-group { min-width: 0; margin: 0; padding: 10px; border: 1px solid var(--line); border-radius: 13px; }
.field-group legend { font-size: .88rem; font-weight: 650; }
.field-group > .action { margin-top: 8px; }
.wheel-facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.wheel-facts > div { padding: 8px; }
.records { display: grid; gap: 8px; }
.record, .wheel-card {
  min-width: 0; background: var(--paper); border: 1px solid var(--line); border-radius: 13px; padding: 12px 14px;
}
.record { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.record:hover { background: #f9faf8; border-color: #b8c1b4; }
.record.compact { min-height: 62px; }
.record-label { display: flex; align-items: start; min-width: 0; gap: 12px; }
.record-label > div { min-width: 0; }
.record time, .shelf strong { color: var(--ink); font-weight: 750; font-variant-numeric: tabular-nums; white-space: nowrap; }
.record time { margin-top: 3px; border-right: 1px solid var(--line); padding-right: 10px; }
.slot-hours { flex: 0 0 54px; display: grid; gap: 1px; border-right: 1px solid var(--line); }
.slot-hours time { border: 0; padding: 0; }
.slot-hours span { color: var(--muted); font-size: .76rem; font-variant-numeric: tabular-nums; }
.record-ref { color: var(--muted); font-size: .77rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.record p, .wheel-card p { font-size: .8rem; margin-top: 4px; }
.status { align-self: center; max-width: 12rem; padding: 5px 8px; border-radius: 6px; font-size: .75rem; line-height: 1.25; font-weight: 660; text-align: center; }
.status-planned { background: #ecf0f3; color: #364550; }
.status-active { background: #e9f0b8; color: #3e480d; }
.status-pickup { background: #e8e8f7; color: #473c77; }
.status-done { background: #e1f0e6; color: #235537; }
.chevron { color: var(--muted); font-size: 1.4rem; line-height: 1; }
.wheel-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; }
.wheel-card details { grid-column: 1/-1; border-top: 1px solid var(--line); }
.wheel-card summary { cursor: pointer; padding-block: 11px 2px; font-size: .86rem; font-weight: 620; }
.wheel-card details[open] p { margin-top: 8px; }
.shelf { display: grid; gap: 1px; text-align: right; }
.shelf span, dt { color: var(--muted); font-size: .77rem; }
.facts, .depths { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.facts > div { padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--paper); }
.depths { margin-top: 10px; }
dd { font-weight: 650; }
.empty { padding: 14px; border: 1px dashed #bdc7b9; border-radius: 10px; color: var(--muted); }
form { display: grid; justify-items: stretch; gap: 16px; max-width: 680px; }
form .field { padding: 13px 15px; border: 1px solid var(--line); border-radius: 13px; background: var(--paper); }
.checks { min-width: 0; margin: 0; padding: 4px 15px; border: 1px solid var(--line); border-radius: 13px; background: var(--paper); }
.checks legend { padding-inline: 5px; font-size: .86rem; font-weight: 650; }
.checks label { display: flex; min-height: 47px; align-items: center; gap: 11px; }
.checks label + label { border-top: 1px solid var(--line); }
.checks input { width: 19px; height: 19px; margin: 0; flex: none; accent-color: #728000; }
.primary { min-height: 48px; padding: 8px 12px; border: 1px solid #c3cb30; border-radius: 10px; background: var(--lime); color: var(--dark); font-weight: 720; cursor: pointer; }
.primary:disabled { background: #e7eae4; border-color: var(--line); color: #59635b; cursor: default; }
#form-feedback { color: #306045; }
#form-feedback.error { color: #802f21; }
#connection { position: fixed; bottom: 12px; right: 12px; left: 12px; max-width: max-content; margin-inline: auto; padding: 9px 12px; border-radius: 8px; background: var(--dark); color: white; font-size: .84rem; }
@media (max-width: 580px) {
  .layout { padding-inline: max(12px, env(safe-area-inset-left, 0px)) max(12px, env(safe-area-inset-right, 0px)); padding-top: 13px; }
  .topbar-inner { min-height: 64px; padding-inline: 13px; }
  .brand img { height: 36px; width: 36px; }
  nav { position: sticky; top: 0; z-index: 2; }
  main { gap: 14px; margin-top: 18px; }
  .record { display: grid; gap: 7px; padding: 11px; }
  .record.compact { display: flex; }
  .record:not(.compact) .status { justify-self: start; }
  .record:has(.slot-hours) .status { margin-inline-start: 66px; }
  .photo-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .photo-actions button { justify-content: center; padding-inline: 5px; font-size: .85rem; }
}
@media (max-width: 350px) {
  .preview-label { font-size: .68rem; }
  nav a { font-size: .8rem; }
  .field-grid:not(.field-group .field-grid) { grid-template-columns: minmax(0, 1fr); }
}
