:root,
[data-theme="light"] {
  --brand-teal: #308C94;
  --brand-navy: #1E4B5F;
  --color-primary: #1E4B5F;
  --color-accent: #308C94;
  --color-background: #EEF3F5;
  --color-surface: #FFFFFF;
  --color-foreground: #0F2430;
  --color-muted: #E3EBEE;
  --color-muted-fg: #5A6F78;
  --color-border: #C8D6DC;
  --color-destructive: #E04E39;
  --color-danger-bg: #FCEBE8;
  --auth-story-bg: #f7f7f7;
  --auth-story-bg-deep: #eeeeee;
  --auth-story-fg: #111111;
  --auth-story-muted: #525252;
  --auth-story-soft: #737373;
  --auth-story-line: rgba(0, 0, 0, 0.12);
  --auth-story-rule: rgba(0, 0, 0, 0.72);
  --auth-story-aura-border: rgba(0, 0, 0, 0.14);
  --auth-story-aura-fill: rgba(0, 0, 0, 0.05);
  --auth-story-wash-1: rgba(0, 0, 0, 0.06);
  --auth-story-wash-2: rgba(0, 0, 0, 0.04);
  --auth-story-wash-3: rgba(0, 0, 0, 0.03);
  --auth-story-edge: #e5e5e5;
  --auth-logo-bg: transparent;
  --auth-logo-shadow: none;
  --auth-logo-border: transparent;
  --auth-card-bg: #ffffff;
  --auth-card-border: #e5e5e5;
  --auth-page-bg: #ffffff;
  --auth-input-bg: #ffffff;
  --auth-input-border: #d4d4d4;
  --auth-muted-fg: #525252;
  --auth-cta-bg: #111111;
  --auth-cta-fg: #ffffff;
  --space-sm: 0.25rem;
  --space-md: 0.5rem;
  --space-lg: 0.75rem;
  --space-xl: 1rem;
  --space-2xl: 1.5rem;
  --radius-md: 8px;
  --radius-xl: 16px;
  --shadow-focus: 0 0 0 3px rgba(0, 0, 0, 0.12);
  --shadow-glow: 0 0 0 1px rgba(0, 0, 0, 0.06), 0 12px 32px rgba(0, 0, 0, 0.08);
  --font-sans: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --text-sm: 0.8125rem;
  --text-lg: 1.125rem;
  --control-h: 38px;
  --touch-min: 44px;
  --motion: 200ms cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: light;
}

[data-theme="dark"] {
  --brand-teal: #7eb8be;
  --brand-navy: #e8e8e8;
  --color-primary: #e8e8e8;
  --color-accent: #f0f0f0;
  --color-background: #0d0d0d;
  --color-surface: #171717;
  --color-foreground: #f2f2f2;
  --color-muted: #2a2a2a;
  --color-muted-fg: #a0a0a0;
  --color-border: #333333;
  --color-destructive: #ff7b6b;
  --color-danger-bg: #3a1814;
  --auth-story-bg: #0a0a0a;
  --auth-story-bg-deep: #000000;
  --auth-story-fg: #fafafa;
  --auth-story-muted: #a3a3a3;
  --auth-story-soft: #8a8a8a;
  --auth-story-line: rgba(255, 255, 255, 0.14);
  --auth-story-rule: rgba(255, 255, 255, 0.82);
  --auth-story-aura-border: rgba(255, 255, 255, 0.16);
  --auth-story-aura-fill: rgba(255, 255, 255, 0.06);
  --auth-story-wash-1: rgba(255, 255, 255, 0.07);
  --auth-story-wash-2: rgba(255, 255, 255, 0.04);
  --auth-story-wash-3: rgba(255, 255, 255, 0.03);
  --auth-story-edge: #262626;
  --auth-page-bg: #000000;
  --auth-logo-bg: transparent;
  --auth-logo-shadow: none;
  --auth-logo-border: transparent;
  --auth-card-bg: #121212;
  --auth-card-border: #2a2a2a;
  --auth-input-bg: #171717;
  --auth-input-border: #333333;
  --auth-muted-fg: #a3a3a3;
  --auth-cta-bg: #fafafa;
  --auth-cta-fg: #000000;
  --shadow-focus: 0 0 0 3px rgba(255, 255, 255, 0.16);
  --shadow-glow: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 12px 32px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--color-foreground);
  background: var(--color-background);
}
.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
}
.skip-link:focus { left: 8px; top: 8px; background: var(--color-surface); color: var(--color-foreground); padding: 8px; z-index: 5; }

.theme-toggle {
  position: fixed;
  top: 0.85rem;
  right: 0.85rem;
  z-index: 20;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 36px;
  padding: 0 0.7rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface);
  color: var(--color-foreground);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 650;
  cursor: pointer;
  box-shadow: var(--shadow-glow);
}
.theme-toggle:hover { border-color: var(--color-foreground); }
.theme-toggle-icon { font-size: 0.95rem; line-height: 1; }

.auth-page {
  --font-sans: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
  --color-foreground: #111111;
  --color-surface: #ffffff;
  --color-border: #e5e5e5;
  --color-muted-fg: #525252;
  --shadow-focus: 0 0 0 3px rgba(0, 0, 0, 0.12);
  font-family: var(--font-sans);
  background: var(--auth-page-bg);
  color: var(--color-foreground);
  min-height: 100dvh;
  overscroll-behavior: contain;
}
[data-theme="dark"] .auth-page {
  --color-foreground: #fafafa;
  --color-surface: #121212;
  --color-border: #2a2a2a;
  --color-muted-fg: #a3a3a3;
  --shadow-focus: 0 0 0 3px rgba(255, 255, 255, 0.16);
}
.auth-layout {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl) var(--space-xl);
  gap: var(--space-xl);
}
.auth-layout-split {
  display: grid;
  grid-template-columns: minmax(280px, 0.95fr) minmax(320px, 1.05fr);
  align-items: stretch;
  justify-items: stretch;
  min-height: 100dvh;
  padding: 0;
  gap: 0;
}
.auth-story {
  --story-pad-x: clamp(1.5rem, 4vw, 2.75rem);
  --story-pad-y: clamp(2rem, 6vh, 3.25rem);
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 2rem; /* 32px between logo ↔ main ↔ footer */
  min-height: 100dvh;
  padding: var(--story-pad-y) var(--story-pad-x);
  color: var(--auth-story-fg);
  background:
    radial-gradient(ellipse 70% 50% at 0% 0%, var(--auth-story-wash-1), transparent 55%),
    radial-gradient(ellipse 65% 48% at 100% 100%, var(--auth-story-wash-2), transparent 55%),
    linear-gradient(165deg, var(--auth-story-bg) 0%, var(--auth-story-bg-deep) 100%);
  border-right: 1px solid var(--auth-story-edge);
  transition: background var(--motion), color var(--motion), border-color var(--motion);
}
.auth-story::before,
.auth-workspace::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
}
.auth-story-aura,
.auth-story-aura::before,
.auth-story-aura::after,
.auth-workspace-aura,
.auth-workspace-aura::before,
.auth-workspace-aura::after {
  position: absolute;
  pointer-events: none;
  z-index: 0;
}
.auth-story-aura,
.auth-workspace-aura {
  inset: 0;
  background: none;
}
/* Corner soft discs only — no center rings behind copy */
.auth-story-aura::before,
.auth-story-aura::after,
.auth-workspace-aura::before,
.auth-workspace-aura::after {
  content: "";
  border-radius: 50%;
  border: 1px solid var(--auth-story-aura-border);
  will-change: transform;
}
.auth-story-aura::before,
.auth-workspace-aura::before {
  width: min(420px, 70vw);
  height: min(420px, 70vw);
  top: -28%;
  right: -26%;
  background: radial-gradient(circle at 42% 40%, var(--auth-story-aura-fill), transparent 68%);
  animation: auth-aura-drift 22s ease-in-out infinite;
}
.auth-story-aura::after,
.auth-workspace-aura::after {
  width: min(300px, 58vw);
  height: min(300px, 58vw);
  left: -22%;
  bottom: -24%;
  background: radial-gradient(circle at 55% 45%, var(--auth-story-aura-fill), transparent 70%);
  animation: auth-aura-drift 26s ease-in-out infinite reverse;
}
.auth-workspace-aura::before,
.auth-workspace-aura::after {
  opacity: 0.55;
}
@keyframes auth-aura-drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(8px, -6px) scale(1.02); }
}
.auth-story-brand,
.auth-story-main,
.auth-story-body,
.auth-story-foot,
.story-quote {
  position: relative;
  z-index: 1;
}
.auth-story-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
  flex: 0 0 auto;
  width: 100%;
  max-width: 28rem;
  animation: auth-story-in 420ms ease-out both;
}
.portal-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 360px;
  margin: 0;
  padding: 0;
  background: transparent;
  text-decoration: none;
  line-height: 0;
  position: relative;
}
.portal-brand img,
.auth-logo.logo-on-light,
.auth-logo.logo-on-dark {
  display: block;
  width: min(100%, 220px);
  height: auto;
  max-height: 104px;
  object-fit: contain;
  object-position: center;
}
.portal-brand img {
  background: transparent !important;
  border: 0;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
  image-rendering: auto;
  -ms-interpolation-mode: bicubic;
  transform: translateZ(0);
}
/* Theme-aware Prep lockups (official light + on-dark plates) */
.portal-brand .logo-on-dark,
.auth-brand .logo-on-dark { display: none; }
.portal-brand .logo-on-light { display: block; }
[data-theme="dark"] .portal-brand .logo-on-light,
[data-theme="dark"] .auth-brand .logo-on-light { display: none; }
[data-theme="dark"] .portal-brand .logo-on-dark { display: block; }
.portal-brand .logo-on-light,
.portal-brand .logo-on-dark {
  width: min(100%, 220px);
}
.portal-brand-rule {
  display: block;
  width: min(100%, 160px);
  height: 0;
  margin: 0;
  border: 0;
  border-top: 1px solid var(--auth-story-rule);
}
.auth-story-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0;
  width: 100%;
  max-width: 28rem;
  margin: 0.25rem 0; /* ~4px — parent gap handles brand/foot rhythm */
  flex: 0 0 auto;
  min-height: 0;
  height: auto;
  animation: auth-story-in 480ms ease-out 80ms both;
}
.auth-story-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 100%;
  gap: 0.7rem;
  margin: 0 0 1.5rem; /* 24px under headline block → quote */
}
.auth-story-kicker {
  margin: 0;
  color: var(--auth-story-muted);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.auth-story h1 {
  margin: 0;
  max-width: 15ch;
  font-size: clamp(1.75rem, 3.4vw, 2.5rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.035em;
  color: var(--auth-story-fg);
  text-wrap: balance;
  text-align: center;
}
.story-quote {
  margin: 0;
  padding: 0;
  max-width: 26em;
  text-align: center;
}
.story-quote-rule {
  display: block;
  width: 36px;
  height: 0;
  margin: 0 auto 0.85rem; /* ~14px above quote text */
  border: 0;
  border-top: 2px solid var(--auth-story-rule);
}
.story-quote blockquote {
  margin: 0;
  padding: 0;
  border: 0;
  color: var(--auth-story-fg);
  font-size: clamp(0.95rem, 1.3vw, 1.0625rem);
  font-style: italic;
  font-weight: 400;
  line-height: 1.6;
  letter-spacing: -0.01em;
  text-wrap: pretty;
}
.story-quote figcaption {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 10px;
  margin: 1rem 0 0; /* 16px above “Today’s note” */
}
.story-quote-label {
  color: var(--auth-story-soft);
  font-size: 11px;
  font-style: normal;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.story-quote-author {
  color: var(--auth-story-muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.auth-story-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 0 0 auto;
  width: 100%;
  max-width: 28rem;
  margin: 0;
  color: var(--auth-story-soft);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  animation: auth-story-in 520ms ease-out 140ms both;
}
@keyframes auth-story-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .auth-story-brand,
  .auth-story-main,
  .auth-story-foot { animation: none; }
  .auth-story-aura::before,
  .auth-story-aura::after,
  .auth-workspace-aura::before,
  .auth-workspace-aura::after {
    animation: none;
  }
}
.auth-workspace {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: clamp(1.5rem, 4vh, 2.75rem) 1.25rem;
  background:
    radial-gradient(ellipse 65% 50% at 100% 0%, var(--auth-story-wash-1), transparent 55%),
    radial-gradient(ellipse 60% 45% at 0% 100%, var(--auth-story-wash-2), transparent 55%),
    linear-gradient(200deg, var(--auth-story-bg) 0%, var(--auth-page-bg) 55%, var(--auth-story-bg-deep) 100%);
}
.auth-card {
  position: relative;
  z-index: 1;
  width: min(400px, 100%);
  background: var(--auth-card-bg);
  border: 1px solid var(--auth-card-border);
  border-radius: 12px;
  box-shadow: none;
  padding: 1.65rem 1.5rem 1.25rem;
  animation: auth-story-in 420ms ease-out 60ms both;
}
.auth-brand { text-align: left; margin-bottom: 1.15rem; }
.auth-brand-compact .auth-logo-mobile { display: none; }
.auth-logo { margin: 0 0 var(--space-lg); width: min(180px, 60vw); height: auto; display: block; }
.auth-eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--auth-muted-fg);
}
.auth-product {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--color-foreground);
}
.auth-lead { margin: 0.4rem 0 0; color: var(--auth-muted-fg); font-size: var(--text-sm); text-align: left; }
.auth-footer { font-size: var(--text-sm); color: var(--auth-muted-fg); text-align: center; }
.auth-footer a { font-weight: 600; color: var(--color-foreground); }
.auth-powered {
  margin: 1.35rem 0 0;
  padding-top: 0.95rem;
  border-top: 1px solid var(--auth-card-border);
  font-size: 0.75rem;
  color: var(--auth-muted-fg);
  text-align: center;
}
.auth-powered a { color: var(--color-foreground); font-weight: 650; text-decoration: none; }
.auth-powered a:hover { text-decoration: underline; }
.auth-actions {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  align-items: stretch;
  margin-top: 1.35rem;
}
.auth-link {
  display: block;
  text-align: center;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-foreground);
  text-decoration: underline;
  text-underline-offset: 3px;
  min-height: var(--touch-min);
  line-height: var(--touch-min);
  cursor: pointer;
  transition: opacity 180ms ease;
}
.auth-link:hover { opacity: 0.72; }

.auth-step-track {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 1rem;
}
.auth-step-dot {
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  display: inline-grid;
  place-items: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--color-muted-fg);
  background: var(--color-surface);
}
.auth-step-dot.is-active {
  background: var(--color-foreground);
  border-color: var(--color-foreground);
  color: var(--color-surface);
}
.auth-step-line {
  flex: 1;
  height: 1px;
  background: var(--color-border);
}
.auth-step-label {
  margin: 0 0 0.25rem;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-muted-fg);
}
.auth-step-title {
  margin: 0 0 0.9rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-foreground);
}
.auth-step-user {
  margin: 0 0 0.85rem;
  font-size: var(--text-sm);
  color: var(--color-muted-fg);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.65rem;
}
.auth-step-user strong { color: var(--color-foreground); }
.auth-change-user {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 650;
  color: var(--color-foreground);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

@media (max-width: 900px) {
  .auth-layout-split {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }
  .auth-story {
    --story-pad-x: 1.25rem;
    --story-pad-y: max(1.35rem, env(safe-area-inset-top, 0px));
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--auth-story-edge);
    justify-content: flex-start;
    gap: 1rem;
    padding-bottom: 1.25rem;
  }
  .auth-story-aura::before,
  .auth-workspace-aura::before {
    width: min(260px, 72vw);
    height: min(260px, 72vw);
    top: -40%;
    right: -32%;
  }
  .auth-story-aura::after,
  .auth-workspace-aura::after {
    width: min(200px, 60vw);
    height: min(200px, 60vw);
    left: -32%;
    bottom: -48%;
  }
  .portal-brand .logo-on-light,
  .portal-brand .logo-on-dark {
    width: min(100%, 168px);
    max-height: 80px;
  }
  .portal-brand-rule { width: min(100%, 112px); }
  .auth-story-main {
    flex: 0 0 auto;
    max-width: 22rem;
    margin: 0;
  }
  .auth-story-body {
    margin-bottom: 0; /* quote hidden on mobile */
  }
  .auth-story h1 {
    font-size: clamp(1.2rem, 5vw, 1.45rem);
    max-width: 18ch;
  }
  .story-quote,
  .auth-story-foot { display: none; }
  .auth-workspace {
    min-height: 0;
    padding: 1.25rem 1rem max(1.75rem, env(safe-area-inset-bottom, 0px));
    align-items: center;
  }
  .auth-card {
    width: min(400px, 100%);
    margin: 0 auto;
    padding: 1.4rem 1.2rem 1.15rem;
    animation-delay: 0ms;
  }
  .auth-product { font-size: 1.35rem; }
  .auth-brand-compact {
    text-align: center;
    margin-bottom: 1rem;
  }
  .auth-brand-compact .auth-logo-mobile.logo-on-light,
  .auth-brand-compact .auth-logo-mobile.logo-on-dark {
    display: none;
  }
  .auth-brand { text-align: center; }
  .auth-lead { text-align: center; }
}
@media (max-width: 380px) {
  .auth-story h1 { font-size: 1.15rem; }
  .portal-brand .logo-on-light,
  .portal-brand .logo-on-dark {
    width: min(100%, 150px);
    max-height: 72px;
  }
}

.field { display: flex; flex-direction: column; gap: var(--space-sm); }
.field label { font-size: var(--text-sm); font-weight: 600; }
.field .error { font-size: 0.75rem; color: var(--color-destructive); min-height: 1em; }
.input {
  width: 100%;
  min-height: var(--control-h);
  padding: 0 var(--space-lg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-foreground);
  font-family: inherit;
  font-size: var(--text-sm);
}
.input:focus { border-color: var(--color-accent); box-shadow: var(--shadow-focus); outline: none; }
.input.is-invalid { border-color: var(--color-destructive); }
.password-field { position: relative; display: flex; }
.password-field .input { padding-right: 44px; }
.password-toggle {
  position: absolute;
  right: 2px;
  top: 50%;
  transform: translateY(-50%);
  width: var(--touch-min);
  height: var(--touch-min);
  border: 0;
  background: transparent;
  color: var(--color-muted-fg);
  cursor: pointer;
  display: grid;
  place-items: center;
  border-radius: var(--radius-md);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--control-h);
  padding: 0 var(--space-lg);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.btn-primary { background: var(--color-accent); color: #fff; }
.btn-primary:hover { filter: brightness(0.95); }
.btn-secondary { background: var(--color-surface); color: var(--color-foreground); border-color: var(--color-border); }
.auth-page .btn-primary {
  min-height: 44px;
  background: var(--auth-cta-bg);
  color: var(--auth-cta-fg);
  border-color: var(--auth-cta-bg);
  border-radius: 10px;
  filter: none;
  transition: opacity 180ms ease, transform 160ms ease;
}
.auth-page .btn-primary:hover {
  opacity: 0.9;
  filter: none;
}
.auth-page .btn-primary:active {
  transform: scale(0.985);
}
.auth-page .field label {
  color: var(--color-foreground);
  font-weight: 600;
}
.auth-page .input {
  min-height: 44px;
  background: var(--auth-input-bg);
  color: var(--color-foreground);
  border-color: var(--auth-input-border);
  border-radius: 10px;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}
.auth-page .input:focus {
  border-color: var(--color-foreground);
  box-shadow: var(--shadow-focus);
}
.auth-page .password-toggle {
  color: var(--auth-muted-fg);
  cursor: pointer;
}
.auth-page .password-toggle:hover {
  color: var(--color-foreground);
}
@media (prefers-reduced-motion: reduce) {
  .auth-card,
  .auth-page .btn-primary { animation: none; transition: none; }
  .auth-page .btn-primary:active { transform: none; }
}
.alert { padding: 0.7rem 0.8rem; border-radius: var(--radius-md); margin-bottom: 0.75rem; font-size: var(--text-sm); }
.alert-error { background: var(--color-danger-bg); color: var(--color-destructive); }

.topbar {
  --tb-bg: #111111;
  --tb-fg: #ffffff;
  --tb-muted: #a3a3a3;
  --tb-line: #2a2a2a;
  --tb-hover: rgba(255, 255, 255, 0.08);
  --tb-active-bg: #ffffff;
  --tb-active-fg: #111111;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  min-height: 56px;
  padding: 0.5rem 1rem;
  background: var(--tb-bg);
  color: var(--tb-fg);
  border-bottom: 1px solid #111111;
  position: sticky;
  top: 0;
  z-index: 40;
}
[data-theme="dark"] .topbar {
  --tb-bg: #000000;
  --tb-line: #222222;
  border-bottom-color: var(--tb-line);
}
.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}
.topbar-left { flex: 1 1 auto; }
.topbar-right { flex: 0 0 auto; margin-left: auto; }
.topbar-brand {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  line-height: 0;
  text-decoration: none;
}
.topbar-brand img {
  display: block;
  background: transparent;
  border-radius: 0;
  height: 32px;
  width: auto;
  padding: 0;
}
.menu {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: wrap;
  padding: 2px;
  border: 1px solid var(--tb-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
}
.menu a {
  color: var(--tb-muted);
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  padding: 0.42rem 0.72rem;
  border-radius: 6px;
  border: 0;
  white-space: nowrap;
  transition: background 160ms ease, color 160ms ease;
}
.menu a:hover { color: var(--tb-fg); background: var(--tb-hover); }
.menu a.is-active {
  color: var(--tb-active-fg);
  background: var(--tb-active-bg);
}
.topbar-search {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 36px;
  padding: 0 0.65rem 0 0.7rem;
  border: 1px solid var(--tb-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--tb-muted);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}
.topbar-search:hover {
  color: var(--tb-fg);
  border-color: #555;
  background: var(--tb-hover);
}
.topbar-search-kbd {
  margin-left: 0.15rem;
  padding: 0.12rem 0.35rem;
  border: 1px solid #444;
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #bbb;
  background: #1a1a1a;
}
.user-menu { position: relative; }
.user-menu-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 36px;
  padding: 0 0.55rem 0 0.35rem;
  border: 1px solid var(--tb-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--tb-fg);
  font: inherit;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease;
}
.user-menu-toggle:hover,
.user-menu.is-open .user-menu-toggle {
  border-color: #555;
  background: var(--tb-hover);
}
.user-avatar {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  color: #111;
  font-size: 0.72rem;
  font-weight: 700;
}
.user-menu-name {
  font-size: 0.8125rem;
  font-weight: 650;
  max-width: 9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-menu-caret { opacity: 0.65; }
.user-menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 50;
  width: min(240px, calc(100vw - 1.5rem));
  padding: 0.55rem;
  border: 1px solid var(--tb-line);
  border-radius: 10px;
  background: #141414;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  color: #f5f5f5;
}
.user-menu-head {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.4rem 0.45rem 0.65rem;
  margin-bottom: 0.35rem;
  border-bottom: 1px solid #2a2a2a;
}
.user-menu-head-name { font-size: 0.875rem; font-weight: 700; }
.user-menu-head-meta { font-size: 0.7rem; color: #8a8a8a; }
.user-menu-section { padding: 0.35rem 0.25rem 0.55rem; }
.user-menu-label {
  margin: 0 0 0.4rem 0.2rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8a8a8a;
}
.user-menu-item {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 38px;
  padding: 0 0.65rem;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #f5f5f5;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.user-menu-item:hover { background: rgba(255, 255, 255, 0.08); }
.user-menu-danger {
  margin-top: 0.2rem;
  border-top: 1px solid #2a2a2a;
  border-radius: 0 0 6px 6px;
  color: #ffb4a8;
}
.theme-switch {
  display: inline-flex;
  align-items: stretch;
  width: 100%;
  padding: 2px;
  border: 1px solid #333;
  border-radius: 6px;
  background: #0d0d0d;
  gap: 2px;
}
.theme-switch-btn {
  appearance: none;
  flex: 1 1 0;
  border: 0;
  margin: 0;
  min-height: 28px;
  padding: 0 0.35rem;
  border-radius: 4px;
  background: transparent;
  color: #999;
  font: inherit;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
}
.theme-switch-btn:hover { color: #fff; }
.theme-switch-btn.is-active {
  background: #fff;
  color: #111;
}

/* Command palette (Ctrl+K) — PREP-style go-to screen */
.cmd-palette {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: start center;
  padding: 12vh 1rem 1rem;
}
.cmd-palette[hidden] { display: none !important; }
.cmd-palette-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}
.cmd-palette-card {
  position: relative;
  z-index: 1;
  width: min(520px, 100%);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-surface);
  color: var(--color-foreground);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}
.cmd-palette-title {
  margin: 0;
  padding: 0.85rem 1rem 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-muted-fg);
}
.cmd-palette-search {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.35rem 0.9rem 0.75rem;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-muted-fg);
}
.cmd-palette-search input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--color-foreground);
  font: inherit;
  font-size: 1rem;
  font-weight: 500;
  padding: 0.35rem 0;
}
.cmd-palette-search kbd {
  padding: 0.15rem 0.4rem;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--color-muted-fg);
}
.cmd-palette-list {
  max-height: min(360px, 50vh);
  overflow: auto;
  padding: 0.4rem;
}
.cmd-palette-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  min-height: 42px;
  padding: 0.45rem 0.7rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--color-foreground);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.cmd-palette-item:hover,
.cmd-palette-item.is-active {
  background: var(--color-muted);
}
.cmd-palette-item-label { font-size: 0.875rem; font-weight: 650; }
.cmd-palette-item-group {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-muted-fg);
}
.cmd-palette-empty {
  margin: 0;
  padding: 1.25rem 1rem;
  text-align: center;
  color: var(--color-muted-fg);
  font-size: var(--text-sm);
}
.cmd-palette-hint {
  margin: 0;
  padding: 0.55rem 0.9rem 0.7rem;
  border-top: 1px solid var(--color-border);
  font-size: 0.7rem;
  color: var(--color-muted-fg);
}
@media (max-width: 900px) {
  .topbar {
    flex-wrap: wrap;
    padding: 0.55rem 0.75rem;
  }
  .topbar-left {
    width: 100%;
    justify-content: space-between;
  }
  .menu {
    order: 3;
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }
  .topbar-right {
    margin-left: 0;
  }
  .topbar-search-label { display: none; }
  .user-menu-name { display: none; }
}
@media (max-width: 520px) {
  .topbar-search-kbd { display: none; }
}
.page { padding: 1.5rem 1.25rem 2.5rem; max-width: 1100px; margin: 0 auto; }
.page.page-wide {
  max-width: none;
  width: 100%;
  padding-left: clamp(1rem, 2.5vw, 2rem);
  padding-right: clamp(1rem, 2.5vw, 2rem);
  box-sizing: border-box;
}
.page-header h2 { margin: 0; font-size: clamp(1.2rem, 2vw, 1.45rem); font-weight: 700; letter-spacing: -0.02em; }
.page-header-text { min-width: 0; }
.page-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 0 0 auto;
}
.page-desc { margin: 0.3rem 0 0; color: var(--color-muted-fg); font-size: var(--text-sm); }
.page-header-row { margin-bottom: 0.35rem; }
.page-header-row .page-header-actions .btn-ghost {
  min-height: 36px;
  border-radius: 8px;
  font-weight: 650;
}

/* Companies list */
.companies-page .table-wrap { margin-top: 0.85rem; }
.companies-table-wrap { max-height: min(78vh, 820px); }
.companies-table th,
.companies-table td {
  padding: 0.55rem 0.85rem;
  vertical-align: middle;
}
.companies-table tbody tr {
  transition: background 140ms ease;
}
.companies-table tbody tr:hover {
  background: rgba(0, 0, 0, 0.035);
}
[data-theme="dark"] .companies-table tbody tr:hover {
  background: var(--pe-row-hover, #242424);
}
.companies-table .col-company {
  min-width: 14rem;
  font-weight: 400;
}
.companies-table .company-name {
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--color-foreground);
}
.companies-table .col-gstin { min-width: 10.5rem; }
.companies-table .gstin {
  display: inline-block;
  margin: 0;
  padding: 0.12rem 0.35rem;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.04);
  color: var(--color-muted-fg);
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}
[data-theme="dark"] .companies-table .gstin {
  background: rgba(255, 255, 255, 0.06);
  color: #b0b0b0;
}
.companies-table .col-import { white-space: nowrap; }
.companies-table .import-time {
  font-variant-numeric: tabular-nums;
  font-size: 0.8125rem;
  font-weight: 550;
  color: var(--color-foreground);
}
.companies-table .import-time.is-never,
.companies-table .cell-muted {
  color: var(--color-muted-fg);
  font-weight: 500;
}
.companies-table .table-empty {
  text-align: center;
  color: var(--color-muted-fg);
  padding: 1.5rem 0.85rem;
}
.companies-table td.num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  font-weight: 550;
}
@media (max-width: 900px) {
  .companies-table .col-company {
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--color-surface);
    box-shadow: 1px 0 0 var(--color-border);
  }
  .companies-table thead .col-company {
    z-index: 3;
    background: #f4f4f4;
  }
  [data-theme="dark"] .companies-table .col-company {
    background: var(--pe-row, #121212);
  }
  [data-theme="dark"] .companies-table thead .col-company {
    background: #1a1a1a;
  }
  .companies-table tbody tr:hover .col-company {
    background: #f0f0f0;
  }
  [data-theme="dark"] .companies-table tbody tr:hover .col-company {
    background: var(--pe-row-hover, #242424);
  }
}
.filters-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  margin-bottom: 1rem;
}
.filters .field { min-width: 10rem; flex: 1 1 10rem; max-width: 18rem; }
.filters-multi {
  display: grid;
  grid-template-columns: minmax(14rem, 1.4fr) minmax(10rem, 0.7fr) minmax(14rem, 1.4fr) minmax(9rem, 0.6fr);
  gap: 1rem 1.25rem;
  align-items: start;
}
.filters-multi .field {
  max-width: none;
  flex: none;
  min-width: 0;
  width: 100%;
}
.filters-multi .select-multi {
  min-height: 12rem;
  width: 100%;
}
.check-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  padding: 0.45rem 0;
}
.filters-actions-col {
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
  padding-top: 1.4rem;
  display: flex;
}
.filter-pill {
  margin: 0;
  padding: 0.35rem 0.5rem;
  background: #f4f7f8;
  border-radius: 8px;
}
.page-wide .table-wrap {
  max-height: min(75vh, 720px);
}
.page-wide .table-cross {
  max-height: none;
  overflow-x: auto;
}
.page-wide .data-table {
  width: 100%;
  min-width: 960px;
}
@media (max-width: 960px) {
  .filters-multi {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 640px) {
  .filters-multi {
    grid-template-columns: 1fr;
  }
  .filters-actions-col { padding-top: 0; }
}
.cross-card { margin-top: 0.25rem; }
.cross-head h3, .list-head h3 {
  margin: 0;
  font-size: 1rem;
  color: var(--brand-navy);
}
.cross-head .hint { margin: 0.2rem 0 0; }
.list-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 1.25rem 0 0.35rem;
}
.table-cross { margin-top: 0.75rem; }
.data-table { table-layout: fixed; }
.data-table th,
.data-table td {
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.data-table .col-grade { width: 7.5rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.data-table .col-state-sm { width: 4rem; text-align: center; }
.data-table .col-zone { width: auto; min-width: 9rem; }
.data-table .col-price,
.data-table .col-state,
.data-table .col-diff { width: 7.5rem; font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.data-table .col-date { width: 10.5rem; font-variant-numeric: tabular-nums; }
.data-table .col-circ { width: 5.5rem; }
.table-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f4f4f4;
  color: #525252;
  border-bottom-color: #e5e5e5;
}
[data-theme="dark"] .table-wrap thead th {
  background: #1a1a1a;
  color: #cfcfcf;
  border-bottom-color: #333333;
}
.table-wrap { max-height: min(70vh, 640px); }
.subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 1rem 0 1.25rem;
}
.subnav a {
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--brand-navy);
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
}
.subnav a:hover { border-color: var(--color-accent); }
.subnav a.is-active {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
}
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: flex-end;
  margin: 0.5rem 0 0.25rem;
}
.filters .field { min-width: 8rem; }
.filters-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding-bottom: 1px;
}
.table-wrap {
  margin-top: 1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  overflow: auto;
  color: var(--color-foreground);
}
table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.7rem 0.9rem; text-align: left; border-bottom: 1px solid var(--color-border); color: inherit; }
th { font-size: 0.75rem; letter-spacing: 0.03em; text-transform: uppercase; color: var(--color-muted-fg); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:last-child td { border-bottom: 0; }

.link { color: inherit; text-decoration: none; font-size: var(--text-sm); }
.link:hover { text-decoration: underline; }
.btn { border: 1px solid transparent; border-radius: 8px; padding: 0.45rem 0.8rem; font: inherit; cursor: pointer; }
.btn-primary { background: #308C94; color: #fff; }
.btn-ghost { background: #fff; border-color: var(--color-border); color: #1E4B5F; }
.btn-danger { background: #fff; border-color: #e7b4b4; color: var(--color-destructive); }
.alert-ok { background: #e7f6f4; color: #1E4B5F; }
.card { background: #fff; border: 1px solid var(--color-border); border-radius: 12px; padding: 1rem 1.1rem; margin: 1rem 0; }
.card h3 { margin: 0 0 0.6rem; font-size: 1rem; }
.mcp-head, .mcp-actions, .mcp-url-row { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.mcp-head { justify-content: space-between; }
.mcp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.radio { display: flex; gap: 0.45rem; align-items: center; margin: 0.35rem 0; }
.hint { color: var(--color-muted-fg); font-size: var(--text-sm); }
.status-on { color: #1f7a4d; }
.status-off { color: #9a6b12; }
.status-stop { color: var(--color-destructive); }
.token { margin: 0.5rem 0; padding: 0.6rem; background: #f4f7f8; border-radius: 8px; word-break: break-all; }
dialog { border: 0; border-radius: 12px; max-width: 36rem; padding: 1.2rem; }
dialog::backdrop { background: rgba(15, 42, 51, 0.45); }
@media (max-width: 720px) { .mcp-grid { grid-template-columns: 1fr; } }

.page-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.form-stack { display: flex; flex-direction: column; gap: 1rem; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem 1rem;
}
@media (max-width: 720px) {
  .form-grid { grid-template-columns: 1fr; }
}
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.select-multi {
  min-height: 12rem;
  padding: 0.4rem;
}
.field.is-muted { opacity: 0.55; }
.check {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 600;
  cursor: pointer;
}
.section-title {
  margin: 0.5rem 0 0;
  font-size: 1rem;
  color: var(--brand-navy);
}
.slab-wrap { max-height: none; }
.slab-wrap .input { min-height: 34px; }
.num-input { text-align: right; font-variant-numeric: tabular-nums; }
.scope-fieldset {
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  margin: 0;
}
.scope-fieldset legend {
  padding: 0 0.35rem;
  font-size: var(--text-sm);
  font-weight: 650;
  color: var(--brand-navy);
}
.textarea {
  min-height: 5rem;
  padding: 0.55rem 0.75rem;
  resize: vertical;
  font-family: inherit;
}

.data-table .col-disc,
.data-table .col-net { width: 7.5rem; }
/* Tip panel is portaled to body so table overflow:auto cannot clip it */
.data-table td.col-disc {
  overflow: visible;
}
.disc-tip {
  position: relative;
  display: inline-block;
}
.disc-tip-trigger,
.col-disc .num {
  color: var(--brand-navy);
  font-weight: 600;
}
.disc-tip-trigger {
  cursor: help;
  border-bottom: 1px dotted var(--color-accent);
}
.disc-tip-trigger small,
.col-disc .num small {
  font-weight: 500;
  color: var(--color-muted-fg);
}
/* Keep source markup hidden; floating clone (#disc-tip-float) is shown */
.disc-tip > .disc-tip-panel {
  display: none !important;
}
.disc-tip-panel,
#disc-tip-float.disc-tip-panel {
  display: none;
  position: fixed;
  z-index: 4000;
  min-width: 16rem;
  max-width: min(22rem, 80vw);
  max-height: 16rem;
  overflow: auto;
  padding: 0.65rem 0.75rem;
  background: #0F2A33;
  color: #E8F0F2;
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(15, 42, 51, 0.28);
  text-align: left;
  font-size: 0.75rem;
  line-height: 1.4;
  font-weight: 400;
  white-space: normal;
  pointer-events: auto;
}
#disc-tip-float.disc-tip-panel.is-open {
  display: block;
}
.disc-tip-block + .disc-tip-block {
  margin-top: 0.65rem;
  padding-top: 0.65rem;
  border-top: 1px solid rgba(232, 240, 242, 0.2);
}
.disc-tip-block strong { color: #fff; }
.col-net strong { color: var(--brand-navy); }

/* —— PE workspace (black & white, simple) —— */
.pe-body {
  --pe-ink: #111111;
  --pe-muted: #666666;
  --pe-line: #dddddd;
  --pe-soft: #f5f5f5;
  --pe-white: #ffffff;
  --pe-canvas: #ffffff;
  --pe-row: #ffffff;
  --pe-row-alt: #fafafa;
  --pe-row-hover: #f0f0f0;
  --pe-hero-bg: #111111;
  --pe-hero-fg: #ffffff;
  --pe-hero-muted: #bbbbbb;
  --pe-hero-line: #444444;
  background: var(--pe-canvas);
  color: var(--pe-ink);
}
[data-theme="dark"] .pe-body,
[data-theme="dark"] body {
  --pe-ink: #f2f2f2;
  --pe-muted: #a0a0a0;
  --pe-line: #333333;
  --pe-soft: #1a1a1a;
  --pe-white: #121212;
  --pe-canvas: #0d0d0d;
  --pe-row: #121212;
  --pe-row-alt: #1a1a1a;
  --pe-row-hover: #242424;
  --pe-hero-bg: #000000;
  --pe-hero-fg: #ffffff;
  --pe-hero-muted: #9a9a9a;
  --pe-hero-line: #444444;
  --color-background: #0d0d0d;
  --color-surface: #121212;
  --color-foreground: #f2f2f2;
  --color-muted: #1f1f1f;
  --color-muted-fg: #a0a0a0;
  --color-border: #333333;
  background: var(--pe-canvas);
  color: var(--pe-ink);
}
[data-theme="dark"] .page-desc,
[data-theme="dark"] .hint { color: var(--pe-muted); }
[data-theme="dark"] .table-wrap,
[data-theme="dark"] .card,
[data-theme="dark"] .filters-card {
  background: var(--pe-white);
  border-color: var(--pe-line);
}
[data-theme="dark"] th { color: var(--pe-muted); }
[data-theme="dark"] th,
[data-theme="dark"] td {
  border-bottom-color: var(--pe-line);
  color: var(--pe-ink);
}
[data-theme="dark"] tbody tr { background: var(--pe-row); }
[data-theme="dark"] tbody tr:nth-child(even) { background: var(--pe-row-alt); }
[data-theme="dark"] tbody tr:hover { background: var(--pe-row-hover); }
[data-theme="dark"] .btn-ghost {
  background: var(--pe-white);
  border-color: var(--pe-line);
  color: var(--pe-ink);
}
[data-theme="dark"] .btn-primary {
  background: #fff;
  border-color: #fff;
  color: #111;
}
[data-theme="dark"] .subnav a.is-active {
  background: #fff;
  color: #111;
  border-color: #fff;
}
[data-theme="dark"] .input {
  background: #1a1a1a;
  border-color: #333;
  color: #f2f2f2;
}
[data-theme="dark"] .alert-ok {
  background: #1a2a22;
  color: #b8e0c8;
}
[data-theme="dark"] .token {
  background: #1a1a1a;
  color: #f2f2f2;
}
.pe-page { padding-top: 1.1rem; }
.pe-hero {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1.1rem 1.75rem;
  margin-bottom: 0.35rem;
  padding: 1.15rem 1.25rem;
  background: var(--pe-hero-bg);
  color: var(--pe-hero-fg);
  border: 1px solid var(--pe-hero-bg);
  border-radius: 6px;
}
.pe-kicker {
  margin: 0 0 0.3rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--pe-hero-muted);
}
.pe-hero h1 {
  margin: 0;
  font-size: clamp(1.25rem, 2vw, 1.55rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--pe-hero-fg);
}
.pe-lead {
  margin: 0.4rem 0 0;
  max-width: 36rem;
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--pe-hero-muted);
}
.pe-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.8rem;
}
.pe-hero-btn,
.pe-hero-btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 0.85rem;
  border-radius: 4px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
}
.pe-hero-btn {
  background: #ffffff;
  color: #111111;
  border-color: #ffffff;
}
.pe-hero-btn:hover { background: #f0f0f0; }
.pe-hero-btn-ghost {
  background: transparent;
  border-color: #888888;
  color: #ffffff;
}
.pe-hero-btn-ghost:hover { border-color: #ffffff; }
.pe-filter-panel-simple .pe-simple-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1rem;
  align-items: flex-end;
}
.pe-simple-filter .field { flex: 1 1 16rem; max-width: 28rem; }
.pe-simple-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding-bottom: 1px;
}
.pe-upload-form {
  max-width: 28rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.pe-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: stretch;
}
.pe-stat {
  min-width: 7rem;
  padding: 0.6rem 0.8rem;
  background: transparent;
  border: 1px solid var(--pe-hero-line);
  border-radius: 4px;
}
.pe-stat-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--pe-hero-muted);
}
.pe-stat-value {
  display: block;
  margin-top: 0.15rem;
  font-size: 1.25rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--pe-hero-fg);
}
.pe-stat-value-sm {
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.35;
  max-width: 12rem;
}

.pe-page .subnav {
  margin: 0.85rem 0 1rem;
  gap: 0.25rem;
  padding: 0;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--pe-line);
  border-radius: 0;
  backdrop-filter: none;
}
.pe-page .subnav a {
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--pe-muted);
  margin-bottom: -1px;
}
.pe-page .subnav a:hover {
  color: var(--pe-ink);
  border-color: transparent;
}
.pe-page .subnav a.is-active {
  background: transparent;
  color: var(--pe-ink);
  border-bottom-color: var(--pe-ink);
  box-shadow: none;
  font-weight: 700;
}

.pe-page .btn-primary,
.pe-body .btn-primary {
  background: var(--pe-ink);
  border-color: var(--pe-ink);
  color: var(--pe-canvas);
}
.pe-page .btn-primary:hover,
.pe-body .btn-primary:hover {
  filter: none;
  opacity: 0.92;
}
[data-theme="dark"] .pe-page .btn-primary,
[data-theme="dark"] .pe-body .btn-primary {
  background: #ffffff;
  border-color: #ffffff;
  color: #111111;
}
.pe-page .btn-ghost,
.pe-body .btn-ghost {
  background: var(--pe-white);
  border-color: var(--pe-line);
  color: var(--pe-ink);
}
.pe-page .input:focus,
.pe-body .input:focus {
  border-color: var(--pe-ink);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.08);
}
.pe-page .col-net strong,
.pe-body .col-net strong { color: var(--pe-ink); }
.pe-body .disc-tip-trigger { color: var(--pe-ink); border-bottom-color: #888888; }
.pe-body .disc-tip-panel,
.pe-body #disc-tip-float.disc-tip-panel {
  background: var(--pe-ink);
  color: #eeeeee;
  border-radius: 4px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.pe-filter-panel {
  background: var(--pe-white);
  border: 1px solid var(--pe-line);
  border-radius: 6px;
  padding: 1rem 1.1rem 1.15rem;
  margin-bottom: 1rem;
  box-shadow: none;
}
.pe-filter-head {
  margin-bottom: 0.85rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--pe-line);
}
.pe-filter-head h2 {
  margin: 0;
  font-size: 1rem;
  color: var(--pe-ink);
}
.pe-filter-head p {
  margin: 0.25rem 0 0;
  color: var(--pe-muted);
  font-size: var(--text-sm);
}
.pe-filter-grid {
  display: grid;
  grid-template-columns: minmax(14rem, 1.35fr) minmax(11rem, 0.85fr) minmax(14rem, 1.35fr) minmax(10rem, 0.7fr);
  gap: 1rem 1.25rem;
  align-items: start;
}
.pe-filter-label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: var(--text-sm);
  font-weight: 650;
  color: var(--pe-ink);
}
.pe-search {
  margin-bottom: 0.45rem;
}
.pe-filter-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}
.pe-filter-label-row .pe-filter-label { margin-bottom: 0; }
.pe-mini-actions {
  display: flex;
  gap: 0.55rem;
}
.pe-link-btn {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 650;
  color: var(--pe-ink);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.pe-link-btn:hover { color: #000000; }
.pe-check-list {
  min-height: 12.5rem;
  max-height: 14rem;
  overflow: auto;
  width: 100%;
  border: 1px solid var(--pe-line);
  border-radius: 4px;
  background: var(--pe-soft);
  padding: 0.2rem;
}
.pe-check-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.4rem 0.55rem;
  border-radius: 3px;
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: 550;
  color: var(--pe-ink);
  user-select: none;
}
.pe-check-item:hover { background: var(--pe-row-hover); }
.pe-check-item:has(input:checked) {
  background: var(--pe-ink);
  color: var(--pe-canvas);
  font-weight: 650;
}
[data-theme="dark"] .pe-check-item:has(input:checked) {
  background: #ffffff;
  color: #111111;
}
.pe-check-item input {
  width: 1rem;
  height: 1rem;
  accent-color: #111111;
  flex: 0 0 auto;
}
.pe-check-item[hidden] { display: none !important; }
.pe-filter-hint {
  margin: 0.4rem 0 0;
  font-size: 0.75rem;
  color: var(--pe-muted);
}
.pe-state-toggles {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.pe-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--pe-line);
  border-radius: 4px;
  background: var(--pe-soft);
  cursor: pointer;
  transition: border-color var(--motion), background var(--motion), color var(--motion);
}
.pe-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.pe-toggle span { font-size: var(--text-sm); color: var(--pe-muted); }
.pe-toggle strong {
  font-size: 0.95rem;
  color: var(--pe-ink);
}
.pe-toggle.is-on {
  background: var(--pe-ink);
  border-color: var(--pe-ink);
  box-shadow: none;
}
.pe-toggle.is-on span { color: #aaaaaa; }
.pe-toggle.is-on strong { color: var(--pe-white); }
.pe-filter-actions {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding-top: 1.55rem;
}
.pe-btn-apply {
  min-height: 40px;
  box-shadow: none;
}
.pe-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.25rem;
}
.pe-chip {
  display: inline-flex;
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  background: var(--pe-soft);
  border: 1px solid var(--pe-line);
  color: var(--pe-ink);
  font-size: 0.72rem;
  font-weight: 650;
}

.pe-panel {
  background: var(--pe-white);
  border: 1px solid var(--pe-line);
  border-radius: 6px;
  padding: 1rem 1.1rem 1.1rem;
  margin-bottom: 1rem;
  box-shadow: none;
}
.pe-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 0.85rem;
}
.pe-panel-head h2 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--pe-ink);
}
.pe-panel-meta {
  margin: 0.25rem 0 0;
  font-size: var(--text-sm);
  color: var(--pe-muted);
}
.pe-panel-disc {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  padding: 0.4rem 0.65rem;
  background: var(--pe-soft);
  border: 1px solid var(--pe-line);
  border-radius: 4px;
}
.pe-panel-disc-label,
.pe-panel-disc-unit {
  font-size: 0.75rem;
  color: var(--pe-muted);
  font-weight: 600;
}
.pe-count-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.65rem;
  border-radius: 3px;
  background: var(--pe-ink);
  color: var(--pe-white);
  font-size: 0.75rem;
  font-weight: 650;
}
.pe-table-wrap {
  margin-top: 0;
  border-radius: 4px;
  border-color: var(--pe-line);
  background: var(--pe-row);
  color: var(--pe-ink);
}
.pe-table {
  color: var(--pe-ink);
}
.pe-table thead th {
  background: var(--pe-soft);
  font-weight: 650;
  color: var(--pe-muted);
}
.pe-table tbody td {
  color: var(--pe-ink);
  background: transparent;
}
.pe-table tbody tr {
  background: var(--pe-row);
  transition: background var(--motion);
}
.pe-table tbody tr:hover {
  background: var(--pe-row-hover);
}
.pe-table tbody tr:nth-child(even) {
  background: var(--pe-row-alt);
}
.pe-table tbody tr:nth-child(even):hover {
  background: var(--pe-row-hover);
}
.pe-grade-link {
  font-weight: 650;
  color: var(--pe-ink);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.pe-badge {
  display: inline-flex;
  min-width: 2.1rem;
  justify-content: center;
  padding: 0.15rem 0.45rem;
  border-radius: 3px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  border: 1px solid var(--pe-line);
}
.pe-badge-mh {
  background: var(--pe-ink);
  border-color: var(--pe-ink);
  color: var(--pe-white);
}
.pe-badge-gj {
  background: var(--pe-white);
  border-color: var(--pe-ink);
  color: var(--pe-ink);
}
.pe-net {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 3px;
  background: var(--pe-ink);
  color: var(--pe-white);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.pe-empty {
  text-align: center;
  color: var(--pe-muted);
  padding: 1.5rem !important;
}
.pe-page .muted { color: var(--pe-muted); font-size: 0.85rem; }
.pe-state-head { text-align: center !important; }

/* Registers (sales / purchase) — quiet ledger */
.pe-filter-dates .pe-date-row,
.pe-text-filters {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.pe-date-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--pe-muted);
}
.pe-date-field .input { font-weight: 500; color: var(--pe-ink); }
.pe-table tfoot th {
  background: var(--pe-soft);
  position: sticky;
  bottom: 0;
  z-index: 1;
  font-size: 0.8rem;
}

.reg-body .pe-hero {
  animation: reg-rise 420ms ease-out both;
}
.reg-kind-badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 0.85rem;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}
.reg-kind-purchase {
  background: #fff;
  color: #111;
  border-color: #fff;
}
.reg-subnav a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.reg-nav-mark {
  font-size: 0.85rem;
  opacity: 0.7;
}
.reg-filter {
  animation: reg-rise 480ms ease-out 40ms both;
  padding-bottom: 0;
}
.reg-filter-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}
.reg-filter-head h2 { margin: 0; }
.reg-view-switch {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.25rem;
  border: 1px solid var(--pe-line);
  border-radius: 6px;
  background: var(--pe-soft);
}
.reg-view-opt {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 36px;
  padding: 0 0.7rem;
  border-radius: 4px;
  cursor: pointer;
  user-select: none;
  border: 1px solid transparent;
  color: var(--pe-muted);
  transition: background var(--motion), color var(--motion), border-color var(--motion);
}
.reg-view-opt input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.reg-view-code {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  opacity: 0.75;
}
.reg-view-name {
  font-size: var(--text-sm);
  font-weight: 650;
}
.reg-view-opt.is-on {
  background: var(--pe-ink);
  border-color: var(--pe-ink);
  color: var(--pe-white);
}
.reg-view-opt.is-on .reg-view-code { opacity: 0.85; color: #ddd; }
.reg-filter-grid {
  display: grid;
  grid-template-columns: minmax(14rem, 1fr) minmax(16rem, 1.15fr) minmax(16rem, 1.15fr);
  gap: 0.85rem;
  margin-top: 0.25rem;
}
.reg-filter-card {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.85rem;
  border: 1px solid var(--pe-line);
  border-radius: 6px;
  background: var(--pe-soft);
  min-height: 100%;
}
.reg-card-title {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--pe-ink);
}
.reg-date-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}
.reg-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin: 0.95rem -1.1rem 0;
  padding: 0.85rem 1.1rem;
  border-top: 1px solid var(--pe-line);
  background: var(--pe-soft);
  border-radius: 0 0 6px 6px;
}
[data-theme="dark"] .reg-kind-badge {
  border-color: rgba(255, 255, 255, 0.35);
  color: #fff;
}
[data-theme="dark"] .reg-kind-purchase {
  background: #fff;
  color: #111;
  border-color: #fff;
}
.reg-filter-bar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.reg-filter-bar .pe-btn-apply {
  min-width: 9.5rem;
}
.reg-empty-panel {
  animation: reg-rise 520ms ease-out 80ms both;
}
.reg-empty {
  text-align: center;
  padding: 2.5rem 1.25rem 2.75rem;
  max-width: 28rem;
  margin: 0 auto;
}
.reg-empty-mark {
  display: inline-grid;
  place-items: center;
  width: 3.25rem;
  height: 3.25rem;
  margin-bottom: 0.85rem;
  border-radius: 50%;
  border: 1px solid var(--pe-line);
  background: var(--pe-soft);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--pe-ink);
}
.reg-empty h2 {
  margin: 0 0 0.4rem;
  font-size: 1.25rem;
  color: var(--pe-ink);
}
.reg-empty p {
  margin: 0 0 1.15rem;
  color: var(--pe-muted);
  font-size: var(--text-sm);
  line-height: 1.55;
}
.reg-empty-inline {
  padding: 2rem 1rem;
}
.reg-results {
  animation: reg-rise 520ms ease-out 60ms both;
}
.reg-result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}
.reg-amount-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.65rem;
  border-radius: 3px;
  border: 1px solid var(--pe-line);
  background: var(--pe-soft);
  color: var(--pe-ink);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.78rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.reg-table-wrap {
  max-height: min(70vh, 720px);
  overflow: auto;
}
.reg-table {
  font-variant-numeric: tabular-nums;
}
.reg-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #111;
  color: #ddd;
  border-bottom-color: #111;
  letter-spacing: 0.04em;
}
.reg-table tbody td {
  vertical-align: middle;
}
.reg-table tbody tr {
  animation: reg-row-in 280ms ease-out both;
}
.reg-table tbody tr:nth-child(1) { animation-delay: 20ms; }
.reg-table tbody tr:nth-child(2) { animation-delay: 40ms; }
.reg-table tbody tr:nth-child(3) { animation-delay: 60ms; }
.reg-table tbody tr:nth-child(4) { animation-delay: 80ms; }
.reg-table tbody tr:nth-child(5) { animation-delay: 100ms; }
.reg-table tbody tr:nth-child(6) { animation-delay: 120ms; }
.reg-table tbody tr:nth-child(7) { animation-delay: 140ms; }
.reg-table tbody tr:nth-child(8) { animation-delay: 160ms; }
.reg-date,
.reg-vno,
.reg-mono,
.reg-grade {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.8rem;
  font-weight: 500;
}
.reg-grade { font-weight: 650; }
.reg-type {
  display: inline-flex;
  padding: 0.12rem 0.4rem;
  border: 1px solid var(--pe-line);
  border-radius: 3px;
  background: var(--pe-soft);
  color: var(--pe-ink);
  font-size: 0.72rem;
  font-weight: 650;
  white-space: nowrap;
}
[data-theme="dark"] .reg-type {
  background: #000000;
  border-color: #444444;
  color: #f2f2f2;
}
[data-theme="dark"] .reg-table thead th {
  background: #000000;
  color: #cfcfcf;
  border-bottom-color: #000000;
}
[data-theme="dark"] .reg-table tfoot th {
  background: #1a1a1a;
  color: #f2f2f2;
  border-top: 1px solid #333;
}
[data-theme="dark"] .reg-amount-pill {
  background: #1a1a1a;
  border-color: #444;
  color: #f2f2f2;
}
[data-theme="dark"] .pe-count-pill {
  background: #ffffff;
  color: #111111;
}
[data-theme="dark"] .pe-chip {
  background: #1a1a1a;
  border-color: #444;
  color: #f2f2f2;
}
[data-theme="dark"] .pe-panel,
[data-theme="dark"] .pe-filter-panel,
[data-theme="dark"] .reg-filter-card {
  background: #121212;
  border-color: #333;
}
[data-theme="dark"] .reg-filter-bar {
  background: #1a1a1a;
  border-top-color: #333;
}
.reg-amt {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.reg-table tfoot th.reg-amt {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.85rem;
}

@keyframes reg-rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes reg-row-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .reg-body .pe-hero,
  .reg-filter,
  .reg-empty-panel,
  .reg-results,
  .reg-table tbody tr { animation: none; }
}

@media (max-width: 960px) {
  .pe-filter-grid {
    grid-template-columns: 1fr 1fr;
  }
  .reg-filter-grid { grid-template-columns: 1fr 1fr; }
  .reg-filter-card:first-child { grid-column: 1 / -1; }
  .pe-filter-actions { padding-top: 0; grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; }
}
.s12-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  align-items: stretch;
}
.s12-filter-actions {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-width: 12rem;
  justify-content: flex-end;
}
.s12-kpis {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.35rem;
}
.s12-kpi {
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--pe-line);
  border-radius: 4px;
  background: var(--pe-soft);
}
.s12-kpi-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--pe-muted);
}
.s12-kpi strong {
  display: block;
  margin-top: 0.15rem;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 1.05rem;
  color: var(--pe-ink);
}
.s12-chart {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 0.45rem;
  align-items: end;
  min-height: 220px;
  padding: 0.5rem 0.25rem 0.25rem;
}
.s12-bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  min-width: 0;
}
.s12-bar-track {
  width: 100%;
  height: 160px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  border-radius: 4px 4px 0 0;
  background: var(--pe-soft);
  border: 1px solid var(--pe-line);
  border-bottom: 0;
  padding: 0 18%;
}
.s12-bar {
  width: 100%;
  min-height: 2px;
  border-radius: 3px 3px 0 0;
  background: var(--pe-ink);
  transition: height 280ms ease;
}
[data-theme="dark"] .s12-bar { background: #ffffff; }
.s12-bar-val {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--pe-ink);
  text-align: center;
  line-height: 1.2;
  min-height: 1.6em;
}
.s12-bar-label {
  font-size: 0.68rem;
  font-weight: 650;
  color: var(--pe-ink);
  text-align: center;
  white-space: nowrap;
}
.s12-bar-count {
  font-size: 0.62rem;
  color: var(--pe-muted);
  text-align: center;
}
.s12-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  align-items: start;
}

@media (max-width: 960px) {
  .s12-chart { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .s12-split { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .pe-filter-grid { grid-template-columns: 1fr; }
  .reg-filter-grid { grid-template-columns: 1fr; }
  .reg-filter-card:first-child { grid-column: auto; }
  .reg-filter-head { flex-direction: column; }
  .reg-view-switch { width: 100%; }
  .reg-view-opt { flex: 1 1 auto; justify-content: center; }
  .reg-filter-bar { flex-direction: column; align-items: stretch; }
  .reg-filter-bar-actions { width: 100%; }
  .reg-filter-bar-actions .btn { flex: 1; }
  .pe-hero { padding: 1rem; }
  .s12-chart { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
