/* ===== Assura Motor Claims 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) */
.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 { padding: 5px 12px; border-radius: 12px; font-size: 11px; font-weight: bold; align-self: flex-start; margin-top: 17px; } /* 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: 17px; }
.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 .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; }
.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); }
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gap); }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); }
.grid2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--gap); }
@media (max-width: 1100px) { .grid { grid-template-columns: repeat(2, 1fr); } .grid3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .grid, .grid3, .grid2 { grid-template-columns: 1fr; } }
.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 */
.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; }

/* ---------- 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; }
.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; }

/* 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); }
.ovgrid { display: grid; grid-template-columns: 285px 1fr 330px; 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; } }

/* 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); }
}

/* 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; }
}
