/* ===== F1Claims v2 — legacy desktop style, tokenised ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  /* color tokens (UI #97) */
  --teal: #17677a; --teal-dark: #125565; --teal-lt: #e2ecf2;
  --navy: #1e3a5f;
  --bg: #e9edf2; --panel: #f4f6f8; --surface: #ffffff;
  --border: #aab6c2; --border-lt: #d7dde3; --hairline: #e6ebef;
  --tbl-head: #eef1f4; --zebra: #f7f9fb;
  --sel: #dceafc; --sel-border: #9ec3ea;
  --red: #c0392b; --red-bg: #fdeef0; --red-border: #e8b4bc;
  --amber: #b45309; --amber-bg: #fdf6e7; --amber-border: #ecd39b;
  --green: #0a7a3d; --green-bg: #eaf7ee; --green-border: #b7dfc4;
  --text: #202830; --text-2: #46586a; --muted: #64748b;
  --radius: 3px;                 /* single radius token (UI #38) */
  --gap: 12px;                   /* single gap token (UI #52) */
  --pad-modal: 16px;             /* single modal padding (UI #74) */
  --font: Tahoma, 'Segoe UI', Verdana, Arial, sans-serif; /* single stack (UI #96) */
  --focus: 2px solid #2a7fd4;
}
.theme-dark {                    /* dark theme (UI #100) */
  --bg: #1d242b; --panel: #232b33; --surface: #2a333d;
  --border: #46525e; --border-lt: #3a444e; --hairline: #333d47;
  --tbl-head: #2f3944; --zebra: #2e3843; --sel: #274867; --sel-border: #3c6da0;
  --teal-lt: #21444f; --text: #dfe6ec; --text-2: #a8b6c2; --muted: #7e8c99b;
  --red-bg: #43272b; --amber-bg: #41371f; --green-bg: #21402c;
}
html, body { height: 100%; }
body {
  font-family: var(--font);
  font-size: 12px; color: var(--text); background: var(--bg); overflow: hidden;
}
button { font-family: inherit; cursor: pointer; }
/* desktop-app feel: no text selection / I-beam on chrome (DF #23,#24) */
.ribbon, .menubar, .tabstrip, .claimbar, .statusbar, .mhead, .bhead, .tbl th, .rbtn, .tab, .btn, label {
  user-select: none; cursor: default;
}
button, .tab, a.lnk, .clickable { cursor: pointer !important; }

input, select, textarea { font-family: inherit; font-size: 12px; color: var(--text); }
input[type=text], input[type=email], input[type=date], input[type=time], input[type=number], input[type=password], select, textarea {
  border: 1px solid var(--border); background: var(--surface); padding: 7px 8px; border-radius: var(--radius); outline: none; /* UI #41 */
}
input:focus, select:focus, textarea:focus { border-color: var(--teal); } /* flat focus, no glow (UI #3) */
:focus-visible { outline: var(--focus); outline-offset: 1px; } /* UI #17,#36 */
input.dirty, select.dirty, textarea.dirty { background: #fff3cd; border-left: 3px solid #d97706; } /* UI #42 */
.theme-dark input.dirty, .theme-dark select.dirty, .theme-dark textarea.dirty { background: #4a3d1e; }
input.invalid, select.invalid { border-color: var(--red); background: var(--red-bg); }
textarea { resize: vertical; min-height: 34px; } /* UI #43 */
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; } /* UI #46 */
input[type=number] { -moz-appearance: textfield; appearance: textfield; }
select {
  -webkit-appearance: none; appearance: none; padding-right: 22px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2346586a' stroke-width='1.6' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 7px center; /* UI #44 */
}
.hint { font-size: 10px; color: var(--muted); } /* date format hints (UI #45) */
.req { color: var(--red); font-weight: bold; margin-left: 2px; } /* UI #47 */
svg.ic { width: 15px; height: 15px; vertical-align: -3px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }

/* =================== app frame =================== */
#app { display: none; height: 100vh; flex-direction: column; }
#app.on { display: flex; }

/* ---------- classic menu bar (DF #4) ---------- */
.menubar { display: flex; background: var(--panel); border-bottom: 1px solid var(--border-lt); font-size: 12px; padding: 0 4px; flex: 0 0 auto; }
.menubar .mitem { padding: 4px 10px; color: var(--text); border-radius: 0; background: none; border: none; }
.menubar .mitem:hover, .menubar .mitem.open { background: var(--teal-lt); }
.mdrop {
  position: fixed; background: var(--surface); border: 1px solid var(--border); box-shadow: 0 6px 18px rgba(0,0,0,.25);
  z-index: 200; min-width: 220px; padding: 3px;
}
.mdrop button { display: flex; width: 100%; text-align: left; padding: 6px 10px; background: none; border: none; font-size: 12px; color: var(--text); align-items: center; gap: 8px; }
.mdrop button:hover { background: var(--teal-lt); }
.mdrop button .mshort { margin-left: auto; color: var(--muted); font-size: 10.5px; }
.mdrop hr { border: none; border-top: 1px solid var(--hairline); margin: 3px 4px; }

/* ---------- ribbon ---------- */
.ribbon {
  display: flex; align-items: stretch; gap: 3px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 5px 6px 3px;
  overflow-x: auto; overflow-y: hidden; flex: 0 0 auto;
  scrollbar-width: thin;
}
.rgroup { display: flex; flex-direction: column; gap: 2px; }
.rgroup .rrow { display: flex; gap: 3px; }
.rgroup .rlabel { text-align: center; font-size: 9px; color: var(--muted); letter-spacing: .4px; text-transform: uppercase; } /* UI #11,#16 group labels */
.rbtn {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 68px; padding: 4px 4px 3px;                              /* uniform width (UI #10) */
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--navy); font-size: 10.5px; line-height: 1.2;
  gap: 3px; white-space: nowrap; position: relative;
}
.theme-dark .rbtn { color: var(--text); }
.rbtn b { font-weight: bold; }
.rbtn:hover { background: var(--teal-lt); border-color: var(--teal); }
.rbtn:active, .rbtn.popup-open { background: #cfe3ea; border-color: var(--teal-dark); } /* pressed + open state (UI #16) */
.rbtn:disabled { opacity: .45; cursor: not-allowed !important; background: var(--panel); } /* UI/UX #14 */
.rbtn svg.ic { width: 17px; height: 17px; }
.rbtn.warn-save { background: #fde8c8; border-color: #d97706; color: #8a4a06; } /* static amber (UI #12) */
.rbtn.warn-save::after { content: '●'; position: absolute; top: 1px; right: 4px; color: #d97706; font-size: 9px; }
.rbtn.danger:hover { background: var(--red-bg); border-color: var(--red); color: var(--red); }
.rsep { width: 1px; background: var(--border); margin: 2px 4px; flex: 0 0 1px; } /* stronger (UI #11) */
.rspring { flex: 1 0 8px; }
.rbtn .badge {
  position: absolute; top: 2px; right: 6px; background: var(--red); color: #fff;
  border-radius: 8px; font-size: 9px; min-width: 15px; height: 15px; line-height: 15px; text-align: center; padding: 0 3px;
} /* inside padding (UI #13) */
.rbtn.has-tasks .badge { background: var(--teal, #0e7490); }
.rbtn.pulsing { animation: rbtnpulse 1.4s ease-in-out infinite; }
.rbtn.pulsing .badge { background: #d97706; }
@keyframes rbtnpulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(217, 119, 6, .45); } 50% { box-shadow: 0 0 0 4px rgba(217, 119, 6, 0); } }
.ribbon-fade { position: relative; }

/* ---------- claim header ---------- */
.claimbar {
  display: flex; align-items: flex-start; gap: 14px;
  background: var(--surface); padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(15,35,52,.06);
  flex: 0 0 auto; flex-wrap: wrap;
}
.refbox {
  font-family: Consolas, 'Courier New', monospace; font-weight: bold; font-size: 14px;
  background: var(--teal); color: #fff; border: 1px solid var(--teal-dark); border-radius: 6px;
  padding: 0 14px; letter-spacing: .5px; display: flex; align-items: center; height: 46px;
  cursor: pointer !important;
}
.refbox:hover { background: var(--teal-dark); }
.refbox.muted { background: var(--panel); color: var(--muted); border-color: var(--border); }
.clientbox {
  background: var(--panel); border: 1px solid var(--border-lt); border-radius: 6px;
  padding: 5px 12px; width: 270px; height: 46px; overflow: hidden;
  display: flex; flex-direction: row; gap: 10px; align-items: center;
}
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--teal); color: #fff; font-weight: bold; font-size: 12px; display: flex; align-items: center; justify-content: center; flex: 0 0 32px; }
.cbtext { min-width: 0; flex: 1; }
.clientbox .cname { font-weight: bold; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clientbox .csub { color: var(--muted); font-size: 11px; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hlabel { font-size: 11px; font-weight: 600; color: var(--text-2); } /* UI #27 */
.hgroup { display: flex; flex-direction: column; gap: 3px; justify-content: flex-start; }
.hgroup > .hlabel { height: 14px; }
.hgroup select, .hgroup input { height: 28px; padding: 3px 6px; }
#cb-status { width: 210px; text-overflow: ellipsis; } /* fixed status width (UI #23) */
.readonly-field { background: var(--panel) !important; color: var(--text-2); border-style: dashed !important; } /* UI #26 */
.stagedots { display: flex; gap: 3px; align-items: center; }
.sdot {
  width: 26px; height: 13px; border-radius: 7px; background: var(--border-lt);
  font-size: 9px; color: #fff; text-align: center; line-height: 13px; font-weight: bold; /* bigger + numbered (UI #24,#25) */
}
.sdot.on { background: var(--teal); }
.sdot.cur { background: #d97706; outline: 1px solid #8a4a06; } /* shape difference for colorblind (UI #25) */
.stagelabel { font-size: 9.5px; color: var(--muted); }
.routepill { display: inline-flex; align-items: center; height: 24px; padding: 0 12px; border-radius: 12px; font-size: 10.5px; font-weight: bold; align-self: flex-start; margin-top: 15px; white-space: nowrap; box-sizing: border-box; } /* UI #29 */
.routepill.nonfault { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-border); }
.routepill.fault { background: var(--red-bg); color: var(--red); border: 1px solid var(--red-border); }
.routepill.other { background: var(--amber-bg); color: var(--amber); border: 1px solid var(--amber-border); }
.presence { display: flex; gap: 4px; align-items: center; align-self: flex-start; margin-top: 15px; }
.presence .pchip { background: var(--amber-bg); border: 1px solid var(--amber-border); color: var(--amber); font-size: 10px; padding: 2px 8px; border-radius: 9px; }
.claimbar .rightbtns { margin-left: auto; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; align-self: flex-start; margin-top: 9px; }
@media (max-width: 1420px) { /* compact header (UI #28,#30,#99) */
  .clientbox { width: 190px; }
  #cb-status { width: 160px; }
  .claimbar .rightbtns { margin-left: 0; width: 100%; justify-content: flex-start; }
}
.btn {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 7px 13px; font-weight: bold; color: var(--navy); font-size: 12px;
  display: inline-flex; align-items: center; gap: 6px;
}
.theme-dark .btn { color: var(--text); }
.btn:hover { background: var(--teal-lt); border-color: var(--teal); }
.btn:active { background: #cfe3ea; }
.btn.primary { background: var(--teal); border-color: var(--teal-dark); color: #fff; }
.btn.primary:hover { background: var(--teal-dark); }
.btn.danger { color: var(--red); }
.btn.danger:hover { background: var(--red-bg); border-color: var(--red); }
.btn.sm { padding: 3px 9px; font-size: 11px; font-weight: 600; }
.btn:disabled { opacity: .5; cursor: not-allowed !important; }
.btn.busy { opacity: .7; pointer-events: none; }

/* ---------- tabs ---------- */
.tabstrip {
  display: flex; align-items: flex-end; background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 4px 6px 0; gap: 2px; overflow-x: auto; flex: 0 0 auto; scrollbar-width: thin;
}
.tab {
  padding: 7px 12px; background: #d5dce2; border: 1px solid var(--border); border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0; font-size: 12px; color: #26313c; white-space: nowrap; /* UI #34 */
  border-top: 2px solid transparent;
}
.theme-dark .tab { background: var(--panel); color: var(--text-2); }
.tab:hover { background: #e6ecf1; } /* UI #32 */
.theme-dark .tab:hover { background: var(--tbl-head); }
.tab.on {
  background: var(--surface); font-weight: bold; color: var(--text); padding-bottom: 8px; margin-bottom: -1px;
  border-top: 2px solid var(--teal); /* UI #31 */
}
.tab .tdot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #d97706; margin-left: 5px; vertical-align: 1px; }
.tab .tdot.task { background: var(--teal); } /* department-queue tasks waiting */
.tab .tdirty { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #d97706; margin-left: 5px; vertical-align: 4px; }

/* ---------- workspace ---------- */
.workspace { flex: 1 1 auto; background: var(--surface); overflow: auto; padding: 12px 14px; min-height: 100px; }
/* ultrawide / 4K: keep content centred and readable instead of stretching edge-to-edge */
@media (min-width: 2200px) { .workspace { padding-left: calc((100% - 2200px) / 2 + 14px); padding-right: calc((100% - 2200px) / 2 + 14px); } }
.ws-empty { color: var(--muted); text-align: center; padding-top: 30px; font-size: 13px; }
.ws-empty .bigbtns { display: flex; gap: 12px; justify-content: center; margin-top: 18px; }

fieldset.fs {
  border: 1px solid var(--border-lt); border-top: 3px solid var(--teal); border-radius: 6px;
  padding: 12px 14px 14px; margin-bottom: 16px;
  background: var(--surface); box-shadow: 0 1px 4px rgba(15,35,52,.07);
}
fieldset.fs legend {
  font-weight: bold; color: var(--navy); padding: 2px 10px; font-size: 12.5px;
  background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border-lt);
  box-shadow: 0 1px 2px rgba(15,35,52,.06);
}
fieldset.fs.client-src { border-top-color: #1d4ed8; }
fieldset.fs.staff-src { border-top-color: #b45309; }
.secbadge { font-size: 9.5px; font-weight: 600; padding: 2px 8px; border-radius: 8px; margin-left: 8px; vertical-align: 1px; letter-spacing: .3px; }
.secbadge.client { background: #e3ecfd; color: #1d4ed8; }
.secbadge.staff { background: var(--amber-bg); color: var(--amber); }
.theme-dark fieldset.fs legend { color: var(--text); }
/* fluid form grids — columns flow to fit ANY monitor (no hard breakpoints):
   ~1 col on phones, 2-3 on tablets, 4-6 on desktop, capped-width tracks on ultrawide */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: var(--gap); }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--gap); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: var(--gap); }
/* on very wide / 4K screens, stop fields from stretching to silly widths */
@media (min-width: 2000px) {
  .grid { grid-template-columns: repeat(auto-fit, minmax(240px, 360px)); justify-content: start; }
  .grid3 { grid-template-columns: repeat(auto-fit, minmax(250px, 380px)); justify-content: start; }
}
.fld { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.fld label { font-size: 11px; font-weight: 600; color: var(--text-2); } /* sentence case (UI #40) */
.fld input, .fld select, .fld textarea { width: 100%; }
.fld.wide { grid-column: 1 / -1; }

.banner { display: flex; align-items: center; gap: 10px; border: 1px solid; border-radius: var(--radius); padding: 9px 12px; margin-bottom: 12px; font-size: 12px; }
.banner svg.ic { flex: 0 0 auto; } /* icon column (UI #49) */
.banner > span, .banner > b { min-width: 0; }
.banner.red { background: var(--red-bg); border-color: var(--red-border); color: #8e2735; }
.banner.green { background: var(--green-bg); border-color: var(--green-border); color: #1e6b3a; }
.banner.amber { background: var(--amber-bg); border-color: var(--amber-border); color: #8a5a12; }
.banner.blue { background: var(--teal-lt); border-color: var(--border-lt); color: var(--navy); }
.theme-dark .banner.red { color: #f1b7bd; } .theme-dark .banner.green { color: #a9dfbc; }
.theme-dark .banner.amber { color: #ecd39b; } .theme-dark .banner.blue { color: var(--text); }
.banner .tag { font-weight: bold; background: #f5c6cb; padding: 2px 7px; border-radius: 2px; font-size: 10px; color: #7a1f2b; }
.banner .spacer { flex: 1; }

/* overview: calmer rhythm, red only for problems (UI #50,#51) */
.overview-text { font-size: 12.5px; line-height: 1.7; padding: 4px 2px; }
.overview-text > div { margin-bottom: 7px; }
.overview-text .rd { color: var(--red); font-weight: bold; }        /* problems only */
.overview-text .bl { color: #1a5276; font-weight: bold; }           /* data */
.theme-dark .overview-text .bl { color: #7db4d8; }
.overview-text .gr { color: var(--green); font-weight: bold; }
.ov-head { font-weight: bold; font-size: 13px; margin-bottom: 8px; }
.nextaction { display: flex; gap: 10px; align-items: center; }

/* status plain-language subtitle */
.status-plain { font-size: 10px; color: var(--muted); max-width: 220px; line-height: 1.25; }

/* ---------- tables ---------- */
table.tbl { width: 100%; border-collapse: collapse; background: var(--surface); }
.tbl th {
  background: var(--tbl-head); border: 1px solid var(--border-lt); padding: 5px 8px;
  text-align: left; font-size: 11px; color: var(--text-2); white-space: nowrap; position: sticky; top: 0; z-index: 1;
  box-shadow: 0 1px 0 var(--border-lt); /* UI #53 */
}
.tbl th.sortable { cursor: pointer !important; }
.tbl th.sortable:hover { background: var(--teal-lt); }
.tbl th .arr { color: var(--teal); font-size: 9px; margin-left: 3px; }
.tbl td { border-bottom: 1px solid var(--hairline); padding: 5px 8px; font-size: 12px; vertical-align: top; } /* hairlines (UI #62) */
.tbl tbody tr:nth-child(even) { background: var(--zebra); } /* zebra (UI #54) */
.tbl tbody tr:hover { background: var(--teal-lt); } /* clearer hover (UI #55) */
.tbl tbody tr.sel { background: var(--sel); outline: 1px solid var(--sel-border); } /* blue selection (UI #60) */
.tbl tbody tr.clickable { cursor: pointer !important; }
.tbl tbody tr.overdue { background: var(--red-bg); } /* UI #67 */
/* claims currently IN HIRE — red so the team instantly sees daily-cost claims (client spec §2) */
.tbl tbody tr.tr-inhire { background: var(--red-bg); box-shadow: inset 3px 0 0 var(--red); }
.tbl tbody tr.tr-inhire:hover { background: #fbe3e6; }
/* history panel highlights while an email is dragged over it */
.bpanel.left.droppable { outline: 2px dashed var(--teal); outline-offset: -4px; background: var(--teal-lt); }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; } /* UI #57,#87 */
.tbl td.nowrap, .tbl .nowrap { white-space: nowrap; } /* UI #58 */
.tbl td.clamp { max-width: 420px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; } /* UI #59 */
.tbl .empty-row td { text-align: center; color: var(--muted); padding: 22px; border: none; font-size: 12px; } /* UI #61 */
.strike { text-decoration: line-through; opacity: .6; }
.amend-note { color: var(--red); font-size: 11px; }

/* traffic lights */
.light { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 4px; }
.light.red { background: #d33; } .light.amber { background: #e6a817; } .light.green { background: #2eaa5e; }

/* skeleton loaders (UX #33) */
.skel { background: linear-gradient(90deg, var(--panel) 25%, var(--hairline) 50%, var(--panel) 75%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: var(--radius); height: 14px; margin: 8px 0; }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------- bottom panels ---------- */
#splitter { height: 5px; background: var(--border-lt); cursor: row-resize !important; flex: 0 0 5px; display: flex; align-items: center; justify-content: center; gap: 3px; } /* UI #69 */
#splitter::before, #splitter::after { content: ''; width: 26px; height: 1px; background: var(--border); }
#splitter:hover { background: var(--teal-lt); }
.bottom { flex: 0 0 252px; display: flex; border-top: 1px solid var(--border); background: var(--panel); min-height: 110px; }
.bpanel { display: flex; flex-direction: column; min-width: 0; }
.bpanel.left { flex: 1 1 62%; border-right: 2px solid var(--border); }
.bpanel.right { flex: 1 1 38%; }
.bhead { display: flex; align-items: center; gap: 6px; padding: 5px 8px; flex: 0 0 auto; flex-wrap: wrap; }
.bhead .btitle { font-weight: bold; font-size: 13px; color: var(--text); margin-right: 4px; } /* UI #63 */
.bhead select, .bhead input { padding: 3px 6px; font-size: 11px; }
.bhead .chip { padding: 2px 9px; font-size: 10.5px; border: 1px solid var(--border); background: var(--surface); border-radius: 9px; color: var(--text-2); }
.bhead .chip.on { background: var(--teal); color: #fff; border-color: var(--teal-dark); }
.bhead .cnt { font-size: 10.5px; color: var(--muted); }
.bhead .searchwrap { position: relative; display: flex; align-items: center; }
.bhead .searchwrap input { width: 120px; transition: width .15s; padding-right: 18px; }
.bhead .searchwrap input:focus { width: 200px; } /* UI #65 */
.bhead .searchwrap .clr { position: absolute; right: 3px; background: none; border: none; color: var(--muted); font-size: 11px; }
.bbody { flex: 1 1 auto; overflow: auto; background: var(--surface); border-top: 1px solid var(--border-lt); } /* single scroll (UI #68) */
.bbody table.tbl { border: none; }

/* Client sketch: persistent two-column detail forms and a stronger sticky work tray. */
.sketch-two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; width: 100%; }
.sketch-stack { display: flex; flex-direction: column; min-width: 0; gap: 0; }
.sketch-card { min-width: 0; margin-bottom: 16px !important; }
.sketch-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; }
.sketch-fields .fld.wide, .sketch-fields textarea { grid-column: 1 / -1; }
.hsr-heading { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; padding: 8px 12px; border: 1px solid #8cc8d5; background: #edf9fc; border-radius: 6px; color: var(--navy); font-weight: 700; }
.hsr-mark { background: var(--teal); color: #fff; border-radius: 4px; padding: 4px 9px; letter-spacing: .5px; }
.claim-meta-quick select { max-width: 145px; }
.referral-quick { max-width: 145px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.claim-ref-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.claim-ref-row { display: flex; gap: 7px; align-items: center; padding: 8px 9px; border: 1px solid var(--border-lt); border-radius: 5px; background: var(--surface); }
.bottom { flex-basis: 280px; position: relative; z-index: 5; box-shadow: 0 -3px 12px rgba(15,35,52,.08); }
.bpanel.left { flex-basis: 60%; }
.bpanel.right { flex-basis: 40%; }
@media (max-width: 1050px) {
  .sketch-two-col { grid-template-columns: 1fr; }
  .sketch-fields { grid-template-columns: 1fr; }
  .claim-meta-quick { display: none; }
}

/* ---------- status bar ---------- */
.statusbar {
  flex: 0 0 auto; background: var(--teal); color: #f2f8fa; display: flex; align-items: center;
  padding: 4px 10px; font-size: 11.5px; gap: 8px;
}
.statusbar .seg { display: inline-flex; align-items: center; gap: 5px; padding: 1px 4px; border-radius: 2px; }
.statusbar .seg.click { cursor: pointer !important; }
.statusbar .seg.click:hover { background: rgba(255,255,255,.12); }
.statusbar .sep { color: rgba(255,255,255,.55); } /* UI #70 */
.statusbar b { color: #fff; }
.statusbar .spring { flex: 1; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.dot.ok { background: #4be18a; } .dot.bad { background: #ff7a6e; } .dot.warn { background: #ffcf5c; }

/* connection / offline banner (UX #39,#97) */
#connbar { display: none; background: #7a1f2b; color: #fff; text-align: center; padding: 5px; font-size: 12px; flex: 0 0 auto; }
#connbar.warn { background: #8a5a12; }
#connbar.show { display: block; }

/* =================== modals =================== */
.modal-back {
  position: fixed; inset: 0; background: rgba(20,35,45,.45); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 24px 14px; overflow: auto;
}
.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); width: 760px; max-width: 100%;
  box-shadow: 0 10px 34px rgba(0,0,0,.3); display: flex; flex-direction: column; max-height: calc(100vh - 70px);
}
.modal.sm { width: 470px; } .modal.lg { width: 1020px; } .modal.xl { width: 1220px; }
.arf-form{display:grid;gap:9px}.arf-section{border:1px solid var(--line);border-radius:8px;background:#fff;overflow:hidden}.arf-section>summary{cursor:pointer;padding:10px 12px;font-weight:800;color:#0b6174;background:#f4f8fa;list-style-position:inside}.arf-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:9px;padding:11px}.arf-field{display:grid;gap:4px;font-size:11px;color:#40566b}.arf-field>span{font-weight:700}.arf-field.wide,.arf-subtitle.wide{grid-column:1/-1}.arf-subtitle{padding:7px 0 2px;font-weight:800;color:#132f43;border-bottom:1px solid var(--line)}.arf-field textarea{resize:vertical;min-height:64px}@media(max-width:850px){.arf-grid{grid-template-columns:1fr}.arf-field.wide,.arf-subtitle.wide{grid-column:auto}}
.arf-people{grid-column:1/-1;border:1px solid var(--line);border-radius:7px;padding:9px}.arf-people-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:7px}.arf-people-rows{display:grid;gap:7px}.arf-person-row{display:grid;grid-template-columns:1.3fr .8fr 1.2fr auto;gap:8px;align-items:end;padding:7px;background:#f7fafb;border-radius:6px}.arf-empty{color:var(--muted);font-size:11px;padding:5px}.arf-person-row>.btn{margin-bottom:1px}@media(max-width:850px){.arf-person-row{grid-template-columns:1fr}.arf-person-row>.btn{justify-self:start}}
.mhead {
  background: var(--panel); border-bottom: 1px solid var(--border-lt); /* flat (UI #71) */
  padding: 9px 14px; font-weight: bold; color: var(--navy); font-size: 13px;
  display: flex; align-items: center; gap: 8px; cursor: move !important; /* draggable (DF #30) */
}
.theme-dark .mhead { color: var(--text); }
.mhead .msub { font-weight: normal; font-size: 11px; color: var(--muted); } /* popup subtitle (NT #4) */
.mhead .x { margin-left: auto; background: none; border: none; width: 26px; height: 26px; border-radius: var(--radius); color: var(--text-2); display: flex; align-items: center; justify-content: center; } /* 24px hit area (UI #72) */
.mhead .x:hover { background: var(--red-bg); color: var(--red); }
.mbody { padding: var(--pad-modal); overflow: auto; }
.mbody fieldset.fs { background: var(--panel); } /* flattened look inside modals (UI #75) */
.mfoot { border-top: 1px solid var(--border-lt); padding: 10px 14px; display: flex; gap: 8px; background: var(--panel); }
.mfoot .left { margin-right: auto; display: flex; gap: 8px; } /* danger on the left (UI #73) */
.mfoot .rightside { margin-left: auto; display: flex; gap: 8px; }
.mspin { text-align: center; padding: 30px; color: var(--muted); }
.mspin .spinner { width: 26px; height: 26px; border: 3px solid var(--border-lt); border-top-color: var(--teal); border-radius: 50%; margin: 0 auto 10px; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* toasts v2: bottom-right, icons, tinted, errors persist (UI #76,#77,#78) */
#toasts { position: fixed; right: 14px; bottom: 34px; z-index: 300; display: flex; flex-direction: column-reverse; gap: 8px; max-width: 380px; }
.toast {
  color: var(--text); padding: 10px 12px; border-radius: var(--radius); font-size: 12px;
  box-shadow: 0 6px 18px rgba(0,0,0,.25); border: 1px solid var(--border-lt); background: var(--surface);
  display: flex; gap: 8px; align-items: flex-start; animation: slidein .18s ease-out;
}
.toast svg.ic { margin-top: 1px; }
.toast.err { background: var(--red-bg); border-color: var(--red-border); color: #7a1f2b; }
.toast.ok { background: var(--green-bg); border-color: var(--green-border); color: #1e6b3a; }
.toast.warn { background: var(--amber-bg); border-color: var(--amber-border); color: #8a5a12; }
.toast .tx { background: none; border: none; color: inherit; margin-left: auto; font-size: 13px; opacity: .7; }
.toast .tact { text-decoration: underline; cursor: pointer !important; font-weight: bold; }
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } }

/* =================== login =================== */
#login { height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--teal); } /* flat (UI #2) */
.loginbox { background: #fff; border-radius: 6px; width: 390px; max-width: 92vw; box-shadow: 0 8px 28px rgba(0,0,0,.28); overflow: hidden; } /* lighter shadow (UI #8) */
.loginbox .lhead { background: var(--teal-dark); color: #fff; padding: 20px 24px; display: flex; gap: 14px; align-items: center; }
.loginbox .logo { width: 44px; height: 44px; flex: 0 0 44px; } /* logo (UI #1) */
.loginbox .lhead h1 { font-size: 19px; letter-spacing: .5px; }
.loginbox .lhead p { font-size: 11px; opacity: .85; margin-top: 3px; }
.loginbox .lbody { padding: 22px 24px; display: flex; flex-direction: column; gap: 12px; }
.loginbox input { padding: 10px; font-size: 14px; }
#li-pin { font-size: 20px; letter-spacing: 8px; } /* big PIN (UI #6) */
.pinwrap { position: relative; }
.pinwrap .peek { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--muted); }
.loginbox .btn.primary { padding: 11px; font-size: 13px; justify-content: center; }
.loginbox .btn.primary:hover { background: #0d4757; } /* distinct hover (UI #7) */
.loginbox .flink { font-size: 12.5px; color: var(--teal); text-align: center; cursor: pointer !important; text-decoration: underline; padding: 6px; } /* UI #4 */
.field-err { color: var(--red); font-size: 11px; display: none; } /* UI #5 */
.field-err.show { display: block; }
.lver { text-align: center; font-size: 10px; color: var(--muted); padding-bottom: 10px; }

/* lock screen (DF #48) */
#lockscreen { position: fixed; inset: 0; background: var(--teal); z-index: 500; display: none; align-items: center; justify-content: center; }
#lockscreen.show { display: flex; }

/* files grid */
.filegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); gap: var(--gap); }
.fcard { border: 1px solid var(--border-lt); border-radius: 6px; overflow: hidden; background: var(--surface); display: flex; flex-direction: column; position: relative; box-shadow: 0 1px 4px rgba(15,35,52,.07); }
.fcard .fprev { height: 110px; background: var(--panel); display: flex; align-items: center; justify-content: center; overflow: hidden; cursor: pointer !important; }
.fcard .fprev img { max-width: 100%; max-height: 100%; object-fit: contain; } /* letterbox (UI #81) */
.fcard .fprev video { width: 100%; height: 100%; object-fit: cover; }
.fbadge { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 54px; border-radius: 4px; font-size: 10px; font-weight: bold; color: #fff; } /* filetype badges (UI #82) */
.fbadge.pdf { background: #c0392b; } .fbadge.img { background: #2471a3; } .fbadge.vid { background: #7d3c98; } .fbadge.doc { background: #1e8449; } .fbadge.other { background: #7f8c8d; }
.fcard .fmeta { padding: 7px 9px; font-size: 11px; }
.fcard .fmeta .fcat { font-weight: bold; color: var(--teal); font-size: 10px; text-transform: uppercase; line-height: 1.3; } /* wraps 2 lines (UI #83) */
.fcard .fmeta .fname { word-break: break-all; margin: 2px 0; }
.fcard .kebab { position: absolute; top: 4px; right: 4px; background: var(--surface); border: 1px solid var(--border-lt); border-radius: var(--radius); width: 24px; height: 22px; font-weight: bold; color: var(--text-2); } /* UI #84 */
.fcard .kebab:hover { background: var(--teal-lt); }

/* lightbox */
.lightbox { position: fixed; inset: 0; background: rgba(10,16,20,.88); z-index: 400; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 10px; }
.lightbox img, .lightbox video { max-width: 92vw; max-height: 82vh; }
.lightbox .lb-bar { color: #fff; display: flex; gap: 14px; align-items: center; }
.lightbox button { background: rgba(255,255,255,.15); color: #fff; border: none; border-radius: var(--radius); padding: 7px 14px; }

/* dashboard */
.dcards { display: grid; grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); gap: 10px; margin-bottom: 16px; }
.dcard { border: 1px solid var(--border-lt); border-radius: var(--radius); padding: 12px 14px; background: var(--surface); cursor: pointer !important; }
.dcard:hover { border-color: var(--teal); background: var(--teal-lt); } /* clickable (UX #16) */
.dcard .dnum { font-size: 24px; font-weight: bold; color: var(--teal); font-variant-numeric: tabular-nums; }
.dcard .dlab { font-size: 11px; color: var(--muted); margin-top: 2px; }
.dcard.hot .dnum { color: var(--red); }
.bar { display: flex; align-items: center; gap: 8px; margin: 4px 0; font-size: 11.5px; }
.bar .blab { width: clamp(90px, 22vw, 220px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: right; color: var(--text-2); } /* UI #85 */
.bar .btrack { flex: 1; background: var(--panel); border-radius: 3px; height: 16px; }
.bar .bfill { height: 100%; border-radius: 3px; min-width: 2px; background: var(--teal); }
.bar .bfill.amber { background: #e6a817; } .bar .bfill.red { background: #d34a3d; } .bar .bfill.green { background: #2eaa5e; } /* UI #86 */
.bar .bnum { width: 30px; font-weight: bold; font-variant-numeric: tabular-nums; }

.status-pill { display: inline-block; padding: 2px 9px; border-radius: 10px; font-size: 11px; font-weight: bold; background: var(--teal-lt); color: var(--navy); }
.theme-dark .status-pill { color: var(--text); }
.muted { color: var(--muted); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
a.lnk { color: var(--teal); cursor: pointer !important; text-decoration: underline; }
.theme-dark a.lnk { color: #6db9cc; }
.kbd { background: var(--panel); border: 1px solid var(--border-lt); border-radius: 3px; padding: 1px 6px; font-size: 10.5px; font-family: Consolas, monospace; }

/* department-scoped tabs */
.tab.mine { box-shadow: inset 0 -3px 0 var(--teal); font-weight: bold; }
.tab.mine:not(.on) { color: var(--teal); }
.tab.locked { opacity: .55; font-style: italic; }
.tab.locked.on { opacity: .8; }
.ro-banner { position: sticky; top: 0; z-index: 4; }

/* niche identity: UK plate, stamps, chips */
.plate { display: inline-block; background: #f7c31c; color: #111; font-family: 'Arial Black', Arial, sans-serif; font-weight: 900; font-size: 11px; letter-spacing: 1px; padding: 1px 7px; border-radius: 3px; border: 1px solid #b8940e; white-space: nowrap; }
.plate.sm { font-size: 10px; padding: 0 5px; }
.stampchip { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 3px; font-size: 10px; font-weight: 900; letter-spacing: 1px; border: 2px solid; box-sizing: border-box; white-space: nowrap; }
.stampchip.live { color: #0a7a3d; border-color: #0a7a3d; background: #eaf7ee; }
.stampchip.notlive { color: #c0392b; border-color: #c0392b; background: #fdeef0; }
.hchip { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 10px; border-radius: 12px; font-size: 10.5px; font-weight: bold; align-self: flex-start; margin-top: 15px; white-space: nowrap; box-sizing: border-box; }
/* prominent "in hire with <company>" chip in the claim header */
.hirewith { display: inline-flex; align-items: center; gap: 5px; align-self: flex-start; margin-top: 15px; height: 24px; padding: 0 12px; border-radius: 12px; font-size: 11px; font-weight: 800; letter-spacing: .4px; white-space: nowrap; box-sizing: border-box; background: linear-gradient(135deg, #1a2857, #3d6ea5); color: #fff; border: 1px solid #14204a; box-shadow: 0 1px 4px rgba(26,40,87,.35); }
.hchip.teal { background: var(--teal-lt); color: var(--teal); border: 1px solid #b9d4dd; }
.hchip.amber { background: var(--amber-bg); color: var(--amber); border: 1px solid var(--amber-border); }
.hchip.red { background: var(--red-bg); color: #8e2735; border: 1px solid var(--red-border); }
.refbox.fault { background: #8e2735; border-color: #6e1620; }
.eseal { display: inline-flex; align-items: center; gap: 3px; font-size: 9px; font-weight: 900; color: #0a7a3d; border: 1.5px solid #0a7a3d; border-radius: 3px; padding: 1px 6px; letter-spacing: .5px; background: #eaf7ee; }
.today-divider td { background: var(--teal-lt) !important; color: var(--teal); font-weight: bold; font-size: 10px; text-align: center; padding: 2px !important; letter-spacing: 1px; border: none !important; }
.fsel { position: absolute; top: 6px; left: 6px; width: 16px; height: 16px; accent-color: var(--teal); }

/* compact one-screen overview */
.ovstrip { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--border-lt); border-radius: 6px; padding: 6px 10px; margin-bottom: 10px; flex-wrap: wrap; box-shadow: 0 1px 3px rgba(15,35,52,.06); }
.ovnext { display: inline-flex; align-items: center; gap: 4px; min-width: 0; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-shrink: 1; }
.ovchip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 11px; font-size: 10.5px; font-weight: bold; cursor: pointer !important; white-space: nowrap; }
.ovchip.red { background: var(--red-bg); color: #8e2735; border: 1px solid var(--red-border); }
.ovchip.green { background: var(--green-bg); color: #1e6b3a; border: 1px solid var(--green-border); }
.ovchip.amber { background: var(--amber-bg); color: #8a5a12; border: 1px solid var(--amber-border); }
.deptprog { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; margin-bottom: 8px; }
.ovgrid { display: grid; grid-template-columns: minmax(260px, 300px) minmax(0, 1fr) minmax(300px, 340px); gap: 10px; align-items: start; }
.ovc { background: var(--surface); border: 1px solid var(--border-lt); border-top: 3px solid var(--teal); border-radius: 6px; padding: 8px 10px 9px; box-shadow: 0 1px 3px rgba(15,35,52,.06); }
.ovrail { display: flex; flex-direction: column; gap: 10px; }
.ovh { display: flex; align-items: center; gap: 6px; font-weight: bold; font-size: 11.5px; color: var(--navy); margin-bottom: 5px; }
.theme-dark .ovh { color: var(--text); }
.ovrow { display: flex; align-items: center; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--hairline); min-width: 0; }
.ovrow:last-child { border-bottom: none; }
.ovrow.slim { padding: 3px 0; font-size: 11.5px; }
.ovic { width: 24px; height: 24px; border-radius: 6px; display: flex; align-items: center; justify-content: center; flex: 0 0 24px; }
.ovrt { min-width: 0; flex: 1; }
.ovl { font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.ovv { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ovstory { font-size: 11.5px; line-height: 1.55; }
.ovstory > div { margin-bottom: 5px; }
.ovstory .rd { color: var(--red); font-weight: bold; }
.ovstory .bl { color: #1a5276; font-weight: bold; }
.theme-dark .ovstory .bl { color: #7db4d8; }
.ovstory .gr { color: var(--green); font-weight: bold; }
@media (max-width: 1150px) { .ovgrid { grid-template-columns: 1fr 1fr; } .ovc.grow { grid-column: 1 / -1; } }
@media (max-width: 760px) { .ovgrid { grid-template-columns: 1fr; } }
/* small screens: let wide tables scroll horizontally within their card instead of blowing out the page */
@media (max-width: 820px) { fieldset.fs { overflow-x: auto; } .tbl { min-width: 560px; } }

/* key facts + journey + invoice head */
.kfgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 700px) { .kfgrid { grid-template-columns: 1fr; } }
.kfact { display: flex; gap: 10px; align-items: center; padding: 9px 10px; border: 1px solid var(--hairline); border-radius: 8px; background: var(--panel); min-width: 0; }
.kficon { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex: 0 0 32px; }
.kflabel { font-size: 9.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.kfvalue { font-size: 12.5px; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.jprog { height: 9px; background: var(--panel); border: 1px solid var(--hairline); border-radius: 5px; overflow: hidden; flex: 1; }
.jfill { height: 100%; background: linear-gradient(90deg, #0e7490, #0a7a3d); border-radius: 5px; }
.invhead { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

/* DVLA verification (green = matches DVLA, red = differs) */
input.match { border-color: #2eaa5e !important; background: var(--green-bg) !important; }
input.mismatch, select.mismatch { border-color: var(--red) !important; background: var(--red-bg) !important; }

/* overview two-column */
.ov2 { display: grid; grid-template-columns: 1.55fr 1fr; gap: 14px; align-items: start; }
@media (max-width: 1050px) { .ov2 { grid-template-columns: 1fr; } }
.jrow { display: flex; align-items: center; gap: 8px; padding: 6px 2px; border-bottom: 1px solid var(--hairline); font-size: 12px; }
.jrow:last-child { border-bottom: none; }
.jrow .spacer { flex: 1; }
.jrow a.lnk { font-size: 11px; }

/* upload progress (UX #35) */
.upwrap { display: flex; align-items: center; gap: 8px; }
.upbar { flex: 1; height: 12px; background: var(--panel); border: 1px solid var(--border-lt); border-radius: 6px; overflow: hidden; }
.upbar .upfill { height: 100%; background: var(--teal); width: 0%; transition: width .2s; }

/* context menu (DF #20) */
.ctxmenu { position: fixed; background: var(--surface); border: 1px solid var(--border); box-shadow: 0 6px 18px rgba(0,0,0,.25); z-index: 350; min-width: 180px; padding: 3px; }
.ctxmenu button { display: flex; width: 100%; text-align: left; padding: 6px 10px; background: none; border: none; font-size: 12px; color: var(--text); gap: 8px; align-items: center; }
.ctxmenu button:hover { background: var(--teal-lt); }

/* command palette (DF #11 / UX #88) */
#palette input { width: 100%; padding: 10px 12px; font-size: 14px; }
#palette .pl-list { max-height: 340px; overflow: auto; margin-top: 8px; }
#palette .pl-item { padding: 7px 10px; border-radius: var(--radius); display: flex; gap: 10px; align-items: center; cursor: pointer !important; font-size: 12.5px; }
#palette .pl-item:hover, #palette .pl-item.hot { background: var(--teal-lt); }
#palette .pl-item .plsub { color: var(--muted); font-size: 11px; }

/* pager */
.pager { display: flex; gap: 6px; align-items: center; justify-content: flex-end; margin-top: 8px; font-size: 11.5px; }

/* dense mode (DF #36) */
.dense .tbl td { padding: 2px 8px; font-size: 11.5px; }
.dense .tbl th { padding: 3px 8px; }

/* big text (NT #45) */
.bigtext { font-size: 13.5px; }
.bigtext .tbl td { font-size: 13px; }

/* scrollbars: webkit + firefox (UI #98) */
* { scrollbar-width: thin; scrollbar-color: var(--border) var(--panel); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 5px; border: 2px solid var(--panel); }
::-webkit-scrollbar-track { background: var(--panel); }

@media (max-width: 900px) {
  .bottom { flex-direction: column; flex-basis: 300px; }
  .bpanel.left { border-right: none; border-bottom: 2px solid var(--border); }
}

/* Department queue: scan first, expand only the task being worked. */
.dept-queue-modal { min-height: 300px; }
.dept-queue-filter { display:flex; align-items:center; gap:10px; padding:8px 12px; margin:-4px 0 10px; background:#f4f8fa; border:1px solid #d7e3e8; border-radius:9px; }
.dept-queue-filter .field { margin:0; min-width:230px; }
.dept-queue-summary { position:sticky; top:0; z-index:2; display:grid; grid-template-columns:repeat(3, 110px) 1fr; gap:8px; padding:8px 0 10px; background:var(--surface, #fff); }
.queue-stat { display:flex; align-items:baseline; gap:7px; padding:8px 10px; border:1px solid #d7e3e8; border-radius:9px; background:#fff; }
.queue-stat b { color:#087086; font-size:18px; line-height:1; }
.queue-stat span,.queue-help { color:#617083; font-size:11px; }
.queue-help { display:flex; justify-content:flex-end; align-items:center; }
.dept-queue-list { display:grid; gap:8px; }
.queue-card { margin:0 !important; padding:0 !important; overflow:hidden; border:1px solid #d4e1e7 !important; border-left:4px solid #08758b !important; border-radius:10px !important; box-shadow:0 2px 7px rgba(15,42,60,.06); }
.queue-card-head { min-height:48px; padding:8px 10px; gap:7px; border:0 !important; flex-wrap:wrap; }
.queue-card-head > .muted { min-width:250px; flex:1; }
.queue-card-head .hchip { white-space:nowrap; }
.queue-details-toggle { cursor:pointer; padding:8px 12px; border-top:1px solid #e5edf1; background:#f8fafb; color:#086c80; font-size:11px; font-weight:700; list-style:none; }
.queue-details-toggle::before { content:'+'; display:inline-grid; place-items:center; width:16px; height:16px; margin-right:6px; border-radius:50%; background:#dceff3; }
.queue-work[open] .queue-details-toggle::before { content:'−'; }
.queue-work > :not(summary) { margin:8px 10px !important; }

/* Repair workspace: compact route selector followed by balanced work groups. */
.tab-repair { display:grid; grid-template-columns:minmax(230px, .7fr) minmax(650px, 2.3fr); gap:10px; align-content:start; }
.tab-repair .repair-decision { grid-column:1; }
.tab-repair .repair-details { grid-column:2; grid-row:1 / span 2; }
.tab-repair .repair-decision .grid { grid-template-columns:1fr !important; }
.tab-repair .repair-details .grid { grid-template-columns:repeat(4,minmax(0,1fr)) !important; }
.tab-repair > .banner,.tab-repair > fieldset:not(.repair-decision):not(.repair-details) { grid-column:1 / -1; }
.tab-repair .repair-details { border-top:3px solid #08758b; }
@media (max-width:1100px) {
  .tab-repair { grid-template-columns:1fr; }
  .tab-repair .repair-decision,.tab-repair .repair-details { grid-column:1; grid-row:auto; }
  .tab-repair .repair-details .grid { grid-template-columns:repeat(2,minmax(0,1fr)) !important; }
  .dept-queue-summary { grid-template-columns:repeat(3,1fr); }
  .queue-help { display:none; }
}

/* service-request toggle switches (overview) */
.svc-toggle { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px 7px 10px; border: 1px solid var(--border-lt, #e2e8f0); border-radius: 20px; background: #fff; cursor: pointer; font-size: 12px; font-weight: 600; color: #475569; transition: border-color .15s, color .15s, background .15s; }
.svc-toggle .svc-knob { width: 30px; height: 16px; border-radius: 10px; background: #cbd5e1; position: relative; flex: 0 0 30px; transition: background .15s; }
.svc-toggle .svc-knob::after { content: ''; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.svc-toggle.on { border-color: #0a7a3d; color: #0a7a3d; background: #0a7a3d0d; }
.svc-toggle.on .svc-knob { background: #0a7a3d; }
.svc-toggle.on .svc-knob::after { left: 16px; }
.svc-toggle .svc-tick { color: #0a7a3d; font-weight: bold; }
.svc-toggle:hover { border-color: #94a3b8; }
.svc-toggle:disabled { opacity: .55; cursor: not-allowed; }

/* informational strip at the top of tabs (label + value chips) */
.tabinfo { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin-bottom: 13px; }
.tabinfo-chip { background: var(--surface); border: 1px solid var(--border-lt); border-left: 3px solid var(--teal); border-radius: 8px; padding: 7px 11px; box-shadow: 0 1px 2px rgba(15,35,52,.05); min-width: 0; }
.tabinfo-chip .ti-label { display: block; font-size: 9.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.tabinfo-chip .ti-value { display: block; font-size: 14px; font-weight: 700; color: var(--text); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabinfo-chip.green { border-left-color: var(--green); } .tabinfo-chip.green .ti-value { color: var(--green); }
.tabinfo-chip.amber { border-left-color: var(--amber); } .tabinfo-chip.amber .ti-value { color: var(--amber); }
.tabinfo-chip.red { border-left-color: var(--red); } .tabinfo-chip.red .ti-value { color: var(--red); }
.tabinfo-chip.blue { border-left-color: #1d4ed8; } .tabinfo-chip.blue .ti-value { color: #1d4ed8; }

/* prominent OFF-HIRE toggle button (hire page) */
.offhire-toggle { display: inline-flex; align-items: center; gap: 10px; padding: 10px 16px 10px 12px; border: 2px solid var(--green-border); border-radius: 26px; background: var(--green-bg); cursor: pointer; font-size: 13px; font-weight: 700; color: var(--green); transition: all .18s ease; box-shadow: 0 1px 3px rgba(15,35,52,.1); }
.offhire-toggle .oht-knob { width: 44px; height: 24px; border-radius: 14px; background: var(--green); position: relative; flex: 0 0 44px; transition: background .18s; }
.offhire-toggle .oht-knob::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: left .18s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.offhire-toggle .oht-state { font-size: 11px; letter-spacing: .5px; padding: 2px 9px; border-radius: 10px; background: var(--green); color: #fff; }
.offhire-toggle:hover { filter: brightness(.98); box-shadow: 0 2px 6px rgba(15,35,52,.16); }
.offhire-toggle.on { border-color: var(--amber-border); background: var(--amber-bg); color: var(--amber); box-shadow: 0 0 0 3px rgba(180,83,9,.14), 0 2px 6px rgba(180,83,9,.18); }
.offhire-toggle.on .oht-knob { background: var(--amber); }
.offhire-toggle.on .oht-knob::after { left: 23px; }
.offhire-toggle.on .oht-state { background: var(--amber); }

/* print: one-page claim summary (UI/NT #43, DF #42) */
@media print {
  body { overflow: visible; background: #fff; }
  .menubar, .ribbon, .tabstrip, .bottom, .statusbar, #splitter, #toasts, .modal-back, #connbar, .claimbar .rightbtns { display: none !important; }
  #app { display: block !important; height: auto; }
  .workspace { overflow: visible; padding: 0; }
  .claimbar { border: 1px solid #999; margin-bottom: 10px; }
}

/* ============================================================
   DESIGN POLISH — refinement of the classic look (same layout,
   same teal/navy palette). Structural tweaks are theme-safe;
   light-only colour tweaks are scoped to :not(.theme-dark).
   ============================================================ */
:root { --radius: 5px; }

/* smooth, consistent interactions everywhere */
.btn, .rbtn, .tab, input, select, textarea, .chip, .bhead .chip, .refbox, .stampchip, .hchip, .mhead .x { transition: background-color .13s ease, border-color .13s ease, color .13s ease, box-shadow .13s ease; }

/* buttons — a little more presence and depth */
.btn { padding: 7px 14px; box-shadow: 0 1px 1px rgba(15,35,52,.05); }
.btn:hover { box-shadow: 0 2px 5px rgba(15,35,52,.11); }
.btn:active { transform: translateY(.5px); }
.btn.primary { box-shadow: 0 1px 2px rgba(18,85,101,.28); }
.btn.primary:hover { box-shadow: 0 2px 7px rgba(18,85,101,.32); }
.btn.sm { border-radius: 4px; }

/* inputs — soft focus ring, gentle radius */
input, select, textarea { border-radius: 5px; }
input:focus, select:focus, textarea:focus { box-shadow: 0 0 0 3px rgba(23,103,122,.13); }

/* fieldset cards — airier, softer edges, refined legend */
fieldset.fs { border-radius: 9px; padding: 13px 15px 15px; box-shadow: 0 1px 3px rgba(15,35,52,.06), 0 1px 1px rgba(15,35,52,.04); }
fieldset.fs legend { border-radius: 6px; padding: 3px 11px; box-shadow: 0 1px 2px rgba(15,35,52,.07); }
.ovc { border-radius: 9px; box-shadow: 0 1px 3px rgba(15,35,52,.06); }
.ovstrip { border-radius: 9px; }

/* tabs — tidier shape, clearer active */
.tabstrip { padding: 5px 8px 0; gap: 3px; }
.tab { border-radius: 6px 6px 0 0; padding: 8px 14px; }
.tab.on { box-shadow: 0 -2px 7px rgba(15,35,52,.06); }

/* ribbon + header boxes — subtle softening */
.rbtn { border-radius: 6px; box-shadow: 0 1px 1px rgba(15,35,52,.04); }
.refbox { border-radius: 9px; }
.clientbox { border-radius: 9px; }

/* tables — bolder, calmer header */
.tbl th { font-weight: 700; letter-spacing: .2px; }

/* modals — softer corners + shadow */
.modal { border-radius: 10px; }
.mhead { border-radius: 10px 10px 0 0; }
.mfoot { border-radius: 0 0 10px 10px; }

/* light-theme-only colour refinements (kept out of dark mode) */
body:not(.theme-dark) .tab { background: #dbe1e7; color: #38434f; border-color: var(--border-lt); }
body:not(.theme-dark) .tab:hover { background: #eaeff3; }
body:not(.theme-dark) .tbl th { background: linear-gradient(var(--tbl-head), #e6ebef); }
body:not(.theme-dark) .tbl tbody tr:hover { background: #eef5f9; }
body:not(.theme-dark) .workspace { background: #fcfdfe; }

/* ============================================================
   MODERN PASS (client request): simple, clean, easy to use.
   System font stack, lighter chrome, roomier controls, softer
   ribbon. Brand teal/navy retained; dark mode unaffected where
   rules are scoped to :not(.theme-dark).
   ============================================================ */
:root { --font: 'Segoe UI', -apple-system, BlinkMacSystemFont, Inter, Roboto, Arial, sans-serif; --radius: 8px; }
body { font-size: 12.5px; }

/* menubar + ribbon: flat, airy */
body:not(.theme-dark) .menubar { background: #ffffff; border-bottom-color: var(--hairline); }
body:not(.theme-dark) .ribbon { background: #ffffff; border-bottom: 1px solid var(--border-lt); }
.rbtn { border-radius: 8px; border-color: transparent; box-shadow: none; }
body:not(.theme-dark) .rbtn { background: transparent; }
body:not(.theme-dark) .rbtn:hover { background: var(--teal-lt); border-color: transparent; }
.rsep { background: var(--hairline); }
.rgroup .rlabel { font-size: 8.5px; letter-spacing: .6px; }

/* header + tabs: card-like, pill tabs */
body:not(.theme-dark) .claimbar { background: #fbfcfd; }
.refbox, .clientbox { border-radius: 10px; }
.tabstrip { padding: 8px 10px 8px; gap: 5px; border-bottom: 1px solid var(--border-lt); align-items: center; }
.tab { border-radius: 16px; border: 1px solid transparent; padding: 6px 14px; border-top: none; }
body:not(.theme-dark) .tab { background: #eef2f5; }
.tab.on { border: 1px solid var(--teal); border-top: 1px solid var(--teal); background: var(--surface); color: var(--teal); margin-bottom: 0; padding-bottom: 6px; box-shadow: none; }
.theme-dark .tab.on { background: var(--surface); color: var(--text); }

/* inputs & buttons: modern rounding */
input, select, textarea { border-radius: 8px; padding: 7px 10px; }
.btn { border-radius: 8px; }
.btn.sm { border-radius: 7px; }
.chip, .bhead .chip { border-radius: 12px; padding: 3px 11px; }

/* cards */
fieldset.fs { border-radius: 12px; border-top-width: 3px; }
fieldset.fs legend { border-radius: 8px; }
.ovc { border-radius: 12px; }
.ovstrip { border-radius: 12px; }
.tabinfo-chip { border-radius: 10px; }
.modal { border-radius: 14px; }
.mhead { border-radius: 14px 14px 0 0; }
.mfoot { border-radius: 0 0 14px 14px; }

/* tables: calm flat headers */
body:not(.theme-dark) .tbl th { background: #f6f8fa; border-color: var(--hairline); }
.tbl td { padding: 6px 9px; }
.tbl th { padding: 7px 9px; }

/* app background */
body:not(.theme-dark) { background: #f2f5f8; }
body:not(.theme-dark) .bottom { background: #fbfcfd; }
body:not(.theme-dark) .tab.on { color: var(--teal); background: var(--surface); border-color: var(--teal); }

/* ============ shared claims mailbox (Gmail-style split view) ============ */
.mb-wrap { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 10px; height: 480px; }
.mb-list { overflow: auto; border: 1px solid var(--border-lt); border-radius: 10px; background: var(--surface); }
.mb-row { padding: 9px 12px; border-bottom: 1px solid var(--hairline); cursor: pointer; }
.mb-row:hover { background: var(--teal-lt); }
.mb-row.sel { background: var(--sel); }
.mb-row.unread .mb-from, .mb-row.unread .mb-subj { font-weight: 700; }
.mb-row.unread { box-shadow: inset 3px 0 0 var(--teal); }
.mb-from { font-size: 12px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mb-subj { font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.mb-date { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.mb-read { display: flex; flex-direction: column; border: 1px solid var(--border-lt); border-radius: 10px; background: var(--surface); overflow: hidden; }
.mb-head { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-bottom: 1px solid var(--hairline); flex-wrap: wrap; }
.mb-body { flex: 1 1 auto; min-height: 0; }
@media (max-width: 900px) { .mb-wrap { grid-template-columns: 1fr; height: auto; } .mb-list { max-height: 220px; } .mb-read { min-height: 320px; } }

/* ============ overview redesign — livelier, card-based ============ */
.deptprog { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin-bottom: 12px; }
.dpcard { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--border-lt); border-radius: 12px; padding: 11px 13px; position: relative; overflow: hidden; box-shadow: 0 1px 3px rgba(15,35,52,.06); transition: transform .12s ease, box-shadow .12s ease; }
.dpcard::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--dp); }
.dpcard:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(15,35,52,.10); }
.dpic { width: 34px; height: 34px; flex: 0 0 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--dp) 12%, transparent); }
.dpbody { flex: 1; min-width: 0; }
.dpname { font-weight: 700; font-size: 12px; letter-spacing: .2px; }
.dpstatus { font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.jprog.dp { width: 100%; height: 5px; margin-top: 5px; border-radius: 3px; background: var(--hairline); overflow: hidden; }
.jprog.dp .jfill { height: 100%; border-radius: 3px; }
.dppct { font-weight: 800; font-size: 15px; color: var(--dp); flex: 0 0 auto; }
.dppct.done { color: var(--green); font-size: 18px; }

/* overview cards: colored headers + hover lift */
.ovc { transition: transform .12s ease, box-shadow .12s ease; }
.ovc:hover { box-shadow: 0 4px 12px rgba(15,35,52,.09); }
.ovh { font-weight: 700; font-size: 12px; letter-spacing: .2px; display: flex; align-items: center; gap: 6px; padding-bottom: 7px; margin-bottom: 4px; border-bottom: 1px solid var(--hairline); }

/* key-facts rows: bigger icon tiles, roomier */
.ovic { width: 30px !important; height: 30px !important; flex: 0 0 30px !important; border-radius: 9px !important; display: flex; align-items: center; justify-content: center; }
.ovrow { padding: 6px 0; }
.ovl { font-size: 9.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.ovv { font-size: 12.5px; font-weight: 600; }

/* claim story: readable panel */
.ovstory { font-size: 12.5px; line-height: 1.8; padding: 6px 4px; }
.ovstory > div { padding: 3px 0; border-bottom: 1px dashed var(--hairline); }
.ovstory > div:last-child { border-bottom: none; }

/* journey progress bar: thicker, friendlier */
.jprog { height: 7px; border-radius: 4px; background: var(--hairline); overflow: hidden; }
.jprog .jfill { height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--teal), #3d9db5); }

/* service-request panel pops a little more */
.svc-toggle { font-size: 12.5px; }

/* ============ RIBBON — original layout, higher contrast, NO horizontal scroll ============ */
.ribbon { flex-wrap: wrap; overflow: visible; row-gap: 5px; padding: 6px 8px 4px; }
body:not(.theme-dark) .rbtn { background: #ffffff; border: 1px solid #c3d0da; box-shadow: 0 1px 2px rgba(15,35,52,.08); }
.rbtn { color: #16232e; font-weight: 600; }
.theme-dark .rbtn { border-color: #3a4a58; }
body:not(.theme-dark) .rbtn:hover { background: var(--teal-lt); border-color: var(--teal); }
.rgroup .rlabel { color: #4e5d6a; font-weight: 700; letter-spacing: .5px; }
.theme-dark .rgroup .rlabel { color: var(--muted); }
.rsep { background: #c3d0da; }
/* primary actions (New FNOL, Save) stand out */
body:not(.theme-dark) .rbtn:has(> b) { background: var(--teal); border-color: var(--teal-dark, #0b5c73); color: #fff; }
body:not(.theme-dark) .rbtn:has(> b) svg.ic { stroke: #fff; }
body:not(.theme-dark) .rbtn:has(> b):hover { background: var(--teal-dark, #0b5c73); }
.theme-dark .rbtn:has(> b) { background: var(--teal); color: #fff; }
body:not(.theme-dark) .rbtn.warn-save { background: #fde8c8; border-color: #d97706; color: #8a4a06; } /* unsaved beats the fill */
body:not(.theme-dark) .rbtn.warn-save svg.ic { stroke: #8a4a06; }

/* the tab strip wraps too — nothing in the chrome scrolls sideways */
.tabstrip { flex-wrap: wrap; overflow: visible; row-gap: 3px; }
body { overflow-x: hidden; }

/* ============ FORM TABS IN 2 COLUMNS — less scrolling, easier to fill in ============ */
.workspace.cols { display: grid; grid-template-columns: 1fr; gap: 0 16px; align-items: start; align-content: start; }
@media (min-width: 900px) { .workspace.cols { grid-template-columns: 1fr 1fr; } }
@media (min-width: 2000px) { .workspace.cols { grid-template-columns: 1fr 1fr 1fr; } }
.workspace.cols > * { min-width: 0; }
.workspace.cols > .banner, .workspace.cols > .tabinfo { grid-column: 1 / -1; }

/* form cards: clearer header, softer body, comfortable inputs */
fieldset.fs { border-radius: 10px; padding: 13px 16px 15px; }
fieldset.fs legend { border-radius: 999px; padding: 3px 12px; background: #eef5f7; border-color: #cfe0e7; letter-spacing: .2px; }
.theme-dark fieldset.fs legend { background: var(--panel); border-color: var(--border); }
.fld label { color: #3a4a58; }
.theme-dark .fld label { color: var(--muted); }
.fld input, .fld select, .fld textarea { padding: 7px 9px; font-size: 12.5px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid rgba(23,103,122,.4); outline-offset: 0; border-color: var(--teal); }

/* ================================================================
   DESIGN SYSTEM V3 — the professional pass.
   One palette, one type scale, calm chrome, consistent depth.
   Light theme refined here; dark theme keeps its own tokens.
   ================================================================ */
:root {
  --teal: #0e6a80; --teal-dark: #0a5162; --teal-lt: #e7f1f4;
  --navy: #16324c;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow-md: 0 2px 8px rgba(16, 24, 40, .09);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .18);
}
body:not(.theme-dark) {
  --bg: #f0f3f7; --panel: #f7f9fb; --surface: #ffffff;
  --border: #c9d3dc; --border-lt: #dee5eb; --hairline: #e8edf2;
  --tbl-head: #f4f7f9; --zebra: #f8fafc;
  --text: #1a2733; --text-2: #45566a; --muted: #6d7d8d;
}
body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

/* ---- chrome: white bars separated by hairlines only ---- */
body:not(.theme-dark) .menubar { background: #fff; border-bottom: 1px solid var(--hairline); }
.menubar .mitem { padding: 6px 11px; font-weight: 500; color: var(--text-2); border-radius: 7px; margin: 2px 0; }
body:not(.theme-dark) .menubar .mitem:hover, body:not(.theme-dark) .menubar .mitem.open { background: var(--teal-lt); color: var(--teal-dark); }
.mdrop { border: 1px solid var(--border-lt); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 5px; }
.mdrop button { border-radius: 7px; padding: 7px 10px; }

/* ---- ribbon: bordered white buttons, unified icons, tight groups ---- */
body:not(.theme-dark) .ribbon { background: #fff; border-bottom: 1px solid var(--border-lt); box-shadow: var(--shadow-sm); }
.ribbon { padding: 7px 10px 5px; }
.rbtn { border-radius: 9px; font-size: 10.5px; font-weight: 600; letter-spacing: .1px; width: 66px; padding: 6px 3px 4px; gap: 4px; }
body:not(.theme-dark) .rbtn { background: #fff; border: 1px solid var(--border-lt); box-shadow: var(--shadow-sm); color: #2a3b4c; }
body:not(.theme-dark) .rbtn:hover { background: var(--teal-lt); border-color: #a8c8d3; box-shadow: none; }
/* icons in the chrome are one calm slate colour — no rainbow */
.ribbon .rbtn svg.ic { stroke: #4a6172 !important; }
body:not(.theme-dark) .rbtn:hover svg.ic { stroke: var(--teal-dark) !important; }
body:not(.theme-dark) .rbtn:has(> b) { background: var(--teal); border-color: var(--teal-dark); color: #fff; box-shadow: 0 1px 3px rgba(10, 81, 98, .35); }
body:not(.theme-dark) .rbtn:has(> b) svg.ic, body:not(.theme-dark) .rbtn:has(> b):hover svg.ic { stroke: #fff !important; }
body:not(.theme-dark) .rbtn:has(> b):hover { background: var(--teal-dark); }
body:not(.theme-dark) .rbtn.warn-save { background: #b45309; border-color: #92400e; color: #fff; box-shadow: 0 1px 3px rgba(146, 64, 14, .4); }
body:not(.theme-dark) .rbtn.warn-save svg.ic { stroke: #fff !important; }
body:not(.theme-dark) .rbtn:disabled { background: #fff; border-color: var(--hairline); color: #9daebb; box-shadow: none; }
body:not(.theme-dark) .rbtn:disabled svg.ic { stroke: #b3c1cc !important; }
.rgroup .rlabel { font-size: 8.5px; font-weight: 700; letter-spacing: .8px; color: #8494a3; padding-top: 1px; }
.rsep { background: var(--hairline); margin: 3px 6px; }

/* ---- claim bar ---- */
body:not(.theme-dark) .claimbar { background: #fff; border-bottom: 1px solid var(--border-lt); box-shadow: none; }
.refbox { border-radius: 10px; letter-spacing: .5px; }
.hlabel { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: #8494a3; }

/* ---- tab strip: clean underline tabs (no grey pills) ---- */
body:not(.theme-dark) .tabstrip { background: #fff; border-bottom: 1px solid var(--border-lt); }
.tabstrip { padding: 3px 10px 0; gap: 2px; align-items: stretch; }
.tab, body:not(.theme-dark) .tab {
  background: transparent; border: none; border-radius: 8px 8px 0 0;
  padding: 9px 13px 10px; font-size: 12.5px; font-weight: 500; color: var(--text-2);
  position: relative; box-shadow: none;
}
.tab::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: transparent; }
.tab:hover, body:not(.theme-dark) .tab:hover { background: var(--panel); color: var(--text); }
.tab.on, body:not(.theme-dark) .tab.on {
  background: transparent; border: none; color: var(--teal-dark); font-weight: 700;
  padding: 9px 13px 10px; margin: 0;
}
.tab.on::after { background: var(--teal); }
.theme-dark .tab.on { color: #7ec6d8; }

/* ---- workspace: soft canvas, white cards ---- */
body:not(.theme-dark) .workspace { background: var(--bg); }
fieldset.fs {
  border: 1px solid var(--border-lt); border-top: 1px solid var(--border-lt); border-radius: 12px;
  padding: 14px 18px 17px; margin-bottom: 14px; box-shadow: var(--shadow-sm);
}
fieldset.fs legend {
  background: transparent; border: none; box-shadow: none; border-radius: 0;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .7px;
  color: var(--text-2); padding: 0 6px;
}
fieldset.fs legend svg.ic { stroke: var(--teal) !important; }
.tabinfo { gap: 10px; margin-bottom: 14px; }
.tabinfo-chip { border-radius: 10px; border: 1px solid var(--border-lt); border-left-width: 4px; padding: 9px 13px; }
.tabinfo-chip .ti-label { font-size: 9.5px; font-weight: 600; letter-spacing: .6px; }
.tabinfo-chip .ti-value { font-size: 15px; letter-spacing: -.2px; }
.banner { border-radius: 10px; font-size: 12.5px; padding: 10px 14px; border-width: 1px; }

/* ---- forms: consistent, comfortable, obvious focus ---- */
.fld { gap: 4px; }
.fld label { font-size: 11px; font-weight: 600; color: var(--text-2); letter-spacing: .1px; }
input[type=text], input[type=email], input[type=date], input[type=time], input[type=number], input[type=password], select, textarea {
  border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; font-size: 12.5px;
  background: var(--surface); transition: border-color .12s ease, box-shadow .12s ease;
}
body:not(.theme-dark) input:hover:not(:focus):not(.dirty), body:not(.theme-dark) select:hover:not(:focus), body:not(.theme-dark) textarea:hover:not(:focus) { border-color: #a9b8c5; }
input:focus, select:focus, textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(14, 106, 128, .14); outline: none; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; }

/* ---- buttons: one family ---- */
.btn { border-radius: 8px; font-weight: 600; padding: 7px 14px; border-color: var(--border); box-shadow: var(--shadow-sm); color: var(--text); }
.btn:hover { border-color: var(--teal); box-shadow: none; }
.btn.primary { box-shadow: 0 1px 3px rgba(10, 81, 98, .3); border-color: var(--teal-dark); }
.btn.sm { padding: 4px 10px; border-radius: 7px; }
.chip, .bhead .chip { border-radius: 999px; font-weight: 600; }

/* ---- tables: airy, quiet header, tabular numbers ---- */
.tbl { font-variant-numeric: tabular-nums; }
.tbl th, body:not(.theme-dark) .tbl th {
  background: var(--tbl-head); font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .6px; color: #64788a; padding: 8px 10px; border-bottom: 1px solid var(--border-lt);
}
.tbl td { padding: 8px 10px; border-bottom: 1px solid var(--hairline); font-size: 12.3px; }
body:not(.theme-dark) .tbl tbody tr:hover { background: #f2f7fa; }

/* ---- bottom panel + status bar ---- */
body:not(.theme-dark) .bhead { background: #fff; border-bottom: 1px solid var(--hairline); }
.bhead { padding: 7px 10px; }
body:not(.theme-dark) .statusbar { background: var(--navy); }

/* ---- modals ---- */
.modal { border-radius: 14px; box-shadow: var(--shadow-lg); border: 1px solid var(--border-lt); }
.mhead { border-radius: 14px 14px 0 0; }
.mfoot { border-radius: 0 0 14px 14px; }

/* ---- scrollbars (WebKit) — slim and unobtrusive ---- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c3cfd9; border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #a9b8c5; border: 2px solid transparent; background-clip: content-box; }
.theme-dark ::-webkit-scrollbar-thumb { background: #46525e; border: 2px solid transparent; background-clip: content-box; }

/* ---- empty fields: red border until filled in ---- */
.workspace input.unfilled, .workspace select.unfilled, .workspace textarea.unfilled { border-color: #d05663; }
.workspace input.unfilled:focus, .workspace select.unfilled:focus, .workspace textarea.unfilled:focus { border-color: #d05663; box-shadow: 0 0 0 3px rgba(208, 86, 99, .15); }
.theme-dark .workspace input.unfilled, .theme-dark .workspace select.unfilled, .theme-dark .workspace textarea.unfilled { border-color: #b34955; }

/* ---- titles and subtitles: strong, consistent contrast ---- */
body:not(.theme-dark) fieldset.fs legend { color: #1c2a36; }
body:not(.theme-dark) .fld label { color: #3f5060; }
body:not(.theme-dark) .ovh { color: #1c2a36; font-weight: 700; }
body:not(.theme-dark) .tabinfo-chip .ti-label { color: #5a6b7a; }
body:not(.theme-dark) .hlabel { color: #566574; }
body:not(.theme-dark) .rgroup .rlabel { color: #66788a; }
body:not(.theme-dark) .mhead { color: #16232e; }
body:not(.theme-dark) .mhead .msub { color: #5a6b7a; }
body:not(.theme-dark) .bhead b, body:not(.theme-dark) .bhead { color: #1c2a36; }
body:not(.theme-dark) .tbl th { color: #55687a; }
body:not(.theme-dark) .muted { color: #64748b; }

/* ---- balanced columns (JS masonry) — replaces the grid that left holes under short cards ---- */
.workspace.cols { display: block; }
.mason { display: flex; gap: 16px; align-items: flex-start; }
.mason > .mcol { flex: 1 1 0; min-width: 0; }
.mason fieldset.fs { margin-bottom: 16px; }
fieldset.fs { margin-bottom: 16px; }

/* ---- alignment polish: uniform control heights, even gutters ---- */
input[type=text], input[type=email], input[type=date], input[type=time], input[type=number], input[type=password], select { height: 33px; }
.fld > .hint { margin-top: 2px; }
.grid, .grid2, .grid3 { gap: 12px 14px; }
.banner { margin-bottom: 14px; }
.tabinfo { margin-bottom: 14px; }

/* ================================================================
   CLAIM WORKSPACE V4 — compact, consistent, low-scroll tab pages
   ================================================================ */
.workspace.tab-page {
  padding: 8px 10px 10px;
  scroll-padding-top: 10px;
}
.tab-page fieldset.fs {
  padding: 9px 12px 11px;
  margin-bottom: 9px;
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .045);
}
.tab-page fieldset.fs legend {
  padding: 0 5px;
  font-size: 10.5px;
  letter-spacing: .58px;
}
.tab-page .grid,
.tab-page .grid2,
.tab-page .grid3,
.tab-page .sketch-fields { gap: 6px 10px; }
.tab-page .sketch-two-col,
.tab-page .mason { gap: 10px; }
.tab-page .mason fieldset.fs,
.tab-page .sketch-card { margin-bottom: 9px !important; }
.tab-page .fld { gap: 2px; min-width: 0; }
.tab-page .fld label { font-size: 10.5px; line-height: 1.2; }
.tab-page .fld .hint { font-size: 9.5px; line-height: 1.25; color: var(--muted); }
.tab-page input[type=text], .tab-page input[type=email], .tab-page input[type=date],
.tab-page input[type=time], .tab-page input[type=number], .tab-page input[type=password],
.tab-page select { height: 30px; padding: 5px 8px; font-size: 12px; border-radius: 7px; }
.tab-page textarea { min-height: 54px; padding: 6px 8px; font-size: 12px; line-height: 1.35; resize: vertical; }
.tab-page .banner { min-height: 34px; padding: 7px 10px; margin-bottom: 8px; border-radius: 8px; }
.tab-page .tabinfo { gap: 7px; margin-bottom: 8px; }
.tab-page .tabinfo-chip { min-height: 44px; padding: 6px 10px; border-radius: 8px; }
.tab-page .tabinfo-chip .ti-value { font-size: 13px; }
.tab-page .btn { min-height: 30px; padding: 5px 10px; }
.tab-page .btn.sm { min-height: 26px; padding: 3px 8px; }

/* Detail entry tabs use the same balanced two-card rhythm. */
.tab-client .sketch-two-col,
.tab-vehicle .sketch-two-col,
.tab-accident .sketch-two-col,
.tab-thirdparty .sketch-two-col,
.tab-hire .sketch-two-col { align-items: stretch; }
.tab-client > .sketch-card { margin-top: 0 !important; }
.tab-client > fieldset.fs .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tab-hire .sketch-stack > fieldset:last-child { margin-bottom: 0 !important; }

/* Dense operational forms: readable columns without long vertical runs. */
@media (min-width: 1180px) {
  .tab-engineer .grid,
  .tab-repair .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .tab-accounts .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tab-client > fieldset.fs .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* Documents, money and audit pages prioritise actions + scannable tables. */
.tab-accounts > fieldset.fs:first-of-type { position: sticky; top: -1px; z-index: 3; }
.tab-files .filegrid { gap: 8px; }
.tab-files .fcard { border-radius: 9px; }
.tab-invoices .invhead { gap: 8px; }
.tab-invoices .kfact { min-height: 48px; padding: 7px 9px; border-radius: 8px; }
.tab-page .tbl th { top: 0; z-index: 2; padding: 6px 8px; }
.tab-page .tbl td { padding: 6px 8px; }
.tab-audit fieldset.fs { overflow: auto; }

/* Files: one library panel with compact category bands instead of one large
   fieldset per category. Upload and checklist remain easy to find above it. */
.tab-files .docs-panel { padding-bottom: 8px; }
.docs-library { display: grid; gap: 9px; }
.docs-category { min-width: 0; padding-top: 7px; border-top: 1px solid var(--hairline); }
.docs-category:first-child { padding-top: 0; border-top: 0; }
.docs-category-head { display: flex; align-items: center; gap: 7px; margin: 0 0 6px; font-size: 11px; color: var(--text-2); }
.docs-category-head .chip { min-width: 22px; padding: 1px 7px; text-align: center; font-size: 9.5px; }
.tab-files .filegrid { grid-template-columns: repeat(auto-fill, minmax(225px, 1fr)); }
.tab-files .fprev { height: 74px; }

/* Invoices: ordinary scrolling, a single top summary and a 60/40 working area. */
.tab-invoices > fieldset.fs:first-of-type { position: static; }
.invoice-layout { display: grid; grid-template-columns: minmax(0, 3fr) minmax(330px, 2fr); gap: 10px; align-items: start; }
.invoice-column { min-width: 0; }
.invoice-column fieldset.fs:last-child { margin-bottom: 0; }
.tab-invoices .invhead { flex-wrap: wrap; }
.tab-invoices .invhead > .kfact { flex: 0 1 220px; }
.invoice-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-left: auto; justify-content: flex-end; }
.invoice-actions .btn { white-space: nowrap; padding-left: 9px; padding-right: 9px; }
.tab-invoices .invoice-secondary .ovrow.slim { flex-wrap: wrap; }
.tab-invoices .invoice-secondary .ovrow.slim input,
.tab-invoices .invoice-secondary .ovrow.slim select { flex: 1 1 130px; width: auto !important; min-width: 0 !important; }
@media (max-width: 1350px) { .invoice-layout { grid-template-columns: 1fr; } }

/* Overview stays a cockpit: compact cards, no artificial blank height. */
.tab-overview .ovc { border-radius: 9px; }
.tab-overview .ovh { min-height: 31px; padding: 6px 9px; }
.tab-overview .ovrow { padding: 5px 8px; }
.tab-overview .ovstory { padding: 7px 10px; line-height: 1.4; }
.tab-overview fieldset.fs { margin-bottom: 8px; }

/* Responsive: retain two-column entry longer; stack cleanly on smaller laptops. */
@media (max-width: 1050px) and (min-width: 801px) {
  .tab-page .sketch-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .workspace.tab-page { padding: 7px; }
  .tab-page .sketch-two-col, .tab-page .mason { display: block; }
  .tab-page .sketch-fields, .tab-page .grid, .tab-page .grid2, .tab-page .grid3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 620px) {
  .tab-page .sketch-fields, .tab-page .grid, .tab-page .grid2, .tab-page .grid3 { grid-template-columns: 1fr; }
  .tab-page fieldset.fs { padding: 8px; }
}

/* Preserve the persistent history/diary tray without letting it consume most
   of a laptop viewport; the existing splitter still lets staff enlarge it. */
.bottom { flex-basis: 220px; }

.outlook-picker { display:grid; gap:6px; max-height:58vh; overflow:auto; padding:2px; }
.outlook-pick { display:flex; flex-direction:column; gap:4px; width:100%; padding:10px 12px; text-align:left; color:var(--text); background:#fff; border:1px solid #d7e3e8; border-radius:8px; cursor:pointer; }
.outlook-pick:hover,.outlook-pick:focus { border-color:#08758b; background:#f1fafb; outline:none; }
.outlook-pick b { font-size:12px; }
.outlook-pick span { color:var(--muted); font-size:10.5px; }
.email-preview-loading { padding:30px; text-align:center; color:var(--muted); }
.email-preview { display:grid; grid-template-rows:auto minmax(420px,62vh); min-height:480px; border:1px solid #d7e3e8; border-radius:9px; overflow:hidden; background:#fff; }
.email-preview-head { padding:12px 16px; border-bottom:1px solid #d7e3e8; background:#f7fafb; color:#334155; font-size:11.5px; line-height:1.55; }
.email-preview-head h3 { margin:0 0 7px; color:#12212f; font-size:15px; }
.email-preview-frame { display:block; width:100%; height:100%; min-height:420px; border:0; background:#fff; }
.email-preview-text { padding:16px; white-space:pre-wrap; line-height:1.6; overflow:auto; background:#fff; }

/* Final specificity for the repair workspace (the generic workspace grid is
   declared above and must not split the route card unintentionally). */
.workspace.tab-repair { grid-template-columns:minmax(230px,.7fr) minmax(650px,2.3fr); }
.workspace.tab-repair .repair-decision { grid-column:1; }
.workspace.tab-repair .repair-details { grid-column:2; grid-row:1 / span 2; }
.workspace.tab-repair > .banner,
.workspace.tab-repair > fieldset:not(.repair-decision):not(.repair-details) { grid-column:1 / -1; }
@media (max-width:1100px) {
  .workspace.tab-repair { grid-template-columns:1fr; }
  .workspace.tab-repair .repair-decision,
  .workspace.tab-repair .repair-details { grid-column:1; grid-row:auto; }
}
.supervisor-review-row{background:#fff7d6!important;border-left:4px solid #d97706}.supervisor-review-row td{font-weight:600;color:#7c4a03}
