/* =============================================================================
   Component layer (§2.4). All reusable UI lives here, `hh-` prefixed. Adding a
   theme is a variable block (20-theme.css), never new components.
   ========================================================================== */

body {
  font-family: var(--hh-font-sans);
  background: var(--hh-bg);
  color: var(--hh-ink);
  font-size: 15px;
  letter-spacing: -0.006em;
}

/* ---------- App shell layout ---------- */
.hh-app { min-height: 100vh; display: flex; flex-direction: column; }
.hh-main {
  flex: 1 1 auto;
  width: 100%;
  max-width: 1120px;
  margin-inline: auto;
  padding: var(--hh-space-6) var(--hh-space-5) var(--hh-space-12);
}
.hh-page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  flex-wrap: wrap; gap: var(--hh-space-3); margin-bottom: var(--hh-space-5);
}
.hh-page-title { font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.1rem); letter-spacing: -0.025em; }
.hh-page-sub { color: var(--hh-ink-soft); margin-top: 2px; }

/* ---------- Navbar ---------- */
.hh-nav {
  position: sticky; top: 0; z-index: var(--hh-z-sticky);
  display: flex; align-items: center; gap: var(--hh-space-4);
  height: 60px; padding: 0 var(--hh-space-5);
  background: color-mix(in oklab, var(--hh-surface) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--hh-border);
}
.hh-brand {
  display: inline-flex; align-items: center; gap: var(--hh-space-2);
  font-weight: 700; letter-spacing: -0.03em; font-size: 1.05rem;
}
.hh-brand__mark {
  width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center;
  color: var(--hh-accent-ink); font-size: 0.85rem; font-weight: 800;
  background: linear-gradient(140deg, var(--hh-accent), var(--hh-accent-strong));
  box-shadow: var(--hh-shadow-sm);
}
.hh-nav__links { display: flex; align-items: center; gap: var(--hh-space-1); }
.hh-nav__spacer { flex: 1 1 auto; }

.hh-navlink {
  display: inline-flex; align-items: center; gap: var(--hh-space-2);
  padding: var(--hh-space-2) var(--hh-space-3); border-radius: var(--hh-radius-sm);
  color: var(--hh-ink-soft); font-weight: 550; font-size: 0.92rem;
  transition: background var(--hh-dur-fast) var(--hh-ease-out),
              color var(--hh-dur-fast) var(--hh-ease-out);
}
.hh-navlink:hover { background: var(--hh-surface-2); color: var(--hh-ink); }
.hh-navlink--active { color: var(--hh-ink); background: var(--hh-accent-soft); }

/* ---------- Dropdowns (native popover-safe) ---------- */
.hh-dropdown { position: relative; }
.hh-menu {
  position: absolute; top: calc(100% + 8px); right: 0; min-width: 220px;
  background: var(--hh-surface); border: 1px solid var(--hh-border);
  border-radius: var(--hh-radius); box-shadow: var(--hh-shadow-lg);
  padding: var(--hh-space-2); z-index: var(--hh-z-dropdown);
  opacity: 0; transform: translateY(-6px) scale(0.98);
  transform-origin: top right; pointer-events: none;
  transition: opacity var(--hh-dur-fast) var(--hh-ease-out),
              transform var(--hh-dur-fast) var(--hh-ease-out);
}
.hh-dropdown[data-open="true"] .hh-menu { opacity: 1; transform: none; pointer-events: auto; }
.hh-menu__label {
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--hh-muted); padding: var(--hh-space-2) var(--hh-space-2) var(--hh-space-1);
}
.hh-menu__item {
  display: flex; align-items: center; gap: var(--hh-space-3);
  padding: var(--hh-space-2) var(--hh-space-3); border-radius: var(--hh-radius-sm);
  color: var(--hh-ink); font-size: 0.9rem; width: 100%; text-align: left;
}
.hh-menu__item:hover { background: var(--hh-surface-2); }
.hh-menu__item--danger, .hh-menu__item--danger:hover { color: var(--hh-danger); }
.hh-menu__sep { height: 1px; background: var(--hh-border); margin: var(--hh-space-2) 0; }
.hh-menu__icon { width: 1.1rem; text-align: center; opacity: 0.8; }

/* Avatar: uploaded image, or an initial on the accent fill. Reusable. */
.hh-avatar {
  width: 1.6rem; height: 1.6rem; border-radius: 50%; flex: none; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--hh-accent-strong); color: var(--hh-accent-ink);
  font-weight: 700; font-size: 0.72rem; line-height: 1;
}
.hh-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* User-menu trigger: bare avatar + name, no container chrome. */
.hh-usermenu__trigger {
  display: inline-flex; align-items: center; gap: var(--hh-space-2);
  background: none; border: 0; padding: var(--hh-space-1) var(--hh-space-2);
  border-radius: var(--hh-radius-pill); color: var(--hh-ink);
  font: inherit; cursor: pointer;
  transition: background var(--hh-dur-fast) var(--hh-ease-out);
}
.hh-usermenu__trigger:hover { background: var(--hh-surface-2); }
.hh-dropdown[data-open="true"] .hh-usermenu__trigger { background: var(--hh-surface-2); }
.hh-usermenu__name {
  max-width: 10rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600;
}
.hh-usermenu__caret { opacity: 0.6; font-size: 0.7rem; }
@media (max-width: 480px) { .hh-usermenu__name { display: none; } }

/* ---------- Buttons ---------- */
.hh-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--hh-space-2);
  padding: 0.55rem 1rem; border-radius: var(--hh-radius-sm);
  font-weight: 600; font-size: 0.92rem; line-height: 1;
  border: 1px solid transparent; color: var(--hh-ink);
  transition: background var(--hh-dur-fast) var(--hh-ease-out),
              border-color var(--hh-dur-fast) var(--hh-ease-out),
              transform var(--hh-dur-fast) var(--hh-ease-out),
              box-shadow var(--hh-dur-fast) var(--hh-ease-out);
}
.hh-btn:active { transform: translateY(1px); }
.hh-btn--primary {
  background: var(--hh-accent-strong); color: var(--hh-accent-ink);
  box-shadow: var(--hh-shadow-sm);
}
.hh-btn--primary:hover { background: color-mix(in oklab, var(--hh-accent-strong) 88%, black); }
.hh-btn--ghost { background: transparent; border-color: var(--hh-border-strong); color: var(--hh-ink); }
.hh-btn--ghost:hover { background: var(--hh-surface-2); }
.hh-btn--subtle { background: var(--hh-surface-2); }
.hh-btn--subtle:hover { background: var(--hh-surface-3); }
.hh-btn--danger { background: var(--hh-danger); color: oklch(0.99 0 0); }
.hh-btn--danger:hover { filter: brightness(0.94); }
.hh-btn--sm { padding: 0.38rem 0.7rem; font-size: 0.82rem; }
.hh-btn--icon { padding: 0.45rem; width: 2.1rem; height: 2.1rem; }
/* line icon — inline stroke SVG that inherits the button's text color */
.hh-icon { width: 1.15rem; height: 1.15rem; flex-shrink: 0; display: block; }
/* current page in an icon toolbar — mirrors .hh-navlink--active */
.hh-btn--active { color: var(--hh-ink); background: var(--hh-accent-soft); border-color: var(--hh-accent); }
.hh-btn--active:hover { background: var(--hh-accent-soft); }
.hh-btn:disabled { opacity: 0.5; pointer-events: none; }

/* ---------- Tooltip (instant, hover/focus; replaces native title) ---------- */
[data-hh-tip] { position: relative; }
[data-hh-tip]::after {
  content: attr(data-hh-tip);
  position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--hh-ink); color: var(--hh-surface);
  padding: 0.3rem 0.5rem; border-radius: var(--hh-radius-sm); box-shadow: var(--hh-shadow);
  font-size: 0.75rem; font-weight: 600; line-height: 1.2; white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity var(--hh-dur-fast) var(--hh-ease-out);
  z-index: var(--hh-z-tooltip);
}
[data-hh-tip]::before {
  content: ""; position: absolute; bottom: calc(100% + 1px); left: 50%; transform: translateX(-50%);
  border: 5px solid transparent; border-top-color: var(--hh-ink);
  opacity: 0; pointer-events: none;
  transition: opacity var(--hh-dur-fast) var(--hh-ease-out);
  z-index: var(--hh-z-tooltip);
}
[data-hh-tip]:hover::after, [data-hh-tip]:focus-visible::after,
[data-hh-tip]:hover::before, [data-hh-tip]:focus-visible::before { opacity: 1; }

/* ---------- Add-on icon toolbar (in-page sub-navigation) ---------- */
.hh-addon-toolbar {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: var(--hh-space-2); margin-bottom: var(--hh-space-4);
}
.hh-addon-toolbar__sep {
  width: 1px; align-self: stretch; min-height: 1.4rem;
  background: var(--hh-border-strong); margin: 0 var(--hh-space-1);
}

/* loading: inline spinner revealed only while an HTMX request is in flight */
.hh-spin {
  width: 0.95em; height: 0.95em; flex-shrink: 0;
  border: 2px solid color-mix(in oklab, currentColor 35%, transparent);
  border-top-color: currentColor; border-radius: 50%;
  display: inline-block; animation: hh-spin 0.6s linear infinite;
}
@keyframes hh-spin { to { transform: rotate(360deg); } }
/* htmx toggles .htmx-request on the requesting element; show indicators then */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline-block; }
.htmx-request .hh-btn__label { opacity: 0.6; }
/* a swapped region dims subtly while its replacement loads */
#ops-panel.htmx-request { opacity: 0.55; transition: opacity var(--hh-dur) var(--hh-ease-out); }

/* ---------- Forms ---------- */
.hh-field { display: flex; flex-direction: column; gap: var(--hh-space-2); }
.hh-label { font-weight: 600; font-size: 0.85rem; color: var(--hh-ink); }
.hh-input, .hh-textarea, .hh-select {
  width: 100%; padding: 0.6rem 0.75rem;
  background: var(--hh-surface); color: var(--hh-ink);
  border: 1px solid var(--hh-border-strong); border-radius: var(--hh-radius-sm);
  transition: border-color var(--hh-dur-fast) var(--hh-ease-out),
              box-shadow var(--hh-dur-fast) var(--hh-ease-out);
}
.hh-input::placeholder, .hh-textarea::placeholder { color: var(--hh-muted); }
.hh-input:focus, .hh-textarea:focus, .hh-select:focus {
  outline: none; border-color: var(--hh-accent);
  box-shadow: 0 0 0 3px var(--hh-accent-soft);
}
/* bare Django widgets inside a field pick up input styling automatically */
.hh-field input:not([type="checkbox"]):not([type="radio"]),
.hh-field textarea,
.hh-field select {
  width: 100%; padding: 0.6rem 0.75rem;
  background: var(--hh-surface); color: var(--hh-ink);
  border: 1px solid var(--hh-border-strong); border-radius: var(--hh-radius-sm);
  transition: border-color var(--hh-dur-fast) var(--hh-ease-out),
              box-shadow var(--hh-dur-fast) var(--hh-ease-out);
}
.hh-field input:focus, .hh-field textarea:focus, .hh-field select:focus {
  outline: none; border-color: var(--hh-accent); box-shadow: 0 0 0 3px var(--hh-accent-soft);
}
.hh-field textarea { resize: vertical; min-height: 5rem; }
.hh-help { font-size: 0.78rem; color: var(--hh-ink-soft); }
.hh-error { font-size: 0.8rem; color: var(--hh-danger); }

/* field error state (§ product: ship every state) */
.hh-field--error input:not([type="checkbox"]):not([type="radio"]),
.hh-field--error textarea,
.hh-field--error select { border-color: var(--hh-danger); }
.hh-field--error input:focus, .hh-field--error textarea:focus, .hh-field--error select:focus {
  border-color: var(--hh-danger);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--hh-danger) 22%, transparent);
}

/* disabled form controls */
.hh-field input:disabled, .hh-field textarea:disabled, .hh-field select:disabled,
.hh-input:disabled, .hh-textarea:disabled, .hh-select:disabled {
  background: var(--hh-surface-2); color: var(--hh-muted); cursor: not-allowed;
}
.hh-check { display: inline-flex; align-items: flex-start; gap: var(--hh-space-2); }
.hh-check input { margin-top: 3px; accent-color: var(--hh-accent-strong); }

/* ---------- Cards / panels (used sparingly) ---------- */
.hh-panel {
  background: var(--hh-surface); border: 1px solid var(--hh-border);
  border-radius: var(--hh-radius-lg); box-shadow: var(--hh-shadow-sm);
}
.hh-panel__body { padding: var(--hh-space-5); }
.hh-panel__head {
  padding: var(--hh-space-4) var(--hh-space-5); border-bottom: 1px solid var(--hh-border);
  display: flex; align-items: center; justify-content: space-between; gap: var(--hh-space-3);
}

/* ---------- Badges & alerts ---------- */
.hh-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 0.5rem; border-radius: var(--hh-radius-pill);
  font-size: 0.72rem; font-weight: 600;
  background: var(--hh-surface-3); color: var(--hh-ink-soft);
}
.hh-badge--accent { background: var(--hh-accent-soft); color: var(--hh-accent-strong); }
.hh-badge--success { background: color-mix(in oklab, var(--hh-success) 18%, transparent); color: var(--hh-success); }
.hh-badge--danger { background: var(--hh-danger-soft); color: var(--hh-danger); }
.hh-badge--dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.hh-alert {
  display: flex; gap: var(--hh-space-3); align-items: flex-start;
  padding: var(--hh-space-3) var(--hh-space-4); border-radius: var(--hh-radius);
  background: var(--hh-surface-2); border: 1px solid var(--hh-border);
}
.hh-alert--success { background: color-mix(in oklab, var(--hh-success) 12%, var(--hh-surface)); border-color: color-mix(in oklab, var(--hh-success) 35%, var(--hh-border)); }
.hh-alert--error   { background: var(--hh-danger-soft); border-color: color-mix(in oklab, var(--hh-danger) 35%, var(--hh-border)); }

/* ---------- Toasts (Django messages) ---------- */
.hh-toasts {
  position: fixed; right: var(--hh-space-5); bottom: var(--hh-space-5);
  display: flex; flex-direction: column; gap: var(--hh-space-2);
  z-index: var(--hh-z-toast); max-width: min(92vw, 380px);
}
.hh-toast {
  background: var(--hh-surface); border: 1px solid var(--hh-border);
  border-radius: var(--hh-radius); box-shadow: var(--hh-shadow-lg);
  padding: var(--hh-space-3) var(--hh-space-4); font-size: 0.9rem;
  animation: hh-toast-in var(--hh-dur) var(--hh-ease-out) both;
}
@keyframes hh-toast-in { from { opacity: 0; transform: translateY(10px); } }

/* ---------- Modal framework (§2.4) ---------- */
.hh-modal-backdrop {
  position: fixed; inset: 0; background: var(--hh-overlay);
  z-index: var(--hh-z-modal-backdrop); display: none;
  align-items: flex-start; justify-content: center; padding: 6vh var(--hh-space-4);
  opacity: 0; transition: opacity var(--hh-dur) var(--hh-ease-out);
  overflow-y: auto;
}
.hh-modal-backdrop[data-open="true"] { display: flex; opacity: 1; }
.hh-modal {
  width: 100%; max-width: 540px;
  background: var(--hh-surface); border: 1px solid var(--hh-border);
  border-radius: var(--hh-radius-lg); box-shadow: var(--hh-shadow-lg);
  z-index: var(--hh-z-modal);
  transform: translateY(12px) scale(0.985);
  transition: transform var(--hh-dur) var(--hh-ease-out);
}
.hh-modal-backdrop[data-open="true"] .hh-modal { transform: none; }
.hh-modal__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--hh-space-4) var(--hh-space-5); border-bottom: 1px solid var(--hh-border);
}
.hh-modal__title { font-size: 1.05rem; font-weight: 650; letter-spacing: -0.02em; }
.hh-modal__body { padding: var(--hh-space-5); }
.hh-modal__foot {
  display: flex; justify-content: flex-end; gap: var(--hh-space-2);
  padding: var(--hh-space-4) var(--hh-space-5); border-top: 1px solid var(--hh-border);
}

/* Duplicate-review modal: widen the shell so the two source previews sit side by
   side, and cap each preview so a tall receipt/PDF doesn't blow out the dialog.
   Columns wrap to stacked on narrow screens via .hh-row-wrap. */
.hh-modal:has(.hh-dup) { max-width: 880px; }
.hh-dup-cols { align-items: flex-start; }
.hh-dup-col { flex: 1 1 16rem; min-width: 0; }
.hh-dup-preview {
  width: 100%; max-height: 42vh; object-fit: contain;
  border: 1px solid var(--hh-border); border-radius: var(--hh-radius-sm);
  background: var(--hh-surface-2);
}

/* ---------- Drawer (off-canvas panel) — reusable chrome, parallel to the modal ---------- */
.hh-drawer-backdrop {
  position: fixed; inset: 0; background: var(--hh-overlay);
  z-index: var(--hh-z-modal-backdrop); display: none;
  opacity: 0; transition: opacity var(--hh-dur) var(--hh-ease-out);
}
.hh-drawer-backdrop[data-open="true"] { display: block; opacity: 1; }
.hh-drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(400px, 100vw); display: flex; flex-direction: column;
  background: var(--hh-surface); border-left: 1px solid var(--hh-border);
  box-shadow: var(--hh-shadow-lg); z-index: var(--hh-z-modal);
  transform: translateX(100%);
  transition: transform var(--hh-dur) var(--hh-ease-out);
}
.hh-drawer-backdrop[data-open="true"] .hh-drawer { transform: none; }
.hh-drawer__head {
  flex: none; display: flex; align-items: center; justify-content: space-between;
  gap: var(--hh-space-3); padding: var(--hh-space-4) var(--hh-space-5);
  border-bottom: 1px solid var(--hh-border);
}
.hh-drawer__title { font-size: 1.05rem; font-weight: 650; letter-spacing: -0.02em; }
.hh-drawer__body { flex: 1 1 auto; overflow-y: auto; padding: var(--hh-space-5); }
@media (prefers-reduced-motion: reduce) {
  .hh-drawer-backdrop, .hh-drawer { transition: none; }
}

/* ---------- Connections (navbar badge, invite box, person rows) ---------- */
.hh-iconbtn-badged { position: relative; }
.hh-count {
  position: absolute; top: -3px; right: -3px;
  min-width: 1.05rem; height: 1.05rem; padding: 0 0.28rem;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--hh-radius-pill);
  background: var(--hh-accent-strong); color: var(--hh-accent-ink);
  font-size: 0.64rem; font-weight: 700; line-height: 1;
  border: 2px solid var(--hh-surface); pointer-events: none;
}
.hh-count--empty { display: none; }

.hh-conn-invite { margin-bottom: var(--hh-space-6); }
.hh-conn-invite__row {
  display: flex; gap: var(--hh-space-2); margin-top: var(--hh-space-2);
}
.hh-conn-invite__row .hh-input { flex: 1 1 auto; min-width: 0; }
.hh-conn-invite__note { font-size: 0.8rem; margin-top: var(--hh-space-2); }
.hh-conn-invite__note--ok { color: var(--hh-success); }
.hh-conn-invite__note--error { color: var(--hh-danger); }

.hh-conn-section + .hh-conn-section { margin-top: var(--hh-space-6); }
.hh-conn-section__title {
  display: flex; align-items: center; gap: var(--hh-space-2);
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.07em;
  font-weight: 700; color: var(--hh-muted); margin-bottom: var(--hh-space-2);
}
.hh-conn-blank { font-size: 0.88rem; padding: var(--hh-space-2) 0; }

.hh-conn {
  display: flex; align-items: center; gap: var(--hh-space-3);
  padding: var(--hh-space-3) 0;
}
.hh-conn + .hh-conn { border-top: 1px solid var(--hh-border); }
.hh-conn__id { flex: 1 1 auto; min-width: 0; }
.hh-conn__name {
  font-weight: 600; font-size: 0.92rem; color: var(--hh-ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hh-conn__meta {
  font-size: 0.78rem; color: var(--hh-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hh-conn__actions { flex: none; display: flex; align-items: center; gap: var(--hh-space-2); }
.hh-avatar--lg { width: 2.2rem; height: 2.2rem; font-size: 0.85rem; }

.hh-conn-page { max-width: 520px; }

/* Abrechner active-project switcher bar (above the manager toolbar) */
.hh-projbar { margin-bottom: var(--hh-space-4); }

/* ---------- Sorting mode (focused keyboard deck) ---------- */
.hh-sort-shell {
  min-height: 100dvh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: var(--hh-space-5);
  padding: var(--hh-space-8) var(--hh-space-4); text-align: center;
}
.hh-sort-exit {
  position: fixed; top: var(--hh-space-4); right: var(--hh-space-4);
  z-index: var(--hh-z-sticky);
}

/* chooser */
.hh-sort-start { max-width: 40rem; display: flex; flex-direction: column; gap: var(--hh-space-2); align-items: center; }
.hh-sort-start__title { font-size: 1.6rem; font-weight: 680; letter-spacing: -0.02em; }
.hh-sort-start__count { font-size: 1.05rem; color: var(--hh-ink); margin-top: var(--hh-space-2); }
.hh-sort-choices {
  display: flex; flex-wrap: wrap; gap: var(--hh-space-4);
  justify-content: center; margin-top: var(--hh-space-4);
}
.hh-sort-choice {
  display: flex; flex-direction: column; gap: var(--hh-space-1); align-items: center;
  width: min(15rem, 80vw); padding: var(--hh-space-6) var(--hh-space-4);
  background: var(--hh-surface); border: 1px solid var(--hh-border);
  border-radius: var(--hh-radius-lg); color: var(--hh-ink);
  transition: border-color var(--hh-dur-fast) var(--hh-ease-out),
              background var(--hh-dur-fast) var(--hh-ease-out),
              transform var(--hh-dur-fast) var(--hh-ease-out);
}
.hh-sort-choice:hover { border-color: var(--hh-accent); background: var(--hh-surface-2); transform: translateY(-2px); }
.hh-sort-choice__mark { font-size: 1.8rem; opacity: 0.85; }
.hh-sort-choice__name { font-weight: 640; }
.hh-sort-choice__hint { font-size: 0.8rem; color: var(--hh-muted); }

/* deck */
.hh-sort-head { width: min(34rem, 92vw); display: flex; flex-direction: column; gap: var(--hh-space-2); }
.hh-sort-progress { height: 6px; border-radius: var(--hh-radius-pill); background: var(--hh-surface-3); overflow: hidden; }
.hh-sort-progress > span {
  display: block; height: 100%; width: 0;
  background: var(--hh-accent-strong);
  transition: width var(--hh-dur) var(--hh-ease-out);
}
.hh-sort-stage {
  display: flex; align-items: center; gap: var(--hh-space-4);
  perspective: 1200px;
}
.hh-sort-card {
  position: relative;
  width: min(28rem, 88vw); min-height: 12rem;
  display: flex; flex-direction: column; gap: var(--hh-space-3);
  align-items: center; justify-content: center;
  padding: var(--hh-space-8) var(--hh-space-5);
  background: var(--hh-surface); border: 1px solid var(--hh-border);
  border-radius: var(--hh-radius-lg); box-shadow: var(--hh-shadow-lg);
  transform-origin: center;
  transition: transform var(--hh-dur) var(--hh-ease-out), opacity var(--hh-dur) var(--hh-ease-out);
}
.hh-sort-card.is-out { transform: rotateY(90deg); opacity: 0; }
.hh-sort-card.is-sorted { opacity: 0.6; }
.hh-sort-card.is-sorted::after {
  content: "✓"; position: absolute; top: var(--hh-space-3); right: var(--hh-space-4);
  color: var(--hh-success); font-weight: 700; font-size: 1.1rem;
}
.hh-sort-card.is-error { border-color: var(--hh-danger); animation: hh-shake 0.4s var(--hh-ease-out); }
.hh-sort-card__kicker { font-size: 0.8rem; color: var(--hh-muted); font-weight: 600; }
.hh-sort-card__desc { font-size: 1.5rem; font-weight: 660; letter-spacing: -0.02em; text-wrap: balance; }
.hh-sort-card__meta { color: var(--hh-ink-soft); }
.hh-sort-nav {
  flex: none; width: 2.6rem; height: 2.6rem; border-radius: 50%;
  background: var(--hh-surface); border: 1px solid var(--hh-border);
  color: var(--hh-ink-soft); font-size: 1.3rem; line-height: 1; cursor: pointer;
  transition: background var(--hh-dur-fast) var(--hh-ease-out), color var(--hh-dur-fast) var(--hh-ease-out);
}
.hh-sort-nav:hover { background: var(--hh-surface-2); color: var(--hh-ink); }
.hh-sort-hint { margin: 0; }

.hh-sort-legend {
  display: flex; flex-wrap: wrap; gap: var(--hh-space-3);
  justify-content: center; max-width: 40rem;
}
.hh-keycap {
  display: flex; flex-direction: column; align-items: center; gap: var(--hh-space-1);
  background: none; border: 0; cursor: pointer; color: var(--hh-ink-soft);
  transition: color var(--hh-dur-fast) var(--hh-ease-out);
}
.hh-keycap:hover { color: var(--hh-ink); }
.hh-keycap__key {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.2rem; height: 2.2rem; border-radius: var(--hh-radius-sm);
  background: var(--hh-surface); border: 1px solid var(--hh-border-strong);
  border-bottom-width: 3px; box-shadow: var(--hh-shadow-sm);
  font-weight: 700; font-variant-numeric: tabular-nums;
  transition: transform var(--hh-dur-fast) var(--hh-ease-out);
}
.hh-keycap:hover .hh-keycap__key { transform: translateY(-1px); border-color: var(--hh-accent); }
.hh-keycap:active .hh-keycap__key { transform: translateY(1px); border-bottom-width: 1px; }
.hh-keycap__label { font-size: 0.78rem; max-width: 7rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hh-sort-overflow { max-width: 28rem; }

.hh-sort-done { display: flex; flex-direction: column; align-items: center; gap: var(--hh-space-3); }
.hh-sort-cta {
  background: var(--hh-accent-soft); border-color: var(--hh-accent-line);
  color: var(--hh-accent-strong); margin-bottom: var(--hh-space-4);
  font-weight: 560; text-decoration: none;
}
.hh-sort-cta:hover { background: color-mix(in oklab, var(--hh-accent-soft) 80%, var(--hh-accent)); }

@keyframes hh-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}
@media (prefers-reduced-motion: reduce) {
  .hh-sort-card, .hh-sort-progress > span, .hh-sort-choice { transition: none; }
  .hh-sort-card.is-out { transform: none; }
  .hh-sort-card.is-error { animation: none; }
}

/* ---------- Manager table (§5) ---------- */
.hh-toolbar { display: flex; flex-wrap: wrap; gap: var(--hh-space-2); align-items: center; margin-bottom: var(--hh-space-4); }
.hh-search { position: relative; flex: 1 1 240px; max-width: 360px; }
.hh-search .hh-input { padding-left: 2.1rem; }
.hh-search__icon { position: absolute; left: 0.7rem; top: 50%; transform: translateY(-50%); color: var(--hh-muted); }

.hh-table-wrap { background: var(--hh-surface); border: 1px solid var(--hh-border); border-radius: var(--hh-radius-lg); overflow: hidden; }
.hh-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.hh-table thead th {
  text-align: left; font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--hh-muted); font-weight: 650; padding: var(--hh-space-3) var(--hh-space-4);
  background: var(--hh-surface-2); border-bottom: 1px solid var(--hh-border);
}
.hh-table tbody td { padding: var(--hh-space-3) var(--hh-space-4); border-bottom: 1px solid var(--hh-border); }
.hh-table tbody tr:last-child td { border-bottom: 0; }
.hh-table tbody tr { transition: background var(--hh-dur-fast) var(--hh-ease-out); }
.hh-table tbody tr:hover { background: var(--hh-surface-2); }
.hh-table tbody tr[data-href] { cursor: pointer; }
.hh-table__actions { text-align: right; white-space: nowrap; }
/* Row action cluster — icon buttons with native tooltips (title). */
.hh-row-actions { display: inline-flex; gap: var(--hh-space-2); justify-content: flex-end; align-items: center; }
.hh-row-actions .hh-btn--icon { font-size: 0.95rem; line-height: 1; }
.hh-row-actions__danger:hover { color: var(--hh-danger); border-color: var(--hh-danger); background: var(--hh-danger-soft); }

/* Sortable column headers — the whole header label is the toggle. */
.hh-table thead th.hh-th--sortable { padding: 0; }
.hh-th__sort {
  display: flex; align-items: center; justify-content: space-between; gap: var(--hh-space-2);
  width: 100%; padding: var(--hh-space-3) var(--hh-space-4); color: inherit; text-decoration: none;
  cursor: pointer; transition: color var(--hh-dur-fast) var(--hh-ease-out), background var(--hh-dur-fast) var(--hh-ease-out);
}
.hh-th__sort:hover { color: var(--hh-ink); background: var(--hh-accent-soft); }
.hh-sort-ind { font-size: 0.7em; line-height: 1; opacity: 0.35; transition: opacity var(--hh-dur-fast) var(--hh-ease-out); }
.hh-table thead th.hh-th--asc, .hh-table thead th.hh-th--desc { color: var(--hh-accent-strong); }
.hh-table thead th.hh-th--asc .hh-sort-ind, .hh-table thead th.hh-th--desc .hh-sort-ind { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .hh-th__sort, .hh-sort-ind { transition: none; } }

/* Bulk-editable header — a "B" hint inks in on hover/focus; press B to bulk-edit. */
.hh-table thead th.hh-th--bulk { position: relative; }
.hh-table thead th.hh-th--bulk::after {
  content: "B"; position: absolute; top: 50%; right: var(--hh-space-2); transform: translateY(-50%);
  display: grid; place-items: center; width: 1.15rem; height: 1.15rem; border-radius: var(--hh-radius-sm);
  font-size: 0.62rem; font-weight: 700; line-height: 1; letter-spacing: 0;
  color: var(--hh-accent-ink); background: var(--hh-accent-strong);
  opacity: 0; transition: opacity var(--hh-dur-fast) var(--hh-ease-out); pointer-events: none;
}
.hh-table thead th.hh-th--bulk:hover::after, .hh-table thead th.hh-th--bulk:focus-within::after { opacity: 1; }
.hh-table thead th.hh-th--bulk.hh-th--sortable .hh-th__sort { padding-right: 1.9rem; }
.hh-table thead th.hh-th--bulk:not(.hh-th--sortable) { padding-right: 1.9rem; }
@media (prefers-reduced-motion: reduce) { .hh-table thead th.hh-th--bulk::after { transition: none; } }

/* ---------- Inline click-to-edit (Abrechner detail + reusable) ---------- */
.hh-ie-slot { display: inline-flex; align-items: center; max-width: 100%; }
.hh-ie-slot--block { display: flex; width: 100%; }
.hh-ie-sep { color: var(--hh-muted); margin: 0 var(--hh-space-2); }
.hh-ie {
  font: inherit; color: inherit; text-align: left; cursor: text;
  background: none; border: 1px solid transparent; border-radius: var(--hh-radius-sm);
  padding: 0.15rem 0.4rem; margin: -0.15rem -0.4rem;
  transition: background var(--hh-dur-fast) var(--hh-ease-out),
              border-color var(--hh-dur-fast) var(--hh-ease-out);
}
.hh-ie:hover { background: var(--hh-surface-2); border-color: var(--hh-border); }
.hh-ie:focus-visible { outline: none; border-color: var(--hh-accent); box-shadow: 0 0 0 3px var(--hh-accent-soft); }
.hh-ie::after { content: "✎"; margin-left: 0.4rem; font-size: 0.8em; color: var(--hh-muted); opacity: 0; transition: opacity var(--hh-dur-fast) var(--hh-ease-out); }
.hh-ie:hover::after, .hh-ie:focus-visible::after { opacity: 1; }
.hh-ie--empty { color: var(--hh-muted); font-style: italic; }
.hh-ie__input {
  font: inherit; width: 100%; min-width: 8rem; max-width: 22rem; padding: 0.2rem 0.45rem;
  background: var(--hh-surface); color: var(--hh-ink);
  border: 1px solid var(--hh-accent); border-radius: var(--hh-radius-sm);
  box-shadow: 0 0 0 3px var(--hh-accent-soft); outline: none;
}
.hh-ie__input--num { max-width: 10rem; }
textarea.hh-ie__input { min-height: 4rem; resize: vertical; }
.hh-ie__err { display: block; color: var(--hh-danger); font-size: 0.8rem; margin-top: 0.2rem; }
@keyframes hh-ie-saved {
  from { background: color-mix(in oklab, var(--hh-success) 22%, transparent); }
  to { background: transparent; }
}
.hh-ie--saved { animation: hh-ie-saved 0.9s var(--hh-ease-out); }
@media (prefers-reduced-motion: reduce) { .hh-ie--saved { animation: none; } }

/* ---------- Item keyword tags (inline-editable) ---------- */
.hh-tag {
  display: inline-flex; align-items: center; padding: 0.1rem 0.5rem;
  font-size: 0.78rem; line-height: 1.4; border-radius: var(--hh-radius-pill, 999px);
  background: var(--hh-accent-soft); color: var(--hh-accent-strong); white-space: nowrap;
}
.hh-kw {
  display: inline-flex; flex-wrap: wrap; gap: 0.25rem; align-items: center;
  border: 0; background: transparent; padding: 0.15rem; margin: -0.15rem; cursor: pointer;
  border-radius: var(--hh-radius-sm, 6px); text-align: left;
  transition: background var(--hh-dur-fast) var(--hh-ease-out);
}
.hh-kw:hover:not([disabled]) { background: var(--hh-surface-2); }
.hh-kw[disabled] { cursor: default; }
.hh-kw--empty { color: var(--hh-muted); font-size: 0.82rem; }
.hh-kw--saved { animation: hh-ie-saved 0.9s var(--hh-ease-out); }
.hh-kw-edit { display: inline-flex; gap: 0.3rem; align-items: flex-start; min-width: 13rem; }
.hh-kw-edit .ts-wrapper { min-width: 9rem; flex: 1; }
@media (prefers-reduced-motion: reduce) { .hh-kw, .hh-kw--saved { transition: none; animation: none; } }

/* ---------- Empty states ---------- */
.hh-empty {
  text-align: center; padding: var(--hh-space-12) var(--hh-space-5);
  color: var(--hh-ink-soft);
}
.hh-empty__mark { font-size: 2.2rem; margin-bottom: var(--hh-space-3); opacity: 0.6; }

/* ---------- Feed (dashboard, Seam 3) ---------- */
.hh-feed { display: flex; flex-direction: column; gap: var(--hh-space-2); }
.hh-feed__item {
  display: flex; gap: var(--hh-space-3); align-items: flex-start;
  padding: var(--hh-space-3) var(--hh-space-4);
  background: var(--hh-surface); border: 1px solid var(--hh-border);
  border-radius: var(--hh-radius); transition: border-color var(--hh-dur-fast) var(--hh-ease-out),
              transform var(--hh-dur-fast) var(--hh-ease-out);
}
a.hh-feed__item:hover { border-color: var(--hh-accent-line); transform: translateX(2px); }
.hh-feed__icon {
  width: 34px; height: 34px; flex-shrink: 0; border-radius: 9px; display: grid; place-items: center;
  background: var(--hh-accent-soft); color: var(--hh-accent-strong); font-size: 1rem;
}
.hh-feed__title { font-weight: 600; }
.hh-feed__sub { color: var(--hh-ink-soft); font-size: 0.85rem; }

/* ---------- Tabs (ops panel) ---------- */
.hh-tabs {
  display: flex; gap: var(--hh-space-1); border-bottom: 1px solid var(--hh-border);
  margin-bottom: var(--hh-space-5);
  overflow-x: auto;                 /* scroll only when tabs truly exceed width */
  scrollbar-width: none;            /* but never show the scrollbar chrome */
}
.hh-tabs::-webkit-scrollbar { display: none; }
.hh-tab {
  padding: var(--hh-space-3) var(--hh-space-4); color: var(--hh-ink-soft); font-weight: 600;
  font-size: 0.9rem; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color var(--hh-dur-fast) var(--hh-ease-out), border-color var(--hh-dur-fast) var(--hh-ease-out);
}
.hh-tab:hover { color: var(--hh-ink); }
.hh-tab--active { color: var(--hh-accent-strong); border-bottom-color: var(--hh-accent-line); }

/* ---------- Auth / centered card pages ---------- */
.hh-auth { min-height: 100vh; display: grid; place-items: center; padding: var(--hh-space-6) var(--hh-space-4); }
.hh-auth__card { width: 100%; max-width: 400px; }
.hh-auth__card .hh-panel__body { padding: var(--hh-space-6); }

/* ---------- Chip strip (quick references above a manager) ---------- */
.hh-chipstrip { display: flex; flex-wrap: wrap; gap: var(--hh-space-2); margin-bottom: var(--hh-space-4); }

/* ---------- Account page ---------- */
.hh-account {
  display: flex; flex-direction: column; gap: var(--hh-space-5);
  max-width: 640px;
}
.hh-form-2col { display: grid; grid-template-columns: 1fr 1fr; gap: var(--hh-space-4); }
@media (max-width: 560px) { .hh-form-2col { grid-template-columns: 1fr; } }

/* ---------- Landing: the three seams (differentiated, not a card grid) ---------- */
.hh-seams { margin-top: var(--hh-space-8); max-width: 760px; }
.hh-seams__lead { color: var(--hh-ink-soft); font-size: 1.05rem; margin-bottom: var(--hh-space-4); }
.hh-seams__list { border-top: 1px solid var(--hh-border); }
.hh-seams__row {
  display: grid; grid-template-columns: 14rem 1fr; gap: var(--hh-space-5);
  padding: var(--hh-space-4) 0; border-bottom: 1px solid var(--hh-border);
}
.hh-seams__row dt { display: flex; align-items: center; gap: var(--hh-space-2); font-weight: 650; }
.hh-seams__row dd { color: var(--hh-ink-soft); }
.hh-seams__idx {
  width: 1.6rem; height: 1.6rem; flex-shrink: 0; border-radius: 7px;
  display: grid; place-items: center; font-size: 0.8rem; font-weight: 700;
  background: var(--hh-surface-3); color: var(--hh-ink-soft);
}
/* the most-used seam gets visual weight, breaking the identical-row rhythm */
.hh-seams__row--lead { padding-block: var(--hh-space-5); }
.hh-seams__row--lead dt { font-size: 1.15rem; }
.hh-seams__row--lead dd { color: var(--hh-ink); }
.hh-seams__row--lead .hh-seams__idx { background: var(--hh-accent-soft); color: var(--hh-accent-strong); }
@media (max-width: 620px) {
  .hh-seams__row { grid-template-columns: 1fr; gap: var(--hh-space-2); }
}

/* ---------- Style guide ---------- */
.hh-sg__section { margin-bottom: var(--hh-space-8); }
.hh-sg__demo { padding: var(--hh-space-5); background: var(--hh-surface); border: 1px solid var(--hh-border); border-radius: var(--hh-radius); }
.hh-sg__code {
  margin-top: var(--hh-space-2); padding: var(--hh-space-3) var(--hh-space-4);
  background: var(--hh-surface-3); border-radius: var(--hh-radius-sm);
  font-family: var(--hh-font-mono); font-size: 0.78rem; color: var(--hh-ink-soft);
  white-space: pre-wrap; overflow-x: auto;
}
.hh-swatch-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: var(--hh-space-3); }
.hh-swatch { border-radius: var(--hh-radius); overflow: hidden; border: 1px solid var(--hh-border); }
.hh-swatch__chip { height: 56px; }
.hh-swatch__label { padding: var(--hh-space-2) var(--hh-space-3); font-size: 0.75rem; font-family: var(--hh-font-mono); }

/* ---------- Object / entity chips (§2.4.1) ---------- */
.hh-chip, .hh-chip--object {
  display: inline-flex; align-items: center; gap: 0.3rem;
  height: 32px; padding: 0 0.55rem 0 0.35rem;
  background: var(--hh-surface); border: 1px solid var(--hh-border);
  border-radius: var(--hh-radius-pill); font-size: 0.85rem; color: var(--hh-ink);
  position: relative;
  transition: border-color var(--hh-dur-fast) var(--hh-ease-out),
              box-shadow var(--hh-dur-fast) var(--hh-ease-out);
}
.hh-chip:hover, .hh-chip--object:hover { border-color: var(--hh-accent-line); box-shadow: var(--hh-shadow-sm); }
.hh-chip--object { padding-left: 0.75rem; }

.hh-chip__avatar {
  width: 22px; height: 22px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.62rem; font-weight: 700; color: #fff; flex-shrink: 0;
}
.hh-chip__avatar--blue   { background: oklch(0.55 0.16 255); }
.hh-chip__avatar--purple { background: oklch(0.52 0.18 305); }
.hh-chip__avatar--green  { background: oklch(0.55 0.15 150); }
.hh-chip__avatar--amber  { background: oklch(0.62 0.15 75); }
.hh-chip__avatar--ink    { background: oklch(0.38 0.02 250); }
.hh-chip__avatar--teal   { background: oklch(0.55 0.12 200); }
.hh-chip__avatar--rose   { background: oklch(0.55 0.18 15); }
.hh-chip__avatar--indigo { background: oklch(0.48 0.17 275); }

.hh-chip__name { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hh-chip__divider { width: 1px; height: 14px; background: var(--hh-border); margin: 0 2px; }
.hh-chip__btn {
  width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; color: var(--hh-muted); font-size: 0.75rem;
  transition: background var(--hh-dur-fast) var(--hh-ease-out), color var(--hh-dur-fast) var(--hh-ease-out);
}
.hh-chip__btn:hover { background: var(--hh-surface-3); color: var(--hh-ink); }
.hh-chip__btn--remove:hover { background: var(--hh-danger-soft); color: var(--hh-danger); }

.hh-chip--add {
  display: inline-flex; align-items: center; gap: 0.35rem; height: 32px; padding: 0 0.8rem;
  border: 1px dashed var(--hh-border-strong); border-radius: var(--hh-radius-pill);
  color: var(--hh-ink-soft); font-size: 0.85rem; background: transparent;
  transition: border-color var(--hh-dur-fast) var(--hh-ease-out), color var(--hh-dur-fast) var(--hh-ease-out);
}
.hh-chip--add:hover { border-color: var(--hh-accent-line); color: var(--hh-accent-strong); }

/* chip actions popover (§2.4.1) */
.hh-chip-menu {
  position: absolute; top: calc(100% + 6px); right: 0; min-width: 200px;
  background: var(--hh-surface); border: 1px solid var(--hh-border); border-radius: var(--hh-radius);
  box-shadow: var(--hh-shadow-lg); padding: var(--hh-space-1); z-index: var(--hh-z-dropdown); display: none;
}
.hh-chip-menu.is-open { display: block; }

/* ---------- Tom Select theming bridge (modal-safe dropdown sits above modal) ---------- */
.ts-dropdown { z-index: var(--hh-z-modal); }
.ts-wrapper.single .ts-control, .ts-wrapper.multi .ts-control {
  background: var(--hh-surface) !important; border-color: var(--hh-border-strong) !important;
  border-radius: var(--hh-radius-sm) !important; color: var(--hh-ink) !important;
  box-shadow: none !important;
}
.ts-control input, .ts-control input::placeholder { color: var(--hh-ink) !important; }
.ts-control input::placeholder { color: var(--hh-muted) !important; }
.ts-wrapper.focus .ts-control {
  border-color: var(--hh-accent) !important;
  box-shadow: 0 0 0 3px var(--hh-accent-soft) !important;
}
.ts-dropdown {
  background: var(--hh-surface); border: 1px solid var(--hh-border); color: var(--hh-ink);
  border-radius: var(--hh-radius); box-shadow: var(--hh-shadow-lg);
}
.ts-dropdown .option { color: var(--hh-ink); }
.ts-dropdown .option.active { background: var(--hh-accent-soft); color: var(--hh-accent-strong); }
.ts-dropdown .option:hover { background: var(--hh-surface-2); }
.ts-control .item { background: var(--hh-accent-soft) !important; color: var(--hh-accent-strong) !important; border-radius: var(--hh-radius-sm); }

/* ---------- Checkbox-gated reveal (no JS; uses :has()) ----------
   Put .hh-reveal on a wrapper containing both the controlling checkbox field
   (marked .hh-reveal__toggle) and the gated region (.hh-reveal__body). The body
   collapses out of the layout AND the tab order when the box is unchecked. */
.hh-reveal__body { display: grid; gap: var(--hh-space-4); }
.hh-reveal:has(.hh-reveal__toggle input:not(:checked)) .hh-reveal__body { display: none; }

/* ---------- Disclosure (secondary actions tucked behind a summary) ---------- */
.hh-disclosure {
  margin-top: var(--hh-space-5); border-top: 1px solid var(--hh-border);
  padding-top: var(--hh-space-2);
}
.hh-disclosure > summary {
  list-style: none; cursor: pointer; user-select: none;
  display: inline-flex; align-items: center; gap: var(--hh-space-2);
  padding: var(--hh-space-2) 0;
  font-size: 0.85rem; font-weight: 600; color: var(--hh-accent-strong);
}
.hh-disclosure > summary::-webkit-details-marker { display: none; }
.hh-disclosure > summary::before {
  content: "›"; display: inline-block; font-size: 1.1em; line-height: 1;
  transition: transform var(--hh-dur-fast) var(--hh-ease-out);
}
.hh-disclosure[open] > summary::before { transform: rotate(90deg); }
.hh-disclosure > summary:focus-visible {
  outline: 2px solid var(--hh-accent); outline-offset: 3px; border-radius: var(--hh-radius-sm);
}
.hh-disclosure__body { padding-top: var(--hh-space-3); }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important; animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important; scroll-behavior: auto !important;
  }
}

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .hh-nav { gap: var(--hh-space-2); padding: 0 var(--hh-space-3); }
  .hh-nav__links { display: none; }
  .hh-nav[data-mobile-open="true"] .hh-nav__links {
    display: flex; flex-direction: column; position: absolute; top: 60px; left: 0; right: 0;
    background: var(--hh-surface); border-bottom: 1px solid var(--hh-border);
    padding: var(--hh-space-3); gap: var(--hh-space-1); box-shadow: var(--hh-shadow);
  }
  .hh-main { padding: var(--hh-space-5) var(--hh-space-4) var(--hh-space-8); }
  .hh-nav__burger { display: inline-flex !important; }
}
.hh-nav__burger { display: none; }
/* =============================================================================
   Abrechner — upload drop zone + helpers (feature plugin)
   ========================================================================== */
.hh-dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--hh-space-2);
  padding: var(--hh-space-6) var(--hh-space-4);
  text-align: center;
  border: 2px dashed var(--hh-border-strong);
  border-radius: var(--hh-radius-lg);
  background: var(--hh-surface-2);
  color: var(--hh-ink-soft);
  cursor: pointer;
  transition: border-color var(--hh-dur-fast) var(--hh-ease-out),
              background var(--hh-dur-fast) var(--hh-ease-out);
}
.hh-dropzone:hover,
.hh-dropzone:focus-within {
  border-color: var(--hh-accent);
  background: var(--hh-accent-soft);
}
/* Dragging a file over the zone (set by app-core.js — :hover doesn't fire on drag). */
.hh-dropzone.is-dragover {
  border-color: var(--hh-accent-strong);
  border-style: solid;
  background: var(--hh-accent-soft);
}
/* A file is chosen: confirm it with a solid success-tinted border + filename. */
.hh-dropzone.has-file {
  border-style: solid;
  border-color: color-mix(in oklab, var(--hh-success) 45%, var(--hh-border));
  background: color-mix(in oklab, var(--hh-success) 8%, var(--hh-surface-2));
  color: var(--hh-ink);
}
.hh-dropzone__mark { font-size: 1.6rem; line-height: 1; }
.hh-dropzone.has-file .hh-dropzone__mark { color: var(--hh-success); }
.hh-dropzone__text { font-size: 0.9rem; }
/* Chosen filename — hidden until a file is picked, then truncated to one line. */
.hh-dropzone__file {
  display: none;
  max-width: 100%;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--hh-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hh-dropzone.has-file .hh-dropzone__file { display: block; }
.hh-dropzone.has-file .hh-dropzone__text { display: none; }
/* The file input fills the zone so click *and* native drag-drop work without JS. */
.hh-dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

/* In-modal "the AI is reading your receipt" state. Driven purely by the
   .htmx-request class htmx puts on the form during the (multi-second) upload —
   a button spinner alone is too quiet for that wait. */
.hh-extract-loading {
  display: none;
  align-items: center;
  justify-content: center;
  gap: var(--hh-space-2);
  padding: var(--hh-space-4);
  font-size: 0.9rem;
  color: var(--hh-ink-soft);
}
form.htmx-request .hh-extract-loading { display: flex; }
/* Dim + lock the picker while extraction runs so the loading state reads as the
   one live thing in the modal. */
form.htmx-request .hh-dropzone {
  opacity: 0.5;
  pointer-events: none;
  transition: opacity var(--hh-dur) var(--hh-ease-out);
}
@media (prefers-reduced-motion: reduce) {
  form.htmx-request .hh-dropzone { transition: none; }
}

.hh-btn--block { width: 100%; justify-content: center; }

.hh-visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.hh-code {
  font-family: var(--hh-font-mono);
  font-size: 0.8rem;
  background: var(--hh-surface-2);
  border: 1px solid var(--hh-border);
  border-radius: var(--hh-radius-sm);
  padding: var(--hh-space-3);
  overflow: auto;
  max-height: 24rem;
}

/* "Models & prices" refresh button: swap label ⇄ "Updating…" on the HTMX
   in-flight state, so the busy feedback needs no JS. */
.ai-pricing-refresh__busy { display: none; }
.ai-pricing-refresh.htmx-request .ai-pricing-refresh__idle { display: none; }
.ai-pricing-refresh.htmx-request .ai-pricing-refresh__busy { display: inline; }

/* =============================================================================
   Abrechner — summary statistics (scope selector + stat tiles + per-year cards)
   ========================================================================== */
.hh-section-title {
  font-size: 1.1rem; font-weight: 650; margin: var(--hh-space-6) 0 var(--hh-space-2);
}
.hh-stats-controls {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--hh-space-4);
  margin: var(--hh-space-4) 0 var(--hh-space-5);
}
.hh-stats-controls__field { display: flex; flex-direction: column; gap: var(--hh-space-2); }
.hh-stats-controls__field .hh-select { min-width: 16rem; }
/* the Share/Paid toggle drops the tab-strip bottom border so it sits inline */
.hh-stats-controls__toggle { border-bottom: 0; margin-bottom: 0; }

.hh-stats-grid {
  display: grid; gap: var(--hh-space-4);
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  margin-bottom: var(--hh-space-4);
}
.hh-stat {
  background: var(--hh-surface); border: 1px solid var(--hh-border);
  border-radius: var(--hh-radius-lg); box-shadow: var(--hh-shadow-sm);
  padding: var(--hh-space-4) var(--hh-space-5);
  display: flex; flex-direction: column; gap: var(--hh-space-1);
}
.hh-stat__value { font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.hh-stat__unit { font-size: 0.9rem; font-weight: 600; color: var(--hh-ink-soft); }
.hh-stat__label { font-size: 0.8rem; color: var(--hh-ink-soft); }

.hh-year-grid {
  display: grid; gap: var(--hh-space-4);
  grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
}
.hh-year-card {
  background: var(--hh-surface); border: 1px solid var(--hh-border);
  border-radius: var(--hh-radius-lg); box-shadow: var(--hh-shadow-sm);
  padding: var(--hh-space-4) var(--hh-space-5);
  display: flex; flex-direction: column; gap: var(--hh-space-2);
}
.hh-year-card__year {
  font-size: 0.85rem; font-weight: 650; color: var(--hh-accent-strong);
  letter-spacing: 0.02em;
}
.hh-year-card__money { display: flex; flex-direction: column; gap: 2px; }
.hh-year-card__amount { font-size: 1.25rem; font-weight: 700; line-height: 1.15; }
.hh-year-card__meta { margin-top: auto; }
