/* Jones Petroleum maintenance workspace — design system
   Light and dark palettes are separate token sets; components only use tokens. */
:root {
  color-scheme: light;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", system-ui, "Helvetica Neue", Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  --accent: #0879cf;
  --accent-ink: #ffffff;
  --accent-soft: color-mix(in srgb, var(--accent) 11%, transparent);
  --accent-text: color-mix(in srgb, var(--accent) 88%, #000);
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #fbfbfd;
  --surface-3: #f2f2f5;
  --glass: rgba(255, 255, 255, .72);
  --line: rgba(0, 0, 0, .075);
  --line-2: rgba(0, 0, 0, .13);
  --text: #1d1d1f;
  --text-2: #3d3d42;
  --muted: #6e6e73;
  --faint: #8e8e93;
  --hover: rgba(0, 0, 0, .04);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .04), 0 1px 1px rgba(0, 0, 0, .02);
  --shadow-2: 0 10px 30px -12px rgba(0, 0, 0, .18), 0 2px 6px rgba(0, 0, 0, .04);
  --shadow-3: 0 30px 80px -20px rgba(0, 0, 0, .35), 0 8px 24px rgba(0, 0, 0, .08);
  --ok: #1d8a3a; --ok-soft: #e8f6ec;
  --warn: #a25d00; --warn-soft: #fdf2e1;
  --bad: #c9302c; --bad-soft: #fdecec;
  --info: #0b6bc2; --info-soft: #e7f1fc;
  --neutral: #5f6168; --neutral-soft: #eeeef1;
  --violet: #6a4bc4; --violet-soft: #f0ecfb;
  --viz-surface: #fcfcfb;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --grid: #ececea;
  --r-sm: 8px; --r: 12px; --r-lg: 18px;
  --side: 252px;
  --top: 60px;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-mode="light"]) {
    color-scheme: dark;
    --accent-ink: #ffffff;
    --accent-soft: color-mix(in srgb, var(--accent) 22%, transparent);
    --accent-text: color-mix(in srgb, var(--accent) 55%, #fff);
    --bg: #0f0f11; --surface: #1c1c1f; --surface-2: #202024; --surface-3: #2a2a2f; --glass: rgba(28, 28, 31, .72);
    --line: rgba(255, 255, 255, .08); --line-2: rgba(255, 255, 255, .15);
    --text: #f5f5f7; --text-2: #d8d8dd; --muted: #a1a1a8; --faint: #7c7c84; --hover: rgba(255, 255, 255, .055);
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .4); --shadow-2: 0 12px 30px -10px rgba(0, 0, 0, .6); --shadow-3: 0 30px 80px -20px rgba(0, 0, 0, .8);
    --ok: #4fd06e; --ok-soft: rgba(79, 208, 110, .14); --warn: #ffb547; --warn-soft: rgba(255, 181, 71, .14);
    --bad: #ff6b63; --bad-soft: rgba(255, 107, 99, .14); --info: #64b0ff; --info-soft: rgba(100, 176, 255, .14);
    --neutral: #b4b4bb; --neutral-soft: rgba(255, 255, 255, .08); --violet: #b29dff; --violet-soft: rgba(178, 157, 255, .14);
    --viz-surface: #1a1a19; --series-1: #3987e5; --series-2: #d95926; --grid: #2c2c2a;
  }
}
:root[data-mode="dark"] {
  color-scheme: dark;
  --accent-ink: #ffffff;
  --accent-soft: color-mix(in srgb, var(--accent) 22%, transparent);
  --accent-text: color-mix(in srgb, var(--accent) 55%, #fff);
  --bg: #0f0f11; --surface: #1c1c1f; --surface-2: #202024; --surface-3: #2a2a2f; --glass: rgba(28, 28, 31, .72);
  --line: rgba(255, 255, 255, .08); --line-2: rgba(255, 255, 255, .15);
  --text: #f5f5f7; --text-2: #d8d8dd; --muted: #a1a1a8; --faint: #7c7c84; --hover: rgba(255, 255, 255, .055);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .4); --shadow-2: 0 12px 30px -10px rgba(0, 0, 0, .6); --shadow-3: 0 30px 80px -20px rgba(0, 0, 0, .8);
  --ok: #4fd06e; --ok-soft: rgba(79, 208, 110, .14); --warn: #ffb547; --warn-soft: rgba(255, 181, 71, .14);
  --bad: #ff6b63; --bad-soft: rgba(255, 107, 99, .14); --info: #64b0ff; --info-soft: rgba(100, 176, 255, .14);
  --neutral: #b4b4bb; --neutral-soft: rgba(255, 255, 255, .08); --violet: #b29dff; --violet-soft: rgba(178, 157, 255, .14);
  --viz-surface: #1a1a19; --series-1: #3987e5; --series-2: #d95926; --grid: #2c2c2a;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { min-height: 100vh; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 70%, transparent); outline-offset: 2px; border-radius: 6px; }
::selection { background: color-mix(in srgb, var(--accent) 25%, transparent); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tabular { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.mono { font-family: var(--mono); font-size: .92em; }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.icon.sm { width: 15px; height: 15px; }
.icon.lg { width: 22px; height: 22px; }

.boot { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--muted); }
.boot img { border-radius: 14px; box-shadow: var(--shadow-2); }

/* Shell ------------------------------------------------------------------ */
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.shell.collapsed { --side: 72px; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px; padding: 14px 12px 12px;
  background: var(--glass); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-right: 1px solid var(--line); overflow: hidden; z-index: 30; }
.brand { display: flex; align-items: center; gap: 11px; padding: 6px 8px 14px; color: var(--text); text-decoration: none !important; }
.brand img { width: 36px; height: 36px; border-radius: 10px; object-fit: cover; box-shadow: var(--shadow-1); flex: none; }
.brand b { display: block; font-family: var(--font-display); font-size: 14.5px; letter-spacing: -.01em; white-space: nowrap; }
.brand small { display: block; color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.nav { flex: 1; overflow-y: auto; overflow-x: hidden; margin: 0 -4px; padding: 0 4px; scrollbar-width: thin; }
.nav-group { margin: 14px 10px 5px; font-size: 11px; font-weight: 600; letter-spacing: .04em; color: var(--faint); text-transform: uppercase; white-space: nowrap; }
.nav a { display: flex; align-items: center; gap: 11px; height: 34px; padding: 0 10px; margin: 1px 0; border-radius: 9px; color: var(--text-2);
  text-decoration: none; white-space: nowrap; font-weight: 500; }
.nav a:hover { background: var(--hover); }
.nav a.active { background: var(--accent-soft); color: var(--accent-text); }
.nav a .icon { color: var(--muted); }
.nav a.active .icon { color: var(--accent-text); }
.nav a .count { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; display: grid; place-items: center;
  font-size: 11.5px; font-weight: 600; background: var(--surface-3); color: var(--text-2); }
.nav a .count.alert { background: var(--bad); color: #fff; }
.side-foot { border-top: 1px solid var(--line); padding-top: 8px; display: grid; gap: 2px; }
.side-foot button, .side-foot a { display: flex; align-items: center; gap: 11px; height: 34px; padding: 0 10px; border: 0; border-radius: 9px; background: none;
  color: var(--text-2); cursor: pointer; text-align: left; white-space: nowrap; font-weight: 500; text-decoration: none; }
.side-foot button:hover, .side-foot a:hover { background: var(--hover); }
.shell.collapsed .brand > div, .shell.collapsed .nav-group, .shell.collapsed .nav a span, .shell.collapsed .nav a .count, .shell.collapsed .side-foot span { display: none; }
.shell.collapsed .nav a, .shell.collapsed .side-foot button, .shell.collapsed .side-foot a { justify-content: center; padding: 0; }
.shell.collapsed .nav-group { display: block; height: 1px; background: var(--line); margin: 10px 8px; font-size: 0; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; height: var(--top); display: flex; align-items: center; gap: 12px; padding: 0 22px;
  background: color-mix(in srgb, var(--bg) 78%, transparent); backdrop-filter: saturate(180%) blur(18px); -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid var(--line); }
.menu-btn { display: none; }
.search-trigger { flex: 0 1 440px; display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--muted); cursor: text; box-shadow: var(--shadow-1); }
.search-trigger kbd { margin-left: auto; font: 11px var(--font); color: var(--faint); border: 1px solid var(--line-2); border-radius: 5px; padding: 1px 6px; }
.recents { display: flex; gap: 6px; overflow: hidden; flex: 1; min-width: 0; mask-image: linear-gradient(90deg, #000 85%, transparent); }
.recents a { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 8px; color: var(--muted);
  font-size: 12.5px; background: transparent; text-decoration: none; max-width: 210px; }
.recents a:hover { background: var(--hover); color: var(--text); }
.recents a b { font-weight: 600; color: var(--text-2); }
.recents a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip { display: flex; align-items: center; gap: 9px; height: 36px; padding: 0 6px 0 4px; border-radius: 18px; border: 0; background: none; cursor: pointer; }
.user-chip:hover { background: var(--hover); }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 12.5px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 80%, #fff), var(--accent)); color: #fff; }
.user-chip .who { text-align: left; line-height: 1.15; }
.user-chip .who b { display: block; font-size: 13px; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip .who small { color: var(--muted); font-size: 11.5px; }
.content { padding: 24px 28px 48px; min-width: 0; flex: 1; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-family: var(--font-display); font-size: 28px; line-height: 1.12; letter-spacing: -.022em; margin: 0; font-weight: 700; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.page-head .spacer { flex: 1; }
.eyebrow { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .01em; }

/* Controls ---------------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; padding: 0 14px; border-radius: 9px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--text); font-weight: 550; cursor: pointer; white-space: nowrap;
  box-shadow: var(--shadow-1); transition: background .15s, border-color .15s, transform .05s; text-decoration: none !important; }
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(.5px); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
.btn.danger { color: var(--bad); }
.btn.danger.solid { background: var(--bad); color: #fff; border-color: transparent; }
.btn.ghost { background: none; border-color: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--hover); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.icon-btn { width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 9px; border: 1px solid transparent; background: none;
  color: var(--text-2); cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.bordered { border-color: var(--line-2); background: var(--surface); box-shadow: var(--shadow-1); }
.icon-btn.sm { width: 28px; height: 28px; border-radius: 7px; }
.icon-btn:disabled { opacity: .4; cursor: default; }
.input, .field input, .field select, .field textarea, select.input {
  width: 100%; height: 36px; padding: 0 11px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text);
  transition: border-color .15s, box-shadow .15s; }
textarea.input, .field textarea { height: auto; min-height: 96px; padding: 9px 11px; resize: vertical; line-height: 1.45; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3.5px var(--accent-soft); }
.input.sm { height: 30px; font-size: 13px; padding: 0 9px; border-radius: 8px; }
select.input, .field select { appearance: none; padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M7 10l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; background-size: 16px; }
.field { display: grid; gap: 5px; min-width: 0; }
.field > span { font-size: 12.5px; font-weight: 550; color: var(--text-2); }
.field.wide { grid-column: 1 / -1; }
.field small { color: var(--muted); }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); }
.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--surface-3); border: 1px solid var(--line); }
.segmented button { height: 28px; padding: 0 12px; border: 0; border-radius: 7.5px; background: none; color: var(--text-2); font-weight: 550; font-size: 13px; cursor: pointer; white-space: nowrap; }
.segmented button:hover { color: var(--text); }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1), 0 0 0 .5px var(--line-2); }
.search-field { position: relative; display: flex; align-items: center; }
.search-field .icon { position: absolute; left: 10px; color: var(--faint); pointer-events: none; }
.search-field input { padding-left: 34px; }

/* Chips & status ---------------------------------------------------------- */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 11px; font-size: 12px; font-weight: 600;
  white-space: nowrap; background: var(--neutral-soft); color: var(--neutral); line-height: 1; }
.chip i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.info { background: var(--info-soft); color: var(--info); }
.chip.violet { background: var(--violet-soft); color: var(--violet); }
.chip.accent { background: var(--accent-soft); color: var(--accent-text); }
.chip.outline { background: none; box-shadow: inset 0 0 0 1px var(--line-2); color: var(--text-2); }
.prio { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 550; color: var(--text-2); white-space: nowrap; }
.prio b { display: inline-flex; gap: 2px; }
.prio b i { width: 3px; height: 11px; border-radius: 2px; background: var(--line-2); }
.prio.p4 b i:nth-child(-n+4), .prio.p3 b i:nth-child(-n+3), .prio.p2 b i:nth-child(-n+2), .prio.p1 b i:nth-child(1) { background: currentColor; }
.prio.p4 { color: var(--bad); } .prio.p3 { color: var(--warn); } .prio.p2 { color: var(--info); } .prio.p1 { color: var(--neutral); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--neutral); flex: none; }

/* Cards & layout ---------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.card-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px 0; }
.card-head h2, .card-head h3 { margin: 0; font-size: 15px; font-weight: 650; letter-spacing: -.005em; }
.card-head .spacer { flex: 1; }
.card-body { padding: 14px 18px 18px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.stack { display: grid; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spacer { flex: 1; }
.empty { display: grid; justify-items: center; text-align: center; gap: 8px; padding: 40px 20px; color: var(--muted); }
.empty .icon { width: 34px; height: 34px; color: var(--faint); stroke-width: 1.4; }
.empty h3 { margin: 4px 0 0; color: var(--text); font-size: 15px; }
.empty p { margin: 0; max-width: 420px; }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: 12px; background: var(--info-soft); color: var(--text-2); font-size: 13.5px; }
.notice .icon { color: var(--info); margin-top: 1px; }
.notice.warn { background: var(--warn-soft); } .notice.warn .icon { color: var(--warn); }
.notice.bad { background: var(--bad-soft); } .notice.bad .icon { color: var(--bad); }
.notice.ok { background: var(--ok-soft); } .notice.ok .icon { color: var(--ok); }

/* Tiles ------------------------------------------------------------------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; margin-bottom: 18px; }
.tile { display: block; padding: 15px 16px 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1);
  color: var(--text); text-decoration: none !important; transition: transform .15s, box-shadow .15s; }
a.tile:hover { transform: translateY(-1px); box-shadow: var(--shadow-2); }
.tile label { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 550; color: var(--muted); cursor: inherit; }
.tile label .icon { width: 15px; height: 15px; }
.tile strong { display: block; margin-top: 8px; font-family: var(--font-display); font-size: 30px; line-height: 1; letter-spacing: -.03em; font-weight: 650; font-variant-numeric: tabular-nums; }
.tile small { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; }
.tile.alert strong { color: var(--bad); }
.tile.warn strong { color: var(--warn); }

/* Lists / tables ---------------------------------------------------------- */
.workspace { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.workspace.split { grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); }
.list-card { overflow: hidden; display: flex; flex-direction: column; min-width: 0; }
.workspace.split .list-card { position: sticky; top: calc(var(--top) + 16px); max-height: calc(100vh - var(--top) - 40px); }
.list-tools { display: flex; align-items: center; gap: 8px; padding: 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.list-tools .search-field { flex: 1 1 220px; }
.list-scopes { padding: 10px 12px 0; display: flex; gap: 8px; align-items: center; overflow-x: auto; scrollbar-width: none; }
.table-scroll { overflow: auto; min-height: 0; }
table.data { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
table.data th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); text-align: left; font-size: 12px; font-weight: 600; color: var(--muted);
  padding: 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data th button { display: flex; align-items: center; gap: 5px; width: 100%; height: 36px; padding: 0 12px; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
table.data th button:hover { color: var(--text); }
table.data th.sorted { color: var(--text); }
table.data th.num button { justify-content: flex-end; }
table.data tr.filters th { top: 36px; padding: 4px 6px 7px; background: var(--surface-2); }
table.data tr.filters input { width: 100%; min-width: 64px; height: 26px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); padding: 0 7px; font-size: 12px; }
table.data tr.filters input:focus { outline: none; border-color: var(--accent); }
table.data td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data td.id { color: var(--muted); font-family: var(--mono); font-size: 12.5px; }
table.data tbody tr { cursor: pointer; transition: background .1s; }
table.data tbody tr:hover td { background: var(--hover); }
table.data tbody tr.selected td { background: var(--accent-soft); }
table.data tbody tr.tone-bad td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
table.data tbody tr.tone-warn td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
table.data tbody tr.tone-ok td:first-child { box-shadow: inset 3px 0 0 var(--ok); }
table.data tfoot td { position: sticky; bottom: 0; background: var(--surface-2); font-weight: 600; border-top: 1px solid var(--line); border-bottom: 0; color: var(--text-2); }
table.data td a { color: var(--text); text-decoration: none; border-bottom: 1px dotted var(--line-2); }
table.data td a:hover { color: var(--accent-text); border-bottom-color: currentColor; }
table.data td .overdue { color: var(--bad); font-weight: 600; }
.pager { display: flex; align-items: center; gap: 6px; padding: 9px 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12.5px; flex-wrap: wrap; }
.pager input { width: 54px; height: 26px; text-align: center; padding: 0 4px; border-radius: 6px; border: 1px solid var(--line-2); background: var(--surface); font-size: 12.5px; }
.compact-list { overflow-y: auto; min-height: 0; flex: 1; }
.compact-list a { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 11px 14px; border-bottom: 1px solid var(--line);
  color: var(--text); text-decoration: none !important; }
.compact-list a:hover { background: var(--hover); }
.compact-list a.selected { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.compact-list b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compact-list small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compact-list .side { grid-row: span 2; align-self: center; display: grid; justify-items: end; gap: 4px; }
.skeleton { height: 14px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-3), var(--hover), var(--surface-3)); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Record detail ----------------------------------------------------------- */
.record { min-width: 0; display: grid; gap: 16px; }
.record-head { padding: 18px 20px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 16px; align-items: start; }
.record-icon { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); }
.record-icon .icon { width: 23px; height: 23px; }
.record-head h1 { margin: 2px 0 6px; font-family: var(--font-display); font-size: 22px; line-height: 1.2; letter-spacing: -.018em; font-weight: 700; overflow-wrap: anywhere; }
.record-head .meta-line { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.record-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.record-nav { display: inline-flex; align-items: center; gap: 2px; color: var(--muted); font-size: 12.5px; }
.status-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 0 20px 16px; }
.section-tabs { display: flex; gap: 2px; padding: 0 14px; border-top: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.section-tabs a { padding: 11px 10px; color: var(--muted); font-weight: 550; font-size: 13px; white-space: nowrap; border-bottom: 2px solid transparent; text-decoration: none !important; }
.section-tabs a:hover { color: var(--text); }
.section-tabs a.active { color: var(--text); border-bottom-color: var(--accent); }
.record-body { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.record-body.single { grid-template-columns: minmax(0, 1fr); }
.record-main { display: grid; gap: 16px; min-width: 0; }
.section { scroll-margin-top: calc(var(--top) + 16px); }
.fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 22px; margin: 0; }
.fields > div { min-width: 0; }
.fields dt { font-size: 12px; color: var(--muted); font-weight: 550; margin-bottom: 3px; }
.fields dd { margin: 0; overflow-wrap: anywhere; color: var(--text); }
.fields dd.empty-val { color: var(--faint); }
.fields .wide { grid-column: 1 / -1; }
.fields dd.prose { white-space: pre-wrap; line-height: 1.55; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 18px; }
.rail { position: sticky; top: calc(var(--top) + 16px); display: grid; gap: 16px; max-height: calc(100vh - var(--top) - 40px); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 7px 14px; font-size: 13.5px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.kv .total { font-weight: 700; border-top: 1px solid var(--line); padding-top: 8px; }
.mini-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.mini-table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 7px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.mini-table td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.mini-table tr:last-child td { border-bottom: 0; }
.mini-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.mini-table input.input { height: 30px; }
.mini-table tr.muted-row td { color: var(--faint); text-decoration: line-through; }
.table-x { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
.inline-form { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); align-items: end; padding: 12px; margin-top: 12px;
  border-radius: 12px; background: var(--surface-2); border: 1px dashed var(--line-2); }
.inline-form .actions { display: flex; gap: 6px; justify-content: flex-end; }
.people { display: flex; gap: 8px; flex-wrap: wrap; }
.person { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 6px 0 4px; border-radius: 17px; background: var(--surface-3); font-weight: 550; font-size: 13px; }
.person .avatar { width: 26px; height: 26px; font-size: 11px; }
.task { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.task:last-child { border-bottom: 0; }
.task.done .t-title { color: var(--muted); text-decoration: line-through; }
.task input[type=checkbox] { width: 18px; height: 18px; margin-top: 1px; accent-color: var(--accent); }
.task .t-title { flex: 1; }
.progress { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.site-card { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start; }
.site-card .pin { width: 36px; height: 36px; border-radius: 10px; background: var(--surface-3); display: grid; place-items: center; color: var(--muted); }

/* Conversation ------------------------------------------------------------ */
.thread { display: flex; flex-direction: column; min-height: 0; }
.thread-tabs { padding: 12px 12px 0; }
.messages { flex: 1; overflow-y: auto; padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; min-height: 160px; max-height: 52vh; }
.msg { max-width: 92%; display: grid; gap: 3px; }
.msg .bubble { padding: 9px 12px; border-radius: 14px; background: var(--surface-3); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13.5px; line-height: 1.45; }
.msg small { color: var(--faint); font-size: 11.5px; padding: 0 4px; }
.msg.mine { align-self: flex-end; }
.msg.mine .bubble { background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 5px; }
.msg.mine small { text-align: right; }
.msg.theirs .bubble { border-bottom-left-radius: 5px; }
.msg.system { align-self: center; max-width: 100%; }
.msg.system .bubble { background: none; color: var(--muted); font-size: 12.5px; padding: 2px 8px; text-align: center; }
.msg.note .bubble { background: var(--warn-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--warn) 25%, transparent); }
.composer { border-top: 1px solid var(--line); padding: 10px; display: grid; gap: 8px; }
.composer textarea { min-height: 64px; }
.composer .row { justify-content: space-between; }

/* Media ------------------------------------------------------------------- */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.media-grid figure { margin: 0; position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--surface-3); border: 1px solid var(--line); cursor: zoom-in; }
.media-grid img, .media-grid video { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-grid figcaption { position: absolute; inset: auto 0 0; padding: 18px 8px 6px; font-size: 11px; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.6));
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropzone { display: grid; place-items: center; gap: 4px; aspect-ratio: 1; border-radius: 12px; border: 1.5px dashed var(--line-2); color: var(--muted); cursor: pointer; font-size: 12.5px; text-align: center; padding: 8px; }
.dropzone:hover, .dropzone.over { border-color: var(--accent); color: var(--accent-text); background: var(--accent-soft); }
.lightbox { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: rgba(0,0,0,.82); padding: 30px; }
.lightbox img, .lightbox video { max-width: 100%; max-height: 88vh; border-radius: 12px; box-shadow: var(--shadow-3); }

/* Dialogs, palette, menus, toasts ---------------------------------------- */
dialog.modal { padding: 0; border: 0; border-radius: 20px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-3);
  width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 48px); }
dialog.modal.wide { width: min(920px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgba(10, 10, 14, .38); backdrop-filter: blur(3px); }
dialog.modal[open] { animation: pop .18s ease-out; display: flex; flex-direction: column; }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.985); } }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 18px 20px 10px; }
.modal-head h2 { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -.01em; flex: 1; }
.modal-body { padding: 6px 20px 16px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 18px; border-top: 1px solid var(--line); }
.modal-error { color: var(--bad); font-size: 13px; margin: 8px 0 0; }
.palette { position: fixed; inset: 0; z-index: 90; display: grid; justify-items: center; align-items: start; padding-top: 12vh; background: rgba(10, 10, 14, .32); backdrop-filter: blur(3px); }
.palette-box { width: min(640px, calc(100vw - 24px)); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow-3); overflow: hidden; border: 1px solid var(--line); }
.palette-box .search-field input { height: 54px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; font-size: 16px; padding-left: 46px; background: var(--surface); }
.palette-box .search-field input:focus { box-shadow: none; outline: none; }
.palette-box .search-field .icon { left: 16px; width: 20px; height: 20px; }
.palette-results { max-height: 56vh; overflow-y: auto; padding: 6px; }
.palette-results h4 { margin: 10px 10px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); }
.palette-results a { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 9px 10px; border-radius: 10px; color: var(--text); text-decoration: none !important; }
.palette-results a .icon { color: var(--muted); }
.palette-results a.active, .palette-results a:hover { background: var(--accent-soft); }
.palette-results a b { display: block; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-results a small { color: var(--muted); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-results .id { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.palette-hint { padding: 9px 14px; border-top: 1px solid var(--line); color: var(--faint); font-size: 12px; display: flex; gap: 14px; }
.menu { position: fixed; z-index: 80; min-width: 210px; padding: 6px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-3); animation: pop .12s ease-out; }
.menu button, .menu a { display: flex; align-items: center; gap: 10px; width: 100%; height: 34px; padding: 0 10px; border: 0; border-radius: 8px; background: none; color: var(--text); cursor: pointer; text-align: left; font-weight: 500; text-decoration: none !important; white-space: nowrap; }
.menu button:hover, .menu a:hover { background: var(--hover); }
.menu button .icon, .menu a .icon { color: var(--muted); }
.menu .danger { color: var(--bad); } .menu .danger .icon { color: var(--bad); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 5px 4px; }
.menu .menu-label { padding: 6px 10px 4px; font-size: 11.5px; color: var(--faint); font-weight: 600; }
.combo { position: relative; }
.combo-list { position: absolute; z-index: 60; left: 0; right: 0; top: calc(100% + 4px); max-height: 280px; overflow-y: auto; padding: 5px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-2); min-width: 240px; }
.combo-list button { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1px 10px; width: 100%; padding: 7px 9px; border: 0; border-radius: 8px; background: none; text-align: left; cursor: pointer; }
.combo-list button:hover, .combo-list button.active { background: var(--accent-soft); }
.combo-list b { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combo-list small { grid-column: 1; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combo-list .id { grid-row: 1; grid-column: 2; font: 11.5px var(--mono); color: var(--faint); align-self: center; }
.combo-list .none { padding: 10px; color: var(--muted); font-size: 13px; }
.combo .clear { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }
#toasts { position: fixed; right: 20px; bottom: 20px; z-index: 120; display: grid; gap: 8px; justify-items: end; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; max-width: 420px; padding: 11px 14px; border-radius: 14px; background: #1d1d1f; color: #fff;
  box-shadow: var(--shadow-3); font-size: 13.5px; animation: pop .2s ease-out; }
.toast.bad { background: #b3261e; }
.toast .icon { color: #8fe3a4; } .toast.bad .icon { color: #fff; }

/* Auth -------------------------------------------------------------------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; background:
  radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 60%),
  radial-gradient(900px 500px at 110% 110%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 60%), var(--bg); }
.auth-card { width: min(400px, 100%); padding: 32px 30px 28px; border-radius: 24px; background: var(--glass); backdrop-filter: blur(24px) saturate(180%); -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--line); box-shadow: var(--shadow-3); display: grid; gap: 14px; }
.auth-card img { width: 64px; height: 64px; border-radius: 16px; box-shadow: var(--shadow-2); }
.auth-card h1 { margin: 6px 0 0; font-family: var(--font-display); font-size: 25px; letter-spacing: -.02em; }
.auth-card p { margin: 0; color: var(--muted); }
.auth-card .btn { height: 40px; }

/* Charts ------------------------------------------------------------------ */
.viz { position: relative; }
.viz svg { display: block; width: 100%; height: auto; overflow: visible; }
.viz .axis text, .viz .label { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.viz .value { fill: var(--text-2); font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.viz .gridline { stroke: var(--grid); stroke-width: 1; }
.viz .baseline { stroke: var(--line-2); stroke-width: 1; }
.viz .hit { fill: transparent; cursor: default; }
.viz .hit:hover + .mark, .viz .mark.hover { filter: brightness(1.08); }
.viz-tip { position: absolute; z-index: 5; pointer-events: none; padding: 8px 10px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow-2); font-size: 12.5px; white-space: nowrap; transform: translate(-50%, calc(-100% - 10px)); }
.viz-tip b { display: block; margin-bottom: 3px; }
.viz-tip span { display: flex; align-items: center; gap: 6px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.viz-tip i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); margin-bottom: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.viz-table summary { cursor: pointer; color: var(--muted); font-size: 12px; margin-top: 8px; }
.viz-table table { margin-top: 6px; }
.hbars { display: grid; gap: 9px; }
.hbar { display: grid; grid-template-columns: minmax(90px, 36%) minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 13px; }
.hbar .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.hbar .track { height: 12px; position: relative; }
.hbar .track i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--series-1); border-radius: 0 4px 4px 0; min-width: 3px; }
.hbar b { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 26px; text-align: right; }
a.hbar { color: inherit; text-decoration: none !important; border-radius: 6px; }
a.hbar:hover .name { color: var(--accent-text); }

/* Calendar ---------------------------------------------------------------- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.cal .dow { padding: 8px 10px; font-size: 12px; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--line); }
.cal .day { min-height: 118px; padding: 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal .day:nth-child(7n) { border-right: 0; }
.cal .day.other { background: var(--surface-2); }
.cal .day.other .num { color: var(--faint); }
.cal .num { font-size: 12.5px; font-weight: 600; padding: 2px 4px; align-self: flex-start; border-radius: 12px; min-width: 24px; text-align: center; }
.cal .day.today .num { background: var(--accent); color: #fff; }
.cal .ev { display: flex; align-items: center; gap: 5px; padding: 3px 6px; border-radius: 6px; font-size: 11.5px; background: var(--surface-3); color: var(--text); text-decoration: none !important; min-width: 0; }
.cal .ev:hover { background: var(--accent-soft); }
.cal .ev span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal .ev.plan { background: var(--violet-soft); }
.cal .more { font-size: 11.5px; color: var(--muted); padding: 0 6px; }

/* Tree -------------------------------------------------------------------- */
.tree details { border-bottom: 1px solid var(--line); }
.tree summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 10px 14px; cursor: pointer; }
.tree summary::-webkit-details-marker { display: none; }
.tree summary:hover { background: var(--hover); }
.tree summary .chev { transition: transform .15s; color: var(--faint); }
.tree details[open] > summary .chev { transform: rotate(90deg); }
.tree .children { padding-left: 26px; }
.tree .leaf { display: flex; align-items: center; gap: 10px; padding: 8px 14px; color: var(--text); text-decoration: none !important; border-radius: 8px; }
.tree .leaf:hover { background: var(--hover); }

/* Settings ---------------------------------------------------------------- */
.settings-nav { display: grid; gap: 2px; align-content: start; }
.settings-nav button { text-align: left; height: 34px; padding: 0 12px; border: 0; border-radius: 9px; background: none; color: var(--text-2); font-weight: 550; cursor: pointer; }
.settings-nav button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-text); }
.list-editor { display: grid; gap: 6px; }
.list-editor .row { flex-wrap: nowrap; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatches button { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--sw); cursor: pointer; box-shadow: 0 0 0 1px var(--line-2) inset; display: grid; place-items: center; color: #fff; }
.swatches button[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--sw); }

/* Responsive -------------------------------------------------------------- */
@media (max-width: 1280px) {
  .record-body { grid-template-columns: minmax(0, 1fr); }
  .rail { position: static; max-height: none; }
  .fields, .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1080px) {
  .workspace.split { grid-template-columns: minmax(0, 1fr); }
  .workspace.split .list-card { display: none; }
  .grid-3 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .shell, .shell.collapsed { grid-template-columns: minmax(0, 1fr); --side: 270px; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; transform: translateX(-102%); transition: transform .22s ease; box-shadow: var(--shadow-3); background: var(--surface); }
  .shell.drawer .sidebar { transform: none; }
  .shell.collapsed .brand > div, .shell.collapsed .nav-group, .shell.collapsed .nav a span, .shell.collapsed .nav a .count, .shell.collapsed .side-foot span { display: revert; }
  .shell.collapsed .nav a, .shell.collapsed .side-foot button { justify-content: flex-start; padding: 0 10px; }
  .scrim { position: fixed; inset: 0; z-index: 25; background: rgba(0,0,0,.3); }
  .menu-btn { display: inline-grid; }
  .recents, .user-chip .who { display: none; }
  .topbar { padding: 0 12px; gap: 8px; }
  .search-trigger { flex: 1; }
  .search-trigger kbd { display: none; }
  .content { padding: 16px 14px 40px; }
  .page-head h1 { font-size: 24px; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .fields, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .record-head { grid-template-columns: auto minmax(0, 1fr); padding: 16px; }
  .record-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .cal .day { min-height: 76px; padding: 4px; }
  .cal .ev span { display: none; }
  .cal .ev { padding: 3px; justify-content: center; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #toasts { left: 12px; right: 12px; bottom: 12px; justify-items: stretch; }
}

/* Print: a clean record sheet --------------------------------------------- */
@media print {
  .sidebar, .topbar, .list-card, .record-actions, .section-tabs, .rail .composer, .no-print, #toasts, .inline-form { display: none !important; }
  .shell, .workspace.split, .record-body { display: block; }
  .content { padding: 0; }
  .card { box-shadow: none; border-color: #ccc; break-inside: avoid; margin-bottom: 12px; }
  body { background: #fff; color: #000; }
}

/* Late additions */
.list-card .list-body { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.mini-table td.overdue { color: var(--bad); font-weight: 600; }
.status-bar .segmented { flex-wrap: wrap; }

/* Layout containment: wide tables scroll inside their card instead of widening the page. */
.record, .record-main, .rail, .stack, .record-body.single { grid-template-columns: minmax(0, 1fr); }
.record > *, .record-main > *, .record-body > *, .rail > *, .stack > *, .workspace > * { min-width: 0; }
.record-head > div { min-width: 0; }
.record-head .meta-line > * { overflow-wrap: anywhere; }
.status-bar .segmented { overflow-x: auto; max-width: 100%; scrollbar-width: none; flex-wrap: nowrap; }
.mini-table td.mono, table.data td.id { white-space: nowrap; }
.workspace.split > [data-record] { container-type: inline-size; }
@container (max-width: 1040px) {
  .record-body { grid-template-columns: minmax(0, 1fr); }
  .rail { position: static; max-height: none; }
}
@container (max-width: 700px) {
  .fields, .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container (max-width: 460px) {
  .fields, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .record-head { grid-template-columns: auto minmax(0, 1fr); }
  .record-actions { grid-column: 1 / -1; justify-content: flex-start; }
}
/* Focus mode hides the list pane beside an open record. */
.workspace.split.focus { grid-template-columns: minmax(0, 1fr); }
.workspace.split.focus .list-card { display: none; }
@media (max-width: 1080px) { [data-focus] { display: none; } }
.palette-box .search-field { display: flex; width: 100%; }
.palette-box .search-field input { width: 100%; outline: none; color: var(--text); }
.recents a b { white-space: nowrap; }

/* ===== Access, roles and settings components ===== */
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill-check { position: relative; display: inline-flex; cursor: pointer; }
.pill-check input { position: absolute; opacity: 0; pointer-events: none; }
.pill-check span { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 13px; border-radius: 16px; border: 1px solid var(--line-2);
  background: var(--surface); color: var(--text-2); font-weight: 550; font-size: 13px; transition: background .15s, border-color .15s, color .15s, box-shadow .15s; }
.pill-check:hover span { border-color: color-mix(in srgb, var(--accent) 45%, var(--line-2)); }
.pill-check input:checked + span { background: var(--accent); border-color: transparent; color: var(--accent-ink); box-shadow: 0 2px 8px -2px color-mix(in srgb, var(--accent) 55%, transparent); }
.pill-check input:focus-visible + span { outline: 2px solid color-mix(in srgb, var(--accent) 70%, transparent); outline-offset: 2px; }
.pill-check.locked { cursor: default; }
.pill-check.locked span { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; box-shadow: none; }
.access-block { padding: 16px 0; border-bottom: 1px solid var(--line); display: grid; gap: 12px; }
.access-block:first-child { padding-top: 0; }
.access-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.access-head b { display: block; font-size: 14px; }
.access-head small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; max-width: 560px; }
.perm-row { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 12px; align-items: start; }
.perm-title { font-size: 12.5px; font-weight: 600; color: var(--muted); padding-top: 7px; }
.choice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); cursor: pointer; transition: border-color .15s, background .15s; }
.choice:hover { background: var(--hover); }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice input { margin-top: 3px; accent-color: var(--accent); }
.choice b { display: block; font-weight: 600; }
.choice small { display: block; color: var(--muted); font-size: 12.5px; }
.settings-layout { display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 16px; align-items: start; }
.settings-layout > * { min-width: 0; }
.settings-nav { padding: 8px; display: grid; gap: 2px; position: sticky; top: calc(var(--top) + 16px); }
.settings-nav a { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 12px; border-radius: 10px; color: var(--text-2); font-weight: 550; text-decoration: none !important; }
.settings-nav a:hover { background: var(--hover); }
.settings-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-text); }
.role-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.role-card { padding: 14px 16px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface-2); }
.role-card b { display: block; font-weight: 650; }
.role-card small { color: var(--muted); font-size: 12px; }
.role-icon { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); flex: none; }
.loc-list { max-height: 46vh; overflow: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px; padding: 2px; }
.loc-item { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); cursor: pointer; }
.loc-item:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.loc-item input { margin-top: 3px; accent-color: var(--accent); }
.loc-item b { display: block; font-weight: 550; font-size: 13px; }
.loc-item small { display: block; color: var(--muted); font-size: 11.5px; }
@media (max-width: 860px) {
  .settings-layout { grid-template-columns: minmax(0, 1fr); }
  .settings-nav { position: static; display: flex; overflow-x: auto; }
  .settings-nav a { white-space: nowrap; }
  .perm-row { grid-template-columns: minmax(0, 1fr); gap: 6px; }
}

/* ===== Polish layer ===== */
body { background:
  radial-gradient(900px 420px at 85% -120px, color-mix(in srgb, var(--accent) 9%, transparent), transparent 70%),
  radial-gradient(700px 360px at 15% -160px, color-mix(in srgb, var(--accent) 6%, transparent), transparent 70%), var(--bg);
  background-attachment: fixed; }
.sidebar { background: color-mix(in srgb, var(--surface) 70%, transparent); }
.brand { padding: 8px 8px 16px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.brand img { width: 40px; height: 40px; border-radius: 12px; }
.nav a { position: relative; transition: background .15s, color .15s; }
.nav a.active { background: color-mix(in srgb, var(--accent) 13%, transparent); font-weight: 600; }
.nav a.active::before { content: ""; position: absolute; left: -4px; top: 9px; bottom: 9px; width: 3px; border-radius: 2px; background: var(--accent); }
.topbar { background: color-mix(in srgb, var(--bg) 70%, transparent); }
.search-trigger { transition: border-color .15s, box-shadow .15s; }
.search-trigger:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); box-shadow: 0 0 0 3.5px var(--accent-soft); }
.page-head { margin-bottom: 22px; }
.page-head h1 { font-size: 30px; letter-spacing: -.026em; }
.page-head .eyebrow { color: var(--accent-text); letter-spacing: .06em; font-size: 11.5px; }
.card { border-radius: 20px; border-color: color-mix(in srgb, var(--line) 80%, transparent);
  box-shadow: 0 1px 1px rgba(0,0,0,.02), 0 2px 6px -2px rgba(0,0,0,.05), 0 12px 32px -18px rgba(0,0,0,.14); }
.card-head h2, .card-head h3 { font-size: 15.5px; }
.tile { border-radius: 18px; position: relative; overflow: hidden;
  box-shadow: 0 1px 1px rgba(0,0,0,.02), 0 2px 6px -2px rgba(0,0,0,.05), 0 12px 28px -18px rgba(0,0,0,.14); }
.tile label .icon { width: 28px; height: 28px; padding: 6px; border-radius: 9px; background: var(--accent-soft); color: var(--accent-text); }
.tile.alert label .icon { background: var(--bad-soft); color: var(--bad); }
.tile.warn label .icon { background: var(--warn-soft); color: var(--warn); }
.tile strong { margin-top: 12px; font-size: 32px; }
a.tile:hover { transform: translateY(-2px); }
.record-head { background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 7%, transparent), transparent 85%); border-radius: 20px 20px 0 0; }
.record-icon { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 18%, transparent); }
.record-head h1 { font-size: 24px; }
.btn.primary { background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 88%, #fff), var(--accent));
  box-shadow: 0 1px 1px rgba(0,0,0,.08), 0 4px 12px -4px color-mix(in srgb, var(--accent) 60%, transparent); }
.btn.primary:hover { background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 86%, #000)); }
.input, .field input, .field select, .field textarea, select.input { border-radius: 10px; }
table.data th { font-size: 11.5px; letter-spacing: .02em; }
table.data td { padding-top: 11px; padding-bottom: 11px; }
.list-card { border-radius: 20px; }
.compact-list a { transition: background .12s; }
.empty .icon { width: 56px; height: 56px; padding: 14px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); stroke-width: 1.6; }
.section-tabs a { transition: color .15s, border-color .15s; }
.avatar { box-shadow: 0 2px 6px -2px color-mix(in srgb, var(--accent) 70%, transparent); }
.mini-table tbody tr { transition: background .12s; }
.mini-table tbody tr:hover td { background: var(--hover); }
@media (prefers-color-scheme: dark) {
  :root:not([data-mode="light"]) .card, :root:not([data-mode="light"]) .tile { box-shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 12px 32px -18px rgba(0,0,0,.7); }
}
:root[data-mode="dark"] .card, :root[data-mode="dark"] .tile { box-shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 12px 32px -18px rgba(0,0,0,.7); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* Compact sidebar so every item fits on a laptop screen */
.nav a { height: 32px; margin: 1px 0; }
.nav-group { margin: 12px 10px 4px; }
.brand { padding-bottom: 12px; }
.sidebar { gap: 4px; padding-top: 12px; }
@media (max-height: 820px) { .nav a { height: 30px; } .nav-group { margin-top: 9px; } }
@media (max-width: 860px) { .record-nav [aria-label="First record"], .record-nav [aria-label="Last record"] { display: none; } }

/* ===== Login dialog ===== */
.type-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.type-option { position: relative; display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line-2);
  background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s, box-shadow .15s; }
.type-option:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line-2)); }
.field .type-option input, .type-option input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.type-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent) inset; }
.type-option:has(input:focus-visible) { outline: 2px solid color-mix(in srgb, var(--accent) 70%, transparent); outline-offset: 2px; }
.type-icon { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); flex: none; }
.type-option:has(input:checked) .type-icon { background: var(--accent); color: var(--accent-ink); }
.type-text { min-width: 0; display: grid; gap: 1px; }
.type-text b { font-size: 13.5px; font-weight: 600; color: var(--text); }
.type-text small { font-size: 12px; color: var(--muted); font-weight: 400; }
.pw-section { display: grid; gap: 10px; padding: 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.pw-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.pw-head b { font-size: 13.5px; }
.pw-temp { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-radius: 10px; background: var(--surface); border: 1px dashed var(--line-2); }
.pw-temp .mono { font-size: 18px; letter-spacing: .04em; user-select: all; }
.pw-manual { display: flex; gap: 8px; }
.pw-manual .input { flex: 1; }
.pw-note { margin: 4px 0 0; font-size: 12.5px; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13.5px; color: var(--text-2); }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 36px; height: 22px; border-radius: 11px; background: var(--line-2); position: relative; transition: background .15s; flex: none; }
.switch .track i { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s; }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track i { transform: translateX(14px); }
.switch input:focus-visible + .track { outline: 2px solid color-mix(in srgb, var(--accent) 70%, transparent); outline-offset: 2px; }
@media (max-width: 560px) { .type-grid { grid-template-columns: minmax(0, 1fr); } }

/* ===== Appearance preferences ===== */
/* Background */
:root[data-background="plain"] body { background: var(--bg); }
:root[data-background="tinted"] body { background:
  radial-gradient(1100px 600px at 80% -200px, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
  linear-gradient(180deg, color-mix(in srgb, var(--accent) 7%, var(--bg)), var(--bg) 60%); background-attachment: fixed; }
:root[data-background="aurora"] body { background:
  radial-gradient(800px 500px at 90% -10%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 65%),
  radial-gradient(700px 500px at 0% 10%, color-mix(in srgb, #8e4ec6 14%, transparent), transparent 60%),
  radial-gradient(900px 600px at 50% 110%, color-mix(in srgb, #12a594 12%, transparent), transparent 60%), var(--bg); background-attachment: fixed; }

/* Sidebar */
:root[data-sidebar="tinted"] .sidebar { background: color-mix(in srgb, var(--accent) 9%, var(--surface)); border-right-color: color-mix(in srgb, var(--accent) 16%, var(--line)); }
:root[data-sidebar="dark"] .sidebar { background: #16171b; border-right-color: #23252b; color: #e8e8ed; color-scheme: dark; }
:root[data-sidebar="dark"] .sidebar .brand b, :root[data-sidebar="dark"] .sidebar .nav a, :root[data-sidebar="dark"] .sidebar .side-foot button { color: #e3e3e8; }
:root[data-sidebar="dark"] .sidebar .brand small, :root[data-sidebar="dark"] .sidebar .nav-group, :root[data-sidebar="dark"] .sidebar .nav a .icon { color: #8d8f98; }
:root[data-sidebar="dark"] .sidebar .brand { border-bottom-color: #26282f; }
:root[data-sidebar="dark"] .sidebar .side-foot { border-top-color: #26282f; }
:root[data-sidebar="dark"] .sidebar .nav a:hover, :root[data-sidebar="dark"] .sidebar .side-foot button:hover { background: rgba(255,255,255,.06); }
:root[data-sidebar="dark"] .sidebar .nav a.active { background: color-mix(in srgb, var(--accent) 30%, transparent); color: #fff; }
:root[data-sidebar="dark"] .sidebar .nav a.active .icon { color: #fff; }
:root[data-sidebar="dark"] .sidebar .nav a .count { background: rgba(255,255,255,.1); color: #e3e3e8; }

/* Text size (main content area) */
:root[data-text="small"] .content { zoom: .93; }
:root[data-text="large"] .content { zoom: 1.1; }
:root[data-text="large"] .nav a, :root[data-text="large"] .side-foot button { font-size: 15px; }

/* Spacing */
:root[data-density="compact"] .content { padding: 16px 20px 32px; }
:root[data-density="compact"] .card-body { padding: 10px 14px 14px; }
:root[data-density="compact"] .card-head { padding: 12px 14px 0; }
:root[data-density="compact"] table.data td { padding: 6px 10px; }
:root[data-density="compact"] .mini-table td { padding: 6px 8px; }
:root[data-density="compact"] .record, :root[data-density="compact"] .record-main, :root[data-density="compact"] .stack { gap: 10px; }
:root[data-density="compact"] .tiles { gap: 8px; margin-bottom: 12px; }
:root[data-density="compact"] .tile { padding: 11px 13px 10px; }
:root[data-density="compact"] .tile strong { font-size: 26px; margin-top: 8px; }
:root[data-density="compact"] .fields { gap: 10px 18px; }
:root[data-density="compact"] .compact-list a { padding: 8px 12px; }
:root[data-density="compact"] .nav a { height: 29px; }

/* Corners */
:root[data-corners="soft"] .card, :root[data-corners="soft"] .list-card, :root[data-corners="soft"] .tile, :root[data-corners="soft"] dialog.modal { border-radius: 12px; }
:root[data-corners="soft"] .record-head { border-radius: 12px 12px 0 0; }
:root[data-corners="soft"] .btn, :root[data-corners="soft"] .input, :root[data-corners="soft"] .nav a { border-radius: 8px; }
:root[data-corners="crisp"] .card, :root[data-corners="crisp"] .list-card, :root[data-corners="crisp"] .tile, :root[data-corners="crisp"] dialog.modal,
:root[data-corners="crisp"] .role-card, :root[data-corners="crisp"] .pw-section, :root[data-corners="crisp"] .type-option { border-radius: 6px; }
:root[data-corners="crisp"] .record-head { border-radius: 6px 6px 0 0; }
:root[data-corners="crisp"] .btn, :root[data-corners="crisp"] .input, :root[data-corners="crisp"] .nav a, :root[data-corners="crisp"] .segmented,
:root[data-corners="crisp"] .segmented button, :root[data-corners="crisp"] .search-trigger, :root[data-corners="crisp"] .record-icon { border-radius: 4px; }
:root[data-corners="crisp"] .chip, :root[data-corners="crisp"] .pill-check span { border-radius: 4px; }

/* Font */
:root[data-font="rounded"] { --font: ui-rounded, "SF Pro Rounded", "Nunito", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif; --font-display: ui-rounded, "SF Pro Rounded", "Nunito", "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif; }
:root[data-font="serif"] { --font: ui-serif, "New York", "Iowan Old Style", Georgia, "Times New Roman", serif; --font-display: ui-serif, "New York", "Iowan Old Style", Georgia, serif; }
:root[data-font] body, :root[data-font] button, :root[data-font] input, :root[data-font] select, :root[data-font] textarea { font-family: var(--font); }

/* Appearance dialog */
.look-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 22px; }
.look-grid section.wide { grid-column: 1 / -1; }
.look-grid h4 { margin: 0 0 9px; font-size: 13px; font-weight: 650; color: var(--text-2); }
.look-grid .hint { margin: 8px 0 0; font-size: 12px; color: var(--muted); }
.look-grid .segmented { display: flex; width: fit-content; max-width: 100%; flex-wrap: wrap; }
.look-grid .segmented button { display: inline-flex; align-items: center; gap: 6px; }
.font-system { font-family: -apple-system, "Segoe UI", system-ui, sans-serif !important; }
.font-rounded { font-family: ui-rounded, "SF Pro Rounded", "Nunito", "Segoe UI", sans-serif !important; }
.font-serif { font-family: ui-serif, "New York", Georgia, serif !important; }
.look-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.look-tile { display: grid; gap: 7px; padding: 8px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--surface); cursor: pointer; font-weight: 550; font-size: 12.5px; color: var(--text-2); text-align: center; }
.look-tile[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; color: var(--text); }
.look-preview { position: relative; display: block; height: 58px; border-radius: 9px; overflow: hidden; border: 1px solid var(--line); background: var(--bg); }
.look-preview i { position: absolute; left: 0; top: 0; bottom: 0; width: 28%; background: var(--surface); border-right: 1px solid var(--line); }
.look-preview b { position: absolute; left: 36%; right: 8%; top: 22%; height: 34%; border-radius: 5px; background: var(--surface); box-shadow: var(--shadow-1); }
.background-soft { background: radial-gradient(120px 60px at 85% -10px, color-mix(in srgb, var(--accent) 24%, transparent), transparent 70%), var(--bg); }
.background-aurora { background: radial-gradient(90px 60px at 95% 0, color-mix(in srgb, var(--accent) 40%, transparent), transparent 70%), radial-gradient(80px 60px at 10% 10%, rgba(142,78,198,.28), transparent 70%), radial-gradient(100px 60px at 50% 120%, rgba(18,165,148,.25), transparent 70%), var(--bg); }
.background-tinted { background: color-mix(in srgb, var(--accent) 12%, var(--bg)); }
.background-plain { background: var(--bg); }
.sidebar-glass i { background: color-mix(in srgb, var(--surface) 75%, transparent); }
.sidebar-tinted i { background: color-mix(in srgb, var(--accent) 16%, var(--surface)); }
.sidebar-dark i { background: #16171b; border-right-color: #23252b; }
.custom-swatch { position: relative; width: 34px; height: 34px; border-radius: 50%; background: var(--sw); display: grid; place-items: center; color: #fff; cursor: pointer; box-shadow: 0 0 0 1px var(--line-2) inset; }
.custom-swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
.custom-swatch input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; border: 0; padding: 0; }
.custom-swatch .icon { filter: drop-shadow(0 1px 1px rgba(0,0,0,.4)); pointer-events: none; }
@media (max-width: 640px) { .look-grid { grid-template-columns: minmax(0, 1fr); } }

/* ===== Notifications ===== */
.notify-bell { position: relative; }
.notify-count { position: absolute; top: 2px; right: 0; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--bad, #d93d3d); color: #fff; font-size: 10.5px; font-weight: 750; line-height: 17px; text-align: center; box-shadow: 0 0 0 2px var(--surface); }
.notify-list { display: grid; gap: 6px; max-height: 60vh; overflow: auto; }
.notify-item { display: flex; gap: 12px; align-items: flex-start; text-align: left; width: 100%; padding: 11px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; color: var(--text); font: inherit; }
.notify-item:hover { border-color: var(--line-2); background: var(--surface-2, var(--surface)); }
.notify-item.unread { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
.notify-item.unread b::after { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-left: 7px; vertical-align: middle; }
.notify-ic { flex: none; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
.notify-text { display: grid; gap: 2px; min-width: 0; }
.notify-text span { color: var(--text-2); font-size: 13px; }
.notify-text small { color: var(--muted); font-size: 12px; }
.notify-row { align-items: flex-start; }
.notify-row .track { margin-top: 2px; }

/* JP logo: white lettering in dark mode (blue stays blue). */
:root[data-mode="dark"] img[src="/jones-petro-logo.png"] { content: url(/jones-petro-logo-dark.png); }
@media (prefers-color-scheme: dark) { :root:not([data-mode="light"]) img[src="/jones-petro-logo.png"] { content: url(/jones-petro-logo-dark.png); } }
.brand img, .boot img, .auth-card > img { object-fit: contain !important; border-radius: 0 !important; box-shadow: none !important; background: transparent !important; }

/* Reports ------------------------------------------------------------------ */
.report-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.report-card { display: flex; gap: 12px; align-items: flex-start; padding: 13px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--text); text-decoration: none; transition: border-color .12s, background .12s; min-width: 0; }
.report-card:hover { border-color: var(--accent); background: var(--hover); }
.report-ic { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); }
.report-text { display: grid; gap: 3px; min-width: 0; }
.report-text b { font-weight: 650; font-size: 14px; }
.report-text small { color: var(--text-2); font-size: 12.5px; line-height: 1.35; }
.report-meta { color: var(--muted); font-size: 11.5px; }
.source-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px 16px; }
.source-option { display: grid; gap: 2px; width: 100%; text-align: left; padding: 10px 12px; margin-bottom: 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); cursor: pointer; font: inherit; }
.source-option:hover { border-color: var(--accent); background: var(--hover); }
.source-option small { color: var(--muted); font-size: 12px; }
.report-layout { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 16px; align-items: start; }
.report-layout.collapsed { grid-template-columns: minmax(0, 1fr); }
.report-layout.collapsed .report-builder { display: none; }
.report-builder { position: sticky; top: 12px; max-height: calc(100vh - 110px); overflow: auto; padding: 4px 0; }
.rb-section { padding: 14px 16px; border-bottom: 1px solid var(--line); display: grid; gap: 10px; }
.rb-section:last-child { border-bottom: 0; }
.rb-section h4 { margin: 0; display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 650; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; }
.rb-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rb-filter { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) auto; gap: 6px; align-items: center; }
.rb-filter > :nth-child(3):not(button) { grid-column: 1 / 3; }
.rb-filter > div.row, .rb-filter > input { min-width: 0; }
.rb-measures { display: grid; gap: 6px; }
.rb-columns { display: grid; gap: 4px; }
.rb-col { display: flex; align-items: center; gap: 4px; padding: 3px 4px 3px 10px; border-radius: 8px; background: var(--surface-2); font-size: 13px; }
.rb-col span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.report-results { display: grid; gap: 16px; min-width: 0; transition: opacity .15s; }
.report-results.loading { opacity: .55; }
.report-context { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.report-context .chip .icon { width: 12px; height: 12px; }
.report-tiles { margin-bottom: 0; }
.report-table td { cursor: default; }
.report-table tbody tr[data-open] td { cursor: pointer; }
.report-table tbody tr.static:hover td { background: none; }
.report-table tr.lvl-0 td { font-weight: 600; }
.report-table tr.lvl-1 td b { font-weight: 500; color: var(--text-2); }
.report-table th button { white-space: nowrap; }
.report-scroll { max-height: 70vh; overflow: auto; }
.report-bars .hbar { grid-template-columns: minmax(110px, 32%) minmax(0, 1fr) auto; }
.report-viz .hit { fill: transparent; cursor: crosshair; }
.print-only { display: none; }
.report-print-head { align-items: center; gap: 12px; margin-bottom: 8px; }
.report-print-head img { width: 44px; height: 44px; object-fit: contain; }
.report-print-head b { display: block; font-size: 18px; }
.report-print-head small { color: #555; }
@media (max-width: 1000px) { .report-layout { grid-template-columns: minmax(0, 1fr); } .report-builder { position: static; max-height: none; } }

/* Audit trail -------------------------------------------------------------- */
.audit-filters { display: grid; grid-template-columns: minmax(220px, 2fr) repeat(6, minmax(110px, 1fr)) auto; gap: 10px; padding: 14px 16px; margin-bottom: 16px; align-items: end; }
.audit-filters .search-field { align-self: end; }
@media (max-width: 1200px) { .audit-filters { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); } .audit-filters .search-field { grid-column: 1 / -1; } }
.audit-table td { white-space: nowrap; }
.audit-table tr.selected td { background: var(--accent-soft); }
.audit-detail td { white-space: normal !important; background: var(--surface-2); cursor: default; max-width: none !important; }
.audit-detail-box { padding: 6px 4px; }
.audit-detail .mini-table td { white-space: normal; word-break: break-word; vertical-align: top; }
.audit-before { color: var(--bad); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.audit-after { color: var(--ok); }
.audit-kv { grid-template-columns: minmax(120px, auto) 1fr; max-width: 760px; }
.audit-kv dd { text-align: left; word-break: break-word; }

@media print {
  .print-only { display: flex !important; }
  .report-layout { display: block; }
  .report-builder, .page-head .row, .page-head .eyebrow, .viz-table, .report-context .spacer { display: none !important; }
  .report-scroll { max-height: none; overflow: visible; }
  .report-table td { white-space: normal; max-width: none; }
  .report-table th { position: static; }
  .page-head h1 { font-size: 20px; }
  .tile { box-shadow: none; }
}
.report-table th:not(:has(button)) { padding: 9px 12px; white-space: nowrap; }
.report-table th.num { text-align: right; }
.audit-table { table-layout: fixed; min-width: 1000px; }
.audit-table th { padding: 9px 12px; }
.audit-table th:nth-child(1) { width: 158px; } .audit-table th:nth-child(2) { width: 18%; } .audit-table th:nth-child(3) { width: 24%; }
.audit-table th:nth-child(4) { width: 168px; } .audit-table th:nth-child(5) { width: 12%; } .audit-table th:nth-child(7) { width: 150px; }
.audit-table td { overflow: hidden; text-overflow: ellipsis; }
.audit-table th:nth-child(2) { width: 15%; } .audit-table th:nth-child(3) { width: 20%; } .audit-table th:nth-child(5) { width: 11%; } .audit-table th:nth-child(6) { width: 17%; }
.audit-table th:nth-child(4) { width: 150px; } .audit-table th:nth-child(7) { width: 140px; }
.chip.super { background: linear-gradient(135deg, #f6e7b0, #e8c96a); color: #5b4300; }
.chip.super .icon { width: 13px; height: 13px; }
:root[data-mode="dark"] .chip.super { background: linear-gradient(135deg, #5b4a14, #7a611a); color: #ffe9a6; }

/* Reports v2: tabs, insights, library ------------------------------------- */
.tabs-line { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: -6px 0 18px; overflow-x: auto; }
.tabs-line a { display: inline-flex; align-items: center; gap: 7px; padding: 10px 14px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs-line a:hover { color: var(--text); }
.tabs-line a[aria-selected="true"] { color: var(--accent-text); border-bottom-color: var(--accent); }
.tabs-line a b { font-size: 11px; background: var(--surface-3); color: var(--text-2); border-radius: 9px; padding: 1px 7px; }
.kpi-tiles { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.tile.kpi { text-decoration: none; color: inherit; }
a.tile.kpi:hover { border-color: var(--accent); }
.tile.kpi strong { font-size: 28px; }
.tile.kpi small span { color: var(--muted); }
.delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; font-size: 12px; padding: 1px 7px; border-radius: 9px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.delta.better { color: var(--ok); background: var(--ok-soft); }
.delta.worse { color: var(--bad); background: var(--bad-soft); }
.delta.flat { color: var(--text-2); background: var(--surface-3); }
.insight-alerts { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; margin-bottom: 16px; }
.insight-alerts a.notice { text-decoration: none; color: var(--text); }
.insight-alerts a.notice:hover { filter: brightness(.98); outline: 1px solid var(--line-2); }
.insight-grid { align-items: start; }
.insight-grid .insight.wide { grid-column: 1 / -1; }
.insight .card-body { padding-top: 12px; }
@media (max-width: 900px) { .insight-grid { grid-template-columns: minmax(0, 1fr); } }
.library-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 16px; align-items: start; }
.library-nav { padding: 8px; display: grid; gap: 2px; position: sticky; top: 12px; }
.library-nav button { display: flex; align-items: center; gap: 9px; padding: 9px 10px; border: 0; border-radius: 9px; background: none; color: var(--text-2); font: inherit; font-weight: 550; cursor: pointer; text-align: left; }
.library-nav button span { flex: 1; }
.library-nav button b { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.library-nav button:hover { background: var(--hover); color: var(--text); }
.library-nav button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-text); }
@media (max-width: 800px) { .library-layout { grid-template-columns: minmax(0, 1fr); } .library-nav { position: static; grid-auto-flow: column; overflow-x: auto; } }
.report-list { display: grid; }
.report-row { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(140px, 220px) auto; align-items: center; gap: 14px; padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none; }
.report-row:has(.report-meta + .report-meta) { grid-template-columns: auto minmax(0, 1fr) minmax(140px, 200px) minmax(120px, 170px) auto; }
.report-row:last-child { border-bottom: 0; }
.report-row:hover { background: var(--hover); }
.report-row > .icon:last-child { color: var(--faint); }
.report-row .report-meta { font-size: 12px; line-height: 1.45; }
@media (max-width: 700px) { .report-row, .report-row:has(.report-meta + .report-meta) { grid-template-columns: auto minmax(0, 1fr) auto; } .report-row .report-meta { display: none; } }
.rb-label { font-size: 12.5px; font-weight: 550; color: var(--text-2); }
.check.disabled { opacity: .55; cursor: not-allowed; }
.icon.rot90 { transform: rotate(90deg); }
.report-table td.prev { color: var(--muted); }
.pct-bar { display: inline-block; width: 52px; height: 6px; border-radius: 3px; background: var(--surface-3); margin-right: 8px; vertical-align: middle; overflow: hidden; }
.pct-bar i { display: block; height: 100%; background: var(--series-1); border-radius: 3px; }
.report-table.pivot td.heat { background: color-mix(in srgb, var(--series-1) calc(var(--heat) * 100%), transparent); }
.hbar .track em { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: var(--text); border-radius: 1px; opacity: .55; }
.legend i.tick { width: 2px; height: 12px; border-radius: 1px; background: var(--text); opacity: .55; }
@media print {
  .tabs-line, .insight-alerts { display: none !important; }
  .kpi-tiles { grid-template-columns: repeat(4, 1fr); }
  .insight-grid { display: block; }
  .insight { break-inside: avoid; margin-bottom: 12px; }
  .viz-table { display: none; }
}
.report-results { grid-template-columns: minmax(0, 1fr); }


/* ---- Feature requests FR-1 … FR-9 and the Administrator panel ---------------------------------- */
/* FR-4: floating picker list (attached to <body>, never clipped by tables or cards). */
.combo-list.floating { position: fixed; z-index: 1000; box-sizing: border-box; overscroll-behavior: contain; }
.combo-list button.with-thumb { grid-template-columns: 34px minmax(0, 1fr) auto; }
.combo-list button.with-thumb small { grid-column: 2; }
.combo-list button.with-thumb .id { grid-column: 3; }
.combo-list .opt-thumb { grid-row: 1 / span 2; width: 34px; height: 34px; border-radius: 8px; object-fit: cover; background: var(--surface-3); }
.line-items .prt-cell { width: 128px; min-width: 112px; }
.line-items .prt-cell input, .prt-field input { font-size: 13px; letter-spacing: .01em; }
.prt-msg { display: block; min-height: 0; color: var(--bad); font-size: 11.5px; margin-top: 2px; }
.prt-msg:empty { display: none; }
.input.bad { border-color: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.lv-cell { min-width: 170px; max-width: 240px; }
.lv { display: grid; gap: 1px; justify-items: start; font-size: 13px; }
.lv small { font-size: 11.5px; }
.lv .btn { margin-top: 3px; }

/* Administrator panel */
.settings-nav .dot.on { background: var(--ok); }
.admin-settings { display: grid; gap: 0; }
.admin-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 8px 22px; padding: 13px 0; border-bottom: 1px solid var(--line); align-items: start; }
.admin-row:last-child { border-bottom: 0; }
.admin-label { display: grid; gap: 3px; }
.admin-label small { font-size: 12.5px; line-height: 1.4; }
.admin-control { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.admin-control > .input, .admin-control > select, .admin-control > textarea { flex: 1 1 220px; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px 14px; flex: 1 1 100%; }
.warn-text { color: var(--warn); }

/* FR-6 part image + FR-7 last vendor on the item page */
.part-top { display: grid; gap: 16px; }
.part-top.with-side { grid-template-columns: 240px minmax(0, 1fr); align-items: start; }
.part-side .card-body { display: grid; gap: 12px; }
.part-image { display: grid; gap: 8px; justify-items: center; border-radius: var(--r); padding: 4px; transition: background .15s; }
.part-image.drag { background: var(--accent-soft); outline: 2px dashed var(--accent); }
.part-thumb { width: 100%; aspect-ratio: 1; border-radius: var(--r); overflow: hidden; border: 1px solid var(--line); background: var(--surface-3); padding: 0; cursor: zoom-in; display: grid; place-items: center; }
.part-thumb img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.part-thumb.empty { cursor: default; color: var(--faint); gap: 4px; align-content: center; }
.part-thumb.empty small { font-size: 12px; }
.drop-hint { font-size: 11.5px; }
.part-lv { border-top: 1px solid var(--line); padding-top: 10px; }
.lightbox.zoomable { overflow: auto; }
.lightbox.zoomable img { cursor: zoom-in; transition: transform .2s; touch-action: pinch-zoom; }
.lightbox.zoomable img.zoomed { max-width: none; max-height: none; width: auto; cursor: zoom-out; }
.lightbox-close { position: fixed; top: 14px; right: 14px; background: rgba(255,255,255,.92); color: #111; z-index: 2; }
.image-history { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.image-history figure { margin: 0; display: grid; gap: 6px; font-size: 12px; }
.image-history img { width: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 10px; border: 1px solid var(--line); background: #fff; }

/* FR-8 labels */
.label-pick { display: grid; gap: 10px; max-height: 52vh; overflow: auto; }
.label-row { display: flex; gap: 14px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: var(--r); }
.label-name { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.label-preview { flex: none; width: 58px; height: 124px; overflow: hidden; border-radius: 4px; border: 1px solid var(--line-2); background: #fff; color: #000; }
.label-preview .label { width: 29mm; height: 62mm; transform: scale(.53); transform-origin: top left; display: flex; flex-direction: column; align-items: center; padding: 2.5mm; font-family: Arial, Helvetica, sans-serif; box-sizing: border-box; }
.label-preview .qr { width: 24mm; height: 24mm; } .label-preview .qr svg { width: 24mm; height: 24mm; display: block; }
.label-preview .code { margin-top: 1.2mm; font-size: 9pt; font-weight: 700; }
.label-preview .name { margin-top: .8mm; font-size: 7.2pt; line-height: 1.18; text-align: center; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.label-preview .sub { font-size: 6.2pt; }
.resolve-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.resolve-grid .card { box-shadow: none; border: 1px solid var(--line); }

/* FR-1 time clock */
.time-clock .tc-icon { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); flex: none; }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r); background: var(--surface-3); }
.checklist li span { display: grid; gap: 2px; }
.checklist li.done { background: var(--ok-soft); color: var(--ok); }
.checklist li.done b { color: var(--text); }
.radio-list { display: grid; gap: 6px; max-height: 50vh; overflow: auto; }

/* FR-2 / FR-3 report tabs */
.filter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px 14px; }
.mini-table.clickable tbody tr { cursor: pointer; }
.mini-table.clickable tbody tr:hover td { background: var(--hover); }
.mini-table tr.tone-warn td { background: var(--warn-soft); }

@media (max-width: 860px) {
  .admin-row { grid-template-columns: minmax(0, 1fr); }
  .part-top.with-side { grid-template-columns: minmax(0, 1fr); }
  .part-side .part-thumb { max-width: 220px; }
  .resolve-grid { grid-template-columns: minmax(0, 1fr); }
  .label-row { flex-wrap: wrap; }
}
@media print {
  .no-print { display: none !important; }
}

/* FR-8 "Scan item" dialog on the web work order */
.scan-dialog .scan-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.scan-dialog .scan-buttons:empty { display: none; }
.scan-dialog .scan-video { position: relative; border-radius: 16px; overflow: hidden; background: #000; aspect-ratio: 4 / 3; max-height: 52vh; }
.scan-dialog .scan-video video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-dialog .scan-frame { position: absolute; inset: 16% 18%; border: 3px solid rgba(255, 255, 255, .9); border-radius: 16px; pointer-events: none; }
.scan-dialog .scan-msg.bad { background: var(--warn-soft); }
.scan-dialog .scan-card { border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.scan-dialog .scan-card .scan-name { font-size: 18px; font-weight: 800; color: var(--text); margin-top: 2px; }

/* Work order: "Work performed" card, and the conversation placed right after it whenever the page is a single column
   (laptops, tablets, phones, split view) instead of last. On wide screens the conversation stays in the right rail. */
.wp-card .card-head h3 { display: flex; align-items: center; gap: 8px; }
.wp-form { display: grid; gap: 12px; }
.wp-form textarea { min-height: 84px; resize: vertical; font-size: 14.5px; }
.wp-row { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, .6fr) minmax(0, .9fr) auto; gap: 12px; align-items: end; }
.wp-row .actions { display: flex; }
.wp-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.wp-list li { padding: 10px 0; border-top: 1px solid var(--line); }
.wp-list li:first-child { border-top: 0; }
.wp-form + .wp-list li:first-child { border-top: 1px solid var(--line); }
.wp-list p { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); }
.wp-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12.5px; color: var(--text-2); }
.wp-meta b { color: var(--text); font-weight: 650; }
.wp-more summary { cursor: pointer; color: var(--accent-text, var(--accent)); font-size: 13px; font-weight: 600; padding: 4px 0; }
.record-top { gap: 16px; }
@media (max-width: 760px) { .wp-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .wp-row .field:first-child, .wp-row .actions { grid-column: 1 / -1; } .wp-row .actions .btn { width: 100%; justify-content: center; } }
@media (max-width: 1280px) {
  .record-body.lift > .record-main { display: contents; }
  .record-body.lift > .record-main > * { order: 3; }
  .record-body.lift > .record-main > .record-top { order: 1; }
  .record-body.lift > .rail { order: 2; }
  .record-body.lift-after_work > .rail { order: 4; }
  .record-body.lift-after_work > .record-main > #sec-work-performed ~ * { order: 5; }
  .record-body.lift-after_general > .rail { order: 4; }
  .record-body.lift-after_general > .record-main > #sec-general ~ * { order: 5; }
}
@container (max-width: 1040px) {
  .record-body.lift > .record-main { display: contents; }
  .record-body.lift > .record-main > * { order: 3; }
  .record-body.lift > .record-main > .record-top { order: 1; }
  .record-body.lift > .rail { order: 2; }
  .record-body.lift-after_work > .rail { order: 4; }
  .record-body.lift-after_work > .record-main > #sec-work-performed ~ * { order: 5; }
  .record-body.lift-after_general > .rail { order: 4; }
  .record-body.lift-after_general > .record-main > #sec-general ~ * { order: 5; }
}
:root[data-density="compact"] .record-body.lift, :root[data-density="compact"] .record-top { gap: 10px; }

/* Administrator panel: find, overview, attention list, save bar; mileage review. */
.settings-nav .admin-find { margin: 2px 0 6px; }
.settings-nav .admin-find .input { height: 34px; }
.settings-nav .count.warn { margin-left: auto; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 10px; display: grid; place-items: center; font-size: 11.5px; font-weight: 700; background: var(--warn-soft); color: var(--warn); }
.attention { list-style: none; margin: 0; padding: 0; display: grid; }
.attention li { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.attention li:first-child { border-top: 0; padding-top: 0; }
.attention li > .icon { color: var(--warn); }
.attention li div { display: grid; gap: 1px; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.feature-tile { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 12px; color: var(--text); text-decoration: none !important; }
.feature-tile:hover { background: var(--hover); }
.feature-tile div { display: grid; gap: 1px; min-width: 0; }
.find-results { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.find-results a { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 10px; color: var(--text); text-decoration: none !important; }
.find-results a:hover { background: var(--hover); }
.find-results span { display: grid; gap: 1px; min-width: 0; }
.admin-savebar { position: sticky; bottom: 0; margin: 14px -18px -18px; padding: 12px 18px; background: var(--surface); border-top: 1px solid var(--line); border-radius: 0 0 16px 16px; z-index: 3; gap: 12px; }
.admin-row.flash { animation: admin-flash 2.4s ease-out; border-radius: 10px; }
@keyframes admin-flash { 0%, 40% { background: var(--accent-soft); } 100% { background: transparent; } }
.mileage-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.mileage-filters .segmented { flex-wrap: wrap; }
.mileage-filters .search-field { flex: 1; min-width: 200px; }
.mileage-table td { vertical-align: top; }

:root[data-density="compact"] .admin-savebar { margin: 10px -14px -14px; padding: 10px 14px; }
.mileage-table td.addr { min-width: 260px; }
@media (max-width: 860px) { .settings-nav { flex-wrap: wrap; overflow-x: visible; } .settings-nav .admin-find { flex: 1 0 100%; } .settings-nav a { flex: 0 0 auto; } }

/* Audit trail quick filters */
.audit-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.audit-presets .chip { text-decoration: none !important; cursor: pointer; }

/* Store portal (module app) */
.portal-body { background: var(--bg); }
.portal-shell { min-height: 100vh; }
.portal-top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 10px max(16px, calc((100vw - 1100px) / 2)); background: var(--glass, var(--surface)); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.portal-brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none !important; }
.portal-brand span { display: grid; line-height: 1.15; } .portal-brand small { color: var(--muted); font-size: 11.5px; }
.portal-bell { position: relative; }
.portal-bell .badge-dot { position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #d93d3d; color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
.portal-user { display: flex; align-items: center; gap: 8px; border: 0; background: none; color: var(--text); cursor: pointer; padding: 4px 6px; border-radius: 10px; font: inherit; }
.portal-user:hover { background: var(--hover); }
.portal-user .who { display: grid; text-align: left; line-height: 1.15; } .portal-user small { color: var(--muted); font-size: 11.5px; }
.portal-main { max-width: 1100px; margin: 0 auto; padding: 20px 16px 48px; display: grid; gap: 16px; }
.portal-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.portal-filters .search-field { flex: 1; min-width: 200px; } .portal-filters select { max-width: 240px; }
.portal-list { list-style: none; margin: 0; padding: 0; }
.portal-list a { display: grid; grid-template-columns: minmax(0, 1fr) auto 16px; gap: 12px; align-items: center; padding: 14px 18px; border-top: 1px solid var(--line); color: var(--text); text-decoration: none !important; }
.portal-list li:first-child a { border-top: 0; } .portal-list a:hover { background: var(--hover); }
.pl-main { display: grid; gap: 2px; min-width: 0; } .pl-title { font-weight: 650; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pl-new { font-size: 11.5px; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: #fde8e8; color: #b42318; }
.pl-chips { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.portal-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.portal-timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.portal-timeline li { display: grid; gap: 1px; padding-left: 16px; border-left: 2px solid var(--line-2, var(--line)); }
.portal-media { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.portal-media img, .portal-media video { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; background: var(--surface-2); }
#portal-thread .messages { max-height: 420px; overflow: auto; display: grid; gap: 10px; }
#portal-thread .msg { max-width: 85%; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
#portal-thread .msg.mine { justify-self: end; background: var(--accent-soft); }
#portal-thread .msg-meta { font-size: 12px; color: var(--muted); margin-bottom: 3px; } #portal-thread .msg-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.portal-notify .find-results a.unread b { font-weight: 800; } .dot-new { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #d93d3d; margin-left: 4px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 760px) { .portal-grid, .grid-3 { grid-template-columns: minmax(0, 1fr); } .portal-user .who { display: none; } .portal-list a { grid-template-columns: minmax(0, 1fr) 16px; } .pl-chips { grid-column: 1; justify-content: flex-start; } .portal-list a > .icon { grid-row: 1; grid-column: 2; } }
.portal-main > a.btn { justify-self: start; } #portal-thread .messages { min-height: 0; height: auto; display: grid; align-content: start; }

/* Workspace switch (Maintenance ⇄ JP Propane), shown only to logins with both workspaces. */
.ws-switch { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 15px; font-size: 12.5px; font-weight: 650;
  background: var(--accent-soft); color: var(--accent-text); text-decoration: none; white-space: nowrap; flex: none; }
.ws-switch .icon { width: 15px; height: 15px; }
.ws-switch:hover { filter: brightness(.97); }
/* FR-10 … FR-19 ------------------------------------------------------------------------------------- */
.media-grid figure.pdf-tile { cursor: default; display: flex; flex-direction: column; background: var(--surface-2, var(--surface-3)); }
.pdf-icon { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--bad, #c0392b); text-decoration: none; min-height: 72px; }
.pdf-icon b { font-size: 12px; letter-spacing: .08em; }
.media-grid figure.pdf-tile figcaption { position: static; background: none; color: var(--text); padding: 6px 8px; font-size: 11.5px; line-height: 1.35; word-break: break-word; }
.pdf-actions { display: block; color: var(--muted); }
.pdf-actions a, .linkish { color: var(--accent-text, var(--accent)); }
.linkish { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; text-decoration: underline; }
.bad-text { color: var(--bad); } .warn-text { color: var(--warn); }
ul.plain { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 14px; }
.stats-row .stat { text-decoration: none; color: inherit; }
.stats-row .stat .card-body { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; }
.stats-row .stat b { font-size: 26px; font-variant-numeric: tabular-nums; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 14px; margin-top: 14px; }
.kpi-grid .kpi.na { opacity: .78; }
.kpi-grid .kv dd { text-align: left; }
.receipt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 12px; }
.receipt-card { display: grid; grid-template-columns: 88px 1fr; gap: 12px; padding: 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.receipt-thumb { border: 0; padding: 0; border-radius: 10px; overflow: hidden; background: var(--surface-3); height: 110px; cursor: zoom-in; display: flex; }
.receipt-thumb img { width: 100%; height: 100%; object-fit: cover; }
.lightbox.scroll { display: block; overflow: auto; text-align: center; }
.lightbox.scroll img { display: block; margin: 0 auto 16px; max-height: none; max-width: min(100%, 900px); }
.filters-bar .field.inline { display: flex; align-items: center; gap: 6px; margin: 0; }
.filters-bar .field.inline span { font-size: 12.5px; color: var(--muted); }
.list-setting { display: grid; gap: 8px; width: 100%; }
.list-setting .mini-table input.input, .list-setting .mini-table select.input { min-width: 0; padding: 6px 8px; }
@media (max-width: 640px) {
  .filters-bar { flex-direction: column; align-items: stretch !important; }
  .filters-bar select.input { max-width: none !important; }
  .receipt-card { grid-template-columns: 72px 1fr; }
}
