/* =========================================================================
   PERFECT JEWELRY — DESIGN SYSTEM
   One file, two themes (light / dark), driven entirely by CSS custom
   properties keyed off [data-theme]. No component below reaches for a raw
   color — everything reads from the token list. When this gets ported to
   Django templates, these two blocks (:root + [data-theme="..."]) are the
   only place a re-skin ever needs to touch.
   ========================================================================= */

/* ---------- Tokens that never change between themes ---------- */
:root {
  --font-serif: 'Cormorant', serif;
  --font-sans: 'Montserrat', sans-serif;

  --sidebar-w: 258px;
  --sidebar-w-collapsed: 0px;
  --sidebar-w-mini: 72px;
  --header-h: 64px;

  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-pill: 999px;

  --ease: cubic-bezier(.4, 0, .2, 1);
  --t-fast: .15s;
  --t-med: .25s;

  /* brand gold stays constant across themes — it's the one color that IDs the brand */
  --brand: #c6a15b;
  --brand-soft: #e7d3a8;
  --brand-strong: #a9813f;
}

/* ---------- LIGHT THEME ---------- */
[data-theme="light"] {
  --bg: #faf7f1;
  /* page background */
  --bg-2: #f4efe4;
  /* secondary background (table head, hovers, chips) */
  --surface: #ffffff;
  /* cards, tables, header, modal */
  --panel: #ffffff;
  --surface-2: #f4efe4;
  /* subtle fill inside a surface */
  --border: #e5ddcc;
  --border-strong: #d9cbaa;

  --text: #2b2622;
  --text-muted: #8a7f6f;
  --text-faint: #b3a993;
  --text-on-brand: #1c1712;

  --brand-dim: rgba(198, 161, 91, .14);
  --brand-ink: #8a6a2e;
  /* text used on --brand-dim fills */

  --sidebar-bg: #f4efe4;
  --sidebar-border: #e5ddcc;
  --sidebar-text: #4a453c;
  --sidebar-text-muted: #96897a;
  --sidebar-logo: #2b2622;

  --header-bg: #ffffff;
  --header-border: #e5ddcc;

  --shadow-sm: 0 1px 2px rgba(20, 17, 15, .06);
  --shadow-md: 0 10px 30px rgba(20, 17, 15, .10);
  --overlay: rgba(30, 26, 20, .45);

  --ok: #3f6b52;
  --ok-bg: #eaf3ee;
  --warn: #a8752c;
  --warn-bg: #faf1de;
  --danger: #a13f3f;
  --danger-bg: #f8ecec;
  --info: #4d5b6b;
  --info-bg: #eef1f3;
  --neutral: #8a8577;
  --neutral-bg: #f1efe9;
  --violet: #6c4a80;
  --violet-bg: #f3ecf6;

  color-scheme: light;
}

/* ---------- DARK THEME ---------- */
[data-theme="dark"] {
  --bg: #15120f;
  --bg-2: #1c1815;
  --surface: #221e1a;
  --panel: #221e1a;
  --surface-2: #2b2620;
  --border: rgba(198, 161, 91, .16);
  --border-strong: rgba(198, 161, 91, .28);

  --text: #ece4d5;
  --text-muted: #a29a89;
  --text-faint: #6f6858;
  --text-on-brand: #1c1712;

  --brand-dim: rgba(198, 161, 91, .16);
  --brand-ink: #e9d7ac;

  --sidebar-bg: linear-gradient(180deg, #100d0b 0%, #221e1a 100%);
  --sidebar-border: rgba(198, 161, 91, .16);
  --sidebar-text: #d8cdb9;
  --sidebar-text-muted: #8f8676;
  --sidebar-logo: #ffffff;

  --header-bg: #1c1815;
  --header-border: rgba(198, 161, 91, .14);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-md: 0 14px 34px rgba(0, 0, 0, .45);
  --overlay: rgba(0, 0, 0, .6);

  --ok: #8fcda9;
  --ok-bg: rgba(63, 139, 94, .18);
  --warn: #e3b06a;
  --warn-bg: rgba(198, 142, 58, .18);
  --danger: #e2938f;
  --danger-bg: rgba(178, 86, 86, .20);
  --info: #aab6c2;
  --info-bg: rgba(120, 133, 148, .20);
  --neutral: #beb6a4;
  --neutral-bg: rgba(154, 146, 124, .18);
  --violet: #cdaee0;
  --violet-bg: rgba(140, 100, 168, .20);

  color-scheme: dark;
}

/* =========================================================================
   RESET + BASE
   ========================================================================= */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background var(--t-med) var(--ease), color var(--t-med) var(--ease);
}

h1,
h2,
h3,
.serif {
  font-family: var(--font-serif);
}

a {
  color: inherit;
}

button {
  font-family: inherit;
}

::selection {
  background: var(--brand-dim);
  color: var(--brand-ink);
}

/* thin, theme-aware scrollbars for the content column */
.content,
.modal-body {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

.content::-webkit-scrollbar,
.modal-body::-webkit-scrollbar {
  width: 8px;
}

.content::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 8px;
}

/* =========================================================================
   SHELL / LAYOUT
   ========================================================================= */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  padding: 14px 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  transition: background var(--t-med) var(--ease), border-color var(--t-med) var(--ease),
    width var(--t-med) var(--ease), flex-basis var(--t-med) var(--ease);
  z-index: 30;
}

.sb-logo {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 0 12px 17px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--sidebar-border);
}

.sb-logo .mark {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex: 0 0 36px;
  border: 1px solid var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-weight: 600;
  color: var(--brand);
  font-size: 17px;
}

.sb-logo .name {
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: .3px;
  color: var(--sidebar-logo);
  line-height: 1.15;
}

.sb-logo .sub {
  font-size: 9.5px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--sidebar-text-muted);
  margin-top: 2px;
}

.sb-scroll {
  flex: 1;
}

.sb-section {
  padding: 14px 12px 2px;
}

.sb-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 10px 8px;
  color: var(--sidebar-text-muted);
}

.sb-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.6px;
  text-transform: uppercase;
}

.sb-section-head i.chev {
  font-size: 9px;
  transition: transform var(--t-fast) var(--ease);
}

.sb-section.collapsed .chev {
  transform: rotate(-90deg);
}

.sb-section.collapsed .nav-list {
  display: none;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 9px 12px;
  margin-bottom: 2px;
  border-radius: var(--radius);
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  border-left: 2px solid transparent;
  background: none;
  border-top: none;
  border-right: none;
  border-bottom: none;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
  text-align: left;
}

.nav-item i {
  width: 15px;
  font-size: 12.5px;
  color: var(--sidebar-text-muted);
  text-align: center;
  transition: color var(--t-fast);
}

.nav-item:hover {
  background: var(--brand-dim);
}

.nav-item.active {
  background: var(--brand-dim);
  color: var(--brand-ink);
  border-left-color: var(--brand);
  font-weight: 600;
}

.nav-item.active i {
  color: var(--brand);
}

.nav-item.top-level {
  padding-left: 12px;
}

.sb-foot {
  margin-top: auto;
  padding: 16px 20px 4px;
  border-top: 1px solid var(--sidebar-border);
}

.sb-foot-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sb-foot .u-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex: 0 0 32px;
  background: var(--brand-dim);
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 13px;
}

.sb-foot .u-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--sidebar-text);
}

.sb-foot .u-role {
  font-size: 10.5px;
  color: var(--sidebar-text-muted);
  letter-spacing: .3px;
}

/* mobile sidebar backdrop */
.sb-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 25;
}

/* ---------- Sidebar — collapsed / icon-rail state (desktop & tablet only;
   the hamburger drives this state above the 900px breakpoint, and the
   existing off-canvas open/close below it — see the responsive block at
   the bottom of this file) ---------- */
@media(min-width:901px) {
  .app-shell.sb-collapsed .sidebar {
    width: var(--sidebar-w-mini);
    flex-basis: var(--sidebar-w-mini);
  }

  .app-shell.sb-collapsed .sb-logo {
    padding: 0 0 13px 13px;
    justify-content: center;
  }

  .app-shell.sb-collapsed .sb-logo .name,
  .app-shell.sb-collapsed .sb-logo .sub {
    display: none;
  }

  .app-shell.sb-collapsed .sb-section {
    padding: 14px 8px 2px;
  }

  .app-shell.sb-collapsed .sb-section-head {
    justify-content: center;
    padding: 0 0 8px;
  }

  .app-shell.sb-collapsed .sb-label,
  .app-shell.sb-collapsed .sb-section-head i.chev {
    display: none;
  }

  .app-shell.sb-collapsed .nav-item {
    justify-content: center;
    padding: 10px 0;
    gap: 0;
  }

  .app-shell.sb-collapsed .nav-item.top-level {
    padding-left: 0;
  }

  .app-shell.sb-collapsed .nav-item i {
    width: auto;
    font-size: 15px;
  }

  .app-shell.sb-collapsed .nav-label {
    display: none;
  }

  .app-shell.sb-collapsed .sb-foot {
    padding: 16px 8px 4px;
  }

  .app-shell.sb-collapsed .sb-foot-user {
    justify-content: center;
  }

  .app-shell.sb-collapsed .sb-foot-user>div:not(.u-avatar) {
    display: none;
  }
}

/* ---------- Main column ---------- */
.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

header.topbar {
  height: var(--header-h);
  background: var(--header-bg);
  border-bottom: 1px solid var(--header-border);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 26px;
  position: sticky;
  top: 0;
  z-index: 20;
  transition: background var(--t-med) var(--ease), border-color var(--t-med) var(--ease);
}

.hamburger {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 17px;
  cursor: pointer;
  flex: 0 0 auto;
}

.topbar-left {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.crumbs {
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
}

.crumbs b {
  color: var(--text);
  font-weight: 600;
}

.page-title {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 600;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-search {
  flex: 1;
  display: flex;
  justify-content: center;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 8px 16px;
  font-size: 12.5px;
  color: var(--text-muted);
  width: 100%;
  max-width: 420px;
  position: relative;
  overflow: visible;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

.search-box:focus-within {
  border-color: color-mix(in srgb, var(--brand) 55%, var(--border));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 14%, transparent);
}

.search-dd {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 400;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  max-height: min(420px, 70vh);
  overflow-y: auto;
  padding: 6px;
  font-size: 12.5px;
  isolation: isolate;
}

.sd-group + .sd-group {
  border-top: 1px solid var(--border);
  margin-top: 4px;
  padding-top: 4px;
}

.sd-group-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  padding: 6px 10px 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sd-group-count {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-faint);
  background: var(--bg-2);
  border-radius: 999px;
  padding: 1px 7px;
  letter-spacing: 0;
  text-transform: none;
}

.sd-row {
  display: block;
  padding: 7px 10px;
  border-radius: 6px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.sd-row:hover,
.sd-row.active {
  background: var(--neutral-bg);
}

.sd-row.sd-exact {
  background: var(--ok-bg);
}

.sd-row.sd-exact.active {
  background: var(--ok-bg);
  outline: 1px solid var(--ok);
}

.sd-label {
  font-weight: 600;
}

.sd-label mark,
.sd-sub mark {
  background: color-mix(in srgb, var(--brand) 22%, transparent);
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}

.sd-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}

.sd-empty {
  padding: 16px 12px;
  color: var(--text-muted);
  text-align: center;
}

.sd-empty-hint {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-faint);
}

.sd-loading {
  padding: 18px 12px;
  color: var(--text-muted);
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12px;
}

.sd-foot-wrap {
  margin-top: 4px;
  border-top: 1px solid var(--border);
}

.sd-foot {
  display: block;
  text-align: center;
  padding: 8px;
  color: var(--brand-strong);
  font-weight: 600;
  font-size: 11.5px;
  text-decoration: none;
}

.sd-foot:hover {
  background: var(--neutral-bg);
}

.sd-kbd-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex-wrap: wrap;
  padding: 4px 8px 8px;
  font-size: 10px;
  color: var(--text-faint);
}

.sd-kbd-hint kbd {
  font-family: var(--font-sans);
  font-size: 9.5px;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0 4px;
  background: var(--bg-2);
  color: var(--text-muted);
}

.search-box i {
  font-size: 12px;
}

.search-box input {
  border: none;
  background: none;
  outline: none;
  font-family: inherit;
  font-size: 12.5px;
  color: var(--text);
  width: 100%;
}

.search-box input::placeholder {
  color: var(--text-faint);
}

.search-box kbd {
  font-family: var(--font-sans);
  font-size: 10px;
  color: var(--text-faint);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  margin-left: auto;
}

.search-box .search-close {
  display: none;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 4px;
  font-size: 13px;
  margin-left: auto;
}

.search-toggle {
  display: none;
}

/* ---------- Search results page ---------- */
.search-page-form {
  align-items: stretch;
}

.search-page-input-wrap {
  flex: 1;
  min-width: 200px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 0 14px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

.search-page-input-wrap:focus-within {
  border-color: color-mix(in srgb, var(--brand) 55%, var(--border));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 14%, transparent);
}

.search-page-input-wrap i {
  color: var(--text-muted);
  font-size: 12px;
}

.search-page-input-wrap .fbar-input {
  border: none;
  background: transparent;
  box-shadow: none;
  padding-left: 0;
  padding-right: 0;
  flex: 1;
}

.search-page-input-wrap .fbar-input:focus {
  outline: none;
  box-shadow: none;
}

.search-page-clear {
  color: var(--text-muted);
  font-size: 13px;
  padding: 4px;
  line-height: 1;
  text-decoration: none;
}

.search-page-clear:hover {
  color: var(--text);
}

.search-hints {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 8px;
}

.search-hint {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.search-hint > i {
  color: var(--brand-strong);
  font-size: 15px;
  margin-top: 2px;
  width: 18px;
  text-align: center;
}

.search-hint strong {
  display: block;
  font-size: 13px;
  margin-bottom: 2px;
}

.search-hint span {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

.search-jump {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 18px;
}

.search-jump-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}

.search-jump-chip span {
  font-size: 10.5px;
  font-weight: 700;
  background: var(--surface);
  border-radius: 999px;
  padding: 1px 7px;
  color: var(--text-faint);
}

.search-jump-chip:hover {
  color: var(--text);
  border-color: color-mix(in srgb, var(--brand) 35%, var(--border));
}

.search-jump-chip.active {
  background: color-mix(in srgb, var(--brand) 12%, var(--surface));
  border-color: color-mix(in srgb, var(--brand) 45%, var(--border));
  color: var(--brand-strong);
}

.search-jump-chip.active span {
  background: color-mix(in srgb, var(--brand) 18%, var(--surface));
  color: var(--brand-strong);
}

.search-section {
  margin-top: 8px;
  scroll-margin-top: calc(var(--header-h) + 12px);
}

.search-section .section-heading {
  margin-top: 20px;
}

.search-section-count {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-faint);
}

.search-empty {
  margin-top: 24px;
  text-align: center;
  padding: 40px 24px;
}

.search-empty > i {
  font-size: 28px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.search-empty-tips {
  list-style: none;
  padding: 0;
  margin: 14px auto 0;
  max-width: 360px;
  text-align: left;
  color: var(--text-muted);
  font-size: 12.5px;
  line-height: 1.6;
}

.search-empty-tips li {
  padding-left: 14px;
  position: relative;
}

.search-empty-tips li::before {
  content: "·";
  position: absolute;
  left: 2px;
  color: var(--text-faint);
}

.db-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.db-badge.dev {
  background: var(--ok-bg);
  color: var(--ok);
}
.db-badge.prod {
  background: var(--danger-bg);
  color: var(--danger);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid transparent;
  background: none;
  color: var(--text-muted);
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: background var(--t-fast), color var(--t-fast);
}

.icon-btn:hover {
  background: var(--bg-2);
  color: var(--text);
}

.icon-btn .badge {
  position: absolute;
  top: 4px;
  right: 5px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  border: 2px solid var(--header-bg);
}

/* theme toggle: two icons, swap visibility by [data-theme] on <html> */
.theme-toggle .fa-sun {
  display: none;
}

.theme-toggle .fa-moon {
  display: inline;
}

html[data-theme="dark"] .theme-toggle .fa-sun {
  display: inline;
}

html[data-theme="dark"] .theme-toggle .fa-moon {
  display: none;
}

/* ---------- dropdown menus (user + notifications) ---------- */
.menu-wrap {
  position: relative;
}

.menu-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px 6px 5px 5px;
  border-radius: var(--radius-pill);
  color: var(--text);
}

.menu-trigger:hover {
  background: var(--bg-2);
}

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--text);
  color: var(--brand-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-size: 13px;
  font-weight: 600;
  flex: 0 0 30px;
}

[data-theme="dark"] .avatar {
  background: var(--brand);
  color: var(--text-on-brand);
}

.menu-trigger .u-meta {
  text-align: left;
  line-height: 1.2;
  display: none;
}

.menu-trigger .u-meta .n {
  font-size: 12px;
  font-weight: 600;
}

.menu-trigger .u-meta .r {
  font-size: 10px;
  color: var(--text-muted);
}

.menu-trigger .fa-chevron-down {
  font-size: 9px;
  color: var(--text-faint);
}

@media(min-width:1180px) {
  .menu-trigger .u-meta {
    display: block;
  }
}

.dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 250px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity var(--t-fast) var(--ease), transform var(--t-fast) var(--ease), visibility var(--t-fast);
  z-index: 50;
}

.menu-wrap.open .dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-head {
  padding: 8px 10px 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}

.dropdown-head .n {
  font-size: 13px;
  font-weight: 600;
}

.dropdown-head .e {
  font-size: 11px;
  color: var(--text-muted);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  background: none;
  border: none;
  font-size: 12.5px;
  color: var(--text);
  cursor: pointer;
}

.dropdown-item i {
  width: 15px;
  color: var(--text-muted);
  font-size: 12px;
}

.dropdown-item:hover {
  background: var(--bg-2);
}

.dropdown-item.danger {
  color: var(--danger);
}

.dropdown-item.danger i {
  color: var(--danger);
}

.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 6px 2px;
}

.dropdown.notif {
  width: 320px;
}

.notif-list {
  max-height: 340px;
  overflow-y: auto;
}

.notif-row {
  display: flex;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-sm);
}

.notif-row:hover {
  background: var(--bg-2);
}

.notif-dot-wrap {
  width: 8px;
  padding-top: 6px;
  flex: 0 0 8px;
}

.notif-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand);
}

.notif-row.read .notif-dot {
  background: transparent;
}

.notif-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  flex: 0 0 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.notif-body {
  min-width: 0;
}

.notif-body .t {
  font-size: 12px;
  color: var(--text);
  line-height: 1.35;
}

.notif-body .m {
  font-size: 10.5px;
  color: var(--text-faint);
  margin-top: 2px;
}

.dropdown-foot {
  text-align: center;
  padding-top: 6px;
  margin-top: 4px;
  border-top: 1px solid var(--border);
}

.dropdown-foot a {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--brand-strong);
  text-decoration: none;
}

/* =========================================================================
   CONTENT
   ========================================================================= */
.content {
  padding: 26px 28px 70px;
  flex: 1;
}

.page {
  display: none;
  animation: fade .2s var(--ease);
}

.page.active {
  display: block;
}

@keyframes fade {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.page-head h1 {
  font-size: 24px;
  font-weight: 600;
}

.page-head p {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 3px;
}

.page-head-actions {
  display: flex;
  gap: 10px;
}

/* ---------- KPI cards ---------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
  transition: border-color var(--t-fast);
}

a.kpi-link {
  display: block;
  color: inherit;
  text-decoration: none;
}

a.kpi-link:hover {
  border-color: var(--brand);
}

.kpi-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--kpi-accent, var(--brand));
}

.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.kpi-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 1.1px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.kpi-icon {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--kpi-bg, var(--brand-dim));
  color: var(--kpi-accent, var(--brand));
  font-size: 11px;
  flex: 0 0 26px;
}

.kpi-num {
  font-family: var(--font-serif);
  font-size: 29px;
  font-weight: 600;
  line-height: 1;
}

.kpi-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 5px;
}

.kpi-sub.up {
  color: var(--ok);
}

.kpi-sub.down {
  color: var(--danger);
}

/* ---------- Filter bar ---------- */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  margin-bottom: 18px;
}

.seg {
  display: flex;
  background: var(--bg-2);
  border-radius: var(--radius-pill);
  padding: 3px;
  gap: 2px;
}

.seg button {
  border: none;
  background: transparent;
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  color: var(--text-muted);
  letter-spacing: .3px;
  transition: background var(--t-fast), color var(--t-fast);
}

.seg button.active {
  background: var(--text);
  color: var(--brand-soft);
}

[data-theme="dark"] .seg button.active {
  background: var(--brand);
  color: var(--text-on-brand);
}

.field,
.fbar-input,
.fbar-select {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 12.5px;
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color var(--t-fast);
}

.field:focus,
.fbar-input:focus,
.fbar-select:focus {
  border-color: var(--brand);
}

.fbar-input {
  flex: 1;
  min-width: 80px;
}

.btn {
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .5px;
  text-transform: uppercase;
  padding: 9px 18px;
  border-radius: var(--radius);
  cursor: pointer;
  border: 1px solid transparent;
  transition: .2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.btn-primary {
  background: var(--text);
  color: var(--brand-soft);
  border-color: var(--text);
}

.btn-primary:hover {
  background: var(--brand);
  color: var(--text-on-brand);
  border-color: var(--brand);
}

[data-theme="dark"] .btn-primary {
  background: var(--brand);
  color: var(--text-on-brand);
  border-color: var(--brand);
}

[data-theme="dark"] .btn-primary:hover {
  background: var(--brand-soft);
  border-color: var(--brand-soft);
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

.btn-ghost:hover {
  border-color: var(--brand);
  color: var(--brand-strong);
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger-bg);
}

.btn-danger:hover {
  background: var(--danger-bg);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 10.5px;
}

.btn[disabled] {
  opacity: .5;
  cursor: not-allowed;
}

/* ---------- Section heading ---------- */
.section-heading {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 600;
  margin: 28px 0 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-heading::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.section-heading .tag {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-faint);
}

/* ---------- Table ---------- */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.table-scroll {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  min-width: 640px;
}

thead th {
  text-align: left;
  padding: 11px 16px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .9px;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
  white-space: nowrap;
}

tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: var(--bg-2);
}

.mono {
  font-variant-numeric: tabular-nums;
  letter-spacing: .2px;
}

.cell-strong {
  font-weight: 600;
}

.cell-muted {
  color: var(--text-muted);
}

.row-check {
  width: 34px;
}

.table-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}

.icon-action {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.icon-action:hover {
  background: var(--bg-2);
  color: var(--brand-strong);
  border-color: var(--border);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .3px;
  text-transform: uppercase;
  white-space: nowrap;
}

.pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.pill-ok {
  background: var(--ok-bg);
  color: var(--ok);
}

.pill-info {
  background: var(--info-bg);
  color: var(--info);
}

.pill-warn {
  background: var(--warn-bg);
  color: var(--warn);
}

.pill-danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.pill-violet {
  background: var(--violet-bg);
  color: var(--violet);
}

.pill-neutral {
  background: var(--neutral-bg);
  color: var(--neutral);
}

.table-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 10px;
}

.pagination {
  display: flex;
  gap: 4px;
}

.pagination button {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 11.5px;
  cursor: pointer;
}

.pagination button.active {
  background: var(--text);
  color: var(--brand-soft);
  border-color: var(--text);
}

[data-theme="dark"] .pagination button.active {
  background: var(--brand);
  color: var(--text-on-brand);
  border-color: var(--brand);
}

/* ---------- Tracker gauge (Product Tracker: Entered / Expected) ---------- */
.pj-gauge-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin: 22px 0;
}

.pj-gauge {
  width: 340px;
  height: 340px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 5px solid var(--brand-soft);
  box-shadow: 0 0 0 1px var(--border-strong), 0 8px 20px rgba(0, 0, 0, .08);
}

.pj-gauge-half {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
}

.pj-gauge-half.entered {
  background: var(--text);
  color: var(--bg);
}

.pj-gauge-half.expected {
  background: var(--brand);
  color: var(--text-on-brand);
}

.pj-gauge-num {
  font-family: var(--font-serif);
  font-size: 5rem;
  font-weight: 600;
  line-height: 1;
  margin-bottom: 12px;

}

.pj-gauge-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1.3px;
  text-transform: uppercase;
  opacity: .85;
}

.pj-gauge-badge {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .6px;
  text-transform: uppercase;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  background: var(--surface);
  text-align: center;
  max-width: 260px;
}

/* ---------- Generic surface panel / card ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
}

.two-col {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 16px;
  align-items: start;
}

@media(max-width:980px) {
  .two-col {
    grid-template-columns: 1fr;
  }
}

/* ---------- Products catalogue ---------- */
.pl-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.pl-sum {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: inherit;
  transition: border-color var(--t-fast), background var(--t-fast);
  min-width: 0;
}

.pl-sum:hover {
  border-color: var(--brand);
}

.pl-sum.is-active {
  border-color: var(--brand);
  background: var(--brand-dim);
}

.pl-sum-static {
  cursor: default;
}

.pl-sum-static:hover {
  border-color: var(--border);
}

.pl-sum-n {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.1;
}

.pl-sum-l {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .4px;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pl-sum-ok .pl-sum-n { color: var(--ok); }
.pl-sum-warn .pl-sum-n { color: var(--warn); }

.pl-filters {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pl-search {
  position: relative;
  display: flex;
  align-items: center;
}

.pl-search > i {
  position: absolute;
  left: 12px;
  color: var(--text-faint);
  font-size: 12px;
  pointer-events: none;
}

.pl-search .field {
  width: 100%;
  padding-left: 36px;
}

.pl-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.pl-filter-row .fbar-select {
  flex: 1 1 140px;
  min-width: 130px;
}

.pl-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.pl-chips-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .4px;
  text-transform: uppercase;
  color: var(--text-faint);
}

.pl-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  background: var(--brand-dim);
  color: var(--brand-ink);
  font-size: 11.5px;
  font-weight: 600;
  text-decoration: none;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pl-chip .fa-xmark {
  font-size: 10px;
  opacity: .7;
}

.pl-chip:hover .fa-xmark {
  opacity: 1;
}

.pl-chip-clear {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--brand-strong);
  text-decoration: none;
}

.pl-chip-clear:hover {
  text-decoration: underline;
}

.pl-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.pl-toolbar-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.pl-toolbar-meta b {
  color: var(--text);
  font-weight: 600;
}

.pl-view-seg a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 28px;
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 12px;
}

.pl-view-seg a.active {
  background: var(--text);
  color: var(--brand-soft);
}

[data-theme="dark"] .pl-view-seg a.active {
  background: var(--brand);
  color: var(--text-on-brand);
}

.pl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.pl-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: border-color var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
}

.pl-card:hover {
  border-color: var(--brand);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.pl-card-media {
  position: relative;
  aspect-ratio: 1;
  background: var(--bg-2);
  overflow: hidden;
}

.pl-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform var(--t-med) var(--ease);
}

.pl-card:hover .pl-card-media img {
  transform: scale(1.04);
}

.pl-card-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  font-size: 28px;
}

.pl-card-badge {
  position: absolute;
  top: 10px;
  left: 10px;
}

.pl-card-body {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.pl-card-name {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pl-card-ref {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pl-card-style {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pl-card-meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
  font-size: 11px;
  color: var(--text-muted);
}

.pl-card-foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 6px;
}

.pl-card-metal {
  font-size: 11px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pl-card-price {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 600;
  color: var(--brand-strong);
  flex-shrink: 0;
}

[data-theme="dark"] .pl-card-price {
  color: var(--brand);
}

.pl-th-img,
.pl-td-img {
  width: 64px;
  padding-left: 12px !important;
  padding-right: 8px !important;
}

.pl-thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 8px;
  display: block;
  background: var(--bg-2);
}

.pl-thumb-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  font-size: 14px;
}

.pl-row {
  cursor: pointer;
}

.pl-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 4px 0;
  font-size: 11.5px;
  color: var(--text-muted);
}

.pl-pager-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  color: var(--text-faint);
}

.pl-empty {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

@media (max-width: 1100px) {
  .pl-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .pl-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pl-sum-static {
    grid-column: 1 / -1;
  }

  .pl-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .pl-card-body {
    padding: 10px;
  }

  .pl-card-name {
    font-size: 12.5px;
  }

  .pl-card-ref {
    font-size: 12.5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pl-card,
  .pl-card-media img {
    transition: none;
  }

  .pl-card:hover {
    transform: none;
  }

  .pl-card:hover .pl-card-media img {
    transform: none;
  }
}

/* location cards (Inventory > Location) */
.loc-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}

@media(max-width:1200px) {
  .loc-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.loc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  cursor: pointer;
  transition: border-color var(--t-fast);
}

.loc-card:hover,
.loc-card.active {
  border-color: var(--brand);
}

.loc-card-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.loc-card-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand-dim);
  color: var(--brand-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex: 0 0 32px;
}

[data-theme="dark"] .loc-card-icon {
  color: var(--brand);
}

.loc-card-name {
  font-size: 13px;
  font-weight: 600;
}

.loc-card-type {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.loc-card-num {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 600;
}

.loc-card-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.mix-wrap {
  margin: -8px 0 24px;
}

.mix-bar {
  display: flex;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--bg-2);
}

.mix-bar > span {
  display: block;
  height: 100%;
  min-width: 0;
}

.mix-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-muted);
}

.mix-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: 1px;
}

.mix-pending { background: var(--ok); }
.mix-assigned { background: var(--info); }
.mix-sold { background: var(--violet); }
.mix-reserved { background: var(--warn); }

table.loc-bars td {
  vertical-align: middle;
}

.loc-name-cell { width: 220px; }
.loc-name-cell a { display: block; }
.loc-bar-cell { width: auto; }
.loc-count-cell { width: 72px; text-align: right; font-weight: 600; }

.dash-bar {
  height: 8px;
  border-radius: 4px;
  background: var(--bg-2);
  overflow: hidden;
}

.dash-bar > span {
  display: block;
  height: 100%;
  background: var(--brand);
  min-width: 3px;
  border-radius: 4px;
}

.dash-mini-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 12px;
}

.dash-mini-num {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 600;
  margin-top: 4px;
}

.dash-sales {
  background: var(--brand-dim);
  border: 1px solid var(--border);
  border-left: 4px solid var(--brand);
  border-radius: var(--radius-lg);
  padding: 14px 16px 16px;
  margin-bottom: 24px;
}

.dash-seq-intro {
  margin: -4px 0 12px;
  font-size: 12.5px;
  color: var(--text-muted);
  max-width: 62ch;
}

.dash-seq-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.dash-seq-card {
  padding: 16px 18px 18px;
}

.dash-seq-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.dash-seq-series {
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-muted);
}

.dash-seq-next {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  background: var(--brand-dim);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
}

.dash-seq-next-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.dash-seq-next-code {
  font-size: 22px;
  font-weight: 700;
  color: var(--brand-strong);
  letter-spacing: 0.02em;
}

[data-theme="dark"] .dash-seq-next-code {
  color: var(--brand);
}

.dash-seq-last {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
  margin-bottom: 14px;
}

.dash-seq-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
  margin: 0;
}

.dash-seq-meta dt {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 0 0 2px;
}

.dash-seq-meta dd {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 800px) {
  .dash-seq-grid {
    grid-template-columns: 1fr;
  }
}

.kpi-card.is-alert {
  --kpi-accent: var(--danger);
  --kpi-bg: var(--danger-bg);
}

.loc-empty {
  display: none;
}

.loc-empty.is-visible {
  display: table-row;
}

.loc-toggle-row td {
  text-align: center;
  padding: 8px 14px;
}

button.linkish {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  color: var(--brand-strong);
  cursor: pointer;
}

button.linkish:hover {
  text-decoration: underline;
}

.dash-actions {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 24px;
}

.action-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 18px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: center;
  transition: border-color var(--t-fast);
}

.action-card:hover {
  border-color: var(--brand);
  color: inherit;
}

.action-card i {
  font-size: 18px;
  color: var(--text-muted);
}

.action-card:hover i {
  color: var(--brand);
}

/* report cards (Reports page) */
.report-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

@media(max-width:980px) {
  .report-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media(max-width:640px) {
  .report-grid {
    grid-template-columns: 1fr;
  }
}

.report-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color var(--t-fast), transform var(--t-fast);
}

.report-card:hover {
  border-color: var(--brand);
  transform: translateY(-2px);
}

.report-card-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  background: var(--brand-dim);
  color: var(--brand-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}

[data-theme="dark"] .report-card-icon {
  color: var(--brand);
}

.report-card h3 {
  font-size: 15.5px;
  font-weight: 600;
  font-family: var(--font-sans);
}

.report-card p {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.5;
  flex: 1;
}

.report-card a {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--brand-strong);
  text-decoration: none;
  letter-spacing: .3px;
}

.report-card a i {
  margin-left: 4px;
  font-size: 10px;
}

/* tag print preview */
.tag-preview {
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.tag-chip {
  width: 100%;
  max-width: 230px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
}

.tag-chip .brand {
  font-family: var(--font-serif);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .5px;
  margin-bottom: 6px;
}

.tag-chip .code {
  font-family: var(--font-sans);
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.tag-chip .bars {
  height: 34px;
  background: repeating-linear-gradient(90deg, var(--text) 0 2px, transparent 2px 4px);
  margin-bottom: 8px;
  opacity: .85;
}

.tag-chip .price {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 600;
  color: var(--brand-strong);
}

[data-theme="dark"] .tag-chip .price {
  color: var(--brand);
}

/* empty state */
.empty-state {
  text-align: center;
  padding: 50px 20px;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 26px;
  color: var(--text-faint);
  margin-bottom: 12px;
}

.empty-state p {
  font-size: 12.5px;
}

.note {
  padding: 12px 16px;
  background: var(--brand-dim);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 12px;
  color: var(--brand-ink);
  margin-bottom: 18px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.note i {
  margin-top: 1px;
}


/* Auth — see the AUTH / SIGN-IN section further down for the split layout. */
.auth-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: stretch;
}


/* =========================================================================
   MODALS
   ========================================================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--t-med) var(--ease), visibility var(--t-med);
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-md);
  transform: translateY(10px);
  transition: transform var(--t-med) var(--ease);
  border: 1px solid var(--border);
}

.modal-overlay.open .modal {
  transform: translateY(0);
}

.modal.wide {
  max-width: 760px;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}

.modal-head h2 {
  font-size: 19px;
  font-weight: 600;
}

.modal-head p {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
}

.modal-close:hover {
  color: var(--text);
}

.modal-body {
  padding: 20px 22px;
  overflow-y: auto;
}

.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 22px;
  border-top: 1px solid var(--border);
}

.modal-foot .spacer {
  margin-right: auto;
  font-size: 11.5px;
  color: var(--text-muted);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-grid.single {
  grid-template-columns: 1fr;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-field.span-2 {
  grid-column: 1/-1;
}

.form-field label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: .3px;
  text-transform: uppercase;
}

.form-field input,
.form-field select,
.form-field textarea {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 12px;
  font-size: 13px;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color var(--t-fast);
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  border-color: var(--brand);
}

.form-field textarea {
  resize: vertical;
  min-height: 70px;
}

.mini-table {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 6px;
}

.mini-table table {
  min-width: 0;
  font-size: 12px;
}

.mini-table thead th {
  padding: 8px 12px;
}

.mini-table tbody td {
  padding: 9px 12px;
}

.total-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 2px;
  font-size: 13px;
}

.total-row.grand {
  font-weight: 700;
  font-size: 15px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
  padding-top: 12px;
}

.detail-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.detail-row .k {
  color: var(--text-muted);
}

.detail-row .v {
  font-weight: 600;
}

/* =========================================================================
   RESPONSIVE — off-canvas sidebar under 900px
   ========================================================================= */
@media(max-width:900px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    transform: translateX(-100%);
    transition: transform var(--t-med) var(--ease);
    box-shadow: var(--shadow-md);
  }

  .app-shell.nav-open .sidebar {
    transform: translateX(0);
  }

  .app-shell.nav-open .sb-backdrop {
    display: block;
  }

  .topbar-search {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 30;
    background: var(--header-bg);
    padding: 0 12px;
    align-items: center;
    justify-content: stretch;
  }

  .topbar-search.is-open {
    display: flex;
  }

  .topbar-search .search-box {
    max-width: none;
    width: 100%;
  }

  .topbar-search .search-box kbd {
    display: none;
  }

  .topbar-search .search-box .search-close {
    display: inline-flex;
  }

  .topbar-search .search-dd {
    left: 12px;
    right: 12px;
    width: auto;
  }

  .search-toggle {
    display: flex;
  }
}

@media(max-width:560px) {
  .content {
    padding: 18px 16px 60px;
  }

  .page-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }
}
/* =========================================================================
   AUTH / SIGN-IN
   The login page previously rendered `{{ form.as_p }}`, so the panel and
   button picked up the design system while the inputs fell back to browser
   defaults — labels inline with colons, hairline borders, no dark-theme
   support. These rules cover the fields the template now writes out
   explicitly.
   ========================================================================= */
.auth-main::before {
  /* A quiet wash behind the card on the form column so it isn't a flat
     expanse. Brand hue at very low alpha — reads in both themes without a
     second colour being introduced. */
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(42rem 28rem at 110% -15%, color-mix(in srgb, var(--brand) 9%, transparent), transparent 72%);
  pointer-events: none;
}

/* ── Split sign-in: slideshow left, form right ──────────────────────────
   The aside is always dark (photo + scrim) regardless of theme; the form
   column follows the active theme. Below 860px the aside drops to a dim
   fixed backdrop and the card floats over it. Slideshow is decorative
   only — aria-hidden, and it freezes for prefers-reduced-motion. */
.auth-aside {
  position: relative;
  flex: 1 1 0;
  overflow: hidden;
  background: #14110f;
  display: flex;
}

.auth-slideshow {
  position: absolute;
  inset: 0;
}

.auth-slideshow span {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transform: scale(1.06);
  animation: authKenBurns 84s infinite;
  will-change: opacity, transform;
}

/* 12 frames x 7s = the 84s loop. Each holds ~4s with a ~1.5s cross-fade. */
.auth-slideshow span:nth-child(1)  { animation-delay:  0s; }
.auth-slideshow span:nth-child(2)  { animation-delay:  7s; }
.auth-slideshow span:nth-child(3)  { animation-delay: 14s; }
.auth-slideshow span:nth-child(4)  { animation-delay: 21s; }
.auth-slideshow span:nth-child(5)  { animation-delay: 28s; }
.auth-slideshow span:nth-child(6)  { animation-delay: 35s; }
.auth-slideshow span:nth-child(7)  { animation-delay: 42s; }
.auth-slideshow span:nth-child(8)  { animation-delay: 49s; }
.auth-slideshow span:nth-child(9)  { animation-delay: 56s; }
.auth-slideshow span:nth-child(10) { animation-delay: 63s; }
.auth-slideshow span:nth-child(11) { animation-delay: 70s; }
.auth-slideshow span:nth-child(12) { animation-delay: 77s; }

@keyframes authKenBurns {
  0%    { opacity: 0; transform: scale(1.06); }
  1.8%  { opacity: 1; }
  7.1%  { opacity: 1; }
  8.9%  { opacity: 0; transform: scale(1.12); }
  100%  { opacity: 0; transform: scale(1.12); }
}

.auth-aside-veil {
  position: absolute;
  inset: 0;
  background: linear-gradient(155deg, rgba(20, 17, 15, .28) 0%, rgba(20, 17, 15, .55) 55%, rgba(20, 17, 15, .82) 100%);
}

.auth-aside-copy {
  position: relative;
  margin-top: auto;
  padding: 48px;
  color: #f4ecdd;
}

.auth-aside-mark {
  width: 46px;
  height: 46px;
  border: 1px solid var(--brand);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 600;
  color: var(--brand);
  margin-bottom: 18px;
}

.auth-aside-name {
  font-family: var(--font-serif);
  font-size: 30px;
  font-weight: 600;
  letter-spacing: .5px;
}

.auth-aside-tag {
  margin-top: 6px;
  font-size: 11px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: rgba(231, 211, 168, .72);
}

.auth-main {
  position: relative;
  flex: 0 0 clamp(380px, 38vw, 540px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  /* The column IS the surface. It used to sit on --bg with a bordered
     card floating inside it — two dark planes of nearly the same value,
     with a 1px border doing all the work of telling them apart. Painting
     the column in --panel and dropping the inner card gives one honest
     surface, and matches the mobile sheet so both breakpoints express the
     same idea. */
  /* --panel is pure #ffffff in the light theme, which put a clinical
     white slab against a dark photograph. --bg is the warm off-white the
     rest of the light UI sits on, so the column reads as part of the same
     world as the gold. The dark theme keeps --panel, where the lift over
     --bg is what makes the column a surface at all. */
  background: var(--bg);
  /* Lifts the column off the photograph without a hard rule. */
  box-shadow: -24px 0 48px -24px rgba(0, 0, 0, .55);
  z-index: 1;
}

[data-theme="dark"] .auth-main {
  background: var(--panel);
}

@media (prefers-reduced-motion: reduce) {
  .auth-slideshow span { animation: none; transform: none; }
  .auth-slideshow span:not(:first-child) { display: none; }
  .auth-slideshow span:first-child { opacity: 1; }
}

.auth-card {
  /* No longer a card — just the measure the form is set to. Kept as a
     class so the mobile rules and the markup don't have to change. */
  position: relative;
  width: min(380px, 100%);
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 26px;
}

.auth-mark {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 50%;
  border: 1px solid var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 18px;
  color: var(--brand);
}

.auth-name {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.15;
}

.auth-sub {
  font-size: 10.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 2px;
}

.auth-title {
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 600;
  margin: 0 0 20px;
}

.auth-error {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  background: var(--danger-bg);
  color: var(--danger);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 12.5px;
  line-height: 1.45;
  margin-bottom: 18px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-field label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.auth-field .field {
  width: 100%;
  font-size: 14px;
  padding: 11px 13px;
}

.auth-pw {
  position: relative;
  display: flex;
}

.auth-pw .field {
  padding-right: 42px;
}

.auth-pw-toggle {
  position: absolute;
  right: 2px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  /* 44x44 is the smallest reliable tap target Apple and Google both
     publish. This was roughly 34px — fine with a mouse, fiddly with a
     thumb. */
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  border-radius: var(--radius);
}

.auth-pw-toggle:hover { color: var(--text); }
.auth-pw-toggle:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }

.auth-caps {
  font-size: 11px;
  color: var(--warn);
  display: flex;
  align-items: center;
  gap: 5px;
}

/* `display:flex` above is an author rule and outranks the browser's own
   `[hidden] { display: none }`, so without this the Caps Lock hint shows
   from page load and never hides however correctly the JS sets the
   attribute. Any element that gets a display value AND uses `hidden`
   needs this guard. */
.auth-caps[hidden] {
  display: none;
}

.auth-submit {
  width: 100%;
  padding: 12px 18px;
  font-size: 12px;
  margin-top: 4px;
}

.auth-submit:disabled { opacity: .65; cursor: progress; }

.auth-foot {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
}

/* ---- Mobile: hero photo above, form on a sheet that rises over it ----
   The desktop layout is a side-by-side split. Squeezing that onto a phone
   by turning the photo into a full-bleed background meant veiling it to
   88% so the form stayed readable — which downloaded 1.7 MB of imagery to
   render something indistinguishable from a flat dark panel.

   Here the photo gets the top third at a veil light enough to actually
   see it, and the form sits on an opaque sheet with a rounded top edge
   overlapping the image. Brand identity is where the eye lands first, the
   sign-in button falls in the thumb zone, and the picture earns its
   bytes. */
@media (max-width: 860px) {
  .auth-shell {
    display: flex;
    flex-direction: column;
  }

  .auth-aside {
    flex: none;
    height: clamp(190px, 34dvh, 340px);
  }

  /* Fades from a light wash at the top into the panel colour at the
     bottom, so the sheet's edge reads as a join rather than a seam. */
  .auth-aside-veil {
    background: linear-gradient(180deg,
      rgba(20, 17, 15, .30) 0%,
      rgba(20, 17, 15, .45) 55%,
      rgba(20, 17, 15, .70) 100%);
  }

  /* One image, not twelve. A login screen is on screen for a few seconds,
     so a slideshow is spend without payoff — and `display:none` means the
     other eleven are never fetched. Swap which one shows by reordering
     the spans in the template. */
  .auth-slideshow span:nth-child(n+2) { display: none; }
  .auth-slideshow span:first-child {
    animation: none;
    opacity: 1;
    transform: none;
  }

  .auth-aside-copy {
    display: block;
    margin-top: auto;
    padding: 0 22px 30px;
    padding-left: max(22px, env(safe-area-inset-left));
  }

  .auth-aside-mark {
    width: 34px;
    height: 34px;
    font-size: 15px;
    margin-bottom: 10px;
  }

  .auth-aside-name { font-size: 21px; }
  .auth-aside-tag { font-size: 9.5px; }

  .auth-main {
    position: relative;
    z-index: 1;
    flex: 1 1 auto;
    /* A flex column, not a block: the card below uses flex:1 to fill the
       sheet so `margin-top:auto` on the footer actually reaches the
       bottom. A percentage height on the card would not resolve here,
       because this element's own height comes from flex, not from a
       definite value. */
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--panel);
    /* Pulls the sheet up over the photo — the overlap is what makes it
       read as a sheet rather than two stacked bands. */
    margin-top: -20px;
    border-radius: 20px 20px 0 0;
    /* The desktop rule casts a shadow to the left, where the column meets
       the photo. Here the seam is the top edge, so the shadow turns with
       it — which is also what sells the sheet as rising over the image. */
    box-shadow: 0 -18px 36px -18px rgba(0, 0, 0, .6);
    background: var(--bg);
    padding: 28px 22px 22px;
    padding-left: max(22px, env(safe-area-inset-left));
    padding-right: max(22px, env(safe-area-inset-right));
    padding-bottom: max(22px, env(safe-area-inset-bottom));
  }

  .auth-main::before { display: none; }

  /* The sheet is the card now, so the card stops being one. */
  .auth-card {
    width: 100%;
    max-width: 440px;
    margin: 0 auto;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
  }

  /* Brand appears once, on the hero. */
  .auth-brand { display: none; }

  .auth-title {
    font-size: 30px;
    margin-bottom: 18px;
    /* Paired with the footer's own `margin-top:auto` below, this splits
       the sheet's spare height in two — so on a tall phone the form sits
       optically centred instead of stranded at the top above a void. On a
       short phone there is no spare height and both autos collapse to
       zero, which is exactly the behaviour wanted there. */
    margin-top: auto;
  }

  .auth-submit {
    padding: 15px 18px;
    font-size: 12.5px;
  }

  /* Pushes the footer to the bottom of the sheet so the button lands in
     the thumb zone instead of floating mid-screen. */
  .auth-foot { margin-top: auto; }
}

/* iOS Safari zooms the page whenever a focused input renders below 16px,
   and never zooms back out. 14px reads better on a desktop, so the bump
   is scoped to small screens rather than applied everywhere. */
@media (max-width: 640px) {
  .auth-field .field { font-size: 16px; }
  .auth-pw .field { padding-right: 50px; }
}

@media (max-width: 460px) {
  .auth-card { padding: 26px 22px 20px; border-radius: 12px; }
  .auth-title { font-size: 23px; }
}

/* ---- Brand marks -------------------------------------------------------
   The sidebar and login circles used to render the letters "PJ" in the
   serif face with a gold ring. They now hold the real monogram, which
   carries its own gold and its own diamond outline — so the ring is
   dropped rather than boxing artwork inside a second border. */
.sb-logo .mark img,
.auth-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.sb-logo .mark,
.auth-mark {
  border: none;
  padding: 2px;
}

/* Collapsed sidebar keeps the mark centred at its smaller size. */
.sidebar.is-collapsed .sb-logo .mark img { padding: 0; }

.auth-aside-logo {
  display: block;
  width: clamp(150px, 42%, 240px);
  height: auto;
  margin-bottom: 14px;
}

@media (max-width: 860px) {
  .auth-aside-logo {
    width: clamp(120px, 38%, 165px);
    margin-bottom: 10px;
  }
}

/* ---- Autofill ----------------------------------------------------------
   Chrome paints its own pale blue (or yellow) over any field it fills, and
   it wins over `background` — which is why every filled input in this app
   sits off-palette in both themes. There is no property to turn that off,
   so the standard workaround is an inset box-shadow thick enough to cover
   the field, plus -webkit-text-fill-color for the text on top of it. The
   absurd transition delay stops Chrome animating its colour back in on
   focus. Applies app-wide, not just to the sign-in form. */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active,
textarea:-webkit-autofill,
select:-webkit-autofill {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px var(--surface) inset;
  box-shadow: 0 0 0 1000px var(--surface) inset;
  caret-color: var(--text);
  transition: background-color 100000s ease-in-out 0s;
}
