/* ==========================================================================
   Veeday Sales Tracker
   Palette is the Veeday brand set and nothing else:
     Veeday Red  #C8201A   Off-white #FAFAF8   Charcoal #111111
   On dark surfaces the red is used as a fill behind off-white text rather
   than as text itself - red on charcoal only reaches about 2.2:1, which is
   not readable, while off-white on red reaches 8.7:1.
   Type: Playfair Display for display headings, Inter for everything else.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */
:root {
  --red: #C8201A;
  --red-hover: #A81A15;
  --red-soft: rgba(200, 32, 26, 0.10);
  --red-line: rgba(200, 32, 26, 0.28);

  --bg: #FAFAF8;
  --surface: #FFFFFF;
  --surface-2: #F3F2EE;
  --surface-3: #EAE8E2;

  --ink: #111111;
  --ink-2: #454340;
  --ink-3: #75726B;

  --line: rgba(17, 17, 17, 0.11);
  --line-strong: rgba(17, 17, 17, 0.20);

  --shadow-sm: 0 1px 2px rgba(17, 17, 17, 0.05), 0 1px 3px rgba(17, 17, 17, 0.04);
  --shadow-md: 0 4px 6px -2px rgba(17, 17, 17, 0.05), 0 12px 24px -6px rgba(17, 17, 17, 0.10);
  --shadow-lg: 0 24px 60px -12px rgba(17, 17, 17, 0.22);

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-pill: 999px;

  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --display: 'Playfair Display', Georgia, 'Times New Roman', serif;

  --focus: 0 0 0 3px rgba(200, 32, 26, 0.30);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0D0D0C;
    --surface: #161615;
    --surface-2: #1E1E1C;
    --surface-3: #272725;

    --ink: #FAFAF8;
    --ink-2: #C9C6C0;
    --ink-3: #918E88;

    --line: rgba(250, 250, 248, 0.11);
    --line-strong: rgba(250, 250, 248, 0.22);

    --red-soft: rgba(200, 32, 26, 0.18);
    --red-line: rgba(200, 32, 26, 0.45);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 12px 28px -8px rgba(0, 0, 0, 0.65);
    --shadow-lg: 0 28px 70px -14px rgba(0, 0, 0, 0.8);

    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0D0D0C;
  --surface: #161615;
  --surface-2: #1E1E1C;
  --surface-3: #272725;

  --ink: #FAFAF8;
  --ink-2: #C9C6C0;
  --ink-3: #918E88;

  --line: rgba(250, 250, 248, 0.11);
  --line-strong: rgba(250, 250, 248, 0.22);

  --red-soft: rgba(200, 32, 26, 0.18);
  --red-line: rgba(200, 32, 26, 0.45);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 12px 28px -8px rgba(0, 0, 0, 0.65);
  --shadow-lg: 0 28px 70px -14px rgba(0, 0, 0, 0.8);

  color-scheme: dark;
}

/* --------------------------------------------------------------------------
   2. Base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* The shell stays blank until app.js decides which view to show, so there is
   no flash of the sign-in form for an already-authenticated user. */
html[data-boot="pending"] body > *:not(noscript) { visibility: hidden; }

h1, h2, h3, p, ul, figure { margin: 0; }
ul { padding: 0; list-style: none; }
img { max-width: 100%; height: auto; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }

a { color: var(--red); text-decoration: none; }

:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-sm); }

.is-hidden { display: none !important; }

.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;
}

.noscript {
  margin: 20vh auto; max-width: 32rem; padding: 1.25rem 1.5rem;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); text-align: center;
}

/* --------------------------------------------------------------------------
   3. Controls
   -------------------------------------------------------------------------- */
.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.72rem 1.15rem;
  border: 1px solid transparent; border-radius: var(--r-pill);
  font-size: 0.9rem; font-weight: 600; letter-spacing: 0.01em;
  cursor: pointer; white-space: nowrap;
  transition: background-color 0.16s var(--ease), border-color 0.16s var(--ease),
              color 0.16s var(--ease), transform 0.12s var(--ease), box-shadow 0.16s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn[disabled] { cursor: not-allowed; opacity: 0.62; }

.btn--primary { background: var(--red); color: #FAFAF8; box-shadow: var(--shadow-sm); }
.btn--primary:hover:not([disabled]) { background: var(--red-hover); box-shadow: var(--shadow-md); }

.btn--ghost { background: transparent; color: var(--ink-2); border-color: var(--line-strong); }
.btn--ghost:hover:not([disabled]) { background: var(--surface-2); color: var(--ink); }

.btn--sm { padding: 0.48rem 0.9rem; font-size: 0.83rem; }
.btn--block { width: 100%; padding-block: 0.85rem; font-size: 0.95rem; }

.btn__plus { position: relative; width: 12px; height: 12px; flex: none; }
.btn__plus::before, .btn__plus::after {
  content: ''; position: absolute; inset: 0; margin: auto;
  background: currentColor; border-radius: 1px;
}
.btn__plus::before { width: 12px; height: 2px; }
.btn__plus::after { width: 2px; height: 12px; }

.spinner {
  display: none; width: 15px; height: 15px; flex: none;
  border: 2px solid rgba(250, 250, 248, 0.35);
  border-top-color: #FAFAF8; border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.btn--ghost .spinner { border-color: var(--line-strong); border-top-color: var(--ink); }
.btn.is-busy .spinner { display: block; }
.btn.is-busy .btn__label { opacity: 0.75; }

@keyframes spin { to { transform: rotate(360deg); } }

/* Fields ------------------------------------------------------------------ */
.form { display: grid; gap: 1.05rem; }

.field { display: grid; gap: 0.42rem; }

.field__label {
  font-size: 0.78rem; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--ink-3);
}
.field__hint { text-transform: none; letter-spacing: 0; font-weight: 500; opacity: 0.8; }

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

.input {
  width: 100%;
  padding: 0.78rem 0.95rem;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  color: var(--ink);
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease), background-color 0.16s var(--ease);
}
.input::placeholder { color: var(--ink-3); opacity: 0.75; }
.input:hover { border-color: var(--ink-3); }
.input:focus { outline: none; border-color: var(--red); box-shadow: var(--focus); }

.field__icon + .input { padding-left: 2.6rem; }
.input--prefixed { padding-left: 2.2rem; }
.input--reveal { padding-right: 3rem; }

.textarea { resize: vertical; min-height: 6rem; line-height: 1.5; }

.select { appearance: none; -webkit-appearance: none; padding-right: 2.6rem; cursor: pointer; }
.field__control--select::after {
  content: ''; position: absolute; right: 1.05rem; pointer-events: none;
  width: 8px; height: 8px; border-right: 2px solid var(--ink-3);
  border-bottom: 2px solid var(--ink-3); transform: translateY(-3px) rotate(45deg);
}

.field__prefix {
  position: absolute; left: 0.95rem; color: var(--ink-3);
  font-weight: 600; pointer-events: none;
}

.field__icon {
  position: absolute; left: 0.95rem; width: 16px; height: 16px;
  pointer-events: none; opacity: 0.6;
  background: currentColor; color: var(--ink-3);
}
.field__icon--user {
  -webkit-mask: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='12' cy='7' r='4'/%3E%3C/svg%3E");
          mask: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='12' cy='7' r='4'/%3E%3C/svg%3E");
}
.field__icon--lock {
  -webkit-mask: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='11' width='18' height='11' rx='2'/%3E%3Cpath d='M7 11V7a5 5 0 0 1 10 0v4'/%3E%3C/svg%3E");
          mask: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='11' width='18' height='11' rx='2'/%3E%3Cpath d='M7 11V7a5 5 0 0 1 10 0v4'/%3E%3C/svg%3E");
}

.field__reveal {
  position: absolute; right: 0.5rem;
  width: 34px; height: 34px; padding: 0;
  background: transparent; border: 0; border-radius: var(--r-sm);
  cursor: pointer; opacity: 0.6;
}
.field__reveal:hover { opacity: 1; background: var(--surface-2); }
.field__reveal::before {
  content: ''; position: absolute; inset: 0; margin: auto;
  width: 18px; height: 18px; background: var(--ink-2);
  -webkit-mask: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7-10-7-10-7Z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E");
          mask: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7-10-7-10-7Z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E");
}
.field__reveal[aria-pressed="true"]::after {
  content: ''; position: absolute; inset: 0; margin: auto;
  width: 20px; height: 2px; background: var(--ink-2);
  transform: rotate(-45deg); border-radius: 2px;
}

.field__count { margin: 0; font-size: 0.75rem; color: var(--ink-3); text-align: right; }

/* Alerts / notices -------------------------------------------------------- */
.alert {
  padding: 0.7rem 0.9rem;
  background: var(--red-soft);
  border: 1px solid var(--red-line);
  border-radius: var(--r-md);
  font-size: 0.87rem; font-weight: 500;
}

.notice {
  display: flex; align-items: flex-start; gap: 0.6rem;
  margin-bottom: 1.25rem; padding: 0.8rem 1rem;
  background: var(--red-soft); border: 1px solid var(--red-line);
  border-radius: var(--r-md); font-size: 0.87rem;
}

/* Theme toggle ------------------------------------------------------------ */
.theme-toggle {
  width: 38px; height: 38px; padding: 0; flex: none;
  display: grid; place-items: center;
  background: transparent; border: 1px solid var(--line-strong);
  border-radius: var(--r-pill); cursor: pointer;
  transition: background-color 0.16s var(--ease), border-color 0.16s var(--ease);
}
.theme-toggle:hover { background: var(--surface-2); border-color: var(--ink-3); }
.theme-toggle__icon {
  width: 17px; height: 17px; background: var(--ink-2);
  -webkit-mask: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8Z'/%3E%3C/svg%3E");
          mask: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8Z'/%3E%3C/svg%3E");
}
/* Moon offers dark; once dark is on, the control offers light instead. */
.theme-toggle__icon--sun { display: none; }
:root[data-theme="dark"] .theme-toggle__icon--moon { display: none; }
:root[data-theme="dark"] .theme-toggle__icon--sun { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle__icon--moon { display: none; }
  :root:not([data-theme="light"]) .theme-toggle__icon--sun { display: block; }
}
.theme-toggle__icon--sun {
  -webkit-mask: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='4.5'/%3E%3Cpath d='M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4'/%3E%3C/svg%3E");
          mask: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='4.5'/%3E%3Cpath d='M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4'/%3E%3C/svg%3E");
}

/* --------------------------------------------------------------------------
   4. Sign in
   -------------------------------------------------------------------------- */
.auth {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  min-height: 100vh; min-height: 100dvh;
}

/* Left stage --------------------------------------------------------------*/
.auth__stage {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between; gap: 2rem;
  padding: clamp(2rem, 4vw, 3.5rem);
  background: #0D0D0C;
  color: #FAFAF8;
  /* Reads as a seam in light mode from the contrast alone; in dark mode the
     two panels are close enough in value to need the hairline. */
  border-right: 1px solid rgba(250, 250, 248, 0.09);
  isolation: isolate;
}

.stage__wash {
  position: absolute; inset: 0; z-index: -3;
  background:
    radial-gradient(120% 90% at 8% 92%, rgba(200, 32, 26, 0.55) 0%, rgba(200, 32, 26, 0) 58%),
    radial-gradient(90% 70% at 88% 6%, rgba(200, 32, 26, 0.22) 0%, rgba(200, 32, 26, 0) 62%),
    linear-gradient(160deg, #17100F 0%, #0D0D0C 55%, #120C0B 100%);
}

.stage__grid {
  position: absolute; inset: 0; z-index: -2; opacity: 0.5;
  background-image:
    linear-gradient(rgba(250, 250, 248, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(250, 250, 248, 0.045) 1px, transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: radial-gradient(90% 80% at 40% 45%, #000 0%, transparent 78%);
          mask-image: radial-gradient(90% 80% at 40% 45%, #000 0%, transparent 78%);
}

.stage__map { position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; }

.corridor {
  fill: none;
  stroke: rgba(250, 250, 248, 0.14);
  stroke-width: 1.1;
}

.pulse {
  fill: none;
  stroke: #C8201A;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-dasharray: 34 1000;
  stroke-dashoffset: 1034;
  filter: drop-shadow(0 0 6px rgba(200, 32, 26, 0.85));
  animation: travel 7s linear infinite;
}
.pulse-1 { animation-delay: 0s;    }
.pulse-2 { animation-delay: 0.9s;  }
.pulse-3 { animation-delay: 1.8s;  }
.pulse-4 { animation-delay: 2.7s;  }
.pulse-5 { animation-delay: 3.6s;  }
.pulse-6 { animation-delay: 4.5s;  }
.pulse-7 { animation-delay: 5.4s;  }

@keyframes travel {
  0%   { stroke-dashoffset: 1034; opacity: 0; }
  6%   { opacity: 1; }
  70%  { stroke-dashoffset: 0;    opacity: 1; }
  80%  { stroke-dashoffset: 0;    opacity: 0; }
  100% { stroke-dashoffset: 0;    opacity: 0; }
}

.hop { fill: rgba(250, 250, 248, 0.5); animation: hopFlash 7s ease-in-out infinite; }
.hop-1 { animation-delay: 4.9s; } .hop-2 { animation-delay: 5.8s; }
.hop-3 { animation-delay: 6.7s; } .hop-4 { animation-delay: 0.6s; }
.hop-5 { animation-delay: 1.5s; } .hop-6 { animation-delay: 2.4s; }
.hop-7 { animation-delay: 3.3s; }

@keyframes hopFlash {
  0%, 88%, 100% { fill: rgba(250, 250, 248, 0.42); opacity: 0.8; }
  92%           { fill: #C8201A; opacity: 1; filter: drop-shadow(0 0 7px rgba(200, 32, 26, 0.95)); }
}

.hub__core { fill: #C8201A; }
.hub__ring { fill: none; stroke: rgba(200, 32, 26, 0.7); stroke-width: 1.4; transform-origin: 118px 726px; }
.hub__ring--a { animation: hubPing 3.4s ease-out infinite; }
.hub__ring--b { animation: hubPing 3.4s ease-out infinite 1.7s; }
.hub-glow { animation: hubBreathe 6s ease-in-out infinite; transform-origin: 118px 726px; }

@keyframes hubPing {
  0%   { transform: scale(0.5); opacity: 0.9; }
  100% { transform: scale(3.4); opacity: 0; }
}
@keyframes hubBreathe {
  0%, 100% { opacity: 0.7; transform: scale(1); }
  50%      { opacity: 1;   transform: scale(1.07); }
}

.stage__body { position: relative; max-width: 34rem; }

.stage__logo { position: relative; width: clamp(118px, 12vw, 150px); height: auto; }

.stage__title {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(2rem, 3.4vw, 3.1rem);
  line-height: 1.1;
  letter-spacing: -0.015em;
}

.stage__lede {
  margin-top: 1rem;
  max-width: 28rem;
  color: rgba(250, 250, 248, 0.72);
  font-size: 1rem;
}

.stage__routes {
  display: flex; flex-wrap: wrap; gap: 0.4rem;
  margin-top: 1.6rem;
}
.stage__routes li {
  padding: 0.28rem 0.7rem;
  border: 1px solid rgba(250, 250, 248, 0.18);
  border-radius: var(--r-pill);
  font-size: 0.76rem; font-weight: 500;
  color: rgba(250, 250, 248, 0.82);
  backdrop-filter: blur(4px);
}

.stage__licence {
  display: flex; align-items: center; gap: 0.55rem;
  margin-top: 2rem; padding-top: 1.4rem;
  border-top: 1px solid rgba(250, 250, 248, 0.12);
  font-size: 0.8rem; letter-spacing: 0.01em;
  color: rgba(250, 250, 248, 0.62);
}
.stage__licence .dot {
  width: 7px; height: 7px; flex: none; border-radius: 50%;
  background: #C8201A; box-shadow: 0 0 0 3px rgba(200, 32, 26, 0.22);
}

/* Right panel --------------------------------------------------------------*/
.auth__panel {
  display: grid; grid-template-rows: auto 1fr auto;
  padding: clamp(1.5rem, 3vw, 2.5rem);
  background: var(--bg);
}

.auth__top { display: flex; align-items: center; justify-content: space-between; }
.auth__mark { width: 52px; height: auto; }

.auth__center {
  align-self: center;
  width: 100%; max-width: 25rem;
  margin: 0 auto;
  padding: clamp(1.5rem, 5vh, 3rem) 0;
}

.eyebrow {
  font-size: 0.74rem; font-weight: 600; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--red);
}

.auth__title {
  margin-top: 0.4rem;
  font-family: var(--display); font-weight: 600;
  font-size: clamp(2rem, 4vw, 2.6rem); line-height: 1.08;
  letter-spacing: -0.02em;
}
.auth__sub { margin-top: 0.5rem; color: var(--ink-3); }
.auth__intro { margin-bottom: 1.9rem; }

.auth__help {
  margin-top: 1.5rem; padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  font-size: 0.82rem; line-height: 1.5; color: var(--ink-3);
}

.auth__foot {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.78rem; color: var(--ink-3);
}
.auth__foot-sep { opacity: 0.5; }

/* --------------------------------------------------------------------------
   5. Application shell
   -------------------------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid var(--line);
}
@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .topbar { background: var(--bg); }
}

.topbar__inner {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  max-width: 1240px; margin: 0 auto;
  padding: 0.75rem clamp(1rem, 3vw, 2rem);
}

.brand { display: flex; align-items: center; gap: 0.7rem; color: inherit; }
.brand__mark { width: 34px; height: auto; }
.brand__text { display: flex; flex-direction: column; line-height: 1.1; }
.brand__name {
  font-family: var(--display); font-weight: 700; font-size: 1.12rem;
  letter-spacing: -0.01em;
}
.brand__sub {
  font-size: 0.68rem; font-weight: 600; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--ink-3);
}

.topbar__actions { display: flex; align-items: center; gap: 0.65rem; }

.who { display: flex; align-items: center; gap: 0.6rem; }
.who__avatar {
  display: grid; place-items: center; flex: none;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--red); color: #FAFAF8;
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.02em;
}
.who__text { display: flex; flex-direction: column; line-height: 1.2; }
.who__name { font-size: 0.87rem; font-weight: 600; }
.who__role {
  font-size: 0.68rem; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink-3);
}

.wrap {
  max-width: 1240px; margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 2.5rem) clamp(1rem, 3vw, 2rem) 4rem;
}

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 1rem; margin-bottom: 1.6rem; flex-wrap: wrap;
}
.page-title {
  font-family: var(--display); font-weight: 600;
  font-size: clamp(1.8rem, 3vw, 2.4rem); line-height: 1.1; letter-spacing: -0.02em;
}
.page-sub { margin-top: 0.25rem; font-size: 0.87rem; color: var(--ink-3); }

/* Stats ------------------------------------------------------------------- */
.stats {
  display: grid; gap: 0.9rem; margin-bottom: 1.4rem;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.stat {
  padding: 1.15rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.stat--won { border-color: var(--red-line); background: linear-gradient(180deg, var(--red-soft), transparent 70%), var(--surface); }

.stat__label {
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.11em;
  text-transform: uppercase; color: var(--ink-3);
}
.stat__value {
  margin-top: 0.35rem;
  font-family: var(--display); font-weight: 700;
  font-size: clamp(1.5rem, 2.6vw, 1.95rem); line-height: 1.1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.stat__meta { margin-top: 0.3rem; font-size: 0.78rem; color: var(--ink-3); }

.meter {
  margin-top: 0.7rem; height: 6px; border-radius: var(--r-pill);
  background: var(--surface-3); overflow: hidden;
}
.meter__fill {
  display: block; height: 100%; width: 0;
  background: var(--red); border-radius: inherit;
  transition: width 0.5s var(--ease);
}

/* Panel + toolbar ---------------------------------------------------------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--line);
}

.search { position: relative; flex: 1 1 15rem; max-width: 22rem; }
.search__icon {
  position: absolute; left: 0.85rem; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; background: var(--ink-3); opacity: 0.7; pointer-events: none;
  -webkit-mask: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
          mask: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
}
.input--search { padding: 0.58rem 0.9rem 0.58rem 2.45rem; font-size: 0.88rem; background: var(--surface-2); }

.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip {
  padding: 0.42rem 0.85rem; white-space: nowrap;
  background: transparent; color: var(--ink-3);
  border: 1px solid var(--line-strong); border-radius: var(--r-pill);
  font-size: 0.81rem; font-weight: 600; cursor: pointer;
  transition: all 0.16s var(--ease);
}
.chip:hover { color: var(--ink); border-color: var(--ink-3); }
.chip.is-active { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* Table -------------------------------------------------------------------- */
.table-scroll { overflow-x: auto; }

.table { width: 100%; border-collapse: collapse; }

.table th {
  padding: 0.7rem 1.15rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--ink-3); text-align: left;
  white-space: nowrap;
}

.table td {
  padding: 0.85rem 1.15rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.89rem; vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background-color 0.14s var(--ease); }
.table tbody tr:hover { background: var(--surface-2); }

.col-act, .cell-act { width: 1%; text-align: right; }
.cell-date { white-space: nowrap; color: var(--ink-3); font-size: 0.83rem; }


.badge {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.26rem 0.66rem; border-radius: var(--r-pill);
  font-size: 0.74rem; font-weight: 700; letter-spacing: 0.02em; white-space: nowrap;
  border: 1px solid transparent;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* Seventeen stages cannot be told apart by hue, and the brand has one accent
   colour anyway, so the label does the work and the fill carries the mood:
   waiting is neutral, cleared is red-tinted, a retest is solid charcoal, a
   dead end is a dashed outline, and mobilised is the full Veeday red. */
.badge--wait { background: var(--surface-3);  color: var(--ink-2); border-color: var(--line-strong); }
.badge--good { background: var(--red-soft);   color: var(--ink);   border-color: var(--red-line); }
.badge--good::before { background: var(--red); }
.badge--warn { background: var(--ink);        color: var(--bg);    border-color: var(--ink); }
.badge--done { background: var(--red);        color: #FAFAF8;      border-color: var(--red); }
.badge--stop {
  background: transparent; color: var(--ink-3);
  border-color: var(--line-strong); border-style: dashed;
}
.badge--stop::before { background: transparent; box-shadow: inset 0 0 0 1px currentColor; }

.cell-candidate { font-weight: 600; }
.cell-sub {
  display: block; margin-top: 1px;
  font-size: 0.75rem; font-weight: 500; color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.cell-client { font-weight: 500; }
.cell-cre, .col-cre { white-space: nowrap; color: var(--ink-2); }
.col-stage { min-width: 11rem; }

/* Skeletons + empty state -------------------------------------------------- */
.skeleton {
  display: block; height: 0.85rem; border-radius: var(--r-sm);
  background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2));
  background-size: 200% 100%;
  animation: shimmer 1.3s linear infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

.empty { padding: 3.5rem 1.5rem; text-align: center; }
.empty__mark {
  display: block; width: 44px; height: 44px; margin: 0 auto 1rem;
  background: var(--ink-3); opacity: 0.35;
  -webkit-mask: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.5'%3E%3Cpath d='M3 5h18l-7 8v6l-4 2v-8Z'/%3E%3C/svg%3E");
          mask: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.5'%3E%3Cpath d='M3 5h18l-7 8v6l-4 2v-8Z'/%3E%3C/svg%3E");
}
.empty__title { font-family: var(--display); font-size: 1.2rem; font-weight: 600; }
.empty__text { margin-top: 0.35rem; font-size: 0.88rem; color: var(--ink-3); }

/* --------------------------------------------------------------------------
   6. Drawer + toasts
   -------------------------------------------------------------------------- */
body.is-locked { overflow: hidden; }

.drawer { position: fixed; inset: 0; z-index: 60; }

.drawer__scrim {
  position: absolute; inset: 0;
  background: rgba(13, 13, 12, 0.55);
  backdrop-filter: blur(2px);
  animation: fade 0.2s var(--ease);
}

.drawer__sheet {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: min(29rem, 100%);
  display: flex; flex-direction: column;
  background: var(--bg);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.26s var(--ease);
}

@keyframes fade { from { opacity: 0; } }
@keyframes slideIn { from { transform: translateX(100%); } }

.drawer__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem clamp(1.25rem, 3vw, 1.75rem);
  border-bottom: 1px solid var(--line);
}
.drawer__title {
  font-family: var(--display); font-weight: 600; font-size: 1.35rem;
  letter-spacing: -0.01em;
}

.icon-btn {
  width: 34px; height: 34px; padding: 0; display: grid; place-items: center;
  background: transparent; border: 1px solid var(--line-strong);
  border-radius: var(--r-pill); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn__x { position: relative; width: 13px; height: 13px; }
.icon-btn__x::before, .icon-btn__x::after {
  content: ''; position: absolute; inset: 0; margin: auto;
  width: 13px; height: 2px; background: var(--ink-2); border-radius: 2px;
}
.icon-btn__x::before { transform: rotate(45deg); }
.icon-btn__x::after  { transform: rotate(-45deg); }

.drawer__form {
  flex: 1; overflow-y: auto;
  padding: clamp(1.25rem, 3vw, 1.75rem);
  align-content: start;
}
.drawer__actions {
  display: flex; justify-content: flex-end; gap: 0.6rem;
  margin-top: 0.5rem; padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.toasts {
  position: fixed; z-index: 80;
  right: clamp(1rem, 3vw, 2rem); bottom: clamp(1rem, 3vw, 2rem);
  display: grid; gap: 0.5rem; max-width: min(22rem, calc(100vw - 2rem));
}

.toast {
  display: flex; align-items: flex-start; gap: 0.6rem;
  padding: 0.75rem 0.95rem;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line-strong); border-left-width: 3px;
  border-radius: var(--r-md); box-shadow: var(--shadow-md);
  font-size: 0.86rem;
  animation: toastIn 0.24s var(--ease);
}
.toast--error { border-left-color: var(--red); }
.toast--ok { border-left-color: var(--ink); }
.toast.is-leaving { animation: toastOut 0.2s var(--ease) forwards; }

@keyframes toastIn  { from { opacity: 0; transform: translateY(8px); } }
@keyframes toastOut { to   { opacity: 0; transform: translateY(8px); } }

/* --------------------------------------------------------------------------
   7. Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 960px) {
  .auth { grid-template-columns: 1fr; }
  .auth__stage {
    min-height: 44vh;
    order: -1;
    padding-block: clamp(1.75rem, 5vw, 2.75rem);
    border-right: 0;
    border-bottom: 1px solid rgba(250, 250, 248, 0.09);
  }
  .stage__title { font-size: clamp(1.7rem, 6vw, 2.3rem); }
  .stage__routes { display: none; }
  .auth__panel { min-height: auto; }
}

@media (max-width: 600px) {
  /* Get the form above the fold on a phone; the headline and licence line
     carry enough of the brand on their own. */
  .stage__lede { display: none; }
  .auth__stage { min-height: 34vh; gap: 1.25rem; }
  .stage__licence { margin-top: 1.25rem; padding-top: 1rem; }
}

@media (max-width: 720px) {
  .topbar__inner { padding-inline: 1rem; }
  .who__text { display: none; }
  .brand__sub { display: none; }

  .toolbar { align-items: stretch; }
  .search { max-width: none; }
  .chips { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; -webkit-overflow-scrolling: touch; }
  .chips::after { content: ''; flex: none; width: 0.25rem; }

  /* Rows become stacked cards - a 7-column table is unreadable at this width */
  .table-scroll { overflow-x: visible; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr {
    padding: 0.9rem 1rem;
    border-bottom: 1px solid var(--line);
    position: relative;
  }
  .table td {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: 0.3rem 0; border: 0;
  }
  .table td::before {
    content: attr(data-label);
    flex: none;
    font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em;
    text-transform: uppercase; color: var(--ink-3);
  }
  .cell-client { font-size: 1rem; }
  .cell-act { justify-content: flex-end; padding-top: 0.5rem; }
  .cell-candidate { text-align: left; }
  .col-num, .cell-value { text-align: right; }
}

@media (max-width: 420px) {
  .page-head { flex-direction: column; align-items: stretch; }
  .page-head .btn { width: 100%; }
}

/* --------------------------------------------------------------------------
   8. Motion + print
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .pulse { stroke-dashoffset: 0; stroke-dasharray: 3 9; opacity: 0.5; }
  .hub-glow { opacity: 0.8; }
}

@media print {
  .topbar, .toolbar, .page-head .btn, .cell-act, .toasts, .drawer { display: none !important; }
  .panel, .stat { border: 1px solid #999; box-shadow: none; }
  body { background: #fff; color: #000; }
}


/* --------------------------------------------------------------------------
   9. Placement UI
   -------------------------------------------------------------------------- */
.btn--xs { padding: 0.34rem 0.75rem; font-size: 0.78rem; }
.btn--danger { color: var(--red); border-color: var(--red-line); background: transparent; }
.btn--danger:hover:not([disabled]) { background: var(--red-soft); border-color: var(--red); }

.toolbar__filters { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.select--compact {
  padding: 0.5rem 2.4rem 0.5rem 0.85rem;
  font-size: 0.83rem; font-weight: 600;
  background-color: var(--surface-2);
}
.stage-filter { min-width: 12rem; position: relative; }
.stage-filter::after {
  content: ''; position: absolute; right: 1rem; top: 50%; pointer-events: none;
  width: 8px; height: 8px;
  border-right: 2px solid var(--ink-3); border-bottom: 2px solid var(--ink-3);
  transform: translateY(-70%) rotate(45deg);
}

.field__req {
  margin-left: 0.2rem; color: var(--red); font-weight: 700;
}

/* The derived stage sits at the top of the record so it reads as an output of
   the ticks below, not as something you choose. */
.ladder {
  padding: 1rem clamp(1.25rem, 3vw, 1.75rem) 1.15rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}
.ladder__now { display: flex; align-items: center; gap: 0.65rem; }
.ladder__label {
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.11em;
  text-transform: uppercase; color: var(--ink-3);
}
.ladder__track { display: flex; gap: 3px; margin-top: 0.75rem; }
.ladder__seg {
  flex: 1; height: 5px; border-radius: 2px;
  background: var(--surface-3);
  transition: background-color 0.2s var(--ease);
}
.ladder__seg.is-done    { background: var(--red-line); }
.ladder__seg.is-current { background: var(--red); }
.ladder__seg.is-stop    { background: var(--ink-3); }
.ladder__hint { margin-top: 0.6rem; font-size: 0.75rem; color: var(--ink-3); }

.drawer__sheet--wide { width: min(46rem, 100%); }
.drawer__sub { margin-top: 0.15rem; font-size: 0.83rem; color: var(--ink-3); }
.drawer__spacer { flex: 1; }
.drawer__actions { align-items: center; }

.group { border: 0; padding: 0; margin: 0 0 1.7rem; min-width: 0; }
.group:last-of-type { margin-bottom: 0.5rem; }
.group__title {
  padding: 0;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.11em;
  text-transform: uppercase; color: var(--ink-3);
}
.group__note { margin-top: 0.35rem; font-size: 0.78rem; color: var(--ink-3); }
.group__grid {
  display: grid; gap: 0.9rem; margin-top: 0.8rem;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* The stage block is boxed because it is the only group whose values have
   consequences outside themselves. */
.group--stages {
  padding: 1rem clamp(0.9rem, 2vw, 1.2rem) 1.2rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}
.group--stages .group__title { color: var(--red); }

@media (max-width: 720px) {
  .toolbar__filters { width: 100%; }
  .stage-filter { flex: 1; min-width: 0; }
  .group__grid { grid-template-columns: 1fr; }
  .drawer__actions { flex-wrap: wrap; }
  .drawer__spacer { display: none; }
}
