:root {
  --theme-primary: #0f4c81;
  --theme-primary-dark: #0b3f6a;
  --theme-primary-soft: #d9e7f5;
  --theme-primary-soft-2: #edf3fa;
  --theme-primary-soft-3: #eff5fb;
  --theme-accent-soft: #f2faf7;
  --theme-secondary: #17624c;
  --theme-danger: #b42318;
  --theme-success: #0f6b43;
  --theme-text: #17324d;
  --theme-text-strong: #1d3652;
  --theme-muted: #5b748f;
  --theme-bg: #f3f6fb;
  --theme-surface: #fff;
  --theme-border: #c7d4e3;
  --theme-nav-start: #0f4c81;
  --theme-nav-end: #0b6b68;
  /* Added when the hardcoded colours were tokenised. Defaults are the exact
     values that were already in the file, so day one looks identical. */
  --theme-border-soft: #dbe6f1;   /* the lighter rule between table rows and inside cards */
  --theme-band-bg: #334155;       /* dark bands: the Total row, and headers on dark */
  --theme-primary-rgb: 15, 76, 129; /* the primary as channels, so rgba() can follow the design */
  --theme-surface-2: #fbfdff;     /* the faint tint used for panels sitting on a card */
}
body.theme-current, .theme-current {
  /* Exactly what :root holds - the system as it looks today. Stated as a palette
     so the gallery can draw it, and kept as the default because the owner asked
     for the current UI to remain the default. */
  --theme-primary: #0f4c81; --theme-primary-dark: #0b3f6a;
  --theme-primary-soft: #d9e7f5; --theme-primary-soft-2: #edf3fa; --theme-primary-soft-3: #eff5fb;
  --theme-accent-soft: #f2faf7; --theme-secondary: #17624c;
  --theme-danger: #b42318; --theme-success: #0f6b43;
  --theme-text: #17324d; --theme-text-strong: #1d3652; --theme-muted: #59718c;
  --theme-bg: #f3f6fb; --theme-surface: #ffffff; --theme-border: #c7d4e3;
  --theme-nav-start: #0f4c81; --theme-nav-end: #0b6b68;
  --theme-border-soft: #dbe6f1; --theme-band-bg: #334155;
  --theme-primary-rgb: 15, 76, 129; --theme-surface-2: #fbfdff;
}
/* ---------------------------------------------------------------------------
   THE FOURTEEN PALETTES

   Rebuilt after the owner reported three pairs reading as the same colour:
   slate/graphite, emerald/deep-teal/bangla-green, and amber/copper.

   Separation is now measured, not judged. Every pair of primaries is at least
   16 CIEDE2000 apart - the standard measure of how different two colours look
   to a person - where under 10 reads as "the same colour, slightly different".

   Contrast is measured too: white on every primary, and ink and muted text on
   every ground, all pass WCAG AA.
   --------------------------------------------------------------------------- */
body.theme-ocean, .theme-ocean {
  /* Ocean Blue */
  --theme-primary: #1D4ED8; --theme-primary-dark: #173da8;
  --theme-primary-soft: #dfe6fa; --theme-primary-soft-2: #f1f4fd; --theme-primary-soft-3: #edf1fc;
  --theme-accent-soft: #f7f9fe; --theme-secondary: #1943ba;
  --theme-danger: #9b1c1c; --theme-success: #0f6b43;
  --theme-text: #0F172A; --theme-text-strong: #0b1120; --theme-muted: #5A6478;
  --theme-bg: #F6F8FC; --theme-surface: #ffffff; --theme-border: #DCE3EF;
  --theme-nav-start: #1D4ED8; --theme-nav-end: #173ead;
  --theme-border-soft: #ecf0f6; --theme-band-bg: #0F172A;
  --theme-primary-rgb: 29, 78, 216; --theme-surface-2: #fbfcfe;
}
body.theme-eclipse, .theme-eclipse {
  /* Blue Eclipse */
  --theme-primary: #0B2E7A; --theme-primary-dark: #09245f;
  --theme-primary-soft: #dde2ec; --theme-primary-soft-2: #f0f2f7; --theme-primary-soft-3: #ebeef4;
  --theme-accent-soft: #f6f8fa; --theme-secondary: #092869;
  --theme-danger: #9b1c1c; --theme-success: #0f6b43;
  --theme-text: #0B1526; --theme-text-strong: #08101c; --theme-muted: #57627A;
  --theme-bg: #F4F6FC; --theme-surface: #ffffff; --theme-border: #D8DEEA;
  --theme-nav-start: #0B2E7A; --theme-nav-end: #092562;
  --theme-border-soft: #eaedf3; --theme-band-bg: #0B1526;
  --theme-primary-rgb: 11, 46, 122; --theme-surface-2: #fafbfe;
}
body.theme-seaside, .theme-seaside {
  /* Charming Seaside */
  --theme-primary: #0E7490; --theme-primary-dark: #0b5a70;
  --theme-primary-soft: #ddecef; --theme-primary-soft-2: #f1f7f8; --theme-primary-soft-3: #ecf4f6;
  --theme-accent-soft: #f7fafb; --theme-secondary: #0c647c;
  --theme-danger: #9b1c1c; --theme-success: #0f6b43;
  --theme-text: #082630; --theme-text-strong: #061c24; --theme-muted: #4F7280;
  --theme-bg: #F2F9FB; --theme-surface: #ffffff; --theme-border: #D0E6EE;
  --theme-nav-start: #0E7490; --theme-nav-end: #0b5d73;
  --theme-border-soft: #e5f1f6; --theme-band-bg: #082630;
  --theme-primary-rgb: 14, 116, 144; --theme-surface-2: #f9fcfd;
}
body.theme-indigo, .theme-indigo {
  /* Indigo */
  --theme-primary: #5B21B6; --theme-primary-dark: #471a8e;
  --theme-primary-soft: #e8e0f5; --theme-primary-soft-2: #f5f2fb; --theme-primary-soft-3: #f2edf9;
  --theme-accent-soft: #f9f7fc; --theme-secondary: #4e1c9d;
  --theme-danger: #9b1c1c; --theme-success: #0f6b43;
  --theme-text: #1B1140; --theme-text-strong: #140d30; --theme-muted: #665C8E;
  --theme-bg: #F8F6FD; --theme-surface: #ffffff; --theme-border: #E2DBF4;
  --theme-nav-start: #5B21B6; --theme-nav-end: #491a92;
  --theme-border-soft: #efebf9; --theme-band-bg: #1B1140;
  --theme-primary-rgb: 91, 33, 182; --theme-surface-2: #fcfbfe;
}
body.theme-hydrangea, .theme-hydrangea {
  /* Hydrangea */
  --theme-primary: #9B2C9B; --theme-primary-dark: #792279;
  --theme-primary-soft: #f1e1f1; --theme-primary-soft-2: #f9f2f9; --theme-primary-soft-3: #f7eef7;
  --theme-accent-soft: #fcf8fc; --theme-secondary: #852685;
  --theme-danger: #9b1c1c; --theme-success: #0f6b43;
  --theme-text: #2E0F2E; --theme-text-strong: #220b22; --theme-muted: #775477;
  --theme-bg: #FBF5FB; --theme-surface: #ffffff; --theme-border: #EEDAEE;
  --theme-nav-start: #9B2C9B; --theme-nav-end: #7c237c;
  --theme-border-soft: #f6ebf6; --theme-band-bg: #2E0F2E;
  --theme-primary-rgb: 155, 44, 155; --theme-surface-2: #fdfafd;
}
body.theme-crimson, .theme-crimson {
  /* Crimson Seal */
  --theme-primary: #B31235; --theme-primary-dark: #8c0e29;
  --theme-primary-soft: #f4dee3; --theme-primary-soft-2: #faf1f3; --theme-primary-soft-3: #f9ecef;
  --theme-accent-soft: #fcf7f8; --theme-secondary: #9a0f2e;
  --theme-danger: #9b1c1c; --theme-success: #0f6b43;
  --theme-text: #2B0A13; --theme-text-strong: #20080e; --theme-muted: #7E5563;
  --theme-bg: #FDF5F7; --theme-surface: #ffffff; --theme-border: #F1D6DE;
  --theme-nav-start: #B31235; --theme-nav-end: #8f0e2a;
  --theme-border-soft: #f7e8ed; --theme-band-bg: #2B0A13;
  --theme-primary-rgb: 179, 18, 53; --theme-surface-2: #fefafb;
}
body.theme-sienna, .theme-sienna {
  /* Burnt Sienna */
  --theme-primary: #A6432A; --theme-primary-dark: #813421;
  --theme-primary-soft: #f3e5e1; --theme-primary-soft-2: #faf4f2; --theme-primary-soft-3: #f8f0ee;
  --theme-accent-soft: #fcf8f8; --theme-secondary: #8f3a24;
  --theme-danger: #9b1c1c; --theme-success: #0f6b43;
  --theme-text: #2B1109; --theme-text-strong: #200d07; --theme-muted: #7C5B4F;
  --theme-bg: #FDF6F3; --theme-surface: #ffffff; --theme-border: #EFDBD3;
  --theme-nav-start: #A6432A; --theme-nav-end: #853622;
  --theme-border-soft: #f6ebe7; --theme-band-bg: #2B1109;
  --theme-primary-rgb: 166, 67, 42; --theme-surface-2: #fefbfa;
}
body.theme-amber, .theme-amber {
  /* Amber Earth */
  --theme-primary: #96631A; --theme-primary-dark: #754d14;
  --theme-primary-soft: #f0e9df; --theme-primary-soft-2: #f9f6f1; --theme-primary-soft-3: #f7f3ed;
  --theme-accent-soft: #fbfaf7; --theme-secondary: #815516;
  --theme-danger: #9b1c1c; --theme-success: #0f6b43;
  --theme-text: #241C0E; --theme-text-strong: #1b150a; --theme-muted: #7A6A52;
  --theme-bg: #FBF8F2; --theme-surface: #ffffff; --theme-border: #EBE1D0;
  --theme-nav-start: #96631A; --theme-nav-end: #784f15;
  --theme-border-soft: #f4eee5; --theme-band-bg: #241C0E;
  --theme-primary-rgb: 150, 99, 26; --theme-surface-2: #fdfcf9;
}
body.theme-olive, .theme-olive {
  /* Olive Green */
  --theme-primary: #6E7B1C; --theme-primary-dark: #566016;
  --theme-primary-soft: #ebeddf; --theme-primary-soft-2: #f6f7f1; --theme-primary-soft-3: #f3f4ed;
  --theme-accent-soft: #fafaf7; --theme-secondary: #5f6a18;
  --theme-danger: #9b1c1c; --theme-success: #0f6b43;
  --theme-text: #20240A; --theme-text-strong: #181b08; --theme-muted: #6E7350;
  --theme-bg: #F9FAEF; --theme-surface: #ffffff; --theme-border: #E4E8CB;
  --theme-nav-start: #6E7B1C; --theme-nav-end: #586216;
  --theme-border-soft: #f0f2e2; --theme-band-bg: #20240A;
  --theme-primary-rgb: 110, 123, 28; --theme-surface-2: #fcfdf8;
}
body.theme-emerald, .theme-emerald {
  /* Emerald */
  --theme-primary: #037A4E; --theme-primary-dark: #025f3d;
  --theme-primary-soft: #dcece6; --theme-primary-soft-2: #f0f7f4; --theme-primary-soft-3: #ebf4f1;
  --theme-accent-soft: #f6faf9; --theme-secondary: #036943;
  --theme-danger: #9b1c1c; --theme-success: #0f6b43;
  --theme-text: #062017; --theme-text-strong: #041811; --theme-muted: #4E7565;
  --theme-bg: #F2FBF6; --theme-surface: #ffffff; --theme-border: #CDE9DA;
  --theme-nav-start: #037A4E; --theme-nav-end: #02623e;
  --theme-border-soft: #e4f3eb; --theme-band-bg: #062017;
  --theme-primary-rgb: 3, 122, 78; --theme-surface-2: #f9fdfb;
}
body.theme-algae, .theme-algae {
  /* Sea Algae Green */
  --theme-primary: #11605E; --theme-primary-dark: #0d4b49;
  --theme-primary-soft: #dee9e8; --theme-primary-soft-2: #f1f5f5; --theme-primary-soft-3: #ecf2f2;
  --theme-accent-soft: #f7f9f9; --theme-secondary: #0f5351;
  --theme-danger: #9b1c1c; --theme-success: #0f6b43;
  --theme-text: #06211F; --theme-text-strong: #041917; --theme-muted: #4E7370;
  --theme-bg: #F1F8F8; --theme-surface: #ffffff; --theme-border: #CFE6E4;
  --theme-nav-start: #11605E; --theme-nav-end: #0e4d4b;
  --theme-border-soft: #e5f1f0; --theme-band-bg: #06211F;
  --theme-primary-rgb: 17, 96, 94; --theme-surface-2: #f9fcfc;
}
body.theme-moss, .theme-moss {
  /* Mossy Hollow */
  --theme-primary: #38463A; --theme-primary-dark: #2c372d;
  --theme-primary-soft: #e3e5e3; --theme-primary-soft-2: #f3f4f3; --theme-primary-soft-3: #eff0ef;
  --theme-accent-soft: #f8f9f8; --theme-secondary: #303c32;
  --theme-danger: #9b1c1c; --theme-success: #0f6b43;
  --theme-text: #121711; --theme-text-strong: #0e110d; --theme-muted: #5C6A5D;
  --theme-bg: #F5F7F5; --theme-surface: #ffffff; --theme-border: #DCE3DD;
  --theme-nav-start: #38463A; --theme-nav-end: #2d382e;
  --theme-border-soft: #ecf0ec; --theme-band-bg: #121711;
  --theme-primary-rgb: 56, 70, 58; --theme-surface-2: #fafbfa;
}
body.theme-slate, .theme-slate {
  /* Slate */
  --theme-primary: #4A5560; --theme-primary-dark: #3a424b;
  --theme-primary-soft: #e6e7e9; --theme-primary-soft-2: #f4f5f5; --theme-primary-soft-3: #f1f1f2;
  --theme-accent-soft: #f9f9f9; --theme-secondary: #404953;
  --theme-danger: #9b1c1c; --theme-success: #0f6b43;
  --theme-text: #1F252B; --theme-text-strong: #171c20; --theme-muted: #69737C;
  --theme-bg: #F6F7F8; --theme-surface: #ffffff; --theme-border: #E0E3E7;
  --theme-nav-start: #4A5560; --theme-nav-end: #3b444d;
  --theme-border-soft: #eef0f2; --theme-band-bg: #1F252B;
  --theme-primary-rgb: 74, 85, 96; --theme-surface-2: #fbfbfc;
}
body.theme-ash, .theme-ash {
  /* Light Ash */
  --theme-primary: #78706A; --theme-primary-dark: #5e5753;
  --theme-primary-soft: #ecebea; --theme-primary-soft-2: #f7f6f6; --theme-primary-soft-3: #f4f4f3;
  --theme-accent-soft: #fafafa; --theme-secondary: #67605b;
  --theme-danger: #9b1c1c; --theme-success: #0f6b43;
  --theme-text: #1F1D1B; --theme-text-strong: #171614; --theme-muted: #6E6862;
  --theme-bg: #FAFAF9; --theme-surface: #ffffff; --theme-border: #E7E5E2;
  --theme-nav-start: #78706A; --theme-nav-end: #605a55;
  --theme-border-soft: #f2f1ef; --theme-band-bg: #1F1D1B;
  --theme-primary-rgb: 120, 112, 106; --theme-surface-2: #fdfdfc;
}


* { box-sizing: border-box; }
body { margin: 0; font-family: "Segoe UI", Arial, sans-serif; background: var(--theme-bg); color: var(--theme-text); }
a { color: var(--theme-primary); text-decoration: none; }
button, .button-link { background: var(--theme-primary); color: #fff; border: 0; border-radius: 8px; padding: 10px 14px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; min-height: 42px; line-height: 1.2; font: inherit; text-decoration: none; vertical-align: middle; }
button:disabled { opacity: .6; cursor: not-allowed; }
.btn-small { padding: 6px 10px; font-size: 12px; }
.btn-danger { background: var(--theme-danger); }
.btn-secondary { background: var(--theme-secondary); }
.icon-only-button {
  width: 42px;
  min-width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 10px;
  font-size: 18px;
  line-height: 1;
}
.icon-action-button { background: var(--theme-primary); }
.icon-delete-button { background: var(--theme-danger); }
.hidden { display: none !important; }
.container { width: 100%; padding: 16px 18px; max-width: none; margin: 0; }
.nav { background: linear-gradient(90deg, var(--theme-nav-start), var(--theme-nav-end)); color: #fff; padding: 16px 24px; display: flex; gap: 16px; justify-content: space-between; align-items: center; }
.nav-title { font-size: 22px; font-weight: 700; }
.nav-links { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.nav-links a { color: #fff; }
.logout-form { margin: 0; }
.card { background: var(--theme-surface); border-radius: 16px; padding: 20px; margin-bottom: 20px; box-shadow: 0 8px 24px rgba(var(--theme-primary-rgb), 0.08); }
.hero-card {
  padding: 22px 20px;
  border-radius: 20px;
  border: 1px solid #ebf1f7;
  background: linear-gradient(90deg, #f8fafc 0%, #f8fbfd 56%, var(--theme-accent-soft) 100%);
  box-shadow: 0 10px 26px rgba(17, 55, 92, 0.06);
}
.hero-row, .toolbar-row, .modal-actions, .inline-form, .bulk-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.hero-row { justify-content: space-between; align-items: center; gap: 24px; flex-wrap: nowrap; min-height: 116px; }
.hero-copy { min-width: 0; }
.hero-title { margin: 0 0 26px; font-size: 20px; line-height: 1.2; font-weight: 700; letter-spacing: -0.01em; color: var(--theme-text-strong); }
.hero-subtitle { margin: 0; font-size: 15px; line-height: 1.45; color: #627588; }
.hero-actions { margin-left: auto; display: flex; gap: 26px; align-items: center; justify-content: flex-end; flex-wrap: nowrap; text-align: left; }
.hero-summary {
  min-width: 132px;
  padding: 2px 0;
  display: grid;
  gap: 10px;
}
.hero-summary-item { line-height: 1.2; }
.hero-summary-item strong { display: inline-block; margin-bottom: 4px; color: var(--theme-text-strong); font-size: 15px; }
.hero-summary-item .muted { font-size: 14px; color: #6b7e90; }
.hero-declare-button {
  min-width: 186px;
  min-height: 42px;
  padding: 10px 18px;
  border-radius: 10px;
  background: var(--theme-primary);
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.08);
}
.toolbar-row { align-items: stretch; }
.toolbar-row > button,
.toolbar-row > .button-link,
.toolbar-row > form > button { min-width: 140px; }
.scope-switch-row {
  justify-content: center;
}
.scope-switch-row .button-link {
  background: var(--theme-border-soft);
  color: var(--theme-primary);
}
.scope-switch-row .button-link .segment-new-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 8px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #fff7d6;
  color: #8a5b00;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}
.scope-switch-row .button-link.is-active {
  background: var(--theme-primary);
  color: #fff;
}
.scope-switch-row .button-link.is-active .segment-new-badge {
  background: rgba(255, 247, 214, 0.95);
  color: #7a5100;
}
.segment-switch-card {
  background: transparent;
  box-shadow: none;
  border: 0;
  padding-top: 4px;
  padding-bottom: 4px;
}
.sortable-head {
  color: inherit;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.sortable-head.is-active {
  color: #fff;
  font-weight: 700;
}
.asset-category-grid th.sort-active {
  background: var(--theme-primary);
  color: #fff;
}
.sortable-head:hover {
  text-decoration: underline;
}
.office-page-head { justify-content: space-between; }
.grid { display: grid; gap: 14px; }
.grid label, .split label { display: grid; gap: 8px; font-weight: 600; color: #204261; }
.common-fields-template-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: center;
}
.common-fields-template-grid > div {
  display: flex;
  align-items: center;
}
.common-fields-template-grid > div > .button-link,
.common-fields-template-grid > div > input[type="file"],
.common-fields-template-grid > div > button {
  width: 100%;
}
.field-label-row,
.field-head-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.mandatory-marker {
  display: inline-block;
  margin-left: 4px;
  font-weight: 800;
}
.mandatory-marker-input {
  color: #12385d;
}
.mandatory-marker-final {
  color: #9ab0c4;
}
.field-head-row {
  width: 100%;
  justify-content: flex-start;
}
.field-help-button {
  width: 18px;
  min-width: 18px;
  height: 18px;
  min-height: 18px;
  padding: 0;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  background: var(--theme-primary-soft);
  color: var(--theme-primary);
  box-shadow: none;
}
.field-help-button:hover {
  background: var(--theme-primary);
  color: #fff;
}
.field-help-table {
  flex: 0 0 auto;
}
.field-help-inline {
  align-self: center;
}
.split { display: grid; grid-template-columns: 1.1fr .9fr; gap: 20px; }
.board-filters-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
input, select, textarea { width: 100%; border: 1px solid var(--theme-border); border-radius: 10px; padding: 10px 12px; font: inherit; background: var(--theme-surface); color: var(--theme-text); }
textarea { resize: vertical; }
.filter-picker {
  position: relative;
}
.filter-picker.is-selected [data-filter-picker-input] {
  background: var(--theme-primary);
  color: #fff;
  border-color: var(--theme-primary);
  font-weight: 600;
}
.filter-picker.is-selected [data-filter-picker-input]::placeholder {
  color: rgba(255, 255, 255, 0.8);
}
.filter-picker-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--theme-surface);
  border: 1px solid var(--theme-border);
  border-radius: 12px;
  box-shadow: 0 14px 30px rgba(var(--theme-primary-rgb), 0.14);
  max-height: 240px;
  overflow-y: auto;
  display: none;
  z-index: 30;
  padding: 6px;
}
.filter-picker.is-open .filter-picker-menu {
  display: block;
}
.filter-picker-option {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--theme-text);
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
}
.filter-picker-option:hover {
  background: var(--theme-primary-soft-2);
}
.filter-picker-option.is-disabled {
  color: #93a4b7;
  background: var(--theme-surface-2);
  cursor: not-allowed;
}
.filter-picker-option.is-disabled:hover {
  background: var(--theme-surface-2);
}
.filter-picker-option[hidden] {
  display: none;
}
.inline-edit,
.inline-readonly {
  border: 1px solid transparent;
  background: transparent;
  border-radius: 8px;
  padding: 8px 10px;
  box-shadow: none;
}
.inline-edit:hover,
.inline-edit.is-editing,
.inline-edit:focus {
  background: var(--theme-surface);
  border-color: var(--theme-primary-soft);
  outline: none;
}
.inline-readonly {
  color: #4f6781;
}
.status-active { color: var(--theme-success); font-weight: 700; }
.status-inactive { color: var(--theme-danger); font-weight: 700; }
.action-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline-check,
.grid label.inline-check,
.split label.inline-check {
  display: inline-grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: start;
  column-gap: 8px;
  row-gap: 0;
  font-weight: 600;
  color: #204261;
}
.inline-check input[type="checkbox"] {
  width: 18px;
  min-width: 18px;
  margin: 0;
  align-self: start;
  justify-self: center;
}
.inline-check span {
  display: block;
  min-width: 0;
  text-align: left;
  line-height: 1.3;
  align-self: start;
}
.field-options-box { min-width: 220px; min-height: 84px; }
.segmented-control {
  display: inline-flex;
  padding: 6px;
  border-radius: 999px;
  background: var(--theme-primary-soft-2);
  gap: 6px;
}
.download-level1-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px 14px;
}
.download-manager-topbar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.download-manager-page {
  display: grid;
  gap: 16px;
}
.download-manager-info-grid,
.download-manager-segment-grid {
  display: grid;
  gap: 16px;
}
.download-manager-info-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.download-manager-segment-grid {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}
.download-manager-info-card {
  border: 1px solid var(--theme-border-soft);
  border-radius: 16px;
  background: var(--theme-surface-2);
  padding: 16px;
  display: grid;
  gap: 12px;
}
.download-manager-info-card h3 {
  margin: 0;
}
.download-preview-list,
.download-level2-field-list,
.download-manager-placeholder {
  display: grid;
  gap: 10px;
}
.download-preview-row {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--theme-border-soft);
  border-radius: 12px;
  background: var(--theme-surface);
}
.download-token-helper-grid {
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}
.download-token-helper-grid .download-preview-row {
  grid-template-columns: minmax(0, 1fr);
  min-height: 52px;
  padding: 10px 12px;
  align-items: center;
}
.download-token-helper-grid .download-preview-label {
  min-width: 0;
}
.download-token-helper-grid .download-preview-label code {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.92rem;
}
.download-preview-serial {
  font-weight: 700;
  color: var(--theme-primary);
}
.download-placeholder-line {
  padding: 8px 10px;
  border: 1px dashed #c6d6e7;
  border-radius: 12px;
  background: var(--theme-surface);
  color: #4d6784;
}
.download-manager-table td {
  vertical-align: top;
}
.download-manager-table {
  width: 100%;
  table-layout: fixed;
}
.download-manager-table th:nth-child(1),
.download-manager-table td:nth-child(1) {
  width: 10%;
}
.download-manager-table th:nth-child(2),
.download-manager-table td:nth-child(2),
.download-manager-table th:nth-child(3),
.download-manager-table td:nth-child(3) {
  width: 45%;
}
.download-level1-table {
  width: 100%;
  table-layout: fixed;
}
.download-level1-table th,
.download-level1-table td {
  vertical-align: middle;
}
.download-level1-table th:nth-child(1),
.download-level1-table td:nth-child(1) {
  width: 28%;
}
.download-level1-table th:nth-child(2),
.download-level1-table td:nth-child(2) {
  width: 10%;
  text-align: center;
}
.download-level1-table th:nth-child(3),
.download-level1-table td:nth-child(3) {
  width: 12%;
  text-align: center;
}
.download-level1-table th:nth-child(4),
.download-level1-table td:nth-child(4) {
  width: 12%;
}
.download-level1-table th:nth-child(5),
.download-level1-table td:nth-child(5) {
  width: 18%;
}
.download-level1-table th:nth-child(6),
.download-level1-table td:nth-child(6) {
  width: 20%;
}
.download-level1-table input[type="number"],
.download-level1-table select {
  width: 100%;
}
[data-download-output-mode="zip"] .download-level1-table [data-download-level1-col="is_level"],
[data-download-output-mode="zip"] .download-level1-table [data-download-level1-col="serial"],
[data-download-output-mode="zip"] .download-level1-table [data-download-level1-col="sorting"] {
  display: none;
}
[data-download-output-mode="zip"] .download-level1-table [data-download-level1-col="field"] {
  width: 48%;
}
[data-download-output-mode="zip"] .download-level1-table [data-download-level1-col="show"] {
  width: 14%;
}
[data-download-output-mode="zip"] .download-level1-table [data-download-level1-col="filter"] {
  width: 38%;
}
.download-manager-cell {
  display: grid;
  gap: 10px;
}
.download-manager-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.download-chip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 24px;
  align-items: center;
  column-gap: 8px;
  padding: 7px 8px 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--theme-border);
  background: var(--theme-primary-soft-2);
  color: var(--theme-text);
  font-size: 13px;
  line-height: 1.2;
  min-width: 0;
}
.download-chip.is-active {
  border-color: var(--theme-primary);
  background: var(--theme-primary-soft);
}
.download-chip.is-removed {
  opacity: .45;
  background: var(--theme-surface-2);
}
.download-chip-label {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}
.download-chip-action {
  width: 24px;
  min-width: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.download-chip-remove {
  width: 20px;
  min-width: 20px;
  height: 20px;
  min-height: 20px;
  padding: 0;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.08);
  color: inherit;
  font-size: 14px;
  line-height: 1;
}
.download-chip-remove:hover {
  background: var(--theme-danger);
  color: #fff;
}
.segment {
  background: var(--theme-border-soft);
  color: var(--theme-primary);
  border-radius: 999px;
}
.segment.is-active {
  background: var(--theme-primary);
  color: #fff;
}
.download-modal-scope-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.download-modal-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
}
.download-modal-row-single {
  grid-template-columns: minmax(0, 1fr);
}
.download-modal-topbar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  flex-wrap: wrap;
}
.download-data-modal-card {
  width: min(1200px, 100%);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.download-data-form {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 18px;
  min-height: 0;
  flex: 1 1 auto;
}
.download-modal-pages {
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
}
.download-modal-page {
  display: grid;
  gap: 18px;
  align-content: start;
}
.download-layer-card {
  border: 1px solid var(--theme-border-soft);
  border-radius: 16px;
  padding: 16px;
  background: var(--theme-surface-2);
  display: grid;
  gap: 14px;
}
.download-layer-head h4,
.download-config-box h5 {
  margin: 0 0 4px;
}
.download-layer-head p,
.download-config-box p {
  margin: 0;
}
.download-subhead-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.download-choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px 12px;
}
.download-office-bulk-controls {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.download-common-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}
.download-common-card {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  border: 1px solid var(--theme-border-soft);
  border-radius: 12px;
  background: var(--theme-surface);
}
.download-common-check {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  padding-top: 2px;
}
.download-common-meta {
  display: grid;
  gap: 8px;
}
.download-common-order,
.download-common-sort-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.download-common-order input {
  width: 90px;
}
.download-common-sort-controls select {
  min-width: 88px;
}
.download-field-choice-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.download-inline-check {
  padding: 8px 10px;
  border: 1px solid var(--theme-border-soft);
  border-radius: 12px;
  background: var(--theme-surface);
}
.download-level1-values,
.download-segment-block {
  display: grid;
  gap: 12px;
}
.download-segment-block {
  border-top: 1px solid var(--theme-border-soft);
  padding-top: 14px;
}
.download-segment-config-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.7fr);
  gap: 14px;
}
.download-config-box {
  border: 1px solid var(--theme-border-soft);
  border-radius: 14px;
  padding: 14px;
  background: var(--theme-surface);
  display: grid;
  gap: 12px;
}
.download-filter-box {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-items: start;
  width: 100%;
}
.download-filter-box > h5 {
  grid-column: 1 / -1;
}
.download-filter-group {
  border: 1px solid var(--theme-border-soft);
  border-radius: 12px;
  padding: 10px 12px;
  background: var(--theme-surface-2);
  min-width: 0;
}
.download-filter-group h6 {
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: 700;
}
.download-filter-body {
  display: grid;
  gap: 10px;
}
.download-filter-range {
  align-content: start;
}
.download-filter-group .download-choice-grid {
  grid-template-columns: 1fr;
  gap: 8px;
}
.download-filter-group .download-inline-check {
  min-height: 0;
  padding: 10px 12px;
  align-items: center;
}
.download-filter-group .download-inline-check span {
  align-self: center;
}
.download-filter-tree {
  display: grid;
  gap: 10px;
}
.download-filter-tree-node {
  display: grid;
  gap: 8px;
}
.download-filter-tree-children {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  margin-left: 28px;
}
.download-tree-check {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
}
.download-tree-check input {
  width: 16px;
  height: 16px;
  margin-top: 2px;
}
.download-tree-check span {
  display: block;
  text-align: left;
  padding-top: 1px;
}
.download-office-tree,
.download-conditional-tree {
  max-height: 360px;
  overflow: auto;
  padding-right: 4px;
}
.download-date-range {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.download-sort-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 12px;
}
.audit-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.audit-choice-bar .segment {
  padding: 10px 16px;
}
.audit-summary-table {
  table-layout: auto;
  width: 100%;
}
.audit-summary-table .audit-col-sl,
.audit-summary-table .audit-col-count {
  width: 72px;
  white-space: nowrap;
}
.audit-summary-table th,
.audit-summary-table td {
  white-space: normal;
  word-break: normal;
  overflow-wrap: anywhere;
}
.audit-summary-table th:first-child,
.audit-summary-table td:first-child,
.audit-summary-table th:last-child,
.audit-summary-table td:last-child {
  text-align: center;
}
.download-sort-compact {
  display: grid;
  gap: 10px;
}
.office-kind-panel { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; }
.alert.success { background: #e8f7ef; color: var(--theme-success); }
.alert.error { background: #fdeceb; color: var(--theme-danger); }
/* Status colours, like success and error above, are the deliberate exception to the
   palette: an outage must look like an outage in every theme. */
.alert.warning { background: #fdf4e3; color: #8a5a00; }
.alert.info { background: #eef3fb; color: #33475e; }
.muted, .hint { color: var(--theme-muted); }
.table-wrap { width: 100%; overflow: hidden; }
/* The Load More button is a row of the table itself, sitting between the last
   loaded row and the Total row. Being in the table is what keeps the Total row
   lined up with its columns; the old floating bar overlapped and hid it. */
.table-load-more-body td {
  padding: 5px 10px;
  text-align: center;
  background: var(--theme-primary-soft-3);
}
.table-load-more-body tr:hover td {
  background: var(--theme-primary-soft-3);
}
.table-load-more-body tr:hover td:first-child {
  box-shadow: none;
}
.table-load-more-button {
  min-width: 132px;
}
.asset-total-row td {
  background: var(--theme-band-bg);
  color: #e2e8f0;
  font-weight: 600;
}
.asset-total-row:hover td {
  background: var(--theme-primary-soft-2);
  color: #0f172a;
}
.table-load-more-button[disabled] {
  opacity: 0.72;
  cursor: wait;
}
table { width: 100%; border-collapse: collapse; background: var(--theme-surface); table-layout: fixed; }
th, td { border-bottom: 1px solid var(--theme-border-soft); padding: 8px 10px; text-align: left; vertical-align: top; word-break: break-word; overflow-wrap: anywhere; white-space: normal; font-size: 13px; }
th { background: var(--theme-primary-soft-3); color: var(--theme-text); }
tbody tr {
  transition: background-color 140ms ease, box-shadow 140ms ease;
}
tbody tr td {
  transition: background-color 140ms ease, box-shadow 140ms ease;
}
tbody tr:hover td {
  background: var(--theme-primary-soft-2);
}
tbody tr:hover td:first-child {
  box-shadow: inset 3px 0 0 var(--theme-primary);
}
tbody tr[data-common-generated-row="1"] td {
  background: linear-gradient(180deg, #f7fbff 0%, #eef6ff 100%);
}
tbody tr[data-common-generated-row="1"] td:first-child {
  box-shadow: inset 3px 0 0 #5b92c9;
}
tbody tr[data-common-manual-row="1"] td {
  background: linear-gradient(180deg, #fffdf7 0%, #fff8e8 100%);
}
tbody tr[data-common-manual-row="1"] td:first-child {
  box-shadow: inset 3px 0 0 #d1a24a;
}
tbody tr[data-common-generated-row="1"]:hover td {
  background: #e7f1fd;
}
tbody tr[data-common-manual-row="1"]:hover td {
  background: #fff1cb;
}
.sticky-table-header-layer {
  position: fixed;
  top: 0;
  left: 0;
  display: none;
  overflow: hidden;
  pointer-events: none;
  z-index: 220;
  background: transparent;
}
.sticky-table-header-layer.is-visible {
  display: block;
}
.sticky-table-header-layer table {
  margin: 0;
  box-shadow: 0 12px 28px rgba(var(--theme-primary-rgb), 0.12);
}
.sticky-table-header-layer th,
.sticky-table-header-layer td {
  position: static;
}
.board-grid, .asset-category-grid { display: grid; gap: 20px; }
.operational-budget-card .card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.card-head-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.time-filter-modal-card { width: min(620px, 100%); }
.time-filter-datetime-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}
.time-filter-datetime-row .inline-check {
  min-height: 44px;
}
.action-icon-row { display: inline-flex; align-items: center; gap: 6px; }
.table-action-icon {
  width: 28px;
  height: 28px;
  min-width: 28px;
  padding: 0;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
}
.preview-title { font-weight: 700; margin-bottom: 8px; }
.preview-panel { min-height: 220px; border: 1px solid var(--theme-border-soft); border-radius: 12px; background: var(--theme-surface-2); padding: 12px; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(17, 24, 39, 0.56); display: none; justify-content: center; align-items: center; padding: 18px; z-index: 1000; }
.modal-backdrop.open { display: flex; }
.modal-card { background: var(--theme-surface); border-radius: 18px; padding: 20px; width: min(760px, 100%); max-height: 90vh; overflow: auto; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18); }
.welcome-modal-card { width: min(640px, 100%); position: relative; padding: 24px 24px 20px; }
.welcome-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  min-width: 0;
  min-height: 0;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 999px;
  background: transparent;
  color: #47627e;
  font-size: 24px;
  line-height: 1;
  box-shadow: none;
}
.welcome-modal-close:hover { background: var(--theme-surface-2); color: var(--theme-text); }
.welcome-message-body { width: 100%; padding-top: 4px; }
.welcome-message-body > :first-child { margin-top: 0; }
.welcome-message-body > :last-child { margin-bottom: 0; }
.flash-modal-card { width: min(520px, 100%); }
.flash-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.flash-modal-head h3 { margin: 0; }
.flash-modal-alert { margin-bottom: 0; }
.download-hidden-frame { width: 0; height: 0; border: 0; position: absolute; left: -9999px; top: -9999px; }
.download-wait-modal-card { width: min(520px, 100%); overflow: hidden; }
.download-wait-spinner { display: flex; justify-content: center; align-items: center; padding: 10px 0 4px; }
.download-wait-spinner-ring {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 4px solid var(--theme-border-soft);
  border-top-color: var(--brand, #245b92);
  animation: download-spin 0.8s linear infinite;
}
@keyframes download-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.asset-entry-modal { width: min(35vw, 100%); min-width: 360px; }
.modal-wide { width: min(1280px, 100%); }
.import-review-modal-card { width: min(95vw, 100%); }
.audit-table .has-errors { background: #fff2f2; }
.audit-table .is-valid { background: #f8fcfa; }
.import-review-modal-card .table-wrap {
  width: 100%;
  overflow: visible;
}
.audit-table {
  width: 100%;
  table-layout: fixed;
}
.audit-table th,
.audit-table td {
  font-size: 11px;
  padding: 6px 6px;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.review-input {
  border: 1px solid transparent;
  background: transparent;
  border-radius: 8px;
  box-shadow: none;
  min-height: 40px;
  padding: 8px 8px;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.35;
  width: 100%;
  min-width: 0;
}
.review-textarea {
  min-width: 0;
  min-height: 78px;
  line-height: 1.35;
  resize: vertical;
}
.audit-table textarea.review-input,
.audit-table input.review-input,
.audit-table select.review-input {
  height: auto;
}
.audit-table select.review-input {
  min-height: 54px;
}
.audit-table .cell-valid,
.audit-table .cell-error {
  vertical-align: top;
}
.review-input:hover,
.review-input:focus { border-color: #98b6d5; background: var(--theme-surface); outline: none; }
.cell-valid .review-input { border-color: transparent; background: transparent; }
.cell-error .review-input { border-color: #d92d20; background: #fff8f7; }
.bimh-field { display: grid; gap: 6px; min-width: 0; position: relative; }
.bimh-input-row { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 8px; align-items: start; }
.bimh-picker-button { grid-column: 1; grid-row: 1; min-width: 38px; width: 38px; height: 38px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.bimh-id-input { grid-column: 2; grid-row: 1; min-width: 0; }
.bimh-suggestion-menu {
  position: absolute;
  z-index: 45;
  display: grid;
  gap: 4px;
  background: var(--theme-surface);
  border: 1px solid var(--theme-border);
  border-radius: 10px;
  box-shadow: 0 14px 30px rgba(var(--theme-primary-rgb), 0.14);
  max-height: 320px;
  min-height: 0;
  overflow-y: auto;
  padding: 6px;
  justify-items: stretch;
}
.bimh-suggestion-menu[hidden] {
  display: none;
}
.bimh-suggestion-option {
  width: 100%;
  min-height: 0;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--theme-text);
  padding: 10px 14px 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 2px;
}
.bimh-suggestion-option:hover {
  background: var(--theme-primary-soft-2);
}
.bimh-suggestion-id {
  font-weight: 700;
  color: var(--theme-text);
  width: 100%;
  text-align: left;
  line-height: 1.25;
}
.bimh-suggestion-name {
  font-size: 12px;
  color: var(--theme-muted);
  width: 100%;
  text-align: left;
  line-height: 1.35;
}
.bimh-est-name-box {
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--theme-border-soft);
  border-radius: 8px;
  background: var(--theme-surface-2);
  color: #23415f;
  font-size: 12px;
  line-height: 1.35;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.bimh-est-name-box.is-not-found {
  color: var(--theme-danger);
  background: #fff1f1;
  border-color: #f0b7b7;
}
.bimh-est-name-inline {
  display: inline-block;
  min-height: 0;
  padding: 4px 8px;
}
.bimh-picker-modal-card { width: min(1100px, 100%); }
.bimh-picker-modal-card .flash-modal-head { align-items: flex-start; }
.bimh-picker-modal-card .welcome-modal-close {
  position: static;
  top: auto;
  right: auto;
  flex: 0 0 auto;
}
.bimh-picker-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 16px; }
.bimh-picker-table th,
.bimh-picker-table td { vertical-align: top; }
.audit-cell { min-width: 220px; }
.error-text { color: var(--theme-danger); font-size: 12px; margin-bottom: 4px; }
.success-text { color: var(--theme-success); font-weight: 700; }
.compact-grid { gap: 8px; }
/* The sign-in page follows the palette like everything else. It used to hold a
   frozen blue-green gradient, so choosing a colour changed every page except the
   first one anybody sees. */
.auth-body { min-height: 100vh; background: linear-gradient(135deg, var(--theme-primary-soft-2), var(--theme-accent-soft)); display: flex; align-items: center; justify-content: center; padding: 32px; }
.auth-wrap { width: min(1160px, 100%); display: grid; gap: 22px; justify-items: center; }
.auth-logo-row,
.auth-title-row { width: 100%; display: flex; justify-content: center; text-align: center; }
.logo-stack { display: inline-flex; align-items: center; justify-content: center; }
.auth-grid { width: min(1020px, 100%); display: grid; grid-template-columns: minmax(320px, 420px) minmax(380px, 560px); gap: 24px; align-items: stretch; justify-content: center; }
.auth-card, .auth-info { background: var(--theme-surface); border-radius: 18px; padding: 24px; border: 1px solid var(--theme-border-soft); box-shadow: 0 18px 50px rgba(var(--theme-primary-rgb), 0.12); }
.auth-info { display: flex; align-items: center; justify-content: center; }
.auth-info-content { width: min(100%, 520px); }
.auth-info-content > :first-child { margin-top: 0; }
.auth-info-content > :last-child { margin-bottom: 0; }
.auth-title-row h1 { margin: 0; font-size: clamp(32px, 4vw, 42px); line-height: 1.1; color: var(--theme-text); }
.auth-logo { max-height: 108px; width: auto; display: block; }
.login-grid { display: grid; gap: 12px; }
.login-password-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}
.login-password-wrap .login-input {
  margin: 0;
}
.login-password-toggle {
  min-width: 76px;
  padding: 10px 14px;
}
.login-title { font-size: 22px; font-weight: 700; }
.login-actions { display: grid; gap: 12px; }
.login-links { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.profile-form { max-width: 520px; }
.bulk-actions { margin-top: 10px; }
.office-manage-users-head { align-items: flex-start; }
.office-manage-users-permission { margin: 12px 0 16px; }
.office-users-table input[readonly] { background: var(--theme-surface-2); color: var(--theme-muted); }
.office-users-table td { vertical-align: middle; }
.office-users-table .action-row { flex-wrap: wrap; }
.column-visibility-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 14px; }
.column-visibility-grid .inline-check {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  column-gap: 8px;
}
.column-visibility-grid .inline-check input[type="checkbox"] {
  margin: 0;
  justify-self: end;
}
.column-visibility-grid .inline-check span {
  justify-self: start;
  padding-left: 2px;
}
.column-visibility-modal .modal-actions { flex-wrap: wrap; }
.asset-history-meta { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.field-help-modal-card { width: min(760px, 100%); }
.field-help-label { margin: 0 0 10px; font-weight: 700; color: var(--theme-text); }
.field-help-body { display: grid; gap: 10px; color: #36516d; }
.field-help-body p { margin: 0; }
.field-help-video { margin-top: 16px; display: grid; gap: 10px; }
.field-help-video iframe,
.field-help-video video {
  width: 100%;
  min-height: 320px;
  border: 0;
  border-radius: 12px;
  background: #000;
}
.declaration-toggle-row {
  justify-content: center;
  margin-bottom: 16px;
}
.declaration-status-table td,
.declaration-status-table th {
  vertical-align: middle;
}
.declaration-status-cell {
  font-size: 13px;
}
.declaration-status-cell.is-unsent {
  background: #feeceb;
  color: #c4322b;
}
.declaration-status-cell.is-sent {
  background: var(--theme-primary);
  color: #fff;
}
.btn-danger-soft {
  background: #fff1ef;
  color: #c4322b;
}
.btn-danger-soft:hover {
  background: #c4322b;
  color: #fff;
}
.asset-history-list { display: grid; gap: 12px; }
.asset-history-entry { border: 1px solid var(--theme-border-soft); border-radius: 12px; padding: 12px 14px; background: var(--theme-surface-2); }
.asset-history-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.asset-history-details { display: grid; gap: 6px; }
.asset-history-detail-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-start; }
.asset-history-detail-label { font-weight: 700; color: var(--theme-text); min-width: 120px; }
.file-link-list { display: flex; gap: 6px; flex-wrap: wrap; align-items: flex-start; max-width: 100%; }
.file-delete-chip { display: grid; gap: 6px; }
.file-cell-meta { margin-bottom: 6px; font-size: 12px; color: var(--theme-muted); }
.inline-file-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.inline-file-upload-form { display: inline-flex; align-items: center; margin: 6px 0 0; }
.inline-file-add-button { min-width: 0; }
.file-chip {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--theme-border-soft);
  background: var(--theme-surface-2);
  color: var(--theme-text);
  box-shadow: 0 4px 10px rgba(var(--theme-primary-rgb), 0.06);
}
.file-chip-icon-only {
  width: 32px;
  min-width: 32px;
  height: 32px;
  flex: 0 0 auto;
  padding: 0;
  gap: 0;
  justify-content: center;
  border-radius: 10px;
}
.file-chip:hover { border-color: #98b6d5; background: var(--theme-surface); }
.file-chip.is-pdf { border-left: 4px solid #c7362f; }
.file-chip.is-image { border-left: 4px solid #2b8a5c; }
.file-chip.is-doc { border-left: 4px solid #1f5faa; }
.file-chip.is-sheet { border-left: 4px solid #1f7a52; }
.file-chip.is-text { border-left: 4px solid #7a5f1f; }
.file-chip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #fff;
  background: linear-gradient(180deg, #dd5a52, var(--theme-danger));
}
.file-chip-icon-only .file-chip-icon {
  width: 22px;
  height: 22px;
  font-size: 9px;
  border-radius: 6px;
}
.file-chip.is-image .file-chip-icon { background: linear-gradient(180deg, #3da271, var(--theme-secondary)); }
.file-chip.is-doc .file-chip-icon { background: linear-gradient(180deg, #4b87d9, #1f5faa); }
.file-chip.is-sheet .file-chip-icon { background: linear-gradient(180deg, #3da271, #1f7a52); }
.file-chip.is-text .file-chip-icon { background: linear-gradient(180deg, #c89b43, #7a5f1f); }
.file-chip-name {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (min-width: 768px) and (max-width: 1199px) {
  .download-token-helper-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 1200px) {
  .download-token-helper-grid {
    grid-template-columns: repeat(10, minmax(0, 1fr));
  }
}

@media (max-width: 1200px) {
  .container { padding: 16px; }
  .split, .auth-grid { grid-template-columns: 1fr; }
  .nav { padding: 16px; align-items: flex-start; flex-direction: column; }
  .modal-card, .modal-wide, .asset-entry-modal { width: 100%; min-width: 0; }
  .hero-row,
  .hero-actions { flex-wrap: wrap; }
  .hero-row { min-height: 0; }
  .hero-title { margin-bottom: 12px; }
  .download-modal-row { grid-template-columns: 1fr; }
  .download-segment-config-grid,
  .download-date-range,
  .download-sort-row {
    grid-template-columns: 1fr;
  }
  .download-filter-box {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .audit-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .auth-wrap { gap: 18px; }
  .auth-grid { width: min(540px, 100%); }
  .asset-category-grid .table-wrap {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
  }
  .asset-category-grid table {
    width: max-content;
    min-width: 100%;
    table-layout: auto;
  }
  .asset-category-grid th,
  .asset-category-grid td {
    white-space: nowrap;
    word-break: normal;
    overflow-wrap: normal;
  }
  .asset-history-head,
  .asset-history-detail-row { display: grid; }
  .time-filter-datetime-row { grid-template-columns: minmax(0, 1fr); }
  .column-visibility-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .column-visibility-grid { grid-template-columns: minmax(0, 1fr); }
  .download-filter-box { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .audit-grid { grid-template-columns: minmax(0, 1fr); }
}


.audit-detail-row {
  cursor: pointer;
}
.audit-detail-row:focus-visible {
  outline: 2px solid var(--theme-primary);
  outline-offset: -2px;
}
.audit-detail-row.is-active-audit-row td {
  background: var(--theme-primary-soft-2);
}
.audit-detail-modal-card {
  width: min(920px, 100%);
}
.audit-detail-toggle-bar {
  margin-bottom: 14px;
}
.audit-detail-content {
  min-height: 220px;
}
.audit-detail-loading {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--theme-muted);
}
.audit-detail-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.audit-detail-list-item,
.audit-detail-tree-node {
  border: 1px solid var(--theme-border-soft);
  border-radius: 12px;
  padding: 10px 12px;
}
.audit-detail-list-item.is-provided,
.audit-detail-tree-node.is-provided {
  background: #e8f7ef;
  color: #11613f;
  border-color: #b9e6cf;
}
.audit-detail-list-item.is-missing,
.audit-detail-tree-node.is-missing {
  background: #fdeceb;
  color: #a33630;
  border-color: #f4c5c1;
}
.audit-detail-list-item.is-na,
.audit-detail-tree-node.is-na {
  background: whitesmoke;
  color: #111111;
  border-color: var(--theme-border-soft);
}
.audit-detail-node-label {
  font-weight: 600;
}
.audit-detail-tree .download-filter-tree-children {
  margin-top: 10px;
}

.office-row-inactive td {
  background: #e5e7eb;
  color: var(--theme-band-bg);
}
.office-row-inactive td .status-inactive {
  color: var(--theme-band-bg);
}
.office-row-inactive input,
.office-row-inactive select,
.office-row-inactive textarea {
  background: #f3f4f6;
  color: var(--theme-band-bg);
  border-color: var(--theme-border-soft);
}
.audit-page-topbar {
  justify-content: space-between;
  align-items: center;
}
.audit-detail-modal-card {
  position: relative;
  width: min(920px, 100%);
  padding-top: 48px;
}
.audit-detail-close {
  position: absolute;
  top: 10px;
  right: 10px;
  margin: 0;
}
.audit-detail-head {
  margin-bottom: 8px;
}
.audit-detail-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.audit-detail-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.audit-detail-count {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--theme-surface-2);
  color: var(--theme-text);
  font-weight: 700;
}
.office-row-no-provider td {
  background: #eceff3;
  color: var(--theme-band-bg);
}
.office-row-no-provider td .status-inactive,
.office-row-no-provider td .status-active,
.office-row-no-provider td span {
  color: var(--theme-band-bg);
}
.office-row-no-provider input,
.office-row-no-provider select,
.office-row-no-provider textarea {
  background: #f5f6f8;
  color: var(--theme-band-bg);
  border-color: var(--theme-border-soft);
}
.board-embed-shell {
  width: 100%;
  max-width: none;
  padding: 16px;
}
.comparison-embed-body {
  margin: 0;
  background: #f3f7fb;
}
.board-embed-table-only {
  padding: 10px;
}
.board-embed-table-only .board-grid.asset-category-grid {
  gap: 12px;
}
.board-embed-table-only .operational-budget-card {
  margin: 0;
}
.comparison-filter-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
}
.comparison-filter-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.comparison-preview-summary {
  margin-top: 14px;
}
.comparison-split-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}
.comparison-pane {
  padding: 0;
  overflow: hidden;
}
.comparison-pane-head {
  padding: 18px 20px 0;
}
.comparison-frame {
  width: 100%;
  min-height: 78vh;
  border: 0;
  display: block;
  background: var(--theme-surface-2);
}
.comparison-empty-state {
  min-height: 78vh;
  display: grid;
  place-items: center;
  padding: 24px;
  color: var(--theme-muted);
  text-align: center;
}
@media (max-width: 900px) {
  .common-fields-template-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .audit-detail-toolbar {
    align-items: flex-start;
  }
  .comparison-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .comparison-split-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 560px) {
  .comparison-filter-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---- Password policy checklist (Phase 6c) ---- */
.pw-rules {
    list-style: none;
    margin: 4px 0 2px;
    padding: 10px 12px;
    border: 1px solid var(--theme-border-soft);
    border-radius: 6px;
    background: #f8f9fb;
    display: grid;
    gap: 6px;
    font-size: 13px;
}
.pw-rules li {
    display: flex;
    align-items: center;
    gap: 8px;
    transition: color .15s ease;
}
.pw-rules .pw-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    flex: 0 0 18px;
}
.pw-rules li.is-fail { color: #7a828e; }
.pw-rules li.is-fail .pw-mark { background: #fdeaea; color: #c0392b; }
.pw-rules li.is-pass { color: #1e7a46; font-weight: 500; }
.pw-rules li.is-pass .pw-mark { background: #e4f5ea; color: #1e7a46; }
button#pw-submit[disabled],
[data-pw-gated][disabled] { opacity: .5; cursor: not-allowed; }

/* Compact variant for password boxes that live inside a table cell (Offices
   "Manage Users", Users page reset). Hidden until the field is focused or
   filled, so the row height only grows while it is actually being used. */
.pw-rules-compact {
    display: none;
    margin: 6px 0 0;
    padding: 8px 9px;
    gap: 4px;
    font-size: 12px;
    min-width: 190px;
}
.pw-rules-compact.is-open { display: grid; }
.pw-rules-compact .pw-mark {
    width: 15px;
    height: 15px;
    flex: 0 0 15px;
    font-size: 10px;
}

/* ---- One-time credential handover modal (Phase 13) ---- */
.cred-card { max-width: 620px; }
.cred-warn { margin: 0 0 12px; }
.cred-grid {
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 6px 14px;
    margin: 0 0 10px;
    align-items: baseline;
}
.cred-grid dt { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: #6b727e; }
.cred-grid dd { margin: 0; word-break: break-all; }
.cred-link {
    display: inline-block;
    font-family: ui-monospace, Consolas, Menlo, monospace;
    font-size: 12px;
    letter-spacing: .06em;
    background: #f2f5f9;
    border: 1px solid var(--theme-border-soft);
    border-radius: 5px;
    padding: 6px 12px;
    user-select: all;
}
.cred-message {
    width: 100%;
    font-family: ui-monospace, Consolas, Menlo, monospace;
    font-size: 12px;
    line-height: 1.5;
    border: 1px solid var(--theme-border-soft);
    border-radius: 5px;
    padding: 8px 10px;
    background: #fbfcfd;
    resize: vertical;
}
.cred-actions { flex-wrap: wrap; gap: 8px; }
a.cred-wa {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    background: #25d366;
    border-color: #25d366;
    color: #05341a;
    font-weight: 600;
}
a.cred-wa:hover { background: #1fb855; }
.cred-note { margin-top: 8px; }

/* Phase 13 — minimal setup-link modal */
.cred-lead { margin: 0 0 16px; font-size: 14px; line-height: 1.6; }
.cred-mail-form { display: inline; margin: 0; }

/* Phase 13b — Email Sending card */
.mail-steps { margin: 8px 0 12px; padding-left: 20px; font-size: 13px; line-height: 1.7; color: #4a515c; }
.mail-steps code { background: #eef1f6; padding: 1px 5px; border-radius: 3px; font-size: 12px; }
.mail-on { color: #1e7a46; }
.mail-off { color: #b3541e; }
.mail-test-form { margin-top: 14px; padding-top: 14px; border-top: 1px solid #e3e7ee; }
.mail-advanced { border: 1px solid #e3e7ee; border-radius: 6px; padding: 10px 12px; background: #fafbfc; }
.mail-advanced summary { cursor: pointer; font-size: 13px; font-weight: 600; color: #4a515c; }
.mail-advanced > label { margin-top: 10px; display: block; }

/* ---- Session expiry warning (Phase 6f) ----
   Fixed to the bottom so it never covers the board toolbar or a form field
   the user is in the middle of filling. */
.session-warning {
    position: fixed;
    left: 50%;
    bottom: 18px;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 14px;
    max-width: min(680px, calc(100vw - 32px));
    padding: 12px 16px;
    border: 1px solid #f0c36d;
    border-radius: 10px;
    background: #fff8e6;
    color: #6b4d09;
    font-size: 14px;
    box-shadow: 0 10px 30px rgba(var(--theme-primary-rgb), 0.18);
}
.session-warning-text { flex: 1 1 auto; }
.session-warning .btn-small { flex: 0 0 auto; white-space: nowrap; }
@media (max-width: 560px) {
    .session-warning { flex-direction: column; align-items: stretch; text-align: center; }
}

/* ---- Log monitor (Phase 14) ---- */
.log-summary { display: flex; gap: 10px; flex-wrap: wrap; margin: 4px 0 14px; }
.log-chip {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    min-width: 96px; padding: 10px 14px; border-radius: 10px;
    border: 1px solid var(--theme-border); background: var(--theme-primary-soft-3);
    color: var(--theme-text); text-decoration: none;
}
.log-chip-count { font-size: 20px; font-weight: 700; line-height: 1.1; }
.log-chip-label { font-size: 12px; color: var(--theme-muted); }
.log-chip.log-outcome-blocked { background: #fff4e5; border-color: #f0c36d; }
.log-chip.log-outcome-crashed { background: #fdeceb; border-color: #f0b3ae; }
.log-chip.log-outcome-failed  { background: #fdf3e7; border-color: #eec99a; }
.log-chip.log-outcome-partial { background: #fbf7e3; border-color: #e6d99a; }
.log-chip.log-outcome-success { background: #e9f7ef; border-color: #a8ddbf; }

.log-quickviews { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.log-quickviews .button-link { background: var(--theme-border-soft); color: var(--theme-primary); }
.log-quickviews .button-link.is-active { background: var(--theme-primary); color: #fff; }

.log-filter-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); align-items: end; }
.log-filter-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.log-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.log-table th, .log-table td { padding: 8px 10px; border-bottom: 1px solid #e7edf4; vertical-align: top; text-align: left; }
.log-table th { background: var(--theme-primary-soft-2); font-weight: 600; white-space: nowrap; }
.log-when, .log-route { white-space: nowrap; }
.log-event code { font-size: 12px; background: var(--theme-primary-soft-3); padding: 2px 6px; border-radius: 5px; }
.log-empty { text-align: center; color: var(--theme-muted); padding: 26px; }

.log-badge {
    display: inline-block; padding: 2px 9px; border-radius: 999px;
    font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .02em;
}
.log-badge.log-outcome-success { background: #e4f5ea; color: #1e7a46; }
.log-badge.log-outcome-partial { background: #fbf3d6; color: #7a6212; }
.log-badge.log-outcome-blocked { background: #fdeccd; color: #8a5b00; }
.log-badge.log-outcome-failed  { background: #fde4d3; color: #9a4a12; }
.log-badge.log-outcome-crashed { background: #fdeaea; color: var(--theme-danger); }

.log-row.log-sev-error td, .log-row.log-sev-critical td { background: #fffaf9; }
.log-context summary { cursor: pointer; color: var(--theme-primary); font-size: 12px; }
.log-context pre {
    margin: 6px 0 0; padding: 10px; border-radius: 8px; max-height: 260px; overflow: auto;
    background: var(--theme-surface-2); border: 1px solid #e2e9f1; font-size: 12px; white-space: pre-wrap; word-break: break-word;
}
.log-request-banner { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; background: #eef5fd; }
.log-pager { display: flex; gap: 14px; align-items: center; justify-content: center; margin-top: 14px; }

/* ---- Completeness report (Phase 15 step 0) ---------------------------------
   Percentages are the point of this page, so the bar carries the meaning and the
   number confirms it. Colour is never the only signal -- the figure is always
   printed next to it. */
.cmp-headline {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 12px;
}
.cmp-headline-figure {
    font-size: 40px;
    font-weight: 700;
    line-height: 1;
    color: var(--accent, var(--theme-primary));
}
.cmp-headline-text { flex: 1 1 260px; }
.cmp-headline-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.cmp-table { width: 100%; border-collapse: collapse; }
.cmp-table th,
.cmp-table td { padding: 8px 10px; border-bottom: 1px solid rgba(128, 128, 128, 0.22); }
.cmp-table tbody tr.is-selected { background: rgba(var(--theme-primary-rgb), 0.07); }
.cmp-num { text-align: right; white-space: nowrap; }
.cmp-progress { width: 210px; white-space: nowrap; }
.cmp-weak { font-size: 13px; }

.cmp-bar {
    display: inline-block;
    width: 120px;
    height: 9px;
    border-radius: 5px;
    background: rgba(128, 128, 128, 0.25);
    overflow: hidden;
    vertical-align: middle;
}
.cmp-bar-fill { display: block; height: 100%; border-radius: 5px; }
.cmp-bar-fill.is-good { background: #1e7a46; }
.cmp-bar-fill.is-mid  { background: #b8860b; }
.cmp-bar-fill.is-bad  { background: var(--theme-danger); }
.cmp-pct { display: inline-block; min-width: 52px; text-align: right; font-variant-numeric: tabular-nums; }

.cmp-required {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 11px;
    background: rgba(180, 35, 24, 0.12);
    color: var(--theme-danger);
}

/* ---- AI provider setup (Phase 15b) -----------------------------------------
   The page leads with "pick a service" because the base URL and the exact model
   string are the two fields nobody can guess or verify. */
.ai-steps { margin: 8px 0 16px; padding-left: 22px; line-height: 1.7; }
.ai-steps li { margin-bottom: 4px; }

.ai-preset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
    margin: 12px 0 16px;
}
.ai-preset-card {
    border: 1px solid rgba(128, 128, 128, 0.3);
    border-radius: 10px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.ai-preset-card.is-chosen {
    border-color: #1e7a46;
    box-shadow: 0 0 0 2px rgba(30, 122, 70, 0.18);
}
.ai-preset-card h4 { margin: 0; font-size: 14px; line-height: 1.4; }
.ai-preset-card p { margin: 0; font-size: 13px; }
.ai-preset-why { color: inherit; }
.ai-preset-free { opacity: 0.8; }
.ai-preset-card .btn-small { align-self: flex-start; margin-top: auto; }

.ai-advanced {
    border: 1px dashed rgba(128, 128, 128, 0.4);
    border-radius: 8px;
    padding: 10px 12px;
}
.ai-advanced summary { cursor: pointer; font-size: 13px; opacity: 0.85; }
.ai-advanced label { margin-top: 10px; }

.ai-model-actions { display: inline-flex; align-items: center; gap: 10px; margin-top: 6px; flex-wrap: wrap; }
.ai-model-actions .muted { font-size: 12px; }

/* ---- AI analysis (Phase 15c) ------------------------------------------------ */
.log-ai-panel {
    margin: 12px 0;
    padding: 10px 12px;
    border: 1px solid rgba(128, 128, 128, 0.3);
    border-radius: 8px;
}
.log-ai-form { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.log-ai-label { display: grid; gap: 4px; font-size: 13px; }
.log-ai-label select { min-width: 220px; }
.log-ai-note { flex: 1 1 260px; font-size: 12px; }

.ai-evidence,
.ai-brief-text {
    white-space: pre-wrap;
    word-break: break-word;
    font-family: ui-monospace, Consolas, "Courier New", monospace;
    font-size: 12.5px;
    line-height: 1.65;
    background: rgba(128, 128, 128, 0.08);
    border: 1px solid rgba(128, 128, 128, 0.22);
    border-radius: 8px;
    padding: 12px 14px;
    overflow-x: auto;
    margin: 0;
}
.ai-brief-text { font-family: inherit; font-size: 14px; }
.visually-hidden {
    position: absolute; width: 1px; height: 1px; margin: -1px;
    padding: 0; overflow: hidden; clip: rect(0 0 0 0); border: 0;
}

/* ---- AI bench (Phase 15e) --------------------------------------------------- */
.ai-rate-form { display: grid; gap: 10px; max-width: 640px; }
.ai-rate-options { display: flex; gap: 16px; flex-wrap: wrap; }
.ai-rate-option { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }

.ai-compare-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 14px;
}
.ai-compare-col {
    border: 1px solid rgba(128, 128, 128, 0.28);
    border-radius: 10px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}
.ai-compare-col.is-current { border-color: var(--theme-primary); box-shadow: 0 0 0 2px rgba(var(--theme-primary-rgb), 0.15); }
.ai-compare-col h4 { margin: 0; font-size: 13px; word-break: break-all; }
.ai-compare-col p { margin: 0; font-size: 12px; }
.ai-compare-note { font-style: italic; }
.ai-compare-text {
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 12px;
    line-height: 1.55;
    max-height: 320px;
    overflow-y: auto;
    background: rgba(128, 128, 128, 0.08);
    border-radius: 6px;
    padding: 10px;
    margin: 0;
}
.ai-compare-col .btn-small { align-self: flex-start; margin-top: auto; }

.ai-bulk-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 6px;
    margin: 10px 0;
}
.ai-bulk-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    padding: 5px 8px;
    border: 1px solid rgba(128, 128, 128, 0.22);
    border-radius: 6px;
    word-break: break-all;
}

/* Linked sheets (L2): a cell that fills itself, and a cell with its own rule. */
.cell-linked {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.cell-linked code {
    font-size: 11px;
    opacity: 0.75;
    word-break: break-all;
}
.cell-linked-tag {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: #e8f0fe;
    color: #1a4d8f;
    white-space: nowrap;
}
.cell-rule-tag {
    margin-top: 3px;
    font-size: 10px;
    color: #8a5a00;
    white-space: nowrap;
}

/* Linked sheets: the divider between what the superadmin sets and what the
   office fills in, and the per-cell popup. */
.col-divider {
    width: 6px;
    min-width: 6px;
    padding: 0;
    background: repeating-linear-gradient(45deg, #d8dde5, #d8dde5 3px, transparent 3px, transparent 6px);
}
th.col-ordinary { font-style: italic; }
td.col-ordinary { vertical-align: top; }
.cell-config-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(20, 25, 35, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 900;
}
.cell-config-backdrop[hidden] { display: none; }
.cell-config-box {
    background: var(--theme-surface);
    border-radius: 6px;
    padding: 18px 20px;
    width: min(620px, 92vw);
    max-height: 88vh;
    overflow: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}
.cell-config-box textarea { width: 100%; font-family: ui-monospace, Consolas, monospace; }
.cc-picker { display: flex; gap: 8px; margin: 6px 0 10px; }
.cc-picker select { flex: 1; min-width: 0; }

/* Phase D: the value box on the "Set this cell" popup, and the tag that shows a
   stored figure on the grid.

   background and color travel together here on purpose - CLAUDE.md L6d. The tag uses
   --theme-primary-soft, the tint made to sit on a surface (9.81:1 in the default
   palette, never below 13.8 in the other fourteen), NOT --theme-band-bg, which is the
   dark band colour and rendered as a solid black rectangle the last time it was used
   behind text on a light panel. */
.cc-value-block { margin: 10px 0 4px; }
.cc-value-block > label { display: block; font-weight: 600; margin-bottom: 4px; }
.cc-value-control[hidden] { display: none; }
.cc-value-control .hint { margin: 0; }
.cc-value-input { width: 100%; }
.cell-value-tag {
    display: inline-block;
    margin-top: 3px;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 10px;
    background: var(--theme-primary-soft);
    color: var(--theme-text);
    white-space: nowrap;
}

/* A cell filled from a linked sheet: shown, never typed into. */
.linked-cell-value {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
    background: #eef2f7;
    color: #2c3a4b;
    border: 1px dashed #b9c4d2;
    cursor: help;
}
.linked-cell-value.is-partial {
    background: #fff6e5;
    border-color: #e0b877;
    color: #7a5300;
}

/* A linked cell that can be clicked through to the sheet behind it. */
a.linked-cell-value {
    text-decoration: none;
}
a.linked-cell-value:hover {
    background: #dde7f3;
    border-style: solid;
}
a.linked-cell-value.is-partial:hover {
    background: #ffeccc;
}

/* The system-health notice: shown to a superadmin only, and only when something
   is genuinely wrong. */
.health-modal-card { max-width: 640px; }
.health-issue {
    border-left: 3px solid #d98a24;
    background: #fffaf2;
    padding: 10px 14px;
    margin: 12px 0;
    border-radius: 3px;
}
.health-issue h4 { margin: 0 0 6px; font-size: 15px; }
.health-issue p { margin: 0 0 8px; }
.health-affected { font-size: 13px; }
.health-fix-form { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* Phase L4. A value the officer cannot type into is shown WITHOUT a box, so the
   screen never offers an input that will not accept anything. The sentence under it
   says which of the three reasons it is. */
/* An inherited or calculated cell in the edit box.
   The owner first asked for no box at all here, so a locked field could not be mistaken
   for a typeable one. He has since asked for the box back, in a LIGHTER colour - so it
   still reads as a field and lines up with the inputs above and below it, while staying
   visibly not-editable. Same geometry as `input` (10px radius, 10/12 padding, 1px) with
   the soft border token instead of the full-strength one, and the page ground instead of
   the surface. */
.entry-locked-value {
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--theme-text);
  border: 1px solid var(--theme-border-soft);
  border-radius: 10px;
  background: var(--theme-bg);
  min-height: 42px;
  display: flex;
  align-items: center;
  word-break: break-word;
}
.entry-locked-value.is-empty {
  color: var(--theme-muted);
  font-weight: 500;
}
.entry-locked-formula {
  display: block;
  margin-top: 4px;
  padding: 5px 8px;
  border-radius: 6px;
  background: var(--theme-primary-soft-3);
  color: #33475e;
  font-size: 12px;
  word-break: break-all;
}

/* Phase L5. The sheets a declared segment draws on must close with it. */
.declaration-align-card {
  border-left: 4px solid var(--theme-warning, #d98324);
}
.declaration-align-card h4 {
  margin: 0 0 6px;
}
.declaration-closed-note {
  padding: 8px 12px;
  border-radius: 8px;
  background: #fdf3e6;
  color: #7a4b12;
  border: 1px solid #f0d9b8;
  font-size: 13px;
  max-width: 460px;
}

/* Audit: narrow a detail view to one superadmin-defined fixed row. */
.audit-fixed-row-button.is-filtered {
  background: var(--theme-primary);
  border-color: var(--theme-primary);
  color: #fff;
}

/* Phase L5b. Co-declaration or individual declaration, per segment - switchable
   both ways, because a setting you cannot take back is a trap, not a setting. */
.declaration-mode-card { border-left: 4px solid var(--theme-primary); }
.declaration-mode-card h4, .declaration-align-card h4 { margin: 0 0 6px; }
.declaration-mode-form { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.declaration-mode-option {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 8px 10px;
  border: 1px solid var(--theme-border-soft);
  border-radius: 8px;
  width: 100%;
  cursor: pointer;
}
.declaration-mode-option.is-current {
  border-color: var(--theme-primary);
  background: var(--theme-primary-soft-3);
}
.declaration-mode-option span.hint { display: block; margin-top: 2px; }
.declaration-align-card.is-aligned { border-left-color: var(--theme-success, #2e7d5b); }

/* Phase L5b. A column can be compulsory on ONE fixed row and optional on the rest.
   Floated to the corner of the cell so it never pushes the value about, and it sits
   in the same place on a text cell, a box, and a file chip. */
td.has-cell-rule { position: relative; }
.cell-mandatory-marker {
  float: right;
  margin-left: 4px;
  font-size: 14px;
  line-height: 1;
}
.cell-mandatory-marker.is-exempt {
  color: #a8bccd;
  text-decoration: line-through;
}


/* The radio drives selection but takes no space: the whole card is the target. */
.theme-card > input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.theme-card > input[type="radio"]:focus-visible ~ .theme-mock { outline: 3px solid var(--theme-primary); outline-offset: -3px; }

/* --- the miniature ------------------------------------------------------- */
.theme-mock { display: block; background: var(--theme-bg); }
.theme-mock-nav {
  display: block;
  height: 16px;
  background: linear-gradient(90deg, var(--theme-nav-start), var(--theme-nav-end));
}
.theme-mock-body { display: block; padding: 8px; }
.theme-mock-card {
  display: block;
  background: var(--theme-surface);
  border: 1px solid var(--theme-border);
  border-radius: 6px;
  padding: 7px;
  margin-bottom: 7px;
}
.theme-mock-line { display: block; height: 5px; border-radius: 3px; background: var(--theme-primary-soft); margin-bottom: 5px; }
.theme-mock-line.is-strong { width: 62%; background: var(--theme-text); opacity: .75; }
.theme-mock-row { display: flex; gap: 5px; align-items: center; }
.theme-mock-btn { display: block; width: 42px; height: 12px; border-radius: 4px; background: var(--theme-primary); }
.theme-mock-chip { display: block; width: 26px; height: 12px; border-radius: 4px; background: var(--theme-secondary); }
.theme-mock-table { display: block; border: 1px solid var(--theme-border); border-radius: 6px; overflow: hidden; }
.theme-mock-th { display: block; height: 10px; background: var(--theme-primary-soft-3); }
.theme-mock-td { display: block; height: 9px; background: var(--theme-surface); border-top: 1px solid var(--theme-border); }
.theme-mock-total { display: block; height: 11px; background: var(--theme-band-bg); }

/* --- the label under it -------------------------------------------------- */
.theme-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  background: var(--theme-surface);
  border-top: 1px solid var(--theme-border-soft);
}
.theme-card-name { font-size: 13px; font-weight: 600; color: var(--theme-text); }
.theme-card-swatches { display: inline-flex; gap: 3px; }
.theme-swatch { width: 11px; height: 11px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .12); }
.theme-swatch.sw-primary { background: var(--theme-primary); }
.theme-swatch.sw-secondary { background: var(--theme-secondary); }
.theme-swatch.sw-success { background: var(--theme-success); }
.theme-swatch.sw-danger { background: var(--theme-danger); }
.theme-card-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .02em;
  background: var(--theme-primary);
  color: #fff;
}
.theme-gallery-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }


/* ===========================================================================
   THE SIX SYSTEM ARCHITECTURES

   Not veneers. Each one below redefines the whole shell - the navigation, the
   page frame, cards, tables, forms, buttons and modals - so every page in the
   system follows it: board, admin, audit, declarations, offices, downloads,
   profile, the lot.

   Colour is a SEPARATE axis. Any of the eleven palettes can be worn by any of
   these six, because nothing here sets a colour that is not a token.

   `layout-current` appears nowhere in this file, on purpose. The owner asked
   for the present look to stay the default, so a system nobody has touched must
   not pick up a single rule from here.
   =========================================================================== */


/* ===========================================================================
   SIDEBAR  -  the navigation stands on the left, all sixteen links visible
   ---------------------------------------------------------------------------
   A superadmin has 16 nav links. Wrapped across a horizontal bar they take two
   or three rows and re-flow as the window changes; standing in a column they
   read as a menu and hold still.
   =========================================================================== */
/* :not(.auth-body) is load-bearing. This grid is the APP shell - a navigation
   column and a content column. The sign-in page has neither, so without the
   exclusion its card landed inside the 224px navigation column and spilled out
   of it, leaving the whole right-hand side of the screen empty. */
body.layout-sidebar:not(.auth-body) { display: grid; grid-template-columns: 224px minmax(0, 1fr); min-height: 100vh; }
body.layout-sidebar:not(.auth-body) .nav {
  grid-column: 1; grid-row: 1 / span 3;
  flex-direction: column; align-items: stretch; justify-content: flex-start;
  gap: 2px; padding: 16px 12px;
  background: linear-gradient(180deg, var(--theme-nav-start), var(--theme-nav-end));
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
body.layout-sidebar .nav-title { font-size: 15px; line-height: 1.3; margin-bottom: 12px; padding: 0 6px; }
body.layout-sidebar .nav-links { flex-direction: column; align-items: stretch; gap: 1px; }
body.layout-sidebar .nav-links a,
body.layout-sidebar .nav-links button {
  display: block; width: 100%; text-align: left;
  padding: 7px 10px; border-radius: 6px; font-size: 13px; min-height: 0;
  background: transparent; border: 0; color: #fff;
}
body.layout-sidebar .nav-links a:hover,
body.layout-sidebar .nav-links button:hover { background: rgba(255, 255, 255, .14); }
body.layout-sidebar .logout-form { width: 100%; margin-top: 8px; }
body.layout-sidebar:not(.auth-body) .container { grid-column: 2; max-width: none; padding: 18px 22px; }
body.layout-sidebar .card { border-radius: 10px; box-shadow: 0 1px 3px rgba(var(--theme-primary-rgb), .08); }
body.layout-sidebar th { background: var(--theme-primary-soft-3); font-size: 12px; letter-spacing: .03em; }
body.layout-sidebar td { padding: 7px 10px; }
body.layout-sidebar table { border-radius: 8px; overflow: hidden; }
@media (max-width: 900px) {
  body.layout-sidebar { display: block; }
  body.layout-sidebar:not(.auth-body) .nav { position: static; height: auto; flex-direction: row; flex-wrap: wrap; }
  body.layout-sidebar .nav-links { flex-direction: row; flex-wrap: wrap; }
  body.layout-sidebar .nav-links a, body.layout-sidebar .nav-links button { width: auto; }
}


/* ===========================================================================
   WIDE  -  nothing between the data and the edge of the screen
   ---------------------------------------------------------------------------
   For 19-column, 2,586-row segments. The navigation compresses to a thin strip
   and every remaining pixel goes to the table.
   =========================================================================== */
body.layout-wide .nav { padding: 8px 16px; }
body.layout-wide .nav-title { font-size: 15px; }
body.layout-wide .nav-links { gap: 8px; }
body.layout-wide .nav-links a { font-size: 12.5px; }
body.layout-wide .container { padding: 10px 12px; max-width: none; }
body.layout-wide .card { border-radius: 6px; padding: 12px; margin-bottom: 12px; box-shadow: none; border: 1px solid var(--theme-border-soft); }
body.layout-wide .table-wrap { overflow-x: auto; }
body.layout-wide th, body.layout-wide td { padding: 6px 8px; }
body.layout-wide .hero-card { border-radius: 8px; padding: 12px 14px; }


/* ===========================================================================
   COMPACT  -  the most rows a screen can hold
   ---------------------------------------------------------------------------
   Every control shrinks together, not just the table: a tight table under
   full-height buttons looks broken. Row padding 8px -> 3px, text 13px -> 12px.
   =========================================================================== */
body.layout-compact { font-size: 13px; }
body.layout-compact .nav { padding: 6px 14px; }
body.layout-compact .nav-title { font-size: 14px; }
body.layout-compact .nav-links { gap: 7px; }
body.layout-compact .nav-links a { font-size: 12px; }
body.layout-compact .container { padding: 8px 10px; max-width: none; }
body.layout-compact .card { padding: 10px; border-radius: 4px; margin-bottom: 10px; box-shadow: none; border: 1px solid var(--theme-border-soft); }
body.layout-compact .card-head { margin-bottom: 6px; }
body.layout-compact h1 { font-size: 19px; }
body.layout-compact h2 { font-size: 16px; }
body.layout-compact h3 { font-size: 14px; }
body.layout-compact th, body.layout-compact td { padding: 3px 7px; font-size: 12px; }
body.layout-compact button,
body.layout-compact .button-link { min-height: 30px; padding: 5px 10px; font-size: 12.5px; border-radius: 5px; }
body.layout-compact .btn-small { min-height: 26px; padding: 3px 8px; font-size: 12px; }
body.layout-compact input, body.layout-compact select, body.layout-compact textarea { padding: 5px 7px; font-size: 12.5px; }
body.layout-compact input.inline-edit, body.layout-compact select.inline-edit { min-height: 26px; padding: 2px 6px; }
body.layout-compact .hint { font-size: 11.5px; }
body.layout-compact .modal-card { padding: 14px; border-radius: 6px; }
body.layout-compact .table-load-more-body td { padding: 3px 7px; }


/* ===========================================================================
   FOCUS  -  calm, roomy, made for a tablet in the field
   ---------------------------------------------------------------------------
   A measured column, generous spacing and targets big enough for a thumb.
   Tables still get their full width, because a register is a register.
   =========================================================================== */
body.layout-focus { font-size: 15px; }
body.layout-focus .nav { padding: 14px 20px; }
body.layout-focus .nav-links a { font-size: 14px; padding: 6px 4px; }
body.layout-focus .container { max-width: 1120px; margin: 0 auto; padding: 22px 20px; }
body.layout-focus .card { padding: 26px; border-radius: 14px; margin-bottom: 22px; box-shadow: 0 2px 10px rgba(var(--theme-primary-rgb), .07); }
body.layout-focus h2 { margin-bottom: 4px; }
body.layout-focus label { display: block; margin-bottom: 14px; font-size: 14px; }
body.layout-focus input, body.layout-focus select, body.layout-focus textarea { min-height: 46px; padding: 10px 12px; font-size: 15px; border-radius: 8px; }
body.layout-focus button,
body.layout-focus .button-link { min-height: 48px; padding: 12px 20px; font-size: 15px; border-radius: 8px; }
body.layout-focus .btn-small { min-height: 38px; padding: 8px 14px; font-size: 13.5px; }
body.layout-focus th, body.layout-focus td { padding: 11px 12px; font-size: 14px; }
body.layout-focus .hint { font-size: 13.5px; line-height: 1.6; }
body.layout-focus .modal-card { padding: 26px; border-radius: 14px; }
/* The table is the one thing allowed out of the measured column. */
body.layout-focus .operational-budget-card { max-width: none; }


/* ===========================================================================
   REGISTER  -  typeset like the paper book it replaces
   ---------------------------------------------------------------------------
   Serif, ruled columns, square corners, restrained ornament. What is on the
   screen and what comes out of the printer are the same document.
   =========================================================================== */
body.layout-register { font-family: Georgia, "Times New Roman", "Nirmala UI", "Kalpurush", serif; }
body.layout-register .nav {
  background: var(--theme-surface); color: var(--theme-text);
  border-bottom: 3px double var(--theme-text); padding: 12px 22px;
}
body.layout-register .nav-title { font-size: 20px; letter-spacing: .01em; }
body.layout-register .nav-links a,
body.layout-register .nav-links button { color: var(--theme-text); font-size: 13px; }
body.layout-register .container { max-width: 1320px; margin: 0 auto; padding: 20px; }
body.layout-register .card {
  border-radius: 0; border: 1px solid var(--theme-text);
  box-shadow: none; background: var(--theme-surface); padding: 18px 20px;
}
body.layout-register .card > h1:first-child,
body.layout-register .card > h2:first-child,
body.layout-register .card > h3:first-child {
  text-align: center; letter-spacing: .03em; font-weight: 700;
  border-bottom: 1px solid var(--theme-border); padding-bottom: 8px; margin-bottom: 12px;
}
body.layout-register table { border: 1px solid var(--theme-text); border-collapse: collapse; }
body.layout-register th {
  background: transparent; border-bottom: 2px solid var(--theme-text);
  border-right: 1px solid var(--theme-border);
  text-transform: uppercase; letter-spacing: .06em; font-size: 11px; font-family: var(--sans, inherit);
}
body.layout-register td { border-bottom: 1px solid var(--theme-border); border-right: 1px solid var(--theme-border); }
body.layout-register th:last-child, body.layout-register td:last-child { border-right: 0; }
body.layout-register button,
body.layout-register .button-link { border-radius: 2px; font-family: inherit; }
body.layout-register input, body.layout-register select, body.layout-register textarea { border-radius: 2px; }
body.layout-register .modal-card { border-radius: 0; border: 1px solid var(--theme-text); }
@media print {
  body.layout-register .nav,
  body.layout-register .card-head-actions,
  body.layout-register .toolbar-row,
  body.layout-register button,
  body.layout-register .button-link { display: none !important; }
  body.layout-register .card { border: 1px solid var(--theme-text); page-break-inside: avoid; }
}


/* ===========================================================================
   CONSOLE  -  quiet chrome, the content does the talking
   ---------------------------------------------------------------------------
   Flat surfaces, hairline rules, no shadows anywhere, a pale navigation strip
   instead of a coloured band. For long working days in front of the screen.
   =========================================================================== */
body.layout-console .nav {
  background: var(--theme-surface); color: var(--theme-text);
  border-bottom: 1px solid var(--theme-border); padding: 10px 18px;
}
body.layout-console .nav-title { font-size: 15px; font-weight: 650; }
body.layout-console .nav-links a,
body.layout-console .nav-links button {
  color: var(--theme-text); font-size: 12.5px; padding: 5px 9px;
  border-radius: 6px; background: transparent; border: 1px solid transparent; min-height: 0;
}
body.layout-console .nav-links a:hover,
body.layout-console .nav-links button:hover { background: var(--theme-primary-soft-2); border-color: var(--theme-border-soft); }
body.layout-console .container { max-width: none; padding: 14px 16px; }
body.layout-console .card {
  border-radius: 6px; box-shadow: none;
  border: 1px solid var(--theme-border-soft); padding: 16px;
}
body.layout-console .hero-card { background: var(--theme-surface); box-shadow: none; border-radius: 6px; }
body.layout-console th {
  background: transparent; border-bottom: 2px solid var(--theme-border);
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em;
}
body.layout-console td { border-bottom: 1px solid var(--theme-border-soft); }
body.layout-console button,
body.layout-console .button-link { border-radius: 6px; box-shadow: none; }
body.layout-console .modal-card { border-radius: 6px; box-shadow: 0 10px 30px rgba(0, 0, 0, .16); }
body.layout-console input, body.layout-console select, body.layout-console textarea { border-radius: 6px; }

/* The whole appearance control: two dropdowns and a Save. */
.appearance-form { display: flex; flex-direction: column; gap: 18px; max-width: 640px; }
.appearance-field { display: flex; flex-direction: column; gap: 5px; }
.appearance-label { font-weight: 600; font-size: 13.5px; color: var(--theme-text); }
.appearance-field select { max-width: 340px; }
.appearance-fit { font-style: italic; opacity: .85; }
.appearance-swatches { display: inline-flex; gap: 0; height: 22px; width: 260px; border: 1px solid var(--theme-border); border-radius: 4px; overflow: hidden; margin-top: 4px; }
.appearance-swatch { flex: 1; }
.appearance-swatch.sw-nav { background: linear-gradient(90deg, var(--theme-nav-start), var(--theme-nav-end)); }
.appearance-swatch.sw-primary { background: var(--theme-primary); }
.appearance-swatch.sw-secondary { background: var(--theme-secondary); }
.appearance-swatch.sw-soft { background: var(--theme-primary-soft); }
.appearance-swatch.sw-bg { background: var(--theme-bg); }
.appearance-swatch.sw-band { background: var(--theme-band-bg); }
.appearance-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ===========================================================================
   THE SIGN-IN PAGE, PER ARCHITECTURE

   The first screen anybody sees has to belong to the same system as the rest.
   Before this it wore neither the colour nor the layout: a frozen blue-green
   gradient and one fixed card, whatever was chosen elsewhere.

   `layout-current` is absent here too, so the sign-in page of an untouched
   system is exactly what it has always been.
   =========================================================================== */

/* --- Sidebar: the same rounded, panelled feel as its navigation column ---- */
body.layout-sidebar.auth-body { background: linear-gradient(160deg, var(--theme-nav-start), var(--theme-nav-end)); }
body.layout-sidebar .auth-title-row h1 { color: #fff; }
body.layout-sidebar .auth-card,
body.layout-sidebar .auth-info { border-radius: 10px; border: 0; box-shadow: 0 10px 30px rgba(0, 0, 0, .22); }

/* --- Wide: edge to edge, the same as its board ---------------------------- */
body.layout-wide.auth-body { padding: 16px; background: var(--theme-bg); }
body.layout-wide .auth-wrap { width: min(1400px, 100%); gap: 14px; }
body.layout-wide .auth-grid { width: min(1240px, 100%); gap: 16px; }
body.layout-wide .auth-card,
body.layout-wide .auth-info { border-radius: 6px; padding: 18px; box-shadow: none; border: 1px solid var(--theme-border); }
body.layout-wide .auth-logo { max-height: 72px; }

/* --- Compact: small and tight, like the rest of it ------------------------ */
body.layout-compact.auth-body { padding: 18px; background: var(--theme-bg); }
body.layout-compact .auth-wrap { gap: 12px; }
body.layout-compact .auth-grid { width: min(840px, 100%); gap: 14px; }
body.layout-compact .auth-card,
body.layout-compact .auth-info { border-radius: 4px; padding: 16px; box-shadow: none; border: 1px solid var(--theme-border); }
body.layout-compact .auth-title-row h1 { font-size: clamp(22px, 3vw, 28px); }
body.layout-compact .auth-logo { max-height: 68px; }

/* --- Focus: one roomy card, nothing else competing for attention ---------- */
body.layout-focus.auth-body { background: linear-gradient(160deg, var(--theme-primary-soft-2), var(--theme-surface)); }
/* Focus stacks the two panels rather than hiding one. Dropping the instruction
   panel took the purpose text and all five helpdesk numbers off the page - and the
   helpdesk is the only route out for somebody who cannot sign in. One column, form
   first, instructions under it. */
body.layout-focus .auth-grid { grid-template-columns: minmax(340px, 560px); justify-content: center; }
body.layout-focus .auth-info { padding: 24px; }
body.layout-focus .auth-card { border-radius: 16px; padding: 34px; box-shadow: 0 16px 44px rgba(var(--theme-primary-rgb), .16); }
body.layout-focus .auth-card input { min-height: 50px; font-size: 16px; }
body.layout-focus .auth-card button { min-height: 52px; font-size: 16px; width: 100%; }

/* --- Register: a signing sheet, not a web form --------------------------- */
/* White sheets need something to sit on, or the ruled border is doing all the work. */
body.layout-register.auth-body { background: var(--theme-primary-soft-3); padding: 26px; }
body.layout-register .auth-title-row h1 { font-family: Georgia, "Times New Roman", serif; letter-spacing: .01em; }
body.layout-register .auth-card,
body.layout-register .auth-info {
  border-radius: 0; box-shadow: none;
  border: 1px solid var(--theme-text); background: var(--theme-surface);
}
body.layout-register .auth-card { border-top: 3px double var(--theme-text); }
body.layout-register .auth-card input,
body.layout-register .auth-card button { border-radius: 2px; }

/* --- Console: flat and quiet ---------------------------------------------- */
/* The ground was --theme-bg and the card border --theme-border-soft, which on a pale
   palette is close enough to nothing that the instruction panel reads as missing. */
body.layout-console.auth-body { background: var(--theme-primary-soft-3); }
body.layout-console .auth-card,
body.layout-console .auth-info {
  border-radius: 6px; box-shadow: none;
  border: 1px solid var(--theme-border); background: var(--theme-surface);
}
body.layout-console .auth-title-row h1 { font-size: clamp(26px, 3.2vw, 32px); font-weight: 620; }
body.layout-console .auth-logo { max-height: 84px; }

/* ===========================================================================
   THE SIGN-IN PAGE AT EVERY WIDTH

   The two panels are 320+380+24 = 724px at their narrowest, so anything under
   about 790px had them overflowing rather than stacking. The single break at
   1200px was also far too late: between 790px and 1200px the panels were being
   squeezed thinner than they can usefully be.
   =========================================================================== */

/* Never let the sign-in block exceed its container, whatever a layout does. */
.auth-wrap, .auth-grid { max-width: 100%; }
.auth-card, .auth-info { min-width: 0; }

/* Laptops and small desktops: keep two panels but let them shrink honestly. */
@media (max-width: 1199px) and (min-width: 900px) {
  .auth-grid { grid-template-columns: minmax(300px, 1fr) minmax(320px, 1.2fr); width: min(940px, 100%); gap: 18px; }
}

/* Tablets and below: one column, and the helpdesk panel reads under the form. */
@media (max-width: 899px) {
  .auth-body { padding: 20px 14px; align-items: flex-start; }
  .auth-wrap { width: 100%; gap: 16px; }
  .auth-grid { grid-template-columns: 1fr; width: min(560px, 100%); gap: 14px; }
  .auth-card, .auth-info { padding: 18px; border-radius: 12px; }
  .auth-title-row h1 { font-size: clamp(22px, 6vw, 30px); }
  .auth-logo { max-height: 76px; }
}

/* Phones. */
@media (max-width: 520px) {
  .auth-body { padding: 14px 10px; }
  .auth-card, .auth-info { padding: 14px; border-radius: 10px; }
  .auth-title-row h1 { font-size: clamp(19px, 7vw, 25px); }
  .auth-logo { max-height: 60px; }
  .auth-card input { min-height: 44px; }
  .auth-card button { min-height: 46px; }
}

/* Very wide screens: the block centres instead of drifting to one side. */
@media (min-width: 1600px) {
  .auth-grid { width: min(1120px, 100%); }
}

/* An architecture may restyle the sign-in page, but it must never restructure the
   body itself - that is what broke it once already. */
body.layout-focus .auth-grid,
body.layout-wide .auth-grid,
body.layout-compact .auth-grid { max-width: 100%; }
@media (max-width: 899px) {
  body.layout-wide .auth-grid,
  body.layout-compact .auth-grid,
  body.layout-focus .auth-grid { grid-template-columns: 1fr; width: min(560px, 100%); }
}

/* Hooks that cost nothing until a layout asks for them.
   The nav carries data-icon and data-group on every link; column heads carry a type
   glyph. All three are invisible unless one of the four new architectures wants them,
   so the default and the other seven layouts are untouched. */
.fh-type { display: none; }
.nav-links a::before, .nav-links button::before { content: none; }

/* ===========================================================================
   THE FOUR PROPOSED ARCHITECTURES

   Built from the owner's own reference screenshots, blended with Ant Design's
   table discipline and Material 3's tonal surfaces.

   They lean on three hooks added to the shared markup, each inert by default:
     data-icon   on every nav link      (Console's icon rail)
     data-group  on every nav link      (Workbench's grouped sidebar)
     .fh-type    in every column header (Orbital's type marks)

   None of them touches the sign-in page structure. See I7.
   =========================================================================== */


/* ===========================================================================
   CONSOLE  -  icon rail, segment list, and the table owning its own chrome
   Supabase (three panes) + Orbital (type marks) + Ant (compact rows)
   =========================================================================== */
body.layout-console_pane { --cp-rail: 58px; --cp-panel: 200px; }
body.layout-console_pane:not(.auth-body) { display: grid; grid-template-columns: var(--cp-rail) minmax(0, 1fr); min-height: 100vh; }
body.layout-console_pane:not(.auth-body) .nav {
  grid-column: 1; grid-row: 1 / span 3; position: sticky; top: 0; height: 100vh;
  flex-direction: column; align-items: center; justify-content: flex-start; gap: 2px;
  padding: 12px 6px; overflow-y: auto;
  background: linear-gradient(180deg, var(--theme-nav-start), var(--theme-nav-end));
}
body.layout-console_pane .nav-title { font-size: 0; margin-bottom: 10px; }
body.layout-console_pane .nav-title::after { content: "SS"; font-size: 13px; font-weight: 800; letter-spacing: .04em; }
body.layout-console_pane .nav-links { flex-direction: column; align-items: center; gap: 3px; }
/* The link text collapses; the icon hook becomes the button. The title attribute is
   not available here, so the label is kept for screen readers via font-size:0. */
body.layout-console_pane .nav-links a,
body.layout-console_pane .nav-links button {
  width: 38px; height: 34px; display: grid; place-items: center; border-radius: 8px;
  font-size: 0; background: transparent; border: 0; color: #fff; min-height: 0; padding: 0;
}
body.layout-console_pane .nav-links a::before,
body.layout-console_pane .nav-links button::before { content: attr(data-icon); font-size: 15px; }
body.layout-console_pane .nav-links a:hover,
body.layout-console_pane .nav-links button:hover { background: rgba(255, 255, 255, .16); }
/* The panel sits immediately right of the rail; the content immediately right of the
   panel. Both widths are named once, at the top, so they cannot drift apart. */
body.layout-console_pane:not(.auth-body) .container { grid-column: 2; max-width: none; padding: 0; }

/* The segment switcher stops being a strip of buttons and becomes the list panel. */
body.layout-console_pane .segment-switch-card {
  position: fixed; top: 0; left: var(--cp-rail); bottom: 0; width: var(--cp-panel); z-index: 3;
  margin-left: 0;
  margin: 0; border-radius: 0; border-right: 1px solid var(--theme-border);
  background: var(--theme-surface); padding: 12px 10px; overflow-y: auto; box-shadow: none;
}
body.layout-console_pane .segment-switch-card .scope-switch-row { flex-direction: column; align-items: stretch; gap: 2px; }
body.layout-console_pane .segment-switch-card .button-link {
  justify-content: flex-start; width: 100%; background: transparent; color: var(--theme-text);
  border: 0; border-radius: 6px; font-size: 12.5px; min-height: 30px; padding: 5px 9px;
}
body.layout-console_pane .segment-switch-card .button-link.is-active {
  background: var(--theme-primary); color: #fff; font-weight: 600;
}
/* THE BUG. ".container > .card" also matched .segment-switch-card - it is a card too -
   so the fixed panel was shifted by the very margin that was clearing space for the
   content, and landed on top of it. One rule, one exclusion. */
body.layout-console_pane .container > *:not(.segment-switch-card) { margin-left: var(--cp-panel); }
body.layout-console_pane .card { border-radius: 0; box-shadow: none; border: 0; border-bottom: 1px solid var(--theme-border); margin-bottom: 0; padding: 14px 18px; }
/* The table carries its own chrome, Supabase-style. */
body.layout-console_pane .operational-budget-card .card-head {
  border-bottom: 1px solid var(--theme-border); padding-bottom: 10px; margin-bottom: 10px;
}
body.layout-console_pane .fh-type {
  display: inline-block; font-family: ui-monospace, "Cascadia Mono", Menlo, monospace;
  font-size: 8.5px; font-style: normal; letter-spacing: .04em; color: var(--theme-muted);
  background: var(--theme-primary-soft-2); border-radius: 3px; padding: 1px 4px; margin-right: 5px;
  vertical-align: middle;
}
body.layout-console_pane th { background: var(--theme-surface); border-bottom: 2px solid var(--theme-border); }
body.layout-console_pane th, body.layout-console_pane td { padding: 5px 9px; font-size: 12.5px; }
@media (max-width: 1000px) {
  body.layout-console_pane:not(.auth-body) { display: block; }
  body.layout-console_pane:not(.auth-body) .nav { position: static; height: auto; flex-direction: row; flex-wrap: wrap; }
  body.layout-console_pane .nav-links { flex-direction: row; flex-wrap: wrap; }
  body.layout-console_pane .segment-switch-card { position: static; width: auto; }
  body.layout-console_pane .container > * { margin-left: 0; }
}


/* ===========================================================================
   WORKBENCH  -  grouped sidebar, and the bulk bar rises when rows are ticked
   Prodex (groups, bulk bar) + Signpaper (bottom-pinned account) + Material 3
   =========================================================================== */
body.layout-workbench:not(.auth-body) { display: grid; grid-template-columns: 222px minmax(0, 1fr); min-height: 100vh; }
body.layout-workbench:not(.auth-body) .nav {
  grid-column: 1; grid-row: 1 / span 3; position: sticky; top: 0; height: 100vh;
  flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 1px;
  padding: 14px 10px; overflow-y: auto;
  background: linear-gradient(180deg, var(--theme-nav-start), var(--theme-nav-end));
}
body.layout-workbench .nav-title { font-size: 14px; line-height: 1.3; margin-bottom: 14px; padding: 0 6px; }
body.layout-workbench .nav-links { flex-direction: column; align-items: stretch; gap: 1px; }
body.layout-workbench .nav-links a,
body.layout-workbench .nav-links button {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  padding: 7px 10px; border-radius: 8px; font-size: 13px; min-height: 0;
  background: transparent; border: 0; color: #fff;
}
body.layout-workbench .nav-links a::before,
body.layout-workbench .nav-links button::before { content: attr(data-icon); font-size: 13px; width: 15px; opacity: .85; }
body.layout-workbench .nav-links a:hover,
body.layout-workbench .nav-links button:hover { background: rgba(255, 255, 255, .15); }
body.layout-workbench:not(.auth-body) .container { grid-column: 2; max-width: none; padding: 18px 22px; }
/* Material 3 tonal surfaces: elevation as tint, not shadow. */
body.layout-workbench .card {
  border-radius: 14px; box-shadow: none;
  border: 1px solid var(--theme-border-soft); background: var(--theme-surface);
}
body.layout-workbench .hero-card { border-radius: 16px; }
body.layout-workbench th { background: var(--theme-primary-soft-3); border-bottom: 0; font-size: 11.5px; }
body.layout-workbench td { border-bottom: 1px solid var(--theme-border-soft); }
body.layout-workbench button,
body.layout-workbench .button-link { border-radius: 20px; padding: 9px 18px; }
body.layout-workbench .btn-small { border-radius: 16px; }
/* Prodex's floating bulk bar: the delete strip stops being a block and becomes a bar. */
body.layout-workbench .bulk-actions {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 22px; z-index: 40;
  display: flex; align-items: center; gap: 10px;
  background: var(--theme-surface); border: 1px solid var(--theme-border);
  border-radius: 999px; padding: 8px 16px; box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
}
@media (max-width: 940px) {
  body.layout-workbench:not(.auth-body) { display: block; }
  body.layout-workbench:not(.auth-body) .nav { position: static; height: auto; flex-direction: row; flex-wrap: wrap; }
  body.layout-workbench .nav-links { flex-direction: row; flex-wrap: wrap; }
  body.layout-workbench .nav-links a, body.layout-workbench .nav-links button { width: auto; }
}


/* ===========================================================================
   LEDGER  -  no rail at all, the tightest rows, the segment strip as tabs
   Transactions (no rail, tabs, dot status) + Ant Design (small table, 4px grid)
   =========================================================================== */
body.layout-ledger { font-size: 13px; }
body.layout-ledger .nav { padding: 7px 16px; }
body.layout-ledger .nav-title { font-size: 14px; }
body.layout-ledger .nav-links { gap: 6px; }
body.layout-ledger .nav-links a,
body.layout-ledger .nav-links button { font-size: 12px; padding: 4px 7px; border-radius: 5px; min-height: 0; }
body.layout-ledger .nav-links a:hover { background: rgba(255, 255, 255, .16); }
body.layout-ledger .container { max-width: none; padding: 10px 14px; }
body.layout-ledger .card { border-radius: 5px; padding: 12px 14px; margin-bottom: 10px; box-shadow: none; border: 1px solid var(--theme-border-soft); }
/* The segment strip becomes a tab row, underlined rather than buttoned. */
body.layout-ledger .segment-switch-card { border: 0; background: transparent; padding: 0 2px; margin-bottom: 8px; }
body.layout-ledger .segment-switch-card .scope-switch-row { gap: 0; border-bottom: 1px solid var(--theme-border); flex-wrap: wrap; }
body.layout-ledger .segment-switch-card .button-link {
  background: transparent; color: var(--theme-muted); border-radius: 0; border: 0;
  border-bottom: 2px solid transparent; margin-bottom: -1px; min-height: 0;
  padding: 6px 11px; font-size: 12.5px;
}
body.layout-ledger .segment-switch-card .button-link.is-active {
  color: var(--theme-text); font-weight: 700; border-bottom-color: var(--theme-primary);
}
body.layout-ledger th {
  background: transparent; border-bottom: 1.5px solid var(--theme-border);
  font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; padding: 5px 7px;
}
body.layout-ledger td { padding: 3px 7px; font-size: 12px; border-bottom: 1px solid var(--theme-border-soft); }
body.layout-ledger button,
body.layout-ledger .button-link { min-height: 29px; padding: 5px 11px; font-size: 12.5px; border-radius: 5px; }
body.layout-ledger .btn-small { min-height: 25px; padding: 3px 8px; font-size: 11.5px; }
body.layout-ledger input, body.layout-ledger select, body.layout-ledger textarea { padding: 5px 7px; font-size: 12.5px; }
body.layout-ledger input.inline-edit, body.layout-ledger select.inline-edit { min-height: 25px; padding: 2px 6px; }
body.layout-ledger .table-load-more-body td { padding: 3px 7px; }
body.layout-ledger .modal-card { border-radius: 6px; }


/* ===========================================================================
   ATLAS  -  built around the filter row; values carry their own colour
   Stores & Cards (filter chips) + Orbital (value tags) + Material 3 (tonal chips)
   =========================================================================== */
body.layout-atlas .nav {
  background: var(--theme-surface); color: var(--theme-text);
  border-bottom: 1px solid var(--theme-border); padding: 10px 20px;
}
body.layout-atlas .nav-title { font-size: 15px; font-weight: 650; }
body.layout-atlas .nav-links a,
body.layout-atlas .nav-links button {
  color: var(--theme-text); background: transparent; border: 1px solid transparent;
  border-radius: 8px; font-size: 12.5px; padding: 6px 10px; min-height: 0;
  display: inline-flex; align-items: center; gap: 6px;
}
body.layout-atlas .nav-links a::before,
body.layout-atlas .nav-links button::before { content: attr(data-icon); opacity: .55; font-size: 12px; }
body.layout-atlas .nav-links a:hover,
body.layout-atlas .nav-links button:hover { background: var(--theme-primary-soft-2); border-color: var(--theme-border-soft); }
body.layout-atlas .container { max-width: none; padding: 16px 20px; }
body.layout-atlas .card { border-radius: 12px; box-shadow: none; border: 1px solid var(--theme-border-soft); }
/* The active-filter chips. Rendered by the board only for this architecture. */
body.layout-atlas .filter-chip-row { display: flex; }
body.layout-atlas th {
  background: var(--theme-surface); border-bottom: 1.5px solid var(--theme-border);
  font-size: 11.5px; letter-spacing: .04em;
}
body.layout-atlas td { border-bottom: 1px solid var(--theme-border-soft); }
body.layout-atlas .fh-type {
  display: inline-block; font-family: ui-monospace, "Cascadia Mono", Menlo, monospace;
  font-size: 8px; font-style: normal; color: var(--theme-muted); opacity: .75;
  margin-right: 5px; vertical-align: middle;
}
body.layout-atlas button,
body.layout-atlas .button-link { border-radius: 10px; }
body.layout-atlas input, body.layout-atlas select, body.layout-atlas textarea { border-radius: 10px; }

/* The chip row itself. Hidden everywhere except Atlas, so the board renders it once
   and only one architecture pays for it. */
.filter-chip-row {
  display: none; flex-wrap: wrap; gap: 6px; align-items: center;
  margin: 0 0 12px; padding: 0;
}
.filter-chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--theme-border); background: var(--theme-surface);
  border-radius: 9px; padding: 4px 9px; font-size: 12.5px; color: var(--theme-text);
}
.filter-chip b { font-weight: 600; }
.filter-chip .fc-count {
  font-size: 10.5px; font-weight: 700; background: var(--theme-primary); color: #fff;
  border-radius: 9px; padding: 0 6px; font-variant-numeric: tabular-nums;
}
.filter-chip .fc-drop { color: var(--theme-muted); font-size: 11px; }
.filter-chip a.fc-x {
  color: var(--theme-muted); text-decoration: none; font-size: 14px; line-height: 1;
  padding: 0 1px; border-radius: 4px;
}
.filter-chip a.fc-x:hover { color: var(--theme-danger); background: var(--theme-primary-soft-2); }
.filter-chip-clear {
  font-size: 12px; color: var(--theme-primary); text-decoration: none;
  border-bottom: 1px solid currentColor; margin-left: 2px;
}
.filter-chip-row .fc-label {
  font-size: 11px; letter-spacing: .07em; text-transform: uppercase;
  color: var(--theme-muted); margin-right: 2px;
}

/* --- The four proposals sign in in their own idiom too ------------------- */

/* Console Pane: the same dark rail colour behind the card, panels squared off. */
body.layout-console_pane.auth-body { background: linear-gradient(155deg, var(--theme-nav-start), var(--theme-nav-end)); padding: 26px; }
body.layout-console_pane .auth-title-row h1 { color: #fff; }
body.layout-console_pane .auth-card,
body.layout-console_pane .auth-info { border-radius: 4px; border: 0; box-shadow: 0 12px 34px rgba(0, 0, 0, .26); }

/* Workbench: Material 3 - large radii, tonal ground, elevation as tint. */
body.layout-workbench.auth-body { background: var(--theme-primary-soft-2); }
body.layout-workbench .auth-card,
body.layout-workbench .auth-info { border-radius: 20px; border: 1px solid var(--theme-border-soft); box-shadow: none; padding: 28px; }
body.layout-workbench .auth-card input { border-radius: 10px; min-height: 46px; }
body.layout-workbench .auth-card button { border-radius: 20px; min-height: 48px; }

/* Ledger: the same restraint as its tables - flat, tight, no ornament. */
body.layout-ledger.auth-body { background: var(--theme-bg); padding: 20px; }
body.layout-ledger .auth-wrap { gap: 14px; }
body.layout-ledger .auth-grid { gap: 16px; }
body.layout-ledger .auth-card,
body.layout-ledger .auth-info { border-radius: 5px; padding: 18px; box-shadow: none; border: 1px solid var(--theme-border); }
body.layout-ledger .auth-title-row h1 { font-size: clamp(24px, 3.4vw, 30px); }
body.layout-ledger .auth-logo { max-height: 74px; }

/* Atlas: tonal chips and soft corners, matching its chip row. */
body.layout-atlas.auth-body { background: linear-gradient(170deg, var(--theme-primary-soft-3), var(--theme-surface)); }
body.layout-atlas .auth-card,
body.layout-atlas .auth-info { border-radius: 14px; border: 1px solid var(--theme-border-soft); box-shadow: 0 6px 22px rgba(var(--theme-primary-rgb), .10); }
body.layout-atlas .auth-card input,
body.layout-atlas .auth-card button { border-radius: 10px; }

/* ---------------------------------------------------------------------------
   The AI chat drawer (Phase 16d)

   The owner's design: a round tab at the bottom right, sitting just off the edge
   with only a small arrow visible. Hover slides it out; click opens the panel.

   Its own stacking context and a fixed position, so it floats above the page and
   cannot push layout - the Console Pane overlap is what taught us to be explicit
   about that. Every colour comes from a palette token, so it looks right in all
   fifteen palettes and all eleven layouts.
   --------------------------------------------------------------------------- */
.ai-dock {
  position: fixed;
  right: 0;
  bottom: 28px;
  z-index: 1200;
  isolation: isolate;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  font: inherit;
}

/* The tab. Mostly off-screen: only the arrow shows until it is hovered. */
.ai-dock-tab {
  width: 56px;
  height: 56px;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--theme-primary);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  box-shadow: 0 6px 20px rgba(var(--theme-primary-rgb), .38);
  transform: translateX(30px);
  transition: transform .18s ease, box-shadow .18s ease;
}
.ai-dock-tab:hover,
.ai-dock-tab:focus-visible,
.ai-dock.is-open .ai-dock-tab {
  transform: translateX(0);
  box-shadow: 0 10px 28px rgba(var(--theme-primary-rgb), .5);
}
.ai-dock-arrow {
  font-size: 13px;
  line-height: 1;
  opacity: .85;
  transition: opacity .18s ease;
}
.ai-dock-mark {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .04em;
  max-width: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-width .18s ease, opacity .18s ease;
}
.ai-dock-tab:hover .ai-dock-mark,
.ai-dock-tab:focus-visible .ai-dock-mark,
.ai-dock.is-open .ai-dock-mark {
  max-width: 30px;
  opacity: 1;
}
.ai-dock-tab:hover .ai-dock-arrow,
.ai-dock.is-open .ai-dock-arrow { opacity: 0; }

/* The panel. */
.ai-dock-panel {
  width: min(420px, calc(100vw - 32px));
  max-height: min(72vh, 620px);
  display: flex;
  flex-direction: column;
  background: var(--theme-surface);
  border: 1px solid var(--theme-border);
  border-radius: 14px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .22);
  overflow: hidden;
}
.ai-dock-panel[hidden] { display: none; }

.ai-dock-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  background: var(--theme-primary);
  color: #fff;
}
.ai-dock-sub {
  font-size: 11px;
  opacity: .8;
  margin-right: auto;
  margin-left: 8px;
  letter-spacing: .02em;
}
.ai-dock-close {
  background: transparent;
  border: 0;
  color: #fff;
  font-size: 22px;
  line-height: 1;
  min-height: 0;
  padding: 0 4px;
  cursor: pointer;
}

.ai-dock-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--theme-bg);
}
.ai-dock-hint { color: var(--theme-muted); font-size: 13px; margin: 0; line-height: 1.7; }
.ai-dock-hint em { display: inline-block; margin-top: 3px; }

.ai-dock-q {
  align-self: flex-end;
  max-width: 88%;
  background: var(--theme-primary);
  color: #fff;
  padding: 8px 12px;
  border-radius: 12px 12px 2px 12px;
  font-size: 13px;
  word-break: break-word;
}
.ai-dock-a {
  align-self: flex-start;
  max-width: 100%;
  width: 100%;
  background: var(--theme-surface);
  border: 1px solid var(--theme-border-soft);
  border-radius: 12px 12px 12px 2px;
  padding: 10px 12px;
  font-size: 13px;
}
.ai-dock-a p { margin: 0 0 8px; line-height: 1.6; }

/* The evidence. Wide tables scroll inside their own box, never the page. */
.ai-dock-table-wrap { overflow-x: auto; margin-top: 6px; }
.ai-dock-a table { border-collapse: collapse; width: 100%; font-size: 12px; }
.ai-dock-a th, .ai-dock-a td {
  border-bottom: 1px solid var(--theme-border-soft);
  padding: 5px 8px;
  text-align: left;
  white-space: nowrap;
}
.ai-dock-a th { color: var(--theme-muted); font-weight: 600; }
.ai-dock-a td:not(:first-child) { font-variant-numeric: tabular-nums; }
.ai-dock-meta {
  margin-top: 8px;
  font-size: 11px;
  color: var(--theme-muted);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.ai-dock-dl { font-size: 12px; min-height: 0; padding: 5px 10px; }

.ai-dock-form {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--theme-border);
  background: var(--theme-surface);
}
.ai-dock-form textarea {
  flex: 1 1 auto;
  resize: none;
  font-size: 13px;
  padding: 8px 10px;
  border-radius: 10px;
}
.ai-dock-form button { min-height: 0; padding: 8px 16px; }
.ai-dock-form.is-busy button { opacity: .6; pointer-events: none; }

/* A number the model wrote that is not in the table. Shown, never hidden. */
.ai-dock-warn {
  margin-top: 8px;
  padding: 6px 9px;
  border-radius: 8px;
  background: #fdf4e3;
  color: #8a5a00;
  font-size: 12px;
}
.ai-dock-err { color: var(--theme-danger); font-size: 13px; margin: 0; }
.ai-dock-helplink {
  background: transparent; border: 0; padding: 4px 0 0; min-height: 0;
  color: var(--theme-primary); font-size: 12px; cursor: pointer; text-decoration: underline;
}

@media (max-width: 640px) {
  .ai-dock { bottom: 12px; }
  /* No hover on a touch screen, so the tab sits fully on-screen there. */
  .ai-dock-tab { transform: translateX(0); }
  .ai-dock-panel { max-height: 76vh; }
}

@media (prefers-reduced-motion: reduce) {
  .ai-dock-tab, .ai-dock-mark, .ai-dock-arrow { transition: none; }
}

/* --- The help sheet -------------------------------------------------------
   Opened from the little i in the panel header. Wider than the drawer on
   purpose: a guide squeezed into 420px is a guide nobody reads. Every colour
   is a palette token, so it follows all fifteen palettes.
   ------------------------------------------------------------------------- */
.ai-dock-info {
  background: transparent;
  border: 0;
  color: #fff;
  font-size: 15px;
  line-height: 1;
  min-height: 0;
  padding: 0 6px;
  cursor: pointer;
  opacity: .85;
}
.ai-dock-info:hover { opacity: 1; }

.ai-help {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, .55);
}
.ai-help[hidden] { display: none; }

.ai-help-card {
  width: min(760px, 100%);
  max-height: min(86vh, 780px);
  display: flex;
  flex-direction: column;
  background: var(--theme-surface);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 26px 60px rgba(0, 0, 0, .3);
}
.ai-help-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  background: var(--theme-primary);
  color: #fff;
}
.ai-help-head strong { display: block; font-size: 15px; }
.ai-help-head span { font-size: 11px; opacity: .82; }
.ai-help-x {
  background: transparent; border: 0; color: #fff;
  font-size: 24px; line-height: 1; min-height: 0; padding: 0 4px; cursor: pointer;
}
.ai-help-body {
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  background: var(--theme-bg);
}
.ai-help-block h4 {
  margin: 0 0 10px;
  font-size: 12px;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--theme-muted);
}

/* the colour-coded sentence */
.ai-help-formula {
  margin: 0 0 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  line-height: 2.1;
}
.ai-t {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--theme-text-strong);
  border: 1px solid var(--theme-border);
  background: var(--theme-surface);
}
.ai-t1 { border-color: var(--theme-primary); }
.ai-t2 { border-color: var(--theme-secondary); }
.ai-t3 { border-color: var(--theme-success); }
.ai-t4 { border-color: var(--theme-muted); }
.ai-t5 { border-style: dashed; }

.ai-help-key { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ai-help-key li {
  display: flex; align-items: baseline; gap: 8px;
  font-size: 12.5px; color: var(--theme-text);
}
.ai-help-key i {
  flex: 0 0 auto; width: 10px; height: 10px; border-radius: 3px;
  border: 2px solid var(--theme-border);
}
.ai-k1 { border-color: var(--theme-primary); }
.ai-k2 { border-color: var(--theme-secondary); }
.ai-k3 { border-color: var(--theme-success); }
.ai-k4 { border-color: var(--theme-muted); }
.ai-k5 { border-style: dashed; }

.ai-help-note {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  border-left: 3px solid var(--theme-primary);
  background: var(--theme-primary-soft-2);
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--theme-text);
}

/* tap-to-try */
.ai-help-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.ai-help-chips button {
  text-align: left;
  font-size: 12.5px;
  min-height: 0;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--theme-border);
  background: var(--theme-surface);
  color: var(--theme-text);
  cursor: pointer;
}
.ai-help-chips button:hover {
  border-color: var(--theme-primary);
  background: var(--theme-primary-soft-2);
}

/* avoid / write */
.ai-help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ai-help-bad, .ai-help-good {
  padding: 10px 12px; border-radius: 10px; border: 1px solid var(--theme-border-soft);
  background: var(--theme-surface);
}
.ai-help-bad span, .ai-help-good span {
  display: inline-block; font-size: 10px; letter-spacing: .08em;
  text-transform: uppercase; margin-bottom: 5px; font-weight: 700;
}
.ai-help-bad span { color: var(--theme-danger); }
.ai-help-good span { color: var(--theme-success); }
.ai-help-bad p, .ai-help-good p { margin: 0 0 4px; font-size: 13px; color: var(--theme-text); }
.ai-help-bad small, .ai-help-good small { font-size: 11.5px; color: var(--theme-muted); line-height: 1.5; }

.ai-help-explain p {
  margin: 0 0 10px; font-size: 12.5px; line-height: 1.7; color: var(--theme-text);
  padding: 10px 12px; border-radius: 10px; background: var(--theme-surface);
  border: 1px solid var(--theme-border-soft);
}
.ai-help-foot {
  margin: 0; font-size: 12px; color: var(--theme-muted); text-align: center; line-height: 1.6;
}

@media (max-width: 620px) {
  .ai-help { padding: 10px; }
  .ai-help-grid { grid-template-columns: 1fr; }
  .ai-help-formula { line-height: 1.9; }
}

/* =====================================================================
   ADMIN DENSITY  (body.admin-ui)
   =====================================================================
   Measured 2026-08-31 on the live pages: Management carries 256 inputs,
   113 selects and 217 buttons across 11 cards; Log Monitor has a single
   card holding 4,999 words and no controls at all; Profile has 56 inputs.
   Three base rules caused most of it -

       input, select, textarea { width: 100% }   a 3-digit box, 1400px wide
       button { min-height: 42px }               every button equally loud
       .card { padding: 20px; margin: 20px }     a checkbox as big as a table

   Nothing here is deleted; it is sized, grouped and folded. Scoped to
   body.admin-ui so the board and every office-facing screen are untouched.
   ===================================================================== */

/* --- controls sized to what they hold, not to the window ------------- */
body.admin-ui input[type="text"],
body.admin-ui input[type="email"],
body.admin-ui input[type="password"],
body.admin-ui input[type="search"],
body.admin-ui input[type="url"],
body.admin-ui input[type="tel"] { max-width: 30rem; }
body.admin-ui input[type="number"] { max-width: 9rem; }
body.admin-ui input[type="date"],
body.admin-ui input[type="time"] { max-width: 12rem; }
body.admin-ui input[type="file"] { max-width: 32rem; }
body.admin-ui select { max-width: 24rem; }
body.admin-ui textarea { max-width: 52rem; }

/* Inside a table or a toolbar the cell already sets the width; a max-width
   there would leave a ragged column. */
body.admin-ui td input,
body.admin-ui td select,
body.admin-ui td textarea,
body.admin-ui th input,
body.admin-ui th select,
body.admin-ui .toolbar-row input,
body.admin-ui .toolbar-row select,
body.admin-ui .inline-form input,
body.admin-ui .inline-form select { max-width: 100%; }

/* --- three weights of button, instead of one ------------------------- */
/* A row action is not a page action. Quiet ones read as links with a hit
   area; the primary one keeps its weight so it is still obvious. */
body.admin-ui .action-row button,
body.admin-ui .action-row .button-link,
body.admin-ui .inline-form button,
body.admin-ui td button,
body.admin-ui td .button-link {
  min-height: 32px;
  padding: 5px 11px;
  font-size: 13px;
  background: transparent;
  color: var(--theme-primary);
  border: 1px solid var(--theme-border);
  border-radius: 7px;
}
body.admin-ui .action-row button:hover,
body.admin-ui .inline-form button:hover,
body.admin-ui td button:hover,
body.admin-ui .action-row .button-link:hover,
body.admin-ui td .button-link:hover {
  background: var(--theme-primary-soft);
  border-color: var(--theme-primary);
}
/* The one that removes something must never look like the one that saves. */
body.admin-ui .action-row button.is-danger,
body.admin-ui .inline-form button.is-danger,
body.admin-ui td button.is-danger { color: var(--theme-danger); }
body.admin-ui .action-row button.is-danger:hover,
body.admin-ui .inline-form button.is-danger:hover,
body.admin-ui td button.is-danger:hover {
  background: var(--theme-danger);
  border-color: var(--theme-danger);
  color: var(--theme-surface);
}
body.admin-ui .btn-small { min-height: 32px; padding: 5px 11px; font-size: 13px; }

/* --- cards get a rhythm, and small settings look small --------------- */
body.admin-ui .card { padding: 18px 20px; margin-bottom: 14px; }
body.admin-ui .card > h2:first-child,
body.admin-ui .card > h3:first-child { margin-top: 0; }
body.admin-ui .card h3 {
  font-size: 15px;
  letter-spacing: .01em;
  margin: 0 0 6px;
  color: var(--theme-text-strong);
}
body.admin-ui .card .hint { margin-top: 4px; }

/* --- a foldable section: the whole answer to "where do I look?" ------ */
.admin-fold { border: 0; }
.admin-fold > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 2px 0;
  border-radius: 8px;
}
.admin-fold > summary::-webkit-details-marker { display: none; }
.admin-fold > summary:focus-visible {
  outline: 2px solid var(--theme-primary);
  outline-offset: 3px;
}
.admin-fold > summary::before {
  content: "";
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--theme-muted);
  border-bottom: 2px solid var(--theme-muted);
  transform: rotate(-45deg);
  transition: transform .16s ease;
  margin-left: 3px;
}
.admin-fold[open] > summary::before { transform: rotate(45deg); }
.admin-fold-title {
  font-size: 15px;
  font-weight: 650;
  color: var(--theme-text-strong);
}
/* What is inside, said before it is opened - so nothing is hidden from
   the reader, only folded away from the screen. */
.admin-fold-meta {
  margin-left: auto;
  font-size: 12.5px;
  color: var(--theme-muted);
  text-align: right;
}
.admin-fold-body { padding-top: 14px; }
.admin-fold[open] > summary { margin-bottom: 2px; }

/* --- a strip of small switches, instead of one card each ------------- */
.admin-switches {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 12px;
}
.admin-switch {
  border: 1px solid var(--theme-border-soft);
  border-radius: 10px;
  padding: 12px 14px;
  background: var(--theme-bg);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.admin-switch strong { font-size: 13.5px; color: var(--theme-text-strong); }
.admin-switch .hint { font-size: 12.5px; margin: 0; }
.admin-switch form { margin: 0; }

/* --- a wall of text becomes a readable column ------------------------ */
body.admin-ui .card > p,
body.admin-ui .admin-fold-body > p { max-width: 78ch; }

/* --- long output panels scroll instead of running off the page ------- */
.admin-scroll-panel {
  max-height: 30rem;
  overflow: auto;
  border: 1px solid var(--theme-border-soft);
  border-radius: 10px;
  padding: 12px 14px;
  background: var(--theme-bg);
}

@media (max-width: 720px) {
  .admin-fold-meta { display: none; }
  body.admin-ui input,
  body.admin-ui select,
  body.admin-ui textarea { max-width: 100%; }
}

/* =====================================================================
   The information button on the "Options / File Rules" column.
   That one cell carried nine blocks of explanation wrapped around its
   inputs. admin-ui.js moves each behind this button; without the script
   they simply stay visible, which is the behaviour they had before.
   ===================================================================== */
.field-hint-btn {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  min-height: 18px;
  padding: 0;
  margin-left: 6px;
  border-radius: 50%;
  border: 1px solid var(--theme-border);
  background: transparent;
  color: var(--theme-muted);
  font-size: 11px;
  font-style: italic;
  font-weight: 700;
  line-height: 1;
  font-family: Georgia, "Times New Roman", serif;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  cursor: pointer;
}
body.admin-ui .field-hint-btn {
  width: 18px;
  height: 18px;
  min-height: 18px;
  padding: 0;
}
.field-hint-btn:hover,
.field-hint-btn[aria-expanded="true"] {
  border-color: var(--theme-primary);
  color: var(--theme-primary);
  background: var(--theme-primary-soft);
}
.field-hint-row { margin: 2px 0 6px; }

.field-hint-pop {
  position: absolute;
  z-index: 1200;
  width: min(30rem, calc(100vw - 24px));
  background: var(--theme-surface);
  color: var(--theme-text);
  border: 1px solid var(--theme-border);
  border-radius: 12px;
  box-shadow: 0 18px 44px rgba(var(--theme-primary-rgb), 0.22);
  padding: 14px 16px 14px;
}
.field-hint-pop[hidden] { display: none; }
.field-hint-close {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 26px;
  height: 26px;
  min-height: 26px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--theme-muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.field-hint-close:hover { background: var(--theme-primary-soft); color: var(--theme-text-strong); }
.field-hint-body { padding-right: 22px; }
.field-hint-body .hint,
.field-hint-body span,
.field-hint-body div { display: block; font-size: 13px; line-height: 1.55; color: var(--theme-text); }
.field-hint-body code {
  background: var(--theme-primary-soft);
  color: var(--theme-text-strong);
  border: 1px solid var(--theme-border-soft);
  border-radius: 4px;
  padding: 1px 5px;
  word-break: break-word;
}

/* Phase L7. The "linked" badge on a download segment that another sheet draws its
   figures from. Deliberately a short word, not a sentence: the segment list is a
   dense grid of checkboxes and a paragraph in it reads as noise. The detail lives in
   the title attribute for anyone who hovers.
   Colour comes from the palette tokens, never a literal, so it follows every theme. */
.download-linked-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 7px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.6;
    letter-spacing: .02em;
    text-transform: lowercase;
    background: var(--theme-primary-soft);
    color: var(--theme-primary);
    border: 1px solid var(--theme-border);
    vertical-align: middle;
}
