/* PurePro Water Management System — original design system */
:root {
  --brand: #0e7dc4;
  --brand-600: #0b6aa8;
  --brand-700: #095a90;
  --teal: #12b3a6;
  --bg: #eef3f8;
  --surface: #ffffff;
  --surface-2: #f6f9fc;
  --border: #dde5ee;
  --text: #14202b;
  --muted: #62748a;
  --muted-2: #8b9cb0;
  --ok: #17a673;
  --ok-bg: #e2f6ee;
  --warn: #d98a15;
  --warn-bg: #fdf1dc;
  --danger: #d5493f;
  --danger-bg: #fce8e6;
  --info: #2f7ed8;
  --shadow: 0 1px 2px rgba(16,42,66,.06), 0 6px 20px rgba(16,42,66,.06);
  --shadow-lg: 0 12px 40px rgba(16,42,66,.16);
  --radius: 14px;
  --radius-sm: 10px;
  --sidebar-w: 244px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
:root[data-theme="dark"] {
  --brand: #38a8e8;
  --brand-600: #2f97d4;
  --brand-700: #2b87bd;
  --teal: #29c9bb;
  --bg: #0c141c;
  --surface: #131e29;
  --surface-2: #172532;
  --border: #24343f;
  --text: #e7eef5;
  --muted: #93a6b7;
  --muted-2: #6d8195;
  --ok: #2bbd85;
  --ok-bg: #123528;
  --warn: #e2a63f;
  --warn-bg: #3a2c12;
  --danger: #ec6a60;
  --danger-bg: #3a1e1c;
  --info: #4aa3e8;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.28);
  --shadow-lg: 0 16px 48px rgba(0,0,0,.5);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
}
.hidden { display: none !important; }
.muted { color: var(--muted); font-weight: 400; }
a { color: var(--brand); }

/* ---------- Buttons ---------- */
.btn {
  font-family: inherit; font-size: 13.5px; font-weight: 600;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 9px 14px; border-radius: var(--radius-sm); cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px; transition: .15s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { color: var(--danger); border-color: var(--border); }
.btn-danger:hover { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); }
.btn-block { width: 100%; justify-content: center; }
.btn-sm { padding: 6px 10px; font-size: 12.5px; }
.icon-btn { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--muted); padding: 4px 8px; border-radius: 8px; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* ---------- Auth ---------- */
.auth-screen { min-height: 100vh; display: grid; place-items: center;
  background: radial-gradient(1200px 600px at 70% -10%, rgba(18,179,166,.18), transparent),
              radial-gradient(1000px 500px at 0% 100%, rgba(14,125,196,.16), transparent), var(--bg); }
.auth-card { background: var(--surface); width: 360px; max-width: calc(100vw - 32px);
  padding: 34px 30px; border-radius: 20px; box-shadow: var(--shadow-lg); border: 1px solid var(--border); text-align: center; }
.auth-card h1 { margin: 14px 0 2px; font-size: 26px; letter-spacing: -.5px; }
.auth-sub { margin: 0 0 22px; color: var(--muted); font-weight: 500; }
.auth-form { text-align: left; display: grid; gap: 14px; }
.auth-form label { display: grid; gap: 6px; font-weight: 600; font-size: 13px; }
.auth-form input, .auth-form select { padding: 11px 12px; }
.auth-foot { margin: 18px 0 0; font-size: 12px; color: var(--muted-2); }

/* PurePro logo: navy on light, white in dark theme (embedded PNGs, see --logo-* near the end of this sheet) */
.pp-logo { display: block; background: var(--logo) no-repeat center / contain; aspect-ratio: 291 / 53; }
.auth-logo { width: 250px; max-width: 100%; margin: 6px auto 12px; }
.sidebar-logo { width: 100%; max-width: 196px; }
.doc-logo { width: 150px; margin-bottom: 8px; }

/* ---------- Inputs ---------- */
input, select, textarea {
  font-family: inherit; font-size: 13.5px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 9px 11px; width: 100%; outline: none; transition: .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(14,125,196,.14); }
label.field { display: grid; gap: 6px; font-weight: 600; font-size: 12.5px; }
.search { width: 260px; background: var(--surface-2); }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; }
.sidebar-brand { display: flex; align-items: center; padding: 20px 22px 14px; }
.nav { flex: 1; overflow-y: auto; padding: 6px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-section { font-size: 10.5px; text-transform: uppercase; letter-spacing: .7px; color: var(--muted-2);
  font-weight: 700; padding: 14px 12px 5px; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px;
  color: var(--muted); font-weight: 600; cursor: pointer; font-size: 13.5px; transition: .12s; border: none; background: none; width: 100%; text-align: left; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: linear-gradient(90deg, rgba(14,125,196,.14), rgba(18,179,166,.08)); color: var(--brand); }
.nav-item .ico { width: 20px; text-align: center; font-size: 15px; }
.nav-item .badge { margin-left: auto; }
.sidebar-foot { padding: 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.theme-toggle { background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 8px; cursor: pointer;
  font-family: inherit; font-weight: 600; color: var(--muted); font-size: 12.5px; }
.theme-toggle:hover { color: var(--text); }
.user-chip { display: flex; align-items: center; gap: 9px; font-size: 12.5px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(150deg, var(--brand), var(--teal));
  color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 12px; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,.82); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 14px; padding: 12px 22px; }
:root[data-theme="dark"] .topbar { background: rgba(19,30,41,.82); }
.crumb { font-weight: 700; font-size: 16px; letter-spacing: -.2px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.menu-btn { display: none; }
.view { padding: 22px; max-width: 1400px; width: 100%; margin: 0 auto; }

/* ---------- Cards / layout ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px; }
.card-head { display: flex; align-items: center; gap: 12px; padding: 15px 18px; border-bottom: 1px solid var(--border); }
.card-head h3 { margin: 0; font-size: 15px; }
.card-head .btn { margin-left: auto; }
.grid { display: grid; gap: 16px; }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
.row { display: flex; gap: 12px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.section-title { display: flex; align-items: center; gap: 12px; margin: 4px 0 14px; }
.section-title h2 { margin: 0; font-size: 19px; letter-spacing: -.3px; }
.section-title .btn { margin-left: auto; }

/* KPI */
.kpi { padding: 16px 18px; }
.kpi .k-label { color: var(--muted); font-weight: 600; font-size: 12.5px; display: flex; align-items: center; gap: 8px; }
.kpi .k-val { font-size: 27px; font-weight: 800; letter-spacing: -.6px; margin-top: 8px; }
.kpi .k-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.kpi .k-ico { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; font-size: 16px;
  background: rgba(14,125,196,.12); color: var(--brand); }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted);
  font-weight: 700; padding: 11px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr { cursor: pointer; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.t-strong { font-weight: 600; }
.t-sub { color: var(--muted); font-size: 12px; }

/* ---------- Badges / chips ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; background: var(--surface-2); color: var(--muted); }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.badge.info { background: rgba(47,126,216,.14); color: var(--info); }
.badge.brand { background: rgba(14,125,196,.12); color: var(--brand); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

.pill-tabs { display: inline-flex; max-width: 100%; overflow-x: auto; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 2px; }
.pill-tabs button { flex: 0 0 auto; white-space: nowrap; }
.pill-tabs button { border: none; background: none; padding: 7px 14px; border-radius: 8px; font-family: inherit; font-weight: 600;
  font-size: 13px; color: var(--muted); cursor: pointer; }
.pill-tabs button.active { background: var(--surface); color: var(--brand); box-shadow: var(--shadow); }

.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty .big { font-size: 34px; margin-bottom: 8px; }

/* ---------- POS ---------- */
.pos { display: grid; grid-template-columns: 1fr 380px; gap: 16px; align-items: start; }
.pos-cats { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.pos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.prod-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 13px;
  cursor: pointer; transition: .12s; text-align: left; }
.prod-card:hover { border-color: var(--brand); transform: translateY(-2px); box-shadow: var(--shadow); }
.prod-card .p-cat { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--teal); }
.prod-card .p-name { font-weight: 600; margin: 6px 0; line-height: 1.25; min-height: 34px; }
.prod-card .p-foot { display: flex; align-items: center; justify-content: space-between; }
.prod-card .p-price { font-weight: 800; }
.cart { position: sticky; top: 84px; }
#pos-mbar-wrap { display: none; }
@media (max-width: 768px) {
  #pos-mbar-wrap { display: block; position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 30; }
  .pos { padding-bottom: 64px; }
  .pos-mbar { width: 100%; border: none; border-radius: 12px; padding: 13px 16px; background: var(--brand); color: #fff;
    font: inherit; font-weight: 700; font-size: 15px; box-shadow: var(--shadow-lg); cursor: pointer; }
  .pos-mbar.hidden { display: none; }
}
.cart-items { max-height: 46vh; overflow-y: auto; }
.cart-line { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 11px 0; border-bottom: 1px dashed var(--border); }
.cart-line .cl-name { font-weight: 600; }
.cart-line .cl-price { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.qty button { border: none; background: var(--surface-2); width: 26px; height: 26px; cursor: pointer; font-size: 15px; color: var(--text); }
.qty span { min-width: 28px; text-align: center; font-weight: 600; font-size: 13px; }
.totals { padding-top: 10px; }
.totals .t-line { display: flex; justify-content: space-between; padding: 4px 0; color: var(--muted); }
.totals .t-line.grand { color: var(--text); font-weight: 800; font-size: 19px; border-top: 1px solid var(--border); margin-top: 6px; padding-top: 10px; }

/* ---------- Modal ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(10,22,33,.5); backdrop-filter: blur(3px); z-index: 100;
  display: grid; place-items: center; padding: 20px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); width: 560px; max-width: calc(100vw - 40px);
  max-height: 90vh; display: flex; flex-direction: column; animation: pop .18s; }
.modal.wide { width: 760px; }
@keyframes pop { from { transform: translateY(12px) scale(.98); opacity: 0; } }
.modal-head { display: flex; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot { padding: 15px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.pu-add-row #pu-prod { flex: 1; min-width: 0; }
@media (max-width: 480px) { /* phones: document tables fit the modal; purchase product picker gets its own line */
  .modal-body .tbl th, .modal-body .tbl td { padding: 10px 6px; }
  .pu-add-row { flex-wrap: wrap; }
  .pu-add-row #pu-prod { flex: 1 1 100%; width: 100%; min-width: 0; }
  .pu-add-row #pu-cost { flex: 1; min-width: 0; }
}

/* ---------- Toast ---------- */
#toast-root { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--text); color: var(--surface); padding: 12px 16px; border-radius: 11px; font-weight: 600;
  font-size: 13px; box-shadow: var(--shadow-lg); animation: slidein .2s; max-width: 320px; }
.toast.ok { background: var(--ok); color: #fff; }
.toast.danger { background: var(--danger); color: #fff; }
@keyframes slidein { from { transform: translateX(20px); opacity: 0; } }

/* ---------- Misc ---------- */
.progress { height: 7px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--teal)); }
.list-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.list-head .search { width: 300px; }
.detail-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; align-items: start; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px 12px; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; font-weight: 500; }
.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline .ti { display: grid; grid-template-columns: 20px 1fr; gap: 12px; padding-bottom: 16px; position: relative; }
.timeline .ti::before { content: ''; position: absolute; left: 9px; top: 18px; bottom: -2px; width: 2px; background: var(--border); }
.timeline .ti:last-child::before { display: none; }
.timeline .ti .tdot { width: 10px; height: 10px; border-radius: 50%; background: var(--brand); margin-top: 5px; }

a.btn { text-decoration: none; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- Notifications ---------- */
.bell-wrap { position: relative; }
.bell { position: relative; font-size: 18px; line-height: 1; padding: 7px 9px; }
.bell-count { position: absolute; top: 0; right: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 800; display: grid; place-items: center; }
.notif-pop { position: absolute; right: 0; top: calc(100% + 8px); width: 350px; max-width: calc(100vw - 24px); z-index: 50;
  box-shadow: var(--shadow-lg); overflow: hidden; }
.notif-item { display: flex; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--border); cursor: pointer; align-items: flex-start; }
.notif-item:hover { background: var(--surface-2); }
.notif-item .n-ico { font-size: 16px; width: 22px; text-align: center; }

/* ---------- Reminders ---------- */
.rem { display: grid; grid-template-columns: 38px 1fr auto; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); align-items: center; }
.rem:last-child { border-bottom: none; }
.rem-ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-size: 17px; background: rgba(14,125,196,.12); }
.rem-ico.reorder { background: var(--warn-bg); }
.rem-ico.manual { background: rgba(142,91,214,.14); }
.rem-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* ---------- Maps ---------- */
.map { height: 420px; border-radius: var(--radius); overflow: hidden; background: var(--surface-2); position: relative; z-index: 0; }
.map-sm { height: 190px; } .map-md { height: 260px; } .map-lg { height: 560px; }
.map-fallback { height: auto !important; min-height: 150px; padding: 18px; border: 1px dashed var(--border); }
.map-fallback a { display: inline-block; margin: 4px 10px 0 0; font-weight: 600; font-size: 12.5px; }
.num-pin span { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--brand); color: #fff;
  font-weight: 800; font-size: 12px; border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.35); font-family: var(--font); }
.num-pin.hq span { background: #14202b; font-size: 10px; }
.num-pin.done span { background: var(--ok); }
.legend { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-right: 12px; }
.ldot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--border); }
.leaflet-container { font-family: var(--font); }

/* ---------- Kanban ---------- */
.kanban { display: grid; grid-template-columns: repeat(5, minmax(220px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 6px; align-items: start; }
.kcol { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; min-height: 320px; transition: .12s; }
.kcol.drop { border-color: var(--brand); background: rgba(14,125,196,.07); }
.kcol-head { display: flex; align-items: center; gap: 8px; font-weight: 700; margin: 2px 4px 10px; }
.kcol-head .t-sub { margin-left: auto; font-weight: 600; }
.kcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 11px 12px; margin-bottom: 9px;
  cursor: grab; box-shadow: var(--shadow); transition: .12s; }
.kcard:hover { border-color: var(--brand); }
.kcard.dragging { opacity: .45; }
.kcard .kc-val { font-weight: 800; font-size: 15px; }
.kcard .kc-foot { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.kcard .kc-foot .btn { padding: 3px 8px; }
.avatar.xs { width: 22px; height: 22px; font-size: 9.5px; flex-shrink: 0; }
.kcard .badge, .kcol-head .badge { white-space: nowrap; }
.cart-line .qty { justify-self: start; }

/* ---------- POS line editing ---------- */
.cl-edit { grid-column: 1 / -1; display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.cl-edit label { display: grid; gap: 3px; font-size: 11px; font-weight: 600; color: var(--muted); }
.cl-edit input { width: 92px; padding: 5px 8px; text-align: right; font-size: 13px; }
.cl-edit input.overridden { border-color: var(--warn); background: var(--warn-bg); }
.cl-edit .cl-note { font-size: 11.5px; color: var(--muted); padding-bottom: 6px; }
.strike { text-decoration: line-through; color: var(--muted-2); font-weight: 500; font-size: 12px; }

/* ---------- My Day stops ---------- */
.stop { display: grid; grid-template-columns: 34px 1fr; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.stop:last-child { border-bottom: none; }
.stop-num { width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 12.5px; }
.stop.done .stop-num { background: var(--ok); }
.stop-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 9px; }

/* ---------- Documents (statements / receipts) ---------- */
.doc-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.doc-head h3 { margin: 0 0 4px; }
.tbl tfoot td { font-weight: 700; border-top: 2px solid var(--border); }
.tbl tr.subtotal td { background: var(--surface-2); font-weight: 700; }
.tbl tr.static, .tbl.static tbody tr { cursor: default; }
.stat-row { display: flex; gap: 22px; flex-wrap: wrap; margin-top: 8px; }
.stat-row > div { min-width: 120px; }

@media (max-width: 1000px) {
  .cols-4 { grid-template-columns: repeat(2, 1fr); }
  .cols-3 { grid-template-columns: 1fr; }
  .pos { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 60; width: 260px; transform: translateX(-100%); transition: .2s; }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .menu-btn { display: block; }
  .search { width: 150px; }
  .cols-4, .cols-2, .form-grid { grid-template-columns: 1fr; }
  .view { padding: 16px; }
  .topbar-actions .search { display: none; }
  .topbar { padding: 10px 14px; gap: 8px; }
  .crumb { font-size: 15px; }
  #quick-sale { padding: 8px 11px; }
  .notif-pop { position: fixed; left: 12px; right: 12px; top: 58px; width: auto; }
  .kanban { grid-template-columns: repeat(5, 240px); }
  .map-lg { height: 380px; }
  .rem { grid-template-columns: 38px 1fr; }
  .rem-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .list-head .search { width: 100%; }
}

/* ---------- TVA toggle ---------- */
.tva-toggle { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; font-size: 12.5px; color: var(--text); cursor: pointer; }
.tva-toggle input { width: 16px; height: 16px; margin: 0; padding: 0; accent-color: var(--brand); cursor: pointer; }

/* ---------- Service calendar ---------- */
.cal-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; }
.cal-title { font-weight: 800; font-size: 17px; letter-spacing: -.3px; min-width: 190px; }
.cal-nav { display: inline-flex; gap: 6px; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 4px 0; margin-bottom: 12px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--border);
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.cal-dow { background: var(--surface-2); color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; padding: 8px 10px; }
.cal-day { background: var(--surface); min-height: 116px; padding: 6px; display: flex; flex-direction: column; gap: 3px; cursor: pointer; min-width: 0; transition: background .12s; }
.cal-day:hover { background: var(--surface-2); }
.cal-day.out { background: var(--surface-2); }
.cal-day.out .cal-dnum { color: var(--muted-2); }
.cal-dnum { font-size: 12px; font-weight: 700; min-width: 24px; height: 24px; padding: 0 6px; display: inline-grid; place-items: center; border-radius: 999px; align-self: flex-start; }
.cal-day.today .cal-dnum { background: var(--brand); color: #fff; }
.cal-week .cal-day { min-height: 380px; }
.cal-chip { --c: var(--brand); display: flex; align-items: center; gap: 5px; width: 100%; min-width: 0; border: none; border-left: 3px solid var(--c);
  background: color-mix(in srgb, var(--c) 13%, var(--surface)); color: var(--text); font: inherit; font-size: 11.5px; font-weight: 600;
  padding: 3px 5px 3px 6px; border-radius: 6px; cursor: pointer; text-align: left; line-height: 1.3; }
.cal-chip:hover { background: color-mix(in srgb, var(--c) 24%, var(--surface)); }
.cal-chip .cc-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-chip .cc-time { color: var(--muted); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.cal-chip .dot { width: 7px; height: 7px; flex-shrink: 0; }
.cal-chip .avatar.xs { width: 18px; height: 18px; font-size: 8.5px; }
.cal-chip.done { opacity: .62; }
.cal-chip.cancel .cc-t { text-decoration: line-through; }
.cal-chip.overdue { box-shadow: inset 0 0 0 1px var(--danger); }
.cal-chip .cc-proj { flex-shrink: 0; font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--c); }
.cal-chip.projected { opacity: .6; border-left-style: dashed; background: transparent; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 45%, transparent); font-weight: 500; }
.ck-Installation { --c: #0e7dc4; } .ck-Service { --c: #12b3a6; } .ck-Repair { --c: #d98a15; } .ck-Visit { --c: #5b6ee1; }
.ck-maintenance { --c: #8e5bd6; } .ck-reminder { --c: #c0569a; }
.cal-more { border: none; background: none; padding: 1px 4px; font: inherit; font-size: 11px; font-weight: 700; color: var(--brand); cursor: pointer; text-align: left; }
.cal-agenda { display: none; }
.cal-ag-day { padding: 12px 14px; border-bottom: 1px solid var(--border); display: grid; gap: 6px; }
.cal-ag-day:last-child { border-bottom: none; }
.cal-ag-day.today { background: rgba(14,125,196,.06); }
.cal-ag-head { display: flex; align-items: center; gap: 8px; }
.cal-ag-day .cal-chip { font-size: 13px; padding: 7px 8px; }
@media (max-width: 760px) {
  .cal-grid-wrap { display: none; }
  .cal-agenda { display: block; }
  .cal-title { min-width: 0; flex: 1 1 100%; }
}

/* ---------- M5: bell (details/summary), map notes ---------- */
.bell-wrap > summary { list-style: none; cursor: pointer; }
.bell-wrap > summary::-webkit-details-marker { display: none; }
a.notif-item { color: var(--text); text-decoration: none; }
.map-note { position: absolute; left: 8px; right: 8px; bottom: 8px; z-index: 500; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 10px; font-size: 12.5px; box-shadow: var(--shadow); max-height: 40%; overflow-y: auto; }
.map-note a { display: inline-block; margin: 2px 10px 0 0; font-weight: 600; }
.cal-chip, .rem a.t-strong, .kcard a, a.badge { text-decoration: none; }
.tbl .badge { white-space: nowrap; }

/* Logo images (sources: workspace/build/site-src/logo-transparent.png, logo-white.png) */
:root { --logo-navy: url("../img/logo-transparent.png"); --logo-white: url("../img/logo-white.png"); --logo: var(--logo-navy); }
:root[data-theme="dark"] { --logo: var(--logo-white); }

/* ---------- Print: only the open document (modal) or the current view ---------- */
@media print {
  body { background: #fff; }
  .sidebar, .topbar, #toast-root, .no-print, .modal-foot, .modal-head .icon-btn { display: none !important; }
  .shell { display: block; }
  .view { padding: 0; max-width: none; }
  .card { box-shadow: none; }
  body.has-modal #shell { display: none !important; }
  .modal-overlay { position: static; background: none; backdrop-filter: none; padding: 0; display: block; }
  .modal { box-shadow: none; max-height: none; width: 100% !important; max-width: none; border-radius: 0; }
  .modal-body { overflow: visible; }
  .pp-logo { background-image: var(--logo-navy) !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}


/* ===== Django app additions (M1) — not in the demo ===== */
a.nav-item { text-decoration: none; }
.sidebar-foot form { margin: 0; }
.user-chip .uc-name { font-weight: 700; color: var(--text); }
.user-chip .uc-role { color: var(--muted); font-size: 11.5px; }
.logout-btn { margin-left: auto; }
.flash { margin-bottom: 14px; padding: 11px 14px; border-radius: var(--radius-sm); font-weight: 600; background: var(--ok-bg); color: var(--ok); }
.flash.error { background: var(--danger-bg); color: var(--danger); }
.errorlist { list-style: none; margin: 2px 0 0; padding: 0; color: var(--danger); font-size: 12px; font-weight: 600; }
.field-help { color: var(--muted); font-size: 11.5px; font-weight: 500; }
.auth-error { background: var(--danger-bg); color: var(--danger); padding: 9px 12px; border-radius: var(--radius-sm); font-weight: 600; font-size: 12.5px; }
.sidebar-backdrop { display: none; }
@media (max-width: 760px) {
  .sidebar-backdrop.open { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(10,22,33,.35); }
}


/* ---------- M2: list paging, notices, forms ---------- */
.pager { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.flash.warn-flash { background: var(--warn-bg); color: var(--warn); }
.flash.warn-flash a { color: inherit; text-decoration: underline; }
.kv.kv-wide { grid-template-columns: minmax(130px, 34%) 1fr; }
.loc-block { padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px dashed var(--border); }
label.field input[type=checkbox] { justify-self: start; width: auto; }
.tbl tbody tr[data-href] a { color: inherit; text-decoration: none; }


/* ---------- M3: sales screens ---------- */
.pill-tabs a { flex: 0 0 auto; white-space: nowrap; padding: 7px 14px; border-radius: 8px; font-weight: 600; font-size: 13px;
  color: var(--muted); text-decoration: none; }
.pill-tabs a.active { background: var(--surface); color: var(--brand); box-shadow: var(--shadow); }
.qty input { width: 52px; border: none; border-radius: 0; padding: 0 2px; height: 26px; text-align: center; font-weight: 600;
  font-size: 13px; background: var(--surface); -moz-appearance: textfield; }
.qty input::-webkit-outer-spin-button, .qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.cl-rem { grid-column: 1 / -1; display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; padding: 8px 10px;
  background: var(--surface-2); border-radius: 8px; }
.cl-rem label { display: grid; gap: 3px; font-size: 11px; font-weight: 600; color: var(--muted); }
.cl-rem label.grow { flex: 1; min-width: 180px; }
.cl-rem select, .cl-rem input { padding: 5px 8px; font-size: 13px; }
.cl-rem .cl-note { font-size: 11.5px; color: var(--muted); padding-bottom: 6px; }
.doc-foot-grid { display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start; margin-top: 8px; }
@media (max-width: 760px) { .doc-foot-grid { grid-template-columns: 1fr; } }
.doc-card .doc-logo { width: 190px; margin-bottom: 8px; }

/* M4: header action groups align right like single buttons; plain row links; narrow-screen tables */
.section-title > .row { margin-left: auto; }
a.plain { color: inherit; text-decoration: none; }
a.plain:hover { text-decoration: underline; }
.show-sm { display: none; }
@media (max-width: 760px) { .tbl .col-sku { display: none; } .show-sm { display: block; } }
