/* Pontiac Land — Asset Management. Mobile-first.
   Follows the PLG App Design Guidelines (§1 Pontiac Land Group): Navy #002957 and White are
   the only brand colours; the other values are non-brand UI neutrals or functional status colours. */
:root {
  /* PLG brand: only these two are brand colours */
  --plg-navy: #002957;
  --plg-white: #FFFFFF;
  /* Non-brand UI neutrals (from the guideline deck) */
  --plg-text: #222222;
  --plg-text-muted: #595959;
  --plg-border: #CCCCCC;
  --plg-surface-alt: #EEF1F6;
  --plg-navy-tint: #B8C9DC;
  --plg-font: "Futura Book BT", "Futura", "Century Gothic", "CenturyGothic", "AppleGothic", sans-serif;
  --plg-fs-header: 28px;    /* bold */
  --plg-fs-subheader: 20px; /* bold */
  --plg-fs-detail: 14px;    /* regular */
  --plg-logo-min-h: 40px;

  /* App tokens, all resolved to the PLG values above */
  --font-sans: 'Plus Jakarta Sans', -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif; /* the user kept the original font */
  --navy-900: #001b3a;          /* pressed / darker shade of PLG navy */
  --navy-800: var(--plg-navy);
  --navy-700: #0d3a6b;          /* hover shade of PLG navy */
  --navy-600: var(--plg-navy);
  --navy-100: var(--plg-surface-alt);
  --navy-050: #f6f8fb;
  --paper: #f6f8fb;
  --surface: var(--plg-white);
  --surface-alt: #f6f8fb;
  --hairline: #e1e5eb;
  --hairline-strong: var(--plg-border);
  --ink: var(--plg-text);
  --ink-muted: var(--plg-text-muted);
  --ink-faint: #8a8a8a;
  --ink-on-navy: rgba(255, 255, 255, 0.94);
  --ink-on-navy-muted: rgba(255, 255, 255, 0.66);
  /* The old brass accent is now PLG navy (the palette has no secondary colour). */
  --brass: var(--plg-navy);
  --brass-light: var(--plg-navy-tint);
  --brass-tint: var(--plg-surface-alt);
  /* Functional status colours (not brand), kept muted */
  --ok: #2c6b52;
  --ok-tint: #e7f0ec;
  --warn: #8a6416;
  --warn-tint: #f6eeda;
  --danger: #9c3227;
  --danger-tint: #f6e8e6;
  --info: var(--plg-navy);
  --info-tint: var(--plg-surface-alt);
  --radius: 6px;
  --radius-lg: 10px;
  --shadow-sm: 0 1px 2px rgba(0, 41, 87, 0.05);
  --shadow-card: 0 1px 2px rgba(0, 41, 87, 0.04), 0 6px 20px rgba(0, 41, 87, 0.05);
  --shadow-pop: 0 24px 60px rgba(0, 41, 87, 0.28);
  --topbar-h: 56px;
  --bottomnav-h: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--plg-fs-detail);
  line-height: 1.45;
  color: var(--ink);
  background: var(--paper);
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--navy-600); text-decoration: none; }
img, video { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
/* PLG type scale: Header 28px bold, Sub-header 19–20px bold (panel & card headings), Detail 13–15px. */
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: normal; color: var(--plg-navy); }
h1 { font-size: var(--plg-fs-header); line-height: 1.2; }
h2 { font-size: var(--plg-fs-subheader); line-height: 1.25; }
h3 { font-size: 15px; }
.muted { color: var(--ink-muted); }
.faint { color: var(--ink-faint); }
.small { font-size: 0.8125rem; }
.label {
  font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--ink-muted); font-weight: 600;
}
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; word-break: break-word; }

/* ---------- shell: left panel only (no top bar) ---------- */
.layout { display: flex; min-height: 100vh; }
main {
  flex: 1; min-width: 0;
  padding: calc(16px + env(safe-area-inset-top, 0px)) 16px calc(var(--bottomnav-h) + var(--safe-b) + 24px);
  width: 100%; /* full width: pages use the whole space left and right */
}

.sidebar {
  display: flex; flex-direction: column; gap: 4px;
  width: 276px; flex: none; /* wide enough for "Corrective Work Order" on one line */
  padding: calc(18px + env(safe-area-inset-top, 0px)) 12px calc(14px + var(--safe-b));
  background: var(--navy-800); color: var(--ink-on-navy);
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
/* Full Pontiac Land lockup, centred, with a divider under it (like the PLG Intranet). */
.brand {
  display: flex; flex-direction: column; align-items: center; gap: 8px; color: #fff; min-width: 0;
  padding: 6px 8px 16px; margin: 0 -12px 4px; border-bottom: 1px solid rgba(255, 255, 255, 0.16);
}
.brand img { height: 84px; width: auto; flex: none; }
.brand .brand-mini { display: none; height: 36px; }
/* Collapse / expand button (desktop only): a round tab on the panel's right edge, halfway down. */
.side-toggle {
  /* Centred on the panel's edge: the desktop panel is 292px (the `.sidebar { width: 292px }` rule further down). */
  display: none; position: fixed; top: 50%; left: calc(292px - 14px); z-index: 40; transform: translateY(-50%);
  width: 28px; height: 28px; padding: 0; border-radius: 50%; cursor: pointer; place-items: center;
  border: 1px solid var(--hairline-strong); background: #fff; color: var(--navy-800);
  box-shadow: 0 2px 6px rgba(0, 27, 58, 0.18); transition: left 0.2s ease;
}
.side-toggle:hover { background: var(--navy-800); color: #fff; }
.side-toggle svg { width: 16px; height: 16px; transition: transform 0.2s ease; }
@media (min-width: 900px) {
  .side-toggle { display: grid; }
  .sidebar { transition: width 0.2s ease, padding 0.2s ease; }
  /* Collapsed: a narrow navy strip with the small logo and the menu icons (names show on hover). */
  body.side-collapsed .sidebar { width: 72px; padding-left: 10px; padding-right: 10px; overflow-x: hidden; }
  body.side-collapsed .side-toggle { left: calc(72px - 14px); }
  body.side-collapsed .side-toggle svg { transform: rotate(180deg); }
  body.side-collapsed .brand { margin: 0 -10px 4px; padding: 6px 0 14px; }
  body.side-collapsed .brand .brand-full, body.side-collapsed .brand-name { display: none; }
  body.side-collapsed .brand .brand-mini { display: block; }
  body.side-collapsed .sidebar .navlink { justify-content: center; padding: 12px 0; gap: 0; }
  body.side-collapsed .sidebar .navlink span { display: none; }
  body.side-collapsed .side-user { flex-direction: column; padding: 12px 0 2px; gap: 6px; }
  body.side-collapsed .side-user .who { display: none; }
}
.brand-name { font-weight: 600; font-size: 0.8rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-on-navy-muted); }
/* Section headings in the menu (MAIN, WORK ORDERS, …). */
.side-label {
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-on-navy-muted); padding: 14px 14px 4px;
}
.side-label:first-child { padding-top: 6px; }
.side-prop { padding: 0 4px 12px; border-bottom: 1px solid rgba(255, 255, 255, 0.1); margin-bottom: 8px; }
.prop-select {
  width: 100%;
  background: rgba(255, 255, 255, 0.1); color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2); border-radius: var(--radius);
  padding: 7px 10px; font-size: 0.85rem;
}
.prop-select option { color: var(--ink); }
.side-nav { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.sidebar .navlink {
  flex-direction: row; justify-content: flex-start; gap: 14px;
  padding: 13px 14px; border-radius: var(--radius);
  font-size: 1.05rem; color: var(--ink-on-navy-muted);
  white-space: nowrap; /* each item stays on one line */
}
.sidebar .navlink span { overflow: hidden; text-overflow: ellipsis; }
.sidebar .navlink:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.sidebar .navlink.active { background: rgba(255, 255, 255, 0.14); color: #fff; box-shadow: inset 3px 0 0 var(--plg-white); }
.sidebar .navlink svg { width: 22px; height: 22px; }
.sidebar .sep { height: 1px; background: rgba(255, 255, 255, 0.1); margin: 10px 4px; }
.side-user {
  display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 12px 6px 2px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.side-user .who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.side-user .who b { color: #fff; font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user .who small { color: var(--ink-on-navy-muted); font-size: 0.72rem; }
.side-user .icon-btn { color: var(--ink-on-navy-muted); }
.side-user .icon-btn:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--plg-white); color: var(--plg-navy); font-weight: 700; font-size: 0.8rem;
  border: 0; flex: none;
}
.drawer-backdrop { display: none; }

.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--bottomnav-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: var(--surface); border-top: 1px solid var(--hairline);
}
.navlink {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--ink-faint); font-size: 0.68rem; font-weight: 600;
  background: none; border: 0; cursor: pointer; font-family: inherit;
}
.navlink svg { width: 22px; height: 22px; }
.bottomnav .navlink.active { color: var(--navy-700); }
.bottomnav .navlink.active svg { stroke-width: 2.2; }

/* Phones/tablets: the left panel becomes a slide-in drawer (opened from "More"). */
@media (max-width: 899px) {
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 70; height: auto; width: min(290px, 84vw);
    transform: translateX(-102%); transition: transform 0.22s ease-out; box-shadow: var(--shadow-pop);
  }
  body.drawer-open .sidebar { transform: none; }
  body.drawer-open .drawer-backdrop { display: block; position: fixed; inset: 0; z-index: 65; background: rgba(0, 27, 58,0.45); animation: fade 0.15s; }
  body.drawer-open { overflow: hidden; }
}
@media (min-width: 900px) {
  .bottomnav { display: none; }
  main { padding: 24px 28px 48px; }
}

/* ---------- page head ---------- */
.page-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 16px;
}
.page-head .grow { flex: 1; min-width: 0; }
.page-head .sub { margin-top: 2px; }
.back {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--ink-muted); font-size: 0.85rem; font-weight: 600; margin-bottom: 8px;
}
.back svg { width: 16px; height: 16px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 40px; padding: 8px 15px;
  border-radius: var(--radius); border: 1px solid transparent;
  font-weight: 600; font-size: 0.875rem; cursor: pointer;
  background: var(--navy-700); color: #fff;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.btn:hover { background: var(--navy-800); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn svg { width: 17px; height: 17px; flex: none; }
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--hairline-strong); }
.btn.secondary:hover { background: var(--navy-050); }
.btn.ghost { background: transparent; color: var(--navy-600); padding-left: 8px; padding-right: 8px; }
.btn.ghost:hover { background: var(--navy-050); }
.btn.danger { background: var(--surface); color: var(--danger); border-color: #e4c3bf; }
.btn.danger:hover { background: var(--danger-tint); }
.btn.ok { background: var(--ok); }
.btn.ok:hover { background: #22563f; }
/* Same as the primary button ("Add work order" matches "New schedule"). */
.btn.brass { background: var(--navy-700); }
.btn.brass:hover { background: var(--navy-800); }
.btn.sm { min-height: 32px; padding: 5px 11px; font-size: 0.8rem; }
.btn.block { width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.icon-btn {
  width: 36px; height: 36px; display: inline-grid; place-items: center;
  border: 0; background: transparent; border-radius: var(--radius); cursor: pointer; color: var(--ink-muted);
}
.icon-btn:hover { background: var(--navy-050); }
.icon-btn svg { width: 19px; height: 19px; }

.fab {
  position: fixed; right: 18px; bottom: calc(var(--bottomnav-h) + var(--safe-b) + 18px); z-index: 25;
  height: 52px; padding: 0 20px 0 16px; border-radius: 26px;
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--brass); color: #fff; font-weight: 700; border: 0;
  box-shadow: 0 8px 24px rgba(0, 27, 58,0.25); cursor: pointer;
}
.fab svg { width: 22px; height: 22px; }
@media (min-width: 900px) { .fab { display: none; } }
.desktop-only { display: none; }
@media (min-width: 900px) { .desktop-only { display: inline-flex; } }

/* ---------- cards & lists ---------- */
.card {
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
}
.card-pad { padding: 16px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-height: 57px; /* same height with or without a button (e.g. Attachments vs QR code) */
  padding: 12px 16px; border-bottom: 1px solid var(--hairline);
  background: var(--navy-100); color: var(--navy-800);
  border-radius: calc(var(--radius-lg) - 1px) calc(var(--radius-lg) - 1px) 0 0;
}
.card-head h2 { font-size: 19px; } /* PLG sub-header (19–20px) for panel headings */
.section { margin-top: 18px; }
.section > .label { display: block; margin-bottom: 8px; }

.stack > * + * { margin-top: 12px; }

.list { display: flex; flex-direction: column; }
.list-item {
  display: flex; gap: 12px; align-items: center;
  padding: 12px 16px; border-top: 1px solid var(--hairline);
  color: inherit;
}
.list-item:first-child { border-top: 0; }
a.list-item:hover { background: var(--surface-alt); }
.list-item .body { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.list-item .meta { font-size: 0.8125rem; color: var(--ink-muted); margin-top: 2px; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.list-item .right { text-align: right; flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.list-item .chev { color: var(--ink-faint); width: 18px; height: 18px; flex: none; }
/* PWO assets: ID over description on the left, category over location on the right. */
.wo-asset { align-items: flex-start; }
.wo-asset .wa-l { flex: 1; min-width: 0; }
.wo-asset .wa-r { flex: 0 1 auto; min-width: 0; max-width: 50%; text-align: right; }
.wo-asset .wa-id { font-weight: 700; }
.wo-asset .wa-sub { font-size: 0.8125rem; color: var(--ink-muted); margin-top: 2px; overflow-wrap: anywhere; }
.wo-asset .wa-x { flex: none; align-self: center; padding: 4px 8px; }

.thumb {
  width: 56px; height: 56px; border-radius: var(--radius); flex: none;
  background: var(--navy-050); object-fit: cover; display: grid; place-items: center; color: var(--ink-faint);
  overflow: hidden;
}
.thumb svg { width: 24px; height: 24px; }

.asset-grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .asset-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .asset-grid { grid-template-columns: repeat(3, 1fr); } }
.asset-card { display: flex; flex-direction: column; overflow: hidden; color: inherit; transition: box-shadow 0.15s; }
.asset-card:hover { box-shadow: var(--shadow-card); }
.asset-card .photo { aspect-ratio: 16 / 10; background: var(--navy-050); display: grid; place-items: center; color: var(--ink-faint); overflow: hidden; }
.asset-card .photo img { width: 100%; height: 100%; object-fit: cover; }
.asset-card .photo svg { width: 36px; height: 36px; }
.asset-card .info { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; }
.asset-card .row { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.asset-card .name { font-weight: 700; }
@media (max-width: 639px) {
  .asset-card { flex-direction: row; }
  .asset-card .photo { width: 96px; aspect-ratio: auto; flex: none; }
  .asset-card .info { min-width: 0; padding: 10px 12px; }
}

/* Asset list: one light-grey rounded row per asset, no header. */
.alist { display: flex; flex-direction: column; gap: 12px; }
.alist { gap: 8px; }
/* Asset details: 3 columns at every width from 640px up. The Asset ID column is
   widest, Description next, and Asset category (right) narrowest, so the 2nd and
   3rd columns sit further right. */
@media (min-width: 640px) {
  /* Exact starts requested: Description at 45%, Asset category at 80% of the panel width. */
  .kv.kv-fill { grid-template-columns: 45% 35% 20%; column-gap: 0; } /* .kv.kv-fill beats the later generic .kv rule */
  .kv.kv-fill > div { padding-right: 16px; }
  .kv.kv-fill > div:nth-child(3n) { padding-right: 0; }
}

/* Asset page: paired rows so each left card matches the height of its right partner.
   details | photo + QR,  attachments | work orders,  movement | schedules */
.asset-layout {
  display: grid; gap: 16px; grid-template-columns: 1fr;
  grid-template-areas: "photo" "det" "att" "mov" "wo" "qr";
}
.asset-layout .a-det { grid-area: det; }
.asset-layout .a-photo { grid-area: photo; }
.asset-layout .a-qr { grid-area: qr; }
.asset-layout .a-att { grid-area: att; }
.asset-layout .a-mov { grid-area: mov; }
.asset-layout .a-wo { grid-area: wo; }
/* Wide screens:
   details (4 of 6 cols) | photo (2)
   attachments (4) | QR code (2)
   movement (3) | work orders (3) — half and half */
@media (min-width: 900px) { /* same breakpoint as the left panel */
  .asset-layout {
    grid-template-columns: repeat(6, minmax(0, 1fr)); align-items: stretch;
    grid-template-areas: "det det det det photo photo" "att att att att qr qr" "mov mov mov wo wo wo";
  }
  /* Details card fills its row: fields spread across 4 columns and the rows spread vertically. */
  .a-det { display: flex; flex-direction: column; }
  .a-det-body { flex: 1; display: flex; }
  .kv-fill { flex: 1; align-content: space-evenly; gap: 18px 24px; }
  .kv-fill .v { font-size: 0.98rem; }
}

/* Settings → Properties & locations tree */
.ptree .arow { grid-template-columns: minmax(170px, 1.2fr) minmax(170px, 1.5fr) minmax(140px, 1fr) 70px 84px; }
.ptree .indent { display: inline-block; width: calc(var(--depth, 0) * 20px); flex: none; }
.ptree .prow .c-id { display: flex; align-items: center; }
.ptree .prow[style*="--depth:0"] { border-left-color: var(--brass); }
.ptree .tree { color: var(--ink-faint); margin-right: 6px; font-weight: 400; }
.ptree .twisty {
  width: 22px; height: 22px; margin-right: 4px; flex: none; display: inline-grid; place-items: center;
  border: 0; background: none; border-radius: 4px; cursor: pointer; color: var(--ink-muted); padding: 0;
}
.ptree .twisty:hover { background: var(--navy-100); }
.ptree .twisty svg { width: 15px; height: 15px; transition: transform 0.15s; }
.ptree .twisty.open svg { transform: rotate(90deg); }
.ptree .twisty-gap { width: 26px; flex: none; display: inline-block; }
.ptree .prow-act { display: flex; justify-content: flex-end; gap: 2px; }
.settings-link { display: flex; align-items: center; gap: 14px; padding: 14px 16px; color: inherit; }
.settings-link:hover { box-shadow: var(--shadow-card); }
.settings-link .body { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.settings-link > svg { width: 18px; height: 18px; color: var(--ink-faint); }
@media (max-width: 699px) {
  .ptree .arow.ahead { display: none; }
  .ptree .arow { grid-template-columns: 1fr auto; }
  .ptree .prow-act { grid-column: 2; grid-row: 1 / span 2; }
}

/* Asset movement rows: "From: MS.CT.RF ⟶ To: MS.CCS" */
.mv-line { font-size: 0.9rem; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; }
.mv-line b { color: var(--navy-800); }
.mv-arrow { color: var(--brass); font-size: 1.15rem; line-height: 1; margin: 0 4px; }
.mv-toggle {
  display: block; width: 100%; padding: 11px 16px; border: 0; border-top: 1px solid var(--hairline);
  background: var(--surface-alt); color: var(--navy-600); font-weight: 600; font-size: 0.85rem; cursor: pointer; font-family: inherit;
}
.mv-toggle:hover { background: var(--navy-050); }

/* Search field: the input sits inside the .search box, so it has no border of its own. */
.search input, .search input[type=search], .dd-search input[type=search] {
  border: 0 !important; outline: none !important; box-shadow: none !important;
  background: transparent; min-height: 0; padding: 9px 0; border-radius: 0;
}
.search:focus-within { border-color: var(--navy-600); box-shadow: 0 0 0 2px rgba(0, 41, 87,0.15); }

/* Header row: same card style as the rows; each column name sorts the list. */
.arow.ahead {
  background: transparent; border: 0; border-bottom: 2px solid var(--hairline-strong); border-radius: 0; box-shadow: none;
  padding: 2px 19px 6px 23px; /* matches the rows' 4px accent + 18px padding so columns line up */
}
.arow .hcol {
  display: inline-flex; align-items: center; gap: 6px; justify-self: start;
  border: 0; background: none; padding: 6px 0; cursor: pointer; font-family: inherit;
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-muted);
}
.arow .hcol:hover { color: var(--navy-700); }
.arow .hcol.on { color: var(--navy-800); }
.arow .hcol .arr { font-size: 0.7rem; color: var(--ink-faint); letter-spacing: 0; }
.arow .hcol.on .arr { color: var(--brass); }
/* Phones: no column-name row on the table-style lists (Assets, Checklists, …). */
@media (max-width: 699px) {
  .alist .arow.ahead { display: none; }
}
.arow {
  display: grid; grid-template-columns: minmax(200px, 1.4fr) minmax(160px, 1.4fr) minmax(110px, 0.8fr) minmax(130px, 1fr);
  gap: 16px; align-items: center; padding: 14px 18px;
  background: var(--surface); border: 1px solid var(--hairline-strong); border-left: 4px solid var(--navy-600);
  border-radius: 6px; box-shadow: var(--shadow-sm); color: var(--ink); font-size: 0.9rem;
  transition: background 0.15s, box-shadow 0.15s, border-color 0.15s;
}
a.arow:hover { background: var(--navy-050); border-left-color: var(--brass); box-shadow: var(--shadow-card); }
.arow > span { min-width: 0; overflow-wrap: anywhere; }
.arow .c-id { font-weight: 700; color: var(--navy-800); }
.arow .c-desc { color: var(--ink); }
.arow .c-cat { color: var(--ink-muted); }
.arow .c-loc { display: flex; align-items: center; gap: 7px; color: var(--ink-muted); }
.arow .c-loc svg { width: 15px; height: 15px; color: var(--navy-600); flex: none; }
@media (max-width: 699px) {
  .arow { grid-template-columns: 1fr auto; gap: 4px 12px; padding: 12px 14px; }
  .arow .c-id, .arow .c-desc { grid-column: 1 / -1; }
  .arow .c-cat, .arow .c-loc { font-size: 0.8rem; }
  .arow .c-loc { justify-content: flex-end; }
}

/* Preventive Maintenance work orders and Schedules use the same table rows, with their own columns. */
/* Status is wide enough for "Acknowledged & Assigned" (≈215px), so the badge never runs into Due. */
/* WO No. | Schedule | Frequency | Location | Category | Servicer (with dept) | Assignee | Status | Due.
   Small minimums so the whole row always fits the page (no sideways scroll); text wraps in its column. */
.pwo-list .arow {
  /* Minimums are at least each header label's width (FREQUENCY ≈ 92px, LOCATION ≈ 80px). */
  /* WO No. | Schedule | Location | Servicer | Assignee | Status | Due (date) */
  grid-template-columns: minmax(88px, 0.8fr) minmax(84px, 1.3fr) minmax(84px, 0.7fr)
    minmax(100px, 1.3fr) minmax(84px, 0.9fr) minmax(110px, 1.1fr) minmax(84px, 0.7fr);
  gap: 10px;
}
/* "Acknowledged & Assigned" is split with a <br> (pwoARow), so the badge is exactly as wide as its
   longer line instead of stretching across the column. */
.pwo-list .arow .chip, .sched-list .arow .chip { white-space: nowrap; line-height: 1.25; text-align: left; width: max-content; max-width: 100%; }
/* Schedule | Frequency | Type | Category | Location | Servicer (with department) | Next WO */
.sched-list .arow {
  grid-template-columns: minmax(90px, 1.5fr) minmax(96px, 1fr) minmax(80px, 0.9fr) minmax(88px, 1fr)
    minmax(84px, 0.8fr) minmax(110px, 1.4fr) minmax(90px, 0.8fr);
  gap: 10px;
}
/* Header labels wrap inside their own column instead of running into the next one. */
.pwo-list .arow.ahead .hcol, .sched-list .arow.ahead .hcol { min-width: 0; white-space: normal; text-align: left; line-height: 1.25; }
/* Same text size as the Assets / Checklists rows (14.4px). */
.pwo-list .arow > span, .sched-list .arow > span { font-size: 0.9rem; }
.pwo-list .arow .c-desc { font-size: 0.9rem; color: var(--ink); }
/* Desktop, very narrow (sidebar open on a ~1100px window): scroll sideways instead of spilling out. */
@media (min-width: 700px) { .pwo-list, .sched-list { overflow-x: auto; } }
/* Phone card (.m-card, built by mCard): "#no [status]", bold title, photo, Created at | Assignee, and
   "More details". Hidden on desktop; on phones it replaces the table cells and the header row. */
.m-card { display: none; }
@media (max-width: 699px) {
  .pwo-list .arow.ahead, .sched-list .arow.ahead { display: none; }
  .pwo-list .arow, .sched-list .arow { display: block; padding: 12px 14px; }
  .pwo-list .arow > span, .sched-list .arow > span { display: none; }
  .m-card { display: flex; flex-direction: column; gap: 8px; }
  .m-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
  .m-no { color: var(--ink-muted); font-size: 0.85rem; }
  .m-top .chip { flex: none; }
  .m-title { font-weight: 600; font-size: 1rem; color: var(--ink); line-height: 1.3; overflow-wrap: anywhere; }
  .m-img { width: 40px; height: 40px; border-radius: var(--radius-lg); background: var(--navy-050); border: 1px solid var(--hairline);
    display: grid; place-items: center; overflow: hidden; color: var(--ink-muted); }
  .m-img img { width: 100%; height: 100%; object-fit: cover; }
  .m-img svg { width: 18px; height: 18px; }
  .m-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; }
  .m-k { font-size: 0.75rem; color: var(--ink-muted); }
  .m-v { font-size: 0.875rem; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .m-more summary { cursor: pointer; font-size: 0.8rem; color: var(--ink-muted); list-style: none; }
  .m-more summary::-webkit-details-marker { display: none; }
  .m-more summary::before { content: "▸ "; }
  .m-more[open] summary::before { content: "▾ "; }
  .m-more .m-facts { margin-top: 8px; }
  .m-more .m-v { white-space: normal; }
}
.group-title { margin: 20px 0 10px; display: flex; align-items: baseline; gap: 8px; }
.group-title:first-child { margin-top: 0; }

/* ---------- chips ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 999px;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.02em;
  background: var(--navy-050); color: var(--ink-muted); white-space: nowrap;
}
.chip::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.8; }
.chip.plain::before { display: none; }
.chip.ok { background: var(--ok-tint); color: var(--ok); }
.chip.warn { background: var(--warn-tint); color: var(--warn); }
.chip.danger { background: var(--danger-tint); color: var(--danger); }
.chip.info { background: var(--info-tint); color: var(--info); }
.chip.brass { background: var(--plg-navy-tint); color: var(--plg-navy); }
.chip.grey { background: #eeedea; color: var(--ink-faint); }
/* Work-order status: bright solid chips with white text. */
.chip.st-open { background: #1e88e5; color: #fff; }
.chip.st-progress { background: #fb8c00; color: #fff; }
.chip.st-ack { background: #5e35b1; color: #fff; }
.chip.st-done { background: #2e9d4f; color: #fff; }
.chip.st-cancel { background: #e53935; color: #fff; }
.chip[class*=" st-"]::before { opacity: 1; background: #fff; }
.due-overdue { color: var(--danger); font-weight: 700; }
.due-soon { color: var(--warn); font-weight: 600; }

/* ---------- toolbar / filters ---------- */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.search {
  flex: 1 1 220px; display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--hairline-strong); border-radius: var(--radius);
  padding: 0 12px; min-height: 42px;
}
.search svg { width: 17px; height: 17px; color: var(--ink-faint); flex: none; }
.search input { border: 0; outline: none; flex: 1; min-width: 0; background: transparent; padding: 9px 0; }
.toolbar select { min-height: 42px; }

.seg {
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin-bottom: 14px;
  padding-bottom: 2px;
}
.seg::-webkit-scrollbar { display: none; }
.seg button {
  flex: none; border: 1px solid var(--hairline-strong); background: var(--surface);
  padding: 7px 13px; border-radius: 999px; font-size: 0.82rem; font-weight: 600; cursor: pointer; color: var(--ink-muted);
}
.seg button.on { background: var(--navy-700); border-color: var(--navy-700); color: #fff; }
.seg button .n { opacity: 0.7; margin-left: 4px; font-weight: 500; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--hairline); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs a {
  padding: 10px 14px; font-weight: 600; font-size: 0.9rem; color: var(--ink-muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tabs a.on { color: var(--navy-800); border-color: var(--brass); }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 760px) { .stats { grid-template-columns: repeat(4, 1fr); gap: 14px; } }
.stat { padding: 14px 16px; color: inherit; display: block; transition: box-shadow 0.15s; }
.stat:hover { box-shadow: var(--shadow-card); }
.stat .v { font-size: 1.9rem; font-weight: 700; line-height: 1.1; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat .s { font-size: 0.78rem; color: var(--ink-muted); margin-top: 2px; }
.stat.alert .v { color: var(--danger); }
.stat.warn .v { color: var(--warn); }

.two-col { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 1000px) { .two-col { grid-template-columns: 1fr 1fr; } }
.detail-cols { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 1000px) { .detail-cols { grid-template-columns: minmax(0, 2.25fr) minmax(0, 1fr); align-items: start; } /* right column ≈31% (80% of the old 38%) */ }

/* All Home shortcuts on one line, whatever their number. */
.quick { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 10px; margin: 16px 0 4px; }
.quick a {
  display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
  padding: 14px 6px; font-size: 0.8rem; font-weight: 600; color: var(--ink);
}
.quick a svg { width: 24px; height: 24px; color: var(--brass); }

/* ---------- details ---------- */
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
@media (min-width: 640px) { .kv { grid-template-columns: repeat(3, 1fr); } }
.kv .k { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-faint); font-weight: 600; }
.kv .v { margin-top: 2px; word-break: break-word; }
.kv .full { grid-column: 1 / -1; }
/* Schedule details: same columns (via .kv-fill, 45/35/20) and row spacing as the asset
   details panel, where rows measure ~30px apart. */
.kv.kv-roomy { row-gap: 30px; }
.kv.kv-roomy .v { font-size: 0.98rem; }
/* Schedule page: the checklist row opens the checklist dialog. */
.list-item.cl-open { width: 100%; border: 0; background: none; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.list-item.cl-open > svg { width: 18px; height: 18px; color: var(--ink-faint); flex: none; }
.task-q { font-weight: 600; }
/* Planned WO list: "created | schedule | location | …" with roomy separators. */
.meta.wo-desc { display: block; }
.wo-desc .sep { margin: 0 10px; color: var(--hairline-strong); }
/* Schedule pattern tag beside a planned WO number (a soft .chip colour per pattern). */
.chip.freq-tag { margin-left: 8px; vertical-align: 2px; }
/* Each frequency and each priority has its own colour (functional, not brand colours). */
.chip.f-day { background: #e3f2fd; color: #1565c0; }
.chip.f-week { background: #ede7f6; color: #5e35b1; }
.chip.f-month { background: #e0f2f1; color: #00796b; }
.chip.f-year { background: #fff3e0; color: #e65100; }
.chip.p-low { background: #eceff1; color: #546e7a; }
.chip.p-medium { background: #fff8e1; color: #a66b00; }
.chip.p-high { background: #fff3e0; color: #e65100; }
.chip.p-urgent { background: #ffebee; color: #c62828; }
.task-view .task-num { width: 44px; }

.hero-photo {
  position: relative; border-radius: var(--radius-lg); overflow: hidden; background: var(--navy-050);
  height: 220px; display: grid; place-items: center; color: var(--ink-faint); cursor: zoom-in;
}
@media (min-width: 900px) {
  .hero-photo { height: 390px; }
  /* Fixed row heights on the asset page: details + photo 400px, attachments + QR 200px. */
  .asset-layout { grid-template-rows: 400px 200px auto; }
  .asset-layout .a-photo { min-height: 0; }
  .asset-layout .a-photo > div { display: flex; flex-direction: column; height: 100%; }
  .asset-layout .a-photo .hero-photo { flex: 1; height: auto; min-height: 0; }
  .asset-layout .a-det { overflow: hidden; }
  .asset-layout .a-att, .asset-layout .a-qr { display: flex; flex-direction: column; overflow: hidden; min-height: 0; }
  .asset-layout .a-att .card-pad { flex: 1; min-height: 0; overflow: hidden; padding: 6px; } /* no scrolling */
  /* Tight tiles: minimal padding around each attachment so a row fits the 200px panel. */
  .asset-layout .a-att .files { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
  /* 200px panel − 57px header − 12px padding − ~22px label/border ≈ 108px, so the bottom gap matches top/left (6px). */
  .asset-layout .a-att .file .prev { aspect-ratio: auto; height: 108px; }
  .asset-layout .a-att .file .nm { padding: 2px 5px; font-size: 0.68rem; }
  .asset-layout .a-qr .card-pad { flex: 1; min-height: 0; display: flex; align-items: center; padding-top: 10px; padding-bottom: 10px; }
} /* 30% taller than the earlier 300px; details panel matches it */
.hero-photo img { width: 100%; height: 100%; object-fit: contain; background: #1b2a30; }
.hero-photo svg { width: 48px; height: 48px; }
.hero-photo .count {
  position: absolute; right: 10px; bottom: 10px; background: rgba(0, 27, 58,0.7); color: #fff;
  font-size: 0.75rem; font-weight: 600; padding: 3px 9px; border-radius: 999px;
}
.strip { display: flex; gap: 8px; overflow-x: auto; margin-top: 8px; scrollbar-width: thin; }
.strip button { flex: none; width: 64px; height: 64px; padding: 0; border: 2px solid transparent; border-radius: var(--radius); overflow: hidden; cursor: pointer; background: var(--navy-050); }
.strip button.on { border-color: var(--brass); }
.strip img { width: 100%; height: 100%; object-fit: cover; }
/* CWO list: small photo thumbnail at the start of the row. */
.list-item .wo-thumb { width: 48px; height: 48px; align-self: center; }
/* Service Request list: one row per request, photo gallery on the left, details on the right
   (stacked on phones). */
.sr-grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
.sr-grid > :not(.sr-card) { grid-column: 1 / -1; }
.sr-card {
  display: flex; flex-direction: column; background: #fff; border: 1px solid var(--hairline-strong); border-radius: var(--radius-lg);
  overflow: hidden; color: inherit; text-decoration: none; transition: box-shadow 0.15s, border-color 0.15s;
}
.sr-card:hover { border-color: var(--navy-600); box-shadow: 0 4px 14px rgba(0, 41, 87, 0.12); }
.sr-media { position: relative; height: 190px; background: var(--navy-050); }
.sr-main { width: 100%; height: 100%; object-fit: cover; display: block; }
.sr-none { height: 100%; display: grid; place-content: center; justify-items: center; gap: 6px; color: var(--ink-faint); font-size: 0.8rem; }
.sr-none svg { width: 36px; height: 36px; }
.sr-badges { position: absolute; top: 10px; left: 10px; right: 84px; display: flex; flex-wrap: wrap; gap: 6px; }
.sr-badges .chip { text-transform: uppercase; letter-spacing: 0.03em; font-weight: 700; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); }
.sr-nav { position: absolute; top: 10px; right: 10px; display: flex; gap: 6px; }
.sr-nav button {
  width: 32px; height: 32px; border: 0; border-radius: 8px; padding: 0; cursor: pointer;
  background: rgba(0, 0, 0, 0.45); color: #fff; display: grid; place-items: center;
}
.sr-nav button:hover { background: rgba(0, 0, 0, 0.65); }
.sr-nav svg { width: 18px; height: 18px; }
.sr-thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 6px 6px 0; }
.sr-thumbs button { aspect-ratio: 4 / 3; padding: 0; border: 2px solid transparent; border-radius: 8px; overflow: hidden; cursor: pointer; background: var(--navy-050); }
.sr-thumbs button.on { border-color: var(--navy-600); }
.sr-thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sr-more {
  aspect-ratio: 4 / 3; border-radius: 8px; background: #3a3f45; color: #fff; display: grid; place-items: center;
  text-align: center; font-size: 0.85rem; font-weight: 600; line-height: 1.2;
}
.sr-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 5px; }
.sr-head { display: flex; justify-content: space-between; gap: 8px; font-size: 0.85rem; }
.sr-head b { color: var(--navy-800); }
.sr-head span { color: var(--ink-muted); white-space: nowrap; }
.sr-title { font-weight: 700; font-size: 1rem; color: var(--ink); margin-bottom: 4px; overflow-wrap: anywhere; }
.sr-fact { display: grid; grid-template-columns: 74px 1fr; gap: 8px; font-size: 0.8125rem; }
.sr-fact span { color: var(--ink-muted); }
.sr-fact b { font-weight: 500; color: var(--ink); overflow-wrap: anywhere; }
/* Compact cards, 2 per line from 700px, same height as the single-column rows: the photo fills
   the left 40% edge to edge (110px tall), details on the right. Phones: photo across the top. */
.sr-grid { gap: 10px; }
.sr-in { display: flex; flex-direction: column; flex: 1; }
.sr-gallery { display: flex; flex-direction: column; }
.sr-media { height: 150px; }
@media (min-width: 700px) {
  .sr-grid { grid-template-columns: 1fr 1fr; }
  .sr-in { flex-direction: row; }
  .sr-gallery { flex: none; width: 40%; border-right: 1px solid var(--hairline); }
  /* The photo is pinned inside its box, so its own size never makes the card taller: the card is as
     tall as its details (min 110px) and the photo fills that. */
  .sr-media { height: auto; flex: 1; min-height: 110px; }
  .sr-media > .sr-main, .sr-media > .sr-none { position: absolute; inset: 0; width: 100%; height: 100%; }
  /* Every card is exactly 190px (user's choice): the photo fills it above any thumbnail strip, and
     the details are centred (cut off rather than growing the card). */
  .sr-card { height: 190px; }
  /* Tighter sides so the WO no., status and priority stay on one line with the date. */
  .sr-body { padding-left: 8px; padding-right: 8px; }
  .sr-no { flex-wrap: nowrap; gap: 6px; }
  .sr-head { gap: 6px; flex-wrap: nowrap; }
  .sr-head b, .sr-head .chip { white-space: nowrap; }
  .sr-head b { font-size: 0.8rem; }
  .sr-badges .chip { letter-spacing: 0; padding: 2px 5px; }
  .sr-date { font-size: 0.72rem; }
  .sr-gallery { width: 33%; }
  .sr-in { min-height: 0; }
  .sr-media { min-height: 0; }
  .sr-body { overflow: hidden; }
  .sr-body { flex: 1; min-width: 0; justify-content: center; }
}
/* Status / priority badges sit beside the CWO number, on one line. */
.sr-head { align-items: center; }
.sr-no { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.sr-badges { position: static; display: inline-flex; gap: 4px; flex-wrap: nowrap; }
.sr-badges .chip { font-size: 0.62rem; padding: 2px 6px; white-space: nowrap; flex: none; letter-spacing: 0.02em; box-shadow: none; }
.sr-date { flex: none; }
.sr-nav { top: auto; bottom: 6px; right: 6px; gap: 4px; }
.sr-nav button { width: 24px; height: 24px; border-radius: 6px; }
.sr-nav svg { width: 14px; height: 14px; }
/* Thumbnails: a tight strip flush under the photo (no padding or rounding, 2px gaps). */
.sr-thumbs { gap: 2px; padding: 2px 0 0; }
.sr-thumbs button, .sr-more { border-radius: 0; aspect-ratio: 3 / 2; border-width: 2px; }
.sr-more { font-size: 0.7rem; }
.sr-body { padding: 8px 12px 10px; gap: 2px; }
.sr-title { font-size: 0.95rem; margin-bottom: 2px; }
.sr-fact { grid-template-columns: 64px 1fr; font-size: 0.78rem; }
/* CWO detail on phones: Details, Work description, photo, Progress, Assets, then everything else. */
@media (max-width: 899px) {
  .cwo-cols > .stack { display: contents; }
  .cwo-cols > .stack > * { order: 6; }
  .cwo-cols .c-det { order: 1; }
  .cwo-cols .c-desc { order: 2; }
  .cwo-cols .wo-photo { order: 3; }
  .cwo-cols .c-prog { order: 4; }
  .cwo-cols .c-assets { order: 5; }
}

.qr { display: flex; gap: 14px; align-items: center; }
.qr .code { width: 112px; height: 112px; flex: none; background: #fff; border: 1px solid var(--hairline); border-radius: var(--radius); padding: 4px; }
.qr .code svg { width: 100%; height: 100%; }

/* ---------- attachments ---------- */
.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.file {
  position: relative; border: 1px solid var(--hairline); border-radius: var(--radius); overflow: hidden;
  background: var(--surface-alt); cursor: pointer; display: flex; flex-direction: column; text-align: left; padding: 0;
}
.file .prev { aspect-ratio: 1; display: grid; place-items: center; background: var(--navy-050); color: var(--navy-600); overflow: hidden; position: relative; }
.file .prev img, .file .prev video { width: 100%; height: 100%; object-fit: cover; }
.file .prev .ext { font-weight: 800; font-size: 0.85rem; letter-spacing: 0.04em; }
.file .prev svg { width: 26px; height: 26px; }
.file .prev .play { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; background: rgba(0, 27, 58,0.25); }
.file .prev .play svg { width: 32px; height: 32px; }
.file .nm { font-size: 0.72rem; padding: 6px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-muted); }
.file .del {
  position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%;
  border: 0; background: rgba(0, 27, 58,0.65); color: #fff; display: grid; place-items: center; cursor: pointer;
}
.file .del svg { width: 14px; height: 14px; }

.picker { border: 1.5px dashed var(--hairline-strong); border-radius: var(--radius-lg); padding: 12px; background: var(--surface-alt); }
.picker .btn-row { justify-content: flex-start; }
.picker .files { margin-top: 10px; }
.picker .files:empty { display: none; }
.picker .hint { margin-top: 8px; }

/* ---------- forms ---------- */
.form { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 700px) { .form { grid-template-columns: 1fr 1fr; } .form .full { grid-column: 1 / -1; } }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: 0.8rem; font-weight: 600; color: var(--ink-muted); }
.field > span em { color: var(--danger); font-style: normal; }
/* Schedule form: "Recurrence pattern" (type radios | options) and "Range of recurrence" panels,
   each under a normal field label. */
.recur {
  min-width: 0; padding: 14px; display: grid; grid-template-columns: 1fr; gap: 14px;
  border: 1px solid var(--hairline); border-radius: var(--radius-lg); background: var(--navy-050);
}
.recur [hidden] { display: none !important; }
.recur-row em, .recur-sub em { color: var(--danger); font-style: normal; }
.recur-types { display: flex; flex-wrap: wrap; gap: 10px 18px; padding-bottom: 12px; border-bottom: 2px solid var(--navy-100); }
.recur-body > [data-p] { display: flex; flex-direction: column; gap: 16px; }
.recur-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: 0.9rem; }
/* Every input / dropdown box in both panels is the same size. */
/* All match the Start date box exactly: 180 × 42px, same padding, border and font. */
.recur-row input:not([type=radio]):not([type=checkbox]), .recur-row .dd-btn, .range-start input {
  box-sizing: border-box; width: 180px; max-width: 100%; height: 42px; min-height: 42px; flex: none;
  padding: 9px 11px; font-size: 16px; border: 1px solid var(--hairline-strong); border-radius: var(--radius); background: var(--surface);
}
.recur-row input[type=radio], .recur-row input[type=checkbox] { width: 18px; }
.recur-row .check { min-width: 120px; }
.recur-sub { display: flex; flex-direction: column; gap: 10px; }
.recur-sub > span { font-size: 0.8rem; font-weight: 600; color: var(--ink-muted); }
.wd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.range-start { display: flex; flex-direction: column; gap: 14px; }
.range-end { display: flex; flex-direction: column; gap: 16px; }
.recur .full-row { grid-column: 1 / -1; }
@media (min-width: 700px) {
  /* Same left column in both panels so their dividers line up. */
  .recur { grid-template-columns: 200px 1fr; column-gap: 20px; }
  .recur-types { flex-direction: column; flex-wrap: nowrap; gap: 16px; padding: 4px 16px 4px 0; border-bottom: 0; border-right: 2px solid var(--navy-100); }
  .range-start { padding-right: 16px; border-right: 2px solid var(--navy-100); }
  .range-end { padding-top: 22px; }
}
/* Schedule form: selected assets as removable chips; picker rows; checklist preview. */
.asset-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.achip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 4px 4px 10px; font-size: 0.85rem;
  border: 1px solid var(--hairline-strong); border-radius: 999px; background: var(--surface); }
.achip .icon-btn { width: 26px; height: 26px; }
.pick-list { max-height: 55vh; overflow: auto; display: flex; flex-direction: column; gap: 2px; }
.pick-row { padding: 8px 6px; border-bottom: 1px solid var(--hairline); align-items: flex-start; }
/* Checklist dialog: name | description | duration, then task cards
   (number + drag handle | text, type, options, answer preview | minutes, attachment, remark, delete). */
@media (min-width: 1200px) { .cl-form { grid-template-columns: 1fr 1.4fr 170px; } }
.cl-duration { min-height: 42px; display: flex; align-items: center; padding: 0 11px; font-weight: 700;
  border: 1px solid var(--hairline); border-radius: var(--radius); background: var(--navy-050); }
.task-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.task { display: flex; border: 1px solid var(--hairline-strong); border-left: 3px solid var(--navy-600);
  border-radius: var(--radius-lg); background: var(--surface); overflow: hidden; }
.task.dragging { opacity: 0.5; }
.task [hidden] { display: none !important; }
.task-num { flex: none; width: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  border-right: 1px solid var(--hairline); color: var(--ink-muted); }
.task-num b { font-size: 1.1rem; }
.task-grip { cursor: grab; display: grid; place-items: center; }
.task-grip svg { width: 16px; height: 16px; }
.task-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; padding: 12px 12px 0; }
.task-top { display: grid; grid-template-columns: 1fr; gap: 8px; }
@media (min-width: 700px) { .task-top { grid-template-columns: 1fr 200px; } }
.task-preview { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.task-preview textarea, .task-preview input[type=text] { width: 100%; }
.task-preview input[type=number], .task-preview input[type=date] { width: 180px; }
.pill-opt { padding: 6px 18px; border: 1px solid var(--navy-600); border-radius: 999px; color: var(--navy-600); font-size: 0.85rem; font-weight: 600; }
.switch { display: inline-block; flex: none; width: 40px; height: 22px; border-radius: 999px; background: var(--hairline-strong); position: relative; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; }
.task-bar { display: flex; align-items: center; gap: 4px; margin: 0 -12px; padding: 6px 8px 6px 12px;
  background: var(--surface-alt); border-top: 1px solid var(--hairline); }
.task-min { display: inline-flex; align-items: center; gap: 6px; font-size: 0.85rem; color: var(--ink-muted); }
.task-min svg { width: 15px; height: 15px; }
.task-min input { width: 64px; min-height: 32px; padding: 4px 8px; }
.task-bar .grow { flex: 1; }
.task-req { margin-left: 14px; font-size: 0.85rem; color: var(--ink-muted); }
.req-star { color: var(--danger); font-weight: 700; }
/* Answer values typed straight into the card. */
.task-opts { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.opt-row { display: flex; align-items: center; gap: 8px; width: 100%; max-width: 480px; }
.opt-row input { flex: 1; }
.opt-mark { flex: none; width: 16px; height: 16px; border: 2px solid var(--hairline-strong); }
.opt-mark.single { border-radius: 50%; }
.opt-mark.multi { border-radius: 3px; }
.opt-toggle, .opt-check { display: flex; align-items: center; gap: 12px; }
.opt-toggle input { width: 180px; flex: 0 1 180px; min-width: 0; }
/* Checklist dialog: the checklist being built on the left, existing checklists to pick tasks
   from on the right. On tablets/desktops it fills the screen and each side scrolls on its own,
   split by a clear divider; on phones the library stacks below. */
.cl-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.cl-library { display: flex; flex-direction: column; gap: 10px; padding: 12px; border: 1px solid var(--hairline);
  border-radius: var(--radius-lg); background: var(--navy-050); }
@media (min-width: 700px) {
  .sheet.xwide .cl-layout { flex: 1; min-height: 0; grid-template-columns: minmax(0, 1fr) minmax(300px, 32%); gap: 0;
    margin: 0 -22px -22px; border-top: 1px solid var(--hairline); }
  .sheet.xwide .cl-form { overflow: auto; padding: 18px 22px 22px; align-content: start; }
  .sheet.xwide .cl-library { overflow: auto; padding: 18px 18px 22px; border: 0; border-left: 3px solid var(--navy-100); border-radius: 0; }
}
.cl-lib-head { display: flex; flex-direction: column; gap: 2px; }
.cl-library .search { flex: none; background: var(--surface); } /* one line, not stretched down the column */
.cl-lib { display: flex; flex-direction: column; gap: 8px; }
.cl-lib details { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius); }
.cl-lib summary { display: flex; align-items: center; gap: 8px; padding: 8px 10px; cursor: pointer; list-style: none; }
.cl-lib summary::-webkit-details-marker { display: none; }
.cl-lib .grow { flex: 1; min-width: 0; }
.lib-task { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-top: 1px solid var(--hairline); font-size: 0.88rem; }
.lib-task.added { opacity: 0.55; }
.opt-check input[type=text] { width: 260px; }
.fake-upload { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border: 1px dashed var(--hairline-strong);
  border-radius: var(--radius); color: var(--ink-muted); font-size: 0.9rem; }
.fake-upload svg { width: 16px; height: 16px; }
.q-tools { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 16px; margin-top: 4px; }
.q-from { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; }
.q-from .field { width: 260px; }
.cl-preview ol, .cl-list { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 4px; }
.field .help { font-size: 0.75rem; color: var(--ink-faint); }
input[type=text], input[type=email], input[type=date], input[type=time], input[type=number], input[type=search], select, textarea {
  width: 100%; min-height: 42px; padding: 9px 11px;
  border: 1px solid var(--hairline-strong); border-radius: var(--radius); background: var(--surface);
  font-size: 16px; /* stops iOS zooming on focus */
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(0, 41, 87,0.25); border-color: var(--navy-600); }
.inline { display: flex; gap: 8px; align-items: center; }
.inline > * { flex: 1; }
.check { display: flex; gap: 9px; align-items: center; font-size: 0.9rem; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--navy-700); }
.form-actions {
  display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap;
}
@media (max-width: 699px) {
  .form-actions {
    position: sticky; bottom: calc(var(--bottomnav-h) + var(--safe-b)); margin: 18px -16px 0; padding: 12px 16px;
    background: rgba(245, 244, 241, 0.96); border-top: 1px solid var(--hairline); z-index: 5;
  }
  .form-actions .btn { flex: 1; }
}
.picker-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; text-align: left;
  min-height: 42px; padding: 8px 11px; border: 1px solid var(--hairline-strong); border-radius: var(--radius);
  background: var(--surface); cursor: pointer; width: 100%;
}
.picker-btn .ph { color: var(--ink-faint); }
.picker-btn svg { width: 16px; height: 16px; color: var(--ink-faint); flex: none; }

/* ---------- timeline ---------- */
.timeline { display: flex; flex-direction: column; }
.tl { display: flex; gap: 10px; padding: 10px 0; border-top: 1px solid var(--hairline); }
.tl:first-child { border-top: 0; }
.tl .dot { width: 28px; height: 28px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--navy-050); color: var(--navy-600); font-size: 0.7rem; font-weight: 700; }
.tl .dot svg { width: 14px; height: 14px; }
/* Kinds are prefixed (tl-comment, tl-file, …): a bare "file" class picked up the attachment-tile styles. */
.tl.tl-comment .dot { background: var(--plg-navy-tint); color: var(--plg-navy); }
.tl > div { flex: 1; min-width: 0; } /* lets long text (e.g. "Attached IMG_2026…jpg") wrap instead of overflowing the panel */
.tl .who { font-size: 0.78rem; color: var(--ink-faint); }
.tl .what { font-size: 0.9rem; overflow-wrap: anywhere; }
.comment-box { display: flex; gap: 8px; margin-top: 10px; align-items: flex-end; }
.comment-box textarea { min-height: 44px; height: 44px; }

/* ---------- calendar ---------- */
.cal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.cal-head h2 { flex: 1; text-align: center; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); border-top: 1px solid var(--hairline); border-left: 1px solid var(--hairline); background: var(--surface); border-radius: var(--radius-lg); overflow: hidden; }
.cal .dow { padding: 6px; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-faint); text-align: center; border-right: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline); background: var(--surface-alt); }
.cal .day { min-height: 54px; padding: 4px; border-right: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline); cursor: pointer; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cal .day.out { background: var(--surface-alt); color: var(--ink-faint); }
.cal .day.today .num { background: var(--navy-700); color: #fff; }
.cal .day.sel { box-shadow: inset 0 0 0 2px var(--brass); }
.cal .num { font-size: 0.75rem; font-weight: 700; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; }
.cal .dots { display: flex; gap: 3px; flex-wrap: wrap; padding-left: 3px; }
.cal .dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--navy-600); }
.cal .dots i.cor { background: var(--danger); }
.cal .dots i.proj { background: transparent; border: 1.5px solid var(--navy-600); width: 7px; height: 7px; }
.cal .dots i.done { background: var(--ok); }
.cal .ev { display: none; font-size: 0.7rem; padding: 1px 5px; border-radius: 3px; background: var(--navy-100); color: var(--navy-800); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal .ev.cor { background: var(--danger-tint); color: var(--danger); }
.cal .ev.proj { background: transparent; border: 1px dashed var(--navy-600); }
.cal .ev.done { background: var(--ok-tint); color: var(--ok); text-decoration: line-through; }
.cal .more { display: none; font-size: 0.68rem; color: var(--ink-faint); padding-left: 4px; }
@media (min-width: 800px) {
  .cal .day { min-height: 104px; }
  .cal .dots { display: none; }
  .cal .ev, .cal .more { display: block; }
}
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 0.75rem; color: var(--ink-muted); margin-top: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 9px; height: 9px; border-radius: 50%; background: var(--navy-600); display: inline-block; }
.legend i.cor { background: var(--danger); }
.legend i.proj { background: transparent; border: 1.5px solid var(--navy-600); }
.legend i.done { background: var(--ok); }
/* Settings: collapsible group cards. */
.fold-head { cursor: pointer; user-select: none; gap: 8px; }
.fold-head h2 { flex: 1; min-width: 0; }
.fold-chev { display: inline-flex; color: var(--ink-faint); transition: transform 0.15s; transform: rotate(90deg); }
.fold-chev svg { width: 18px; height: 18px; }
.card.folded .fold-chev { transform: none; }
.folded > :not(.fold-head) { display: none; }
.card.folded > .card-head { border-bottom: 0; }
/* Service categories (folding) with their problem types inside, in one card. */
.lk-search { padding-bottom: 6px; }
.lk-group { border-top: 1px solid var(--hairline); }
.lk-ghead { display: flex; align-items: center; padding: 10px 16px; background: var(--surface-alt); }
.lk-ghead h2 { font-size: 0.95rem; font-weight: 600; }
.lk-group .tbl td:first-child { padding-left: 44px; }
.lk-none { padding: 10px 16px 12px 44px; }
.lk-cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px 14px; max-height: 260px; overflow-y: auto;
  border: 1px solid var(--hairline); border-radius: var(--radius); padding: 10px 12px; }
/* PWO calendar: events in the status chip colours. */
.cal .ev.st-open { background: #1e88e5; color: #fff; }
.cal .ev.st-ack { background: #5e35b1; color: #fff; }
.cal .ev.st-progress { background: #fb8c00; color: #fff; }
.cal .ev.st-done { background: #2e9d4f; color: #fff; }
.cal .dots i.st-open, .legend i.st-open { background: #1e88e5; }
.cal .dots i.st-ack, .legend i.st-ack { background: #5e35b1; }
.cal .dots i.st-progress, .legend i.st-progress { background: #fb8c00; }
.cal .dots i.st-done, .legend i.st-done { background: #2e9d4f; }
/* (older frequency tints, no longer used by the calendar) */
.cal .ev.f-day { background: #e3f2fd; color: #1565c0; }
.cal .ev.f-week { background: #ede7f6; color: #5e35b1; }
.cal .ev.f-month { background: #e0f2f1; color: #00796b; }
.cal .ev.f-year { background: #fff3e0; color: #e65100; }
.cal .ev.proj { background: transparent; border: 1px dashed currentColor; }
.cal .ev.done { background: var(--surface-alt); color: var(--ink-faint); text-decoration: line-through; }
.cal .dots i.f-day, .legend i.f-day { background: #1565c0; }
.cal .dots i.f-week, .legend i.f-week { background: #5e35b1; }
.cal .dots i.f-month, .legend i.f-month { background: #00796b; }
.cal .dots i.f-year, .legend i.f-year { background: #e65100; }
.cal .dots i.proj { background: transparent; border: 1.5px solid var(--navy-600); }
.cal .dots i.f-day.proj { border-color: #1565c0; }
.cal .dots i.f-week.proj { border-color: #5e35b1; }
.cal .dots i.f-month.proj { border-color: #00796b; }
.cal .dots i.f-year.proj { border-color: #e65100; }
.cal .dots i.done, .legend i.done { background: var(--ink-faint); }
.cal-views { margin-bottom: 12px; }
.cal-sel { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.cal-sel .label { margin: 0; }
.cal-count { margin: -2px 0 10px; text-align: center; }

/* ---------- modal / sheet ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 60; background: rgba(0, 27, 58,0.5);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade 0.15s;
}
.sheet {
  background: var(--surface); width: 100%; max-height: 92vh; overflow: auto;
  border-radius: 16px 16px 0 0; padding: 18px 16px calc(18px + var(--safe-b));
  box-shadow: var(--shadow-pop); animation: up 0.2s ease-out;
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 10px; }
@media (min-width: 700px) {
  .overlay { align-items: center; padding: 24px; }
  .sheet { max-width: 560px; border-radius: var(--radius-lg); padding: 22px; }
  .sheet.wide { max-width: 760px; }
  /* Large working dialog (e.g. the checklist builder): 80% of the screen. */
  .sheet.xwide { max-width: none; width: 80vw; height: 80vh; max-height: none; display: flex; flex-direction: column; overflow: hidden; }
}
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(30px); opacity: 0.6; } }

.lightbox {
  position: fixed; inset: 0; z-index: 80; background: rgba(0, 10, 14, 0.94);
  display: flex; flex-direction: column;
}
.lightbox .lb-top { display: flex; align-items: center; gap: 10px; padding: 10px 12px; color: #fff; padding-top: calc(10px + env(safe-area-inset-top, 0px)); }
.lightbox .lb-top .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.9rem; }
.lightbox .icon-btn { color: #fff; }
.lightbox .icon-btn:hover { background: rgba(255, 255, 255, 0.1); }
/* Scrollable photo viewer: the photo is shown at full width and the area scrolls. */
.lightbox .lb-body {
  flex: 1; min-height: 0; overflow: auto; position: relative;
  touch-action: pan-x pan-y; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
}
.lightbox .lb-stage { display: flex; min-width: 100%; min-height: 100%; width: max-content; }
.lightbox .lb-stage img {
  display: block; margin: auto; max-width: none; max-height: none; height: auto;
  cursor: zoom-in; user-select: none; -webkit-user-drag: none;
}
.lightbox.zoomed .lb-stage img { cursor: grab; }
.lightbox.dragging .lb-stage img { cursor: grabbing; }
.lightbox .lb-stage video { margin: auto; max-width: 100vw; max-height: calc(100vh - 70px); }
.lightbox .lb-pct { color: rgba(255, 255, 255, 0.8); font-size: 0.8rem; min-width: 42px; text-align: center; font-variant-numeric: tabular-nums; }
.lightbox.zoomed .nav { display: none; }
.asset-title { word-break: break-word; }
.page-head .sub + .sub { margin-top: 0; }
.lightbox .nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, 0.12); color: #fff; cursor: pointer; display: grid; place-items: center; }
.lightbox .nav.prev { left: 10px; }
.lightbox .nav.next { right: 10px; }
.lightbox .nav svg { width: 22px; height: 22px; }

.progress { height: 6px; background: var(--navy-100); border-radius: 3px; overflow: hidden; margin-top: 10px; }
.progress > div { height: 100%; background: var(--brass); width: 0; transition: width 0.2s; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 90;
  bottom: calc(var(--bottomnav-h) + var(--safe-b) + 18px);
  background: var(--navy-900); color: #fff; padding: 11px 18px; border-radius: 8px;
  font-size: 0.875rem; font-weight: 500; box-shadow: var(--shadow-pop); max-width: calc(100vw - 32px);
  animation: up 0.2s ease-out;
}
.toast.err { background: var(--danger); }
@media (min-width: 900px) { .toast { bottom: 28px; } }

.empty { padding: 36px 16px; text-align: center; color: var(--ink-muted); }
.empty svg { width: 40px; height: 40px; color: var(--hairline-strong); margin: 0 auto 10px; }
.empty .btn { margin-top: 14px; }

.loading { padding: 48px; display: grid; place-items: center; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--navy-100); border-top-color: var(--navy-600); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.menu {
  position: absolute; right: 12px; top: calc(var(--topbar-h) + 4px); z-index: 70;
  background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop); min-width: 220px; padding: 6px; color: var(--ink);
}
.menu .who { padding: 10px 12px; border-bottom: 1px solid var(--hairline); margin-bottom: 4px; }
.menu a { display: block; padding: 10px 12px; border-radius: var(--radius); color: var(--ink); font-size: 0.9rem; }
.menu a:hover { background: var(--navy-050); }

table.tbl { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.tbl th { text-align: left; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-faint); font-weight: 600; padding: 10px 16px; border-bottom: 1px solid var(--hairline); }
.tbl td { padding: 10px 16px; border-bottom: 1px solid var(--hairline); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.scroll-x { overflow-x: auto; }
/* Home work-order table: clickable rows. */
.home-wo tbody tr { cursor: pointer; }
.home-wo tbody tr:hover td, .home-wo tbody tr:focus-visible td { background: var(--navy-050); }
.home-wo td { padding-top: 9px; padding-bottom: 9px; }
.home-wo th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.home-wo th.sortable:hover, .home-wo th.on { color: var(--plg-navy); }
.home-wo .sort-ar { margin-left: 5px; font-size: 0.65rem; opacity: 0.55; }
.home-wo th.on .sort-ar { opacity: 1; }
.home-wo .hw-img { width: 56px; padding-right: 0; }
/* Every column fits its data; only Subject / Schedule (3rd) takes the spare width. Every row has the
   same 44px photo slot (blank when there's no photo), so all rows are the same height. */
.home-wo th, .home-wo td { width: 1%; white-space: nowrap; }
.home-wo th:nth-child(3), .home-wo td:nth-child(3) { width: auto; white-space: normal; }
/* Location gets a share of the width. The table never scrolls sideways: it fits its card, and on
   narrow screens the cells wrap instead. */
.home-wo th:nth-child(4), .home-wo td:nth-child(4) { width: 13%; }  /* Location */
.home-wo { min-width: 0; width: 100%; }
@media (max-width: 1100px) { .home-wo td { white-space: normal; } }
.home-wo td { height: 70px; }
.home-wo td.hw-img .ph { width: 44px; height: 44px; border-radius: var(--radius); background: var(--navy-050); }
.home-wo td.hw-img img { width: 44px; height: 44px; object-fit: cover; border-radius: var(--radius); display: block; }
/* Bigger photo (60px) and tighter cells (5px top/bottom, 10px sides). */
.home-wo th, .home-wo td { padding-left: 10px; padding-right: 10px; }
.home-wo td { padding-top: 5px; padding-bottom: 5px; }
.home-wo th.hw-img, .home-wo td.hw-img { padding-left: 6px; padding-right: 2px; }
/* Photo column 5% and WO No. 10% (≈80px / 170px on a 1720px table). The square photo fills its
   column, up to 72px. */
.home-wo th.hw-img, .home-wo td.hw-img { width: 5%; }
.home-wo td.hw-img img, .home-wo td.hw-img .ph { width: 100%; max-width: 72px; height: auto; aspect-ratio: 1 / 1; }
.home-wo th:nth-child(2), .home-wo td:nth-child(2) { width: 10%; }
.home-wo td { height: 82px; }

/* ---------- in-app dropdowns (replace native <select>) ---------- */
select.dd-native { display: none !important; }
.dd-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%;
  min-height: 42px; padding: 7px 11px; text-align: left; cursor: pointer;
  border: 1px solid var(--hairline-strong); border-radius: var(--radius); background: var(--surface);
  font-size: 15px; color: var(--ink);
}
.dd-btn:focus-visible { outline: 2px solid rgba(0, 41, 87,0.25); border-color: var(--navy-600); }
.dd-btn svg { width: 16px; height: 16px; flex: none; color: var(--ink-faint); }
.dd-btn .dd-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd-btn .dd-label small { display: block; font-size: 0.72rem; color: var(--ink-faint); line-height: 1.2; }
.dd-btn .dd-label.ph { color: var(--ink-faint); }
.toolbar .dd-btn { width: auto; min-width: 150px; flex: 0 1 auto; }
.toolbar .dd-btn.filter-select { min-width: 200px; } /* WO list Stage / Created by */
/* Multi-select filter: a dd-btn that opens a tick list. */
.mf { position: relative; flex: 0 1 auto; }
.mf .dd-btn { width: 100%; }
.mf-pop {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 30; min-width: 250px; max-height: 340px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--hairline-strong); border-radius: var(--radius); box-shadow: var(--shadow-card);
  padding: 6px;
}
.mf-pop .check { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 4px; cursor: pointer; white-space: nowrap; }
.mf-pop .check:hover { background: var(--navy-050); }
.mf-actions { display: flex; justify-content: space-between; border-top: 1px solid var(--hairline); margin-top: 4px; padding-top: 4px; }
.mf-actions button { border: 0; background: none; color: var(--navy-600); font-weight: 600; font-size: 0.82rem; cursor: pointer; padding: 6px 8px; }
.dd-btn.prop-select { background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.2); color: #fff; padding: 6px 10px; min-height: 38px; font-size: 0.85rem; width: 100%; }
.dd-btn.prop-select svg { color: rgba(255, 255, 255, 0.75); }

.dd {
  position: fixed; z-index: 95; background: var(--surface); color: var(--ink);
  display: flex; flex-direction: column; overflow: hidden;
}
.dd-pop { border: 1px solid var(--hairline); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); animation: fade 0.12s; }
.dd-sheet {
  left: 0; right: 0; bottom: 0; max-height: 72vh; border-radius: 16px 16px 0 0;
  padding-bottom: var(--safe-b); box-shadow: var(--shadow-pop); animation: up 0.18s ease-out;
}
.dd-backdrop { position: fixed; inset: 0; z-index: 94; background: rgba(0, 27, 58,0.45); animation: fade 0.15s; }
.dd-title { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 6px 18px; }
.dd-search { display: flex; align-items: center; gap: 8px; margin: 8px; padding: 0 10px; border: 1px solid var(--hairline-strong); border-radius: var(--radius); }
.dd-search svg { width: 16px; height: 16px; color: var(--ink-faint); flex: none; }
.dd-search input { border: 0 !important; outline: none !important; min-height: 38px !important; padding: 6px 0 !important; flex: 1; }
.dd-list { overflow-y: auto; padding: 4px; flex: 1; overscroll-behavior: contain; }
.dd-opt {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%;
  padding: 10px 12px; border: 0; background: none; border-radius: var(--radius); cursor: pointer;
  text-align: left; font-size: 0.92rem; color: var(--ink);
}
.dd-opt:hover { background: var(--navy-050); }
.dd-opt.on { background: var(--navy-100); font-weight: 600; color: var(--navy-800); }
.dd-opt.ph { color: var(--ink-faint); }
.dd-opt svg { width: 16px; height: 16px; color: var(--navy-600); flex: none; }
.dd-sheet .dd-opt { padding: 13px 14px; font-size: 1rem; }
.dd-group { padding: 10px 12px 4px; font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-faint); }
.dd-empty { padding: 16px; text-align: center; color: var(--ink-faint); font-size: 0.875rem; }
.dd-add {
  display: flex; align-items: center; gap: 8px; border: 0; border-top: 1px solid var(--hairline);
  background: var(--surface-alt); padding: 12px 14px; font-weight: 600; font-size: 0.875rem; color: var(--navy-600); cursor: pointer;
}
.dd-add svg { width: 16px; height: 16px; }

.barcode { margin-top: 10px; background: #fff; border: 1px solid var(--hairline); border-radius: var(--radius); padding: 12px; display: flex; justify-content: center; }
.barcode svg { max-width: 100%; height: auto; }
.more-details { border-top: 1px solid var(--hairline); padding-top: 12px; }
.more-details summary { cursor: pointer; font-weight: 600; font-size: 0.875rem; color: var(--navy-600); }
.search .icon-btn { margin-right: -6px; color: var(--navy-600); }

.banner { padding: 12px 14px; border-radius: var(--radius); background: var(--warn-tint); color: var(--warn); font-size: 0.875rem; margin-bottom: 14px; }

/* Signature capture (planned WO start / complete) and the signed copies on the detail page. */
.sig-pad { position: relative; height: 160px; border: 1.5px dashed var(--line, #cbd5e1); border-radius: 10px; background: #fff; touch-action: none; }
.sig-pad canvas { width: 100%; height: 100%; display: block; cursor: crosshair; touch-action: none; }
.sig-hint { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); color: #94a3b8; font-size: 0.85rem; pointer-events: none; }
.sig-pad.signed .sig-hint { display: none; }
[data-sig] .btn { margin-top: 6px; }
.sig-list { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.sig-img { display: block; width: 100%; max-width: 320px; height: 110px; object-fit: contain; border: 1px solid var(--line, #e2e8f0); border-radius: 8px; background: #fff; margin-bottom: 4px; }
.kv.sched-kv { grid-template-columns: 1fr 1fr; }
.comment-box:first-child { margin: 0 0 10px; }

/* Fillable checklist (PWO Complete dialog): pill radios for Yes/No and toggle tasks, and the recorded answers. */
.pill-pick { display: inline-flex; cursor: pointer; }
.pill-pick input { position: absolute; opacity: 0; pointer-events: none; }
.pill-pick span { padding: 6px 18px; border: 1px solid var(--navy-600); border-radius: 999px; color: var(--navy-600); font-size: 0.85rem; font-weight: 600; }
.pill-pick input:checked + span { background: var(--navy-600); color: #fff; }
.pill-pick input:focus-visible + span { outline: 2px solid var(--navy-600); outline-offset: 2px; }
.task-answer { font-size: 0.95rem; margin-top: 4px; word-break: break-word; }
/* Live toggle in the fillable checklist: the builder's .switch, made clickable. */
.toggle-pick { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.toggle-pick input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-pick .switch { transition: background 0.15s; }
.toggle-pick .switch::after { transition: transform 0.15s; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); }
.toggle-pick input:checked + .switch { background: var(--navy-600); }
.toggle-pick input:checked + .switch::after { transform: translateX(18px); }
.toggle-pick input:focus-visible + .switch { outline: 2px solid var(--navy-600); outline-offset: 2px; }
/* PWO details: schedule-page spacing, but three equal-width columns. */
@media (min-width: 640px) { .kv.kv-fill.kv-equal { grid-template-columns: 37.5% 37.5% 25%; } } /* first two equal, last column starts at 75% */
/* PWO edit form: Coordinator always starts a row so Assign to sits beside it. */
@media (min-width: 700px) { .form .row-start { grid-column: 1; } }
/* Movement rows (asset page panel and its Show all dialog): "from ⟶ to" always on one line; long location codes are cut with "…". */
.mv-row .body { min-width: 0; }
.mv-row .mv-line { flex-wrap: nowrap; white-space: nowrap; overflow: hidden; }
.mv-row .mv-line b { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.mv-row .mv-line span { flex: none; }

/* Phones: no sideways scrolling, and the bottom menu stays put.
   iOS zooms in on any field under 16px when tapped, which leaves the page wider than the
   screen (sideways scroll, bottom menu appears to drift), so fields are 16px here. */
@media (max-width: 899px) {
  html, body { overflow-x: hidden; }
  @supports (overflow: clip) { html, body { overflow-x: clip; } }
  input[type=text], input[type=email], input[type=date], input[type=time], input[type=number], input[type=search],
  select, textarea, .search input, .search input[type=search], .dd-search input[type=search] { font-size: 16px; }
  .bottomnav { position: fixed; bottom: 0; left: 0; right: 0; width: 100%; }
}

/* ---------- Insight ----------
   Two series in fixed order (validated default categorical slots 1–2): Created = blue, Closed = orange.
   Values and labels stay in text colours; the coloured swatch carries the identity. */
:root { --series-1: #2a78d6; --series-2: #eb6834; }
.ins-legend { display: flex; gap: 16px; flex-wrap: wrap; color: var(--ink-muted); }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.sw.s1 { background: var(--series-1); }
.sw.s2 { background: var(--series-2); }
.ins-chart { position: relative; display: flex; gap: 8px; height: 240px; }
.ins-axis { display: flex; flex-direction: column; justify-content: space-between; padding-bottom: 22px; margin-top: -7px;
  font-size: 0.72rem; color: var(--ink-faint); text-align: right; min-width: 24px; }
.ins-plot { position: relative; flex: 1; min-width: 0; }
.ins-gw { position: absolute; left: 0; right: 0; top: 0; bottom: 22px; }
.ins-grid { position: absolute; left: 0; right: 0; height: 0; border-top: 1px solid var(--hairline); }
.ins-grid:first-child { border-top-color: var(--hairline-strong); }
.ins-cols { position: absolute; inset: 0; display: flex; }
.ins-col { flex: 1; min-width: 0; display: flex; flex-direction: column; cursor: default; border-radius: 6px; outline: none; }
.ins-col.on, .ins-col:focus-visible { background: rgba(0, 41, 87, 0.05); }
.ins-bars { flex: 1; display: flex; align-items: flex-end; justify-content: center; gap: 2px; padding: 0 12%; }
.ins-bars .b { flex: 1; max-width: 18px; border-radius: 4px 4px 0 0; min-height: 0; }
.ins-bars .b.s1 { background: var(--series-1); }
.ins-bars .b.s2 { background: var(--series-2); }
.ins-x { height: 22px; line-height: 22px; text-align: center; font-size: 0.72rem; color: var(--ink-muted); white-space: nowrap; overflow: hidden; }
.ins-tip { position: absolute; top: -6px; transform: translate(-50%, -100%); z-index: 5; pointer-events: none;
  background: var(--surface); border: 1px solid var(--hairline-strong); border-radius: 8px; box-shadow: var(--shadow-pop);
  padding: 8px 10px; font-size: 0.8rem; white-space: nowrap; color: var(--ink); }
.ins-tip div { margin-top: 3px; }
.ins-table { margin-top: 12px; }
.ins-table summary { cursor: pointer; color: var(--navy-600); }
.ins-table table { margin-top: 8px; }
.ins-breakdowns { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 700px) { .ins-breakdowns { grid-template-columns: 1fr 1fr; } }
.hb-list { display: flex; flex-direction: column; gap: 9px; }
.hb { display: grid; grid-template-columns: minmax(0, 42%) 1fr auto; align-items: center; gap: 10px; font-size: 0.85rem; }
.hb-l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.hb-t { height: 12px; }
.hb-b { display: block; height: 100%; min-width: 3px; border-radius: 0 4px 4px 0; background: var(--series-1); }
.hb-v { font-weight: 600; min-width: 28px; text-align: right; }
/* Repeat breakdowns table: the Asset column keeps ID and description on one line each;
   the other 5 columns share the rest evenly and wrap. All left-aligned. */
table.tbl.ins-assets { min-width: 840px; }
.ins-assets td, .ins-assets th { vertical-align: top; text-align: left; width: 16%; overflow-wrap: anywhere; padding-left: 12px; padding-right: 12px; }
.ins-assets td:first-child, .ins-assets th:first-child { width: auto; white-space: nowrap; overflow-wrap: normal; }
.ins-assets .num { text-align: left; }
/* Users & access: one checkbox column per role. */
.users-tbl .role-col { text-align: center; white-space: nowrap; }
/* Read-only (change roles via Edit), but keep the ticks in full colour. */
.users-tbl td.role-col input { width: 18px; height: 18px; accent-color: var(--navy-800); opacity: 1; pointer-events: none; }
/* Ask Insight chat. */
.chat-log { max-height: 420px; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.chat-sugg { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chat-sugg .btn { white-space: normal; text-align: left; }
.msg { max-width: 85%; padding: 10px 14px; border-radius: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.msg.me { align-self: flex-end; background: var(--navy-800); color: #fff; border-bottom-right-radius: 4px; white-space: pre-wrap; }
.msg.bot { align-self: flex-start; background: var(--navy-100); color: var(--ink); border-bottom-left-radius: 4px; }
.msg.bot.err { background: #fdecec; color: #a12622; }
.msg p { margin: 0 0 6px; }
.msg p:last-child, .msg ul:last-child, .msg ol:last-child { margin-bottom: 0; }
.msg ul, .msg ol { margin: 0 0 6px; padding-left: 20px; }
.msg code { background: rgba(0, 0, 0, 0.06); padding: 1px 4px; border-radius: 4px; font-size: 0.85em; }
.msg .chat-tbl { background: #fff; border-radius: 8px; margin: 4px 0 6px; font-size: 0.8125rem; }
.msg .chat-tbl th, .msg .chat-tbl td { padding: 6px 10px; }
.chat-form { display: flex; gap: 8px; align-items: flex-end; padding: 12px 16px; border-top: 1px solid var(--hairline); }
.chat-form textarea { flex: 1; resize: none; min-height: 42px; max-height: 140px; }
.chat-form .btn { flex: none; height: 42px; }

/* Assets list pager (50 per page, paged on the server). */
.pager { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 14px 0 80px; }
.pager .grow { flex: 1; }
.pager .btn[disabled] { opacity: 0.45; pointer-events: none; }
.pager input.pg-input { width: 64px; min-height: 32px; padding: 4px 6px; text-align: center; display: inline-block; margin: 0 4px; }

/* ---------- Home: header, filter bar, tabs, KPI cards ---------- */
.home-hero { display: flex; align-items: center; gap: 16px; padding: 0; margin-bottom: 16px; flex-wrap: wrap; }
.home-hero .grow { flex: 1; min-width: 220px; }
.home-hero h1 { font-size: 1.6rem; font-weight: 800; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.home-hero .muted { margin-top: 4px; }
.hero-badge { font-size: 0.75rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--navy-100); color: var(--navy-800); }
.btn.outline-accent { background: var(--surface); color: var(--navy-800); border: 1.5px solid var(--navy-800); }
.btn.outline-accent:hover { background: var(--navy-050); }
.btn.outline-accent.on { background: var(--navy-800); color: #fff; } /* Home "Assigned to me" while filtering */
.home-filter { padding: 16px 18px; margin-bottom: 18px; }
.hf-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.hf-row .dd-btn { width: auto; min-width: 200px; min-height: 40px; }
.hseg { display: inline-flex; border: 1px solid var(--hairline-strong); border-radius: var(--radius); overflow: hidden; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.hseg button { flex: none; border: 0; border-left: 1px solid var(--hairline-strong); background: var(--surface); padding: 9px 12px; font: inherit; font-size: 0.85rem; color: var(--ink); cursor: pointer; white-space: nowrap; }
.hseg button:first-child { border-left: 0; }
.hseg button:hover { background: var(--navy-050); }
.hseg button.on { background: var(--navy-800); color: #fff; font-weight: 700; }
.hf-custom { display: inline-flex; align-items: center; gap: 6px; }
.hf-custom input { min-height: 40px; }
.hf-custom[hidden] { display: none; }
.btn.icon-only { padding: 8px 10px; }
.hf-meta { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; border-top: 1px solid var(--hairline); margin-top: 14px; padding-top: 12px; color: var(--ink-muted); }
.hf-meta span { display: inline-flex; align-items: center; gap: 5px; }
.hf-meta b { color: var(--ink); font-weight: 600; }
.hf-meta svg { width: 14px; height: 14px; color: var(--navy-700); }
.hf-meta .grow { flex: 1; }
.home-tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--hairline-strong); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.home-tabs button { display: inline-flex; align-items: center; gap: 8px; border: 0; background: none; padding: 12px 18px; font: inherit; font-size: 1rem; font-weight: 700;
  color: var(--ink-muted); border-bottom: 2.5px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap; }
.home-tabs button svg { width: 17px; height: 17px; }
.home-tabs button.on { color: var(--navy-800); border-color: var(--navy-800); }
[data-pane][hidden] { display: none; }
.kpis { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
@media (min-width: 1300px) { .kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.kpi { padding: 18px 16px; color: inherit; display: flex; flex-direction: column; gap: 10px; min-height: 150px; }
a.kpi:hover { box-shadow: var(--shadow-card); }
.kpi-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.kpi-label { font-weight: 600; font-size: 0.92rem; color: var(--ink); line-height: 1.3; }
.kpi-ic { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; }
.kpi-ic svg { width: 18px; height: 18px; }
.kpi-ic.t-orange { background: #fff1e0; color: #e8890c; }
.kpi-ic.t-green { background: #e6f4ea; color: #2e9d4f; }
.kpi-ic.t-blue { background: #e3f0fb; color: #1e88e5; }
.kpi-ic.t-red { background: transparent; color: var(--danger); }
.kpi-ic.t-purple { background: #efe8fb; color: #6d3fc8; }
.kpi-ic.t-teal { background: #e0f5f3; color: #00897b; }
.kpi-v { font-size: 2rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-v small { font-size: 0.95rem; font-weight: 500; color: var(--ink); }
.kpi-foot { font-size: 0.8rem; color: var(--ink-muted); margin-top: auto; }
.kd { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; }
.kd svg { width: 14px; height: 14px; }
.kd.good { color: #2e9d4f; }
.kd.bad { color: var(--danger); }
.kd.flat { color: var(--ink-muted); }
.kpi.hot { background: var(--danger-tint); border-color: #e9b4ad; }
.kpi.hot .kpi-v, .kpi.hot .kpi-foot { color: var(--danger); }
.kpi.hot .kpi-foot { font-weight: 600; }
.home-h2 { font-size: 1.05rem; margin: 24px 0 10px; }
@media (max-width: 640px) {
  .home-hero h1 { font-size: 1.3rem; }
  .hf-row .dd-btn { min-width: 0; width: 100%; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { min-height: 0; padding: 14px 12px; }
  .kpi-v { font-size: 1.6rem; }
}
@media (min-width: 760px) { .stats.two { grid-template-columns: repeat(2, 1fr); } }
.quick.one { margin-top: 18px; grid-auto-columns: minmax(0, 320px); }
/* Insight monthly trend as lines (points sit at each month column's centre). */
.ins-lines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.ins-lines .ln { fill: none; stroke-width: 2.5; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; }
.ins-lines .ln.s1 { stroke: var(--series-1); }
.ins-lines .ln.s2 { stroke: var(--series-2); }
.ins-gw .dot { position: absolute; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: var(--surface); border: 2px solid; }
.ins-gw .dot.s1 { border-color: var(--series-1); }
.ins-gw .dot.s2 { border-color: var(--series-2); }
/* Home: KPI cards pick what the list below shows. */
button.kpi { font: inherit; text-align: left; cursor: pointer; width: 100%; }
button.kpi:hover { box-shadow: var(--shadow-card); }
.kpi.sel { outline: 2px solid var(--navy-800); outline-offset: -2px; box-shadow: var(--shadow-card); }
.kpi.hot.sel { outline-color: var(--danger); }
.home-list { margin-top: 18px; }
.home-hero .btn + .btn { margin-left: 0; }
.home-list .hl-head { margin: 4px 2px 12px; }
.home-list .hl-head h2 { font-size: 19px; }
/* KPI cards: all six on one row on desktop; label and footer each stay on one line. */
@media (min-width: 1100px) { .kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; } }
.kpi-top { min-width: 0; }
.kpi-label, .kpi-foot { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.kpi-label { font-size: 0.85rem; flex: 1; }
.kpi-foot { font-size: 0.76rem; }
.kd { white-space: nowrap; }
.kpi-ic { width: 30px; height: 30px; }
.kpi-label, .kpi-foot { text-overflow: clip; }
/* '+7 (+233.3%)' and 'vs prev' sit on the same centre line. */
.kpi-foot { display: flex; align-items: center; gap: 4px; line-height: 1.3; }
.kpi-foot .kd { line-height: inherit; }
.kpi-foot .kd svg { display: block; }
/* Card title may wrap to two lines; the line under the number is smaller and stays on one line. */
.kpi-label { white-space: normal; overflow: visible; text-overflow: clip; }
.kpi-foot { font-size: 0.7rem; text-overflow: ellipsis; }
.kd svg { width: 12px; height: 12px; }
/* The line under the number may wrap to two lines too. */
.kpi-foot { white-space: normal; overflow: visible; text-overflow: clip; flex-wrap: wrap; row-gap: 2px; }
/* KPI row: 6 across when all titles fit in 2 lines (JS adds .six), else 3 + 3. Phones keep 2 across. */
.kpi-label { line-height: 1.3; }
@media (min-width: 641px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } .kpis.six { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
/* Insight: resolution speed + backlog aging. */
.ins-kv { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 10px; font-size: 0.85rem; color: var(--ink-muted); }
.ins-kv b { color: var(--ink); font-size: 1rem; }
.hb-list.aging .hb:nth-child(n+4) .hb-b { background: var(--danger); }
.home-list .pager { margin: 0; padding: 10px 16px; border-top: 1px solid var(--hairline); }
/* Resolution speed + backlog aging: two equal, aligned cards under the breakdowns. */
.ins-two { display: grid; gap: 14px; grid-template-columns: 1fr; align-items: stretch; }
@media (min-width: 900px) { .ins-two { grid-template-columns: 1fr 1fr; } }
.ins-two .card-head { align-items: flex-start; min-height: 74px; }
/* Insight speed / aging bars: label above a thin rounded track. */
.lb-list { display: flex; flex-direction: column; gap: 14px; }
.lb-top { display: flex; justify-content: space-between; gap: 8px; font-size: 0.85rem; font-weight: 700; margin-bottom: 6px; }
.lb-top b { font-weight: 600; color: var(--ink-muted); }
.lb-t { display: block; height: 8px; border-radius: 999px; background: #eeeeee; overflow: hidden; }
.lb-b { display: block; height: 100%; border-radius: 999px; }
.lb-b.c0 { background: #2e9d4f; }
.lb-b.c1 { background: #1e88e5; }
.lb-b.c2 { background: #f5a623; }
.lb-b.c3 { background: #f7891f; }
.lb-b.c4 { background: #d0021b; }
/* CWO / PWO list filters: every dropdown (Stage, Created by, Category, Location, Priority) the same size and look. */
.wo-filters .mf, .wo-filters .wf-fields > .dd-btn.filter-select { flex: 0 0 210px; width: 210px; min-width: 0; }
.wo-filters .dd-btn.filter-select { min-width: 0; }
.wo-filters .dd-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.wo-filters .dd-btn .dd-label.ph { color: inherit; }
/* The filters sit in .wf-fields, which is invisible to the layout on desktop. On phones the toolbar
   is just the search + a Filter button (with a count), and the filters open in a dialog. */
.wf-fields { display: contents; }
.wf-open { display: none; }
.wf-count:not(:empty) {
  margin-left: 6px; min-width: 20px; padding: 1px 6px; border-radius: 999px;
  background: var(--navy-800); color: #fff; font-size: 0.72rem; font-weight: 700; text-align: center;
}
@media (max-width: 899px) {
  .wo-filters { flex-wrap: nowrap; }
  .wo-filters .wf-fields { display: none; }
  .wo-filters .search { flex: 1 1 0; min-width: 0; }
  .wo-filters .wf-open { display: inline-flex; align-items: center; flex: none; min-height: 42px; }
}
/* Wider screens switch to the same search + Filter button when the filters would wrap to a 2nd line
   (JS adds .wf-compact, see fitWoFilterBar). */
.wo-filters.wf-compact { flex-wrap: nowrap; }
.wo-filters.wf-compact .wf-fields { display: none; }
.wo-filters.wf-compact .search { flex: 1 1 0; min-width: 0; }
.wo-filters.wf-compact .wf-open { display: inline-flex; align-items: center; flex: none; min-height: 42px; }
.wf-sheet .wf-fields { display: flex; flex-direction: column; gap: 10px; }
.wf-sheet .mf, .wf-sheet .wf-fields > .dd-btn.filter-select { flex: none; width: 100%; }
.wf-sheet .mf-pop { position: static; margin-top: 4px; min-width: 0; max-height: 260px; box-shadow: none; }
/* Page tabs (Work orders / Schedules / Calendar): bigger and clearer. */
.tabs { gap: 6px; border-bottom: 1px solid var(--hairline-strong); margin-bottom: 18px; }
.tabs a { padding: 12px 22px; font-size: 1.05rem; font-weight: 700; border-bottom-width: 3px; }
.tabs a:hover { color: var(--navy-800); background: var(--navy-050); }
.tabs a.on { color: var(--navy-800); border-color: var(--navy-800); }
/* Left panel: wide enough for "Preventive Maintenance" on one line; any longer label wraps instead of being cut. */
@media (min-width: 900px) { .sidebar { width: 292px; } }
.sidebar .navlink span { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.25; }

/* ===== Millenia theme (2026-10-30) =====
   Colours, font and finish follow the whole Tenant Portal (tenant.milleniasingapore.com/portal and
   its admin pages): deep navy, ivory paper, charcoal text, coral accents, blush highlight on navy,
   beige hairlines, Jost (+ Cormorant Garamond italic as the accent face), square-ish cards, pill
   search fields and uppercase letter-spaced buttons. Only the look changes: no sizes or positions
   are touched here (keep it that way). The bright WO status chips stay. */
:root {
  --plg-navy: #0F2540;
  --mil-navy-2: #16324F;
  --mil-coral: #BD5C45;
  --mil-coral-deep: #A94E39;
  /* 2026-11-03: the user tried the light Pontiac Land blue here, then asked for the pink back. */
  --mil-coral-soft: #E9A98F;
  --mil-blush: #E7B7BE;
  --font-script: 'Cormorant Garamond', Georgia, serif;
  --plg-text: #2B2E33;
  --plg-text-muted: #63666A;
  --plg-border: #D9D3C7;
  --plg-surface-alt: #F4F1EB;
  --plg-navy-tint: #E4DCCF;
  --font-sans: 'Jost', system-ui, -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif;
  --navy-900: #0A0C10;
  --navy-700: var(--mil-navy-2);
  --navy-050: #F7F5EF;
  --paper: #FAFAF8;
  --surface-alt: #FAFAF8;
  --hairline: #E4E0D6;
  --ink-faint: #8C8F93;
  --ink-on-navy: #F7F5EF;
  --ink-on-navy-muted: #C9D1DC;
  --brass: var(--mil-coral);
  --brass-light: var(--mil-coral-soft);
  --brass-tint: #F6F1EC;
  --info-tint: var(--plg-surface-alt);
  --radius: 2px;
  --radius-lg: 4px;
  --shadow-sm: none;
  --shadow-card: 0 1px 2px rgba(15, 37, 64, 0.05), 0 8px 22px rgba(15, 37, 64, 0.06);
  --shadow-pop: 0 26px 60px -18px rgba(9, 13, 20, 0.55);
}
/* Headings: light page titles in charcoal, medium-weight panel titles in navy. */
h1 { font-weight: 300; color: var(--plg-text); letter-spacing: 0.01em; }
h2, h3 { font-weight: 500; }
/* Phone floating "Add …" button: navy (not the coral accent). */
.fab { background: var(--plg-navy); box-shadow: 0 8px 24px rgba(15, 37, 64, 0.3); }
.fab:active { background: var(--mil-navy-2); }
/* Panel headers: navy band with white text (secondary buttons stay white so they still read). */
.card-head { background: var(--plg-navy); color: #fff; border-bottom-color: var(--plg-navy); }
.card-head h2 { font-weight: 500; color: #fff; }
.card-head .muted, .card-head .small, .card-head .faint, .card-head .label { color: var(--ink-on-navy-muted); }
.card-head a:not(.btn), .card-head .btn.ghost, .card-head .icon-btn { color: #fff; }
.card-head .btn.ghost:hover, .card-head .icon-btn:hover { background: rgba(255, 255, 255, 0.12); }
.card-head .btn.secondary { border-color: transparent; }
.label, .side-label { color: var(--mil-coral); font-weight: 500; letter-spacing: 0.16em; }
/* Buttons: uppercase, letter-spaced, square (font a touch smaller so widths stay about the same). */
.btn { text-transform: uppercase; letter-spacing: 0.1em; font-weight: 500; font-size: 0.78rem; }
.btn.sm { letter-spacing: 0.08em; font-size: 0.7rem; }
.btn.secondary { border-color: var(--hairline); }
.btn.danger { color: var(--mil-coral-deep); border-color: var(--mil-coral-deep); }
.btn.danger:hover { background: var(--brass-tint); }
/* Navy panel like the portal header: ivory text, soft-coral kicker, blush highlight. */
.brand-name { color: var(--mil-coral-soft); letter-spacing: 0.24em; }
.sidebar .navlink.active { box-shadow: inset 3px 0 0 var(--mil-blush); }
.sidebar .navlink.active svg { color: var(--mil-blush); }
/* Search fields are pills, as on the portal. */
.search { border-radius: 999px; border-color: var(--hairline); }
/* Accent face (Cormorant Garamond, like the portal's script). */
.script { font-family: var(--font-script); font-weight: 500; }
/* Home KPI cards use Poppins (the user's reference): semibold titles, heavy numbers. */
/* On everything inside, so the clickable (button) cards match the plain ones. */
.kpi, .kpi * { font-family: 'Poppins', var(--font-sans); }
.kpi-label { font-weight: 600; color: #444; }
.kpi-v { font-family: 'Poppins', var(--font-sans); font-weight: 700; }
.kpi-v small { font-weight: 400; }
.kpi-foot { font-weight: 400; }
/* Accents: tabs and selected thumbnails get the coral marker. */
.tabs a.on { border-color: var(--mil-coral); }
.sr-thumbs button.on, .strip button.on { border-color: var(--mil-coral); }
.chip { border-radius: 3px; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(15, 37, 64, 0.22); border-color: var(--plg-navy); }
.back { color: var(--plg-text-muted); }
.back:hover { color: var(--mil-coral); }
.home-list [data-hk] + [data-hk] { margin-top: 16px; }
/* Home filters: the Site / Building dropdowns are as wide as their text (no empty gap after them). */
.hf-row.wo-filters .mf { flex: 0 0 auto; width: auto; }
.hf-row .mf .dd-btn { width: auto; min-width: 140px; }
/* Home: Service Request and Preventive Maintenance side by side on wide screens. */
@media (min-width: 1280px) {
  .home-list.split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
  .home-list.split [data-hk] + [data-hk] { margin-top: 0; }
  .home-list.split .home-wo { min-width: 0; }
  .home-list.split .home-wo .hw-img { display: none; }
  .home-list.split .home-wo td { height: auto; }
  .home-list.split .home-wo th:nth-child(4), .home-list.split .home-wo td:nth-child(4) { width: 1%; }
  .home-list.split .home-wo td { white-space: normal; } /* cells wrap rather than overflow; the ID stays on one line */
  .home-list.split .home-wo td:nth-child(2) { white-space: nowrap; }
}
/* Home rows: small photo, then the details as named columns (name above the value). */
.hw-row { display: flex; gap: 12px; align-items: stretch; padding: 4px; border-top: 1px solid var(--hairline); color: inherit; text-decoration: none; }
.hw-list > .hw-row:first-child { border-top: 0; }
.hw-row:hover { background: var(--navy-050); }
/* The photo is as tall as the row's text (4px margin); the picture is pinned inside its box so a
   tall photo can't make its row taller than the others. */
.hw-thumb { flex: none; width: 96px; align-self: stretch; position: relative; overflow: hidden; border-radius: 6px; background: var(--navy-050); }
.hw-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.hw-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; padding: 6px 12px 6px 0; }
.hw-row.no-photo .hw-body { padding-left: 12px; }
.hw-top { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 0.85rem; }
.hw-top b { color: var(--navy-800); }
.hw-top .grow { flex: 1; }
.hw-title { font-weight: 600; overflow-wrap: anywhere; }
/* Location and Category get the most room; Assigned (and a PM's Due) sit narrower on the right. */
.hw-facts { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1.6fr) minmax(0, 1fr); gap: 4px 14px; margin-top: 2px; font-size: 0.8125rem; }
.hw-facts span { display: block; color: var(--ink-muted); font-size: 0.75rem; }
.hw-facts b { display: block; font-weight: 500; color: var(--ink); overflow-wrap: anywhere; }
@media (max-width: 640px) { .hw-facts, .hw-facts.n4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .hw-thumb { width: 72px; } }
/* Every Home row is the same height: each line stays on one line, long text ends in "…" (full text on hover). */
.hw-top { flex-wrap: nowrap; min-width: 0; }
.hw-top > b, .hw-top .chip { flex: none; white-space: nowrap; }
.hw-title, .hw-facts b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hw-facts > div { min-width: 0; }
.hw-facts.n4 { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1.5fr) minmax(0, 0.9fr) minmax(0, 0.9fr); }
@media (max-width: 640px) { .hw-facts.n4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* Service Request page: "Sort by" column + Asc/Desc, on the right above the cards. */
.sr-sort { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin: 0 2px 10px; }
.sr-sort .sr-dir { min-height: 36px; white-space: nowrap; }
.sr-sort select { width: auto; min-height: 36px; padding: 6px 10px; font: inherit; font-size: 0.875rem; }
/* Filters popup: the Type / Period buttons fill the full width in equal parts, the same height and
   shape as the dropdowns above them; on narrow phones the labels wrap instead of overflowing. */
.wf-sheet .hseg { display: flex; width: 100%; overflow: hidden; }
.wf-sheet .hseg button { flex: 1 1 0; min-width: 0; min-height: 46px; padding: 8px 6px; text-align: center;
  white-space: normal; line-height: 1.2; display: flex; align-items: center; justify-content: center; }
.wf-sheet .hf-custom { width: 100%; }
.wf-sheet .hf-custom input { flex: 1; min-width: 0; }
/* Sort bar: just its own width, on the right, always one line. */
.sr-sort { width: fit-content; max-width: 100%; margin-left: auto; flex-wrap: nowrap; }
.sr-sort > * { flex: none; }
.sr-sort label { display: inline; margin: 0; white-space: nowrap; }
.sr-sort select { width: auto; max-width: 160px; min-width: 0; flex: 0 1 auto; }
/* The app's styled dropdown button (it replaces the <select>) is full width by default; here it fits its text. */
.sr-sort .dd-btn { width: auto; min-width: 130px; min-height: 36px; padding: 6px 10px; font-size: 0.875rem; flex: none; }
/* Service Request status cards (Open / In Progress / Closed / Urgent): click = narrow the list. */
.sr-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 0 0 14px; }
.sr-stats:empty { display: none; }
.sr-stat { font: inherit; font-family: 'Poppins', var(--font-sans); color: inherit; text-align: left; cursor: pointer; width: 100%;
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; padding: 12px 14px; }
.sr-stat .kpi-ic { grid-row: 1 / 3; }
.sr-stat-l { font-size: 0.8rem; font-weight: 600; color: #444; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-stat-v { font-size: 1.5rem; font-weight: 700; line-height: 1.1; }
.sr-stat:hover { box-shadow: var(--shadow-card); }
.sr-stat.sel { outline: 2px solid var(--navy-800); outline-offset: -2px; box-shadow: var(--shadow-card); }
.sr-stat[data-srstat="urgent"] .sr-stat-v { color: var(--danger); }
@media (max-width: 699px) {
  .sr-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .sr-stat { padding: 10px; column-gap: 8px; }
  .sr-stat .kpi-ic { display: none; }
  .sr-stat-v { font-size: 1.25rem; }
}

/* Page titles (Millenia portal style): coral uppercase kicker, light Jost title, last word in italic Cormorant coral. */
.kicker { font-size: 0.75rem; font-weight: 500; letter-spacing: 0.22em; text-transform: uppercase; color: var(--mil-coral); margin: 0 0 6px; }
h1.ptitle, .home-hero h1.ptitle { font-family: var(--font-sans); font-weight: 300; font-size: 2.25rem; line-height: 1.15; color: var(--plg-text); letter-spacing: 0.005em; }
h1.ptitle em { font-family: var(--font-script); font-style: italic; font-weight: 500; font-size: 1.12em; color: var(--mil-coral); }
.home-hero h1.ptitle .hero-badge { font-family: var(--font-sans); vertical-align: middle; }
@media (max-width: 699px) { h1.ptitle, .home-hero h1.ptitle { font-size: 1.7rem; } }
/* "Viewing as" pill while an allowed admin uses the app as someone else (auth.js /auth/as). Floats over
   the page at the top so it never shifts the layout; it cannot be missed. */
#asBar {
  position: fixed; top: calc(8px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); z-index: 1000;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center;
  max-width: calc(100vw - 24px); padding: 8px 14px; border-radius: 999px;
  background: #fff3c4; border: 1px solid #e0b93a; color: #4a3800; font-size: 0.82rem; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}
#asBar a, #asBar button { font: inherit; font-weight: 600; color: var(--navy-800); background: #fff; border: 1px solid #e0b93a; border-radius: 999px; padding: 3px 10px; cursor: pointer; text-decoration: none; }
#asBar a:hover, #asBar button:hover { background: #fffaf0; }

/* Millenia Home */
.mil-hero { position: relative; overflow: hidden; border-radius: 22px; min-height: calc(100svh - 150px); display: flex; align-items: center; justify-content: center; color: #fff; isolation: isolate; }
.mil-bg { position: absolute; inset: 0; z-index: -1; background: url("/img/millenia.jpg") center 55%/cover no-repeat; }
.mil-bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(190deg, rgba(15,37,64,.55) 0%, rgba(15,37,64,.45) 38%, rgba(10,24,46,.92) 100%); }
.mil-inner { width: 100%; max-width: 860px; padding: 40px 20px; text-align: center; }
.mil-kicker { font-size: 11px; letter-spacing: .24em; text-transform: uppercase; color: #9CC3F0; }
.mil-inner h1 { margin: 10px 0 4px; font-size: clamp(30px, 6vw, 46px); font-weight: 500; color: #fff; }
.mil-inner p { margin: 0 0 30px; color: #D6E4F7; }
.mil-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.mil-tile { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 22px 16px; border-radius: 18px; color: #fff; text-decoration: none;
  background: rgba(15,37,64,.55); border: 1px solid rgba(156,195,240,.35); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); transition: transform .2s, background .2s; }
.mil-tile:hover { transform: translateY(-2px); background: rgba(22,50,79,.75); }
.mil-tile svg { width: 26px; height: 26px; stroke: #9CC3F0; }
.mil-tile small { color: #B9CFEA; }

/* Millenia Home, full screen (2026-11-03, the user's ask): the photo fills the whole window beside the left panel,
   which stays navy like on every other page (the user's call, after a frosted-glass try). Neutral shading only, no blue tint.
   body.mil-on is set by setNav() while Millenia Home is open; nothing changes on other pages. */
body.mil-on::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(60% 55% at 58% 50%, rgba(0, 0, 0, 0.42), rgba(0, 0, 0, 0) 75%),
    /* the navy panel flows into the photo: solid navy under the panel, then fading out over ~520px */
    linear-gradient(90deg, var(--navy-800) 0, var(--navy-800) var(--mil-side), color-mix(in srgb, var(--navy-800) 78%, transparent) calc(var(--mil-side) + 70px),
      color-mix(in srgb, var(--navy-800) 30%, transparent) calc(var(--mil-side) + 300px), transparent calc(var(--mil-side) + 560px)),
    linear-gradient(90deg, rgba(0, 0, 0, 0.12) 0%, rgba(0, 0, 0, 0.12) 70%, rgba(0, 0, 0, 0.3) 100%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.15) 0%, rgba(0, 0, 0, 0.05) 40%, rgba(0, 0, 0, 0.55) 100%),
    #1b1b1b url("/img/millenia.jpg") center 55% / cover no-repeat;
}
body.mil-on .layout { position: relative; z-index: 1; }
/* Where the panel ends (it collapses to 72px; phones have no panel). */
body.mil-on { --mil-side: 0px; }
@media (min-width: 900px) { body.mil-on { --mil-side: 292px; } body.mil-on.side-collapsed { --mil-side: 72px; } }
/* No seam: the panel and the photo's navy edge are one colour. */
body.mil-on .sidebar { box-shadow: none; border-right: 0; }
body.mil-on main { padding: 0; }
body.mil-on .mil-hero { border-radius: 0; min-height: 100vh; min-height: 100svh; }
body.mil-on .mil-bg { display: none; }
body.mil-on .mil-inner { text-shadow: 0 1px 14px rgba(0, 0, 0, 0.35); }
body.mil-on .mil-kicker { color: #fff; }
body.mil-on .mil-inner p { color: rgba(255, 255, 255, 0.88); }
body.mil-on .mil-tile { background: color-mix(in srgb, var(--navy-800) 45%, transparent); border-color: rgba(231, 183, 190, 0.4); text-shadow: none; }
body.mil-on .mil-tile:hover { background: color-mix(in srgb, var(--navy-800) 65%, transparent); }
body.mil-on .mil-tile svg { stroke: var(--mil-blush); }
body.mil-on .mil-tile small { color: rgba(255, 255, 255, 0.8); }
body.mil-on .mil-ask-wrap { text-shadow: none; }
@media (max-width: 899px) {
  body.mil-on .mil-inner { padding-bottom: calc(var(--bottomnav-h) + var(--safe-b) + 32px); }
  body.mil-on .bottomnav { background: rgba(20, 20, 20, 0.45); border-top-color: rgba(255, 255, 255, 0.16); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
  body.mil-on .bottomnav .navlink { color: rgba(255, 255, 255, 0.8); }
  body.mil-on .bottomnav .navlink.active { color: #fff; }
}
body.mil-on .mil-tiles { max-width: 620px; margin: 0 auto; }
/* 2026-11-03, the user: the two tiles a little lower and smaller, and the suggestion chips in the same navy glass. */
body.mil-on .mil-tiles { max-width: 500px; margin: 48px auto 0; gap: 12px; }
body.mil-on .mil-tile { padding: 15px 12px; gap: 4px; border-radius: 16px; }
body.mil-on .mil-tile svg { width: 22px; height: 22px; }
body.mil-on .mil-tile b { font-size: 0.92rem; }
body.mil-on .mil-tile small { font-size: 0.76rem; }
/* The AI search bar stays white (the user's call). */
body.mil-on .asst-chip { background: color-mix(in srgb, var(--navy-800) 45%, transparent); border-color: rgba(231, 183, 190, 0.4); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
body.mil-on .asst-chip:hover, body.mil-on .asst-chip:focus-visible { background: color-mix(in srgb, var(--navy-800) 65%, transparent); }
/* 2026-11-03, the user: the collapse / expand arrow matches the navy panel (it was a white circle). */
.side-toggle { background: var(--navy-800); color: var(--mil-blush); border: 1px solid rgba(231, 183, 190, 0.45); box-shadow: 0 2px 10px rgba(0, 0, 0, 0.28); }
.side-toggle:hover, .side-toggle:focus-visible { background: color-mix(in srgb, var(--navy-800) 80%, #fff); color: #fff; border-color: rgba(231, 183, 190, 0.8); outline: none; }
/* 2026-11-03, the user: no vertical scrolling in the left panel (desktop). On a short window the brand and menu
   tighten up instead, so everything still fits. */
@media (min-width: 900px) {
  .sidebar { overflow-y: hidden; }
  .sidebar::-webkit-scrollbar { display: none; }
}
@media (min-width: 900px) and (max-height: 760px) {
  .brand img { height: 60px; }
  .brand { padding-bottom: 10px; }
  .sidebar .navlink { padding-top: 9px; padding-bottom: 9px; }
}
@media (min-width: 900px) and (max-height: 620px) {
  .brand img { height: 44px; }
  .sidebar .navlink { padding-top: 6px; padding-bottom: 6px; }
}
/* Millenia Home content stays centred (the user tried it low, then split, and went back to centred, 2026-11-03). */
/* 2026-11-03, the user: the search bar and everything under it a little lower (the heading stays). */
body.mil-on .mil-ask-wrap { margin-top: 64px; }
/* The longer name ("Facilities Management Hub") under the logo, kept on one line. */
.brand-name { white-space: nowrap; letter-spacing: 0.16em; }
/* 2026-11-03, the user: the search bar, chips and tiles about 10% of the screen lower again (the heading stays put). */
@media (min-width: 900px) {
  body.mil-on .mil-ask-wrap, body.mil-on .mil-tiles { position: relative; top: 10vh; }
}
/* 2026-11-03, the user: the search bar and its chips a bit lower again; the two tiles stay where they are. */
@media (min-width: 900px) {
  body.mil-on .mil-ask-wrap { top: calc(10vh + 24px); }
}
/* The app name under the logo a little smaller. */
.brand-name { font-size: 0.7rem; }
/* 2026-11-03, the user: the three heading lines (kicker, welcome, app name) a little bigger. */
body.mil-on .mil-kicker { font-size: 13px; }
body.mil-on .mil-inner h1 { font-size: clamp(34px, 6.5vw, 56px); }
body.mil-on .mil-inner > p { font-size: 1.12rem; }
/* 2026-11-03, the user: pink on the selected menu item (marker + icon) and on the app name under the logo (soft coral,
   as before); the Millenia Home tile icons and outlines, the chips and the collapse arrow are white. */
body.mil-on .mil-tile svg { stroke: #fff; }
body.mil-on .mil-tile, body.mil-on .asst-chip { border-color: rgba(255, 255, 255, 0.32); }
.side-toggle { color: #fff; border-color: rgba(255, 255, 255, 0.45); }
.side-toggle:hover, .side-toggle:focus-visible { border-color: rgba(255, 255, 255, 0.8); }
/* 2026-11-03, the user: the left panel as narrow as it can be with every label on ONE line, nothing cut off.
   274px = "Preventive Maintenance" (244px in Jost, with icon and padding) + the panel's 24px padding + 6px spare. */
@media (min-width: 900px) {
  .sidebar { width: 274px; }
  .sidebar .navlink span { white-space: nowrap; overflow: visible; text-overflow: clip; }
  body:not(.side-collapsed) .side-toggle { left: calc(274px - 14px); }
  body.mil-on { --mil-side: 274px; }
  body.mil-on.side-collapsed { --mil-side: 72px; }
}
/* Service Requests (2026-11-03): Status and Period always show, outside the Filter button; the search is shorter. */
.wf-main { display: flex; align-items: center; gap: 10px; flex: none; }
.wf-main .mf, .wf-main > .dd-btn.filter-select { flex: 0 0 180px; width: 180px; min-width: 0; }
.wf-main .wf-dates { display: flex; gap: 6px; }
.wf-main .wf-dates.hidden { display: none; }
.wf-main .wf-dates input { width: 150px; min-height: 42px; }
.wo-filters.wf-has-main .search { flex: 0 1 280px; min-width: 160px; }
.wo-filters.wf-has-main.wf-compact .search { flex: 0 1 280px; }
@media (max-width: 899px) {
  .wo-filters.wf-has-main { flex-wrap: wrap; }
  .wo-filters.wf-has-main .wf-main { flex: 1 1 100%; flex-wrap: wrap; }
  .wo-filters.wf-has-main .wf-main .mf, .wo-filters.wf-has-main .wf-main > .dd-btn.filter-select { flex: 1 1 0; width: auto; }
  .wo-filters.wf-has-main .wf-main .wf-dates { flex: 1 1 100%; } .wo-filters.wf-has-main .wf-main .wf-dates input { flex: 1 1 0; width: auto; }
  .wo-filters.wf-has-main .search { flex: 1 1 0; min-width: 0; }
}
/* 2026-11-03, the user: the search box takes all the room left on the line (Service Requests and PM). */
.wo-filters.wf-has-main .search, .wo-filters.wf-has-main.wf-compact .search { flex: 1 1 200px; min-width: 160px; }
/* 2026-11-03, the user: the search box comes first on the left, then the filters, then the Filter button. */
@media (max-width: 899px) { .wo-filters.wf-has-main > .search { flex: 1 1 0; order: 0; } .wo-filters.wf-has-main > .wf-open { order: 1; } .wo-filters.wf-has-main > .wf-main { order: 2; } }
/* 2026-11-03: six Service Request summary cards (four counts that filter the list, two medians that are info only). */
.sr-stats { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.sr-stat-info { cursor: default; }
.sr-stat-info:hover { box-shadow: none; }
.sr-stat-info .sr-stat-v { font-size: 1.25rem; }
@media (max-width: 1399px) { .sr-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 699px) { .sr-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.sr-stat[data-pmstat="overdue"] .sr-stat-v { color: var(--danger); }
/* 2026-11-03, the user: card titles are never cut; they wrap onto a second line, and every card keeps room for two
   so the numbers line up. */
.sr-stat-l { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.25; min-height: 2.5em; display: flex; align-items: flex-end; }
/* 2026-11-03, the user: the Service Request and PM summary cards in the Home KPI style (title top left, icon top
   right, big number, red tint on a warning count), at their compact size. */
.sr-stat.kpi { display: flex; flex-direction: column; gap: 6px; min-height: 0; padding: 12px 14px; }
.sr-stat.kpi .kpi-top { align-items: flex-start; }
.sr-stat.kpi .sr-stat-l { display: block; min-height: 2.5em; font-size: 0.82rem; font-weight: 600; color: var(--ink); line-height: 1.25; white-space: normal; }
.sr-stat.kpi .kpi-ic { width: 30px; height: 30px; }
.sr-stat.kpi .kpi-ic svg { width: 16px; height: 16px; }
.sr-stat.kpi .sr-stat-v { font-size: 1.6rem; font-weight: 800; line-height: 1.1; }
.sr-stat.kpi.sr-stat-info .sr-stat-v { font-size: 1.3rem; }
.sr-stat.kpi.hot .sr-stat-v { color: var(--danger); }
.sr-stat.kpi .kpi-ic { grid-row: auto; }
@media (max-width: 699px) { .sr-stat.kpi .kpi-ic { display: grid; width: 26px; height: 26px; } .sr-stat.kpi .sr-stat-v { font-size: 1.3rem; } }
.sr-stat.kpi { align-items: stretch; text-align: left; }
.sr-stat.kpi .kpi-label { flex: 1; text-align: left; }
.sr-stat.kpi.hot { background: var(--danger-tint); border-color: #e9b4ad; }
/* Median cards: the same number size as the other cards, unit small after it (as on Home). */
.sr-stat.kpi.sr-stat-info .sr-stat-v { font-size: 1.6rem; }
.sr-stat.kpi .sr-stat-v small { font-size: 0.95rem; font-weight: 500; color: var(--ink); }
@media (max-width: 699px) { .sr-stat.kpi.sr-stat-info .sr-stat-v { font-size: 1.3rem; } }

/* AI suggestions for a WO's Location and Asset (wo-suggest): the hint line, and the "AI suggested" group in the asset picker. */
.ai-hint { display: flex; align-items: center; gap: 6px; margin: 0; }
.ai-hint svg, .ai-h svg { width: 15px; height: 15px; color: var(--brass); flex: none; }
.list .ai-h { display: flex; align-items: center; gap: 6px; padding: 10px 14px 4px; font-size: 0.68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-faint); }
.list-item .ai-why { font-size: 0.78rem; color: var(--ink-muted); font-style: italic; margin-top: 2px; }

/* Readable location names (location-names.js): the code path under the name in dropdowns and the tree; progress bar. */
.dd-opt .dd-sub { display: block; font-size: 0.72rem; color: var(--ink-faint); font-weight: 400; margin-top: 1px; overflow-wrap: anywhere; }
.dd-opt.on .dd-sub { color: inherit; opacity: 0.75; }
.ptree-sys { display: block; overflow-wrap: anywhere; }
.rn-bar { height: 8px; border-radius: 999px; background: var(--navy-100, #EEF1F6); overflow: hidden; }
.rn-bar span { display: block; height: 100%; width: 0; background: var(--brass); transition: width 0.4s ease; }
