:root {
  /* Brand accents kept, but used the way an office app uses accent color —
     sparingly, against a neutral canvas — rather than as a big banner fill. */
  --blue: #1856a8;
  --blue-dark: #123f7c;
  --blue-light: #eaf2fc;
  --blue-line: #cfe0f7;
  --orange: #e2711d;
  --orange-dark: #c25c10;
  --green: #107c41;
  --green-bg: #dff6e8;
  --red: #c4314b;
  --red-bg: #fbe4e8;
  --amber: #8a5a00;
  --amber-bg: #fff3d6;
  --purple: #5a3aa8;
  --purple-bg: #ece3fb;

  --bg: #faf9f8;
  --panel: #ffffff;
  --panel-sunken: #f5f4f3;
  --border: #e1dfdd;
  --border-strong: #c8c6c4;
  --text: #242424;
  --text-mute: #616161;
  --text-faint: #8a8886;

  --radius: 6px;
  --radius-sm: 4px;
  --radius-lg: 8px;
  --nav-width: 236px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.10);
  font-size: 15px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

svg.icon { width: 16px; height: 16px; flex-shrink: 0; vertical-align: -3px; }

.wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px 16px 100px;
}
.wrap-wide { max-width: 1200px; }

/* ---- Top bar (login / kiosk — pages without a nav rail) -------------------- */
header.topbar {
  background: var(--panel);
  color: var(--text);
  border-bottom: 1px solid var(--border);
  padding: 12px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
header.topbar h1 { font-size: 1.1rem; margin: 0; }
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-logo-wrap {
  display: flex;
  align-items: center;
  line-height: 0;
}
.brand-logo {
  height: 30px;
  width: auto;
  display: block;
}
.brand-page {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-mute);
  padding-left: 10px;
  border-left: 1px solid var(--border);
}
header.topbar .who { font-size: 0.88rem; color: var(--text-mute); }
header.topbar a, header.topbar button.link {
  color: var(--blue);
  text-decoration: none;
  background: none;
  border: none;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}
header.topbar a:hover, header.topbar button.link:hover { text-decoration: underline; }

.lang-toggle { display: flex; gap: 6px; }
.lang-btn {
  background: var(--panel);
  color: var(--text-mute);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}
.lang-btn.active { background: var(--blue); color: #fff; border-color: var(--blue); }

/* ---- App shell: left nav rail + main column -------------------------------- */
.app-shell { display: flex; min-height: 100vh; align-items: stretch; }

.nav-rail {
  width: var(--nav-width);
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px 14px;
}
.nav-brand img { height: 26px; width: auto; display: block; }
.nav-brand-text { font-size: 0.85rem; font-weight: 700; color: var(--text); line-height: 1.2; }
.nav-brand-sub { font-size: 0.72rem; color: var(--text-mute); font-weight: 600; }

.nav-section {
  padding: 4px 8px;
}
.nav-section + .nav-section { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.nav-section-label {
  padding: 8px 10px 6px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  margin: 1px 0;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  background: none;
  border: none;
  border-left: 3px solid transparent;
  text-align: left;
  cursor: pointer;
  text-decoration: none;
}
.nav-item .icon { color: var(--text-mute); }
.nav-item:hover { background: var(--panel-sunken); }
.nav-item.active { background: var(--blue-light); color: var(--blue-dark); border-left-color: var(--blue); }
.nav-item.active .icon { color: var(--blue); }
.nav-count {
  margin-left: auto;
  background: var(--panel-sunken);
  color: var(--text-mute);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 0.7rem;
  font-weight: 700;
  min-width: 18px;
  text-align: center;
}
.nav-item.active .nav-count { background: var(--blue); color: #fff; }

.nav-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding: 12px 14px;
}
.nav-user { display: flex; align-items: center; gap: 10px; }
.nav-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.82rem;
  flex-shrink: 0;
}
.nav-user-info { min-width: 0; flex: 1; }
.nav-user-name {
  font-size: 0.85rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-user-links { font-size: 0.76rem; color: var(--text-mute); display: flex; gap: 10px; margin-top: 2px; flex-wrap: wrap; }
.nav-user-links a, .nav-user-links button {
  color: var(--text-mute);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-size: inherit;
  font-family: inherit;
  text-decoration: none;
}
.nav-user-links a:hover, .nav-user-links button:hover { color: var(--blue); text-decoration: underline; }

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.content-area { flex: 1; padding: 22px 28px 60px; max-width: 1200px; width: 100%; margin: 0 auto; }
.content-header { margin-bottom: 16px; }
.content-header h1 { font-size: 1.15rem; margin: 0 0 2px; }
.content-header p { margin: 0; color: var(--text-mute); font-size: 0.86rem; }

@media (max-width: 860px) {
  .app-shell { flex-direction: column; }
  .nav-rail {
    width: 100%;
    height: auto;
    position: sticky;
    top: 0;
    z-index: 20;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
    overflow-y: hidden;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .nav-brand { padding: 10px 12px; flex-shrink: 0; }
  .nav-section { display: flex; padding: 6px 6px; }
  .nav-section + .nav-section { margin-top: 0; padding-top: 6px; border-top: none; border-left: 1px solid var(--border); }
  .nav-section-label { display: none; }
  .nav-item { width: auto; white-space: nowrap; border-left: none; border-bottom: 3px solid transparent; }
  .nav-item.active { border-left-color: transparent; border-bottom-color: var(--blue); }
  .nav-footer { margin-top: 0; border-top: none; border-left: 1px solid var(--border); flex-shrink: 0; }
  .content-area { padding: 16px 14px 60px; }
}

/* ---- Cards / forms ----------------------------------------------------------- */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}

h2 { margin-top: 0; font-size: 1rem; }

label {
  display: block;
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 5px;
  margin-top: 12px;
  color: var(--text);
}
label:first-child { margin-top: 0; }

input[type="text"],
input[type="tel"],
input[type="number"],
input[type="password"],
input[type="date"],
input[type="file"],
textarea,
select {
  width: 100%;
  padding: 9px 11px;
  font-size: 0.92rem;
  font-family: inherit;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
}
input:focus, textarea:focus, select:focus {
  outline: 2px solid var(--blue);
  outline-offset: -1px;
  border-color: var(--blue);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  font-size: 0.88rem;
  font-weight: 600;
  font-family: inherit;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  min-height: 36px;
  transition: background-color 0.1s ease, border-color 0.1s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); }
.btn-secondary { background: #fff; color: var(--text); border: 1px solid var(--border-strong); }
.btn-secondary:hover { background: var(--panel-sunken); }
.btn-approve { background: var(--green); color: #fff; }
.btn-approve:hover { background: #0b6134; }
.btn-danger { background: #fff; color: var(--red); border: 1px solid var(--red-bg); }
.btn-danger:hover { background: var(--red-bg); }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-sm { padding: 6px 12px; font-size: 0.8rem; min-height: auto; }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}
@media (max-width: 560px) {
  .grid-2 { grid-template-columns: 1fr; }
}

.material-list { margin-top: 10px; max-height: 420px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.material-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.material-row:last-child { border-bottom: none; }
.material-row:hover { background: var(--panel-sunken); }
.material-name { font-weight: 700; color: var(--text); }
.material-sub { font-size: 0.78rem; color: var(--text-mute); }
.material-sub-supplier { font-size: 0.8rem; color: var(--text-mute); margin-top: 1px; }

.cart-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.cart-item:last-child { border-bottom: none; }
.cart-item .name { flex: 1; }
.cart-item .name .material-sub { margin-top: 2px; }

.qty-stepper {
  display: flex;
  align-items: center;
  gap: 6px;
}
.qty-stepper button {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: #fff;
  font-size: 1.05rem;
  cursor: pointer;
}
.qty-stepper button:hover { background: var(--panel-sunken); }
.qty-stepper input {
  width: 52px;
  text-align: center;
  padding: 6px 4px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.pill-pending { background: var(--amber-bg); color: var(--amber); }
.pill-approved { background: var(--green-bg); color: var(--green); }
.pill-fulfilled { background: var(--blue-light); color: var(--blue); }
.pill-rejected { background: var(--red-bg); color: var(--red); }
.pill-trade { background: var(--purple-bg); color: var(--purple); }

/* Legacy top-tab strip — still used verbatim inside a couple of nested
   sub-areas (kept for anything that isn't part of the nav-rail restructure). */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.tab-btn {
  padding: 10px 14px;
  border: none;
  background: none;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-mute);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.tab-btn.active { color: var(--blue); border-bottom-color: var(--blue); }

/* ---- Order detail (record shown in a detail pane, or standalone card) ------- */
.order-card { padding: 16px; }
.order-card .top-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.order-card .job-address { font-size: 1.02rem; font-weight: 700; }
.order-card .meta { color: var(--text-mute); font-size: 0.85rem; margin-top: 2px; }
.order-card .items { margin: 14px 0; }
.order-card .item-line { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: 0.9rem; }
.order-card .item-line:last-child { border-bottom: none; }
.return-toggle { display: inline-flex; align-items: center; gap: 5px; margin-left: 12px; font-size: 0.76rem; color: var(--text-mute); font-weight: 600; cursor: pointer; vertical-align: middle; }
.return-toggle input { width: 15px; height: 15px; margin: 0; }
.order-card .actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }

.detail-header { border-bottom: 1px solid var(--border); padding-bottom: 14px; margin-bottom: 14px; }
.detail-title { font-size: 1.05rem; font-weight: 700; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.detail-meta { color: var(--text-mute); font-size: 0.86rem; margin-top: 4px; }
.detail-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 280px;
  color: var(--text-faint);
  text-align: center;
  padding: 40px;
  font-size: 0.92rem;
}

.empty-state { text-align: center; padding: 40px 20px; color: var(--text-mute); }

.text-bubble {
  background: var(--blue-light);
  border: 1px solid var(--blue-line);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 10px;
  font-size: 0.88rem;
}
.text-bubble .meta { display: flex; justify-content: space-between; color: var(--text-mute); font-size: 0.74rem; margin-bottom: 6px; }
.text-bubble .sim-badge { background: var(--amber-bg); color: var(--amber); padding: 1px 8px; border-radius: 999px; font-weight: 700; font-size: 0.68rem; }

.step-indicator { display: flex; gap: 6px; margin-bottom: 18px; }
.step-indicator .dot { flex: 1; height: 5px; border-radius: 3px; background: var(--border); }
.step-indicator .dot.active { background: var(--orange); }
.step-indicator .dot.done { background: var(--green); }

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.88rem;
  box-shadow: var(--shadow-md);
  z-index: 50;
}

.error-msg { color: var(--red); font-weight: 600; font-size: 0.86rem; margin-top: 10px; }
.hint { color: var(--text-mute); font-size: 0.82rem; margin-top: 4px; }

.suggest-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.suggest-chip {
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--blue-line);
  color: var(--blue);
  background: var(--blue-light);
  cursor: pointer;
  font-size: 0.82rem;
}

table.admin-table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
table.admin-table th {
  text-align: left;
  padding: 8px;
  border-bottom: 1px solid var(--border-strong);
  color: var(--text-mute);
  font-weight: 600;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
table.admin-table td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--border); }
table.admin-table tbody tr:hover { background: var(--panel-sunken); }
table.admin-table input { padding: 6px 8px; font-size: 0.84rem; }
table.admin-table select { padding: 6px 8px; font-size: 0.84rem; width: auto; }
table.admin-table input[type="checkbox"] { width: 15px; height: 15px; padding: 0; }

.bulk-bar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.bulk-select-all { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 0.84rem; cursor: pointer; margin: 0; }
.bulk-select-all input { width: 15px; height: 15px; margin: 0; }
#invSelectedCount { flex: 1; }

.csv-results { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 0.84rem; }
.csv-results .csv-ok { color: var(--green); font-weight: 700; }
.csv-results .csv-err-summary { color: var(--red); font-weight: 700; margin-top: 4px; }
.csv-results ul { margin: 8px 0 0; padding-left: 20px; max-height: 220px; overflow-y: auto; }
.csv-results li { margin-bottom: 4px; }

.trade-check-group { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 6px; }
.trade-check-group label { display: flex; align-items: center; gap: 6px; font-weight: 500; margin: 0; font-size: 0.86rem; cursor: pointer; }
.trade-check-group input { width: 15px; height: 15px; margin: 0; }
.trade-check-group .hint { width: 100%; margin: 0; }

/* ---- List / detail pane (Outlook-style message-list + reading-pane) --------- */
.list-detail {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}
.list-pane {
  width: 360px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  max-height: calc(100vh - 150px);
}
.list-row {
  display: block;
  width: 100%;
  text-align: left;
  padding: 11px 16px;
  border: none;
  border-bottom: 1px solid var(--border);
  border-left: 3px solid transparent;
  background: none;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
}
.list-row:hover { background: var(--panel-sunken); }
.list-row.selected { background: var(--blue-light); border-left-color: var(--blue); }
.list-row .row-title {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.list-row .row-title .row-time { font-weight: 400; font-size: 0.72rem; color: var(--text-faint); white-space: nowrap; }
.list-row .row-sub { font-size: 0.8rem; color: var(--text-mute); margin-top: 2px; }
.list-row .row-meta { font-size: 0.74rem; color: var(--text-mute); margin-top: 6px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.detail-pane {
  flex: 1;
  min-width: 0;
  padding: 20px 24px;
  overflow-y: auto;
  max-height: calc(100vh - 150px);
}

@media (max-width: 860px) {
  .list-detail { flex-direction: column; }
  .list-pane { width: 100%; border-right: none; border-bottom: 1px solid var(--border); max-height: 320px; }
  .detail-pane { max-height: none; }
}

.pill-trade { background: var(--purple-bg); color: var(--purple); }
.pill-location { background: var(--panel-sunken); color: var(--text-mute); }
.pill-unavailable { background: var(--red-bg); color: var(--red); }
.text-link-btn { display: inline-block; background: none; border: none; padding: 0; margin-top: 2px; color: var(--red); font-size: 0.78rem; cursor: pointer; text-decoration: underline; }
.text-link-btn:hover { opacity: 0.75; }

.trade-tile-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-top: 14px; }
.trade-tile {
  padding: 26px 16px;
  font-size: 1.05rem;
  font-weight: 700;
  text-align: center;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.trade-tile:active { transform: scale(0.98); }
.trade-tile:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-light); }
.trade-tile.selected { border-color: var(--blue); color: var(--blue); background: var(--blue-light); box-shadow: inset 0 0 0 2px var(--blue); }

.confirm-screen { text-align: center; padding: 40px 20px; }
.confirm-screen .icon { font-size: 3.4rem; margin-bottom: 10px; }

footer.kiosk-footer { text-align: center; padding: 20px; color: var(--text-faint); font-size: 0.78rem; }
footer.kiosk-footer a { color: var(--text-mute); }

.login-logo {
  display: flex;
  justify-content: center;
  margin: 40px 0 22px;
}
.login-logo img {
  width: 100%;
  max-width: 220px;
  height: auto;
  display: block;
}

/* ---- Kiosk: touch-friendly overrides ---------------------------------------- */
body.kiosk-shell {
  font-size: 19px;
}
body.kiosk-shell .wrap { max-width: 640px; }
body.kiosk-shell h2 { font-size: 1.2rem; }
body.kiosk-shell label { font-size: 0.92rem; }
body.kiosk-shell input[type="text"],
body.kiosk-shell input[type="tel"],
body.kiosk-shell textarea {
  padding: 15px;
  font-size: 1.05rem;
  border-radius: var(--radius);
}
body.kiosk-shell .btn {
  padding: 15px 22px;
  font-size: 1.02rem;
  min-height: 54px;
  border-radius: var(--radius-lg);
}
body.kiosk-shell .btn-sm { padding: 10px 16px; font-size: 0.9rem; min-height: auto; border-radius: var(--radius); }
body.kiosk-shell .card { border-radius: var(--radius-lg); padding: 22px; }
body.kiosk-shell .material-row { padding: 16px; }
body.kiosk-shell .qty-stepper button { width: 42px; height: 42px; font-size: 1.25rem; }
body.kiosk-shell .trade-tile { border-radius: var(--radius-lg); }

/* ---- Scheduling / dispatch board ------------------------------------------ */
.content-area.content-wide { max-width: none; }
.board-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.header-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filter-bar { display: flex; gap: 10px 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.filter-bar > div { flex: 1; min-width: 150px; }
.filter-bar label { margin-top: 0; }
.filter-bar select, .filter-bar input[type="text"] { padding: 7px 9px; font-size: 0.84rem; }
.check-inline { display: inline-flex !important; align-items: center; gap: 6px; font-weight: 500; font-size: 0.84rem; margin: 0 0 8px; cursor: pointer; white-space: nowrap; }
.check-inline input { width: 15px; height: 15px; margin: 0; }
.icon-btn { background: #fff; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); width: 30px; height: 30px; cursor: pointer; font-size: 0.8rem; color: var(--text); display: inline-flex; align-items: center; justify-content: center; }
.icon-btn:hover { background: var(--panel-sunken); }

.board { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(300px, 1.25fr) minmax(300px, 1.1fr); gap: 14px; align-items: start; }
.board-col { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); display: flex; flex-direction: column; min-width: 0; }
.board-col-head { padding: 10px 14px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 0.9rem; display: flex; align-items: center; gap: 8px; background: var(--panel-sunken); border-radius: var(--radius) var(--radius) 0 0; }
.board-col-head input[type="date"] { width: auto; padding: 5px 8px; font-size: 0.86rem; font-weight: 600; }
.board-col-body { padding: 10px; overflow-y: auto; max-height: calc(100vh - 260px); min-height: 200px; }
.day-nav { justify-content: center; }
@media (max-width: 1100px) {
  .board { grid-template-columns: 1fr 1fr; }
  .board-details { grid-column: 1 / -1; }
}
@media (max-width: 700px) {
  .board { grid-template-columns: 1fr; }
  .board-col-body { max-height: none; }
}

.date-group { font-size: 0.74rem; font-weight: 700; color: var(--text-mute); text-transform: uppercase; letter-spacing: 0.03em; margin: 10px 2px 6px; }
.date-group:first-child { margin-top: 0; }
.wo-card { border: 1px solid var(--border); border-left: 4px solid var(--border-strong); border-radius: var(--radius-sm); background: #fff; padding: 8px 10px; margin-bottom: 8px; cursor: grab; user-select: none; }
.wo-card:hover { box-shadow: var(--shadow-sm); border-color: var(--border-strong); }
.wo-card.selected { outline: 2px solid var(--blue); outline-offset: 1px; }
.wo-card.dragging { opacity: 0.45; }
.wo-card .wo-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.wo-card .wo-addr { font-weight: 700; font-size: 0.9rem; }
.wo-card .wo-type { font-size: 0.72rem; font-weight: 700; color: var(--text-mute); text-align: right; white-space: nowrap; }
.wo-card .wo-sub { font-size: 0.76rem; color: var(--text-mute); margin-top: 2px; }
.wo-card .wo-flags { margin-top: 4px; display: flex; gap: 4px; flex-wrap: wrap; }
.wo-card.completed { opacity: 0.7; }
.mini-pill { font-size: 0.66rem; font-weight: 700; padding: 1px 6px; border-radius: 999px; background: var(--panel-sunken); color: var(--text-mute); }

.crew-block { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 10px; }
.crew-head { padding: 7px 10px; background: var(--amber-bg); font-weight: 700; font-size: 0.84rem; display: flex; justify-content: space-between; gap: 8px; border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.crew-head .crew-po { font-weight: 500; color: var(--text-mute); font-size: 0.76rem; }
.crew-drop { padding: 8px; min-height: 40px; }
.crew-block.empty .crew-drop { min-height: 28px; padding: 4px 8px; font-size: 0.74rem; color: var(--text-faint); }
.drop-zone.drag-over, .crew-drop.drag-over { background: var(--blue-light); outline: 2px dashed var(--blue); outline-offset: -3px; }

.det-grid { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 0.86rem; margin: 10px 0; }
.det-grid dt { color: var(--text-mute); font-weight: 600; text-align: right; }
.det-grid dd { margin: 0; }
.det-section { border-top: 1px solid var(--border); margin-top: 14px; padding-top: 12px; }
.det-section h3 { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-mute); margin: 0 0 8px; }
.status-list label { display: flex; align-items: flex-start; gap: 8px; font-weight: 500; margin: 0 0 6px; font-size: 0.84rem; cursor: pointer; }
.status-list input { width: 15px; height: 15px; margin: 2px 0 0; flex-shrink: 0; }
.status-list .stamp { font-size: 0.72rem; color: var(--text-faint); margin-left: 4px; }
.color-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: 0; margin-right: 4px; border: 1px solid rgba(0,0,0,0.15); }
.task-row { display: flex; gap: 8px; align-items: flex-start; font-size: 0.86rem; padding: 5px 0; border-bottom: 1px dashed var(--border); }
.task-row:last-child { border-bottom: none; }
.task-row input[type="checkbox"] { width: 15px; height: 15px; margin: 2px 0 0; }
.task-row .task-text { flex: 1; white-space: pre-wrap; }
.task-row.done .task-text { text-decoration: line-through; color: var(--text-mute); }
.task-row .task-meta { font-size: 0.72rem; color: var(--text-faint); }
.notes-box { white-space: pre-wrap; font-size: 0.84rem; background: var(--panel-sunken); border-radius: var(--radius-sm); padding: 8px 10px; }
.inline-row { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.inline-row > * { flex: 1; min-width: 120px; }
.inline-row .btn { flex: 0 0 auto; }

/* Slide-over form panel */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.25); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(760px, 100vw); background: var(--bg); z-index: 41; display: flex; flex-direction: column; box-shadow: var(--shadow-md); }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--border); background: var(--panel); }
.drawer-head h2 { margin: 0; font-size: 1.05rem; }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px 20px 30px; }
.drawer-foot { padding: 12px 20px; border-top: 1px solid var(--border); background: var(--panel); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
@media (max-width: 620px) { .form-grid { grid-template-columns: 1fr; } }
.field-with-add { display: flex; gap: 6px; align-items: center; }
.field-with-add select { flex: 1; }
.add-inline { display: flex; gap: 6px; margin-top: 6px; }
.add-inline input { flex: 1; }
.checks-row { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 14px; }
.checks-row label { display: flex; align-items: center; gap: 6px; font-weight: 500; margin: 0; font-size: 0.86rem; cursor: pointer; }
.checks-row input { width: 15px; height: 15px; margin: 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--blue-light); color: var(--blue-dark); border-radius: 999px; padding: 3px 10px; font-size: 0.8rem; font-weight: 600; margin: 4px 6px 0 0; }
.chip button { background: none; border: none; cursor: pointer; color: inherit; font-size: 0.9rem; padding: 0; line-height: 1; }
.edit-list-row { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.edit-list-row input[type="text"] { flex: 1; }
.edit-list-row input[type="color"] { width: 42px; height: 34px; padding: 2px; flex: 0 0 auto; }
.edit-list-row select { flex: 1; }
.edit-list-row .icon-btn { flex: 0 0 auto; }
.pill-unassigned { background: var(--amber-bg); color: var(--amber); }
.pill-assigned { background: var(--blue-light); color: var(--blue); }
.pill-completed { background: var(--green-bg); color: var(--green); }
