/* App-level tweaks on top of AdminLTE 4. Keep this small; prefer Bootstrap utilities. */
/* ==========================================================================
   TESSERA theme (WP-16). Maps the approved palette onto EXISTING Bootstrap 5 /
   AdminLTE 4 variables. No new custom properties, classes or breakpoints.
   Palette: Smoked Copper #9F5938 (deep #884527, mid #A96644, light #BC7550);
   Graphite #11161A, Elevated Graphite #292F33, Slate #697178, Muted Slate #9CA4AA,
   Off White #F5F3EF, White #FFFFFF. Full inventory: docs/ui-ux-brand-audit.md (E).
   Copper = brand / focus / selection / active nav / primary action. Never a state.
   ========================================================================== */
:root, [data-bs-theme="light"] {
  --bs-font-sans-serif: "Inter Variable", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif;
  --bs-body-font-size: .875rem;
  --bs-body-line-height: 1.4286;
  --bs-primary: #9F5938;
  --bs-primary-rgb: 159, 89, 56;
  --bs-primary-text-emphasis: #884527;
  --bs-primary-bg-subtle: #F5F3EF;
  --bs-primary-border-subtle: #BC7550;
  --bs-link-color: #9F5938;
  --bs-link-color-rgb: 159, 89, 56;
  --bs-link-hover-color: #884527;
  --bs-link-hover-color-rgb: 136, 69, 39;
  --bs-focus-ring-color: rgba(188, 117, 80, .45);
  --bs-secondary: #697178;
  --bs-secondary-rgb: 105, 113, 120;
  --bs-body-color: #11161A;
  --bs-body-color-rgb: 17, 22, 26;
  --bs-emphasis-color: #11161A;
  --bs-emphasis-color-rgb: 17, 22, 26;
  --bs-secondary-color: rgba(17, 22, 26, .75);
  --bs-secondary-color-rgb: 17, 22, 26;
  --bs-tertiary-bg: #F5F3EF;
  --bs-tertiary-bg-rgb: 245, 243, 239;
}
[data-bs-theme="dark"] {
  --bs-primary-text-emphasis: #BC7550;
  --bs-primary-bg-subtle: #292F33;
  --bs-primary-border-subtle: #884527;
  /* Copper text on Elevated Graphite is 2.6-3.7:1, so dark-mode text links stay Off White (underlined by Bootstrap); copper is used for fills and focus. */
  --bs-link-color: #F5F3EF;
  --bs-link-color-rgb: 245, 243, 239;
  --bs-link-hover-color: #FFFFFF;
  --bs-link-hover-color-rgb: 255, 255, 255;
  --bs-body-color: #F5F3EF;
  --bs-body-color-rgb: 245, 243, 239;
  --bs-emphasis-color: #FFFFFF;
  --bs-emphasis-color-rgb: 255, 255, 255;
  --bs-secondary-color: #9CA4AA;
  --bs-secondary-color-rgb: 156, 164, 170;
  --bs-tertiary-color: #9CA4AA;
  --bs-tertiary-color-rgb: 156, 164, 170;
  --bs-body-bg: #292F33;
  --bs-body-bg-rgb: 41, 47, 51;
  --bs-secondary-bg: #11161A;
  --bs-secondary-bg-rgb: 17, 22, 26;
  --bs-tertiary-bg: #11161A;
  --bs-tertiary-bg-rgb: 17, 22, 26;
  --bs-border-color: #697178;
  --bs-border-color-translucent: rgba(105, 113, 120, .6);
}
/* Bootstrap compiles these component colours as literals, so they follow --bs-primary only through their own variables. */
.btn-primary {
  --bs-btn-bg: #9F5938; --bs-btn-border-color: #9F5938;
  --bs-btn-hover-bg: #884527; --bs-btn-hover-border-color: #884527;
  --bs-btn-active-bg: #884527; --bs-btn-active-border-color: #884527;
  --bs-btn-disabled-bg: #9F5938; --bs-btn-disabled-border-color: #9F5938;
  --bs-btn-focus-shadow-rgb: 188, 117, 80;
}
.btn-outline-primary { --bs-btn-color: #9F5938; --bs-btn-border-color: #9F5938; --bs-btn-hover-bg: #9F5938; --bs-btn-hover-border-color: #9F5938; --bs-btn-active-bg: #9F5938; --bs-btn-active-border-color: #9F5938; --bs-btn-disabled-color: #9F5938; --bs-btn-disabled-border-color: #9F5938; --bs-btn-focus-shadow-rgb: 188, 117, 80; }
[data-bs-theme="dark"] .btn-outline-primary { --bs-btn-color: #F5F3EF; --bs-btn-border-color: #BC7550; --bs-btn-disabled-color: #F5F3EF; --bs-btn-disabled-border-color: #BC7550; }
.btn-outline-secondary { --bs-btn-color: #11161A; --bs-btn-border-color: #697178; --bs-btn-hover-bg: #697178; --bs-btn-hover-border-color: #697178; --bs-btn-active-bg: #697178; --bs-btn-active-border-color: #697178; --bs-btn-disabled-color: #11161A; --bs-btn-disabled-border-color: #697178; --bs-btn-focus-shadow-rgb: 105, 113, 120; }
[data-bs-theme="dark"] .btn-outline-secondary { --bs-btn-color: #F5F3EF; --bs-btn-border-color: #9CA4AA; --bs-btn-disabled-color: #F5F3EF; --bs-btn-disabled-border-color: #9CA4AA; }
.badge { --bs-badge-font-size: .6875rem; }
.btn { --bs-btn-font-size: .875rem; --bs-btn-font-weight: 500; --bs-btn-line-height: 1.4286; }
.nav-pills { --bs-nav-pills-link-active-bg: #9F5938; }
.pagination { --bs-pagination-active-bg: #9F5938; --bs-pagination-active-border-color: #9F5938; --bs-pagination-hover-color: var(--bs-link-hover-color); }
.progress, .progress-stacked { --bs-progress-bar-bg: #9F5938; }
.dropdown-menu { --bs-dropdown-link-active-bg: #9F5938; }
.list-group { --bs-list-group-active-bg: #9F5938; --bs-list-group-active-border-color: #9F5938; }
.bg-primary, .card-primary, .text-bg-primary { --lte-card-variant-bg: #9F5938; --lte-card-variant-bg-rgb: 159, 89, 56; }
.form-check-input:checked, .form-check-input[type="checkbox"]:indeterminate { background-color: #9F5938; border-color: #9F5938; }
.form-control:focus, .form-select:focus, .form-check-input:focus { border-color: #BC7550; box-shadow: 0 0 0 .25rem var(--bs-focus-ring-color); }
.nav-link:focus-visible { box-shadow: 0 0 0 .25rem var(--bs-focus-ring-color); }
.app-sidebar[data-bs-theme] { --lte-sidebar-menu-active-bg: #9F5938; --lte-sidebar-menu-active-color: #FFFFFF; }
/* Dark controls: the 2.7:1 hairline border is not enough to find an input. */
[data-bs-theme="dark"] .form-control, [data-bs-theme="dark"] .form-select, [data-bs-theme="dark"] .form-check-input:not(:checked) { border-color: var(--bs-secondary-color); }

/* Typography: Inter. Page title 28/36 600; card title 16/24 600; label 14/20 500; metrics tabular. */
.app-content-header h1 { font-weight: 600; line-height: 1.2857; }
.card-title { font-size: 1rem; line-height: 1.5; font-weight: 600; }
.form-label, .col-form-label { font-weight: 500; }
/* Navigation chrome stays neutral: breadcrumbs and inactive tabs are secondary; copper marks the selection. */
.app-content-header .breadcrumb a, .breadcrumb-item a { color: var(--bs-secondary-color); }
.nav-tabs { --bs-nav-tabs-link-active-color: var(--bs-emphasis-color); }
.nav-tabs .nav-link:not(.active):not(.disabled) { color: var(--bs-secondary-color); }
.nav-tabs .nav-link.active { border-top-color: var(--bs-primary); }
.info-box-number, .table, .badge, time, .progress { font-variant-numeric: tabular-nums; }

.col-check { width: 2rem; }
.user-image { width: 2rem; height: 2rem; font-size: .75rem; font-weight: 600; }
.login-box { width: 26rem; max-width: 92vw; margin: 5vh auto; }
.login-logo { text-align: center; margin-bottom: 1rem; }
table td .font-monospace { white-space: nowrap; }
.text-pre-line { white-space: pre-line; }
.nav-tabs .nav-link { white-space: nowrap; }
summary.card-header { cursor: pointer; }
/* Contain absolutely-positioned descendants (visually-hidden labels) so they cannot widen the page. */
.table-responsive { position: relative; }
/* AdminLTE 4.10 draws every fieldset as a bordered box; ours are semantic groups only. */
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset > legend { float: none; width: auto; padding: 0; }
.target-list { max-height: 18rem; overflow-y: auto; }
fieldset:disabled .target-list { max-height: none; } /* a blocked picker has nothing focusable, so it must not be a scroll region */
/* .d-flex / .list-group-item use display with !important, which out-ranks the reboot [hidden] rule. */
.target-list .list-group-item[hidden], .target-panel[hidden] { display: none !important; }
.target-list .list-group-item:focus-within { outline: 2px solid var(--bs-primary); outline-offset: -2px; }
.color-swatch { display: inline-block; width: .9rem; height: .9rem; border-radius: 50%; vertical-align: -.1rem; border: 1px solid rgba(0,0,0,.25); }
input[type="color"].form-control { height: 2.4rem; padding: .25rem; max-width: 6rem; }
.aside-sticky { position: sticky; top: 4.5rem; } /* clears the sticky app header */
@media (max-width: 991.98px) { .aside-sticky { position: static; } }
.table [data-field-row] .form-check { margin: 0; }

/* inventory tables: long names wrap inside a sensible minimum width instead of one letter per line */
.cell-min { min-width: 9rem; }


.bulk-edit-table select { min-width: 9.5rem; }
.bulk-edit-table td:nth-child(2) { min-width: 11rem; }
.cal-grid { table-layout: fixed; }
.cal-cell { height: 8.5rem; vertical-align: top; padding: .25rem; overflow: hidden; }
.cal-out { background: var(--bs-tertiary-bg); }
.cal-out .cal-day { color: var(--bs-secondary-color); }
.cal-today { box-shadow: inset 0 0 0 2px var(--bs-primary); }
.cal-day { font-size: .8rem; }
.cal-chip { font-weight: 400; font-size: .72rem; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; }
.cal-chip:hover, .cal-chip:focus-visible { text-decoration: underline; }

/* Reports: long values in wide result tables wrap inside a bounded column. */
.cell-wide { min-width: 16rem; max-width: 28rem; }
.cell-note { min-width: 12rem; }

/* Settings hub (WP-13) */
.settings-card:hover { border-color: var(--bs-primary); }

/* Permission groups (WP-14) */
.perm-list { columns: 2 18rem; column-gap: 1.5rem; }
.perm-item { break-inside: avoid; padding: .1rem 0; }
.perm-item:not(.granted) { color: var(--bs-secondary-color); }
.perm-table .perm-col { width: 5.5rem; }
.perm-domain > summary { cursor: pointer; }

/* Expanded TESSERA lockup: AdminLTE caps .brand-image-xs at 33px, which leaves the 56px brand
   bar mostly empty. 46px (iterated at 1024/1440/1920) fills it with a 5px margin; width stays auto,
   so the 3.083:1 aspect is kept. Only .logo-xl, so the collapsed A1 mark is unchanged. */
.sidebar-brand .brand-link .logo-xl { max-height: 46px; margin-top: 0; top: 5px; }
