* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #f7f4f1;             /* warm ivory */
  --card: #ffffff;
  --ink: #2b2622;            /* warm near-black */
  --muted: #948b82;          /* warm grey */
  --line: #e8e1d9;           /* warm border */
  --primary: #b17a5e;        /* rose gold / copper (TF brand) */
  --primary-dark: #915f45;   /* deeper copper */
  --gold: #c9a184;           /* light rose gold accent */
  --taupe: #ada294;          /* brand banner taupe */
  --taupe-soft: #efeae3;     /* soft taupe fill */
  --green: #4f8163;
  --amber: #c07d33;
  --blue: #4a6d8c;
  --red: #b5514a;
  --zone-sharjah: #a3503f;   /* terracotta */
  --zone-dubai: #3a5c7a;     /* muted navy */
  --zone-ajman: #4a7c62;     /* muted green */
  --zone-others: #6d5480;    /* muted plum */
  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
}
html, body { height: 100%; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 15px;
}
.hidden { display: none !important; }

/* ---------- brand marks ---------- */
.tf-mono {
  font-family: "Century Gothic", "Futura", "Trebuchet MS", sans-serif;
  font-size: 40px; font-weight: 700; fill: var(--primary); letter-spacing: 1px;
}
.brand-wordmark {
  font-family: var(--serif); font-size: 26px; letter-spacing: .32em;
  text-transform: uppercase; color: var(--primary); margin: 14px 0 4px; font-weight: 600;
}
.brand-block { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name {
  font-family: var(--serif); font-size: 19px; font-weight: 700;
  letter-spacing: .18em; text-transform: uppercase; color: var(--primary-dark);
}
.brand-tag { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }

/* ---------- buttons ---------- */
.btn {
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  padding: 8px 14px; border-radius: 8px; cursor: pointer; font-size: 14px;
  transition: background .15s, border-color .15s;
  white-space: nowrap;
}
.btn:hover { background: #f0f1f3; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: transparent; }
.btn-danger { background: #fff1f1; border-color: #f3c1c1; color: var(--red); }
.btn-block { width: 100%; }

/* ---------- login ---------- */
.login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(155deg, #f3ece5 0%, #ece4dc 45%, #e4d8cd 100%);
}
.login-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 4px;
  padding: 44px 40px; width: 380px; max-width: 92vw; text-align: center;
  box-shadow: 0 18px 50px rgba(120, 90, 70, .16);
  position: relative;
}
.login-card::before {
  content: ""; position: absolute; inset: 8px; border: 1px solid var(--line);
  border-radius: 2px; pointer-events: none;
}
.login-logo { line-height: 0; }
.login-card h1 {
  font-family: var(--serif); font-size: 25px; font-weight: 600; margin: 2px 0 2px;
  letter-spacing: .06em; color: var(--ink);
}
.login-sub { color: var(--muted); margin-bottom: 26px; font-size: 13.5px; letter-spacing: .04em; }
.login-card input {
  width: 100%; padding: 12px 13px; margin-bottom: 12px;
  border: 1px solid var(--line); border-radius: 4px; font-size: 15px;
  background: #fdfbfa;
}
.login-card input:focus { outline: 2px solid var(--gold); border-color: var(--primary); }
.login-error { color: var(--red); margin-top: 12px; min-height: 20px; font-size: 14px; }
.build-stamp { margin-top: 14px; font-size: 11px; color: var(--muted); text-align: center; letter-spacing: .03em; }

/* ---------- topbar ---------- */
.topbar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 9px 18px; background: var(--card); border-bottom: 2px solid var(--gold);
  position: sticky; top: 0; z-index: 20;
}
.topbar-left { display: flex; align-items: center; gap: 11px; }
.logo { line-height: 0; }
.sync-badge { font-size: 12px; color: var(--muted); }
.sync-badge.ok::before { content: "● "; color: var(--green); }
.sync-badge.warn::before { content: "● "; color: var(--amber); }
.date-nav { display: flex; align-items: center; gap: 6px; }
.date-nav input[type=date] {
  padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 15px; font-weight: 600;
}
.topbar-right { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.user-chip {
  background: #f5ede6; color: var(--primary-dark); font-weight: 600;
  padding: 6px 12px; border-radius: 999px; font-size: 13px;
}

/* ---------- control bar (tabs + views) ---------- */
.controlbar {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 10px;
  padding: 10px 14px 0; background: var(--bg); flex-wrap: wrap;
}
.tabbar { display: flex; gap: 6px; }
.viewbar { display: flex; align-items: center; gap: 8px; padding-bottom: 6px; flex-wrap: wrap; }
.viewbar-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.view-group { display: inline-flex; background: var(--taupe-soft); border-radius: 10px; padding: 3px; gap: 2px; }
.view-btn {
  border: 1px solid var(--line); background: var(--card); color: var(--muted);
  padding: 7px 14px; border-radius: 8px; cursor: pointer; font-size: 13.5px; font-weight: 600; font-family: inherit;
}
.view-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.view-group .view-btn { border: 0; background: none; padding: 6px 12px; border-radius: 7px; }
.view-group .view-btn:hover { color: var(--ink); }
.view-group .view-btn.active { background: var(--card); color: var(--primary-dark); box-shadow: 0 1px 2px rgba(0,0,0,.07); }
.view-month { border-radius: 10px; }
.tab {
  border: 1px solid var(--line); border-bottom: none; background: var(--taupe-soft);
  padding: 9px 18px; border-radius: 8px 8px 0 0; cursor: pointer;
  font-size: 15px; font-weight: 600; color: var(--muted);
  display: flex; align-items: center; gap: 8px;
}
.tab:hover { background: #e7ded4; }
.tab.active { background: var(--card); color: var(--ink); border-color: var(--line); border-top: 2px solid var(--primary); box-shadow: 0 -2px 6px rgba(120,90,70,.05); }
.tab-hint { font-weight: 400; font-size: 12px; color: var(--muted); }
.tab-count { background: var(--primary); color: #fff; font-size: 12px; font-weight: 700; border-radius: 999px; padding: 1px 9px; min-width: 22px; text-align: center; }
.tab:not(.active) .tab-count { background: var(--taupe); }

/* ---------- driver chips (admin) ---------- */
.drivers-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.driver-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: #f5ede6; color: var(--primary-dark); border: 1px solid #e6d3c4;
  border-radius: 999px; padding: 5px 6px 5px 12px; font-size: 13.5px; font-weight: 600;
}
.driver-chip button { border: 0; background: rgba(177,122,94,.16); color: var(--primary-dark); border-radius: 999px; width: 20px; height: 20px; cursor: pointer; font-size: 15px; line-height: 1; }
.driver-chip button:hover { background: var(--primary); color: #fff; }

/* ---------- board: all zones in ONE row, scroll right for more ---------- */
.board {
  display: flex; flex-wrap: nowrap; gap: 12px;
  padding: 14px; align-items: stretch;
  overflow-x: auto; overscroll-behavior-x: contain;
  scrollbar-width: thin; scrollbar-color: var(--gold) transparent;
  min-height: calc(100vh - 170px);
}
.board::-webkit-scrollbar { height: 10px; }
.board::-webkit-scrollbar-thumb { background: var(--gold); border-radius: 999px; }
.board::-webkit-scrollbar-track { background: var(--taupe-soft); border-radius: 999px; }
.board .zone-col { flex: 0 0 300px; max-width: 300px; }
.zone-col { background: var(--taupe-soft); border-radius: 12px; display: flex; flex-direction: column; min-height: 300px; }
.zone-head {
  padding: 10px 14px; font-weight: 800; letter-spacing: .5px; font-size: 15px;
  display: flex; justify-content: space-between; align-items: center;
  border-radius: 12px 12px 0 0; color: #fff;
}
.zone-head .count { background: rgba(255,255,255,.25); border-radius: 999px; padding: 1px 10px; font-size: 13px; }
.zone-SHARJAH .zone-head { background: var(--zone-sharjah); }
.zone-DUBAI .zone-head { background: var(--zone-dubai); }
.zone-AJMAN .zone-head { background: var(--zone-ajman); }
.zone-ABUDHABI .zone-head { background: #8a7a45; }
.zone-RAK .zone-head { background: #7c5a3f; }
.zone-UAQ .zone-head { background: #4f7676; }
.zone-FUJAIRAH .zone-head { background: #6b6a52; }
.zone-OTHERS .zone-head { background: var(--zone-others); }
.zone-body { padding: 10px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.zone-body.drag-over { outline: 3px dashed var(--primary); outline-offset: -6px; border-radius: 0 0 12px 12px; background: #f5ede6; }
.zone-empty { color: var(--muted); text-align: center; font-size: 13px; padding: 24px 8px; }

/* ---------- Areas board: zones STACKED vertically (no side-scroll) ---------- */
.board.board-stacked {
  display: block; flex-wrap: initial; overflow-x: visible; gap: 0;
  padding: 14px 16px 40px; min-height: calc(100vh - 190px);
}
.zsec {
  background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--taupe);
  border-radius: 14px; margin-bottom: 14px; overflow: hidden; box-shadow: 0 1px 3px rgba(43,38,34,.05);
}
.zsec.drag-over { outline: 2px dashed var(--primary); outline-offset: -2px; background: #faf5f0; }
.zsec-head {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 13px 16px;
  background: none; border: 0; border-bottom: 1px solid var(--taupe-soft);
  cursor: pointer; font-family: inherit; text-align: left;
}
.zsec-head:hover { background: var(--taupe-soft); }
.zsec-dot { width: 11px; height: 11px; border-radius: 50%; flex: none; background: var(--taupe); box-shadow: 0 0 0 3px rgba(0,0,0,.04); }
.zsec-name { font-size: 15.5px; font-weight: 800; letter-spacing: .02em; color: var(--ink); }
.zsec-count { font-size: 12.5px; font-weight: 700; color: var(--muted); background: var(--taupe-soft); border-radius: 999px; padding: 1px 10px; font-variant-numeric: tabular-nums; }
.zsec-chev { margin-left: auto; color: var(--muted); font-size: 20px; line-height: 1; transition: transform .15s; }
.zsec.collapsed .zsec-chev { transform: rotate(-90deg); }
.zsec.collapsed .zsec-head { border-bottom: 0; }
.zsec.collapsed .zsec-body { display: none; }
.zsec-body { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; padding: 14px 16px; }
/* zone accents (left bar + dot), reusing the palette */
.zsec.zone-SHARJAH { border-left-color: var(--zone-sharjah); } .zsec.zone-SHARJAH .zsec-dot { background: var(--zone-sharjah); }
.zsec.zone-DUBAI { border-left-color: var(--zone-dubai); }     .zsec.zone-DUBAI .zsec-dot { background: var(--zone-dubai); }
.zsec.zone-AJMAN { border-left-color: var(--zone-ajman); }     .zsec.zone-AJMAN .zsec-dot { background: var(--zone-ajman); }
.zsec.zone-ABUDHABI { border-left-color: #8a7a45; }            .zsec.zone-ABUDHABI .zsec-dot { background: #8a7a45; }
.zsec.zone-RAK { border-left-color: #7c5a3f; }                 .zsec.zone-RAK .zsec-dot { background: #7c5a3f; }
.zsec.zone-UAQ { border-left-color: #4f7676; }                 .zsec.zone-UAQ .zsec-dot { background: #4f7676; }
.zsec.zone-FUJAIRAH { border-left-color: #6b6a52; }            .zsec.zone-FUJAIRAH .zsec-dot { background: #6b6a52; }
.zsec.zone-OTHERS { border-left-color: var(--zone-others); }   .zsec.zone-OTHERS .zsec-dot { background: var(--zone-others); }

.zsec-others { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 2px 2px 8px; }
.zso-label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.zso-pill { font-size: 12.5px; color: var(--muted); background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 4px 13px; }
.zso-pill.drag-over { background: var(--primary); color: #fff; border-color: var(--primary); }

.board-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; padding: 70px 20px; color: var(--muted); }
.be-emoji { font-size: 42px; }
.be-msg { font-size: 15px; }

/* readable, unambiguous board date */
.date-pick { position: relative; display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; padding: 7px 14px; background: var(--card); cursor: pointer; font-size: 14px; color: var(--ink); white-space: nowrap; }
.date-pick:hover { border-color: var(--primary); }
.date-label b { font-weight: 800; }
.date-pick input[type=date] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; }

/* ---------- cards ---------- */
.card-entry {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; cursor: grab; box-shadow: 0 1px 3px rgba(0,0,0,.05);
  border-left: 4px solid var(--line);
}
.card-entry:active { cursor: grabbing; }
.card-entry.st-new { border-left-color: #9ca3af; }
.card-entry.st-scheduled { border-left-color: var(--blue); }
.card-entry.st-out { border-left-color: var(--amber); }
.card-entry.st-delivered, .card-entry.st-collected { border-left-color: var(--green); opacity: .75; }
.card-top { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.order-no { font-weight: 800; font-size: 14px; color: var(--primary-dark); }
.task-badge { font-size: 11px; font-weight: 700; background: #ede9fe; color: #6d28d9; border-radius: 4px; padding: 2px 6px; }
.collection-badge { font-size: 11px; font-weight: 700; background: #fef3c7; color: #92400e; border-radius: 4px; padding: 2px 6px; }
.event-badge { font-size: 11px; font-weight: 700; background: #f3e8ff; color: #7e22ce; border-radius: 4px; padding: 2px 6px; }
.status-pill { margin-left: auto; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 2px 9px; }
.status-pill.new { background: #f3f4f6; color: #4b5563; }
.status-pill.scheduled { background: #dbeafe; color: #1d4ed8; }
.status-pill.out { background: #fef3c7; color: #b45309; }
.status-pill.delivered, .status-pill.collected { background: #dcfce7; color: #15803d; }
.card-line { font-size: 13.5px; color: var(--ink); margin: 2px 0; overflow: hidden; text-overflow: ellipsis; }
.card-line.muted { color: var(--muted); font-size: 12.5px; }
.card-meta { display: flex; gap: 6px; margin-top: 7px; flex-wrap: wrap; }
.chip { font-size: 12px; background: #f0f1f3; border-radius: 6px; padding: 2px 8px; color: #374151; }
.chip.time { background: #eff6ff; color: var(--blue); font-weight: 600; }
.chip.assignee { background: #f5ede6; color: var(--primary-dark); font-weight: 600; }
.card-quick { display: flex; gap: 6px; margin-top: 8px; }
/* Big, tappable status buttons — many users work from a phone with one hand. */
.quick-btn {
  flex: 1; font-size: 13px; font-weight: 600; padding: 9px 4px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line); background: #fafafa; color: #374151; min-height: 38px;
}
.quick-btn:hover { background: #eef2ff; border-color: #c7d2fe; }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(20,22,30,.5); z-index: 50;
  display: flex; align-items: flex-start; justify-content: center; padding: 4vh 12px;
  overflow-y: auto;
}
.modal {
  background: var(--card); border-radius: 14px; width: 640px; max-width: 100%;
  box-shadow: 0 24px 60px rgba(0,0,0,.25); display: flex; flex-direction: column; max-height: 92vh;
}
.modal-wide { width: 780px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.modal-header h2 { font-size: 21px; font-family: var(--serif); font-weight: 600; letter-spacing: .04em; }
.modal-close { border: 0; background: none; font-size: 26px; cursor: pointer; color: var(--muted); line-height: 1; }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-footer {
  display: flex; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); align-items: center;
}
.modal-footer .spacer { flex: 1; }

.field { margin-bottom: 12px; position: relative; }
.field label { display: block; font-size: 13px; font-weight: 600; color: #374151; margin-bottom: 4px; }
.field .hint { font-weight: 400; color: var(--muted); }
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 14.5px;
  font-family: inherit; background: #fff;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid #d8bda9; border-color: var(--primary); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.field-inline { display: flex; align-items: center; gap: 12px; margin: 10px 0; }
.checkbox-label { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.form-error { color: var(--red); font-size: 14px; min-height: 18px; margin-top: 6px; }

/* ============ TABBED JOB CARD (TF / manual) ============ */
.modal.jobcard { width: 680px; }
.jc-header { align-items: flex-start; }
.jc-head-main { min-width: 0; }
.jc-sub { font-size: 13px; color: var(--muted); margin-top: 3px; letter-spacing: .01em; }
.jc-head-actions { display: flex; align-items: center; gap: 10px; flex: none; }
.jc-status-chip { white-space: nowrap; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

.jc-tabs { display: flex; gap: 2px; padding: 0 20px; border-bottom: 1px solid var(--line); }
.jc-tabs button {
  border: 0; background: none; padding: 11px 14px; font-size: 14px; font-weight: 600;
  color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.jc-tabs button:hover { color: var(--ink); }
.jc-tabs button.active { color: var(--primary-dark); border-bottom-color: var(--primary); }
.jc-count { color: var(--muted); font-weight: 500; font-size: 12.5px; }

/* locked "From the customer (Shopify)" block — reference only */
.ov-locked { border: 1px solid var(--line); background: var(--taupe-soft); border-radius: 10px; padding: 12px 14px; margin-bottom: 16px; }
.ov-locked-head { font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.ov-lock { font-size: 10.5px; font-weight: 700; background: #e7ddd0; color: #6a5a45; border-radius: 5px; padding: 0 6px; letter-spacing: .02em; text-transform: none; }
.ov-locked .ov-row { padding: 4px 0; }
.ov-locked .ov-k { color: var(--muted); }

/* "updated details" leads (view + edit) */
.ov-working-lead { font-size: 13px; font-weight: 700; color: var(--primary-dark); margin-bottom: 12px; }
.ov-working-lead span { font-weight: 400; color: var(--muted); }
.ov-edit-lead { font-size: 12.5px; color: var(--primary-dark); background: #fbf3ec; border: 1px solid #ecd9c9; border-radius: 8px; padding: 8px 10px; margin-bottom: 14px; }

/* read-only overview */
.ov-group { margin-bottom: 18px; }
.ov-group:last-child { margin-bottom: 4px; }
.ov-group-head {
  font-size: 11.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--primary-dark); margin-bottom: 8px; padding-bottom: 5px; border-bottom: 1px solid var(--taupe-soft);
}
.ov-row { display: flex; gap: 14px; padding: 6px 0; align-items: baseline; }
.ov-k { flex: 0 0 116px; font-size: 13px; color: var(--muted); font-weight: 600; }
.ov-v { flex: 1; min-width: 0; font-size: 14.5px; color: var(--ink); word-break: break-word; }
.ov-empty { color: var(--muted); font-style: italic; }
.ov-mini { font-size: 12.5px; color: var(--primary-dark); text-decoration: none; margin-left: 6px; white-space: nowrap; }
.ov-mini:hover { text-decoration: underline; }
.ov-edited {
  display: inline-block; font-size: 11px; font-weight: 700; color: #8a5a00;
  background: #fbe7cf; border: 1px solid #efce9b; border-radius: 6px; padding: 0 6px; margin-left: 8px; cursor: help;
}

/* grouped edit form */
.ov-edit .jc-group { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px 4px; margin-bottom: 14px; }
.ov-edit .jc-group-head {
  font-size: 11.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--primary-dark); margin-bottom: 10px;
}

/* "changed from the customer's original" block (History tab) */
.ov-changes { border: 1px solid #efce9b; background: #fdf6ea; border-radius: 10px; padding: 12px 14px; margin-bottom: 16px; }
.chg-head { font-size: 13px; font-weight: 700; color: #8a5a00; margin-bottom: 10px; }
.chg-row { padding: 7px 0; border-top: 1px dashed #e6d3ab; }
.chg-row:first-of-type { border-top: 0; }
.chg-field { font-size: 12px; font-weight: 700; color: var(--ink); margin-bottom: 3px; }
.chg-line { font-size: 13.5px; color: var(--ink); padding: 1px 0; }
.chg-tag {
  display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  border-radius: 5px; padding: 0 6px; margin-right: 6px; background: #e7ddd0; color: #6a5a45;
}
.chg-tag.now { background: var(--primary); color: #fff; }

@media (max-width: 560px) {
  .ov-row { flex-direction: column; gap: 2px; }
  .ov-k { flex-basis: auto; }
  .jc-tabs { overflow-x: auto; }
}

.type-toggle { display: flex; gap: 0; margin-bottom: 16px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.type-toggle button {
  flex: 1; padding: 9px; border: 0; background: #fafafa; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--muted);
}
.type-toggle button.active { background: var(--primary); color: #fff; }

/* autocomplete */
.autocomplete-wrap { position: relative; }
.suggestions {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 10;
  background: #fff; border: 1px solid var(--line); border-radius: 0 0 10px 10px;
  box-shadow: 0 12px 24px rgba(0,0,0,.12); max-height: 260px; overflow-y: auto;
}
.suggestion {
  padding: 9px 12px; cursor: pointer; border-bottom: 1px solid #f0f1f3;
}
.suggestion:hover, .suggestion.active { background: #f5ede6; }
.suggestion .s-top { font-weight: 700; font-size: 14px; color: var(--primary-dark); }
.suggestion .s-sub { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggestion.none { color: var(--muted); cursor: default; font-size: 13.5px; }
.linked-order {
  margin-top: 8px; background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534;
  border-radius: 8px; padding: 8px 12px; font-size: 13.5px; display: flex; justify-content: space-between; align-items: center;
}
.linked-order button { border: 0; background: none; color: #166534; cursor: pointer; font-weight: 700; }

/* history inside entry modal */
.entry-history { margin-top: 14px; border-top: 1px dashed var(--line); padding-top: 10px; }
.entry-history h4 { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.hist-row { font-size: 12.5px; color: #4b5563; padding: 3px 0; }
.hist-row b { color: var(--ink); }
.hist-row .t { color: var(--muted); }

/* activity */
.activity-list { display: flex; flex-direction: column; }
.act-row { display: flex; gap: 10px; padding: 9px 4px; border-bottom: 1px solid #f0f1f3; font-size: 13.5px; align-items: baseline; }
.act-time { color: var(--muted); font-size: 12px; white-space: nowrap; min-width: 120px; }
.act-user { font-weight: 700; color: var(--primary-dark); min-width: 80px; }
.act-action { font-size: 11px; font-weight: 700; text-transform: uppercase; border-radius: 4px; padding: 2px 6px; background: #f3f4f6; color: #4b5563; white-space: nowrap; }
.act-details { color: #374151; }

/* admin */
.readonly-badge { font-size: 11px; font-weight: 700; background: #dcfce7; color: #15803d; padding: 3px 8px; border-radius: 6px; vertical-align: middle; }
.modal h3 { font-size: 15px; margin: 10px 0 12px; }
.modal h4 { font-size: 14px; margin: 14px 0 8px; }
.modal hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
.users-list { display: flex; flex-direction: column; gap: 6px; }
.user-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: #fafafa; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; }
.user-row .role { font-size: 11px; font-weight: 700; background: #ede9fe; color: #6d28d9; padding: 2px 8px; border-radius: 4px; }
.user-row .inactive { color: var(--red); font-size: 12px; }
.user-row .spacer { flex: 1; }
.user-row button { font-size: 12px; padding: 4px 10px; }

/* toast */
#toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 20px; border-radius: 10px;
  font-size: 14px; z-index: 100; box-shadow: 0 8px 24px rgba(0,0,0,.3);
  opacity: 0; transition: opacity .25s; pointer-events: none;
}
#toast.show { opacity: 1; }

/* ---------- confirmation dialog ---------- */
/* Sits above the modal that raised it, and above the toast. */
#confirmModal { z-index: 150; }
.modal-confirm { width: 430px; max-width: 94vw; }
.modal-confirm .modal-header { border-bottom: none; padding-bottom: 0; }
.confirm-message { font-size: 14.5px; line-height: 1.5; }
.confirm-changes {
  margin: 12px 0 0; padding: 10px 12px 10px 28px;
  background: var(--taupe-soft); border-radius: 8px;
  font-size: 13.5px; line-height: 1.7; color: var(--ink);
}
.confirm-changes li { margin: 0; }

/* ---------- app shell: sidebar + pages ---------- */
#app { display: flex; height: 100vh; overflow: hidden; }
.side-nav {
  width: 236px; flex: none; background: var(--card); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0;
}
.side-brand { display: flex; align-items: center; gap: 10px; padding: 14px 14px 12px; border-bottom: 1px solid var(--line); }
.nav-list { flex: 1; overflow-y: auto; padding: 10px 10px 16px; }
.nav-heading {
  font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; font-weight: 700;
  color: var(--muted); margin: 16px 10px 5px;
}
.nav-item {
  display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  padding: 10px 12px; border: none; border-radius: 9px; background: none; cursor: pointer;
  font-size: 14.5px; color: var(--ink); font-family: inherit; margin-top: 2px;
}
.nav-item:hover { background: var(--taupe-soft); }
.nav-item.active { background: var(--primary); color: #fff; font-weight: 600; }
.nav-ico { width: 22px; font-size: 16px; text-align: center; flex: none; }
.nav-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-foot { border-top: 1px solid var(--line); padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.side-foot .user-chip { align-self: flex-start; }
.side-foot-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }

.main-area { flex: 1; min-width: 0; overflow-y: auto; display: flex; flex-direction: column; }
.top-strip {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; background: var(--bg); border-bottom: 1px solid var(--line);
}
.top-strip .spacer { flex: 1; }
.page-title { font-family: var(--serif); font-size: 20px; font-weight: 600; letter-spacing: .01em; }
.menu-btn { display: none; font-size: 18px; }
.page { flex: 1; }
.nav-shade { position: fixed; inset: 0; background: rgba(20,16,12,.4); z-index: 59; }

/* board page toolbar (was the old topbar’s middle) */
.board-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px 0; }
.board-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }

/* module pages — full width on purpose. Every module is a working screen
   (boards, rosters, maps, calendars); a centred 1100px column wasted a third of
   a wide monitor and forced sideways scrolling inside the modules themselves. */
.module-root { padding: 20px 26px 40px; width: 100%; }
.ws-empty { color: var(--muted); text-align: center; padding: 40px 16px; font-size: 14px; }

/* home */
.home-wrap { padding: 26px 26px 40px; width: 100%; }
.home-hello h2 { font-family: var(--serif); font-size: 30px; font-weight: 600; letter-spacing: .01em; }
.home-sub { color: var(--muted); margin-top: 2px; font-size: 14.5px; }
.home-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin-top: 22px; }
.home-tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-height: 150px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px;
  cursor: pointer; text-align: left; font-family: inherit; font-size: inherit; color: var(--ink);
  box-shadow: 0 1px 2px rgba(43,38,34,.05); transition: box-shadow .15s, border-color .15s;
}
.home-tile:hover { border-color: var(--gold); box-shadow: 0 6px 20px rgba(43,38,34,.10); }
.tile-big { font-family: var(--serif); font-size: 42px; font-weight: 700; color: var(--primary-dark); line-height: 1; }
.tile-txt { font-size: 14.5px; line-height: 1.45; }
.tile-cta { margin-top: auto; font-size: 13px; font-weight: 600; color: var(--primary-dark); }
.home-welcome { margin-top: 24px; line-height: 1.65; }
.home-welcome .btn { margin-left: 10px; }

/* ---------- foldable sidebar (desktop) ----------
   The ☰ button folds the menu down to icons so a wide working screen — a
   kanban, a month calendar, the live map — gets the whole window. Icons stay
   visible (and keep their tooltips) so nobody loses their way; the choice is
   remembered in localStorage. On phones the same button opens the drawer
   instead, which is the behaviour that was always there. */
.menu-btn { display: inline-block; }
.side-nav { transition: width .16s ease; }
body.nav-folded .side-nav { width: 66px; }
body.nav-folded .brand-block,
body.nav-folded .nav-text,
body.nav-folded .fb-label,
body.nav-folded .side-foot .user-chip { display: none; }
body.nav-folded .side-brand { justify-content: center; padding: 14px 6px 12px; }
body.nav-folded .nav-list { padding: 10px 8px 16px; }
body.nav-folded .nav-item { justify-content: center; padding: 11px 0; gap: 0; }
body.nav-folded .nav-ico { width: auto; font-size: 18px; }
/* Group headings would be unreadable at this width, so they become the rule
   they were always standing in for. */
body.nav-folded .nav-heading {
  font-size: 0; margin: 12px 6px 8px; height: 1px; background: var(--line);
}
body.nav-folded .side-foot { padding: 10px 8px; align-items: center; }
body.nav-folded .side-foot-btns { flex-direction: column; gap: 4px; width: 100%; }
body.nav-folded .side-foot-btns .btn { width: 100%; text-align: center; padding: 7px 0; font-size: 15px; }

@media (max-width: 860px) {
  .side-nav {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 60; width: 260px;
    transform: translateX(-105%); transition: transform .2s ease; box-shadow: 8px 0 30px rgba(0,0,0,.18);
  }
  body.nav-open .side-nav { transform: none; }
  .board-actions { margin-left: 0; width: 100%; }
  .module-root, .home-wrap { padding: 16px 14px 40px; }
  /* Folding is a desktop idea; on a phone the drawer already does this job. */
  body.nav-folded .side-nav { width: 260px; }
  body.nav-folded .brand-block,
  body.nav-folded .nav-text,
  body.nav-folded .fb-label,
  body.nav-folded .side-foot .user-chip { display: revert; }
  body.nav-folded .nav-item { justify-content: flex-start; padding: 10px 12px; gap: 11px; }
  body.nav-folded .nav-heading { font-size: 10.5px; height: auto; background: none; margin: 16px 10px 5px; }
  body.nav-folded .side-foot-btns { flex-direction: row; }
  body.nav-folded .side-foot-btns .btn { width: auto; padding: 5px 10px; font-size: 12.5px; }
}

/* shared module toolkit — modules use these so they look like one product
   and never need to add global CSS of their own. */
.ws-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.ws-title { font-family: var(--serif); font-size: 22px; font-weight: 600; letter-spacing: .01em; }
.ws-sub { color: var(--muted); font-size: 13px; margin: 2px 0 16px; }
.ws-toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.ws-toolbar .spacer { flex: 1; }
.ws-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.ws-card { border: 1px solid var(--line); border-radius: 10px; background: var(--card); padding: 14px 15px; box-shadow: 0 1px 2px rgba(43,38,34,.04); }
.ws-card h4 { margin: 0 0 4px; font-size: 15px; }
.ws-card .muted { color: var(--muted); font-size: 13px; }
.ws-btn { border: 1px solid var(--line); background: var(--card); color: var(--ink); padding: 7px 13px; border-radius: 8px; cursor: pointer; font-size: 13.5px; font-family: inherit; white-space: nowrap; }
.ws-btn:hover { background: #f0f1f3; }
.ws-btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.ws-btn.primary:hover { background: var(--primary-dark); }
.ws-btn.warn { background: #fbf0e2; border-color: #e6c79b; color: #8a5a00; font-weight: 600; }
.ws-btn.warn:hover { background: #f6e6cf; }
.kb-shared-note { font-size: 11px; color: var(--muted); margin-top: 6px; }
.ct-time { font-variant-numeric: tabular-nums; color: var(--muted); }
.ct-time.live { color: var(--green); font-weight: 700; }
.chip.stage.partial { background: var(--amber); color: #fff; }
.ws-btn.danger { background: #fff1f1; border-color: #f3c1c1; color: var(--red); }
.ws-btn.sm { padding: 4px 9px; font-size: 12px; }
.ws-input, .ws-select, .ws-textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13.5px; font-family: inherit; background: #fdfbfa; color: var(--ink); }
.ws-input:focus, .ws-select:focus, .ws-textarea:focus { outline: 2px solid var(--gold); border-color: var(--primary); }
.ws-field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.ws-field > label { font-size: 12px; font-weight: 600; color: var(--muted); }
.ws-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .ws-form-grid { grid-template-columns: 1fr; } }
.ws-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.ws-table th, .ws-table td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.ws-table thead th { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.ws-table tbody tr:hover { background: #faf7f4; }
.ws-scroll { overflow-x: auto; }
.ws-chip { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--taupe-soft); color: var(--primary-dark); }
.ws-chip.green { background: #e7f0ea; color: var(--green); }
.ws-chip.amber { background: #f6ecdd; color: var(--amber); }
.ws-chip.blue  { background: #e7eef4; color: var(--blue); }
.ws-chip.red   { background: #f7e7e6; color: var(--red); }
.ws-chip.grey  { background: #eee9e4; color: var(--muted); }
.ws-chip.purple { background: #ece6f2; color: #6b5896; }
.ws-note { background: var(--taupe-soft); border-radius: 8px; padding: 10px 12px; font-size: 13px; color: var(--ink); }
.ws-error { color: var(--red); font-size: 13px; margin-top: 8px; min-height: 1em; }
.ws-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.ws-tab { padding: 8px 13px; border: none; background: none; cursor: pointer; font-size: 13.5px; color: var(--muted); font-family: inherit; border-bottom: 2px solid transparent; }
.ws-tab.active { color: var(--primary-dark); font-weight: 600; border-bottom-color: var(--primary); }

/* ---------- My work kanban ---------- */
/* day summary strip */
.kb-summary { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 14px; }
.kb-sum-chip { font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 999px; background: var(--taupe-soft); color: var(--ink); border: 1px solid var(--line); }
.kb-sum-chip.amber { background: #f6ecdd; color: var(--amber); border-color: #ecd9bd; }
.kb-sum-chip.green { background: #e7f0ea; color: var(--green); border-color: #cfe2d6; }
.kb-sum-chip.red   { background: #f7e7e6; color: var(--red); border-color: #eecac6; }
.kb-sum-chip.blue  { background: #e7eef4; color: var(--blue); border-color: #cdddea; }
.kb-sum-chip.purple { background: #ece6f2; color: #6b5896; border-color: #d9cfe6; }

/* super-admin "see anyone's work" picker + read-only banner */
.kb-picker { display: flex; align-items: center; gap: 10px; margin: 2px 0 12px; flex-wrap: wrap; }
.kb-picker label { font-size: 13px; font-weight: 600; color: var(--primary-dark); }
.kb-picker .ws-select { max-width: 320px; }
.kb-viewbanner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: #f3ede6; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin-bottom: 12px; font-size: 13px; color: var(--ink); }

/* phone segmented control (hidden on desktop) */
.kb-seg { display: none; gap: 6px; margin-bottom: 12px; }
.kb-seg-btn { flex: 1; padding: 9px 6px; border: 1px solid var(--line); background: var(--card); border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; font-family: inherit; }
.kb-seg-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.kb-board { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 8px; align-items: start; }
.kb-col { background: var(--taupe-soft); border-radius: 12px; padding: 10px; min-height: 120px; }
.kb-col-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; padding: 0 2px; }
.kb-count { font-size: 13px; color: var(--muted); font-weight: 600; }
.kb-col-body { display: flex; flex-direction: column; gap: 10px; }
.kb-empty { color: var(--muted); font-size: 13px; text-align: center; padding: 18px 6px; }
.kb-card { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: 10px; padding: 12px; box-shadow: 0 1px 2px rgba(43,38,34,.05); }
/* urgency stripe down the left of each card */
.kb-card.urg-over  { border-left-color: var(--red); }
.kb-card.urg-today { border-left-color: var(--amber); }
.kb-card.urg-run   { border-left-color: var(--blue); }
.kb-card.urg-hold  { border-left-color: #8f79b8; }
.kb-card.urg-done  { border-left-color: var(--green); opacity: .82; }
.kb-title { font-size: 15px; font-weight: 600; line-height: 1.3; }
.kb-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.kb-cust { font-size: 13px; margin-top: 8px; }
.kb-contact a { color: var(--primary-dark); text-decoration: none; font-weight: 600; white-space: nowrap; }
.kb-link { display: inline-block; margin-top: 6px; font-size: 12.8px; color: var(--primary-dark); text-decoration: none; line-height: 1.4; }
.kb-link:hover { text-decoration: underline; }
.kb-mats { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.kb-team { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.kb-notes { font-size: 12.5px; color: var(--ink); background: var(--taupe-soft); border-radius: 6px; padding: 6px 8px; margin-top: 8px; }
.kb-running { margin-top: 10px; font-size: 16px; font-weight: 700; color: var(--amber); font-variant-numeric: tabular-nums; }
.kb-run-label { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.kb-total { margin-top: 8px; font-size: 13px; color: var(--ink); }
.kb-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.kb-actions .ws-btn { flex: 1; padding: 11px 8px; font-size: 14px; }
.kb-notebtn { margin-top: 8px; color: var(--muted); }
.kb-note-form { display: flex; gap: 6px; margin-top: 8px; }
.kb-note-form input { flex: 1; }
.kb-file-btns { display: flex; gap: 6px; margin-top: 8px; }
.kb-files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.kb-thumb { width: 52px; height: 52px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.kb-file { font-size: 12.5px; color: var(--primary-dark); text-decoration: none; background: var(--taupe-soft); padding: 4px 8px; border-radius: 6px; }
.kb-upload { display: inline-block; cursor: pointer; }
@media (max-width: 900px) {
  .kb-seg { display: flex; flex-wrap: wrap; }
  .kb-board { grid-template-columns: 1fr; }
  .kb-col { min-height: 0; display: none; }
  .kb-board[data-mobile-col="todo"] .kb-col[data-col="todo"],
  .kb-board[data-mobile-col="in_progress"] .kb-col[data-col="in_progress"],
  .kb-board[data-mobile-col="pending"] .kb-col[data-col="pending"],
  .kb-board[data-mobile-col="done"] .kb-col[data-col="done"] { display: block; }
  .kb-col-head { display: none; }
}

/* ============ MY WORK — redesigned kanban ============ */
.mw-summary { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 14px; }
.mw-sum-chip { font-size: 13px; font-weight: 700; padding: 6px 13px; border-radius: 999px; background: var(--taupe-soft); color: var(--ink); border: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.mw-sum-chip.amber { background: #f6ecdd; color: var(--amber); border-color: #ecd9bd; }
.mw-sum-chip.red   { background: #f7e7e6; color: var(--red); border-color: #eecac6; }
.mw-sum-chip.blue  { background: #e7eef4; color: var(--blue); border-color: #cdddea; }
.mw-seg { display: none; gap: 6px; margin: 4px 0 12px; }
.mw-seg-btn { flex: 1; padding: 9px 6px; border: 1px solid var(--line); background: var(--card); border-radius: 9px; font-size: 13px; font-weight: 700; color: var(--muted); cursor: pointer; font-family: inherit; display: flex; align-items: center; justify-content: center; gap: 6px; }
.mw-seg-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.mw-seg-n { font-size: 11px; background: rgba(0,0,0,.08); border-radius: 999px; padding: 0 6px; font-variant-numeric: tabular-nums; }
.mw-seg-btn.active .mw-seg-n { background: rgba(255,255,255,.28); }

.mw-board { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 8px; align-items: start; }
.mw-col { background: var(--taupe-soft); border-radius: 14px; padding: 10px 10px 12px; min-height: 140px; border-top: 3px solid var(--line); transition: background .12s, border-color .12s; }
.mw-col.col-todo { border-top-color: var(--taupe); }
.mw-col.col-in_progress { border-top-color: var(--amber); }
.mw-col.col-pending { border-top-color: #8f79b8; }
.mw-col.col-done { border-top-color: var(--green); }
.mw-col.drop-on { background: #f2ebe3; border-top-style: dashed; outline: 2px dashed var(--primary); outline-offset: -2px; }
.mw-col-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; padding: 2px 4px 0; }
.mw-col-title { font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.mw-col-n { font-size: 12px; font-weight: 700; color: var(--muted); background: var(--card); border-radius: 999px; padding: 1px 9px; font-variant-numeric: tabular-nums; }
.mw-col-body { display: flex; flex-direction: column; gap: 9px; }
.mw-empty { color: var(--muted); font-size: 12.5px; text-align: center; padding: 20px 8px; border: 1px dashed var(--line); border-radius: 10px; }

.mw-card { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: 11px; padding: 11px 12px; box-shadow: 0 1px 2px rgba(43,38,34,.05); cursor: grab; transition: box-shadow .12s, transform .08s; }
.mw-card:hover { box-shadow: 0 6px 18px rgba(43,38,34,.10); }
.mw-card:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.mw-card.dragging { opacity: .55; cursor: grabbing; box-shadow: 0 10px 24px rgba(43,38,34,.18); }
.mw-card.urg-over  { border-left-color: var(--red); }
.mw-card.urg-today { border-left-color: var(--amber); }
.mw-card.urg-run   { border-left-color: var(--blue); }
.mw-card.urg-hold  { border-left-color: #8f79b8; }
.mw-card.urg-done  { border-left-color: var(--green); opacity: .78; }

.mw-top { display: flex; align-items: baseline; gap: 7px; }
.mw-type { font-size: 15px; flex: none; }
.mw-title { font-size: 14.5px; font-weight: 700; line-height: 1.25; color: var(--ink); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.mw-badge { flex: none; font-size: 10.5px; font-weight: 700; border-radius: 6px; padding: 1px 7px; white-space: nowrap; }
.mw-badge.red { background: #f6e0dd; color: #9a3a33; }
.mw-badge.amber { background: #f6e7cf; color: #8a5a00; }
.mw-badge.green { background: #dcece2; color: #2f6146; }
.mw-badge.grey { background: var(--taupe-soft); color: var(--muted); }
.mw-meta { font-size: 12px; color: var(--muted); margin-top: 6px; font-variant-numeric: tabular-nums; }
.mw-ord { color: var(--blue); font-weight: 700; }
.mw-where { display: block; margin-top: 5px; font-size: 12.5px; color: var(--primary-dark); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mw-where:hover { text-decoration: underline; }
.mw-team { font-size: 12px; color: var(--muted); margin-top: 5px; }
.mw-time { margin-top: 7px; font-size: 12.5px; color: var(--ink); font-variant-numeric: tabular-nums; }
.mw-time.live { color: var(--amber); font-weight: 700; }
.mw-noteslot:empty { display: none; }

.mw-foot { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.mw-quick { display: flex; gap: 4px; flex: none; }
.mw-ic { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border: 1px solid var(--line); background: var(--card); border-radius: 8px; font-size: 14px; cursor: pointer; text-decoration: none; color: var(--ink); }
.mw-ic:hover { background: var(--taupe-soft); }
.mw-actions { display: flex; gap: 6px; flex: 1; justify-content: flex-end; flex-wrap: wrap; }
.mw-actions .ws-btn.sm { padding: 8px 12px; font-size: 13px; }

@media (max-width: 900px) {
  .mw-seg { display: flex; flex-wrap: wrap; }
  .mw-board { grid-template-columns: 1fr; gap: 0; }
  .mw-col { min-height: 0; display: none; border-top: 0; background: transparent; padding: 0; }
  .mw-board[data-mobile-col="todo"] .mw-col[data-col="todo"],
  .mw-board[data-mobile-col="in_progress"] .mw-col[data-col="in_progress"],
  .mw-board[data-mobile-col="pending"] .mw-col[data-col="pending"],
  .mw-board[data-mobile-col="done"] .mw-col[data-col="done"] { display: block; }
  .mw-col-head { display: none; }
  .mw-card { cursor: pointer; }   /* drag is desktop-only; phones use the buttons */
}

/* My Work — standalone task detail modal */
.mw-detail { width: 560px; max-width: 100%; }
.mw-detail .modal-header { align-items: flex-start; }
.td-head h2 { font-size: 19px; font-family: var(--serif); font-weight: 600; letter-spacing: .02em; }
.td-sub { margin-top: 5px; font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.td-row { display: flex; gap: 14px; padding: 8px 0; border-top: 1px solid var(--taupe-soft); }
.td-row:first-child { border-top: 0; }
.td-k { flex: 0 0 96px; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.td-v { flex: 1; min-width: 0; font-size: 14px; color: var(--ink); word-break: break-word; }
.td-v a { color: var(--primary-dark); text-decoration: none; font-weight: 600; }
.td-v a:hover { text-decoration: underline; }
.td-notes { background: var(--taupe-soft); border-radius: 8px; padding: 8px 10px; font-size: 13px; line-height: 1.5; }
.td-files { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.td-thumb { width: 54px; height: 54px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.td-upload { display: inline-block; cursor: pointer; }
.td-actions { display: flex; gap: 6px; }
.mw-time-live { color: var(--amber); }

/* ---------- notifications (bell + panel) ---------- */
.notif-wrap { position: relative; }
#bellBtn { position: relative; }
.bell-count {
  position: absolute; top: -3px; right: -3px; min-width: 17px; height: 17px; padding: 0 4px;
  background: var(--red); color: #fff; border-radius: 999px;
  font-size: 11px; font-weight: 700; line-height: 17px; text-align: center;
}
.notif-panel {
  position: absolute; right: 0; top: calc(100% + 8px); width: 360px; max-width: 92vw; z-index: 60;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 14px 40px rgba(0,0,0,.16); overflow: hidden;
}
.notif-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--taupe-soft);
}
.notif-head-actions { display: flex; gap: 10px; }
.btn-link {
  background: none; border: none; padding: 0; cursor: pointer;
  color: var(--primary-dark); font-size: 12.5px; text-decoration: underline;
}
.btn-link:disabled { color: var(--muted); cursor: default; text-decoration: none; }
.notif-list { max-height: 60vh; overflow-y: auto; }
.notif-row {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 12px; border-bottom: 1px solid var(--line); cursor: pointer;
}
.notif-row:last-child { border-bottom: none; }
.notif-row:hover { background: #faf7f4; }
.notif-row.unread { background: #fdf6f1; }
.notif-row.unread .notif-title::before { content: "● "; color: var(--primary); }
.notif-icon { font-size: 15px; line-height: 1.5; }
.notif-text { display: flex; flex-direction: column; min-width: 0; }
.notif-title { font-size: 13.5px; font-weight: 600; }
.notif-body { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.notif-time { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.notif-empty { padding: 22px 16px; text-align: center; color: var(--muted); font-size: 13px; }

@media (max-width: 620px) {
  .notif-panel { position: fixed; top: auto; left: 8px; right: 8px; width: auto; max-width: none; }
}

/* ---------- quick search ---------- */
.search-wrap { display: flex; gap: 6px; align-items: center; flex: 1; min-width: 220px; max-width: 460px; }
.search-wrap input[type=search] {
  flex: 1; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px;
  font-size: 14px; background: #fdfbfa;
}
.search-wrap input[type=search]:focus { outline: 2px solid var(--gold); border-color: var(--primary); }

/* ---------- viewer / driver (limited) modes ---------- */
body.no-write .write-only { display: none !important; }
body.viewer .card-entry, body.worker .card-entry { cursor: pointer; }
/* a driver's own deliveries stand out on the board */
.card-entry.mine { box-shadow: inset 4px 0 0 var(--primary); }

/* ---------- source & note chips ---------- */
.chip.source { background: var(--taupe-soft); color: #6b5f52; border: 1px solid var(--line); }
.map-link { text-decoration: none; }
.s-source { font-size: 11px; font-weight: 600; background: var(--taupe-soft); color: #6b5f52; border-radius: 4px; padding: 1px 6px; margin-left: 6px; }

/* ---------- shopify note ---------- */
.shopify-note {
  background: #fbf6ef; border: 1px dashed var(--gold); border-radius: 8px;
  padding: 9px 12px; font-size: 14px; color: #6b5330; white-space: pre-wrap;
}
.input-row { display: flex; gap: 8px; }
.input-row input { flex: 1; }

/* ---------- attachments ---------- */
/* read-only driver display on the card (driver is set via the delivery task) */
.assigned-show { padding: 9px 11px; border: 1px dashed var(--line); border-radius: 8px; background: #faf7f4; color: var(--ink); font-size: 14px; }

/* ---------- tasks on a job card ---------- */
.chip.tasks { background: #f3ede7; color: var(--primary-dark); font-weight: 600; }
.task-section { margin: 14px 0 4px; border-top: 1px dashed var(--line); padding-top: 12px; }
.card-task-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.card-task { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fdfbfa; }
.ct-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ct-head b { font-size: 14px; }
.ct-remove { margin-left: auto; border: none; background: none; cursor: pointer; font-size: 15px; opacity: .6; }
.ct-remove:hover { opacity: 1; }
.ct-people { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ct-chip { display: inline-flex; align-items: center; }
.ct-x { border: none; background: none; color: #fff; cursor: pointer; font-weight: 700; margin-left: 4px; padding: 0 3px; opacity: .8; }
.ct-x:hover { opacity: 1; }
.ct-assign-btn { margin-top: 8px; font-size: 12.5px; padding: 5px 10px; }
.ct-btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.ct-materials { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.ct-input { padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; font-size: 13.5px; font-family: inherit; background: #fff; }
.ct-status { max-width: 130px; }
.ct-assign { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 8px; background: var(--taupe-soft); padding: 8px; border-radius: 8px; }
.ct-assign .ct-input:first-child { flex: 1; min-width: 140px; }

/* the one-step "add a task" form on a job card */
.card-task-form { border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: #fff; margin-top: 8px; }
.ctf-title { font-size: 13px; font-weight: 600; color: var(--primary-dark); margin-bottom: 10px; }
.card-task-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ctf-field { display: flex; flex-direction: column; gap: 4px; }
.ctf-field > span { font-size: 12px; color: var(--muted); font-weight: 600; }
.ctf-wide { grid-column: 1 / -1; }
.ctf-actions { margin-top: 12px; }
.ctf-actions .btn { width: 100%; }
@media (max-width: 560px) { .card-task-grid { grid-template-columns: 1fr; } }

.files-section { margin: 14px 0 4px; border-top: 1px dashed var(--line); padding-top: 12px; }
.files-label { display: block; font-size: 13px; font-weight: 600; color: #374151; margin-bottom: 8px; }
.files-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.file-row { display: flex; align-items: center; gap: 10px; font-size: 13.5px; background: #faf7f4; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; }
.file-row a { color: var(--primary-dark); text-decoration: none; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row .hint { margin-left: auto; white-space: nowrap; }
.file-del { border: 0; background: none; color: var(--red); font-size: 18px; cursor: pointer; line-height: 1; }
.file-pick { display: inline-block; cursor: pointer; }

/* ---------- attachment previews ---------- */
.card-thumbs { display: flex; gap: 6px; margin: 6px 0 2px; flex-wrap: wrap; }
.card-thumbs img {
  height: 52px; width: 52px; object-fit: cover; border-radius: 6px;
  border: 1px solid var(--line); cursor: zoom-in;
}
.file-thumb {
  height: 36px; width: 36px; object-fit: cover; border-radius: 6px;
  border: 1px solid var(--line); cursor: zoom-in; flex-shrink: 0;
}
#lightbox {
  position: fixed; inset: 0; z-index: 200; background: rgba(30, 24, 20, .85);
  display: none; align-items: center; justify-content: center; cursor: zoom-out;
}
#lightbox.show { display: flex; }
#lightbox img { max-width: 94vw; max-height: 94vh; border-radius: 10px; box-shadow: 0 12px 48px rgba(0,0,0,.5); }

/* ---------- advanced search results ---------- */
.field-btn { display: flex; align-items: flex-end; }
.as-count { font-size: 13px; color: var(--muted); margin: 10px 0 6px; }
.as-results { max-height: 46vh; overflow-y: auto; }
.as-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 9px 10px; border-bottom: 1px solid #f0ece7; cursor: pointer; font-size: 13.5px;
}
.as-row:hover { background: #f5ede6; }
.as-date { font-weight: 700; color: var(--primary-dark); min-width: 90px; }

/* ---------- timeline view (hour-by-hour list) ---------- */
.timeline { padding: 14px; }
.tl-row { display: flex; gap: 14px; margin-bottom: 14px; }
.tl-hour {
  min-width: 92px; text-align: right; font-family: var(--serif); font-weight: 700;
  font-size: 16px; color: var(--primary-dark); padding-top: 10px;
  border-right: 2px solid var(--gold); padding-right: 14px;
}
.tl-cards { flex: 1; display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 10px; }

/* ---------- hour board view (kanban by hour) ---------- */
.hours {
  display: flex; flex-wrap: nowrap; gap: 12px;
  padding: 14px; align-items: stretch;
  overflow-x: auto; overscroll-behavior-x: contain;
  scrollbar-width: thin; scrollbar-color: var(--gold) transparent;
  min-height: calc(100vh - 170px);
}
.hours::-webkit-scrollbar { height: 10px; }
.hours::-webkit-scrollbar-thumb { background: var(--gold); border-radius: 999px; }
.hours::-webkit-scrollbar-track { background: var(--taupe-soft); border-radius: 999px; }
.tl-col { flex: 0 0 300px; max-width: 300px; background: var(--taupe-soft); border-radius: 12px; display: flex; flex-direction: column; min-height: 300px; }
.tl-col-head {
  padding: 10px 14px; font-family: var(--serif); font-weight: 700; letter-spacing: .5px; font-size: 16px;
  display: flex; justify-content: space-between; align-items: center;
  border-radius: 12px 12px 0 0; color: #fff; background: var(--primary);
}
.tl-col-head .count { background: rgba(255,255,255,.25); border-radius: 999px; padding: 1px 10px; font-size: 13px; }

/* ---------- calendar view ---------- */
.calendar { padding: 14px; width: 100%; }
.cal-header { display: flex; align-items: center; justify-content: center; gap: 18px; margin-bottom: 12px; }
.cal-header h3 { font-family: var(--serif); font-size: 24px; font-weight: 600; letter-spacing: .04em; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-dow { text-align: center; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; padding: 6px 0; }
.cal-cell {
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  min-height: 86px; padding: 6px 8px; cursor: pointer;
}
.cal-cell:hover { border-color: var(--primary); }
.cal-cell.empty { background: transparent; border: none; cursor: default; }
.cal-cell.today { border-color: var(--primary); border-width: 2px; }
.cal-cell.selected { background: #f5ede6; }
.cal-daynum { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.cal-stats { display: flex; flex-direction: column; gap: 3px; }
.cal-badge { font-size: 11px; font-weight: 600; border-radius: 4px; padding: 1px 6px; width: fit-content; }
.cal-badge.timed { background: #eef3f8; color: var(--blue); }
.cal-badge.flex { background: var(--taupe-soft); color: #6b5f52; }
.cal-badge.done { background: #e8f2ec; color: var(--green); }

/* ---------- roles ---------- */
.role.viewer-role { background: #eef3f8; color: var(--blue); }
.role.super-role { background: #f3e9dc; color: #8a6135; }
.role.driver-role { background: #e6eef2; color: #3d6b7a; }
.role-select { padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; font-size: 12.5px; }
.role-legend { margin-bottom: 10px; }
.inline-input { flex: 1; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; }
.date-readable { display: block; margin-top: 5px; font-size: 12.5px; font-weight: 600; color: var(--primary-dark); }

/* ---------- new-job wizard ---------- */
.wiz-backdrop { position: fixed; inset: 0; z-index: 90; background: rgba(20,22,30,.5); display: flex; align-items: center; justify-content: center; padding: 3vh 12px; }
.wiz-modal { background: var(--card); border-radius: 16px; width: 100%; max-width: 640px; max-height: 94vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.28); overflow: hidden; }
.wiz-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px 10px; }
.wiz-head h2 { font-size: 22px; margin: 0; }
.wiz-x { border: none; background: none; font-size: 26px; line-height: 1; color: var(--muted); cursor: pointer; padding: 0 4px; }
.wiz-x:hover { color: var(--ink); }
/* progress */
.wiz-progress { display: flex; align-items: center; gap: 4px; padding: 4px 22px 14px; }
.wiz-pstep { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 13px; font-weight: 600; white-space: nowrap; }
.wiz-pdot { width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12.5px; background: var(--taupe-soft); color: var(--muted); border: 1px solid var(--line); }
.wiz-pstep.active .wiz-pdot { background: var(--primary); color: #fff; border-color: var(--primary); }
.wiz-pstep.active { color: var(--primary-dark); }
.wiz-pstep.done .wiz-pdot { background: var(--green); color: #fff; border-color: var(--green); }
.wiz-pline { flex: 1; height: 2px; background: var(--line); min-width: 12px; }
/* body */
.wiz-body { padding: 6px 22px 18px; overflow-y: auto; }
.wiz-lead { color: var(--muted); font-size: 14px; margin: 2px 0 14px; }
.wiz-toggle { display: flex; gap: 8px; margin-bottom: 14px; }
.wiz-tg { flex: 1; padding: 11px 8px; border: 1px solid var(--line); background: var(--card); border-radius: 10px; font-size: 13.5px; font-weight: 600; color: var(--muted); cursor: pointer; font-family: inherit; }
.wiz-tg.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.wiz-field { margin-bottom: 13px; position: relative; }
.wiz-field > label { display: block; font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 5px; }
.wiz-field .hint { font-weight: 400; color: var(--muted); font-size: 12px; }
.wiz-input { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; font-size: 15px; font-family: inherit; background: #fdfbfa; color: var(--ink); }
.wiz-input:focus { outline: 2px solid var(--gold); border-color: var(--primary); }
textarea.wiz-input { resize: vertical; }
.wiz-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.wiz-grid .wiz-wide { grid-column: 1 / -1; }
.wiz-ok { display: none; color: var(--green); font-weight: 700; }
.wiz-field.ok .wiz-ok { display: inline; }
.wiz-err { color: var(--red); font-size: 12.5px; margin-top: 5px; font-weight: 600; }
/* step 3 */
.wiz-summary { display: flex; flex-wrap: wrap; gap: 6px 14px; background: var(--taupe-soft); border-radius: 10px; padding: 10px 12px; margin-bottom: 14px; font-size: 13px; color: var(--ink); }
.wiz-tasks { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.wiz-tasks-empty { color: var(--muted); font-size: 13px; text-align: center; padding: 12px; background: var(--taupe-soft); border-radius: 10px; }
.wiz-taskrow { border: 1px solid var(--line); border-left: 3px solid var(--primary); border-radius: 9px; padding: 9px 11px; }
.wiz-taskrow-main { font-size: 14px; }
.wiz-taskrow-main .hint { font-weight: 400; color: var(--muted); font-size: 12px; }
.wiz-taskmats { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 5px; }
.wiz-taskrow-actions { margin-top: 8px; display: flex; gap: 6px; }
.wiz-matform { margin-top: 8px; display: flex; gap: 6px; align-items: center; }
.wiz-matform .wiz-input { flex: 1; padding: 7px 9px; font-size: 13px; }
.wiz-chip-x { border: none; background: none; color: var(--muted); cursor: pointer; font-size: 14px; padding: 0 2px; }
.wiz-addtask { background: var(--taupe-soft); border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; }
.wiz-addtask-title { font-size: 13.5px; font-weight: 700; color: var(--primary-dark); margin-bottom: 10px; }
.wiz-addtask .wiz-field { margin-bottom: 8px; }
.wiz-addtask .wiz-input { background: var(--card); padding: 8px 10px; font-size: 13.5px; }
.wiz-addtask label { font-size: 12px; }
.wiz-files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.wiz-fchip { font-size: 12.5px; background: var(--taupe-soft); border-radius: 999px; padding: 4px 10px; color: var(--ink); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; }
/* footer */
.wiz-foot { display: flex; align-items: center; gap: 12px; padding: 14px 22px; border-top: 1px solid var(--line); background: #fdfbfa; }
.wiz-foot-hint { flex: 1; text-align: center; font-size: 12.5px; color: var(--muted); }
.wiz-foot .btn { padding: 11px 20px; font-size: 15px; }
.wiz-foot #wizNext { min-width: 130px; }

/* ---------- by-person board view ---------- */
.ppl-col .zone-head { background: var(--primary); color: #fff; }
.ppl-col .zone-head .count { background: rgba(255,255,255,.25); }
/* by-stage view: one column per delivery stage */
.stage-col .zone-head { background: var(--primary); color: #fff; }
.stage-col .zone-head .count { background: rgba(255,255,255,.25); }
.stage-col.stage-done { opacity: .9; }
.stage-col.stage-done .zone-head { background: var(--green); }
.ppl-loading { padding: 40px 16px; text-align: center; color: var(--muted); }
.ppl-task { background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--gold); border-radius: 8px; padding: 9px 11px; margin-bottom: 8px; cursor: pointer; }
.ppl-task:hover { border-color: var(--primary); }
.ppl-task.st-done { opacity: .7; border-left-color: var(--green); }
.ppl-task.st-in_progress { border-left-color: var(--amber); }
.ppl-task.st-pending { border-left-color: #8f79b8; }
.ppl-task-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; font-size: 14px; }
.ppl-task-sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.ppl-task-meta { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }

/* ---------- reports dashboard bars ---------- */
.rp-bar-row { display: grid; grid-template-columns: minmax(88px, 32%) 1fr auto; align-items: center; gap: 10px; padding: 5px 0; }
.rp-bar-label { font-size: 13px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rp-bar-track { background: var(--taupe-soft); border-radius: 999px; height: 10px; overflow: hidden; }
.rp-bar-fill { height: 100%; border-radius: 999px; background: var(--primary); min-width: 4px; }
.rp-bar-fill.green { background: var(--green); }
.rp-bar-fill.amber { background: var(--amber); }
.rp-bar-fill.red { background: var(--red); }
.rp-bar-fill.blue { background: var(--blue); }
.rp-bar-fill.grey { background: var(--muted); }
.rp-bar-fill.purple { background: #8f79b8; }
.rp-bar-val { font-size: 13px; font-weight: 700; color: var(--ink); white-space: nowrap; }

/* print: just the report content, no app chrome */
@media print {
  @page { size: landscape; margin: 10mm; }
  #sideNav, .topbar, .controlbar, .nav-shade, .ws-toolbar, .ws-head .ws-btn,
  .sch-views, .sch-nav .ws-btn, .sch-daymode, .ws-sub, .sch-modal-back { display: none !important; }
  .main-area { margin: 0 !important; }
  .ws-card { break-inside: avoid; }
  .sch-scroll, .ws-scroll { overflow: visible !important; }
  .sch-grid, .sch-month, .sch-hours { min-width: 0 !important; }
  .sch-bar { justify-content: flex-start; }
  .sch-period { font-size: 18px; margin-left: 0; }
  .sch-cell, .sch-name, .sch-daycol { font-size: 10.5px; }
  .kb-card, .sch-row, .sch-moncell, .sch-hrow { break-inside: avoid; }
}

/* ---------- Shifts & Staff schedule ---------- */
.sch-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 6px 0 12px; }
.sch-views { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.sch-vbtn { padding: 8px 16px; border: none; background: var(--card); color: var(--muted); font-weight: 600; font-size: 13.5px; cursor: pointer; font-family: inherit; }
.sch-vbtn.active { background: var(--primary); color: #fff; }
.sch-nav { display: inline-flex; align-items: center; gap: 6px; }
.sch-period { font-weight: 700; color: var(--primary-dark); margin-left: 6px; font-size: 15px; }
.sch-legend { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.sch-legchip { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; color: var(--ink); }
.sch-legtime { font-weight: 400; opacity: .75; }
.sch-scroll { overflow-x: auto; }
.sch-block { display: inline-flex; align-items: baseline; gap: 5px; font-size: 12.5px; color: var(--ink); padding: 3px 8px; border-radius: 7px; line-height: 1.3; }
.sch-block b { font-weight: 700; }
.sch-time { font-size: 11px; opacity: .8; }
.sch-leave { font-size: 12px; color: var(--muted); font-style: italic; }
.sch-pt { display: inline-block; font-size: 10px; font-weight: 700; color: #6b5896; background: #ece6f2; border-radius: 999px; padding: 0 6px; margin-left: 6px; vertical-align: middle; }
/* week grid */
.sch-grid { min-width: 820px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.sch-row { display: grid; grid-template-columns: 150px repeat(7, 1fr); }
.sch-head-row { background: var(--taupe-soft); font-size: 12px; font-weight: 700; color: var(--muted); }
.sch-daycol { padding: 8px 6px; text-align: center; border-left: 1px solid var(--line); text-transform: uppercase; letter-spacing: .04em; }
.sch-daycol.is-today { background: #fbf3ec; color: var(--primary-dark); }
.sch-daynum { display: block; font-weight: 600; color: var(--ink); text-transform: none; }
.sch-pub { font-size: 11px; }
.sch-corner { display: flex; align-items: center; padding-left: 12px; }
.sch-grouphead { grid-column: 1 / -1; background: var(--taupe-soft); padding: 6px 12px; font-weight: 700; font-size: 13px; color: var(--primary-dark); border-top: 1px solid var(--line); }
.sch-gcount { color: var(--muted); font-weight: 600; }
.sch-name { padding: 9px 12px; font-size: 13.5px; display: flex; align-items: center; flex-wrap: wrap; border-top: 1px solid var(--line); }
.sch-cell { border-left: 1px solid var(--line); border-top: 1px solid var(--line); min-height: 40px; padding: 4px; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.sch-cell.empty:hover { background: #fbf3ec; }
.sch-cell.filled { cursor: pointer; }
.sch-plus { color: var(--line); font-size: 18px; font-weight: 700; }
.sch-cell.empty:hover .sch-plus { color: var(--primary); }
/* day view */
.sch-daysummary { background: var(--taupe-soft); border-radius: 10px; padding: 10px 14px; font-size: 14px; margin-bottom: 12px; }
.sch-daygroup { margin-bottom: 14px; }
.sch-daygroup .sch-grouphead { border-radius: 8px; border: none; }
.sch-dayrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--line); }
.sch-dayrow.tap { cursor: pointer; }
.sch-dayrow.tap:hover { background: #fbf3ec; }
.sch-dayname { font-size: 14px; }
.sch-none { color: var(--muted); font-size: 12.5px; font-style: italic; }
/* month view */
.sch-month { min-width: 640px; }
.sch-monrow { display: grid; grid-template-columns: repeat(7, 1fr); }
.sch-monhead { text-align: center; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; padding: 6px 0; }
.sch-moncell { min-height: 74px; border: 1px solid var(--line); margin: -0.5px 0 0 -0.5px; padding: 5px 6px; cursor: pointer; }
.sch-moncell:hover { background: #fbf3ec; }
.sch-moncell.muted { background: #faf8f5; color: var(--muted); }
.sch-moncell.is-today { box-shadow: inset 0 0 0 2px var(--gold); }
.sch-mondate { font-size: 12.5px; font-weight: 700; color: var(--ink); }
.sch-moncount { font-size: 12px; color: var(--primary-dark); margin-top: 4px; }
.sch-dots { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 4px; }
.sch-dot { width: 8px; height: 8px; border-radius: 50%; }
/* schedule modals */
.sch-modal-back { position: fixed; inset: 0; z-index: 120; background: rgba(20,22,30,.5); display: flex; align-items: center; justify-content: center; padding: 3vh 12px; }
.sch-modal { background: var(--card); border-radius: 14px; width: 100%; max-width: 440px; max-height: 92vh; overflow-y: auto; padding: 18px 20px; box-shadow: 0 20px 60px rgba(0,0,0,.28); }
.sch-modal.wide { max-width: 640px; }
.sch-modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.sch-modal-head h3 { margin: 0; font-size: 18px; }
.sch-modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.sch-picks { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; }
.sch-pick { border: 1px solid var(--line); border-radius: 10px; padding: 12px 10px; cursor: pointer; font-family: inherit; text-align: center; display: flex; flex-direction: column; gap: 3px; color: var(--ink); font-size: 13px; }
.sch-pick b { font-size: 14px; }
.sch-pick:hover { outline: 2px solid var(--primary); }
.sch-pick-emoji { font-size: 20px; }
.sch-pick-foot { display: flex; gap: 8px; }
.sch-custom { display: flex; align-items: flex-end; gap: 8px; margin-top: 10px; }
.sch-custom label { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 3px; }
.sch-seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.sch-seg-btn { padding: 8px 16px; border: none; background: var(--card); color: var(--muted); font-weight: 600; cursor: pointer; font-family: inherit; font-size: 13px; }
.sch-seg-btn.active { background: var(--primary); color: #fff; }
.sch-cred-done { background: #e7f0ea; border: 1px solid #cfe2d6; border-radius: 10px; padding: 12px 14px; margin-top: 12px; font-size: 13.5px; line-height: 1.6; }
.sch-cred-done code { background: #fff; padding: 1px 7px; border-radius: 5px; font-size: 14px; font-weight: 700; }
.sch-blocks { display: flex; flex-direction: column; gap: 8px; }
.sch-blockrow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sch-blockrow .sch-block { min-width: 110px; }
.ws-input.sm { padding: 6px 8px; font-size: 13px; width: auto; }
.sch-color { width: 38px; height: 32px; border: 1px solid var(--line); border-radius: 6px; padding: 2px; background: #fff; cursor: pointer; }
/* admin panel: starter password + part-time badge */
.starter-pw { font-size: 11.5px; font-weight: 700; color: var(--primary-dark); background: #fbf3ec; border: 1px solid #ecd9bd; border-radius: 6px; padding: 1px 7px; margin-left: 6px; }
.pt-badge { display: inline-block; font-size: 10px; font-weight: 700; color: #6b5896; background: #ece6f2; border-radius: 999px; padding: 1px 7px; margin-left: 6px; vertical-align: middle; }
/* day view sub-toggle + hourly timeline */
.sch-daymode { display: inline-flex; gap: 6px; margin: 0 0 12px; }
.sch-dm { padding: 6px 14px; border: 1px solid var(--line); background: var(--card); border-radius: 8px; font-weight: 600; font-size: 13px; color: var(--muted); cursor: pointer; font-family: inherit; }
.sch-dm.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.sch-hours { min-width: 660px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.sch-hrow { display: grid; grid-template-columns: 130px 1fr; align-items: center; border-top: 1px solid var(--line); }
.sch-hrow:first-child { border-top: none; }
.sch-hhead .sch-htrack { height: 22px; }
.sch-hname { font-size: 13px; padding: 0 8px 0 12px; }
.sch-htrack { position: relative; height: 34px; }
.sch-htick { position: absolute; top: 0; bottom: 0; font-size: 10.5px; color: var(--muted); transform: translateX(-1px); border-left: 1px solid var(--line); padding-left: 3px; }
.sch-hbar { position: absolute; top: 5px; bottom: 5px; min-width: 3%; border-radius: 6px; display: flex; align-items: center; gap: 5px; padding: 0 8px; font-size: 11.5px; color: var(--ink); overflow: hidden; white-space: nowrap; box-shadow: inset 0 0 0 1px rgba(0,0,0,.06); }
.sch-hbar.tap { cursor: pointer; }
.sch-hbar b { font-weight: 700; }

/* delivery lifecycle stage bar (on the order card) */
.stagebar { display: flex; align-items: center; gap: 2px; margin: 2px 0 14px; overflow-x: auto; padding: 2px 0 4px; }
.stage-step { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 50px; flex-shrink: 0; }
.stage-dot { width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; background: var(--taupe-soft); color: var(--muted); border: 1px solid var(--line); }
.stage-lbl { font-size: 10.5px; color: var(--muted); font-weight: 600; text-align: center; white-space: nowrap; }
.stage-step.done .stage-dot { background: var(--green); color: #fff; border-color: var(--green); }
.stage-step.done .stage-lbl { color: var(--green); }
.stage-step.now .stage-dot { background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: 0 0 0 3px #f0e2d8; }
.stage-step.now .stage-lbl { color: var(--primary-dark); font-weight: 700; }
.stage-line { flex: 1; height: 2px; background: var(--line); min-width: 6px; }
.stage-step[data-setstage] { cursor: pointer; }
.stage-step[data-setstage]:hover .stage-dot { border-color: var(--primary); box-shadow: 0 0 0 3px #f0e2d8; }
.stage-step.partial .stage-dot { background: var(--amber); color: #fff; border-color: var(--amber); }
.stage-step.partial .stage-lbl { color: var(--amber); font-weight: 700; }
.stagebar.pinned { opacity: .96; }
.stage-manual { font-size: 11.5px; color: var(--amber); font-weight: 600; margin: -8px 0 12px; }
.stage-hint { font-size: 11px; color: var(--muted); margin: -8px 0 12px; }
.linklike { border: 0; background: none; color: var(--primary-dark); font: inherit; font-weight: 700; cursor: pointer; padding: 0; text-decoration: underline; }
.chip.stage { background: #f6ecdd; color: var(--amber); font-weight: 700; }

/* ---------- responsive (phones & tablets) ---------- */
@media (max-width: 760px) {
  .topbar { gap: 8px; padding: 8px 10px; }
  .brand-tag { display: none; }
  .brand-name { font-size: 15px; }
  .sync-badge { display: none; }
  .topbar-right { margin-left: 0; width: 100%; justify-content: space-between; }
  .search-wrap { order: 5; max-width: none; width: 100%; }
  .date-nav { flex: 1; }
  .date-pick { flex: 1; justify-content: center; }
  .controlbar { padding: 8px 8px 0; }
  .tabbar { width: 100%; overflow-x: auto; }
  .tab { padding: 8px 12px; font-size: 13.5px; white-space: nowrap; }
  .viewbar { width: 100%; }
  .view-group { flex: 1; overflow-x: auto; }
  .view-group .view-btn { flex: 1 0 auto; white-space: nowrap; }
  .board, .hours { padding: 10px; }
  .board:not(.board-stacked) .zone-col, .hours .tl-col { flex: 0 0 85vw; max-width: 85vw; }
  .board.board-stacked { padding: 10px 10px 32px; }
  .zsec-body { grid-template-columns: 1fr; padding: 12px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .modal { max-height: 96vh; border-radius: 10px; }
  .modal-backdrop { padding: 2vh 6px; }
  .tl-row { flex-direction: column; gap: 6px; }
  .tl-hour { text-align: left; border-right: none; border-bottom: 2px solid var(--gold); padding: 0 0 4px; min-width: 0; }
  .tl-cards { grid-template-columns: 1fr; }
  .cal-cell { min-height: 64px; padding: 4px 5px; }
  .cal-badge { font-size: 9.5px; padding: 1px 4px; }
  .user-chip { display: none; }
  /* wizard on phones: full-height sheet, single-column, compact progress */
  .wiz-backdrop { padding: 0; }
  .wiz-modal { max-width: none; max-height: 100vh; height: 100vh; border-radius: 0; }
  .wiz-grid { grid-template-columns: 1fr; }
  .wiz-plabel { display: none; }
  .wiz-pstep.active .wiz-plabel { display: inline; }
  .wiz-progress { padding: 4px 16px 12px; }
  .wiz-head, .wiz-body, .wiz-foot { padding-left: 16px; padding-right: 16px; }
  .wiz-foot .btn { padding: 12px 16px; }
}
