:root {
  --ink: #1F2933; --mute: #52606D; --line: #CBD2D9; --bg: #F4F5F7; --card: #FFFFFF;
  --accent: #FFB000; --accent-ink: #1F2933; --danger: #B3261E; --ok: #1E6B34; --focus: #0B5FFF;
  --tbd-bg: #F8D7DA; --tbd-ink: #7A1420; --pend-bg: #F8D7DA; --pend-ink: #7A1420;
  --conf-bg: #FFECB3; --conf-ink: #5C3D00; --done-bg: #D8ECD6; --done-ink: #1E5A1E;
  --prog-bg: #D6E6F8; --prog-ink: #14467F; --plan-bg: #E9ECEF; --plan-ink: #3E4C59;
  --tab-h: 72px; --radius: 14px; --tap: 56px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 18px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: var(--ink); background: var(--bg);
  padding-bottom: calc(var(--tab-h) + 96px + var(--safe-b)); overscroll-behavior-y: contain; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.skip { position: absolute; left: -999px; top: 0; background: #fff; padding: 12px; z-index: 99; }
.skip:focus { left: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* App bar */
.appbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px; background: var(--ink); color: #fff;
  padding: calc(env(safe-area-inset-top, 0px) + 8px) 10px 8px; min-height: 64px; }
.jobbtn { flex: 1; min-width: 0; display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; text-align: left; background: transparent;
  border: 2px solid #3E4C59; border-radius: 12px; color: #fff; padding: 4px 12px; min-height: var(--tap); }
.jobbtn-label { font-size: 13px; color: #CBD2D9; grid-column: 1; }
.jobbtn-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; grid-column: 1; }
.caret { grid-column: 2; grid-row: 1 / span 2; align-self: center; padding-left: 8px; }
.planbtn { min-height: var(--tap); min-width: 64px; border-radius: 12px; border: 2px solid var(--accent); background: transparent; color: var(--accent); font-weight: 700; padding: 0 12px; }
.planbtn.pro { background: var(--accent); color: var(--accent-ink); }

.banner { margin: 10px 12px 0; background: #FFF4D6; border: 2px solid #E0A500; border-radius: var(--radius); padding: 10px 12px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.banner p { margin: 0; flex: 1 1 180px; font-size: 16px; }

main { padding: 12px; max-width: 900px; margin: 0 auto; outline: none; }
h1.vh { font-size: 24px; margin: 4px 2px 10px; }
h2 { font-size: 20px; margin: 18px 2px 8px; }
.hint { color: var(--mute); font-size: 16px; margin: 4px 2px 12px; }

/* Toolbar */
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.seg { display: flex; flex-wrap: wrap; flex: 1 1 260px; background: #E4E7EB; border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { flex: 1 0 auto; min-height: 48px; border: 0; background: transparent; border-radius: 9px; font-weight: 600; padding: 0 10px; font-size: 16px; white-space: nowrap; }
.seg button[aria-pressed="true"] { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.btn { min-height: var(--tap); border-radius: 12px; border: 2px solid var(--ink); background: #fff; font-weight: 700; padding: 0 16px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; color: var(--ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.dark { background: var(--ink); color: #fff; }
.btn.danger { border-color: var(--danger); color: var(--danger); background: #fff; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.small { min-height: 48px; padding: 0 12px; font-size: 16px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > .btn { flex: 1 1 140px; }

/* Cards */
.list { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .list.two { grid-template-columns: 1fr 1fr; } }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); display: flex; align-items: stretch; overflow: hidden; }
.card .main { flex: 1; min-width: 0; text-align: left; background: transparent; border: 0; padding: 12px 14px; min-height: 72px; display: block; }
.card .t { font-weight: 700; display: block; overflow-wrap: anywhere; }
.card .s { color: var(--mute); font-size: 16px; display: block; overflow-wrap: anywhere; }
.card .d { display: block; margin-top: 2px; overflow-wrap: anywhere; }
.card.done .t, .card.done .d { text-decoration: line-through; color: var(--mute); }
.card .side { display: flex; align-items: center; padding: 8px; border-left: 1px solid var(--line); }
.check { width: 64px; height: 64px; border-radius: 14px; border: 3px solid var(--ink); background: #fff; font-size: 30px; font-weight: 800; line-height: 1; }
.check[aria-pressed="true"] { background: var(--ok); border-color: var(--ok); color: #fff; }
.thumbs { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.thumbs img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; }
.more-ph { width: 56px; height: 56px; border-radius: 8px; background: #E4E7EB; display: grid; place-items: center; font-weight: 700; font-size: 15px; }
.chip { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: 15px; font-weight: 700; border: 1px solid transparent; }
.st-TBD { background: var(--tbd-bg); color: var(--tbd-ink); } .st-Pending { background: var(--pend-bg); color: var(--pend-ink); }
.st-Confirm { background: var(--conf-bg); color: var(--conf-ink); } .st-Done { background: var(--done-bg); color: var(--done-ink); }
.st-Open { background: var(--conf-bg); color: var(--conf-ink); } .st-In-progress { background: var(--prog-bg); color: var(--prog-ink); }
.st-Planned { background: var(--plan-bg); color: var(--plan-ink); } .st-Delayed { background: var(--tbd-bg); color: var(--tbd-ink); }
.statusbtn { min-width: 108px; min-height: 64px; border-radius: 12px; border: 2px solid rgba(0,0,0,.15); font-weight: 800; font-size: 17px; }
.empty { background: var(--card); border: 2px dashed var(--line); border-radius: var(--radius); padding: 20px; text-align: center; color: var(--mute); }
.empty .btn { margin-top: 12px; }

/* Look-ahead */
.weekhead { display: flex; justify-content: space-between; align-items: baseline; margin: 16px 2px 6px; }
.weekhead h2 { margin: 0; }
.weekhead.now h2::after { content: " (this week)"; font-weight: 400; color: var(--mute); font-size: 16px; }
.strip { display: grid; grid-template-columns: repeat(6, 1fr); gap: 3px; margin-top: 8px; }
.strip span { height: 22px; border-radius: 4px; background: #EEF0F2; font-size: 12px; text-align: center; line-height: 22px; color: var(--mute); }
.strip span.on { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.strip span.on.Done { background: #78B478; } .strip span.on.Delayed { background: #DC5A5A; color: #fff; } .strip span.on.In-progress { background: #5A8CD2; color: #fff; }
.strip span.today { outline: 2px solid var(--ink); }

/* Log */
.todaybtn { width: 100%; min-height: 72px; font-size: 20px; margin-bottom: 12px; }

/* Bottom bar */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr); background: #fff; border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b); box-shadow: 0 -2px 8px rgba(0,0,0,.06); }
.tabs button { min-height: var(--tab-h); border: 0; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 13px; font-weight: 600; color: var(--mute); padding: 4px 2px; }
.tabs .ti { font-size: 24px; line-height: 1; }
.tabs button[aria-current="page"] { color: var(--ink); box-shadow: inset 0 4px 0 var(--accent); background: #FFF8E1; }
.fab { position: fixed; right: 14px; bottom: calc(var(--tab-h) + 14px + var(--safe-b)); z-index: 25; min-height: 64px; padding: 0 24px; border-radius: 32px; border: 0;
  background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: 20px; box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.fab span[aria-hidden] { font-size: 28px; line-height: 0; vertical-align: -3px; }

/* Sheet (forms) */
dialog { border: 0; padding: 0; color: var(--ink); }
dialog::backdrop { background: rgba(15, 20, 25, .55); }
.sheet { width: 100%; max-width: 640px; max-height: 100%; height: 100%; margin: 0 auto; border-radius: 0; background: var(--bg); }
@media (min-width: 700px) { .sheet { height: auto; max-height: 92vh; margin-top: 4vh; border-radius: 18px; } }
.sheet form { display: flex; flex-direction: column; height: 100%; max-height: inherit; }
.sheet .sh-head { display: flex; align-items: center; gap: 8px; padding: calc(env(safe-area-inset-top, 0px) + 8px) 10px 8px 16px; background: var(--ink); color: #fff; }
.sheet .sh-head h2 { flex: 1; margin: 0; font-size: 20px; }
.sheet .x { min-width: var(--tap); min-height: var(--tap); border-radius: 12px; border: 2px solid #52606D; background: transparent; color: #fff; font-size: 26px; line-height: 1; }
.sheet .sh-body { flex: 1; overflow-y: auto; padding: 14px 16px 24px; -webkit-overflow-scrolling: touch; }
.sheet .sh-foot { display: flex; gap: 10px; padding: 10px 16px calc(10px + var(--safe-b)); background: #fff; border-top: 1px solid var(--line); }
.sheet .sh-foot .btn { flex: 1; min-height: 60px; font-size: 19px; }
.sheet .sh-foot .btn.danger { flex: 0 0 auto; }
.field { margin-bottom: 14px; }
.field > label, .field > .lbl { display: block; font-weight: 700; margin-bottom: 6px; font-size: 17px; }
.field input[type=text], .field input[type=date], .field input[type=number], .field input[type=search], .field select, .field textarea {
  width: 100%; min-height: var(--tap); border: 2px solid #9AA5B1; border-radius: 12px; padding: 10px 12px; background: #fff; font-size: 18px; }
.field textarea { min-height: 110px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--focus); outline: none; box-shadow: 0 0 0 3px rgba(11,95,255,.25); }
.field .help { font-size: 15px; color: var(--mute); margin-top: 4px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.radios { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; border: 0; padding: 0; margin: 0; }
.radios legend { font-weight: 700; margin-bottom: 6px; font-size: 17px; padding: 0; }
.radios label { position: relative; }
.radios input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.radios span { display: flex; align-items: center; justify-content: center; min-height: var(--tap); border: 2px solid #9AA5B1; border-radius: 12px; background: #fff; font-weight: 700; text-align: center; padding: 4px 6px; }
.radios input:checked + span { border-color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.radios input:checked + span.st-plain { background: var(--accent); }
.radios input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.ph-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-bottom: 8px; }
.ph { position: relative; }
.ph img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; display: block; border: 1px solid var(--line); }
.ph .rm { position: absolute; top: 4px; right: 4px; width: 44px; height: 44px; border-radius: 22px; border: 2px solid #fff; background: rgba(179,38,30,.95); color: #fff; font-size: 20px; font-weight: 800; }
.filebtn { position: relative; overflow: hidden; }
.filebtn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.crew-row { display: grid; grid-template-columns: 1fr 92px 56px; gap: 8px; margin-bottom: 8px; align-items: end; }
.crew-row .rm2 { min-height: var(--tap); border-radius: 12px; border: 2px solid var(--danger); background: #fff; color: var(--danger); font-size: 22px; font-weight: 800; }
.crew-row input { width: 100%; min-height: var(--tap); border: 2px solid #9AA5B1; border-radius: 12px; padding: 8px 10px; background: #fff; }

/* Confirm */
.confirm { width: min(92vw, 460px); border-radius: 18px; padding: 20px; background: #fff; }
.confirm h2 { margin-top: 0; }
.confirm .row { margin-top: 16px; }
.viewer { width: 100vw; height: 100vh; max-width: 100vw; max-height: 100vh; background: #000; }
.viewer img { width: 100%; height: calc(100% - 76px); object-fit: contain; display: block; }
.viewer .btn { margin: 10px; width: calc(100% - 20px); }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tab-h) + 92px + var(--safe-b)); z-index: 60; background: var(--ink); color: #fff;
  border-radius: 14px; padding: 8px 8px 8px 16px; display: none; align-items: center; gap: 12px; max-width: calc(100vw - 24px); box-shadow: 0 4px 14px rgba(0,0,0,.3); }
.toast.show { display: flex; }
.toast .btn { min-height: 48px; background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* More */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 14px; }
.panel h2 { margin-top: 0; }
.panel p { margin: 6px 0 10px; }
.joblist { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 8px; }
.joblist li { display: flex; gap: 8px; align-items: stretch; }
.joblist .pick { flex: 1; text-align: left; min-height: 64px; border-radius: 12px; border: 2px solid var(--line); background: #fff; padding: 8px 12px; }
.joblist .pick[aria-current="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.joblist .pick small { display: block; color: var(--mute); font-size: 15px; }
.pricebox { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0; }
.pricebox div { border: 2px solid var(--line); border-radius: 12px; padding: 10px; text-align: center; }
.pricebox strong { display: block; font-size: 22px; }
.ok-text { color: var(--ok); font-weight: 700; } .bad-text { color: var(--danger); font-weight: 700; }
.welcome { text-align: center; padding: 24px 8px; }
.welcome img { width: 96px; height: 96px; border-radius: 22px; }
.welcome h1 { font-size: 28px; margin: 12px 0 6px; }
.welcome ul { text-align: left; max-width: 420px; margin: 14px auto; padding-left: 22px; }
.welcome .btn { width: 100%; max-width: 420px; margin: 6px auto; display: flex; min-height: 64px; font-size: 20px; }
.legal { font-size: 15px; color: var(--mute); }
@media (prefers-reduced-motion: no-preference) { .toast.show { animation: up .18s ease-out; } @keyframes up { from { transform: translate(-50%, 20px); opacity: 0; } } }

.confirm .statusbtn[aria-pressed="true"] { border: 4px solid var(--ink); }
.confirm .statusbtn[aria-pressed="true"]::before { content: "\2713  "; }
