/* ==========================================================================
   QuadraPay — Partner Portal
   Design system. Self-hosted, no external dependencies, no build step.

   Palette: near-black chrome, white content surfaces, brass accent.
   Type:    system font stack — renders natively on every platform, loads
            instantly, and keeps the Content-Security-Policy free of any
            external font host.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */

:root {
  /* Brand */
  --brass:        #B08D57;
  --brass-bright: #C9A46B;
  --brass-deep:   #8F7044;
  --brass-tint:   #FBF7F0;
  --ink:          #13203A;

  /* Chrome */
  --chrome:        #0B0D10;
  --chrome-raised: #14181E;
  --chrome-hover:  #1C222A;
  --chrome-line:   rgba(255, 255, 255, .08);
  --chrome-text:   #E6E9EE;
  --chrome-muted:  #8B94A3;

  /* Surfaces */
  --canvas:      #F4F5F7;
  --surface:     #FFFFFF;
  --surface-alt: #FAFBFC;
  --surface-sunk:#F0F2F5;

  /* Lines */
  --line:        #E3E6EB;
  --line-strong: #D3D8E0;

  /* Text */
  --text:        #0E1420;
  --text-muted:  #596274;
  --text-subtle: #8A93A3;
  --text-invert: #FFFFFF;

  /* Semantic */
  --ok:        #067647;  --ok-bg:     #ECFDF3;  --ok-line:     #ABEFC6;
  --warn:      #B54708;  --warn-bg:   #FFFAEB;  --warn-line:   #FEDF89;
  --danger:    #B42318;  --danger-bg: #FEF3F2;  --danger-line: #FECDCA;
  --info:      #175CD3;  --info-bg:   #EFF8FF;  --info-line:   #B2DDFF;
  --slate:     #475467;  --slate-bg:  #F2F4F7;  --slate-line:  #E4E7EC;

  /* Shape */
  --r-xs: 4px;  --r-sm: 6px;  --r: 8px;  --r-md: 10px;  --r-lg: 14px;  --r-xl: 18px;
  --r-pill: 999px;

  /* Elevation */
  --sh-xs: 0 1px 2px rgba(16, 24, 40, .05);
  --sh-sm: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
  --sh:    0 4px 8px -2px rgba(16, 24, 40, .08), 0 2px 4px -2px rgba(16, 24, 40, .04);
  --sh-lg: 0 12px 16px -4px rgba(16, 24, 40, .08), 0 4px 6px -2px rgba(16, 24, 40, .03);
  --sh-xl: 0 24px 48px -12px rgba(16, 24, 40, .18);

  /* Type */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
          Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
          "Liberation Mono", monospace;

  /* Metrics */
  --sidebar-w: 258px;
  --topbar-h:  64px;

  --ease: cubic-bezier(.4, 0, .2, 1);
}

/* --------------------------------------------------------------------------
   2. Reset & base
   -------------------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-variant-ligatures: none;
}

h1, h2, h3, h4, h5, h6 { margin: 0; font-weight: 600; letter-spacing: -.014em; line-height: 1.3; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }

p { margin: 0 0 12px; }
p:last-child { margin-bottom: 0; }

a { color: var(--brass-deep); text-decoration: none; }
a:hover { text-decoration: underline; }

img, svg { max-width: 100%; }
svg { display: block; }

code, pre, .mono { font-family: var(--mono); font-size: .92em; }

hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }

button { font: inherit; color: inherit; }

/* Numeric alignment in tables and stat blocks. */
.num, .stat-value, td.num, th.num { font-variant-numeric: tabular-nums; }

/* Visible only to screen readers. */
.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;
}

/* Consistent, always-visible keyboard focus. */
:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}
:focus:not(:focus-visible) { outline: none; }

.icon { width: 18px; height: 18px; flex: none; }
.icon-sm { width: 15px; height: 15px; flex: none; }
.icon-lg { width: 22px; height: 22px; flex: none; }

/* --------------------------------------------------------------------------
   3. App shell
   -------------------------------------------------------------------------- */

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

.app-main {
  flex: 1;
  min-width: 0;                 /* lets wide tables scroll instead of stretching */
  display: flex;
  flex-direction: column;
}

.content {
  flex: 1;
  padding: 26px 30px 56px;
  max-width: 1440px;
  width: 100%;
}
.content-narrow { max-width: 780px; }

/* --------------------------------------------------------------------------
   4. Sidebar
   -------------------------------------------------------------------------- */

.sidebar {
  width: var(--sidebar-w);
  flex: none;
  background: var(--chrome);
  color: var(--chrome-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid rgba(0, 0, 0, .4);
}

.sidebar-brand {
  padding: 20px 20px 18px;
  border-bottom: 1px solid var(--chrome-line);
  display: block;
}
.sidebar-brand:hover { text-decoration: none; }
.sidebar-brand .eyebrow {
  font-size: 10px;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--brass);
  font-weight: 600;
}
.sidebar-brand .name {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  letter-spacing: -.01em;
  margin-top: 3px;
}
.sidebar-logo {
  display: block;
  max-width: 174px;
  max-height: 42px;
  width: auto;
  height: auto;
  object-fit: contain;
  object-position: left center;
  margin: 0 0 9px;
}
.brand-preview {
  display: block;
  width: auto;
  max-width: 220px;
  max-height: 56px;
  object-fit: contain;
  object-position: left center;
  margin-top: 12px;
  padding: 8px;
  background: var(--chrome);
  border-radius: var(--r-sm);
}
.favicon-preview {
  display: block;
  width: 42px;
  height: 42px;
  object-fit: contain;
  margin-top: 12px;
  padding: 6px;
  background: var(--surface-sunk);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}
.agreement-document {
  white-space: normal;
  color: var(--text);
  line-height: 1.72;
  font-size: 14px;
}
.agreement-body-input { min-height: 230px; }
.file-callout {
  display: flex; align-items: center; gap: 12px;
  padding: 15px; border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface-alt);
}
.file-callout > .icon { color: var(--brass-deep); width: 28px; height: 28px; }
.file-callout > div { flex: 1; min-width: 0; }
.signature-pad {
  overflow: hidden; border: 1px solid var(--line-strong); border-radius: var(--r-md);
  background: #fff;
}
.signature-pad.has-error { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-bg); }
.signature-modes {
  display: flex; gap: 6px; padding: 8px 10px;
  border-bottom: 1px solid var(--line); background: var(--surface-alt);
}
.signature-mode {
  flex: 1; padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: #fff; color: var(--text-muted); font-size: 12.5px; font-weight: 600;
  cursor: pointer;
  transition: background .14s var(--ease), color .14s var(--ease), border-color .14s var(--ease);
}
.signature-mode:hover { color: var(--text); border-color: var(--line-strong); }
.signature-mode.is-active { background: var(--brass-deep); border-color: var(--brass-deep); color: #fff; }
.signature-pad canvas { display: block; width: 100%; height: 180px; cursor: crosshair; touch-action: none; }
.signature-pad canvas.is-typed { cursor: default; }
.signature-typed { padding: 12px 12px 4px; border-top: 1px solid var(--line); }
.signature-typed > .field-label { display: block; margin-bottom: 5px; }
.signature-fonts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; margin-top: 10px; }
.signature-font {
  min-width: 0; padding: 9px 6px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface-alt); color: var(--text); font-size: 17px; line-height: 1.25;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer;
  transition: border-color .14s var(--ease), background .14s var(--ease);
}
.signature-font:hover { border-color: var(--line-strong); background: #fff; }
.signature-font.is-active { border-color: var(--brass-deep); background: #fff; box-shadow: inset 0 0 0 1px var(--brass-deep); }
.signature-adopt { margin-top: 12px; }
.signature-pad-actions {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 7px 10px; border-top: 1px solid var(--line); background: var(--surface-alt);
  color: var(--text-muted); font-size: 12px;
}
@media (max-width: 640px) { .signature-fonts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.signature-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.signature-record { min-width: 0; padding: 13px; background: var(--surface-alt); border: 1px solid var(--line); border-radius: var(--r-md); }
.signature-record-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.signature-name { margin-top: 7px; font-weight: 600; }
.signature-image { display: block; width: 100%; height: 82px; object-fit: contain; object-position: left center; margin: 8px 0; background: #fff; border-bottom: 1px solid var(--line); }
.agreement-timeline { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.agreement-timeline li { display: grid; grid-template-columns: 12px minmax(0, 1fr); gap: 9px; }
.agreement-timeline-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brass); margin-top: 6px; }
@media (max-width: 640px) { .signature-grid { grid-template-columns: 1fr; } .file-callout { align-items: flex-start; flex-wrap: wrap; } .file-callout .btn { margin-left: 40px; } }

/* Optional signing evidence: live camera, still preview and device location. */
.signing-evidence {
  padding: 14px;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.evidence-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.evidence-file-row { display: block; margin-bottom: 10px; }
.evidence-file-row .field-hint { display: block; margin-bottom: 5px; }
.evidence-file { max-width: 100%; padding: 7px 10px; }

/* The camera feed and the captured still share one frame so the panel does not
   jump in height as the signer moves between them. */
.evidence-video,
.evidence-preview {
  display: block;
  width: 100%;
  max-width: 380px;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  margin-bottom: 10px;
  background: var(--surface-sunk);
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
}
.evidence-status { margin: 0; }
.evidence-image {
  display: block; width: 100%; max-width: 320px;
  border-radius: var(--r); border: 1px solid var(--line); margin-bottom: 10px;
}
.btn-danger-ghost { color: var(--danger); }
.btn-danger-ghost:hover { background: var(--danger-bg); color: var(--danger); }

@supports not (aspect-ratio: 4 / 3) {
  .evidence-video, .evidence-preview { height: 240px; }
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px 20px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.16) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 8px; }
.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.14); border-radius: var(--r-pill);
}

.nav-group { margin-bottom: 18px; }
.nav-group-label {
  font-size: 10px;
  letter-spacing: .11em;
  text-transform: uppercase;
  color: #6B7484;
  font-weight: 600;
  padding: 0 10px 7px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 11px;
  border-radius: var(--r-sm);
  color: #B7BFCC;
  font-size: 13.5px;
  font-weight: 500;
  position: relative;
  transition: background .14s var(--ease), color .14s var(--ease);
}
.nav-item:hover {
  background: var(--chrome-hover);
  color: #fff;
  text-decoration: none;
}
.nav-item .icon { opacity: .72; transition: opacity .14s var(--ease); }
.nav-item:hover .icon { opacity: 1; }

.nav-item.is-active {
  background: var(--chrome-raised);
  color: #fff;
  font-weight: 600;
}
.nav-item.is-active .icon { opacity: 1; color: var(--brass-bright); }
.nav-item.is-active::before {
  content: "";
  position: absolute;
  left: -12px; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 20px;
  background: var(--brass);
  border-radius: 0 var(--r-xs) var(--r-xs) 0;
}

.nav-count {
  margin-left: auto;
  background: var(--brass);
  color: #1A1206;
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: var(--r-pill);
  line-height: 1.6;
}

.sidebar-foot {
  border-top: 1px solid var(--chrome-line);
  padding: 12px;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  margin-bottom: 4px;
}
.sidebar-user .avatar { background: var(--brass); color: #1A1206; }
.sidebar-user-meta { min-width: 0; }
.sidebar-user-name {
  font-size: 13px; font-weight: 600; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: 11px; color: var(--chrome-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.sidebar-version {
  font-size: 10.5px;
  color: #5C6473;
  padding: 8px 10px 2px;
  letter-spacing: .02em;
}

/* Mobile drawer */
.sidebar-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(11, 13, 16, .55);
  z-index: 60;
  backdrop-filter: blur(2px);
}
.sidebar-backdrop.is-open { display: block; }

/* --------------------------------------------------------------------------
   5. Topbar
   -------------------------------------------------------------------------- */

.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 30px;
  position: sticky;
  top: 0;
  z-index: 40;
}

.topbar-toggle {
  display: none;
  background: none; border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 7px; cursor: pointer; color: var(--text);
}

.topbar-titles { min-width: 0; }
.breadcrumb {
  font-size: 11.5px;
  color: var(--text-subtle);
  display: flex; align-items: center; gap: 5px;
  margin-bottom: 1px;
}
.breadcrumb a { color: var(--text-subtle); }
.breadcrumb a:hover { color: var(--text-muted); }
.breadcrumb .sep { opacity: .5; }
.topbar-title {
  font-size: 17px; font-weight: 600; letter-spacing: -.015em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 9px; }

/* --------------------------------------------------------------------------
   6. Page header
   -------------------------------------------------------------------------- */

.page-head {
  display: flex; align-items: flex-start; gap: 16px;
  flex-wrap: wrap; margin-bottom: 22px;
}
.page-head-text { flex: 1; min-width: 260px; }
.page-head h1 { font-size: 21px; }
.page-head .sub { color: var(--text-muted); font-size: 13.5px; margin-top: 3px; }
.page-head-actions { display: flex; gap: 9px; flex-wrap: wrap; }

/* --------------------------------------------------------------------------
   7. Cards
   -------------------------------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-xs);
}
.card + .card { margin-top: 18px; }

/* Destructive zone — visually separated so it is never mistaken for the rest. */
.card-danger { border-color: var(--danger-line); }
.card-danger .card-head { border-bottom-color: var(--danger-line); background: var(--danger-bg); border-radius: var(--r-lg) var(--r-lg) 0 0; }
.card-danger .card-head h2 { color: var(--danger); }

.card-head {
  padding: 15px 20px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.card-head h2 { font-size: 14.5px; }
.card-head .sub { font-size: 12.5px; color: var(--text-muted); margin-top: 1px; }
.card-head-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.card-body { padding: 20px; }
.card-body-tight { padding: 14px 20px; }
.card-foot {
  padding: 13px 20px;
  border-top: 1px solid var(--line);
  background: var(--surface-alt);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   8. Stat tiles
   -------------------------------------------------------------------------- */

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

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 17px 18px;
  box-shadow: var(--sh-xs);
  position: relative;
  overflow: hidden;
}
.stat::after {
  content: "";
  position: absolute; inset: 0 auto 0 0;
  width: 3px; background: var(--line-strong);
}
.stat-accent-brass::after  { background: var(--brass); }
.stat-accent-ok::after     { background: var(--ok); }
.stat-accent-warn::after   { background: var(--warn); }
.stat-accent-info::after   { background: var(--info); }
.stat-accent-danger::after { background: var(--danger); }

.stat-top { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.stat-label {
  font-size: 11.5px; font-weight: 600; letter-spacing: .05em;
  text-transform: uppercase; color: var(--text-subtle);
}
.stat-icon { margin-left: auto; color: var(--text-subtle); opacity: .7; }
.stat-value { font-size: 27px; font-weight: 600; letter-spacing: -.024em; line-height: 1.12; }
.stat-foot { margin-top: 7px; font-size: 12.5px; color: var(--text-muted); }
.stat-foot a { font-weight: 500; }
.stat-link { display: block; text-decoration: none; color: inherit; transition: box-shadow .15s, transform .15s; }
.stat-link:hover { box-shadow: var(--sh-sm, 0 4px 14px rgba(0,0,0,.08)); transform: translateY(-1px); }

/* --------------------------------------------------------------------------
   9. Tables
   -------------------------------------------------------------------------- */

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.card > .table-wrap:last-child { border-radius: 0 0 var(--r-lg) var(--r-lg); }

.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

.table thead th {
  background: var(--surface-alt);
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .055em;
  text-transform: uppercase;
  color: var(--text-subtle);
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}
.table thead th a { color: inherit; display: inline-flex; align-items: center; gap: 4px; }
.table thead th a:hover { color: var(--text); text-decoration: none; }

.table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s var(--ease); }
.table tbody tr:hover { background: var(--surface-alt); }

.table .t-strong { font-weight: 600; color: var(--text); }
.table .t-muted  { color: var(--text-muted); font-size: 12.5px; }
.table .t-right  { text-align: right; }
.table .t-nowrap { white-space: nowrap; }
.table .t-actions { text-align: right; white-space: nowrap; }
.table .t-actions .btn + .btn,
.table .t-actions form + form { margin-left: 5px; }
.table td form { display: inline-block; margin: 0; }

/* Stacked name + secondary line, common in these tables. */
.cell-stack .cell-main { font-weight: 600; }
.cell-stack .cell-sub  { font-size: 12px; color: var(--text-muted); margin-top: 1px; }

/* --------------------------------------------------------------------------
   10. Buttons
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 14px;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.3;
  border-radius: var(--r);
  border: 1px solid transparent;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  transition: background .14s var(--ease), border-color .14s var(--ease),
              color .14s var(--ease), box-shadow .14s var(--ease), transform .06s var(--ease);
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(.5px); }
.btn:disabled, .btn.is-disabled { opacity: .55; pointer-events: none; }
.btn .icon { width: 16px; height: 16px; }

.btn-primary {
  background: var(--brass); border-color: var(--brass);
  color: #1A1206; font-weight: 600; box-shadow: var(--sh-xs);
}
.btn-primary:hover { background: var(--brass-bright); border-color: var(--brass-bright); }

.btn-dark {
  background: var(--chrome); border-color: var(--chrome);
  color: #fff; box-shadow: var(--sh-xs);
}
.btn-dark:hover { background: #1C222A; border-color: #1C222A; }

.btn-outline { background: var(--surface); border-color: var(--line-strong); color: var(--text); box-shadow: var(--sh-xs); }
.btn-outline:hover { background: var(--surface-alt); border-color: var(--text-subtle); }

.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-sunk); color: var(--text); }

.btn-danger { background: var(--danger-bg); border-color: var(--danger-line); color: var(--danger); }
.btn-danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }

.btn-success { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok); }
.btn-success:hover { background: var(--ok); border-color: var(--ok); color: #fff; }

.btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: var(--r-sm); gap: 5px; }
.btn-sm .icon { width: 14px; height: 14px; }
.btn-lg { padding: 11px 20px; font-size: 15px; border-radius: var(--r-md); }

.btn-icon { padding: 7px; }
.btn-icon.btn-sm { padding: 5px; }

.btn-block { width: 100%; }

.btn-row { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }

/* --------------------------------------------------------------------------
   11. Badges & pills
   -------------------------------------------------------------------------- */

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px;
  font-size: 11.5px; font-weight: 600; line-height: 1.7;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge-slate { background: var(--slate-bg); color: var(--slate); border-color: var(--slate-line); }
.badge-green { background: var(--ok-bg);    color: var(--ok);    border-color: var(--ok-line); }
.badge-amber { background: var(--warn-bg);  color: var(--warn);  border-color: var(--warn-line); }
.badge-red   { background: var(--danger-bg);color: var(--danger);border-color: var(--danger-line); }
.badge-blue  { background: var(--info-bg);  color: var(--info);  border-color: var(--info-line); }
.badge-brass { background: var(--brass-tint); color: var(--brass-deep); border-color: #EBDCC2; }

.badge-dot::before {
  content: ""; width: 5px; height: 5px; border-radius: 50%;
  background: currentColor; flex: none;
}

.avatar {
  width: 34px; height: 34px; flex: none;
  border-radius: 50%;
  background: var(--slate-bg);
  color: var(--slate);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; letter-spacing: .01em;
}
.avatar-sm { width: 27px; height: 27px; font-size: 10.5px; }
.avatar-lg { width: 48px; height: 48px; font-size: 16px; }

.code-chip {
  display: inline-block;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  background: var(--surface-sunk);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 2px 8px;
  border-radius: var(--r-sm);
  letter-spacing: .04em;
}

/* --------------------------------------------------------------------------
   12. Forms
   -------------------------------------------------------------------------- */

.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }

.field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}
.field-req { color: var(--danger); font-weight: 700; }

.input, .select, .textarea {
  width: 100%;
  padding: 9px 12px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  box-shadow: var(--sh-xs);
  transition: border-color .14s var(--ease), box-shadow .14s var(--ease);
  appearance: none;
}
.input::placeholder, .textarea::placeholder { color: var(--text-subtle); }

.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--brass);
  box-shadow: 0 0 0 3px rgba(176, 141, 87, .16);
}
.input:disabled, .select:disabled, .textarea:disabled {
  background: var(--surface-sunk); color: var(--text-muted); cursor: not-allowed;
}

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

.select {
  /* Chevron drawn as an inline data URI so no external asset is needed. */
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23596274' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 34px;
}

.field-invalid .input,
.field-invalid .select,
.field-invalid .textarea { border-color: var(--danger); }
.field-invalid .input:focus,
.field-invalid .select:focus,
.field-invalid .textarea:focus { box-shadow: 0 0 0 3px rgba(180, 35, 24, .14); }

.field-hint  { font-size: 12.5px; color: var(--text-muted); margin: 6px 0 0; }
.field-error { font-size: 12.5px; color: var(--danger); margin: 6px 0 0; font-weight: 500; }

.checkbox-row {
  display: flex; align-items: flex-start; gap: 9px;
  font-size: 13.5px; cursor: pointer; line-height: 1.5;
}
.checkbox-row input[type="checkbox"],
.checkbox-row input[type="radio"] {
  width: 16px; height: 16px; margin: 2px 0 0; flex: none;
  accent-color: var(--brass); cursor: pointer;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0 16px;
}

/* Inline row of controls (the lead pipeline's status + commission + save).
   It wraps rather than crushing its children, so the same markup stays usable
   from a wide table cell down to a phone. */
.input-group { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.input-group .input { flex: 1; }
.input-group .select { flex: 1 1 130px; min-width: 118px; }
.input-group .btn { flex: 0 0 auto; }

.input-w-xs { max-width: 90px; }
.input-w-sm { max-width: 150px; }
.input-w-md { max-width: 260px; }

/* Search box with a leading icon. */
.search-box { position: relative; flex: 1; min-width: 180px; max-width: 340px; }
.search-box .icon {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  color: var(--text-subtle); pointer-events: none; width: 16px; height: 16px;
}
.search-box .input { padding-left: 34px; }

/* Password field with a reveal toggle. */
.password-wrap { position: relative; }
.password-wrap .input { padding-right: 42px; }
.password-toggle {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  background: none; border: 0; padding: 7px; cursor: pointer;
  color: var(--text-subtle); border-radius: var(--r-sm);
}
.password-toggle:hover { color: var(--text); background: var(--surface-sunk); }

/* --------------------------------------------------------------------------
   13. Filter bar
   -------------------------------------------------------------------------- */

.filter-bar {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  margin-bottom: 16px;
}

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  font-size: 13px; font-weight: 500;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text-muted);
  box-shadow: var(--sh-xs);
  transition: all .14s var(--ease);
}
.chip:hover { border-color: var(--text-subtle); color: var(--text); text-decoration: none; }
.chip.is-active {
  background: var(--chrome); border-color: var(--chrome);
  color: #fff; font-weight: 600;
}
.chip-count {
  font-size: 11px; font-weight: 700;
  background: var(--surface-sunk); color: var(--text-muted);
  padding: 0 6px; border-radius: var(--r-pill);
}
.chip.is-active .chip-count { background: rgba(255,255,255,.16); color: #fff; }

/* --------------------------------------------------------------------------
   14. Alerts & toasts
   -------------------------------------------------------------------------- */

.alert {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 13px 16px;
  border-radius: var(--r-md);
  border: 1px solid;
  font-size: 13.5px;
  margin-bottom: 18px;
}
.alert .icon { margin-top: 1px; }
.alert-title { font-weight: 600; margin-bottom: 2px; }
.alert-ok     { background: var(--ok-bg);     border-color: var(--ok-line);     color: #054F31; }
.alert-error  { background: var(--danger-bg); border-color: var(--danger-line); color: #7A271A; }
.alert-warn   { background: var(--warn-bg);   border-color: var(--warn-line);   color: #7A2E0E; }
.alert-info   { background: var(--info-bg);   border-color: var(--info-line);   color: #194185; }
.alert-ok .icon    { color: var(--ok); }
.alert-error .icon { color: var(--danger); }
.alert-warn .icon  { color: var(--warn); }
.alert-info .icon  { color: var(--info); }

.toast-stack {
  position: fixed; top: 18px; right: 18px; z-index: 200;
  display: flex; flex-direction: column; gap: 10px;
  max-width: min(390px, calc(100vw - 36px));
}
.toast {
  display: flex; gap: 11px; align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--slate);
  border-radius: var(--r-md);
  box-shadow: var(--sh-xl);
  padding: 13px 14px;
  font-size: 13.5px;
  animation: toast-in .26s var(--ease);
}
.toast-ok    { border-left-color: var(--ok); }
.toast-ok .icon { color: var(--ok); }
.toast-error { border-left-color: var(--danger); }
.toast-error .icon { color: var(--danger); }
.toast-body { flex: 1; min-width: 0; }
.toast-close {
  background: none; border: 0; cursor: pointer; padding: 2px;
  color: var(--text-subtle); border-radius: var(--r-xs); flex: none;
}
.toast-close:hover { color: var(--text); }
.toast.is-leaving { animation: toast-out .2s var(--ease) forwards; }

@keyframes toast-in  { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to   { opacity: 0; transform: translateX(18px); } }

/* --------------------------------------------------------------------------
   15. Modal
   -------------------------------------------------------------------------- */

.modal-backdrop {
  position: fixed; inset: 0; z-index: 210;
  background: rgba(11, 13, 16, .58);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: fade-in .16s var(--ease);
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-xl);
  width: 100%;
  max-width: 460px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  animation: modal-in .2s var(--ease);
}
.modal-lg { max-width: 680px; }
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(.985); } to { opacity: 1; transform: none; } }

.modal-head { padding: 20px 22px 0; }
.modal-head h2 { font-size: 16.5px; }
.modal-icon {
  width: 42px; height: 42px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 13px;
}
.modal-icon-danger { background: var(--danger-bg); color: var(--danger); }
.modal-icon-warn   { background: var(--warn-bg);   color: var(--warn); }
.modal-icon-info   { background: var(--info-bg);   color: var(--info); }
.modal-body { padding: 9px 22px 20px; color: var(--text-muted); font-size: 13.5px; }
.modal-foot {
  padding: 15px 22px;
  border-top: 1px solid var(--line);
  background: var(--surface-alt);
  border-radius: 0 0 var(--r-xl) var(--r-xl);
  display: flex; gap: 9px; justify-content: flex-end; flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   16. Empty states
   -------------------------------------------------------------------------- */

.empty { padding: 52px 24px; text-align: center; }
.empty-icon {
  width: 46px; height: 46px; margin: 0 auto 14px;
  border-radius: 50%;
  background: var(--surface-sunk);
  color: var(--text-subtle);
  display: flex; align-items: center; justify-content: center;
}
.empty h3 { font-size: 15px; margin-bottom: 5px; }
.empty p { color: var(--text-muted); max-width: 380px; margin: 0 auto 16px; font-size: 13.5px; }

/* --------------------------------------------------------------------------
   17. Pagination
   -------------------------------------------------------------------------- */

.pagination {
  display: flex; align-items: center; gap: 5px; flex-wrap: wrap;
}
.pagination .page-info { color: var(--text-muted); font-size: 12.5px; margin-right: auto; }
.page-link {
  min-width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 9px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  font-size: 13px; font-weight: 500;
  color: var(--text-muted);
  box-shadow: var(--sh-xs);
}
.page-link:hover { background: var(--surface-alt); color: var(--text); text-decoration: none; }
.page-link.is-active {
  background: var(--chrome); border-color: var(--chrome); color: #fff; font-weight: 600;
}
.page-link.is-disabled { opacity: .45; pointer-events: none; }
.page-gap { padding: 0 3px; color: var(--text-subtle); }

/* --------------------------------------------------------------------------
   18. Tabs
   -------------------------------------------------------------------------- */

.tabs {
  display: flex; gap: 2px; flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
}
.tab {
  padding: 9px 14px;
  font-size: 13.5px; font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  display: inline-flex; align-items: center; gap: 7px;
}
.tab:hover { color: var(--text); text-decoration: none; }
.tab.is-active { color: var(--brass-deep); border-bottom-color: var(--brass); font-weight: 600; }

/* --------------------------------------------------------------------------
   19. Description lists
   -------------------------------------------------------------------------- */

.dl { display: grid; grid-template-columns: minmax(120px, 190px) 1fr; }
.dl > dt {
  padding: 10px 16px 10px 0;
  font-size: 12.5px; font-weight: 600; color: var(--text-subtle);
  border-bottom: 1px solid var(--line);
}
.dl > dd {
  padding: 10px 0;
  margin: 0;
  font-size: 13.5px;
  border-bottom: 1px solid var(--line);
  word-break: break-word;
}
.dl > dt:last-of-type, .dl > dd:last-of-type { border-bottom: 0; }

/* --------------------------------------------------------------------------
   20. Charts (inline SVG rendered server-side)
   -------------------------------------------------------------------------- */

.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart-grid    { stroke: var(--line); stroke-width: 1; }
.chart-axis    { fill: var(--text-subtle); font-size: 10.5px; font-family: var(--font); }
.chart-bar     { fill: var(--brass); transition: fill .14s var(--ease); }
.chart-bar:hover { fill: var(--brass-bright); }
.chart-line    { fill: none; stroke: var(--brass); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-area    { fill: rgba(176, 141, 87, .11); }
.chart-dot     { fill: var(--surface); stroke: var(--brass); stroke-width: 2; }

.legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 14px; }
.legend-item { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-muted); }
.legend-swatch { width: 9px; height: 9px; border-radius: 2px; flex: none; }

/* Horizontal proportion bars (status breakdowns). */
.meter { display: flex; flex-direction: column; gap: 11px; }
.meter-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; }
.meter-label { font-size: 13px; display: flex; align-items: center; gap: 8px; }
.meter-value { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.meter-track {
  grid-column: 1 / -1;
  height: 6px; background: var(--surface-sunk);
  border-radius: var(--r-pill); overflow: hidden;
}
.meter-fill { height: 100%; border-radius: var(--r-pill); transition: width .4s var(--ease); }

/* --------------------------------------------------------------------------
   21. Auth pages (sign-in, reset, setup)
   -------------------------------------------------------------------------- */

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

.auth-brand {
  width: 44%;
  background: var(--chrome);
  color: #fff;
  padding: 44px 46px;
  display: flex; flex-direction: column;
  position: relative;
  overflow: hidden;
}
/* Soft brass wash so the dark panel isn't flat. */
.auth-brand::before {
  content: "";
  position: absolute;
  top: -18%; right: -22%;
  width: 460px; height: 460px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(176,141,87,.20) 0%, rgba(176,141,87,0) 68%);
  pointer-events: none;
}
.auth-brand-mark { position: relative; }
.auth-brand-mark .eyebrow {
  font-size: 11px; letter-spacing: .15em; text-transform: uppercase;
  color: var(--brass); font-weight: 600;
}
.auth-brand-mark .name { font-size: 20px; font-weight: 600; margin-top: 4px; }

.auth-brand-body { margin-top: auto; position: relative; }
.auth-brand-body h2 {
  font-size: 27px; font-weight: 600; letter-spacing: -.022em;
  line-height: 1.28; margin-bottom: 13px;
}
.auth-brand-body p { color: #9AA3B2; font-size: 14.5px; max-width: 36ch; }

.auth-points { list-style: none; padding: 0; margin: 26px 0 0; display: grid; gap: 11px; }
.auth-points li {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 13.5px; color: #C2C9D4;
}
.auth-points .icon { color: var(--brass); margin-top: 2px; width: 16px; height: 16px; }

.auth-brand-foot {
  margin-top: 30px; padding-top: 18px;
  border-top: 1px solid var(--chrome-line);
  font-size: 11.5px; color: #6B7484; position: relative;
}

.auth-panel {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  padding: 40px 24px;
  background: var(--surface);
}
.auth-form { width: 100%; max-width: 372px; }
.auth-form h1 { font-size: 24px; letter-spacing: -.02em; }
.auth-form .lede { color: var(--text-muted); margin: 6px 0 26px; font-size: 14px; }
.auth-form .btn-lg { margin-top: 4px; }
.auth-alt {
  margin-top: 24px; padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 13.5px; color: var(--text-muted); text-align: center;
}
.auth-meta {
  margin-top: 18px; font-size: 12px; color: var(--text-subtle);
  display: flex; align-items: center; justify-content: center; gap: 7px;
}

/* --------------------------------------------------------------------------
   22. Portal chooser (index.php)
   -------------------------------------------------------------------------- */

.chooser {
  min-height: 100vh;
  background: var(--chrome);
  color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 44px 22px;
  position: relative; overflow: hidden;
}
.chooser::before {
  content: "";
  position: absolute; top: -280px; left: 50%; transform: translateX(-50%);
  width: 900px; height: 900px; border-radius: 50%;
  background: radial-gradient(circle, rgba(176,141,87,.15) 0%, rgba(176,141,87,0) 62%);
  pointer-events: none;
}
.chooser-inner { position: relative; width: 100%; max-width: 720px; }
.chooser-head { text-align: center; margin-bottom: 38px; }
.chooser-head .eyebrow {
  font-size: 11.5px; letter-spacing: .17em; text-transform: uppercase;
  color: var(--brass); font-weight: 600;
}
.chooser-head h1 {
  font-size: 30px; font-weight: 600; letter-spacing: -.024em; margin-top: 9px;
}
.chooser-head p { color: #99A2B1; margin-top: 10px; font-size: 15px; }

.chooser-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(268px, 1fr)); gap: 16px; }

.chooser-card {
  background: var(--chrome-raised);
  border: 1px solid var(--chrome-line);
  border-radius: var(--r-xl);
  padding: 26px 24px;
  display: block;
  transition: border-color .18s var(--ease), transform .18s var(--ease), background .18s var(--ease);
}
.chooser-card:hover {
  border-color: rgba(176, 141, 87, .5);
  background: #191E26;
  transform: translateY(-2px);
  text-decoration: none;
}
.chooser-card .c-icon {
  width: 42px; height: 42px; border-radius: var(--r-md);
  background: rgba(176, 141, 87, .13);
  color: var(--brass);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
}
.chooser-card h2 { font-size: 17px; color: #fff; }
.chooser-card p { color: #8B94A3; font-size: 13.5px; margin: 6px 0 0; }
.chooser-card .c-go {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 16px; font-size: 13.5px; font-weight: 600; color: var(--brass);
}
.chooser-card:hover .c-go .icon { transform: translateX(3px); }
.chooser-card .c-go .icon { transition: transform .18s var(--ease); width: 15px; height: 15px; }

.chooser-foot { text-align: center; margin-top: 34px; font-size: 12.5px; color: #667084; }
.chooser-foot a { color: #8B94A3; }

/* --------------------------------------------------------------------------
   23. Public referral form
   -------------------------------------------------------------------------- */

.public-page {
  min-height: 100vh;
  background: var(--canvas);
  display: flex; flex-direction: column; align-items: center;
  padding: 44px 20px 60px;
}
.public-shell { width: 100%; max-width: 580px; }

.public-head { text-align: center; margin-bottom: 26px; }
.public-head .eyebrow {
  font-size: 11px; letter-spacing: .15em; text-transform: uppercase;
  color: var(--brass-deep); font-weight: 700;
}
.public-head h1 { font-size: 25px; letter-spacing: -.02em; margin-top: 7px; }
.public-head p { color: var(--text-muted); margin-top: 9px; font-size: 14.5px; }

.public-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-lg);
  padding: 28px;
}
.public-referrer {
  display: flex; align-items: center; gap: 11px;
  padding: 12px 14px;
  background: var(--brass-tint);
  border: 1px solid #EBDCC2;
  border-radius: var(--r-md);
  margin-bottom: 22px;
  font-size: 13px;
}
.public-referrer .avatar { background: var(--brass); color: #1A1206; }
.public-foot {
  text-align: center; margin-top: 22px;
  font-size: 12px; color: var(--text-subtle);
}

.public-success { text-align: center; padding: 12px 0 6px; }
.public-success .tick {
  width: 56px; height: 56px; margin: 0 auto 18px;
  border-radius: 50%;
  background: var(--ok-bg); color: var(--ok);
  display: flex; align-items: center; justify-content: center;
}
.public-success .tick .icon { width: 28px; height: 28px; stroke-width: 2.4; }
.public-success h2 { font-size: 19px; margin-bottom: 8px; }
.public-success p { color: var(--text-muted); }

/* Honeypot — hidden from people, visible to naive bots. */
.hp-field {
  position: absolute !important;
  left: -9999px !important;
  width: 1px; height: 1px; overflow: hidden;
}

/* --------------------------------------------------------------------------
   24. Form builder
   -------------------------------------------------------------------------- */

.fb-list { display: flex; flex-direction: column; }
.fb-item {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.fb-item:last-child { border-bottom: 0; }
.fb-item.is-inactive { background: var(--surface-alt); }
.fb-item.is-inactive .fb-label { color: var(--text-subtle); }
.fb-handle { color: var(--text-subtle); display: flex; flex-direction: column; gap: 1px; }
.fb-main { flex: 1; min-width: 0; }
.fb-label { font-weight: 600; font-size: 13.5px; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.fb-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.fb-actions { display: flex; gap: 5px; align-items: center; }
.fb-order { display: flex; flex-direction: column; gap: 2px; }
.fb-order button {
  background: none; border: 1px solid var(--line); border-radius: var(--r-xs);
  cursor: pointer; padding: 1px 4px; color: var(--text-subtle); line-height: 1;
  font-size: 10px;
}
.fb-order button:hover { background: var(--surface-sunk); color: var(--text); }
.fb-order button:disabled { opacity: .3; cursor: default; }

/* --------------------------------------------------------------------------
   25. Updater
   -------------------------------------------------------------------------- */

.dropzone {
  border: 2px dashed var(--line-strong);
  border-radius: var(--r-lg);
  padding: 34px 24px;
  text-align: center;
  background: var(--surface-alt);
  transition: border-color .16s var(--ease), background .16s var(--ease);
  cursor: pointer;
  display: block;
}
.dropzone:hover, .dropzone.is-over {
  border-color: var(--brass);
  background: var(--brass-tint);
}
.dropzone .dz-icon {
  width: 46px; height: 46px; margin: 0 auto 13px;
  border-radius: 50%;
  background: var(--surface); border: 1px solid var(--line);
  color: var(--brass-deep);
  display: flex; align-items: center; justify-content: center;
}
.dropzone .dz-main { font-weight: 600; font-size: 14px; }
.dropzone .dz-sub { font-size: 12.5px; color: var(--text-muted); margin-top: 4px; }
.dropzone .dz-file {
  margin-top: 12px; font-size: 13px; font-weight: 600; color: var(--brass-deep);
  display: none;
}
.dropzone.has-file .dz-file { display: block; }

.version-pill {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--mono); font-size: 13px; font-weight: 600;
  background: var(--chrome); color: #fff;
  padding: 4px 11px; border-radius: var(--r-pill);
}

.step-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.step-list li { display: flex; gap: 11px; align-items: flex-start; font-size: 13.5px; }
.step-num {
  width: 22px; height: 22px; flex: none; border-radius: 50%;
  background: var(--surface-sunk); color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
}

/* --------------------------------------------------------------------------
   26. Utilities (a small curated set — not a utility framework)
   -------------------------------------------------------------------------- */

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; align-items: start; }

.stack   { display: flex; flex-direction: column; gap: 18px; }
.stack-sm{ display: flex; flex-direction: column; gap: 9px; }
.row     { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-tight { display: flex; align-items: center; gap: 6px; }
.spacer  { margin-left: auto; }

.muted   { color: var(--text-muted); }
.subtle  { color: var(--text-subtle); }
.small   { font-size: 12.5px; }
.tiny    { font-size: 11.5px; }
.strong  { font-weight: 600; }
.center  { text-align: center; }
.right   { text-align: right; }
.danger-text { color: var(--danger); }
.ok-text     { color: var(--ok); }
.break-all { word-break: break-all; }

.mt-0 { margin-top: 0; }    .mt-1 { margin-top: 6px; }
.mt-2 { margin-top: 12px; } .mt-3 { margin-top: 18px; } .mt-4 { margin-top: 26px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 6px; }
.mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 18px; } .mb-4 { margin-bottom: 26px; }

.hide { display: none !important; }

/* Copy-to-clipboard row. */
.copy-row {
  display: flex; align-items: center; gap: 9px;
  background: var(--surface-sunk);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 8px 8px 8px 13px;
}
.copy-row code {
  flex: 1; min-width: 0;
  font-size: 13px; color: var(--ink); font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* --------------------------------------------------------------------------
   27. Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1024px) {
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 70;
    transform: translateX(-100%);
    transition: transform .24s var(--ease);
    height: 100dvh;
  }
  .sidebar.is-open { transform: none; box-shadow: var(--sh-xl); }
  .topbar-toggle { display: inline-flex; }
  .topbar { padding: 0 18px; }
  .content { padding: 20px 18px 48px; }
  .auth-brand { display: none; }
}

@media (max-width: 640px) {
  h1, .page-head h1 { font-size: 19px; }
  .stat-value { font-size: 23px; }
  .card-head, .card-body { padding: 15px; }
  .card-foot { padding: 12px 15px; }
  .table thead th, .table tbody td { padding: 10px 12px; }
  .public-card { padding: 20px; }
  .chooser-head h1 { font-size: 24px; }
  .dl { grid-template-columns: 1fr; }
  .dl > dt { border-bottom: 0; padding-bottom: 0; }
  .dl > dd { padding-top: 2px; }
  .toast-stack { left: 12px; right: 12px; top: 12px; max-width: none; }
  .modal-foot { flex-direction: column-reverse; }
  .modal-foot .btn { width: 100%; }

  /* Filter controls become full-width rows: a 150px date field and a half-width
     select are both awkward to tap, and side by side they leave neither
     readable. One control per line reads better than four cramped ones. */
  .filter-bar { gap: 8px; }
  .filter-bar > .search-box,
  .filter-bar > .select,
  .filter-bar > .input { flex: 1 1 100%; max-width: none; }
  .filter-bar > .btn { flex: 1 1 auto; justify-content: center; }

  /* Chips stay a single scrollable row instead of stacking into a tall block. */
  .filter-bar:has(> .chip) {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
  }
  .filter-bar:has(> .chip)::-webkit-scrollbar { display: none; }
  .chip { flex: 0 0 auto; }

  .page-head-actions { width: 100%; }
  .page-head-actions .btn { flex: 1 1 auto; justify-content: center; }

  .evidence-video, .evidence-preview { max-width: 100%; }
  .signing-evidence { padding: 12px; }
  .evidence-actions .btn { flex: 1 1 auto; justify-content: center; }
}

/* Below this the two-up stat grid becomes a single readable column. */
@media (max-width: 420px) {
  .stat-grid { grid-template-columns: 1fr; }
  .input-group .select,
  .input-group .input,
  .input-group .btn { flex: 1 1 100%; max-width: none; }
}

/* --------------------------------------------------------------------------
   28. Motion & print
   -------------------------------------------------------------------------- */

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

@media print {
  .sidebar, .topbar, .toast-stack, .page-head-actions, .filter-bar, .pagination { display: none !important; }
  body { background: #fff; }
  .card { border-color: #ccc; box-shadow: none; break-inside: avoid; }
  .content { padding: 0; max-width: none; }
}
