:root {
  --app-bg: #f5f5f5;
  --nav-bg: #efefef;
  --nav-hover: #e6e6e6;
  --nav-selected: #fafafa;
  --surface: #ffffff;
  --text: #242424;
  --text-2: #616161;
  --text-3: #8a8a8a;
  --stroke: #e0e0e0;
  --stroke-strong: #c7c7c7;
  --link: #115ea3;
  --brand: #0f6cbd;
  --brand-hover: #115ea3;
  --on-brand: #ffffff;
  --row-hover: #f5f5f5;
  --row-selected: #ebf3fc;
  --danger: #c50f1f;
  --danger-bg: #fdf3f4;
  --success: #0e700e;
  --success-bg: #f1faf1;
  --header-bg: #1f1f1f;
  --header-text: #ffffff;
  --shadow: 0 0 2px rgba(0, 0, 0, .12), 0 2px 4px rgba(0, 0, 0, .14);
  --shadow-pop: 0 0 2px rgba(0, 0, 0, .12), 0 8px 16px rgba(0, 0, 0, .14);
  --focus: #000000;
  --scrim: rgba(0, 0, 0, .3);
  --tip-stroke: transparent; /* Fluent's transparent stroke: the shadow defines the edge in light mode */
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --app-bg: #141414;
    --nav-bg: #1b1b1b;
    --nav-hover: #262626;
    --nav-selected: #2e2e2e;
    --surface: #242424;
    --text: #f0f0f0;
    --text-2: #c4c4c4;
    --text-3: #9a9a9a;
    --stroke: #3a3a3a;
    --stroke-strong: #555555;
    --link: #62abf5;
    --brand: #479ef5;
    --brand-hover: #62abf5;
    --on-brand: #0b1a2b;
    --row-hover: #2c2c2c;
    --row-selected: #1d3350;
    --danger: #f1707b;
    --danger-bg: #3b1a1d;
    --success: #7fd47f;
    --success-bg: #173017;
    --header-bg: #0a0a0a;
    --header-text: #f0f0f0;
    --shadow: 0 0 2px rgba(0, 0, 0, .5), 0 2px 4px rgba(0, 0, 0, .5);
    --shadow-pop: 0 0 2px rgba(0, 0, 0, .5), 0 8px 16px rgba(0, 0, 0, .6);
    --focus: #ffffff;
    --scrim: rgba(0, 0, 0, .55);
    --tip-stroke: #3d3d3d; /* shadows barely show on dark surfaces, so outline the tooltip */
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--app-bg); color: var(--text);
  font: 14px/20px "Segoe UI", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--link); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; border-radius: 2px; }
.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5;
  stroke-linecap: round; stroke-linejoin: round; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
.grow { flex: 1; }
.app-header .header-menu { display: none; color: var(--header-text); }
.app-header .header-menu.cmd:hover:not(:disabled) { background: rgba(255, 255, 255, .12); }

/* App frame */
.app { display: grid; grid-template-rows: 48px minmax(0, 1fr); grid-template-columns: minmax(0, 1fr); height: 100vh; height: 100dvh; }
.app-header {
  display: flex; align-items: center; gap: 12px; padding: 0 8px 0 16px;
  background: var(--header-bg); color: var(--header-text);
}
.app-header .app-name { font-weight: 600; font-size: 16px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-header .spacer { flex: 1; }
.avatar-button {
  width: 32px; height: 32px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--brand); color: var(--on-brand); font-size: 12px; font-weight: 600;
}
.body { display: flex; min-height: 0; }

/* Site map */
.sitemap {
  width: 272px; flex: none; display: flex; flex-direction: column; min-height: 0;
  background: var(--nav-bg); border-right: 1px solid var(--stroke);
}
.app[data-nav="collapsed"] .sitemap { width: 48px; }
.app[data-nav="collapsed"] .sitemap .label,
.app[data-nav="collapsed"] .sitemap .group-title,
.app[data-nav="collapsed"] .sitemap .sub-list,
.app[data-nav="collapsed"] .sitemap .expander,
.app[data-nav="collapsed"] .sitemap .pin-toggle { display: none; }
.app[data-focused="true"] .sitemap { display: none; }
.sitemap-scroll { flex: 1; overflow-y: auto; padding: 4px 0; }
.nav-item {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 40px; padding: 0 12px 0 14px;
  border: 0; background: none; color: var(--text); text-decoration: none; text-align: left; cursor: pointer;
  position: relative;
}
.nav-item:hover { background: var(--nav-hover); }
.nav-item[aria-current="page"] { background: var(--nav-selected); font-weight: 600; }
.nav-item[aria-current="page"]::before {
  content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 2px; background: var(--brand);
}
.nav-item .label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item .expander { transition: transform .15s; }
.nav-item[aria-expanded="true"] .expander { transform: rotate(180deg); }
.nav-row { position: relative; }
.nav-row .nav-item { padding-right: 40px; }
.nav-row .pin-toggle {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  opacity: 0; border: 0; background: none; padding: 4px; border-radius: 4px; cursor: pointer; color: var(--text-2);
  display: flex;
}
.nav-row:hover .pin-toggle, .pin-toggle:focus-visible, .pin-toggle[aria-pressed="true"] { opacity: 1; }
.pin-toggle .icon { width: 16px; height: 16px; }
.pin-toggle[aria-pressed="true"] .icon { fill: currentColor; }
.sub-list { padding: 0 0 4px; }
.sub-list .nav-item { min-height: 32px; padding-left: 46px; font-size: 13px; }
.sub-list .empty { padding: 4px 16px 8px 46px; color: var(--text-3); font-size: 13px; }
.group-title { padding: 16px 16px 6px; font-weight: 600; font-size: 14px; }
.area-switcher { position: relative; border-top: 1px solid var(--stroke); }
.area-switcher > .nav-item { min-height: 52px; }
.area-badge {
  width: 28px; height: 28px; flex: none; display: grid; place-items: center; border-radius: 4px;
  background: var(--brand); color: var(--on-brand); font-size: 11px; font-weight: 600;
}

/* Main column */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; padding: 8px 8px 8px 8px; }
.card { background: var(--surface); border-radius: 8px; box-shadow: var(--shadow); }

.commandbar { display: flex; align-items: center; gap: 2px; padding: 4px; min-height: 44px; flex-wrap: nowrap; overflow: hidden; }
.commandbar .sep { width: 1px; height: 20px; background: var(--stroke); margin: 0 4px; flex: none; }
.commandbar .grow { flex: 1; }
.cmd {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 8px; flex: none;
  border: 1px solid transparent; border-radius: 4px; background: none; color: var(--text); cursor: pointer; white-space: nowrap;
}
a.cmd { text-decoration: none; }
.cmd:hover:not(:disabled) { background: var(--row-hover); }
.cmd:disabled { color: var(--text-3); cursor: default; }
.cmd.icon-only { padding: 0 6px; }
.cmd.outline { border-color: var(--stroke-strong); }
.cmd .icon.brand { color: var(--brand); }
.cmd:disabled .icon { color: var(--text-3); }

.content { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 12px 20px 8px; }
.content-scroll { flex: 1; min-height: 0; overflow: auto; }

/* List header */
.list-header { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 4px 0 12px; }
.view-selector {
  display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; cursor: pointer;
  font-size: 20px; line-height: 28px; font-weight: 600; padding: 2px 4px; border-radius: 4px;
}
.view-selector:hover { background: var(--row-hover); }
.view-selector .icon { width: 16px; height: 16px; color: var(--text-2); }
.list-header .grow { flex: 1; }
.search-box {
  display: flex; align-items: center; gap: 6px; width: 240px; height: 32px; padding: 0 10px;
  border: 1px solid var(--stroke-strong); border-bottom-color: var(--text-2); border-radius: 4px; background: var(--surface);
}
.search-box:focus-within { border-bottom: 2px solid var(--brand); }
.search-box input { border: 0; outline: 0; background: none; width: 100%; }
.search-box .icon { width: 16px; height: 16px; color: var(--text-2); }
.filter-summary { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 0 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 10px; border-radius: 12px;
  background: var(--row-selected); font-size: 12px;
}
.chip button { border: 0; background: none; cursor: pointer; padding: 2px; border-radius: 50%; display: flex; }
.chip .icon { width: 12px; height: 12px; }

/* Grid */
.grid-wrap { flex: 1; min-height: 0; overflow: auto; border-bottom: 1px solid var(--stroke); }
/* Fixed layout: columns keep their set widths; the last (filler) column takes any spare space. */
table.grid { border-collapse: separate; border-spacing: 0; width: 100%; table-layout: fixed; }
.grid th.filler, .grid td.filler { padding: 0; }
.col-resizer {
  position: absolute; top: 0; right: 0; bottom: 0; width: 9px; z-index: 2;
  cursor: col-resize; touch-action: none;
}
.col-resizer::after {
  content: ""; position: absolute; top: 10px; bottom: 10px; right: 3px; width: 2px; border-radius: 1px;
}
.grid th:hover .col-resizer::after { background: var(--stroke-strong); }
.col-resizer:hover::after, .col-resizer:focus-visible::after, .col-resizing .col-resizer::after { background: var(--brand); }
.col-resizer:focus-visible { outline: none; }
body.col-resizing { cursor: col-resize; user-select: none; }
.grid th, .grid td { height: 42px; padding: 0 12px; text-align: left; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; border-bottom: 1px solid var(--stroke); }
.grid th { position: sticky; top: 0; z-index: 1; background: var(--surface); font-weight: 600; height: 44px;
  border-bottom-color: var(--stroke-strong); }
.grid th.check, .grid td.check { width: 48px; padding: 0 12px; text-align: center; }
.grid td.num { text-align: right; }
.grid tbody tr:hover td { background: var(--row-hover); }
.grid tbody tr[aria-selected="true"] td { background: var(--row-selected); }
.grid .col-button {
  display: inline-flex; align-items: center; gap: 4px; max-width: 100%; border: 0; background: none; cursor: pointer;
  font-weight: 600; padding: 4px 6px; margin-left: -6px; border-radius: 4px;
}
.grid .col-button:hover { background: var(--row-hover); }
.grid .col-button span { overflow: hidden; text-overflow: ellipsis; }
.grid .col-button .icon { width: 12px; height: 12px; color: var(--text-2); }
.grid .col-button .sorted { color: var(--text); }
.grid input[type=checkbox] { width: 18px; height: 18px; margin: 0; accent-color: var(--brand); cursor: pointer; }
.grid .muted { color: var(--text-3); }
.grid-empty { padding: 48px 16px; text-align: center; color: var(--text-2); }
.list-footer { display: flex; gap: 24px; padding: 10px 0 2px; color: var(--text-2); }

/* Chart pane */
.chart-pane { border: 1px solid var(--stroke); border-radius: 8px; padding: 12px 16px; margin-bottom: 12px; }
.chart-pane header { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; font-weight: 600; }
.chart-pane select { height: 30px; border: 1px solid var(--stroke-strong); border-radius: 4px; background: var(--surface); padding: 0 6px; }
.chart-rows { display: grid; grid-template-columns: minmax(80px, 200px) 1fr 40px; gap: 6px 10px; align-items: center; font-size: 13px; }
.chart-rows .bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chart-rows .bar-track { height: 16px; }
.chart-rows .bar { height: 100%; background: var(--brand); border-radius: 0 3px 3px 0; min-width: 2px; }
.chart-rows .bar-value { color: var(--text-2); text-align: right; font-variant-numeric: tabular-nums; }

/* Menus and panels */
.menu {
  position: fixed; z-index: 50; min-width: 200px; max-height: 60vh; overflow-y: auto; padding: 4px;
  background: var(--surface); border-radius: 8px; box-shadow: var(--shadow-pop);
}
.menu button, .menu a {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 32px; padding: 0 10px; border: 0;
  border-radius: 4px; background: none; color: var(--text); text-align: left; text-decoration: none; cursor: pointer;
}
.menu button:hover, .menu a:hover { background: var(--row-hover); }
.menu [aria-checked="true"] { font-weight: 600; }
.menu .menu-sep { height: 1px; background: var(--stroke); margin: 4px 0; }
.menu .menu-heading { padding: 6px 10px 2px; color: var(--text-2); font-size: 12px; }
.menu .icon { width: 16px; height: 16px; }

.scrim { position: fixed; inset: 0; z-index: 40; background: var(--scrim); }
.panel {
  position: fixed; z-index: 41; top: 0; right: 0; bottom: 0; width: min(420px, 100vw); display: flex; flex-direction: column;
  background: var(--surface); box-shadow: var(--shadow-pop);
}
.panel header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px 12px; }
.panel h2 { margin: 0; font-size: 20px; line-height: 28px; font-weight: 600; }
.panel .panel-body { flex: 1; overflow-y: auto; padding: 0 24px 16px; }
.panel footer { display: flex; gap: 8px; padding: 16px 24px; border-top: 1px solid var(--stroke); }
.panel .hint { color: var(--text-2); font-size: 13px; margin: 0 0 12px; }

.btn {
  height: 32px; padding: 0 14px; border-radius: 4px; border: 1px solid var(--stroke-strong);
  background: var(--surface); color: var(--text); font-weight: 600; cursor: pointer;
}
.btn:hover { background: var(--row-hover); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn.primary:hover { background: var(--brand-hover); }
.btn.link { border: 0; background: none; color: var(--link); padding: 0 4px; }
.btn:disabled { opacity: .5; cursor: default; }

.column-list { list-style: none; margin: 0 0 16px; padding: 0; border: 1px solid var(--stroke); border-radius: 4px; }
.column-list li { display: flex; align-items: center; gap: 4px; min-height: 40px; padding: 0 4px 0 12px; border-bottom: 1px solid var(--stroke); }
.column-list li:last-child { border-bottom: 0; }
.column-list li span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn { display: inline-flex; border: 0; background: none; padding: 6px; border-radius: 4px; cursor: pointer; color: var(--text-2); }
.icon-btn:hover:not(:disabled) { background: var(--row-hover); color: var(--text); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.icon-btn .icon { width: 16px; height: 16px; }

.field-select, .field-input {
  width: 100%; height: 32px; padding: 0 8px; border: 1px solid var(--stroke-strong); border-bottom-color: var(--text-2);
  border-radius: 4px; background: var(--surface);
}
textarea.field-input { height: auto; min-height: 72px; padding: 6px 8px; resize: vertical; }
.field-input:focus, .field-select:focus { outline: 0; border-bottom: 2px solid var(--brand); }
.field-input[readonly] { background: var(--app-bg); color: var(--text-2); }
/* Dates are typed as YYYY-MM-DD; the empty-field placeholder shows the format. */
.date-input { font-variant-numeric: tabular-nums; }
.date-input::placeholder { color: var(--text-3); letter-spacing: .03em; }
.field-input[aria-invalid="true"] { border-color: var(--danger); border-bottom: 2px solid var(--danger); }
.native-picker { position: absolute; right: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; border: 0; padding: 0; }
.condition .control { display: flex; gap: 4px; position: relative; }
.condition .control .date-input { flex: 1; min-width: 0; }
.panel .hint.error { color: var(--danger); }
.condition { display: grid; gap: 6px; padding: 12px; border: 1px solid var(--stroke); border-radius: 4px; margin-bottom: 8px; position: relative; }
.condition .icon-btn { position: absolute; top: 6px; right: 6px; }
.condition .field-select:first-of-type { width: calc(100% - 32px); }

/* Record form */
.record-header { display: flex; align-items: center; gap: 12px; padding: 4px 0 16px; border-bottom: 1px solid var(--stroke); }
.record-header h1 { margin: 0; font-size: 20px; line-height: 28px; font-weight: 600; overflow-wrap: anywhere; }
.record-header .entity { color: var(--text-2); }
.record-header .dirty { color: var(--text-2); font-size: 13px; }
.tabs { display: flex; gap: 4px; margin: 8px 0 16px; border-bottom: 1px solid var(--stroke); }
.tab { border: 0; background: none; padding: 8px 10px 10px; cursor: pointer; position: relative; color: var(--text-2); }
.tab[aria-selected="true"] { color: var(--text); font-weight: 600; }
.tab[aria-selected="true"]::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 3px; border-radius: 2px; background: var(--brand); }
.form-section { border: 1px solid var(--stroke); border-radius: 8px; padding: 16px 20px; margin-bottom: 16px; }
.form-section h2 { margin: 0 0 12px; font-size: 16px; font-weight: 600; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 4px 32px; }
.form-field { display: grid; grid-template-columns: minmax(120px, 40%) 1fr; align-items: start; gap: 12px; padding: 6px 0; }
.form-field > label { padding-top: 6px; color: var(--text-2); overflow-wrap: anywhere; }
.form-field .required { color: var(--danger); margin-left: 2px; }
.form-field .control { display: flex; gap: 4px; align-items: start; min-width: 0; }
.form-field .control > :first-child { flex: 1; min-width: 0; }
.form-field .field-hint { color: var(--text-3); font-size: 12px; margin-top: 2px; }
.subgrid { padding-bottom: 8px; }
.subgrid-header { display: flex; align-items: center; gap: 4px; margin: -4px 0 8px; }
.subgrid-header h2 { margin: 0; }
.subgrid-header .count {
  display: inline-block; min-width: 22px; padding: 0 7px; margin-left: 6px; border-radius: 11px;
  background: var(--row-selected); color: var(--text-2); font-size: 12px; font-weight: 600; line-height: 20px; text-align: center;
}
.subgrid .grid-wrap { max-height: 460px; border-bottom: 0; }
.subgrid .grid tbody tr:last-child td { border-bottom: 0; }
.subgrid-empty { margin: 0; color: var(--text-3); }
/* Field tooltips (code descriptions, time zones): shown under the field only while the pointer
   is over it, gone as soon as it moves off. */
.form-field .control { position: relative; }
.field-tip {
  /* Right-aligned to the field so it opens leftwards and stays inside the form. */
  position: absolute; z-index: 20; right: 0; top: calc(100% + 4px); width: max-content; max-width: min(240px, 80vw);
  /* Fluent 2 tooltip: neutral background, 4px radius, shadow16, 12/16 text, 240px max width. */
  padding: 4px 11px 6px; border-radius: 4px; border: 1px solid var(--tip-stroke);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-pop);
  font-size: 12px; line-height: 16px; font-weight: 400; white-space: normal; overflow-wrap: anywhere; pointer-events: none;
  opacity: 0; visibility: hidden; transition: opacity .12s ease, visibility 0s linear .12s;
}
.control:hover > .field-tip:not(:empty) {
  opacity: 1; visibility: visible; transition: opacity .12s ease .25s, visibility 0s linear .25s;
}
@media (prefers-reduced-motion: reduce) { .field-tip { transition: none !important; } }
/* Type-ahead code search (e.g. HS codes): matches listed under the field. */
.lookup-list {
  /* At least 420px wide so descriptions are readable; right-aligned so it stays inside the form. */
  position: absolute; z-index: 30; right: 0; top: calc(100% + 2px); width: max(100%, min(420px, 85vw)); max-height: 300px; overflow-y: auto;
  margin: 0; padding: 4px; list-style: none; background: var(--surface); border: 1px solid var(--tip-stroke);
  border-radius: 4px; box-shadow: var(--shadow-pop);
}
.lookup-list li[role="option"]:not([aria-disabled]) {
  display: grid; grid-template-columns: 7ch 1fr; gap: 10px; padding: 6px 8px; border-radius: 4px; cursor: pointer;
}
.lookup-list li[aria-selected="true"] { background: var(--row-selected); }
.lookup-list li[role="option"]:not([aria-disabled]):hover { background: var(--row-hover); }
.lookup-list li[aria-selected="true"]:hover { background: var(--row-selected); }
.lookup-code { font-weight: 600; font-variant-numeric: tabular-nums; }
.lookup-desc { font-size: 12px; line-height: 16px; color: var(--text-2);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lookup-list mark { background: none; color: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.lookup-more { padding: 6px 8px; font-size: 12px; color: var(--text-3); }
/* Don't show the description tooltip on top of the open match list. */
.control:has(.lookup-list:not([hidden])) > .field-tip { display: none; }
/* Settings page: invitations */
.invite-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; align-items: end; }
.invite-form label { display: grid; gap: 4px; color: var(--text-2); }
.invite-form .btn { height: 32px; }
.invite-link { margin-top: 14px; padding: 12px; border-radius: 6px; background: var(--success-bg); }
.invite-link p { margin: 0 0 8px; }
.invite-copy { display: flex; gap: 8px; }
.invite-copy input { flex: 1; min-width: 0; }
.users-grid select { min-width: 220px; }
.muted { color: var(--text-3); }

/* Settings page */
.tab { text-decoration: none; }
.settings-desc { margin: -4px 0 12px; color: var(--text-2); max-width: 70ch; }
.settings-desc code, .details code { font-size: 12px; }
.settings-group .form-field { grid-template-columns: minmax(140px, 220px) minmax(0, 520px); }
.settings-advanced { margin-top: 8px; }
.settings-advanced summary { cursor: pointer; color: var(--text-2); padding: 6px 0; }
.settings-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.badge { display: inline-block; margin: 4px 6px 0 0; padding: 0 8px; border-radius: 10px; font-size: 12px; line-height: 20px;
  background: var(--row-selected); color: var(--text-2); }
.badge.ok { background: var(--success-bg); color: var(--success); }
.secret-set { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; min-height: 32px; }
.secret-mask { color: var(--text-2); letter-spacing: .1em; }
.switch { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; cursor: pointer; }
.switch input { width: 18px; height: 18px; accent-color: var(--brand); }
.checks { display: grid; gap: 6px; padding-top: 6px; }
.checks label { display: flex; align-items: center; gap: 8px; }
.checks input { width: 16px; height: 16px; accent-color: var(--brand); }
.sync-status { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--stroke); }
.sync-status h3 { margin: 0 0 6px; font-size: 14px; }
.sync-status p { margin: 4px 0; }
.sync-last.succeeded { color: var(--success); }
.sync-last.failed, .sync-error { color: var(--danger); }
.sync-counts { margin: 6px 0 0; padding-left: 18px; color: var(--text-2); }
.sync-running { display: flex; align-items: center; gap: 8px; }
.spinner { width: 14px; height: 14px; border: 2px solid var(--stroke); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
dl.details { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; margin: 0; }
dl.details dt { color: var(--text-2); }
dl.details dd { margin: 0; overflow-wrap: anywhere; }
.related-list { list-style: none; margin: 0; padding: 0; }
.related-list li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--stroke); }
.related-list .count { color: var(--text-2); font-variant-numeric: tabular-nums; }

.banner { display: flex; gap: 8px; align-items: flex-start; padding: 8px 12px; border-radius: 4px; margin-bottom: 12px; }
.banner.error { background: var(--danger-bg); color: var(--danger); }
.banner.ok { background: var(--success-bg); color: var(--success); }
.toast {
  position: fixed; z-index: 60; left: 50%; bottom: 24px; transform: translateX(-50%); padding: 10px 16px;
  border-radius: 6px; background: var(--text); color: var(--surface); box-shadow: var(--shadow-pop);
}
.loading { padding: 32px; color: var(--text-2); }

@media (max-width: 760px) {
  .app-header .header-menu { display: inline-flex; }
  .commandbar { overflow-x: auto; scrollbar-width: none; }
  .nav-toggle { display: none; }
  .app .sitemap { position: fixed; z-index: 45; top: 48px; bottom: 0; left: 0; box-shadow: var(--shadow-pop); }
  .app[data-nav="collapsed"] .sitemap { display: none; }
  .main { padding: 8px; }
  .content { padding: 12px; }
  .cmd .cmd-label { display: none; }
  .search-box { width: 100%; }
  .form-field { grid-template-columns: 1fr; gap: 2px; }
}
