:root {
  /* Optimum brand: charcoal #2c2c2c, teal #61bfc1, orange #e06e38 */
  --bg: #f4f6f6; --panel: #ffffff; --text: #1f2324; --muted: #5d6768; --line: #dde3e3;
  --brand: #1b7f85; --brand-ink: #ffffff; --accent: #2a9ca2; --warn: #c9561f; --danger: #b42318;
  --chip: #e9f3f3; --proposed: #e3f4f4; --radius: 10px;
  --header: #2c2c2c; --header-ink: #ffffff; --orange: #e06e38; --teal: #61bfc1;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1d1f20; --panel: #2a2c2d; --text: #eef1f1; --muted: #a3acad; --line: #3a3e3f;
    --brand: #61bfc1; --brand-ink: #142021; --accent: #61bfc1; --warn: #ef8a55; --danger: #ff7b72;
    --chip: #343839; --proposed: #23393a; --header: #232323;
  }
}
:root[data-theme="dark"] {
  --bg: #1d1f20; --panel: #2a2c2d; --text: #eef1f1; --muted: #a3acad; --line: #3a3e3f;
  --brand: #61bfc1; --brand-ink: #142021; --accent: #61bfc1; --warn: #ef8a55; --danger: #ff7b72;
  --chip: #343839; --proposed: #23393a; --header: #232323; color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }
* { box-sizing: border-box; }
body { margin: 0; font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
.top { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; padding: 8px 16px; background: var(--header); color: var(--header-ink); border-bottom: 3px solid var(--orange); }
.brand { display: flex; align-items: center; gap: 10px; }
.brand img.mark { width: 34px; height: 34px; }
.brand img.word { height: 18px; }
.brand span { font-size: 12px; opacity: .75; letter-spacing: .5px; text-transform: uppercase; }
nav { display: flex; gap: 4px; flex-wrap: wrap; }
nav button { background: transparent; color: var(--header-ink); border: 0; padding: 7px 12px; border-radius: 8px; cursor: pointer; font: inherit; opacity: .85; }
nav button.on, nav button:hover { background: rgba(255,255,255,.12); opacity: 1; }
nav button.on { box-shadow: inset 0 -2px 0 var(--orange); }
#who { font-size: 14px; display: flex; gap: 8px; align-items: center; }
#who button { font-size: 13px; }
main { max-width: 1200px; margin: 0 auto; padding: 16px; }
h2 { margin: 6px 0 12px; font-size: 22px; }
h3 { margin: 16px 0 8px; font-size: 18px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 4px; }
input, select, textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--text); font: inherit; }
textarea { min-height: 70px; font-family: inherit; font-size: 15px; }
input[type=checkbox] { width: auto; }
.checks { display: flex; flex-wrap: wrap; gap: 12px; }
.checks label { display: flex; gap: 6px; align-items: center; color: var(--text); font-size: 15px; margin: 0; }
button { cursor: pointer; font: inherit; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--text); padding: 7px 12px; }
button.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
button.good { background: var(--accent); color: #fff; border-color: var(--accent); }
button.danger { color: var(--danger); }
button:disabled { opacity: .5; cursor: default; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.chip { display: inline-block; background: var(--chip); border-radius: 999px; padding: 2px 9px; font-size: 13px; margin-right: 4px; }
.chip.proposed { background: var(--proposed); }
.chip.hold { color: var(--warn); }
.chip.approved { color: var(--accent); }
.suggest { border: 1px solid var(--line); border-radius: 8px; margin-top: 4px; overflow: hidden; }
.suggest button { display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; }
.verified { color: var(--accent); font-weight: 600; }
.error { color: var(--danger); }
.job { border-top: 1px solid var(--line); padding: 12px 0; }
.job:first-child { border-top: 0; }
.options { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.reasons { margin: 6px 0 0 18px; padding: 0; font-size: 14px; color: var(--muted); }
.cal { width: 100%; border-collapse: collapse; table-layout: fixed; }
.cal th, .cal td { border: 1px solid var(--line); vertical-align: top; padding: 7px; font-size: 14px; }
.cal th { background: var(--chip); }
.stop { padding: 3px 0; border-bottom: 1px dashed var(--line); }
.stop.prop { background: var(--proposed); }
.total { font-weight: 600; margin-top: 4px; }
.total.low { color: var(--warn); }
.scroll { overflow-x: auto; }
#toast { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 8px; display: none; max-width: 90vw; }
@media (max-width: 640px) { main { padding: 12px; } .top { padding: 10px 12px; } }

/* Week board */
.sumrow { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 12px; }
.sum { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 12px; min-width: 96px; }
.sum span { display: block; font-size: 12px; color: var(--muted); }
.sum b { font-size: 16px; }
.cellhead { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-bottom: 4px; }
select.techs { width: auto; padding: 2px 6px; font-size: 12px; border-radius: 999px; background: var(--chip); border-color: transparent; }
td.off { background: var(--bg); }
.cap { position: relative; height: 6px; background: var(--chip); border-radius: 3px; overflow: hidden; display: flex; margin: 2px 0 6px; }
.cap-b { background: var(--accent); }
.cap-p { background: var(--brand); opacity: .35; }
.cap i { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--warn); }
.warn { color: var(--warn); }
.cal td.wk, .cal tr.daytot td, .cal tr.daytot th { background: var(--chip); }
.estimate { margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: var(--chip); font-size: 13px; }
.estimate.big { border-left: 3px solid var(--warn); }
@media (max-width: 700px) { .cal { min-width: 760px; } }

/* Techs & rosters */
.crewbtn { display: inline-flex; gap: 3px; flex-wrap: wrap; padding: 2px 4px; border-radius: 999px; background: transparent; border: 1px dashed var(--line); }
.tchip { display: inline-block; min-width: 24px; text-align: center; font-size: 12px; font-weight: 700; padding: 2px 5px; border-radius: 999px; background: var(--chip); }
.tchip.r-lead, .tchip.r-seasoned { background: var(--brand); color: var(--brand-ink); }
.tchip.r-trainee { border: 1px dashed var(--warn); color: var(--warn); }
.tchip.train { background: var(--warn); color: #fff; }
.techrow { gap: 6px; margin-bottom: 6px; flex-wrap: wrap; }
.techrow select, .techrow input { width: auto; }
.checks.col { display: flex; flex-direction: column; gap: 6px; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal-card { max-width: 460px; width: 100%; max-height: 85vh; overflow: auto; margin: 0; }
/* 12-week outlook */
.outlook { margin: 4px 0 10px; }
.weeks { display: grid; grid-template-columns: repeat(12, minmax(44px, 1fr)); gap: 4px; overflow-x: auto; }
.wkcell { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 2px; }
.wkcell.on { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.vbar { width: 10px; height: 34px; background: var(--chip); border-radius: 3px; display: flex; align-items: flex-end; overflow: hidden; }
.vbar i { display: block; width: 100%; background: var(--accent); }

/* Login */
.login-logo { background: var(--header); border-radius: var(--radius) var(--radius) 0 0; margin: -16px -16px 16px; padding: 22px 16px; text-align: center; border-bottom: 3px solid var(--orange); }
.login-logo img { max-width: 260px; width: 80%; }
@media (max-width: 640px) { .brand img.word { display: none; } }

/* Weekends */
.cal th.wkend, .cal td.wkend { width: 92px; background: var(--bg); }
select.openday { width: auto; margin-top: 4px; padding: 1px 4px; font-size: 11px; }
.stop.rep { border-left: 3px solid var(--orange); padding-left: 4px; }
.cal { min-width: 980px; }

/* Tech app */
a.btn { display: inline-block; text-decoration: none; padding: 7px 12px; border-radius: 8px; border: 1px solid var(--line); color: var(--text); background: var(--panel); }
a.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.receipt { display: flex; flex-direction: column; gap: 12px; max-width: 560px; }
.photo-btn { display: block; border: 2px dashed var(--accent); border-radius: var(--radius); padding: 22px; text-align: center; font-size: 17px; color: var(--text); cursor: pointer; }
.photo-btn input { display: none; }
#r-preview { max-width: 100%; max-height: 260px; object-fit: contain; border-radius: 8px; }
.seg { display: flex; gap: 0; }
.seg button { flex: 1; border-radius: 0; padding: 10px; }
.seg button:first-child { border-radius: 8px 0 0 8px; }
.seg button:last-child { border-radius: 0 8px 8px 0; }
.seg button.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
button.big { padding: 14px; font-size: 17px; }
.xrow { display: flex; gap: 12px; align-items: center; border-bottom: 1px solid var(--line); padding: 10px 0; flex-wrap: wrap; }
.thumb { font-size: 26px; text-decoration: none; }
.chip.approved { color: var(--accent); }
.chip.rejected { color: var(--danger); }
@media (max-width: 640px) { nav button { padding: 7px 8px; } .top { gap: 6px; } }

/* Onboarding */
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 6px; margin-top: 8px; }
.steps div { padding: 6px 10px; border-radius: 8px; background: var(--chip); }
.steps div.ok { color: var(--accent); font-weight: 600; }
.quizq { border-bottom: 1px solid var(--line); padding: 12px 0; display: flex; flex-direction: column; gap: 6px; }
.quizq .checks { margin: 0; }
code { background: var(--chip); padding: 2px 6px; border-radius: 6px; }

.cal tr.overdue td { background: rgba(224,110,56,.08); }

.stop.click { cursor: pointer; }
.stop.click:hover { background: var(--chip); }
.attention { border-left: 4px solid var(--orange); }
.wx { font-weight: 400; margin-top: 2px; }

/* Optimum orange count bubbles */
.badge { display: inline-block; min-width: 20px; padding: 1px 7px; border-radius: 999px; background: #e8742c; color: #fff; font-size: 12px; font-weight: 700; text-align: center; line-height: 18px; margin-left: 4px; }

@media print { #nav, header, #toast, .no-print, button, #pw-form ~ .panel { display: none !important; } #pw-sheet { border: 0; } canvas { border: 1px solid #999 !important; } }

/* ===== Dashboard, close-out badges, month grid, photos, playbook (Nov 12) ===== */
.cbadge { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 999px; }
.cbadge.ok { background: #e3efff; color: #1b5fb8; }
.cbadge.warn { background: #fdebe1; color: #b14a17; }
.on-view { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.dgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 14px; }
.dcard { text-align: left; padding: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.dcard .big { font-size: 26px; font-weight: 700; line-height: 1.2; }
.dcard.warn { border-left: 4px solid var(--orange); }
.dcols { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; margin-top: 8px; }
.tile { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 6px; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--text); font-size: 13px; text-align: center; }
.tile .ti { font-size: 26px; }
.tile:hover { border-color: var(--brand); }
.mgrid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin-bottom: 10px; }
.mh { font-size: 12px; color: var(--muted); text-align: center; }
.mcell { min-height: 92px; text-align: left; vertical-align: top; padding: 4px 6px; display: flex; flex-direction: column; gap: 2px; align-items: stretch; justify-content: flex-start; font-size: 13px; }
.mcell.dim { opacity: .45; }
.mcell.today { border: 2px solid var(--brand); }
.mnum { font-weight: 700; }
.mtag { font-size: 11px; border-radius: 6px; padding: 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mtag.ev { background: var(--chip); }
.mtag.hol { background: #fdebe1; color: #b14a17; }
@media (max-width: 600px) { .mcell { min-height: 64px; font-size: 11px; padding: 2px 3px; } .mtag { display: none; } }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.pcard { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; display: flex; flex-direction: column; gap: 4px; }
.pimg { aspect-ratio: 4 / 3; background: var(--chip); border-radius: 8px; overflow: hidden; }
.pimg img { width: 100%; height: 100%; object-fit: cover; display: block; }
details.pb summary { cursor: pointer; }
.pb-body h4 { margin: 12px 0 4px; }
.pb-body p { margin: 6px 0; }
.pb-t td, .pb-t th { padding: 4px 8px; font-size: 14px; }
ul.chk { list-style: none; padding-left: 4px; }
/* Desktop: menu down the left side like Jobber */
@media (min-width: 1100px) {
  body.wide { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
  body.wide .top { flex-direction: column; flex-wrap: nowrap; align-items: stretch; justify-content: flex-start; position: sticky; top: 0; height: 100vh; overflow-y: auto; border-bottom: 0; border-right: 3px solid var(--orange); padding: 14px 12px; gap: 14px; }
  body.wide nav { flex-direction: column; flex-wrap: nowrap; }
  body.wide nav button { text-align: left; width: 100%; }
  body.wide nav button.on { box-shadow: inset 3px 0 0 var(--orange); }
  body.wide #who { flex-direction: column; align-items: flex-start; }
  body.wide main { max-width: 1400px; margin: 0; padding: 20px 28px; width: 100%; }
}

/* Calendar check boxes (Select mode) */
.selmode .stop.click::before{content:'☐ ';font-weight:700}
.selmode .stop.click.sel{outline:2px solid #1f7a46;background:#e7f4ec}
.selmode .stop.click.sel::before{content:'☑ '}
