:root {
  --chrome: #d4d9df;
  --chrome-2: #c2c9d1;
  --chrome-line: #9aa3ad;
  --chrome-dark: #7d8893;
  --title-1: #1a6e8e;
  --title-2: #0c4256;
  --accent: #c8102e;        /* Mitchell 1 red */
  --accent-dk: #9e0c24;
  --ink: #16202a;
  --muted: #54616e;
  --grid-bg: #ffffff;
  --grid-alt: #f1f5f8;
  --grid-line: #d3dade;
  --grid-head: #e6ebef;
  --grid-head-2: #d2dae0;
  --sel: #b9d8ff;
  --sel-line: #4a90d9;
  --est: #5b6670;           /* estimate = gray */
  --ro: #14181d;            /* repair order = black */
  --inv: #1457c8;           /* posted invoice = blue */
  --red: #c8102e;
  --ok: #15803d;
  --warn: #b45309;
  --ui: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  --mono: "Consolas", "SFMono-Regular", Menlo, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { background: #eef1f4; color: var(--ink); font-family: var(--ui); font-size: 13px; overflow: hidden; }
button, input, select { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--sel-line); outline-offset: 1px; }
.sr-only, .skip-link { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.skip-link:focus { position: fixed; width: auto; height: auto; clip: auto; top: 8px; left: 8px; background: #fff; padding: 6px 10px; z-index: 200; }
.eyebrow { color: var(--muted); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; margin: 0; }

/* ===== Lock screen ===== */
.lock-screen {
  position: fixed; inset: 0; z-index: 80;
  display: grid; place-items: center; padding: 1.5rem;
  background: linear-gradient(135deg, #0c4256, #1a6e8e);
}
.lock-card { width: 100%; max-width: 27rem; background: #fff; border: 1px solid var(--chrome-dark); box-shadow: 0 18px 50px rgba(0,0,0,.35); padding: 1.5rem; border-radius: 3px; }
.lock-brand { display: flex; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.lock-mark, .tb-mark { background: var(--accent); color: #fff; font-weight: 800; letter-spacing: -.02em; }
.lock-mark { width: 3rem; height: 3rem; border-radius: 6px; display: grid; place-items: center; font-size: 1.25rem; }
.lock-brand h1 { margin: 0; font-size: 1.6rem; color: var(--title-2); letter-spacing: -.01em; }
.lock-copy { color: var(--muted); margin: 0 0 1.1rem; }
.lock-card label { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--muted); margin-bottom: .35rem; }
.lock-row { display: grid; grid-template-columns: 1fr auto; border: 1px solid var(--chrome-dark); border-radius: 3px; overflow: hidden; }
.lock-row input { border: 0; padding: .7rem .8rem; min-width: 0; }
.lock-row button { border: 0; background: linear-gradient(#2a86a8, #0e4d66); color: #fff; font-weight: 700; padding: 0 1.3rem; }
.lock-error { color: var(--red); min-height: 1.3rem; margin: .5rem 0 0; }
.lock-foot { color: var(--muted); font-size: 11px; margin: 1rem 0 0; text-align: center; }

/* ===== App frame ===== */
.app { display: grid; grid-template-rows: auto auto auto minmax(0,1fr) auto; height: 100vh; }

.titlebar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; background: linear-gradient(#1a6e8e, #0c4256); color: #fff; padding: .3rem .6rem; min-height: 2rem; }
.tb-left { display: flex; align-items: center; gap: .55rem; min-width: 0; }
.tb-mark { width: 1.4rem; height: 1.4rem; border-radius: 4px; display: grid; place-items: center; font-size: .72rem; }
.tb-title { font-weight: 700; }
.tb-shop { color: rgba(255,255,255,.8); font-size: 12px; border-left: 1px solid rgba(255,255,255,.3); padding-left: .55rem; }
.tb-right { display: flex; align-items: center; gap: .7rem; }
.tb-sync { font-size: 11px; color: rgba(255,255,255,.85); font-family: var(--mono); }
.tb-clock { font-variant-numeric: tabular-nums; font-size: 12px; }
.tb-x { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.25); color: #fff; border-radius: 3px; line-height: 1; padding: .15rem .45rem; }
.tb-x:hover { background: var(--accent); border-color: var(--accent); }

.menubar { display: flex; background: var(--chrome); border-bottom: 1px solid var(--chrome-line); padding: 0 .25rem; }
.menubar > button { background: transparent; border: 0; padding: .35rem .7rem; color: var(--ink); font-size: 12px; }
.menubar > button:hover, .menubar > button.is-open { background: var(--sel); }

.buttonbar { display: flex; gap: .25rem; background: linear-gradient(#e9edf1, #cdd4db); border-bottom: 1px solid var(--chrome-line); padding: .35rem .4rem; }
.bb { display: grid; justify-items: center; gap: .12rem; min-width: 4.1rem; padding: .3rem .35rem; background: linear-gradient(#fbfcfd, #dde3e9); border: 1px solid var(--chrome-dark); border-radius: 4px; color: var(--ink); font-size: 11px; font-weight: 600; }
.bb:hover { background: linear-gradient(#ffffff, #e7edf3); border-color: var(--sel-line); }
.bb.is-active { background: linear-gradient(#cfe6f3, #a9d2e8); border-color: var(--title-2); box-shadow: inset 0 1px 2px rgba(0,0,0,.12); }
.bb-ico { font-size: 1.05rem; line-height: 1; }
.bb-right { margin-left: auto; }

.workarea { min-height: 0; overflow: auto; padding: .6rem; background: #eef1f4; position: relative; }
.alert { margin-bottom: .6rem; padding: .55rem .75rem; border: 1px solid #c9b458; background: #fff8d6; color: #5a4a00; border-radius: 3px; }
.alert.status-good { border-color: #86c79b; background: #e8f7ee; color: #14532d; }
.alert.status-bad { border-color: #e0a0a0; background: #fdeeee; color: #7f1d1d; }

.screen { display: none; }
.screen.is-active { display: block; }
.screen-titlebar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .5rem; }
.screen-titlebar h2 { margin: 0; font-size: 1.1rem; color: var(--title-2); }

/* ===== WIP tools ===== */
.wip-tools { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.wip-filter { font-size: 12px; color: var(--muted); }
.wip-filter select, .wip-search input { border: 1px solid var(--chrome-dark); border-radius: 3px; padding: .3rem .5rem; background: #fff; }
.wip-search input { min-width: 16rem; }
.wip-count { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ===== Data grid ===== */
.grid-wrap { background: var(--grid-bg); border: 1px solid var(--chrome-dark); border-radius: 2px; overflow: auto; max-height: calc(100vh - 16rem); }
.m1-grid { border-collapse: collapse; width: 100%; font-size: 12.5px; white-space: nowrap; }
.m1-grid thead th {
  position: sticky; top: 0; z-index: 1;
  background: linear-gradient(var(--grid-head), var(--grid-head-2));
  border-right: 1px solid var(--chrome-line); border-bottom: 1px solid var(--chrome-dark);
  color: var(--title-2); font-size: 11px; text-transform: uppercase; letter-spacing: .03em;
  padding: .4rem .55rem; text-align: left; cursor: pointer; user-select: none;
}
.m1-grid thead th.r { text-align: right; }
.m1-grid thead th .sortcaret { color: var(--accent); margin-left: .25rem; }
.m1-grid tbody td { border-right: 1px solid var(--grid-line); border-bottom: 1px solid var(--grid-line); padding: .34rem .55rem; }
.m1-grid tbody td.r { text-align: right; font-variant-numeric: tabular-nums; }
.m1-grid tbody tr:nth-child(even) td { background: var(--grid-alt); }
.m1-grid tbody tr:hover td { background: #fff7d6; }
.m1-grid tbody tr.is-sel td { background: var(--sel); box-shadow: inset 0 0 0 9999px rgba(74,144,217,.12); }
.m1-grid tbody tr { cursor: pointer; }
.m1-grid .type-cell { font-weight: 800; font-size: 11px; }
.m1-grid .mono { font-family: var(--mono); }

/* Order type coloring (M1: gray EST, black RO, blue posted INV) */
tr.t-EST td { color: var(--est); }
tr.t-RO td { color: var(--ro); }
tr.t-INV td { color: var(--inv); }
tr.t-EST .type-cell { color: var(--est); }
tr.t-RO .type-cell { color: var(--ro); }
tr.t-INV .type-cell { color: var(--inv); }
td.red-flag { color: var(--red) !important; font-weight: 700; }

.status-pill { display: inline-block; padding: .05rem .5rem; border-radius: 999px; font-size: 11px; font-weight: 700; border: 1px solid transparent; }
.st-in_progress, .st-active { background: #fff3df; color: #9a5b00; border-color: #f0c98a; }
.st-waiting_parts { background: #fdeedd; color: #9a4b00; border-color: #f0b98a; }
.st-approved { background: #e3f1fb; color: #0c5; color: #0e5aa7; border-color: #a9cdec; }
.st-estimate { background: #eef0f2; color: #5b6670; border-color: #cdd4db; }
.st-completed, .st-invoiced, .st-paid { background: #e8f7ee; color: #14532d; border-color: #9bd3ad; }

/* ===== WIP actions / legend ===== */
.wip-actions { display: flex; gap: .4rem; margin-top: .5rem; flex-wrap: wrap; }
.m1-btn { background: linear-gradient(#fbfcfd, #dde3e9); border: 1px solid var(--chrome-dark); border-radius: 4px; padding: .4rem .9rem; font-weight: 600; color: var(--ink); }
.m1-btn:hover { border-color: var(--sel-line); background: linear-gradient(#fff, #e7edf3); }
.m1-btn-primary { background: linear-gradient(#2a86a8, #0e4d66); color: #fff; border-color: var(--title-2); }
.m1-btn-primary:hover { background: linear-gradient(#2f93b8, #0c4458); }
.m1-btn:disabled { opacity: .5; cursor: default; }
.wip-legend { display: flex; gap: 1.1rem; margin-top: .6rem; color: var(--muted); font-size: 11px; flex-wrap: wrap; }
.wip-legend span { display: inline-flex; align-items: center; gap: .35rem; }
.sw { width: .8rem; height: .8rem; border-radius: 2px; display: inline-block; border: 1px solid rgba(0,0,0,.2); }
.sw-est { background: var(--est); } .sw-ro { background: var(--ro); } .sw-inv { background: var(--inv); } .sw-red { background: var(--red); }

/* ===== States ===== */
.empty-state, .loading-state { display: grid; gap: .35rem; place-content: center; min-height: 12rem; padding: 2rem; text-align: center; color: var(--muted); }
.empty-state strong, .loading-state strong { color: var(--ink); font-size: 1rem; }

/* ===== Order screen ===== */
.order-pane { display: grid; gap: .6rem; }
.order-head { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: .6rem; }
.order-card { background: #fff; border: 1px solid var(--chrome-dark); border-radius: 3px; }
.order-card h3 { margin: 0; background: linear-gradient(var(--grid-head), var(--grid-head-2)); border-bottom: 1px solid var(--chrome-dark); color: var(--title-2); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding: .4rem .6rem; }
.order-card .oc-body { padding: .6rem; display: grid; gap: .3rem; }
.kv { display: grid; grid-template-columns: 7.5rem 1fr; gap: .4rem; font-size: 12.5px; }
.kv span { color: var(--muted); }
.kv strong { font-weight: 700; }
.job { border: 1px solid var(--chrome-dark); border-radius: 3px; background: #fff; }
.job-h { display: flex; justify-content: space-between; align-items: center; background: #eaf2f7; border-bottom: 1px solid var(--chrome-line); padding: .4rem .6rem; font-weight: 700; color: var(--title-2); }
.li-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.li-table th { text-align: left; color: var(--muted); font-size: 11px; text-transform: uppercase; padding: .3rem .55rem; border-bottom: 1px solid var(--grid-line); }
.li-table td { padding: .32rem .55rem; border-bottom: 1px solid var(--grid-line); }
.li-table .r { text-align: right; font-variant-numeric: tabular-nums; }
.li-type { display: inline-block; min-width: 3.2rem; font-size: 10px; font-weight: 800; text-transform: uppercase; color: var(--muted); }
.order-totals { display: flex; justify-content: flex-end; }
.order-totals table { font-size: 13px; }
.order-totals td { padding: .2rem .6rem; }
.order-totals .grand td { font-weight: 800; font-size: 15px; border-top: 2px solid var(--chrome-dark); color: var(--title-2); }
.order-actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.backlink { background: none; border: 0; color: var(--accent); font-weight: 700; padding: 0; }

/* ===== Reports ===== */
.reports-pane { display: grid; gap: .8rem; }
.metric-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: .6rem; }
.metric { background: #fff; border: 1px solid var(--chrome-dark); border-radius: 3px; padding: .7rem .8rem; }
.metric span { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; }
.metric strong { display: block; font-size: 1.9rem; color: var(--title-2); letter-spacing: -.03em; }
.report-cats { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem,1fr)); gap: .6rem; }
.report-cat { background: #fff; border: 1px solid var(--chrome-dark); border-radius: 3px; padding: .7rem .8rem; }
.report-cat h4 { margin: 0 0 .4rem; color: var(--title-2); font-size: 12px; text-transform: uppercase; }
.report-cat ul { margin: 0; padding-left: 1rem; color: var(--muted); font-size: 12px; line-height: 1.7; }

/* ===== Sync ===== */
.sync-pane { display: grid; gap: .5rem; max-width: 40rem; }
.sync-row { display: grid; grid-template-columns: 12rem 1fr; gap: .5rem; background: #fff; border: 1px solid var(--chrome-dark); border-radius: 3px; padding: .55rem .7rem; }
.sync-row span:first-child { color: var(--muted); }

/* ===== Status bar ===== */
.statusbar { display: flex; align-items: center; gap: .6rem; background: var(--chrome); border-top: 1px solid var(--chrome-line); padding: .25rem .6rem; font-size: 11px; color: var(--muted); }
.sb-sep { color: var(--chrome-dark); }
.sb-spacer { flex: 1; }

/* ===== Menu popover ===== */
.menu-popover { position: fixed; z-index: 90; background: #fff; border: 1px solid var(--chrome-dark); box-shadow: 0 10px 24px rgba(0,0,0,.25); min-width: 13rem; padding: .25rem; }
.menu-item { display: block; width: 100%; text-align: left; background: none; border: 0; padding: .4rem .6rem; font-size: 12.5px; color: var(--ink); }
.menu-item:hover { background: var(--sel); }

/* ===== Scheduler (block calendar) ===== */
.sched-root { display: grid; grid-template-rows: auto minmax(0,1fr); height: calc(100vh - 11rem); min-height: 22rem; min-width: 0; overflow: hidden; background: #fff; border: 1px solid var(--chrome-dark); border-radius: 2px; }
.sched-root > *, .sched-body, .cal, .month, .month-grid, .month-head, .inshop, .inshop-grid { min-width: 0; max-width: 100%; }
/* Scheduler body: Day = calendar + side rail; Week/Month = calendar + board below */
.sched-body { min-height: 0; }
.sched-body.day { display: grid; grid-template-columns: minmax(0,1fr) 19rem; }
.sched-body.wide { display: grid; grid-template-rows: minmax(0,1.35fr) minmax(0,1fr); }
.inshop { display: flex; flex-direction: column; min-height: 0; background: var(--grid-alt); }
.sched-body.day .inshop { border-left: 1px solid var(--chrome-dark); }
.sched-body.wide .inshop { border-top: 1px solid var(--chrome-dark); }
.inshop-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .4rem .6rem; background: linear-gradient(var(--grid-head), var(--grid-head-2)); border-bottom: 1px solid var(--chrome-dark); }
.inshop-title { font-weight: 800; font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: var(--title-2); }
.inshop-tools { display: flex; align-items: center; gap: .4rem; }
.inshop-count { font-size: 11px; background: #fff3df; border: 1px solid #f0c98a; color: #9a5b00; border-radius: 999px; padding: .1rem .55rem; }
.inshop-sum { font-size: 12px; font-weight: 800; color: #14532d; }
.inshop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem,1fr)); gap: .4rem; padding: .5rem; overflow: auto; align-content: start; }
.sched-body.day .inshop-grid { grid-template-columns: 1fr; }
.inshop-card { background: #fff; border: 1px solid var(--chrome-line); border-left: 4px solid var(--chrome-dark); border-radius: 3px; display: grid; gap: .08rem; padding: .35rem .45rem; text-align: left; cursor: pointer; }
.inshop-card:hover { background: #fff7d6; }
.ic-top { display: flex; justify-content: space-between; gap: .4rem; }
.ic-ro { font-weight: 800; font-size: 12px; color: var(--title-2); }
.ic-amt { font-weight: 800; font-size: 12px; color: #14532d; }
.ic-name { font-weight: 700; font-size: 12px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ic-veh { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ic-meta { display: flex; align-items: center; gap: .3rem; font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .02em; }
.mi-note { margin: .15rem 0 0; font-size: 12px; color: var(--ink); white-space: pre-wrap; line-height: 1.35; }
.mi-table tr.mi-click { cursor: pointer; }
.mi-table tr.mi-click:hover { background: #fff7d6; }
.sched-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem; background: linear-gradient(var(--grid-head), var(--grid-head-2)); border-bottom: 1px solid var(--chrome-dark); padding: .45rem .6rem; }
.sched-nav, .sched-views { display: flex; align-items: center; gap: .3rem; }
.sched-btn { background: linear-gradient(#fbfcfd, #dde3e9); border: 1px solid var(--chrome-dark); border-radius: 4px; font-size: 12px; font-weight: 600; padding: .25rem .6rem; }
.sched-btn.is-active { background: linear-gradient(#2a86a8, #0e4d66); color: #fff; border-color: var(--title-2); }
.sched-range { font-weight: 800; margin-left: .4rem; color: var(--title-2); }
.sched-meta { display: flex; gap: .4rem; font-size: 11px; color: var(--muted); }
.sched-count { background: #e3f1fb; border: 1px solid #a9cdec; border-radius: 999px; padding: .1rem .55rem; }
.sched-count.wip { background: #fff3df; border-color: #f0c98a; color: #9a5b00; }
.wip-strip { display: none; }

.cal { --cal-days: 6; display: grid; grid-auto-rows: min-content; overflow: auto; min-height: 0; }
.cal-head, .cal-row { display: grid; grid-template-columns: 3.4rem repeat(var(--cal-days), minmax(0,1fr)); }
.cal-head { position: sticky; top: 0; z-index: 2; }
.cal-corner, .cal-dayhead { background: var(--grid-head-2); border-right: 1px solid var(--grid-line); border-bottom: 1px solid var(--chrome-dark); color: var(--title-2); font-size: 11px; padding: .35rem .4rem; text-transform: uppercase; }
.cal-dayhead { display: flex; align-items: baseline; justify-content: center; gap: .35rem; flex-wrap: wrap; }
.cal-dayhead .dh-num { font-size: .95rem; font-weight: 800; color: var(--ink); }
.cal-dayhead.is-today { background: linear-gradient(#2a86a8,#0e4d66); color: #fff; }
.cal-dayhead.is-today .dh-num { color: #fff; }
.dh-shop { background: #fff3df; border: 1px solid #f0c98a; border-radius: 999px; color: #9a5b00; font-size: .62rem; font-weight: 700; padding: 0 .4rem; }
.cal-rowlabel { background: var(--grid-alt); border-right: 1px solid var(--grid-line); border-bottom: 1px solid var(--grid-line); color: var(--muted); font-size: 11px; padding: .3rem .35rem; text-align: right; }
.cal-cell { border-right: 1px solid var(--grid-line); border-bottom: 1px solid var(--grid-line); display: grid; gap: .2rem; min-height: 2.5rem; padding: .2rem; }
.cal-cell.is-today-col { background: #fffdf2; }
.cal-allday .cal-cell, .cal-allday .cal-rowlabel { background: #fbf7e6; }
.cal-empty { padding: 1.5rem; text-align: center; color: var(--muted); }

.appt-block, .wip-block { background: #fff; border: 1px solid var(--chrome-line); border-left: 4px solid var(--title-1); border-radius: 3px; display: grid; gap: .04rem; padding: .25rem .35rem; text-align: left; width: 100%; }
.appt-block:hover, .wip-block:hover { background: #fff7d6; }
.ab-top, .wb-top { display: flex; justify-content: space-between; gap: .3rem; }
.ab-time { color: var(--muted); font-size: 10px; font-family: var(--mono); }
.ab-amt, .wb-amt { font-weight: 800; font-size: 11px; }
.ab-name, .wb-name { font-weight: 700; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ab-veh, .wb-veh { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wb-ro { color: var(--muted); font-size: 10px; font-family: var(--mono); }
.wb-meta { display: flex; align-items: center; gap: .3rem; color: var(--muted); font-size: 10px; }
.cal-cell .wip-block { flex: initial; }
.dot { width: .5rem; height: .5rem; border-radius: 50%; display: inline-block; }

/* status left-border accents */
.s-scheduled { border-left-color: #1457c8; } .s-confirmed,.s-approved { border-left-color: #0e7490; }
.s-arrived,.s-active,.s-waiting { border-left-color: #d97706; } .s-estimate { border-left-color: #6d28d9; }
.s-done { border-left-color: #15803d; } .s-warn { border-left-color: var(--red); } .s-cancel { border-left-color: #8a8a8a; } .s-default { border-left-color: var(--chrome-dark); }
.dot.s-scheduled{background:#1457c8}.dot.s-confirmed,.dot.s-approved{background:#0e7490}.dot.s-arrived,.dot.s-active,.dot.s-waiting{background:#d97706}.dot.s-estimate{background:#6d28d9}.dot.s-done{background:#15803d}.dot.s-warn{background:var(--red)}.dot.s-cancel{background:#8a8a8a}.dot.s-default{background:var(--chrome-dark)}

/* Month */
.month { display: grid; grid-template-rows: auto minmax(0,1fr); overflow: auto; min-height: 0; }
.month-head { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); position: sticky; top: 0; z-index: 2; }
.month-weekday { background: var(--grid-head-2); border-right: 1px solid var(--grid-line); border-bottom: 1px solid var(--chrome-dark); color: var(--title-2); font-size: 11px; padding: .35rem .5rem; text-transform: uppercase; }
.month-grid { display: grid; grid-auto-rows: minmax(6rem,1fr); grid-template-columns: repeat(7, minmax(0,1fr)); }
.month-cell { border-right: 1px solid var(--grid-line); border-bottom: 1px solid var(--grid-line); display: flex; flex-direction: column; gap: .15rem; padding: .2rem; min-width: 0; }
.month-cell.is-out { background: #f0f3f5; }
.month-cell.is-out .month-daynum { color: var(--muted); opacity: .6; }
.month-cell.is-today { background: #fffdf2; box-shadow: inset 0 0 0 2px var(--title-1); }
.month-daynum { display: flex; justify-content: space-between; align-items: center; background: none; border: 0; font-weight: 800; padding: .05rem .15rem; }
.md-sum { color: var(--ok); font-size: 11px; }
.month-chip { display: flex; justify-content: space-between; gap: .3rem; background: #fff; border: 1px solid var(--chrome-line); border-left: 4px solid var(--title-1); border-radius: 3px; overflow: hidden; padding: .14rem .3rem; width: 100%; }
.month-chip:hover { background: #fff7d6; }
.mc-name { font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-amt { font-size: 11px; font-weight: 800; flex: 0 0 auto; }
.month-more { background: none; border: 0; color: var(--accent); font-size: 10px; font-weight: 700; text-align: left; padding: .05rem .15rem; }

/* ===== Modal ===== */
.modal-overlay { position: fixed; inset: 0; z-index: 95; background: rgba(12,42,58,.5); display: flex; align-items: center; justify-content: center; padding: 1.25rem; }
.modal-card { width: 100%; max-width: 40rem; max-height: 88vh; background: #fff; border: 1px solid var(--title-2); box-shadow: 0 20px 56px rgba(0,0,0,.4); display: grid; grid-template-rows: auto minmax(0,1fr) auto; border-radius: 3px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; background: linear-gradient(#1a6e8e,#0c4256); color: #fff; padding: .55rem .8rem; }
.modal-head h3 { margin: .05rem 0 0; font-size: 1.1rem; }
.modal-eyebrow { font-size: 11px; color: rgba(255,255,255,.75); text-transform: uppercase; letter-spacing: .08em; }
.modal-x { background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.3); color: #fff; border-radius: 3px; padding: .1rem .5rem; font-size: 1.05rem; line-height: 1; }
.modal-body { overflow: auto; padding: .85rem; display: grid; gap: .8rem; }
.modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem; }
.mi { display: grid; gap: .1rem; }
.mi span { color: var(--muted); font-size: 11px; text-transform: uppercase; }
.mi strong { font-size: .95rem; }
.mi-amt { color: var(--ok) !important; font-size: 1.15rem !important; }
.modal-section { border-top: 1px solid var(--grid-line); padding-top: .7rem; display: grid; gap: .5rem; }
.modal-label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.status-pills { display: flex; flex-wrap: wrap; gap: .35rem; }
.status-pill-btn { background: linear-gradient(#fbfcfd,#dde3e9); border: 1px solid var(--chrome-dark); border-left-width: 4px; border-radius: 999px; font-size: 12px; font-weight: 700; padding: .25rem .7rem; }
.status-pill-btn.is-active { background: linear-gradient(#2a86a8,#0e4d66); color: #fff; }
.mi-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.mi-table th, .mi-table td { border-bottom: 1px solid var(--grid-line); padding: .35rem .45rem; text-align: left; }
.mi-table th { color: var(--muted); font-size: 11px; text-transform: uppercase; }
.mi-table .r { text-align: right; }
.muted { color: var(--muted); }
.ghost-btn { background: linear-gradient(#fbfcfd,#dde3e9); border: 1px solid var(--chrome-dark); border-radius: 4px; font-weight: 600; padding: .4rem .8rem; }
.modal-msg { background: #fff8d6; border: 1px solid #c9b458; color: #5a4a00; margin: 0; padding: .45rem .6rem; border-radius: 3px; }
.modal-foot { display: flex; align-items: center; gap: .5rem; border-top: 1px solid var(--chrome-line); padding: .6rem .8rem; }
.modal-btn { background: linear-gradient(#fbfcfd,#dde3e9); border: 1px solid var(--chrome-dark); border-radius: 4px; color: var(--ink); font-weight: 700; padding: .4rem .9rem; text-decoration: none; }
.modal-btn.primary { background: linear-gradient(#2a86a8,#0e4d66); color: #fff; border-color: var(--title-2); }
.modal-foot .modal-btn:last-child { margin-left: auto; }
.modal-saving { color: var(--muted); font-size: 12px; }

@media (max-width: 820px) {
  .order-head { grid-template-columns: 1fr; }
  .modal-grid { grid-template-columns: 1fr; }
  .bb span:not(.bb-ico) { display: none; }
  .bb { min-width: 2.6rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* =================================================================== *
 * Manager SE fidelity pass — match the real TeamWorks/Manager SE look
 * =================================================================== */
.titlebar { background: linear-gradient(#3f86d6, #2256a8); padding: .25rem .5rem; min-height: 1.8rem; }
.tb-mark { background: #fff; color: #2256a8; }
.tb-title { font-weight: 600; font-size: 12.5px; }
.tb-right { gap: .25rem; }
.winbtn { width: 1.6rem; height: 1.25rem; display: inline-grid; place-items: center; background: transparent; border: 0; color: #fff; font-size: .8rem; line-height: 1; }
.winbtn:hover { background: rgba(255,255,255,.22); }
.winx:hover { background: #c8102e; }

/* Menubar */
.menubar { background: #eef1f4; }
.menubar > button { font-size: 12px; padding: .3rem .65rem; }

/* Toolbar (icon-over-label) */
.toolbar { display: flex; align-items: flex-end; gap: .15rem; background: linear-gradient(#f6f8fa, #dde3ea); border-bottom: 1px solid var(--chrome-line); padding: .3rem .4rem; }
.tbtn { display: grid; justify-items: center; gap: .15rem; min-width: 3.7rem; padding: .25rem .3rem; background: transparent; border: 1px solid transparent; border-radius: 4px; color: var(--ink); font-size: 10.5px; font-weight: 600; }
.tbtn:hover { background: #fff; border-color: var(--chrome-dark); }
.tbtn.is-active { background: #dcebf8; border-color: #2256a8; }
.tbi { width: 1.55rem; height: 1.55rem; border-radius: 4px; display: grid; place-items: center; color: #fff; font-size: .9rem; }
.tb-flex { flex: 1; }

/* Group-by bar above WIP grid */
.groupby-bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; background: #dfe4ea; border: 1px solid var(--chrome-line); border-bottom: 0; padding: .3rem .6rem; }
.gb-text { color: #6b7682; font-size: 11px; font-style: italic; }
.gb-tools { display: flex; gap: .4rem; }
.gb-tools select, .gb-tools input { border: 1px solid var(--chrome-dark); border-radius: 3px; padding: .2rem .45rem; font-size: 11px; background: #fff; }
.gb-tools input { min-width: 13rem; }
.wip-grid-wrap { max-height: calc(100vh - 20rem); border-radius: 0; }

/* WIP grid header neutral gray (not teal) */
.m1-grid thead th { background: linear-gradient(#eef1f4, #dde3ea); color: #2256a8; }

/* Customer name = blue hyperlink (M1 signature) */
.cust-link { color: #1457c8; cursor: pointer; }
.cust-link:hover { text-decoration: underline; }

/* Editable dropdown cells (Written By / Labor Tech) */
.cell-dd { display: inline-flex; align-items: center; gap: .3rem; }
.cell-dd .cap { color: #9aa3ad; font-size: .65rem; }
.cell-edit:hover { outline: 1px solid #2256a8; outline-offset: -1px; cursor: pointer; }

/* Full-cell color-coded Status column (M1 signature) */
.m1-grid tbody td.wcell-status { text-align: center; font-weight: 700; color: #fff; }
.m1-grid tbody td.wst-estimate { background: #e3e7ea; color: #4a545d; }
.m1-grid tbody td.wst-approved { background: #2e7d32; }
.m1-grid tbody td.wst-in_progress { background: #1565c0; }
.m1-grid tbody td.wst-waiting_parts { background: #8a1f2b; }
.m1-grid tbody td.wst-completed { background: #00695c; }
.m1-grid tbody td.wst-invoiced { background: #4527a0; }
.m1-grid tbody td.wst-paid { background: #2e7d32; }
.m1-grid tbody td.wst-default { background: #eceff1; color: #4a545d; }

/* Strong full-row blue selection (overrides zebra + status color) */
.m1-grid tbody tr.is-sel td { background: #2f6fb0 !important; color: #fff !important; }
.m1-grid tbody tr.is-sel td .cust-link, .m1-grid tbody tr.is-sel td .cap { color: #fff !important; }

/* WIP footer: record navigator + recall + row colors */
.wip-footer { display: flex; align-items: center; gap: 1rem; background: #eef1f4; border: 1px solid var(--chrome-line); border-top: 0; padding: .3rem .6rem; font-size: 11px; color: #5b6670; }
.record-nav { font-variant-numeric: tabular-nums; }
.recall-line { flex: 1; color: #9a5b00; }
.rowcolor-link { color: #1457c8; cursor: pointer; }
.rowcolor-link:hover { text-decoration: underline; }

/* Inline edit popover */
.inline-pop { position: fixed; z-index: 120; background: #fff; border: 1px solid var(--chrome-dark); box-shadow: 0 8px 20px rgba(0,0,0,.25); padding: .25rem; }
.inline-pop select { border: 1px solid var(--chrome-dark); border-radius: 3px; padding: .25rem; min-width: 10rem; font-size: 12px; }

/* SVG icons (no emoji) */
.tbi svg { width: 1.05rem; height: 1.05rem; stroke: #fff; fill: none; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.lock-mark, .tb-mark { background: #fff; color: #2256a8; }
.lock-mark svg, .tb-mark svg { stroke: currentColor; fill: none; stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
.tb-mark svg { width: 1rem; height: 1rem; }
.lock-mark svg { width: 1.75rem; height: 1.75rem; }
.winx { font-size: 1rem; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: .6rem; margin-bottom: .9rem; }
.kpi { background: #fff; border: 1px solid var(--chrome-dark); border-top: 3px solid #2256a8; border-radius: 3px; padding: .65rem .8rem; }
.kpi span { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .03em; }
.kpi strong { display: block; font-size: 1.7rem; color: #14304f; letter-spacing: -.03em; line-height: 1.1; }
.kpi small { color: var(--muted); font-size: 11px; }
