:root {
  --ink: #1f2933; --muted: #5f6c7b; --line: #d9dee5; --bg: #f4f5f7; --card: #fff;
  --accent: #d96f12; --accent-ink: #fff; --good: #1d7a46; --bad: #c0352b; --warn: #a66300;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
h1, h2, h3 { line-height: 1.2; margin: 0; }
h1 { font-size: 1.45rem; }
h2 { font-size: 1.05rem; margin-bottom: 10px; }
p { margin: 0; }
a { color: inherit; }
.top { position: sticky; top: 0; z-index: 5; background: var(--ink); color: #fff; padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top)); display: flex; align-items: center; gap: 10px; }
.brand { font-weight: 700; letter-spacing: .02em; }
.brand span { color: #f7a24d; }
.spacer { flex: 1; }
.who { color: #cbd2d9; font-size: .88rem; }
.nav { display: flex; gap: 4px; overflow-x: auto; background: #fff; border-bottom: 1px solid var(--line); padding: 6px 10px; position: sticky; top: 50px; z-index: 4; }
.nav button { background: none; color: var(--muted); border: 0; min-height: 40px; padding: 0 12px; font-weight: 600; white-space: nowrap; border-radius: 8px; }
.nav button.on { background: #fdeedd; color: #8a4708; }
.main { max-width: 860px; margin: 0 auto; padding: 14px; padding-bottom: calc(40px + env(safe-area-inset-bottom)); display: grid; gap: 14px; }
.main > * { min-width: 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.between { justify-content: space-between; }
.stack { display: grid; gap: 10px; }
.muted { color: var(--muted); font-size: .9rem; }
.num { font-variant-numeric: tabular-nums; }
.good { color: var(--good); } .bad { color: var(--bad); } .warn { color: var(--warn); }
button, .btn { font: inherit; font-weight: 600; min-height: 44px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.danger { color: var(--bad); border-color: #eec4c0; }
button.small { min-height: 36px; padding: 0 10px; font-size: .9rem; }
button:disabled { opacity: .55; cursor: default; }
.top button { background: transparent; color: #fff; border-color: #52606d; min-height: 36px; padding: 0 10px; font-size: .9rem; }
label { display: grid; gap: 4px; font-size: .9rem; font-weight: 600; min-width: 0; }
input, select, textarea { font: inherit; width: 100%; min-height: 44px; padding: 8px 10px; border: 1px solid #b7c0cc; border-radius: 10px; background: #fff; color: var(--ink); }
input[type=checkbox] { width: 22px; min-height: 22px; height: 22px; accent-color: var(--accent); }
textarea { min-height: 84px; resize: vertical; }
:focus-visible { outline: 3px solid #f7a24d; outline-offset: 1px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; min-height: 40px; }
.list { display: grid; gap: 8px; }
.job { display: block; width: 100%; text-align: left; min-height: 64px; padding: 12px; height: auto; font-weight: 400; }
.job strong { display: block; font-size: 1.02rem; overflow-wrap: anywhere; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; background: #e9edf2; font-size: .8rem; font-weight: 600; }
.chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); gap: 8px; }
.chips button { min-height: 58px; }
.timer { font-size: 1.7rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.running { border-left: 5px solid var(--good); }
.offline { background: #fff4d6; color: #6b4b00; padding: 8px 14px; font-weight: 600; font-size: .92rem; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(125px, 1fr)); gap: 10px; }
.kpi b { display: block; font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.lines { display: grid; gap: 6px; }
.line { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid #edf0f3; padding-bottom: 6px; }
.line:last-child { border-bottom: 0; }
.line > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.photos a { display: block; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: #e9edf2; }
.photos img { width: 100%; height: 100%; object-fit: cover; display: block; }
.upload { display: inline-flex; align-items: center; justify-content: center; }
.upload input { position: absolute; width: 1px; height: 1px; min-height: 0; padding: 0; opacity: 0; }
.upload:focus-within { outline: 3px solid #f7a24d; }
.center { min-height: 100dvh; display: grid; place-items: center; padding: 18px; }
.login { width: min(100%, 390px); }
#toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 20; max-width: min(92vw, 520px); padding: 12px 16px; border-radius: 10px; background: var(--ink); color: #fff; font-weight: 600; }
#toast.err { background: var(--bad); }
.pick { display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; height: auto; min-height: 52px; padding: 8px 2px; background: none; border: 0; border-bottom: 1px solid #edf0f3; border-radius: 0; text-align: left; font-weight: 400; }
.pick:last-child { border-bottom: 0; }
.pick > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.pick .end { text-align: right; white-space: nowrap; }
.nav .more { display: none; }
@media (max-width: 700px) {
  .nav { position: fixed; top: auto; bottom: 0; left: 0; right: 0; z-index: 6; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 2px; overflow: visible; padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); border-bottom: 0; }
  .nav button { min-height: 48px; padding: 0 2px; font-size: .84rem; }
  .nav .more { display: block; }
  .nav .extra { display: none; order: -1; grid-column: 1 / -1; text-align: left; padding: 0 14px; font-size: 1rem; }
  .nav.open .extra { display: block; }
  .nav ~ .main { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  body:has(.nav) #toast { bottom: calc(76px + env(safe-area-inset-bottom)); }
}
.times { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
input[type=datetime-local] { min-width: 0; max-width: 100%; }
.workers { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.worker { display: grid; gap: 8px; align-content: start; min-height: 120px; padding: 16px; }
.worker strong { font-size: 1.5rem; }
.plan-row { display: grid; grid-template-columns: minmax(0, 1fr); grid-auto-flow: column; grid-auto-columns: auto; gap: 8px; align-items: stretch; }
.plan-row > button:last-child { height: auto; }
.worker .badge { justify-self: start; }
.plan-row .job span { display: block; }
.plan-row > button:not(.job) { height: auto; }
.note { white-space: pre-wrap; overflow-wrap: anywhere; }
.cuts { overflow-x: auto; }
.cuts table { width: 100%; border-collapse: collapse; }
.cuts th, .cuts td { padding: 8px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.cuts th { color: var(--muted); font-size: .85rem; }
.cut-photo { display: block; max-width: 100%; max-height: 70vh; border-radius: 8px; }
a.btn { display: inline-flex; align-items: center; text-decoration: none; }
