:root {
  --bg: #F5F2EF; --card: #FFFFFF; --ink: #1C1917; --ink2: #3F3833; --muted: #655C55; --faint: #A89E95;
  --line: #E8E2DC; --line2: #F0EBE6; --field: #DCD4CC; --chip: #EFEAE5;
  --accent: #C2410C; --accent-d: #9A3412; --brand: #F97316; --tint: #FFEDE0; --tint2: #FFF7F0; --peach: #FDBA74;
  --ok: #1B6B43; --ok-bg: #E6F4EC; --bad: #A3262B; --bad-bg: #FDECEC; --bad-line: #E2B4B6; --warn: #B45309;
  --r: 16px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: 'Manrope', system-ui, -apple-system, sans-serif; font-size: 15px; }
body { padding-bottom: env(safe-area-inset-bottom); }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
h1 { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -.3px; }
h2 { margin: 0; font-size: 16px; font-weight: 800; }
.loading { padding: 40vh 0; text-align: center; color: var(--muted); }

.page { padding: 16px 16px 110px; display: flex; flex-direction: column; gap: 12px; max-width: 640px; margin: 0 auto; }
.row { display: flex; align-items: center; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.col { display: flex; flex-direction: column; gap: 8px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.sm { font-size: 13px; }
.b { font-weight: 700; } .xb { font-weight: 800; }
.red { color: var(--bad); } .green { color: var(--ok); } .orange { color: var(--accent); }
.grow { flex: 1; min-width: 0; }
.hidden { display: none !important; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.card.tight { padding: 4px 14px; gap: 0; }
.card.link { text-decoration: none; color: var(--ink); }
.dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.dark .muted { color: #D6CEC6; }
.dark .big { color: var(--peach); }
.big { font-size: 32px; font-weight: 800; letter-spacing: -.6px; }
.kv { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line2); }
.kv:last-child { border-bottom: 0; }
.kv > :first-child { width: 84px; flex-shrink: 0; font-size: 13px; color: var(--muted); }
.kv > :last-child { font-weight: 600; font-size: 14px; }
.line { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line2); font-size: 14px; }
.line:last-child { border-bottom: 0; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px; text-align: center; }
.stat b { display: block; font-size: 22px; font-weight: 800; }
.tile { background: var(--bg); border-radius: 12px; padding: 10px; }
.dark .tile { background: #2E2925; }
.tile .t { font-size: 11px; color: var(--muted); } .dark .tile .t { color: #D6CEC6; }
.tile .v { font-size: 15px; font-weight: 800; }

.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 9px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.tint { background: var(--tint); color: var(--accent-d); }
.chip.bad { background: var(--bad-bg); color: var(--bad); }
.chip.dark { background: var(--ink); color: var(--peach); font-size: 11px; font-weight: 800; }
.chip.brand { background: var(--brand); color: var(--ink); font-weight: 800; }
.chip.grey { background: var(--chip); color: var(--ink2); }

.btn { display: flex; align-items: center; justify-content: center; gap: 8px; height: 52px; border-radius: 14px; border: 0; background: var(--accent); color: #fff; font-weight: 700; font-size: 16px; text-decoration: none; width: 100%; }
.btn.sm { height: 40px; font-size: 13px; border-radius: 10px; width: auto; padding: 0 12px; }
.btn.xs { height: 34px; font-size: 12px; border-radius: 9px; width: auto; padding: 0 10px; }
.btn.ghost { background: var(--card); color: var(--ink); border: 1px solid var(--field); }
.btn.danger { background: var(--card); color: var(--bad); border: 1.5px solid var(--bad-line); }
.btn.solid-danger { background: var(--bad); color: #fff; }
.btn.dark { background: var(--ink); color: #fff; }
.btn.tint { background: var(--tint); color: var(--accent-d); }
.btn.grey { background: var(--line); color: var(--muted); }
.btn.ok { background: var(--ok); color: #fff; }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 3px; padding: 3px; border-radius: 12px; background: var(--chip); }
.seg button { height: 36px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-weight: 600; font-size: 13px; }
.seg button.on { background: #fff; color: var(--ink); font-weight: 800; }

label.f { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink2); }
.inp, select.inp, textarea.inp { height: 46px; padding: 0 12px; border: 1px solid var(--field); border-radius: 12px; background: #fff; font-size: 15px; font-weight: 500; color: var(--ink); width: 100%; min-width: 0; }
textarea.inp { height: 72px; padding: 10px 12px; resize: vertical; }
.inp:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
.inp[readonly] { background: var(--chip); color: var(--ink2); }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; line-height: 1.4; }
.check input { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); flex-shrink: 0; }
.toggle-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line2); font-size: 14px; font-weight: 600; }
.toggle-row:last-child { border-bottom: 0; }
.toggle-row input { width: 22px; height: 22px; accent-color: var(--accent); flex-shrink: 0; margin: 0; }
.hint { display: block; font-size: 12px; font-weight: 500; color: var(--muted); }

.option { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.option.on { border: 1.5px solid var(--accent); background: var(--tint2); }
.option input { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); flex-shrink: 0; }
.option.off { opacity: .5; }

.upload { min-height: 110px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; border: 1.5px dashed #C9A88E; border-radius: 14px; background: #fff; color: var(--accent); font-weight: 700; font-size: 13px; position: relative; overflow: hidden; text-align: center; padding: 8px; }
.upload input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.upload img, .upload video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.upload .cap { position: relative; background: #fff; border-radius: 8px; padding: 2px 8px; color: var(--ink); }
.upload.tall { min-height: 200px; }

.progress { height: 6px; border-radius: 3px; background: var(--chip); overflow: hidden; }
.progress > div { height: 100%; background: var(--brand); border-radius: 3px; }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-around; background: #fff; border-top: 1px solid var(--line); padding: 8px 0 calc(14px + env(safe-area-inset-bottom)); z-index: 20; }
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 64px; padding-top: 4px; text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 600; }
.tabbar a.on { color: var(--accent); font-weight: 700; }
.tabbar svg { width: 24px; height: 24px; }

.cal-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.day { height: 62px; border: 0; border-radius: 12px; background: transparent; color: var(--faint); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.day .wd { font-size: 11px; font-weight: 600; }
.day .n { font-size: 18px; font-weight: 700; }
.day .dot { width: 5px; height: 5px; border-radius: 3px; }
.day.busy { background: var(--tint); color: var(--ink); } .day.busy .wd { color: var(--muted); } .day.busy .dot { background: var(--accent); }
.day.sel { background: var(--accent); color: #fff; } .day.sel .dot { background: #fff; }
.day.today .n { text-decoration: underline; text-underline-offset: 3px; }
.icon-btn { width: 36px; height: 36px; border: 0; border-radius: 10px; background: var(--bg); display: flex; align-items: center; justify-content: center; }

.shift-card { display: flex; flex-direction: column; gap: 10px; padding: 14px; background: #fff; border: 1px solid var(--line); border-radius: 16px; text-decoration: none; color: var(--ink); }
.shift-card .title { font-size: 16px; font-weight: 800; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--ink2); }
.meta span { display: flex; align-items: center; gap: 6px; }
.note { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; background: var(--bg); font-size: 12px; font-weight: 600; color: var(--ink2); }
.banner { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1.5px solid var(--accent); border-radius: 14px; background: var(--tint2); }

.stars { display: flex; gap: 2px; }
.stars button { border: 0; background: none; padding: 2px; }
.stars svg { width: 24px; height: 24px; }
.att { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.att button { height: 36px; border-radius: 10px; border: 1px solid var(--field); background: #fff; font-size: 12px; font-weight: 600; color: var(--ink2); }
.att button.came { background: var(--ok); color: #fff; border-color: var(--ok); font-weight: 700; }
.att button.late { background: var(--warn); color: #fff; border-color: var(--warn); font-weight: 700; }
.att button.noshow { background: var(--bad); color: #fff; border-color: var(--bad); font-weight: 700; }

.pos-row { display: grid; grid-template-columns: minmax(0, 1fr) 70px; gap: 6px; }
.pos-pay { display: grid; grid-template-columns: minmax(0, 1fr) 110px; gap: 6px; align-items: center; }
.pos-block { display: flex; flex-direction: column; gap: 8px; padding-bottom: 10px; border-bottom: 1px solid var(--line2); }

.sheet-back { position: fixed; inset: 0; background: rgba(28, 25, 23, .55); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 640px; max-height: 92vh; overflow: auto; background: #fff; border-radius: 24px 24px 0 0; padding: 10px 20px calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--field); align-self: center; }
.sheet h2 { font-size: 21px; }

#toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; font-weight: 600; opacity: 0; transition: .2s; z-index: 60; max-width: 90vw; text-align: center; pointer-events: none; }
#toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
.empty { text-align: center; color: var(--muted); padding: 32px 12px; font-size: 14px; }
.media-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.media-grid img, .media-grid video { width: 100%; height: 200px; object-fit: cover; border-radius: 12px; background: var(--chip); }
.thumb { width: 100%; max-height: 360px; object-fit: contain; border-radius: 12px; background: var(--chip); }
.search { position: relative; }
