/* Nova 23 admin — hand-written CSS, no build step.
   Palette from Design/DESIGN-GUIDELINES.md, pushed richer and more saturated
   than the marketing site: a control panel is looked at all day and wants more
   contrast than a landing page. Espresso carries the chrome (sidebar, headers,
   primary buttons); gold stays the single accent. */

:root {
  /* Brand tokens, unchanged — these are the client's palette. */
  --cream: #fbf9f5;
  --espresso: #2b2625;
  --mocha: #3c3736;
  --gold: #c5a059;
  --sand: #ebe3d5;
  --sage: #9ec1a3;
  --mist: #88a0c4;
  --coral: #e8a598;
  --navy: #1e2a38;
  --walnut: #4a3728;

  /* Saturated working variants. The brand tints are chosen for large calm
     areas; at pill and icon size they wash out, so each has a deeper partner
     used for text and small solid shapes. */
  --espresso-deep: #1c1817;
  --espresso-soft: #493f3d;
  --gold-deep: #a8813a;
  --gold-bright: #dcb26a;
  --sage-deep: #4f7d56;
  --mist-deep: #3f6098;
  --coral-deep: #c0563f;

  /* Surfaces */
  --ground: #f3efe7;
  --surface: #ffffff;
  --surface-2: #faf7f1;
  --line: #e3d9c8;
  --line-soft: rgba(227, 217, 200, 0.6);

  /* Type */
  --ink: #2b2625;
  --ink-2: rgba(60, 55, 54, 0.72);
  --ink-3: rgba(60, 55, 54, 0.5);

  --radius: 14px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(43, 38, 37, 0.05);
  --shadow: 0 2px 4px rgba(43, 38, 37, 0.05), 0 12px 28px -14px rgba(43, 38, 37, 0.22);
  --shadow-lg: 0 24px 48px -20px rgba(43, 38, 37, 0.35);

  --sidebar-w: 272px;
  --sidebar-w-collapsed: 76px;
}

* {
  box-sizing: border-box;
}

/* Scrollbars in the brand palette, the same treatment as the marketing site.
   `scrollbar-color` covers Firefox and modern Chromium; the ::-webkit rules
   cover Safari and older Chromium, which ignore the standard property. */
:root {
  scrollbar-color: var(--gold) var(--sand);
  scrollbar-width: thin;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track,
::-webkit-scrollbar-corner {
  background: var(--sand);
}

::-webkit-scrollbar-thumb {
  background: var(--gold);
  border-radius: 999px;
  /* Inset so the thumb reads as a pill inside the track. */
  border: 2px solid var(--sand);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--gold-deep);
}

/* Dark surfaces get a scrollbar that belongs to them rather than a pale
   track cutting through the espresso rail. */
.scrollbar-dark {
  scrollbar-color: var(--gold) var(--espresso-deep);
}

.scrollbar-dark::-webkit-scrollbar-track,
.scrollbar-dark::-webkit-scrollbar-corner {
  background: var(--espresso-deep);
}

.scrollbar-dark::-webkit-scrollbar-thumb {
  border-color: var(--espresso-deep);
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
.brand-wordmark,
.serif {
  font-family: "Cormorant Garamond", Georgia, Cambria, serif;
  font-weight: 600;
  letter-spacing: -0.01em;
}

a {
  color: inherit;
}

img {
  max-width: 100%;
}

/* Every interactive control gets the same visible focus ring. Keyboard access
   to an admin panel is not optional. */
:focus-visible {
  outline: 2px solid var(--gold-deep);
  outline-offset: 2px;
  border-radius: 6px;
}

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

/* ============================ Login ============================ */

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr;
}

@media (min-width: 900px) {
  .login-shell {
    grid-template-columns: 1.05fr 1fr;
  }
}

/* Brand panel: espresso, not navy. The logo is gold on transparent and was
   supplied on black, so it needs a dark backing (frontend/public/brand/README.md);
   espresso keeps that backing inside the brand palette instead of importing a
   blue that appears nowhere else in the product. */
.login-brand {
  background:
    radial-gradient(130% 90% at 12% 8%, rgba(197, 160, 89, 0.22) 0%, rgba(197, 160, 89, 0) 58%),
    linear-gradient(160deg, #342d2b 0%, var(--espresso) 45%, var(--espresso-deep) 100%);
  color: #fff;
  padding: 56px 48px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.login-brand::after {
  content: "";
  position: absolute;
  right: -140px;
  bottom: -160px;
  width: 400px;
  height: 400px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(197, 160, 89, 0.16) 0%, rgba(197, 160, 89, 0) 70%);
}

.login-brand-inner {
  margin: auto 0;
  position: relative;
  z-index: 1;
}

.login-logo {
  display: block;
  width: 100%;
  max-width: 300px;
  height: auto;
}

.login-tagline {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 23px;
  font-style: italic;
  color: var(--gold);
  margin: 24px 0 0;
}

.login-brand-foot {
  position: relative;
  z-index: 1;
  margin: 0;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
}

@media (max-width: 899px) {
  .login-brand {
    padding: 32px 28px;
  }
  .login-logo {
    max-width: 200px;
    margin: 0 auto;
  }
  .login-tagline {
    text-align: center;
    font-size: 18px;
  }
  .login-brand-foot {
    display: none;
  }
}

.login-main {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  background: var(--cream);
}

.login-card {
  width: 100%;
  max-width: 380px;
}

.login-title {
  font-size: 32px;
  margin: 0 0 6px;
}

.login-sub {
  color: var(--ink-2);
  margin: 0 0 32px;
}

.login-foot {
  margin: 26px 0 0;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink-3);
  text-align: center;
}

/* ============================ Forms ============================ */

.field {
  margin-bottom: 18px;
}

.field label,
.label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--ink);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  outline: none;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

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

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--gold-deep);
  box-shadow: 0 0 0 3px rgba(197, 160, 89, 0.22);
}

.field input[aria-invalid="true"],
.field select[aria-invalid="true"] {
  border-color: var(--coral-deep);
}

.field-hint {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--ink-3);
}

.field-error {
  margin: 6px 0 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--coral-deep);
}

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

@media (min-width: 720px) {
  .form-grid.cols-2 {
    grid-template-columns: 1fr 1fr;
  }
}

/* ============================ Buttons ============================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 18px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    transform 0.1s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Espresso, not gold. Gold on white is a mid-tone on a light ground and reads
   as disabled next to real text; espresso is unambiguously the primary action
   and leaves gold free to mean "selected". */
.btn-primary {
  background: var(--espresso);
  color: #fff;
}

.btn-primary:hover {
  background: var(--espresso-soft);
}

.btn-gold {
  background: var(--gold-deep);
  color: #fff;
}

.btn-gold:hover {
  background: #96712f;
}

.btn-secondary {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}

.btn-secondary:hover {
  border-color: var(--espresso-soft);
  background: var(--surface-2);
}

.btn-ghost {
  background: transparent;
  color: var(--ink-2);
}

.btn-ghost:hover {
  color: var(--ink);
  background: rgba(43, 38, 37, 0.05);
}

.btn-danger {
  background: var(--coral-deep);
  color: #fff;
}

.btn-danger:hover {
  background: #a4432d;
}

.btn-block {
  width: 100%;
}

.btn-lg {
  padding: 13px 18px;
  font-size: 15px;
}

.btn-sm {
  padding: 7px 12px;
  font-size: 13px;
}

/* Square icon-only control, used for the row actions in tables. 36px is the
   smallest that still clears the 24px minimum target with its padding. */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
  transition:
    background 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease;
}

.icon-btn:hover {
  background: var(--surface-2);
  border-color: var(--espresso-soft);
  color: var(--ink);
}

.icon-btn svg {
  width: 17px;
  height: 17px;
}

.icon-btn.is-approve:hover {
  border-color: var(--sage-deep);
  color: var(--sage-deep);
}

.icon-btn.is-danger:hover {
  border-color: var(--coral-deep);
  color: var(--coral-deep);
}

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

/* ---------- Row action menu ----------
   Every row action lives behind one button. A row of five icons is a row of
   five guesses; a menu can label what each one does.

   Built on <details>, so it opens and closes without JavaScript, and the menu
   itself is `position: fixed` and placed by admin.js. Absolute positioning
   would be clipped by .table-wrap's `overflow-x: auto`, which is exactly the
   kind of bug that only appears once a table is wide enough to scroll. */
.row-menu {
  position: relative;
  display: inline-block;
}

.row-menu > summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
}

/* Safari draws its own triangle on <summary> unless both are cleared. */
.row-menu > summary::-webkit-details-marker,
.row-menu > summary::marker {
  display: none;
  content: '';
}

.row-menu > summary:hover,
.row-menu[open] > summary {
  background: var(--surface-2);
  border-color: var(--espresso-soft);
  color: var(--ink);
}

.row-menu > summary svg {
  width: 18px;
  height: 18px;
  pointer-events: none;
}

.row-menu-list {
  position: fixed;
  z-index: 80;
  min-width: 214px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
}

.row-menu-list form {
  margin: 0;
}

.row-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.row-menu-item:hover {
  background: var(--surface-2);
}

.row-menu-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--ink-3);
}

.row-menu-item:hover svg {
  color: var(--ink);
}

.row-menu-item.is-approve:hover {
  color: var(--sage-deep);
}

.row-menu-item.is-approve:hover svg {
  color: var(--sage-deep);
}

.row-menu-item.is-danger:hover {
  color: var(--coral-deep);
  background: rgba(216, 112, 92, 0.08);
}

.row-menu-item.is-danger:hover svg {
  color: var(--coral-deep);
}

.row-menu-sep {
  height: 1px;
  margin: 5px 6px;
  background: var(--line-soft);
}

.row-menu-label {
  padding: 7px 10px 4px;
  margin: 0;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--ink-3);
}

/* ============================ Alerts ============================ */

.alert {
  border-radius: 10px;
  padding: 11px 14px;
  margin-bottom: 16px;
  font-size: 13px;
  border: 1px solid;
}

.alert-error {
  background: rgba(216, 112, 92, 0.1);
  border-color: rgba(216, 112, 92, 0.35);
  color: #8f3a26;
}

.alert-success {
  background: rgba(110, 155, 119, 0.12);
  border-color: rgba(110, 155, 119, 0.4);
  color: #3f6a48;
}

.alert-info {
  background: rgba(92, 124, 174, 0.1);
  border-color: rgba(92, 124, 174, 0.32);
  color: var(--mist-deep);
}

/* ============================ Shell ============================ */

.shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: linear-gradient(175deg, #332c2a 0%, var(--espresso) 42%, var(--espresso-deep) 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  /* The whole rail scrolls, brand and footer included. Scrolling only the nav
     list meant that on a short window the sign-out and collapse controls sat
     below the fold with no way to reach them. */
  overflow-y: auto;
  overscroll-behavior: contain;
  transition: width 0.22s ease;
  z-index: 40;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  min-height: 72px;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(197, 160, 89, 0.16);
  border: 1px solid rgba(197, 160, 89, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.brand-mark img {
  width: 26px;
  height: 26px;
  object-fit: contain;
}

.brand-text {
  min-width: 0;
}

.brand-wordmark {
  font-size: 19px;
  margin: 0;
  line-height: 1.15;
  color: #fff;
  white-space: nowrap;
}

.brand-sub {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.45);
  margin: 0;
  white-space: nowrap;
}

.nav {
  /* Grows to push the footer down on a tall window, but does not scroll on its
     own: the sidebar as a whole is the scroll container. */
  flex: 1 0 auto;
  overflow: visible;
  padding: 16px 12px;
}

.nav-label {
  padding: 0 12px 8px;
  margin: 0;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.35);
  white-space: nowrap;
}

.nav-label + .nav-label,
.nav-list + .nav-label {
  padding-top: 18px;
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-item a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 11px;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.72);
  margin-bottom: 3px;
  position: relative;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}

.nav-item a:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}

.nav-item.active a {
  background: var(--gold);
  color: var(--espresso);
  font-weight: 600;
}

.nav-icon {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
}

.nav-text {
  min-width: 0;
}

.nav-text-label {
  font-size: 14px;
  font-weight: 600;
  display: block;
  white-space: nowrap;
}

.nav-text-desc {
  font-size: 11.5px;
  display: block;
  color: rgba(255, 255, 255, 0.42);
  white-space: nowrap;
}

.nav-item.active .nav-text-desc {
  color: rgba(43, 38, 37, 0.65);
}

.nav-soon {
  font-size: 9px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.65);
  border-radius: 999px;
  padding: 1px 6px;
  margin-left: 6px;
  vertical-align: 1px;
}

.sidebar-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 14px;
  flex-shrink: 0;
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 9px 11px;
  text-decoration: none;
  transition: background 0.15s ease;
}

.user-card:hover {
  background: rgba(255, 255, 255, 0.11);
}

.user-card-text {
  min-width: 0;
}

.user-card-name {
  font-size: 13px;
  font-weight: 600;
  margin: 0;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-card-email {
  font-size: 11px;
  margin: 0;
  color: rgba(255, 255, 255, 0.5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 4px 0;
}

.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
}

.badge-gold {
  background: rgba(197, 160, 89, 0.18);
  color: var(--gold);
}

.link-quiet {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.6);
  padding: 4px;
}

.sign-out svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.link-quiet:hover {
  color: #fff;
}

/* ---------- Collapsed rail ----------
   Everything textual is hidden and the rail centres its icons. The labels are
   re-exposed as CSS tooltips so a collapsed sidebar is still navigable without
   hovering blindly. */

html[data-sidebar="collapsed"] .sidebar {
  width: var(--sidebar-w-collapsed);
}

html[data-sidebar="collapsed"] .sidebar .brand-text,
html[data-sidebar="collapsed"] .sidebar .nav-text,
html[data-sidebar="collapsed"] .sidebar .nav-label,
html[data-sidebar="collapsed"] .sidebar .user-card-text,
html[data-sidebar="collapsed"] .sidebar .badge,
html[data-sidebar="collapsed"] .sidebar .sign-out span {
  display: none;
}

/* The footer row itself stays. Hiding it took Sign out with it, and a
   collapsed rail with no way to sign out is a trap. */
html[data-sidebar="collapsed"] .sidebar .sidebar-footer-row {
  justify-content: center;
  padding-top: 12px;
}

html[data-sidebar="collapsed"] .sidebar .sidebar-brand,
html[data-sidebar="collapsed"] .sidebar .nav-item a,
html[data-sidebar="collapsed"] .sidebar .user-card {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}

html[data-sidebar="collapsed"] .sidebar .nav {
  padding-inline: 10px;
}

html[data-sidebar="collapsed"] .sidebar .nav-item a::after {
  content: attr(data-label);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--espresso-deep);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 8px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
  box-shadow: var(--shadow);
  z-index: 60;
}

html[data-sidebar="collapsed"] .sidebar .nav-item a:hover::after,
html[data-sidebar="collapsed"] .sidebar .nav-item a:focus-visible::after {
  opacity: 1;
}

/* ---------- Mobile drawer ---------- */

.scrim {
  position: fixed;
  inset: 0;
  background: rgba(28, 24, 23, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 39;
}

@media (max-width: 980px) {
  .shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(84vw, var(--sidebar-w));
    transform: translateX(-100%);
    transition: transform 0.24s ease;
    box-shadow: var(--shadow-lg);
  }

  /* The rail is a desktop idea; on a phone the drawer is either open or shut. */
  html[data-sidebar="collapsed"] .sidebar {
    width: min(84vw, var(--sidebar-w));
  }

  html[data-sidebar="collapsed"] .sidebar .brand-text,
  html[data-sidebar="collapsed"] .sidebar .nav-text,
  html[data-sidebar="collapsed"] .sidebar .nav-label,
  html[data-sidebar="collapsed"] .sidebar .user-card-text,
  html[data-sidebar="collapsed"] .sidebar .badge,
  html[data-sidebar="collapsed"] .sidebar .sign-out span {
    display: revert;
  }

  html[data-sidebar="collapsed"] .sidebar .sidebar-footer-row {
    justify-content: space-between;
  }

  html[data-sidebar="collapsed"] .sidebar .sidebar-brand,
  html[data-sidebar="collapsed"] .sidebar .nav-item a,
  html[data-sidebar="collapsed"] .sidebar .user-card {
    justify-content: flex-start;
    padding-left: 12px;
    padding-right: 12px;
  }

  html[data-sidebar="collapsed"] .sidebar .nav-item a::after {
    content: none;
  }

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

  body.nav-open .scrim {
    opacity: 1;
    pointer-events: auto;
  }

  body.nav-open {
    overflow: hidden;
  }
}

/* ============================ Workspace ============================ */

.workspace {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: 68px;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 28px;
  position: sticky;
  top: 0;
  z-index: 30;
}

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

.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  flex-shrink: 0;
}

.nav-toggle svg {
  width: 20px;
  height: 20px;
  transition: transform 0.22s ease;
}

/* Collapsed, the bars nudge toward the rail they will push back out. */
html[data-sidebar="collapsed"] .nav-toggle svg {
  transform: scaleX(0.82);
}

.nav-toggle[aria-expanded="false"] {
  border-color: var(--espresso-soft);
}

.breadcrumb {
  font-size: 14px;
  color: var(--ink-3);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.breadcrumb strong {
  color: var(--ink);
  font-weight: 600;
}

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

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(110, 155, 119, 0.15);
  color: var(--sage-deep);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
}

@media (max-width: 720px) {
  .status-pill,
  .breadcrumb {
    display: none;
  }
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--sage-deep);
}

/* The identity in the top right is a link to the profile, not decoration —
   it is where everyone reaches for their own account. */
.topbar-user {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
  border: 1px solid transparent;
  transition:
    background 0.15s ease,
    border-color 0.15s ease;
}

.topbar-user:hover {
  background: var(--surface);
  border-color: var(--line);
}

@media (max-width: 560px) {
  .topbar-user span {
    display: none;
  }
}

.content {
  flex: 1;
  padding: 32px 28px 56px;
  max-width: 1440px;
  width: 100%;
}

@media (max-width: 640px) {
  .topbar {
    padding: 10px 16px;
  }
  .content {
    padding: 24px 16px 40px;
  }
}

.page-title {
  font-size: 27px;
  margin: 0 0 4px;
}

.page-sub {
  color: var(--ink-2);
  margin: 0 0 28px;
  max-width: 62ch;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 36px 0 16px;
}

.section-head h2 {
  font-size: 20px;
  margin: 0;
}

/* ============================ Avatars ============================ */

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: linear-gradient(150deg, var(--gold) 0%, var(--gold-deep) 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
  overflow: hidden;
  text-transform: uppercase;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-sm {
  width: 32px;
  height: 32px;
  font-size: 12px;
}

.avatar-lg {
  width: 76px;
  height: 76px;
  font-size: 26px;
}

/* The gold rim matches the testimonial portraits on the marketing site. */
.avatar-ring {
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--gold);
}

/* ============================ Cards ============================ */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 24px;
}

.card + .card {
  margin-top: 20px;
}

.card-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.card-title {
  font-size: 17px;
  font-weight: 700;
  margin: 0;
}

.card-desc {
  font-size: 13px;
  color: var(--ink-2);
  margin: 0 0 20px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 18px;
  margin-bottom: 30px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 22px;
  position: relative;
  overflow: hidden;
}

/* A hairline of colour so the stat cards read as a set without four different
   backgrounds competing with the content. */
.stat-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--gold);
}

.stat-card.accent-sage::before {
  background: var(--sage-deep);
}
.stat-card.accent-mist::before {
  background: var(--mist-deep);
}
.stat-card.accent-coral::before {
  background: var(--coral-deep);
}

.stat-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--ink-3);
  margin: 0;
}

.stat-value {
  font-size: 34px;
  font-weight: 700;
  margin: 6px 0 2px;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.stat-sub {
  font-size: 13px;
  color: var(--ink-3);
  margin: 0;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-bottom: 30px;
}

@media (min-width: 1024px) {
  .grid-2 {
    grid-template-columns: 1fr 1fr;
  }
}

.sample-badge {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: rgba(216, 112, 92, 0.16);
  color: var(--coral-deep);
  border-radius: 999px;
  padding: 3px 8px;
}

/* ============================ Rows & pills ============================ */

.row-list {
  border-top: 1px solid var(--line-soft);
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
}

.row-title {
  font-weight: 600;
  margin: 0;
}

.row-sub {
  font-size: 13px;
  color: var(--ink-2);
  margin: 2px 0 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
  flex-shrink: 0;
}

.pill-plain::before {
  content: none;
}

.pill-gold {
  background: rgba(197, 160, 89, 0.18);
  color: var(--gold-deep);
}

.pill-sage {
  background: rgba(110, 155, 119, 0.16);
  color: var(--sage-deep);
}

.pill-mist {
  background: rgba(92, 124, 174, 0.14);
  color: var(--mist-deep);
}

.pill-coral {
  background: rgba(216, 112, 92, 0.14);
  color: var(--coral-deep);
}

.pill-sand {
  background: var(--sand);
  color: var(--ink-2);
}

.pill-espresso {
  background: rgba(43, 38, 37, 0.1);
  color: var(--espresso);
}

/* ============================ Tables ============================ */

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  /* Wide tables scroll inside their own card rather than pushing the page
     sideways on a phone. */
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  text-align: left;
}

thead tr {
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}

th {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  font-weight: 700;
  padding: 13px 22px;
  white-space: nowrap;
}

td {
  padding: 14px 22px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}

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

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

.cell-identity {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

/* The identity column carries a name, a reference and an avatar; left to
   shrink it wraps all three. The table already scrolls inside its own card. */
.cell-identity-text {
  min-width: 168px;
}

.th-actions,
.td-actions {
  text-align: right;
}

.empty-state {
  text-align: center;
  padding: 56px 24px;
  color: var(--ink-2);
}

.empty-state strong {
  display: block;
  color: var(--ink);
  margin-bottom: 4px;
}

/* ============================ Toolbar ============================ */

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.toolbar form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0;
}

.toolbar input,
.toolbar select {
  padding: 9px 13px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  font: inherit;
  font-size: 13.5px;
  color: var(--ink);
  outline: none;
}

.toolbar input:focus,
.toolbar select:focus {
  border-color: var(--gold-deep);
  box-shadow: 0 0 0 3px rgba(197, 160, 89, 0.2);
}

.toolbar input[type="search"] {
  min-width: 280px;
}

.spacer {
  flex: 1;
}

/* ============================ Tabs ============================ */

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
  overflow-x: auto;
}

.tab {
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-3);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

.tab:hover {
  color: var(--ink);
}

.tab.active {
  color: var(--ink);
  border-bottom-color: var(--gold);
}

/* ============================ Charts ============================ */

.bars {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 132px;
  margin-top: 24px;
}

.bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.bar {
  width: 100%;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, var(--gold) 0%, var(--gold-deep) 100%);
}

.bar-label {
  font-size: 10px;
  color: var(--ink-3);
}

.donut {
  width: 128px;
  height: 128px;
  border-radius: 999px;
  flex-shrink: 0;
  position: relative;
}

.donut-hole {
  position: absolute;
  inset: 13px;
  background: var(--surface);
  border-radius: 999px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.donut-hole strong {
  font-size: 20px;
}

.donut-hole span {
  font-size: 10px;
  color: var(--ink-3);
}

.legend {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
}

.legend li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  padding: 6px 0;
}

.legend-key {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-2);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.donut-row {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-top: 20px;
  flex-wrap: wrap;
}

/* ============================ Modal ============================ */

dialog.modal {
  border: none;
  border-radius: var(--radius-lg);
  padding: 0;
  width: calc(100% - 32px);
  max-width: 460px;
  box-shadow: var(--shadow-lg);
  color: var(--ink);
}

dialog.modal.modal-wide {
  max-width: 640px;
}

dialog.modal::backdrop {
  background: rgba(28, 24, 23, 0.5);
}

.modal-body {
  padding: 24px;
  max-height: 84vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.modal-header h2 {
  font-size: 19px;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--ink-3);
  line-height: 1;
  padding: 4px 8px;
  border-radius: 8px;
}

.modal-close:hover {
  color: var(--ink);
  background: rgba(43, 38, 37, 0.06);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
  flex-wrap: wrap;
}

/* ============================ Profile ============================ */

.profile-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  align-items: start;
}

@media (min-width: 1000px) {
  .profile-grid {
    grid-template-columns: 320px 1fr;
  }
}

.profile-head {
  display: flex;
  align-items: center;
  gap: 16px;
}

.profile-name {
  font-size: 19px;
  font-weight: 600;
  margin: 0;
}

/* Photo picker: the file input is hidden behind its own label, so the control
   is a real <input type=file> for assistive tech and keyboards while looking
   like the rest of the buttons. */
.photo-picker {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.photo-picker input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.photo-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.mono {
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 12px;
  color: var(--ink-2);
  word-break: break-all;
}

/* `break-all` is right for a UUID in a detail panel and wrong for a short
   reference in a table cell, where it split NOVA-2026-0001 across two lines. */
.mono.nowrap {
  word-break: normal;
}

/* ============================ Plans ============================ */

.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

.plan-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 22px;
  display: flex;
  flex-direction: column;
}

.plan-card.is-archived {
  opacity: 0.62;
}

.plan-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.plan-name {
  font-size: 20px;
  margin: 0;
}

.plan-price {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 30px;
  font-weight: 600;
  margin: 14px 0 0;
  font-variant-numeric: tabular-nums;
}

.plan-price small {
  font-family: inherit;
  font-size: 13px;
  font-weight: 400;
  color: var(--ink-3);
  display: block;
  margin-top: 2px;
}

.plan-features {
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
  flex: 1;
  font-size: 13.5px;
  color: var(--ink-2);
}

.plan-features li {
  display: flex;
  gap: 9px;
  padding: 4px 0;
}

.plan-features li::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--gold);
  flex-shrink: 0;
  margin-top: 7px;
}

.plan-foot {
  display: flex;
  gap: 8px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
}

/* ============================ Switch ============================ */

.switch-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line-soft);
}

.switch-row:last-child {
  border-bottom: none;
}

.switch {
  position: relative;
  flex-shrink: 0;
  width: 42px;
  height: 24px;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
  z-index: 1;
}

.switch-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--sand);
  transition: background 0.18s ease;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease;
}

.switch input:checked + .switch-track {
  background: var(--sage-deep);
}

.switch input:checked + .switch-track::after {
  transform: translateX(18px);
}

.switch input:focus-visible + .switch-track {
  outline: 2px solid var(--gold-deep);
  outline-offset: 2px;
}

/* ============================ Misc ============================ */

.muted {
  color: var(--ink-3);
}

.nowrap {
  white-space: nowrap;
}

.stack-8 > * + * {
  margin-top: 8px;
}

.stack-16 > * + * {
  margin-top: 16px;
}

.divider {
  height: 1px;
  background: var(--line);
  border: 0;
  margin: 24px 0;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* Mode tabs: one selected state across the whole tab, no visible radio.
   The radios are still the mechanism (keyboard, no JavaScript); they are
   moved off-screen rather than hidden, so they keep their focus ring. */
.mode-tabs { display: grid; gap: 8px; margin-top: 8px; }
@media (min-width: 720px) { .mode-tabs { grid-template-columns: repeat(3, 1fr); gap: 10px; } }

.mode-tab { position: relative; display: block; cursor: pointer; }
.mode-tab input {
  position: absolute; width: 1px; height: 1px; margin: 0;
  overflow: hidden; clip-path: inset(50%);
}
.mode-tab-body {
  display: block; height: 100%; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.mode-tab:hover .mode-tab-body { border-color: var(--gold); }
.mode-tab input:focus-visible + .mode-tab-body { outline: 3px solid var(--gold); outline-offset: 2px; }
.mode-tab input:checked + .mode-tab-body {
  border-color: var(--espresso); background: var(--espresso); box-shadow: 0 6px 18px -10px rgba(43, 38, 37, .6);
}
.mode-tab-title { display: block; font-size: 14px; font-weight: 600; color: var(--espresso); }
.mode-tab-hint { display: block; margin-top: 3px; font-size: 12px; line-height: 1.5; color: var(--muted, #6b625c); }
.mode-tab input:checked + .mode-tab-body .mode-tab-title { color: var(--cream); }
.mode-tab input:checked + .mode-tab-body .mode-tab-hint { color: rgba(251, 249, 245, .72); }
