/* EarnLedger — design system.
   One spacing scale (4 / 8 / 12 / 16 / 24), one card treatment
   (white, 1px soft border, 20px radius, one soft shadow), one type
   scale, shared components only — every screen uses the same buttons,
   pills, rows, fields, segmented control, headings and captions. */
:root {
  --green: #0e7a3d;
  --green-dark: #0b3d24;
  --green-soft: #e3f2e7;
  --ink: #0b3d24;
  --muted: #68766b;
  --line: #e7e0d2;
  --card: #ffffff;
  --bg: #faf7f0;
  --amber: #8a6410;
  --amber-bg: #fdf0cd;
  --red: #a33327;
  --red-bg: #fbeae8;
  --radius-card: 20px;
  --radius-tile: 14px;
  --radius-btn: 14px;
  --radius-input: 12px;
  --shadow: 0 1px 2px rgba(11, 61, 36, .05), 0 10px 30px rgba(11, 61, 36, .05);
  /* iOS safe areas, named once and applied at every shell edge:
     the header clears the status bar (with room to spare), the tab
     bar and the sticky save bars sit above the home indicator, and
     page content always has enough bottom padding to scroll clear
     of the tab bar. Nothing renders behind the status bar. */
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--sat) + 16px); }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.45;
}

/* ---------- type scale ---------- */
h2 { font-size: 17px; font-weight: 700; margin: 0 0 12px; }
h3 { font-size: 16px; font-weight: 700; margin: 0 0 12px; }
.tab-title { font-size: 20px; font-weight: 700; margin: 16px 0 12px; }
.hint { color: var(--muted); font-size: 14px; margin: 8px 0; }
p[id$="-error"]:not(:empty) { color: var(--red); }
.eyebrow {
  font-size: 12px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--green);
}

/* ---------- header ---------- */
.topbar {
  padding: calc(18px + var(--sat)) 20px 6px; max-width: 560px; margin: 0 auto;
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
}
.brand { font-size: 19px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.brand-mark { width: 34px; height: 34px; flex: none; }
.tagline { color: var(--muted); margin-top: 2px; font-size: 14px; }
.avatar-btn {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  background: var(--green); color: #fff; border: none; cursor: pointer;
  font-size: 15px; font-weight: 700;
}
.avatar-btn:active { background: var(--green-dark); }

/* ---------- layout & cards ---------- */
main { max-width: 560px; margin: 0 auto; padding: 4px 16px calc(110px + var(--sab)); }
.tab { display: none; }
.tab.active { display: block; }
.panel, .card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-card); box-shadow: var(--shadow);
  padding: 14px 16px; margin-top: 12px;
}
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 4px; }
.panel-head h2 { margin: 0; }
.empty-note {
  background: var(--green-soft); border-radius: var(--radius-tile);
  padding: 16px; text-align: center; margin: 12px 0;
}
.empty-note p { margin: 0 0 12px; }

/* ---------- buttons (shared) ---------- */
.big-btn {
  display: block; width: 100%;
  background: var(--green); color: #fff; border: none;
  font-size: 18px; font-weight: 700;
  padding: 14px 16px; border-radius: var(--radius-btn);
  margin: 12px 0 16px; cursor: pointer; min-height: 52px;
}
.big-btn:active { background: var(--green-dark); }
.big-btn.warn { background: var(--card); color: var(--amber); border: 2px solid var(--amber); }
/* The hidden attribute must always win — several components set their
   own display (flex/inline-flex), which otherwise overrides it. */
[hidden] { display: none !important; }
.soft-btn {
  background: var(--card); color: var(--green-dark);
  border: 1.5px solid var(--green); border-radius: var(--radius-btn);
  font-size: 15px; font-weight: 600;
  padding: 12px 16px; cursor: pointer; min-height: 48px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.soft-btn.primary { background: var(--green); color: #fff; }
.soft-btn:active { opacity: .85; }
.mini-btn {
  background: var(--card); border: 1.5px solid var(--line); border-radius: 8px;
  font-size: 13.5px; font-weight: 600; padding: 8px 12px; cursor: pointer;
  min-height: 38px; color: var(--ink);
}
.mini-btn.go { border-color: var(--green); color: var(--green-dark); background: var(--green-soft); }
.mini-btn.danger { color: var(--red); }
.link-btn {
  background: none; border: none; color: var(--green); font: inherit;
  font-weight: 600; cursor: pointer; padding: 0; text-decoration: underline;
}
.link-btn.view-all { text-decoration: none; font-size: 15px; white-space: nowrap; }
.cust-toggle { display: inline-block; margin: 2px 0 6px; }
.cust-line { margin-top: 8px; overflow-wrap: break-word; }
.cust-line a { color: var(--green-dark); }
.danger-btn { color: var(--red); border-color: #efc4c0; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.file-btn { display: inline-flex; align-items: center; }

/* ---------- pills & badges (shared) ---------- */
.pill {
  display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 10px;
  border-radius: 999px; margin-left: 8px; vertical-align: 2px; white-space: nowrap;
}
.pill.owed { background: var(--amber-bg); color: var(--amber); }
.pill.approved { background: var(--green-soft); color: var(--green-dark); }
.pill.paid { background: var(--green); color: #fff; }
.badge {
  display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 8px;
  border-radius: 999px; background: var(--green-soft); color: var(--green-dark);
  margin-left: 8px; vertical-align: 2px; white-space: nowrap;
}
.badge.risk { background: var(--amber-bg); color: var(--amber); }
.badge.cb { background: var(--red-bg); color: var(--red); }
.icon-btn {
  background: none; border: none; color: var(--muted); cursor: pointer;
  font-size: 15px; padding: 8px; line-height: 1;
}

/* ---------- list rows (shared pattern) ---------- */
.breakdown-row, .entry-row, .rate-row, .check-line, .bd-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--line); gap: 12px;
}
.breakdown-row:last-child, .entry-row:last-child, .rate-row:last-child, .check-line:last-child, .bd-row:last-child { border-bottom: none; }
.bd-row > span:first-child { flex: 1; font-weight: 600; }
.bd-name, .e-name, .entry-name { font-weight: 600; }
.bd-meta, .e-meta, .entry-meta { color: var(--muted); font-size: 13.5px; }
.bd-value, .e-value { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.entry-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.entry { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-tile); padding: 12px 16px; margin-bottom: 12px; }
.entry .entry-main { flex-direction: row; justify-content: space-between; align-items: baseline; }
.entry-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.entry-actions button, .rate-actions button, .plan-actions button {
  background: var(--card); border: 1.5px solid var(--line); border-radius: 8px;
  font-size: 14px; font-weight: 600; padding: 8px 12px; cursor: pointer; min-height: 40px; color: var(--ink);
}
.entry-actions button.go { border-color: var(--green); color: var(--green-dark); }
.entry-actions button.danger, .rate-actions button.danger, .plan-actions button.danger { color: var(--red); }
.rate-actions, .plan-actions { display: flex; gap: 8px; }
.rate-row { align-items: center; }
.risk { font-size: 13.5px; margin-top: 4px; }
.risk.at-risk { color: var(--amber); font-weight: 600; }
.risk.safe { color: var(--muted); }
.risk.charged-back { color: var(--red); font-weight: 600; }
.inline-form { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 12px; }

/* ---------- fields (shared) ---------- */
.field { display: block; margin: 12px 0; }
.field > span, .field > .split-label { display: block; font-size: 14px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.field input, .field select, .money-input input {
  width: 100%; font-size: 17px; padding: 12px;
  border: 1.5px solid var(--line); border-radius: var(--radius-input);
  background: #fff; color: var(--ink); min-height: 50px;
}
.money-input { display: flex; align-items: center; gap: 8px; }
.money-input > span { font-size: 18px; font-weight: 700; color: var(--muted); }
.money-input input { flex: 1; width: auto; }
select { font: inherit; }
.stepper { display: flex; align-items: center; gap: 16px; }
.stepper button {
  width: 52px; height: 52px; border-radius: 50%;
  border: 2px solid var(--green); background: #fff; color: var(--green-dark);
  font-size: 26px; font-weight: 700; cursor: pointer; line-height: 1;
}
.stepper span { font-size: 22px; font-weight: 800; min-width: 30px; text-align: center; font-variant-numeric: tabular-nums; }
.flash {
  background: var(--green); color: #fff; text-align: center; font-weight: 700;
  padding: 12px; border-radius: var(--radius-input); margin: 12px 0;
}
.pw-wrap { display: block; position: relative; }
.pw-wrap input { width: 100%; padding-right: 52px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: none; font-size: 20px; padding: 8px 10px; cursor: pointer; color: var(--muted); line-height: 1; }
.pw-toggle.pw-shown { text-decoration: line-through; opacity: .55; }

/* ---------- segmented control (shared) ---------- */
.seg { display: flex; background: #efeade; border-radius: 999px; padding: 4px; gap: 4px; }
.seg button {
  flex: 1; border: none; background: transparent; padding: 8px 4px;
  border-radius: 999px; font-size: 14.5px; font-weight: 600;
  color: var(--muted); cursor: pointer; min-height: 36px;
}
.seg button.active { background: var(--green); color: #fff; }

/* ---------- HOME ---------- */
.greeting { font-size: 20px; font-weight: 700; margin: 10px 4px 0; }
.lead-card { border-radius: var(--radius-card); padding: 20px; }
.lead-eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--green); }
.lead-value { font-size: 44px; font-weight: 800; line-height: 1.1; margin-top: 8px; font-variant-numeric: tabular-nums; }
.lead-caption { color: var(--muted); font-size: 14px; margin-top: 4px; }
.lead-tiles { display: flex; gap: 12px; margin-top: 16px; }
.lead-tile { flex: 1; border-radius: var(--radius-tile); padding: 12px 16px; display: flex; flex-direction: column; gap: 4px; }
.lead-tile.paid-tile { background: var(--green-soft); }
.lead-tile.owed-tile { background: var(--amber-bg); }
.lead-tile-label { font-size: 13px; font-weight: 600; color: #5c6b5e; }
.lead-tile-value { font-size: 20px; font-weight: 800; color: var(--green-dark); font-variant-numeric: tabular-nums; }
.lead-foot { color: var(--muted); font-size: 13px; margin: 16px 0 0; }
.lead-empty { font-size: 16px; color: var(--muted); margin: 12px 0 4px; line-height: 1.5; }
.home-actions { display: flex; gap: 12px; margin-top: 12px; align-items: stretch; }
.home-actions[hidden] { display: none; }
.sales-seg { margin: 2px 0 14px; }
.log-mode-seg { margin: 2px 0 12px; }
.compose-label { font-size: 14px; font-weight: 600; color: var(--muted); margin: 2px 0 6px; }
#line-add[hidden] { display: none; }
.current-line { background: var(--green-tint); border-radius: 10px; padding-left: 8px; padding-right: 8px; }
.big-btn:disabled { opacity: .45; }
.check-compare { margin: 10px 0 2px; }
.home-actions .big-btn { flex: 1.5; margin: 0; }
.home-actions .soft-btn { flex: 1; font-size: 16px; border-radius: var(--radius-btn); min-height: 52px; }
.next-shift-panel { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; }
.next-shift-panel[hidden] { display: none; }
.next-shift-label { color: var(--muted); font-size: 14px; font-weight: 600; flex: none; }
.next-shift-value { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.next-shift-time { font-weight: 600; color: var(--muted); font-size: 14.5px; }
.recent-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.recent-row:last-child { border-bottom: none; }
.recent-ico {
  width: 40px; height: 40px; border-radius: 12px; flex: none;
  background: var(--green-soft); color: var(--green-dark);
  display: flex; align-items: center; justify-content: center;
}
.recent-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.recent-name { font-weight: 600; }
.recent-amt { color: var(--muted); font-size: 13.5px; font-variant-numeric: tabular-nums; }
.period-line { color: var(--muted); font-size: 13.5px; margin: 10px 4px 0; }
.earnings-hero { margin-top: 10px; }
.earnings-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.earnings-value { font-size: 36px; font-weight: 800; line-height: 1.15; font-variant-numeric: tabular-nums; }
.earnings-sub { color: var(--muted); font-size: 14px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.breakdown-toggle { margin-top: 10px; text-decoration: none; }
#window-totals { margin-top: 6px; }
.empty-state h2 { margin-bottom: 4px; }
.empty-actions { margin-top: 14px; }
.board-head {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  width: 100%; background: none; border: none; cursor: pointer;
  padding: 0; font: inherit; color: var(--ink); text-align: left;
}
.board-head-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.board-title { font-size: 17px; font-weight: 700; }
.board-snapshot { color: var(--muted); font-size: 14px; }
#board-panel .expander-chev { transition: transform .2s ease; }
#board-panel.open .expander-chev { transform: rotate(180deg); }
#board-list { margin-top: 8px; }

/* ---------- owed vs paid / paycheck tiles ---------- */
.split-row, .check-row, .hours-row { display: flex; gap: 12px; }
.split, .check-cell, .hours-cell {
  flex: 1; border-radius: var(--radius-tile); padding: 12px 16px;
  display: flex; flex-direction: column; gap: 4px; background: var(--green-soft);
}
.split.owed { background: var(--amber-bg); }
.split-label, .card-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.split-value, .card-value { font-size: 21px; font-weight: 800; font-variant-numeric: tabular-nums; }
.card-sub { font-size: 13px; color: var(--muted); }
.split-bar { height: 8px; background: var(--amber-bg); border-radius: 4px; overflow: hidden; margin: 12px 0; }
.split-bar > div { height: 100%; background: var(--green); width: 0%; transition: width .3s; }
#mark-period-paid { width: 100%; }
.diff-line { font-weight: 700; margin-top: 12px; padding: 12px 16px; border-radius: var(--radius-tile); background: var(--green-soft); color: var(--green-dark); }
.diff-line.diff-under { background: var(--red-bg); color: var(--red); }

/* ---------- SALES (log) ---------- */
.type-pick { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.sale-card .type-pick { margin-bottom: 8px; }
.compose-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin: 8px 0 12px; }
.compose-math { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; min-width: 0; overflow-wrap: break-word; }
/* Sticky save bar: pinned directly above the fixed tab bar (58px +
   safe-area), always visible while composing a sale. It lives inside
   the Log section, so it only renders while that tab is active. */
.save-bar {
  position: fixed; left: 0; right: 0; z-index: 9;
  bottom: calc(58px + var(--sab));
  background: #fff; border-top: 1px solid var(--line);
  box-shadow: 0 -8px 24px rgba(11, 61, 36, .08);
}
.save-bar-inner { max-width: 560px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 16px; }
.save-bar-total { display: flex; flex-direction: column; flex: none; }
.save-bar-label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.save-bar-value { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.save-bar .big-btn { margin: 0; flex: 1; min-height: 52px; }
#tab-log.composing { padding-bottom: calc(96px + var(--sab)); }
.type-option {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--card); border: 2px solid var(--line); border-radius: var(--radius-tile);
  padding: 12px 14px; font-size: 16px; font-weight: 600; cursor: pointer; min-height: 50px;
  width: 100%; text-align: left; color: var(--ink);
}
.type-option .t-amt { color: var(--green-dark); font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.t-comm { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.type-option.selected { border-color: var(--green); background: var(--green-soft); }
.sale-lines-list { margin-top: 8px; }
.sale-line {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; padding: 8px 0; border-top: 1px dashed var(--line);
}
.sale-line-right { display: inline-flex; align-items: center; gap: 8px; }
.line-actions { margin-top: 4px; padding-bottom: 8px; }
.sale-total { display: flex; justify-content: space-between; font-weight: 700; padding: 8px 0 4px; font-variant-numeric: tabular-nums; }

/* ---------- CLOCK ---------- */
.clock-panel { text-align: center; }
.clock-status { font-size: 19px; font-weight: 700; }
.clock-elapsed { color: var(--muted); font-size: 15px; margin: 4px 0 12px; min-height: 20px; }
.clock-team { color: var(--muted); font-size: 15px; font-weight: 600; margin: -4px 4px 0; }
.clock-team:empty { display: none; }
.clock-cue { color: var(--green-dark); font-weight: 600; font-size: 15px; margin-top: 12px; }
#shift-add { margin-top: 12px; }
.time-row { display: flex; gap: 12px; }
.time-row .field { flex: 1; }
/* Date/time controls: WebKit sizes the native control from its own
   format string + picker glyph and does not shrink it with the CSS
   box, so the generic min-width fix never reached these two control
   types — in a flex row they kept their native widths and crowded
   the middle, and the full-width date control painted past its card.
   Resetting the native appearance hands sizing back to the author
   width (tapping still opens the platform picker). */
.field input[type="date"], .field input[type="time"] {
  -webkit-appearance: none; appearance: none;
  display: block; width: 100%; min-width: 0; max-width: 100%;
}
/* On phone widths Start and End stack — they never compete for the
   same row, whatever the engine does with the controls. */
@media (max-width: 520px) {
  .time-row { flex-direction: column; gap: 0; }
  .time-row .field { flex: none; width: 100%; }
}
.overnight-tag {
  display: inline-block; background: var(--amber-bg); color: var(--amber);
  font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px;
  margin-left: 8px; vertical-align: 2px; white-space: nowrap;
}
.overnight-tag[hidden] { display: none; }
.break-input { margin-top: 8px; }

/* ---------- SCHEDULE ---------- */
.week-nav { display: flex; align-items: center; gap: 8px; margin: 8px 0 12px; }
.week-nav .soft-btn { min-height: 40px; padding: 6px 13px; font-size: 19px; }
.week-label { flex: 1; text-align: center; font-weight: 700; }
.week-total { color: var(--green-dark); font-weight: 700; font-size: 14px; margin: 0 4px 4px; font-variant-numeric: tabular-nums; }
.week-total:empty { display: none; }
.week-strip { display: flex; gap: 6px; margin-bottom: 12px; }
.strip-day {
  flex: 1; min-width: 0; background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 8px 2px 6px; cursor: pointer; font: inherit; color: var(--ink);
  display: flex; flex-direction: column; align-items: center; gap: 1px;
}
.strip-day.today .strip-num { color: var(--green); }
.strip-day.selected { border-color: var(--green); background: var(--green-soft); }
.strip-dow { font-size: 11px; font-weight: 700; color: var(--muted); }
.strip-num { font-size: 16px; font-weight: 800; line-height: 1.2; }
.strip-dot { width: 5px; height: 5px; border-radius: 50%; background: transparent; }
.strip-dot.on { background: var(--green); }
.strip-hrs { font-size: 11px; font-weight: 700; color: var(--green-dark); min-height: 14px; font-variant-numeric: tabular-nums; }
.sched-seg { margin: 2px 0 10px; }
.sched-seg[hidden] { display: none; }
.sched-view-seg { margin: 0 0 10px; }
/* Pay-period view: the strip wraps into whole-week rows of seven. */
.week-strip.rows { flex-wrap: wrap; }
.week-strip.rows .strip-day { flex: 1 1 calc((100% - 36px) / 7); }
.week-strip[hidden] { display: none; }
/* Month view: a calendar grid in the same card language as the strip. */
.month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin-bottom: 12px; }
.month-grid[hidden] { display: none; }
.month-dow { text-align: center; font-size: 11px; font-weight: 700; color: var(--muted); padding: 2px 0; }
.month-grid .strip-day { border-radius: 10px; padding: 6px 1px 5px; }
.month-grid .strip-dow { display: none; }
.month-grid .strip-num { font-size: 14px; }
/* Days drawn only to complete a month-grid week sit quieter. */
.strip-day.out-range { opacity: .45; }
.week-nav .today-btn { min-height: 44px; padding: 8px 12px; font-size: 14.5px; font-weight: 600; }
.small-btn { min-height: 38px; padding: 7px 12px; font-size: 14.5px; }
.shift-row-time { font-size: 16.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.strip-day.is-holiday { background: #fbf7ec; border-color: #eadfc2; }
.strip-day.is-holiday .strip-hrs { color: #9a6b14; }
.strip-none { color: var(--line); font-weight: 500; }
.strip-day.is-holiday.selected { background: #fbeed3; border-color: var(--green); }
.holiday-banner { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: #fdf3e0; border: 1px solid #e8cf9a; }
.holiday-label { font-weight: 700; color: #7a5510; }
.holiday-mark { margin-top: 12px; }
.shift-row-name { font-weight: 600; margin-top: 1px; }
.day-panel { margin-top: 0; }
.day-panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 4px; }
.day-panel-titles { min-width: 0; }
.day-panel-date { font-size: 17px; font-weight: 800; }
.day-panel-hours { color: var(--muted); font-size: 14px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.day-panel-head .soft-btn { flex: none; }
.shift-row { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.shift-row:last-child { border-bottom: none; }
.shift-row-main { flex: 1; min-width: 0; }
.shift-row-text { font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: break-word; }
.shift-row-sub { color: var(--muted); font-weight: 500; }
#day-actual .entry-meta { margin-top: 8px; }
.shift-menu-wrap { position: relative; flex: none; }
.shift-menu-btn { font-size: 20px; font-weight: 800; padding: 8px 10px; }
.shift-menu {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 20;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); min-width: 168px; padding: 4px;
}
.shift-menu button {
  display: block; width: 100%; text-align: left; background: none; border: none;
  padding: 10px 12px; font: inherit; font-size: 15px; font-weight: 600;
  color: var(--ink); cursor: pointer; border-radius: 8px; min-height: 44px;
}
.shift-menu button:active { background: var(--green-soft); }
.shift-menu button.danger { color: var(--red); }

/* ---------- sheets (bottom-sheet dialogs) ---------- */
.sheet-overlay {
  position: fixed; inset: 0; z-index: 30;
  background: rgba(11, 61, 36, .45);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet-overlay[hidden] { display: none; }
.sheet {
  background: var(--card); width: 100%; max-width: 560px;
  border-radius: 20px 20px 0 0; box-shadow: var(--shadow);
  padding: 20px 16px calc(16px + var(--sab));
  /* A tall sheet stops below the safe area instead of sliding
     under the status bar. */
  max-height: calc(94vh - var(--sat)); overflow-y: auto;
}
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.sheet-head h3 { margin: 0; }
.sheet .field input, .sheet .field select { min-width: 0; }
.confirm-sheet h3 { margin: 0; }
.confirm-body { color: var(--muted); font-size: 15px; margin: 8px 0 16px; }
.plan-paid-line { font-weight: 700; font-variant-numeric: tabular-nums; margin: 12px 0 4px; min-height: 22px; }

/* ---------- teams, board, auth ---------- */
.auth-panel { margin-top: 24px; }
.auth-brand { text-align: center; margin-bottom: 16px; }
.auth-brand .brand-mark { width: 64px; height: 64px; }
.auth-brand-name { font-size: 24px; font-weight: 800; margin-top: 8px; }
.auth-brand-tag { color: var(--muted); font-size: 14.5px; margin-top: 2px; }
.team-bar {
  display: flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  box-shadow: var(--shadow); padding: 4px 8px 4px 16px; margin: 8px 0 2px;
}
.team-bar .split-label { font-size: 14px; font-weight: 600; color: var(--muted); }
.team-bar select {
  flex: 1; border: none; background: transparent; font-size: 16px; font-weight: 600;
  color: var(--ink); padding: 8px 24px 8px 4px; min-height: 36px; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%230b3d24' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center;
}
.board-row { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.board-row:last-child { border-bottom: none; }
.board-main { flex: 1; min-width: 0; }
.dot { width: 12px; height: 12px; border-radius: 50%; margin-top: 5px; flex: none; }
.dot-in { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.dot-lunch { background: #e0a100; box-shadow: 0 0 0 3px #fbeecd; }
.dot-out { background: #c3ccc7; }
.dot-wait { background: #e5e9e6; border: 1px dashed #b9c4bd; }
.approve-line { color: var(--amber); font-weight: 600; }
.invite-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.invite-code { font-size: 20px; font-weight: 800; letter-spacing: 1px; background: var(--green-soft); padding: 8px 12px; border-radius: 8px; }
/* NFC tag link: a long URL, not a short code — smaller, wraps anywhere. */
.invite-code.tag-url { font-size: 13px; font-weight: 600; letter-spacing: 0; word-break: break-all; flex: 1 1 220px; }
.tag-line { font-size: 15px; margin: 10px 0 14px; }
.tag-sheet .big-btn { width: 100%; margin-top: 10px; }

/* ---------- chips ---------- */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 4px; }
.chip {
  background: var(--green-soft); color: var(--green-dark); border: none;
  border-radius: 999px; padding: 12px 16px; font-size: 15px; font-weight: 700;
  cursor: pointer; min-height: 46px;
}

/* ---------- more apps ---------- */
.more-apps { list-style: none; padding: 0; margin: 8px 0 0; }
.more-apps li { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; color: var(--muted); }
.more-apps li:last-child { border-bottom: none; }
.more-apps a { color: var(--green-dark); text-decoration: none; }
.more-apps strong { color: var(--ink); }

/* ---------- settings expanders ---------- */
.expander { padding: 0; overflow: hidden; }
.expander-head {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  width: 100%; background: none; border: none; cursor: pointer;
  padding: 13px 16px; font: inherit; color: var(--ink); text-align: left; min-height: 50px;
}
.expander-title { font-size: 17px; font-weight: 700; flex: none; }
.expander-summary { font-size: 13.5px; font-weight: 500; color: var(--muted);
  margin-right: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.expander-chev {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  background: var(--green-soft); color: var(--green-dark);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; transition: transform .2s ease;
}
.expander.open .expander-chev { transform: rotate(180deg); }
.expander-body { padding: 0 16px 14px; }
#tab-settings .field { margin: 9px 0; }
#tab-settings .field > span { margin-bottom: 6px; }
#tab-settings .field input, #tab-settings .field select { min-height: 46px; padding: 10px 12px; }
.danger-caption { color: var(--danger, #b3261e); }
.rate-menu-btn { font-size: 20px; line-height: 1; padding: 8px 12px; }
.expander-body > :first-child { margin-top: 0; }

/* ---------- tab bar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: #fff; border-top: 1px solid var(--line);
  display: flex; padding-bottom: var(--sab);
  z-index: 10;
}
.tabbar button {
  flex: 1; background: none; border: none; cursor: pointer;
  padding: 8px 0 10px; font-size: 12.5px; font-weight: 600; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 58px;
}
.tabbar button .tab-ico { font-size: 20px; line-height: 1.1; display: inline-flex; }
.tabbar button.active { color: var(--green-dark); }

/* ---------- manager member rates ---------- */
.member-rates { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 16px; }
.member-rates-title { margin-bottom: 4px; }

/* ---------- team panel (Settings → Team) ----------
   Scoped to the Team expander only: heading row with a quiet Edit
   button, hairline-divided sub-groups with small subheads, one-row
   input+button pairs, and one uniform button height. */
[data-expander="team"] .team-head { display: flex; align-items: center; gap: 4px; margin-bottom: 12px; }
[data-expander="team"] #team-name-title { margin: 0; font-size: 20px; font-weight: 800; }
[data-expander="team"] .team-edit-btn {
  background: none; border: none; cursor: pointer; font: inherit;
  font-size: 14.5px; font-weight: 600; color: var(--green);
  padding: 6px 8px; border-radius: 8px; line-height: 1;
}
[data-expander="team"] .team-edit-btn:active { opacity: .7; }
[data-expander="team"] #team-name-form { margin-bottom: 12px; }
[data-expander="team"] #team-name-form .field { margin-top: 0; }
[data-expander="team"] .team-group { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 16px; }
[data-expander="team"] .team-subhead {
  font-size: 12.5px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted); margin: 0 0 12px;
}
[data-expander="team"] #team-members > h3 {
  font-size: 12.5px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted);
  margin-top: 0 !important; margin-bottom: 0;
}
[data-expander="team"] .team-inline { display: flex; gap: 8px; align-items: flex-end; }
[data-expander="team"] .team-inline .field { flex: 1 1 auto; min-width: 0; margin: 0; }
[data-expander="team"] .team-inline .soft-btn { flex: none; }
[data-expander="team"] .soft-btn { min-height: 50px; }
[data-expander="team"] .invite-row { margin-bottom: 0; }
[data-expander="team"] .invite-code { min-height: 50px; display: inline-flex; align-items: center; }
[data-expander="team"] .team-leave-row { margin-top: 16px; }

/* ---------- mobile containment (iPhone width) ----------
   Real fixes first: flex children that hold inputs or long text get
   min-width: 0 so they can shrink inside their card instead of
   pushing past its edge; inputs are capped at 100% of their field.
   The overflow-x rule is only a backstop: `clip` (iOS 16+) is the
   stronger form — unlike `hidden` it never lets the root scroller
   acquire a horizontal scroll area at all, and no view in this app
   scrolls horizontally by design, so clipping costs nothing. */
html, body { overflow-x: hidden; overflow-x: clip; }
input, select, textarea, img { max-width: 100%; }
.field input, .field select { min-width: 0; }
.time-row .field { flex: 1 1 0; min-width: 0; }
.time-row input { min-width: 0; }
.money-input input { min-width: 0; }
.split, .check-cell, .hours-cell, .lead-tile { min-width: 0; }
.seg button { min-width: 0; }
.team-bar select { min-width: 0; }
.entry .entry-main > span:first-child { min-width: 0; overflow-wrap: break-word; }
.entry .entry-main > span:last-child { flex: none; }
.shift-row-text { min-width: 0; }
.recent-name { overflow-wrap: break-word; }
.board-row .mini-btn { flex: none; }
.entry-row .entry-actions { flex: none; }
.type-option > span:first-child { min-width: 0; overflow-wrap: break-word; }
.type-option .t-amt { flex: none; }

/* ---------- payouts & 1099 page ---------- */
.payout-back { margin: 4px 0 12px; font-size: 15px; }
.payout-summary-line { font-size: 15.5px; margin: 4px 0; }
.payout-summary-line.warn { color: var(--amber); font-weight: 600; }
#payouts-panel .soft-btn { margin-top: 10px; }
.how-payouts { margin: 4px 0 14px; }
.how-payouts summary { cursor: pointer; font-weight: 600; color: var(--green-dark); padding: 6px 0; }
.how-payouts ul { margin: 2px 0 6px; padding-left: 20px; color: var(--muted); font-size: 14.5px; }
.how-payouts li { margin: 6px 0; }
.contractor-row {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: none; border: none; border-bottom: 1px solid var(--line);
  padding: 12px 0; cursor: pointer; text-align: left; font: inherit; color: var(--ink);
}
.contractor-row .badge { margin-left: 0; flex: none; }
.contractor-name { flex: 1; font-weight: 600; min-width: 0; overflow-wrap: break-word; }
.contractor-meta { color: var(--muted); font-size: 13.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.contractor-actions { border-bottom: 1px solid var(--line); padding: 2px 0 8px; }
.contractor-actions .check-line { border-bottom: none; padding: 8px 0; }

/* ---------- quotes ---------- */
/* The sticky quote bar is taller than the sale bar (four totals +
   three actions), so a composing Quote tab reserves more room. */
#tab-quotes.composing { padding-bottom: calc(168px + var(--sab)); }
/* Visual tightening, scoped to the Quote tab only: headings and
   buttons ~15–20% smaller, tighter cards, smaller helper text. One
   strong green primary per section (Save in the bar, + Add on
   catalog rows, Save item in the editor); red appears only in the
   shared confirm sheet. */
#tab-quotes .tab-title { font-size: 17px; margin: 12px 0 10px; }
#tab-quotes h2 { font-size: 15px; margin-bottom: 10px; }
#tab-quotes h3 { font-size: 14px; }
#tab-quotes .panel, #tab-quotes .card { padding: 12px 14px; }
#tab-quotes .hint { font-size: 12.5px; }
#tab-quotes .soft-btn { min-height: 42px; padding: 9px 13px; font-size: 14px; }
#tab-quotes .small-btn { min-height: 36px; padding: 6px 11px; font-size: 13.5px; }
#tab-quotes .big-btn { font-size: 16px; min-height: 48px; padding: 11px 14px; }
#tab-quotes .field { margin: 9px 0; }
#tab-quotes .field > span { font-size: 13px; margin-bottom: 6px; }
#tab-quotes .field input, #tab-quotes .field select { min-height: 46px; padding: 10px 12px; font-size: 16px; }
.quote-seg { margin: 2px 0 4px; }
/* Collapsed add actions: four quiet buttons; each opens its sheet
   (or the catalog pick list) only when tapped. */
.quote-add-actions { display: flex; flex-direction: column; gap: 8px; }
.quote-add-actions .soft-btn { width: 100%; justify-content: flex-start; }
/* Builder catalog rows: name + price line take the width, one green
   + Add does the adding; manager actions hide behind the ⋯ menu.
   The main block must be free to shrink so the row never outgrows
   the card. */
.catalog-row {
  display: flex; gap: 8px; align-items: center;
  padding: 8px 0; border-bottom: 1px solid var(--line);
}
.catalog-row:last-child { border-bottom: none; }
.catalog-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.catalog-name { font-weight: 600; overflow-wrap: break-word; }
.catalog-price { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.catalog-row .soft-btn { flex: none; }
.catalog-row .shift-menu-wrap { flex: none; }
.quote-subhead { margin: 18px 0 4px; }
.quote-form-row { display: flex; gap: 10px; flex-wrap: wrap; }
.quote-form-row .field { flex: 1 1 110px; margin: 6px 0; }
.quote-line {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.quote-line:last-child { border-bottom: none; }
.quote-line-main { flex: 1 1 150px; min-width: 0; }
.quote-line-name { font-weight: 600; overflow-wrap: break-word; }
.quote-line-sub { font-size: 13px; color: var(--muted); }
.quote-line.waived .quote-line-name, .quote-line.waived .quote-line-amt { text-decoration: line-through; color: var(--muted); }
.quote-line-amt { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.quote-promo-amt { color: var(--green-dark); }
.quote-waive { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--muted); margin-top: 4px; cursor: pointer; }
.quote-waive input { width: 18px; height: 18px; accent-color: var(--green); }
.quote-stepper { gap: 10px; }
.quote-stepper button { width: 38px; height: 38px; font-size: 19px; }
.quote-stepper span { font-size: 17px; min-width: 22px; }
.quote-bd-row {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 4px 0; font-size: 14.5px; color: var(--muted); font-variant-numeric: tabular-nums;
}
.quote-card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.quote-card-name { font-weight: 700; font-size: 16.5px; overflow-wrap: break-word; }
.quote-card-date { color: var(--muted); font-size: 13.5px; white-space: nowrap; }
.quote-card-totals { display: flex; gap: 20px; flex-wrap: wrap; margin: 8px 0 10px; font-size: 15px; color: var(--muted); }
.quote-card-totals strong { color: var(--ink); font-variant-numeric: tabular-nums; }
/* Sticky quote summary: a 2×2 totals grid (pre-tax due today, the
   estimated tax inside it, total today, the monthly bill), then the
   actions. */
.quote-bar-inner { flex-direction: column; align-items: stretch; gap: 8px; }
.quote-bar-totals { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 18px; }
.quote-bar-total { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; min-width: 0; }
.quote-bar-total .save-bar-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quote-bar-value { font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.quote-bar-btns { display: flex; gap: 8px; align-items: center; }
.quote-bar-btns .big-btn { flex: 1; margin: 0; }
.quote-bar-btns .soft-btn { flex: none; }
/* Catalog manager: compact rows + the filter seg. */
.quote-mgr-seg { margin: 4px 0 8px; }
.mgr-row { padding: 8px 0; }
/* Review sheet: the customer's page, framed. */
.quote-review-frame {
  width: 100%; height: 52vh; border: 1px solid var(--line);
  border-radius: 12px; background: #fff; margin: 4px 0 12px;
}

/* ---------- iOS focus-zoom floor: NO form control under 16px ----------
   iOS (Safari and the WKWebView shell) auto-zooms the page when a
   focused input, select or textarea renders at under 16px — and the
   zoom stays after the field loses focus, leaving the app looking
   magnified with content running off the right edge (Ann, Nov 27
   2026, Quote → Catalog). This floor sits LAST in the sheet so it
   beats the UA defaults and every equal-specificity rule before it;
   the stronger rules that size controls (.field at 17px, the Quote
   tab and team-bar rules at exactly 16px) already sit at or above
   the floor and keep their look — max() only ever lifts a control
   that would otherwise compute smaller (a bare control, a select
   inheriting a small parent, the quote waive checkbox). */
input, select, textarea { font-size: max(16px, 1em); }
