/* Honey Mustard theme tokens + dark mode.
   Loaded by both base.html (main app) and base_login.html (auth pages).
   Dark mode is driven by data-bs-theme="dark" on <html> (Bootstrap 5.3+). */

:root {
  --hm-accent: #FFB52E;
  --hm-accent-hover: #E69500;
  --hm-accent-rgb: 255, 181, 46;
  /* The mustard is a FILL colour, not a text colour: #FFB52E on white is 1.76:1.
     accent-text carries text and borders (5.99:1 on white); accent-ink is the
     dark lettering on a mustard fill (7.2:1).  Pinned by
     LeaseUxAuditFixTests.test_the_accent_text_token_meets_contrast_in_both_themes. */
  --hm-accent-text: #8a5a00;
  --hm-accent-ink: #2a1f06;

  --hm-page-bg: #f8f9fa;
  --hm-surface: #ffffff;
  --hm-surface-2: #f1f3f5;
  --hm-text: #333333;
  --hm-text-muted: #555555;
  --hm-border: #e3e3e3;

  --hm-radius: 12px;
  --hm-card-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);

  /* Auth page background gradient */
  --hm-bg-from: #FFF3C4;
  --hm-bg-to: #FFD36E;

  /* Login brand panel */
  --hm-brand-from: #FFF3C4;
  --hm-brand-mid: #FFB52E;
  --hm-brand-to: #E69500;
  --hm-brand-text: #5e4109;
  --hm-brand-text-muted: #7a5b12;
  --hm-badge-bg: rgba(255, 255, 255, 0.25);

  /* Navbar hamburger (rendered as a mask, tinted with --hm-text) */
  --hm-burger: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3E%3Cpath stroke='%23000' stroke-width='2.2' stroke-linecap='round' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E");
}

[data-bs-theme="dark"] {
  --hm-accent: #FFC04D;
  --hm-accent-hover: #FFD27A;
  --hm-accent-rgb: 255, 192, 77;
  --hm-accent-text: #FFC04D;   /* 10.3:1 on the dark surface, so the accent itself will do */
  --hm-accent-ink: #2a1f06;

  --hm-page-bg: #17140f;
  --hm-surface: #221d16;
  --hm-surface-2: #2b251c;
  --hm-text: #ece6da;
  --hm-text-muted: #b3aa98;
  --hm-border: #38322a;

  --hm-card-shadow: 0 15px 30px rgba(0, 0, 0, 0.45);

  --hm-bg-from: #1d1812;
  --hm-bg-to: #0f0d0a;

  --hm-brand-from: #241d12;
  --hm-brand-mid: #5a4310;
  --hm-brand-to: #2e2207;
  --hm-brand-text: #f3e9d2;
  --hm-brand-text-muted: #cbb98f;
  --hm-badge-bg: rgba(255, 255, 255, 0.10);

  /* Bootstrap 5.3 dark surfaces, tuned warm (not blue-gray) */
  --bs-body-bg: #17140f;
  --bs-body-color: #ece6da;
  --bs-emphasis-color: #ffffff;
  --bs-secondary-color: rgba(236, 230, 218, 0.70);
  --bs-secondary-bg: #221d16;
  --bs-tertiary-bg: #2b251c;
  --bs-border-color: #38322a;
  --bs-card-bg: #221d16;
  --bs-card-cap-bg: rgba(255, 181, 46, 0.10);
  --bs-link-color: #FFC65A;
  --bs-link-color-rgb: 255, 198, 90;
  --bs-link-hover-color: #FFD98A;
  --bs-link-hover-color-rgb: 255, 217, 138;
}

body { transition: background-color 0.25s ease, color 0.25s ease; }

/* Theme toggle button - fixed-size circular icon button */
.hm-theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--hm-text-muted);
  cursor: pointer;
  font-size: 1.05rem;
  line-height: 1;
  transition: color 0.2s, background-color 0.2s;
}
.hm-theme-toggle:hover { color: var(--hm-accent-text); background: rgba(var(--hm-accent-rgb), 0.12); }

/* ---- Mustard buttons, as Bootstrap button variants ----
   Written with Bootstrap's own --bs-btn-* variables so hover, active, focus
   ring and disabled all come from the framework.  The old hand-rolled
   .btn-outline-mustard (in base.html until 2026-09-10) had mustard text on
   white, white text on mustard, and no focus ring at all. */
.btn-outline-mustard {
  --bs-btn-color: var(--hm-accent-text);
  --bs-btn-border-color: var(--hm-accent);
  --bs-btn-hover-color: var(--hm-accent-ink);
  --bs-btn-hover-bg: var(--hm-accent);
  --bs-btn-hover-border-color: var(--hm-accent);
  --bs-btn-active-color: var(--hm-accent-ink);
  --bs-btn-active-bg: var(--hm-accent-hover);
  --bs-btn-active-border-color: var(--hm-accent-hover);
  --bs-btn-focus-shadow-rgb: var(--hm-accent-rgb);
  --bs-btn-disabled-color: var(--hm-accent-text);
  --bs-btn-disabled-border-color: var(--hm-accent);
}
.btn-mustard {
  --bs-btn-color: var(--hm-accent-ink);
  --bs-btn-bg: var(--hm-accent);
  --bs-btn-border-color: var(--hm-accent);
  --bs-btn-hover-color: var(--hm-accent-ink);
  --bs-btn-hover-bg: var(--hm-accent-hover);
  --bs-btn-hover-border-color: var(--hm-accent-hover);
  --bs-btn-active-color: var(--hm-accent-ink);
  --bs-btn-active-bg: var(--hm-accent-hover);
  --bs-btn-active-border-color: var(--hm-accent-hover);
  --bs-btn-focus-shadow-rgb: var(--hm-accent-rgb);
  --bs-btn-disabled-color: var(--hm-accent-ink);
  --bs-btn-disabled-bg: var(--hm-accent);
  --bs-btn-disabled-border-color: var(--hm-accent);
  font-weight: 600;
}

/* ---- Shared: pills, panels, row links (2026-09-11) ---- */
.hm-pill {
  display: inline-block; margin-left: 0.4rem; padding: 0.1rem 0.45rem; border-radius: 999px;
  font-size: 0.68rem; font-weight: 600; line-height: 1.4; vertical-align: 1px; white-space: nowrap;
}
.hm-pill.is-danger { color: #8a1c24; background: rgba(176, 42, 55, 0.12); }
.hm-pill.is-warning { color: #7a4d00; background: rgba(var(--hm-accent-rgb), 0.22); }
.hm-pill.is-good { color: #1d5a2d; background: rgba(40, 140, 70, 0.14); }
.hm-pill.is-ok { color: var(--hm-text); background: rgba(127, 127, 127, 0.16); }
[data-bs-theme="dark"] .hm-pill.is-danger { color: #f3b9bd; background: rgba(220, 80, 95, 0.22); }
[data-bs-theme="dark"] .hm-pill.is-warning { color: #ffd98a; background: rgba(var(--hm-accent-rgb), 0.18); }
[data-bs-theme="dark"] .hm-pill.is-good { color: #9fe0b0; background: rgba(60, 170, 90, 0.2); }
.hm-panel { padding: 1.25rem 1.5rem 1rem; }
.hm-panel-title { font-size: 1rem; font-weight: 600; margin: 0 0 0.75rem; }
.hm-panel-sub { font-size: 0.78rem; font-weight: 600; color: var(--hm-text-muted); margin: 1.4rem 0 0.4rem; }
.hm-row-link { color: var(--hm-text); text-decoration: none; border-radius: 6px; }
.hm-row-link:hover, .hm-row-link:focus-visible { background: rgba(var(--hm-accent-rgb), 0.10); color: var(--hm-text); }
.hm-row-link:focus-visible { outline: 2px solid var(--hm-accent-text); outline-offset: 1px; }

/* ---- Dashboard (2026-09-11): what needs action, then the book ---- */
.hm-dash { max-width: 1040px; margin: 0 auto; }
.hm-dash-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 1.5rem; align-items: start; }
@media (max-width: 991.98px) { .hm-dash-grid { grid-template-columns: 1fr; } }
.hm-attn { display: grid; gap: 0.15rem; }
.hm-attn-row {
  display: grid; grid-template-columns: 3.2rem minmax(0, 1fr) 1rem; align-items: center; gap: 0.75rem;
  padding: 0.55rem 0.6rem; margin: 0 -0.6rem; border-radius: 8px; color: var(--hm-text); text-decoration: none;
}
a.hm-attn-row:hover, a.hm-attn-row:focus-visible { background: rgba(var(--hm-accent-rgb), 0.10); color: var(--hm-text); }
a.hm-attn-row:focus-visible { outline: 2px solid var(--hm-accent-text); outline-offset: 1px; }
.hm-attn-row.is-clear { color: var(--hm-text-muted); }
.hm-attn-count { font-size: 1.6rem; font-weight: 600; line-height: 1; text-align: right; font-variant-numeric: tabular-nums; }
.hm-attn-label { font-size: 0.95rem; font-weight: 500; line-height: 1.25; }
.hm-attn-label small { display: block; font-size: 0.76rem; font-weight: 400; color: var(--hm-text-muted); margin-top: 0.1rem; }
.hm-attn-go { font-size: 0.75rem; color: var(--hm-text-muted); }
a.hm-attn-row:hover .hm-attn-go { color: var(--hm-accent-text); }
.hm-expiry { list-style: none; margin: 0; padding: 0; }
.hm-expiry-row {
  display: grid; grid-template-columns: 3.2rem minmax(0, 1fr) auto; gap: 0.75rem; align-items: center;
  padding: 0.4rem 0.6rem; margin: 0 -0.6rem; border-radius: 6px; color: var(--hm-text); text-decoration: none; font-size: 0.88rem;
}
.hm-expiry-row:hover, .hm-expiry-row:focus-visible { background: rgba(var(--hm-accent-rgb), 0.10); color: var(--hm-text); }
.hm-expiry li + li .hm-expiry-row { border-top: 1px solid var(--hm-border); border-radius: 0; }
.hm-expiry-store { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.hm-expiry-where { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hm-expiry-when { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hm-expiry-when small { display: block; color: var(--hm-text-muted); font-size: 0.72rem; }
.hm-book-total { display: flex; align-items: baseline; gap: 0.5rem; color: var(--hm-text); text-decoration: none; margin-bottom: 0.75rem; }
.hm-book-total:hover { color: var(--hm-accent-text); }
.hm-book-number { font-size: 2.4rem; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.hm-book-word { font-size: 1rem; color: var(--hm-text-muted); }
.hm-split { display: flex; height: 10px; border-radius: 5px; overflow: hidden; gap: 2px; }
.hm-split-seg { display: block; flex-basis: 0; min-width: 4px; }
.hm-split-seg.is-1, .hm-legend-dot.is-1 { background: var(--hm-accent); }
.hm-split-seg.is-2, .hm-legend-dot.is-2 { background: rgba(var(--hm-accent-rgb), 0.35); }
.hm-split-seg.is-3, .hm-legend-dot.is-3 { background: var(--hm-text-muted); }
.hm-legend { display: flex; flex-wrap: wrap; gap: 0.35rem 1.25rem; margin-top: 0.5rem; font-size: 0.85rem; }
.hm-legend-item { color: var(--hm-text); text-decoration: none; }
.hm-legend-item:hover { color: var(--hm-accent-text); }
.hm-legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 0.4rem; vertical-align: -1px; }
.hm-book-list { list-style: none; margin: 0; padding: 0; }
.hm-book-row {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: 0.45rem 0.6rem; margin: 0 -0.6rem; color: var(--hm-text); text-decoration: none; font-size: 0.92rem; border-radius: 6px;
}
.hm-book-list li + li .hm-book-row { border-top: 1px solid var(--hm-border); border-radius: 0; }
.hm-book-row:hover, .hm-book-row:focus-visible { background: rgba(var(--hm-accent-rgb), 0.10); color: var(--hm-text); }
.hm-book-row strong { font-variant-numeric: tabular-nums; }
.hm-book-row.is-muted { color: var(--hm-text-muted); }

/* ---- Lease list (2026-09-11) ---- */
.hm-list-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 0.5rem 1rem; margin-bottom: 1rem; }
.hm-list-actions { display: flex; gap: 0.5rem; }
.hm-filter-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.hm-filter-search { position: relative; flex: 1 1 260px; }
.hm-filter-search > i { position: absolute; left: 0.7rem; top: 50%; transform: translateY(-50%); font-size: 0.8rem; color: var(--hm-text-muted); pointer-events: none; }
.hm-filter .form-control, .hm-filter .form-select { font-size: 0.88rem; padding: 0.35rem 0.6rem; }
.hm-filter .hm-filter-search .form-control { padding-left: 2rem; }
.hm-filter .form-select { flex: 0 1 12rem; width: auto; }
.hm-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.75rem 0 1rem; }
.hm-chip {
  display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.25rem 0.7rem; border-radius: 999px;
  border: 1px solid var(--hm-border); background: var(--hm-surface); color: var(--hm-text); text-decoration: none;
  font-size: 0.82rem; font-weight: 500; line-height: 1.3; transition: background-color 0.15s, border-color 0.15s;
}
.hm-chip:hover { border-color: var(--hm-accent); color: var(--hm-text); }
.hm-chip:focus-visible { outline: 2px solid var(--hm-accent-text); outline-offset: 1px; }
.hm-chip.is-active { background: var(--hm-accent); border-color: var(--hm-accent); color: var(--hm-accent-ink); }
.hm-chip-count { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--hm-text-muted); }
.hm-chip.is-active .hm-chip-count { color: var(--hm-accent-ink); }
.hm-chip.is-clear { border-style: dashed; color: var(--hm-text-muted); }
.hm-table-card { margin-bottom: 0; }
.hm-table { font-size: 0.84rem; }
.hm-table th, .hm-table td { padding: 0.45rem 0.55rem; vertical-align: middle; white-space: nowrap; }
/* A status pill sits UNDER its date, not beside it, so Expired and Past never
   widen the column and push the actions off screen (Eric, 2026-09-11). */
.hm-table .hm-date .hm-pill { display: block; width: fit-content; margin: 0.15rem 0 0; }
.hm-table .hm-where { white-space: normal; max-width: 15rem; }
.hm-table .hm-wrap { white-space: normal; line-height: 1.45; min-width: 22rem; }
.hm-clauses { max-width: 1100px; margin: 0 auto; }

/* ---- Lease detail (2026-09-11) ---- */
.hm-detail { max-width: 1100px; margin: 0 auto; }
.hm-brand-lg { height: 16px; vertical-align: 2px; }
.hm-detail-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 1.5rem; align-items: start; margin-bottom: 1.5rem; }
@media (max-width: 991.98px) { .hm-detail-grid { grid-template-columns: 1fr; } }
.hm-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 0.85rem 1.5rem; margin: 0; }
.hm-facts.card { margin-bottom: 1.5rem; padding-bottom: 1.25rem; }
.hm-facts dt { font-size: 0.74rem; font-weight: 600; color: var(--hm-text-muted); margin-bottom: 0.15rem; }
.hm-facts dd { margin: 0; font-size: 0.95rem; }
.hm-facts dd small { display: block; color: var(--hm-text-muted); font-size: 0.76rem; }
.hm-facts dd .hm-pill { vertical-align: 1px; }
.hm-facts .span2 { grid-column: span 2; }
.hm-note-line { font-size: 0.86rem; color: var(--hm-text-muted); margin: -0.75rem 0 1rem; }
.hm-rent-now { font-size: 2rem; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.hm-rent-now small { font-size: 0.86rem; font-weight: 400; color: var(--hm-text-muted); }
.hm-costs { list-style: none; margin: 0.9rem 0 0; padding: 0; font-size: 0.9rem; }
.hm-costs li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.35rem 0; border-top: 1px solid var(--hm-border); }
.hm-costs li span:last-child { font-variant-numeric: tabular-nums; white-space: nowrap; }
.hm-costs li small { display: block; color: var(--hm-text-muted); font-size: 0.74rem; }
.hm-costs li.is-total { font-weight: 600; }
.hm-table tr.is-current td, .hm-table tr.is-current th { background: rgba(var(--hm-accent-rgb), 0.10); }
.hm-table th[scope="row"] { font-weight: 600; background: transparent; }
.hm-table tr.hm-off th, .hm-table tr.hm-off td { color: var(--hm-text-muted); }
.hm-clause-table th[scope="row"] { white-space: normal; min-width: 12rem; }
.hm-notes { white-space: pre-wrap; font-size: 0.92rem; }
.hm-photos { display: flex; flex-wrap: wrap; gap: 1.5rem; }
.hm-photos figure { margin: 0; }
.hm-photos figcaption { font-size: 0.78rem; color: var(--hm-text-muted); margin-top: 0.35rem; }
.hm-photo { max-height: 220px; max-width: 100%; border-radius: 8px; }
.hm-photo-person { border-radius: 50%; width: 160px; height: 160px; object-fit: cover; }
.hm-detail-foot { font-size: 0.84rem; margin: 0; }
.hm-danger-link { color: var(--hm-text-muted); text-decoration: none; }
.hm-danger-link:hover { color: #8a1c24; text-decoration: underline; }
.hm-table tbody tr[data-href] { cursor: pointer; }

/* ---- Sales (2026-09-11) ---- */
.hm-sales { max-width: 1100px; margin: 0 auto; }
.hm-filter-store { flex: 0 1 14rem; }
.hm-sales-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 0.25rem 1rem; margin-bottom: 1rem; }
.hm-sales-head small { display: block; font-size: 0.82rem; font-weight: 400; color: var(--hm-text-muted); margin-top: 0.15rem; }
.hm-figures { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; padding: 0.25rem 0 0.5rem; }
@media (max-width: 575.98px) { .hm-figures { grid-template-columns: 1fr; } }
.hm-figure { display: flex; flex-direction: column; gap: 0.15rem; }
.hm-figure-label { font-size: 0.76rem; font-weight: 600; color: var(--hm-text-muted); }
.hm-figure-value { font-size: 1.7rem; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.hm-figure-value .hm-pill { vertical-align: 0.45em; margin-left: 0.5rem; }
.hm-figure-note { font-size: 0.78rem; color: var(--hm-text-muted); }
.hm-periods th[scope="row"], .hm-years th[scope="row"] { font-weight: 600; color: var(--hm-text); background: transparent; font-size: 0.84rem; }
.hm-periods td { text-align: right; font-variant-numeric: tabular-nums; }
.hm-periods thead th { text-align: right; }
.hm-periods thead th:first-child { text-align: left; }
.hm-periods .hm-total { font-weight: 600; border-left: 1px solid var(--hm-border); }
.hm-years tr.is-selected td, .hm-years tr.is-selected th { background: rgba(var(--hm-accent-rgb), 0.10); }
.hm-trend { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.35rem; font-size: 0.9rem; }
.hm-trend li { display: flex; align-items: center; gap: 0.6rem; }
.hm-trend li i { width: 1.4rem; height: 1.4rem; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 0.7rem; }
.hm-trend li.is-good i { color: #1d5a2d; background: rgba(40, 140, 70, 0.14); }
.hm-trend li.is-danger i { color: #8a1c24; background: rgba(176, 42, 55, 0.12); }
[data-bs-theme="dark"] .hm-trend li.is-good i { color: #9fe0b0; background: rgba(60, 170, 90, 0.2); }
[data-bs-theme="dark"] .hm-trend li.is-danger i { color: #f3b9bd; background: rgba(220, 80, 95, 0.22); }
.hm-empty-panel { padding: 1.5rem; }
/* The actions stay pinned to the right edge whatever the table's width. */
.hm-table .hm-actions, .hm-table th:last-child {
  position: sticky; right: 0; z-index: 1;
  background: var(--bs-card-bg, var(--hm-surface));
  box-shadow: -10px 0 10px -10px rgba(0, 0, 0, 0.25);
}
.hm-table thead th:last-child { background: var(--hm-surface-2); }
.hm-table tbody tr:hover .hm-actions { background: var(--hm-surface-2); }
.hm-table thead th { font-size: 0.72rem; font-weight: 600; color: var(--hm-text-muted); border-bottom: 1px solid var(--hm-border); background: var(--hm-surface-2); }
.hm-sort { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.15rem 0.35rem; margin: -0.15rem -0.35rem; border-radius: 4px; }
.hm-sort:hover { color: var(--hm-text); background: rgba(var(--hm-accent-rgb), 0.12); }
.hm-sort i { font-size: 0.7rem; opacity: 0.5; }
.is-sorted .hm-sort { color: var(--hm-text); }
.is-sorted .hm-sort i { opacity: 1; color: var(--hm-accent-text); }
.hm-store-link { font-weight: 600; color: var(--hm-text); text-decoration: none; }
.hm-store-link:hover { color: var(--hm-accent-text); text-decoration: underline; }
.brand-logo { height: 11px; width: auto; margin-left: 0.4rem; vertical-align: -1px; opacity: 0.85; }
.hm-where { line-height: 1.2; }
.hm-where small { display: block; color: var(--hm-text-muted); font-size: 0.74rem; }
.hm-date, .hm-money { font-variant-numeric: tabular-nums; }
.hm-money { text-align: right; font-weight: 600; }
.hm-actions { text-align: right; }
.hm-icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 6px;
  color: var(--hm-text-muted); text-decoration: none;
}
.hm-icon-btn:hover, .hm-icon-btn:focus-visible { color: var(--hm-accent-text); background: rgba(var(--hm-accent-rgb), 0.12); }
.hm-icon-btn:focus-visible { outline: 2px solid var(--hm-accent-text); outline-offset: 1px; }
.hm-empty { text-align: center; padding: 2.5rem 1rem !important; color: var(--hm-text-muted); white-space: normal !important; }
.hm-pager { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.5rem; padding: 0.6rem 0.75rem; border-top: 1px solid var(--hm-border); font-size: 0.84rem; }
.hm-pager-links { display: flex; align-items: center; gap: 0.5rem; }
.hm-pager-page { color: var(--hm-text-muted); }
@media (max-width: 1399.98px) { .hm-col-updated { display: none; } }

/* ---- Lease edit form (tightened 2026-09-10 for Mandee, who is the one
   person who edits here).  Was full-width Bootstrap columns with a card
   nested inside the card for every rent period, clause and cost. ---- */
.hm-form { max-width: 820px; margin: 0 auto; }
.hm-form-head {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end;
  gap: 0.5rem 1rem; margin-bottom: 1rem;
}
.hm-form-card { padding: 0.5rem 1.75rem 0; }
.hm-fs { border: 0; margin: 0; padding: 1.2rem 0 1rem; border-top: 1px solid var(--hm-border); }
.hm-fs:first-of-type { border-top: 0; padding-top: 1.4rem; }
.hm-fs > legend {
  float: none; width: auto; margin: 0 0 0.6rem; padding: 0;
  font-size: 0.95rem; font-weight: 600; color: var(--hm-text);
}
.hm-fs-note { font-size: 0.8rem; color: var(--hm-text-muted); margin: -0.35rem 0 0.6rem; }
.hm-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 0.55rem 0.75rem; }
.hm-grid > * { grid-column: span 12; min-width: 0; }
@media (min-width: 768px) {
  .hm-grid > .c2 { grid-column: span 2; }
  .hm-grid > .c3 { grid-column: span 3; }
  .hm-grid > .c4 { grid-column: span 4; }
  .hm-grid > .c5 { grid-column: span 5; }
  .hm-grid > .c6 { grid-column: span 6; }
  .hm-grid > .c7 { grid-column: span 7; }
  .hm-grid > .c8 { grid-column: span 8; }
  .hm-grid > .c9 { grid-column: span 9; }
}
.hm-form .form-label { font-size: 0.78rem; font-weight: 500; color: var(--hm-text-muted); margin-bottom: 0.15rem; }
.hm-form .form-control, .hm-form .form-select { font-size: 0.9rem; padding: 0.3rem 0.55rem; }
.hm-form textarea.form-control { min-height: 2.35rem; field-sizing: content; }
.hm-form .form-text { font-size: 0.74rem; margin-top: 0.15rem; }
.hm-form .form-check-label { font-size: 0.9rem; }
.hm-rows { display: grid; gap: 0.4rem; }
.hm-row {
  display: grid; grid-template-columns: 8.5rem repeat(3, minmax(0, 1fr));
  gap: 0.35rem 0.75rem; align-items: center;
}
.hm-row-head { font-size: 0.74rem; font-weight: 500; color: var(--hm-text-muted); }
.hm-row-label { font-size: 0.88rem; font-weight: 500; }
.hm-row-label small { display: block; font-weight: 400; color: var(--hm-text-muted); font-size: 0.72rem; }
.hm-clause {
  display: grid; grid-template-columns: 13rem 6.5rem minmax(0, 1fr);
  gap: 0.35rem 0.75rem; align-items: start;
}
.hm-clause .form-switch { padding-top: 0.3rem; }
@media (max-width: 767.98px) {
  .hm-row, .hm-clause { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hm-row-label, .hm-clause .form-switch, .hm-clause .hm-clause-comments { grid-column: 1 / -1; }
  .hm-row-head { display: none; }
}
.hm-form-actions {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; justify-content: flex-end; align-items: center; gap: 0.5rem;
  padding: 0.75rem 0; margin-top: 0.5rem;
  background: var(--bs-card-bg, var(--hm-surface)); border-top: 1px solid var(--hm-border);
}
.hm-form-actions .hm-form-hint { margin-right: auto; font-size: 0.8rem; color: var(--hm-text-muted); }
.hm-form-errors ul { margin: 0.4rem 0 0 1.1rem; padding: 0; }
.hm-form-errors a { font-weight: 600; }
@media (prefers-reduced-motion: reduce) {
  body, .nav-link, .hm-theme-toggle { transition: none; }
}
.hm-theme-toggle--fixed {
  position: fixed;
  top: 16px;
  right: 18px;
  z-index: 1080;
  color: var(--hm-text);
  background: rgba(127, 127, 127, 0.10);
}

/* Theme-aware navbar hamburger (always tinted with the text color) */
.navbar-toggler-icon {
  background-image: none;
  background-color: var(--hm-text);
  -webkit-mask: var(--hm-burger) center / 100% 100% no-repeat;
  mask: var(--hm-burger) center / 100% 100% no-repeat;
}

/* ---- Dark-mode fixes for fixed-color Bootstrap utilities ----
   These let pages that use bg-white / bg-light / text-dark / table-light
   adapt to dark mode without per-page edits. */
[data-bs-theme="dark"] .bg-white { background-color: var(--hm-surface) !important; }
[data-bs-theme="dark"] .bg-light { background-color: var(--hm-surface-2) !important; }
[data-bs-theme="dark"] .text-dark { color: var(--hm-text) !important; }
[data-bs-theme="dark"] .text-black { color: var(--hm-text) !important; }
[data-bs-theme="dark"] .table-light {
  --bs-table-bg: #2b251c;
  --bs-table-color: var(--hm-text);
  --bs-table-border-color: var(--hm-border);
}
[data-bs-theme="dark"] .alert-hm { background: #3a1d20; border-color: #5c2b30; color: #f3b9bd; }

/* The logo is the way back to the section picker in every shell (Eric,
   2026-09-23).  A logo link is easy to miss, so hovering or tabbing to it
   shows "All sections" underneath.  Fixed colours on purpose: the same rule
   is in theme.css and nro.css and the chip must look identical in both. */
.hm-home-link { position: relative; }
.hm-home-link::after {
  content: attr(data-label);
  position: absolute; left: 0; top: calc(100% + 6px); z-index: 1100;
  padding: 3px 9px; border-radius: 6px;
  background: #0f172a; color: #ffffff;
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.02em; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity 0.15s ease;
}
.hm-home-link:hover::after,
.hm-home-link:focus-visible::after { opacity: 1; }

/* ---- Scorecard (2026-09-23) ----
   Executives read it: against the goal first, then the three departments.
   Every count carries its stores underneath, small, instead of a wide third
   column (the first version left huge gaps between Person, Period and Stores).
   The goal bar reuses the dashboard's split-bar device; its dark tick is the
   share of the year gone, Chuck's "79% of goal in 66% of the time". */
.sc { max-width: 1080px; margin: 0 auto; }
@media (max-width: 575.98px) { .sc { padding-left: 16px; padding-right: 16px; } }
.sc-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.75rem 1.5rem; margin-bottom: 1rem; }
.sc-head-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; }
.sc-title { font-size: 1.6rem; font-weight: 600; letter-spacing: -0.01em; margin: 0; }
.sc-sub { margin: 0.2rem 0 0; color: var(--hm-text-muted); font-size: 0.92rem; }
.sc-sub strong { color: var(--hm-text); margin-right: 0.35rem; }

.sc-picker { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.sc-seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; background: var(--hm-surface); border: 1px solid var(--hm-border); border-radius: 10px; }
.sc-seg-item {
  padding: 0.3rem 0.55rem; border-radius: 7px; font-size: 0.8rem; font-weight: 600;
  color: var(--hm-text); text-decoration: none; font-variant-numeric: tabular-nums;
}
.sc-seg-item:hover { background: rgba(var(--hm-accent-rgb), 0.14); color: var(--hm-text); }
.sc-seg-item:focus-visible { outline: 2px solid var(--hm-accent-text); outline-offset: 1px; }
.sc-seg-item.is-current, .sc-seg-item.is-current:hover { background: var(--hm-accent); color: var(--hm-accent-ink); }

.sc-goals { margin-bottom: 1rem; padding-bottom: 0.6rem; }
.sc-goals-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.sc-elapsed { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.8rem; color: var(--hm-text-muted); }
.sc-pace-key { display: inline-block; width: 2px; height: 12px; border-radius: 1px; background: var(--hm-text); }
.sc-goal {
  display: grid; grid-template-columns: minmax(9rem, 1.1fr) 6.5rem minmax(8rem, 2fr) minmax(10rem, auto);
  align-items: center; gap: 0.5rem 1.25rem; padding: 0.5rem 0;
}
.sc-goal + .sc-goal { border-top: 1px solid var(--hm-border); }
/* Six goals pair up (franchise, lease, construction): two per row on wide
   screens keeps the scorecard on one screen (Eric, 2026-09-23). */
@media (min-width: 1200px) {
  .sc-goal-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 2.5rem; }
  .sc-goal { grid-template-columns: minmax(9.5rem, 1.3fr) 4.75rem minmax(3rem, 1fr) auto; gap: 0.4rem 0.8rem; }
  .sc-goal + .sc-goal { border-top: 0; }
  .sc-goal:nth-child(n+3) { border-top: 1px solid var(--hm-border); }
}
.sc-goal-label { font-size: 0.95rem; font-weight: 600; line-height: 1.25; }
.sc-goal-label small { display: block; font-size: 0.76rem; font-weight: 400; color: var(--hm-text-muted); }
.sc-goal-figure { text-align: right; white-space: nowrap; font-size: 0.9rem; color: var(--hm-text-muted); font-variant-numeric: tabular-nums; }
.sc-goal-figure strong { font-size: 1.5rem; font-weight: 600; color: var(--hm-text); margin-right: 0.15rem; }
.sc-meter { position: relative; height: 10px; border-radius: 5px; background: var(--hm-surface-2); }
.sc-meter-fill { position: absolute; top: 0; bottom: 0; left: 0; border-radius: 5px; background: var(--hm-accent); }
.sc-meter-pace { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; border-radius: 1px; background: var(--hm-text); }
.sc-goal-state { font-size: 0.85rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (max-width: 767.98px) {
  .sc-goal { grid-template-columns: minmax(0, 1fr) auto; }
  .sc-meter, .sc-goal-state { grid-column: 1 / -1; }
}

.sc-depts { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; align-items: start; }
.sc-grid-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 2.9rem 2.9rem; gap: 0.2rem 0.6rem;
  align-items: start; padding: 0.35rem 0;
}
.sc-grid-row + .sc-grid-row { border-top: 1px solid var(--hm-border); }
.sc-grid-row > :not(:first-child) { text-align: right; }
.sc-grid-re .sc-grid-row { grid-template-columns: minmax(0, 1fr) 4.6rem 4.6rem; }
.sc-grid-row > .sc-row-stores { grid-column: 1 / -1; text-align: left; margin-top: 0; }
.sc-grid-head { padding-top: 0; font-size: 0.72rem; font-weight: 600; color: var(--hm-text-muted); }
.sc-grid-row.sc-grid-total { border-top-color: var(--hm-text-muted); }
.sc-grid-total .sc-label, .sc-grid-ytd .sc-label { font-size: 0.82rem; font-weight: 600; color: var(--hm-text-muted); }
.sc-label { font-size: 0.9rem; line-height: 1.3; }
/* One line per row (Eric, 2026-09-23): a wrapped label staggered the rows.
   Anything that still cannot fit ends in an ellipsis; the title has it whole. */
.sc-grid-row > .sc-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-label small { display: block; font-size: 0.74rem; color: var(--hm-text-muted); }
.sc-num { display: block; font-size: 1.05rem; font-weight: 600; line-height: 1.2; font-variant-numeric: tabular-nums; }
.sc-num.is-zero { font-weight: 500; color: var(--hm-text-muted); }
.sc-stores { display: block; margin-top: 0.1rem; font-size: 0.72rem; line-height: 1.35; color: var(--hm-text-muted); }
.sc-stores a { color: var(--hm-accent-text); text-decoration: none; }
.sc-stores a:hover { text-decoration: underline; }
.sc-unknown { font-style: italic; }
.sc-note { margin: 0.7rem 0 0; padding: 0.55rem 0.75rem; border-radius: 8px; background: var(--hm-surface-2); font-size: 0.86rem; }
.sc-note blockquote { white-space: pre-line; }
.sc-note figcaption { margin-top: 0.35rem; font-size: 0.74rem; color: var(--hm-text-muted); }

.sc-manage { list-style: none; margin: 0; padding: 0; }
.sc-manage-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 1rem; padding: 0.7rem 0; }
.sc-manage-row + .sc-manage-row { border-top: 1px solid var(--hm-border); }
.sc-manage-state { text-align: right; font-size: 0.86rem; }
.sc-manage-state small { display: block; font-size: 0.74rem; color: var(--hm-text-muted); }

@media print {
  .sc-noprint, .navbar { display: none !important; }
  .sc .card { box-shadow: none; break-inside: avoid; }
}

/* Year so far (scorecard/_growth.html).  Series are categorical slots 1-3 in
   fixed order, validated for both card surfaces (dataviz palette script); the
   goal ramp is text ink.  Text never wears a series colour. */
.sc-growth { margin-top: 1rem; }
.sc-growth, .sc-growth .sc-tip { --sc-s1: #2a78d6; --sc-s2: #eb6834; --sc-s3: #1baf7a; }
[data-bs-theme="dark"] .sc-growth { --sc-s1: #3987e5; --sc-s2: #d95926; --sc-s3: #199e70; }
.sc-legend { display: flex; flex-wrap: wrap; gap: 0.3rem 1.1rem; list-style: none; margin: 0; padding: 0; font-size: 0.8rem; color: var(--hm-text-muted); }
.sc-legend li { display: inline-flex; align-items: center; gap: 0.4rem; }
.sc-key { display: inline-block; width: 14px; height: 2px; border-radius: 1px; background: var(--hm-text-muted); }
.sc-key.sc-series-1 { background: var(--sc-s1); } .sc-key.sc-series-2 { background: var(--sc-s2); } .sc-key.sc-series-3 { background: var(--sc-s3); }
.sc-key-pace { background: var(--hm-text); height: 1px; }
.sc-chart { position: relative; margin-top: 0.4rem; }
.sc-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.sc-chart svg:focus-visible { outline: 2px solid var(--hm-accent-text); outline-offset: 4px; border-radius: 4px; }
.sc-grid-line { stroke: var(--hm-border); stroke-width: 1; }
.sc-axis { fill: var(--hm-text-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.sc-axis.is-ahead { opacity: 0.55; }
.sc-pace-line { fill: none; stroke: var(--hm-text); stroke-width: 1.5; stroke-dasharray: 5 4; opacity: 0.65; }
.sc-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.sc-line.sc-series-1 { stroke: var(--sc-s1); } .sc-line.sc-series-2 { stroke: var(--sc-s2); } .sc-line.sc-series-3 { stroke: var(--sc-s3); }
.sc-dot { stroke: var(--hm-surface); stroke-width: 2; }
.sc-dot.sc-series-1 { fill: var(--sc-s1); } .sc-dot.sc-series-2 { fill: var(--sc-s2); } .sc-dot.sc-series-3 { fill: var(--sc-s3); }
.sc-end { fill: var(--hm-text); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.sc-crosshair { stroke: var(--hm-text-muted); stroke-width: 1; }
.sc-tip {
  position: absolute; top: 0; z-index: 5; min-width: 11rem; padding: 0.5rem 0.65rem; border-radius: 8px;
  background: var(--hm-surface); border: 1px solid var(--hm-border); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
  font-size: 0.8rem; color: var(--hm-text-muted); pointer-events: none;
}
.sc-tip-head { font-weight: 600; color: var(--hm-text); margin-bottom: 0.2rem; }
.sc-tip > div:not(.sc-tip-head) { display: flex; align-items: center; gap: 0.4rem; }
.sc-tip strong { color: var(--hm-text); font-variant-numeric: tabular-nums; min-width: 1.6rem; text-align: right; }
.sc-table { margin-top: 0.6rem; font-size: 0.85rem; }
.sc-table summary { cursor: pointer; color: var(--hm-accent-text); font-weight: 500; }
.sc-table table { margin-top: 0.5rem; font-variant-numeric: tabular-nums; }
@media print { .sc-growth { break-inside: avoid; } }
