/* Amiry Jobs: mobile first, big touch targets, brand orange + charcoal. */

:root {
  --orange: #ee5a17;
  --orange-dark: #c2410c;
  --orange-soft: #fdeee6;
  --charcoal: #1f1d1b;
  --bg: #f4f1ec;
  --surface: #ffffff;
  --line: #e6dfd4;
  --ink: #1c1a18;
  --muted: #6b645c;
  --good: #15803d;
  --due: #c2410c;
  --danger: #b91c1c;
  --radius: 14px;
  --tabbar-h: 64px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 16px/1.45 var(--font);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
body.no-scroll { overflow: hidden; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
p { margin: 0 0 .5em; }
button { font: inherit; color: inherit; }
/* iPhone: no double-tap zoom delay on buttons and links; keep form text at 16px so Safari doesn't zoom in */
a, button, input, select, textarea, label { touch-action: manipulation; }
input, select, textarea { font-size: 16px; }
.sheet-body { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }

/* PIN lock */
.pin-lock {
  position: fixed; inset: 0; z-index: 90; background: var(--charcoal); color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  padding: calc(env(safe-area-inset-top) + 20px) 24px calc(env(safe-area-inset-bottom) + 20px);
}
.pin-lock[hidden] { display: none !important; }
.pin-lock img { border-radius: 16px; }
#pin-title { font-size: 1.15rem; font-weight: 700; margin: 0; }
.pin-dots { display: flex; gap: 16px; }
.pin-dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid #fff; }
.pin-dots i.on { background: var(--orange); border-color: var(--orange); }
.pin-dots.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
.pin-msg { min-height: 1.3em; color: #fca5a5; margin: 0; font-weight: 600; }
.pin-pad { display: grid; grid-template-columns: repeat(3, 76px); gap: 14px; }
.pin-pad button {
  width: 76px; height: 76px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .1); color: #fff;
  font-size: 1.7rem; font-weight: 600; cursor: pointer;
}
.pin-pad button:active { background: var(--orange); }
.pin-pad button.small { font-size: .9rem; background: transparent; }
.pw-form { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 4px; }

/* Welcome + getting started */
.welcome { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 24px 6px; }
.welcome img { border-radius: 18px; }
.welcome h1 { font-size: 1.5rem; }
.choice {
  width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 4px; text-align: left; cursor: pointer;
  background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); padding: 16px 18px;
}
.choice b { font-size: 1.08rem; }
.choice small { color: var(--muted); }
.choice.main { border-color: var(--orange); box-shadow: 0 0 0 4px var(--orange-soft); }
.steps-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.steps-list li { display: flex; align-items: center; gap: 12px; background: var(--bg); border-radius: 12px; padding: 10px 12px; }
.steps-list li > div { flex: 1; display: flex; flex-direction: column; }
.steps-list small { color: var(--muted); }
.steps-list li.done { opacity: .6; }
.tick { color: var(--good); font-weight: 800; font-size: 1.2rem; }

/* Photos & videos */
.seg.three { grid-template-columns: repeat(3, 1fr); }
.seg-n { font-weight: 600; color: var(--muted); margin-left: 2px; }
.media-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
@media (min-width: 640px) { .media-grid { grid-template-columns: repeat(5, 1fr); } }
.thumb { position: relative; aspect-ratio: 1; border: 0; padding: 0; border-radius: 10px; overflow: hidden; background: #e7e1d8; cursor: pointer; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-ph { display: grid; place-items: center; height: 100%; color: var(--muted); font-weight: 700; font-size: .85rem; }
.play {
  position: absolute; inset: 0; margin: auto; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(0, 0, 0, .55); color: #fff; font-size: .9rem; padding-left: 3px;
}
.upload { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; font-size: .88rem; background: var(--bg); border-radius: 10px; padding: 8px 10px; }
.upload span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload small { color: var(--muted); font-weight: 700; }
.upload .bar { grid-column: span 2; }
.upload.failed small { color: var(--danger); }
.file-btn { position: relative; cursor: pointer; }
.file-btn input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; font-size: 0; }

.viewer { position: fixed; inset: 0; z-index: 70; background: #0d0c0b; color: #fff; display: grid; grid-template-rows: auto 1fr auto; }
.viewer[hidden] { display: none !important; }
.viewer-top { display: flex; align-items: center; gap: 8px; padding: calc(env(safe-area-inset-top) + 6px) 10px 6px; font-size: .9rem; color: #d6d0c7; }
.viewer-top .icon-btn { color: #fff; }
.viewer-stage { position: relative; min-height: 0; display: grid; place-items: center; }
.viewer-stage img, .viewer-stage video { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer-missing { color: #d6d0c7; }
.vnav {
  position: absolute; top: 50%; transform: translateY(-50%); width: 46px; height: 46px; border-radius: 50%; border: 0;
  background: rgba(255, 255, 255, .14); color: #fff; display: grid; place-items: center; cursor: pointer;
}
.vnav.prev { left: 10px; }
.vnav.next { right: 10px; }
.viewer-bar {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
  padding: 10px 10px calc(10px + env(safe-area-inset-bottom)); background: #171513;
}
.vbtn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 58px;
  border: 0; border-radius: 12px; background: rgba(255, 255, 255, .08); color: #fff; font-size: .78rem; font-weight: 700; cursor: pointer;
}
.vbtn.danger { color: #fca5a5; }
.vmove select { min-height: 30px; padding: 2px 6px; font-size: 16px; background: #2a2724; color: #fff; border-color: #3a3632; width: auto; }

/* "Install on iPhone" tip */
.install-tip { display: flex; gap: 12px; align-items: flex-start; background: #fff; border: 2px dashed var(--orange); border-radius: var(--radius); padding: 14px; }
.install-tip img { border-radius: 12px; flex: none; }
.install-tip ol { margin: 6px 0 0; padding-left: 18px; }
.install-tip li { margin-bottom: 3px; }
.share-ico { display: inline-block; width: 18px; height: 18px; vertical-align: -3px; color: #0a84ff; }
svg { width: 22px; height: 22px; flex: none; }
.muted { color: var(--muted); }
small { font-size: .82rem; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; border-radius: 6px; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: grid; grid-template-columns: 56px 1fr 56px; align-items: center;
  min-height: 56px; padding: env(safe-area-inset-top) 6px 0;
  background: var(--charcoal); color: #fff;
}
.topbar-title { font-size: 1.05rem; font-weight: 700; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-side { display: flex; }
.topbar-side.right { justify-content: flex-end; }
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px;
  border: 0; background: transparent; color: inherit; cursor: pointer;
}
.icon-btn:active { background: rgba(255, 255, 255, .12); }
.icon-btn.accent { background: var(--orange); color: #fff; }

.banner { padding: 8px 16px; font-size: .88rem; text-align: center; }
.banner.demo { background: #fff4d6; color: #7a5300; }
.banner.error { background: #fde2e2; color: var(--danger); }

/* ---------- Layout ---------- */
.view {
  max-width: 980px; margin: 0 auto;
  padding: 16px 14px calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 14px;
}
.view:focus { outline: none; }
.card {
  background: var(--surface); border-radius: var(--radius); padding: 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .05); border: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 10px;
}
.card-title { font-size: 1rem; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.sub-title { font-size: .9rem; color: var(--muted); margin-top: 6px; }
.section-title { font-size: .95rem; color: var(--muted); margin-top: 8px; }
.empty { color: var(--muted); font-size: .92rem; margin: 2px 0; }
.hint { color: var(--muted); font-size: .86rem; margin: 0; }
.notes { background: var(--bg); padding: 10px 12px; border-radius: 10px; margin: 4px 0 0; font-size: .95rem; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 18px; border-radius: 12px; border: 0;
  font-weight: 650; cursor: pointer; text-align: center;
}
.btn svg { width: 20px; height: 20px; }
.btn-primary { background: var(--orange); color: #fff; }
.btn-primary:active { background: var(--orange-dark); }
.btn-soft { background: var(--orange-soft); color: var(--orange-dark); align-self: flex-start; }
.btn-ghost-danger { background: transparent; color: var(--danger); border: 1.5px solid #f3c4c4; }
.btn-block { width: 100%; min-height: 54px; font-size: 1.02rem; }
.btn-small { min-height: 38px; padding: 0 14px; font-size: .9rem; }
.link-btn { background: none; border: 0; color: var(--orange-dark); font-weight: 600; padding: 8px; cursor: pointer; }

/* ---------- Today ---------- */
.hello h1 { font-size: 1.5rem; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px; display: flex; flex-direction: column; gap: 4px;
}
.stat span { font-size: .78rem; color: var(--muted); }
.stat strong { font-size: 1.35rem; }
.money-due { color: var(--due); }
.money-good { color: var(--good); }

.todo { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.todo-item {
  display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; background: var(--bg);
}
.todo-item .dot { width: 10px; height: 10px; border-radius: 50%; background: #94a3b8; flex: none; }
.tone-urgent .dot { background: var(--danger); }
.tone-warn .dot { background: #d97706; }
.tone-info .dot { background: #0284c7; }
.todo-text { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.todo-text small { color: var(--muted); }
.todo-item > svg, .site-row > svg, .row-btn > svg, .person > svg { color: #b6aea3; width: 18px; height: 18px; }

.site-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.site-row:first-of-type { border-top: 0; }
.site-row > span:nth-child(2) { flex: 1; display: flex; flex-direction: column; }
.site-bar { width: 6px; align-self: stretch; border-radius: 6px; background: var(--c); }
.crew-names { color: var(--orange-dark); font-weight: 600; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline a { display: flex; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); }
.timeline li:first-child a { border-top: 0; }
.timeline .when { width: 92px; flex: none; font-weight: 700; font-size: .88rem; color: var(--orange-dark); }
.timeline a > span:last-child { display: flex; flex-direction: column; }
.timeline small { color: var(--muted); }

/* ---------- Jobs ---------- */
.search {
  display: flex; align-items: center; gap: 8px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px; padding: 0 12px;
}
.search svg { color: var(--muted); width: 20px; }
.search input { flex: 1; border: 0; background: transparent; min-height: 48px; font: inherit; outline: none; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1px solid var(--line); background: var(--surface); border-radius: 999px;
  min-height: 38px; padding: 0 14px; font-weight: 600; font-size: .9rem; cursor: pointer;
}
.chip span { color: var(--muted); font-weight: 500; margin-left: 2px; }
.chip.on { background: var(--charcoal); color: #fff; border-color: var(--charcoal); }
.chip.on span { color: #d6cfc6; }
.job-list { display: flex; flex-direction: column; gap: 10px; }

/* Board / List switch */
.seg { display: grid; grid-template-columns: 1fr 1fr; background: #e9e3da; border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { border: 0; background: transparent; min-height: 40px; border-radius: 9px; font-weight: 700; cursor: pointer; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }

/* Board: one column per stage, swipe sideways */
.board-wrap { display: flex; flex-direction: column; gap: 8px; margin: 0 -14px; }
.board-wrap > .hint { padding: 0 14px; }
.board {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 78vw); gap: 10px;
  overflow-x: auto; padding: 2px 14px 10px; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch;
}
@media (min-width: 760px) { .board { grid-auto-columns: minmax(170px, 1fr); } }
/* On a computer the board may use the whole screen width, so all 7 stages fit */
.view.wide { max-width: 1680px; }
.view.wide > .search, .view.wide > .seg { max-width: 940px; width: 100%; align-self: center; }
.col { scroll-snap-align: start; background: #ebe5dc; border-radius: var(--radius); display: flex; flex-direction: column; min-height: 220px; border-top: 4px solid var(--c); }
.col-head { display: flex; align-items: baseline; gap: 8px; padding: 10px 12px 6px; }
.col-head b { font-size: .95rem; }
.col-count { background: var(--c); color: #fff; border-radius: 999px; padding: 1px 8px; font-size: .78rem; font-weight: 700; }
.col-head small { margin-left: auto; color: var(--muted); font-weight: 600; }
.col-body { display: flex; flex-direction: column; gap: 8px; padding: 4px 8px 10px; }
.col-empty { color: var(--muted); font-size: .85rem; text-align: center; padding: 16px 0; margin: 0; }
.bcard {
  background: var(--surface); border-radius: 12px; padding: 11px 12px; display: flex; flex-direction: column; gap: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .06); cursor: pointer; border: 1px solid transparent;
}
.bcard:focus-visible { outline: 3px solid var(--orange); }
.bcard.late { border-color: #f3c4c4; box-shadow: inset 4px 0 0 var(--danger); }
.bstatus { font-weight: 650; font-size: .9rem; }
.bmoney { color: var(--muted); }
.bnext {
  margin-top: 4px; align-self: stretch; border: 0; border-radius: 9px; background: var(--orange-soft); color: var(--orange-dark);
  font-weight: 700; font-size: .85rem; min-height: 38px; cursor: pointer; text-align: left; padding: 0 10px;
}
.bar { height: 6px; background: #ece6dd; border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--orange); border-radius: 99px; }
.bar.big { height: 12px; }
.paybox .bar i { background: var(--good); }

/* Stage steps on a job */
.stepper { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(7, 1fr); position: relative; }
.stepper li { position: relative; }
.stepper li::before { content: ""; position: absolute; top: 15px; left: -50%; width: 100%; height: 3px; background: var(--line); z-index: 0; }
.stepper li:first-child::before { display: none; }
.stepper li.done::before, .stepper li.now::before { background: var(--orange); }
.stepper button { position: relative; z-index: 1; width: 100%; background: none; border: 0; padding: 0; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.step-dot {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .85rem;
  background: var(--surface); border: 3px solid var(--line); color: var(--muted);
}
.stepper .done .step-dot { background: var(--orange); border-color: var(--orange); color: #fff; }
.stepper .now .step-dot { border-color: var(--orange); color: var(--orange-dark); box-shadow: 0 0 0 4px var(--orange-soft); }
.step-label { font-size: .66rem; font-weight: 700; color: var(--muted); text-align: center; line-height: 1.1; }
.stepper .now .step-label { color: var(--ink); }
.status-line { font-size: 1.08rem; font-weight: 700; margin: 4px 0 0; }
.btn-line { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn-line .btn-primary { flex: 1; min-width: 200px; }
.lost-note { display: flex; align-items: center; gap: 8px; background: #f1f0ee; border-radius: 10px; padding: 10px 12px; font-weight: 600; }
.lost-note span { flex: 1; }

/* Money on a job */
.paybox { display: flex; flex-direction: column; gap: 8px; background: var(--bg); border-radius: 12px; padding: 12px; }
.paybox-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.ledger { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.ledger li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 12px; border-top: 1px solid var(--line); }
.ledger li:first-child { border-top: 0; }
.ledger li > span, .ledger-btn > span { display: flex; flex-direction: column; }
.ledger small { color: var(--muted); }
.ledger em { font-style: normal; font-weight: 700; }
.ledger-head { background: var(--bg); font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.ledger-empty { color: var(--muted); font-size: .9rem; }
.ledger-total { background: var(--bg); font-weight: 800; }
.ledger li:has(.ledger-btn) { padding: 0; }
.ledger-btn { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 12px; background: none; border: 0; text-align: left; cursor: pointer; }
.profit-line { display: flex; justify-content: space-between; align-items: center; padding: 12px; border-radius: 12px; background: var(--charcoal); color: #fff; }
.profit-line span { display: flex; flex-direction: column; font-weight: 700; }
.profit-line small { color: #cfc8bf; font-weight: 500; }
.profit-line b { font-size: 1.3rem; }
.profit-line .money-good { color: #86efac; }
.profit-line .money-due { color: #fca5a5; }

.dates-line { display: flex; align-items: center; gap: 10px; margin: 0; background: var(--bg); border-radius: 10px; padding: 10px 12px; }
.dates-line svg { color: var(--orange); }
.dates-line span { display: flex; flex-direction: column; }
.dates-line small { color: var(--muted); }
.warn-text { color: var(--due); }
.alert.block { background: #fff1f0; }
.alert-help { color: #57534e; margin-top: 6px !important; }
.chip.small { min-height: 34px; padding: 0 12px; font-size: .85rem; margin: 4px 4px 0 0; }
.job-card {
  background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--c);
  border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 4px;
}
.job-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.job-mid { color: var(--muted); font-size: .9rem; }
.job-bot { display: flex; justify-content: space-between; gap: 10px; font-size: .88rem; }
.job-bot em { font-style: normal; font-weight: 700; }
.badge {
  flex: none; font-size: .74rem; font-weight: 700; padding: 4px 9px; border-radius: 999px;
  color: var(--c); background: color-mix(in srgb, var(--c) 13%, white); white-space: nowrap;
}

.job-head { border-top: 5px solid var(--c); }
.job-head h1 { font-size: 1.35rem; }
.stage-pick { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: .92rem; }
.stage-pick select { flex: 1; }
.actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(70px, 1fr)); gap: 8px; }
.act {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px;
  border-radius: 12px; background: var(--bg); border: 0; font-size: .8rem; font-weight: 600; cursor: pointer;
}
.act svg { color: var(--orange); width: 24px; height: 24px; }
.act.wa svg { color: #1f9d55; }

.kv { display: flex; justify-content: space-between; gap: 16px; padding: 7px 0; border-top: 1px solid var(--line); }
.kv:first-of-type { border-top: 0; }
.kv span { color: var(--muted); }
.kv b { text-align: right; font-weight: 600; }
.kv.total { border-top: 2px solid var(--line); font-size: 1.05rem; }

.money-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.money-grid > div { background: var(--bg); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; }
.money-grid span { color: var(--muted); font-size: .8rem; }
.money-grid b { font-size: 1.12rem; }
.money-grid .span2 { grid-column: span 2; }
.money-grid b.big { font-size: 1.6rem; }
@media (min-width: 640px) { .money-grid { grid-template-columns: repeat(3, 1fr); } .money-grid .span2 { grid-column: span 3; } }

.rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.row-btn, .row-static {
  width: 100%; display: flex; align-items: center; gap: 10px; text-align: left; cursor: pointer;
  background: var(--bg); border: 0; border-radius: 10px; padding: 10px 12px;
}
.row-static { cursor: default; }
.row-btn > span, .row-static > span { flex: 1; display: flex; flex-direction: column; }
.row-btn small, .row-static small { color: var(--muted); }
.crew-row { display: flex; gap: 6px; align-items: stretch; }
.crew-row .row-btn { flex: 1; }
.pill {
  flex: none; border: 1.5px solid var(--due); color: var(--due); background: #fff; border-radius: 10px;
  padding: 0 10px; font-size: .78rem; font-weight: 700; cursor: pointer; min-width: 72px;
}
.pill.paid { border-color: var(--good); color: #fff; background: var(--good); }
.pill-total { font-size: .9rem; color: var(--due); }

.alert {
  display: flex; gap: 10px; background: #fff1f0; border: 1px solid #f7c9c4; color: #7f1d1d;
  border-radius: 12px; padding: 10px 12px; font-size: .9rem;
}
.alert svg { color: var(--danger); }
.alert p { margin: 2px 0 0; }

.templates { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.template { display: flex; flex-direction: column; gap: 4px; padding: 12px; border-radius: 12px; background: var(--bg); border-left: 4px solid #1f9d55; }
.template small { color: var(--muted); }

/* ---------- Planner ---------- */
.week-nav { display: flex; align-items: center; gap: 8px; }
.week-nav b { flex: 1; text-align: center; }
.week-nav .icon-btn { background: var(--surface); border: 1px solid var(--line); }
.grid-wrap {
  overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  -webkit-overflow-scrolling: touch;
}
.grid { display: grid; grid-template-columns: 92px repeat(var(--days), minmax(46px, 1fr)); min-width: max-content; }
.grid > * { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); min-height: 52px; }
.corner, .who { position: sticky; left: 0; background: var(--surface); z-index: 2; }
.day-head { display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: .8rem; color: var(--muted); }
.day-head b { color: var(--ink); font-size: 1rem; }
.day-head.today { background: var(--orange); color: #fff; }
.day-head.today b { color: #fff; }
.who { display: flex; flex-direction: column; justify-content: center; padding: 4px 8px; line-height: 1.15; }
.who small { color: var(--muted); font-size: .7rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell { padding: 3px; display: flex; flex-direction: column; gap: 2px; }
.cell.weekend { background: repeating-linear-gradient(45deg, #faf8f5, #faf8f5 6px, #f1ede6 6px, #f1ede6 12px); }
.cell.today { box-shadow: inset 0 0 0 2px var(--orange); }
.cell.clash { background: #fde2e2; }
.blk {
  flex: 1; display: flex; align-items: center; justify-content: center; border-radius: 6px;
  background: var(--c); color: #fff; font-size: .68rem; font-weight: 700; padding: 2px;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis; min-height: 20px;
}
.off {
  flex: 1; display: grid; place-items: center; border-radius: 6px; background: #e7e5e4; color: #57534e;
  font-size: .72rem; font-weight: 700;
}
.free { flex: 1; border: 0; background: transparent; border-radius: 6px; cursor: pointer; }
.free:hover, .free:active { background: var(--orange-soft); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: .88rem; }
.legend a { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 4px; background: var(--c); }
.legend small { color: var(--muted); }

.need-row { display: grid; grid-template-columns: 1fr 76px; gap: 8px; margin-bottom: 8px; }
.slot { border: 1.5px solid var(--line); border-radius: 12px; padding: 12px; margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.slot.best { border-color: var(--orange); background: var(--orange-soft); }
.slot p { margin: 0; }

/* ---------- Team ---------- */
.person {
  display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 14px;
}
.avatar {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--charcoal); color: #fff; font-weight: 700;
}
.person-main { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.person-main small { color: var(--muted); }
.status { align-self: flex-start; font-size: .76rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.status.free { background: #dcfce7; color: #166534; }
.status.busy { background: var(--orange-soft); color: var(--orange-dark); }
.status.off { background: #e7e5e4; color: #44403c; }
.status.due { background: #fde2e2; color: var(--danger); }

/* ---------- Money table ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.table th, .table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th { color: var(--muted); font-weight: 600; font-size: .78rem; }
.table td a { color: var(--orange-dark); font-weight: 600; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; min-width: 0; }
.field-label { font-weight: 600; font-size: .88rem; display: block; margin-bottom: 6px; }
.field .field-label { margin-bottom: 0; }
.field small { color: var(--muted); }
input, select, textarea {
  font: inherit; color: var(--ink); width: 100%; min-height: 48px; padding: 10px 12px;
  border: 1.5px solid var(--line); border-radius: 10px; background: #fff;
}
textarea { min-height: 76px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px rgba(238, 90, 23, .18); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
@media (max-width: 420px) { .row3 { grid-template-columns: 1fr 1fr; } .row3 > :last-child { grid-column: span 2; } }
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; margin: 4px 0 12px; }
.check input { width: 22px; height: 22px; min-height: 0; accent-color: var(--orange); }
.check-inline { align-self: end; min-height: 48px; margin: 0 0 12px; }
.skill-picks { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.skill input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.skill span {
  display: inline-block; padding: 8px 12px; border-radius: 999px; border: 1.5px solid var(--line);
  font-size: .88rem; font-weight: 600; cursor: pointer;
}
.skill input:checked + span { background: var(--charcoal); border-color: var(--charcoal); color: #fff; }
.skill input:focus-visible + span { outline: 3px solid var(--orange); }

/* ---------- Bottom sheet ---------- */
.sheet-root { position: fixed; inset: 0; z-index: 50; display: none; }
.sheet-root.open { display: block; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(20, 18, 16, .5); }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 92vh; max-height: 92dvh; display: flex; flex-direction: column;
  background: var(--surface); border-radius: 18px 18px 0 0; animation: up .22s ease;
}
@keyframes up { from { transform: translateY(30px); opacity: .6; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } }
.sheet-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 10px 8px 18px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { font-size: 1.1rem; }
.sheet-body { padding: 16px 18px; overflow-y: auto; }
.sheet-foot {
  display: flex; justify-content: flex-end; gap: 10px; padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
}
.sheet-foot:empty { display: none; }
.sheet-foot .btn-primary { flex: 1; max-width: 260px; margin-left: auto; }
@media (min-width: 700px) {
  .sheet { left: 50%; top: 50%; bottom: auto; transform: translate(-50%, -50%); width: 560px; border-radius: 18px; max-height: 88vh; animation: none; }
  .sheet.wide { width: 720px; }
}

/* ---------- Tab bar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface); border-top: 1px solid var(--line);
}
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: .74rem; font-weight: 600; color: var(--muted); }
.tabbar a.active { color: var(--orange); }
.tabbar a.active svg { stroke-width: 2.4; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom)); z-index: 60;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: .2s ease;
  background: var(--charcoal); color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 600;
  max-width: calc(100% - 32px); box-shadow: 0 8px 24px rgba(0, 0, 0, .2); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; text-align: center; gap: 8px; }
.login img { border-radius: 18px; }
.login h1 { font-size: 1.6rem; }
.login-form { width: 100%; max-width: 360px; text-align: left; margin-top: 12px; }
.login-msg { min-height: 1.4em; color: var(--danger); text-align: center; margin-top: 8px; }

/* ---------- Bigger screens ---------- */
@media (min-width: 760px) {
  .view { padding-left: 24px; padding-right: 24px; }
  .stats { gap: 14px; }
  .stat strong { font-size: 1.6rem; }
}
