/* Capital Production Suite — logo-aligned shell (Roboto, elevation, cyan-blue primary) */
:root {
  /* Force dark-native controls regardless of OS/browser default theme. */
  color-scheme: dark;

  /* Capital Modern Palette */
  --accent: #00b6e6; 
  --accent-glow: rgba(0, 182, 230, 0.15);
  
  /* Breathable Neutrals */
  --bg-body: #06080b;
  --surface: #0e1117;
  --surface-variant: #161a23;
  --surface-elevated: #1e242f;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  /* Refined Glassmorphism */
  --glass-bg: rgba(14, 17, 23, 0.6);
  --glass-border: rgba(255, 255, 255, 0.05);
  --glass-blur: 16px;

  /* Layout & Spacing (Breathable) */
  --border-radius-sm: 6px;
  --border-radius-md: 12px;
  --border-radius-lg: 18px;
  --border-radius-xl: 32px;
  
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.12);
  --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 20px 40px -12px rgba(0, 0, 0, 0.4);

  /* Typography */
  --font-sans: "Inter", system-ui, sans-serif;
  --font-display: "Outfit", var(--font-sans);
  
  --cps-chrome-header-height: 64px;
  --cps-layout-gutter-inline: 48px; /* More padding */
  --cps-layout-content-max: 1440px; /* More focused width */

  /* Global app footer — one compact strip everywhere */
  --cps-footer-pad-y: 0.22rem;
  --cps-footer-min-height: 36px;

  --space-1: 6px;
  --space-2: 12px;
  --space-3: 18px;
  --space-4: 24px;
  --space-5: 36px;
  --space-6: 48px;

  /* Animation */
  --transition-fast: 200ms cubic-bezier(0.2, 0, 0, 1);
  --transition-normal: 400ms cubic-bezier(0.2, 0, 0, 1);
}

[data-admin-users-banner="ok"] {
  color: var(--accent);
}

[data-admin-users-banner="err"] {
  color: #c02627;
}

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

html {
  height: 100%;
  text-size-adjust: 100%;
  font-size: 16px; /* 1rem baseline — production-readable minimum across app */
  background-color: #000000;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body.cps-app {
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  color-scheme: dark;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  background-color: var(--bg-body);
  background-image: 
    radial-gradient(at 0% 0%, hsla(var(--accent-h), var(--accent-s), var(--accent-l), 0.05) 0px, transparent 50%),
    radial-gradient(at 100% 0%, hsla(var(--accent-h), var(--accent-s), var(--accent-l), 0.03) 0px, transparent 50%);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Post-login UX baseline: keep one visual system across app pages. */
body.cps-app:not(.cps-login-page) {
  --accent-h: 217;
  --accent-s: 89%;
  --accent-l: 61%;
  --accent-rgb: 66, 133, 244;
  --bg-body: #000000;
  --surface: #0f1115;
  --surface-variant: #171b23;
  --surface-elevated: #1b2230;
  --outline: #2b303d;
  --input-border: #3a4252;
  --text-main: #f3f6ff;
  --text-muted: #b5c0d4;
  --text-dim: #8b96ad;
  --label-secondary: #d7dfef;
  background-image: none;
}

body.cps-app:not(.cps-login-page) h1,
body.cps-app:not(.cps-login-page) h2,
body.cps-app:not(.cps-login-page) h3 {
  font-family: var(--font-display);
  letter-spacing: -0.01em;
}

body.cps-app:not(.cps-login-page) p,
body.cps-app:not(.cps-login-page) label,
body.cps-app:not(.cps-login-page) input,
body.cps-app:not(.cps-login-page) select,
body.cps-app:not(.cps-login-page) textarea,
body.cps-app:not(.cps-login-page) button,
body.cps-app:not(.cps-login-page) a {
  font-family: var(--font-sans);
}

/* Keep authenticated screens on a solid homepage-like background. */
.cps-gemini-bg {
  z-index: -1;
}


/* Match footer color to solid page background after login. */
body.cps-app:not(.cps-login-page) .cps-dash-footer,
body.cps-app:not(.cps-login-page) .cps-tool-footer,
body.cps-app:not(.cps-login-page) .admin-hub__footer.cps-dash-footer,
body.cps-app:not(.cps-login-page) .cps-tool-footer.admin-hub__footer {
  background: var(--bg-body) !important;
}

/* Production floor — larger tool chrome type (post-login) */
body.cps-app:not(.cps-login-page) .cps-premium-header__title {
  font-size: 1.25rem !important;
}

body.cps-app:not(.cps-login-page) .cps-premium-session-val,
body.cps-app:not(.cps-login-page) .cps-premium-session-hud input[readonly],
body.cps-app:not(.cps-login-page) .cps-premium-hud-clock-val {
  font-size: 1rem !important;
}

body.cps-app:not(.cps-login-page) .cps-btn-link--header {
  font-size: 0.875rem;
}

body.cps-app button,
body.cps-app input,
body.cps-app select,
body.cps-app textarea {
  font: inherit;
}

/* Global keyboard focus visibility for accessibility across all pages. */
body.cps-app :is(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 85%, #ffffff 15%);
  outline-offset: 2px;
}

/* --- Screens (login flow) --- */
.cps-screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.45s ease;
  padding: clamp(1rem, 4vw, 2rem) var(--cps-layout-gutter-inline);
}

.cps-screen.is-active {
  display: flex;
  opacity: 1;
}

.cps-screen--dash,
.cps-screen--auth {
  flex-direction: column;
  align-items: stretch;
  padding: 0;
  justify-content: flex-start;
  overflow: hidden;
}

.cps-auth-bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: #000000;
  overflow: hidden;
}

/* Subtle, massive geometric accent for the enterprise look */
.cps-auth-bg::before {
  content: "";
  position: absolute;
  top: -20vh;
  right: -10vw;
  width: 70vw;
  height: 70vw;
  background: radial-gradient(circle, rgba(14, 165, 233, 0.03) 0%, transparent 70%);
  border-radius: 50%;
  z-index: 1;
}

.cps-auth-bg::after {
  content: "";
  position: absolute;
  bottom: -20vh;
  left: -10vw;
  width: 60vw;
  height: 60vw;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.04) 0%, transparent 70%);
  border-radius: 50%;
  z-index: 1;
}

/* Hide old meshes */
.cps-auth-bg__mesh {
  display: none;
}

.cps-demo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-top: 1rem;
}

.cps-demo-grid .cps-btn-secondary {
  min-height: 2.5rem;
  font-size: 0.8125rem;
  padding: 0;
}

/* Login / QR: sticky chrome + scrollable card area */

.cps-auth-header {
  flex: 0 0 var(--cps-auth-header-height);
  height: var(--cps-auth-header-height);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--cps-layout-gutter-inline);
  background: var(--glass-header);
  border-bottom: 1px solid var(--outline);
  position: sticky;
  top: 0;
  z-index: 60;
}

.cps-auth-header__title {
  font-family: var(--font-display);
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-main);
  letter-spacing: 0;
}

.cps-screen-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem var(--cps-layout-gutter-inline);
}

.cps-auth-footer {
  flex: 0 0 auto;
  min-height: var(--cps-auth-footer-height);
  height: auto;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.65rem var(--cps-layout-gutter-inline);
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-muted);
  background: var(--glass-header);
  border-top: 1px solid var(--outline);
  position: sticky;
  bottom: 0;
  z-index: 59;
}

.cps-auth-footer .cps-footer-hud__line {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.cps-auth-footer .cps-warning {
  display: block;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: 0.03em;
  font-size: 0.62rem;
}


/* --- Auth / login card (Material surface + elevation) --- */
.cps-glass-card {
  background: var(--surface);
  border-radius: var(--border-radius-lg);
  border: 1px solid var(--outline);
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.cps-login-card {
  width: min(100%, 460px);
  padding: 3.5rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  background: var(--surface);
  border-radius: 24px;
  border: 1px solid var(--surface-variant);
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.08);
  position: relative;
  overflow: hidden;
  animation: cps-fade-in 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 10;
}

.cps-gemini-auth.is-active {
  display: flex !important;
  flex-direction: column !important;
  justify-content: center;
  align-items: center;
  width: 100vw;
  height: 100vh;
  padding: 2rem !important;
  background: #000000;
  color: #e5e7eb;
  position: relative;
  overflow: hidden;
}

.cps-gemini-auth:not(.is-active) {
  display: none !important;
}


.cps-gemini-bg {
  position: absolute;
  bottom: -15vh;
  left: -10vw;
  width: 120vw;
  height: 60vh;
  background: linear-gradient(to right, 
    rgba(66, 133, 244, 0.6), /* Blue */
    rgba(234, 67, 53, 0.6),  /* Red */
    rgba(251, 188, 5, 0.6),  /* Yellow */
    rgba(52, 168, 83, 0.6),  /* Green */
    rgba(66, 133, 244, 0.6)  /* Blue */
  );
  background-size: 400% 100%;
  animation: shine-bg 4.5s linear infinite;
  filter: blur(90px);
  z-index: 0;
  pointer-events: none;
  -webkit-mask-image: radial-gradient(ellipse at bottom, black 0%, transparent 80%);
  mask-image: radial-gradient(ellipse at bottom, black 0%, transparent 80%);
}

@keyframes shine-bg {
  0% { background-position: 0% 100%; }
  100% { background-position: 100% 100%; }
}

.cps-gemini-top {
  position: absolute;
  top: 3rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
}

.cps-gemini-logo {
  height: 64px;
  filter: brightness(0) invert(1);
  opacity: 0.9;
  animation: float-logo 4s ease-in-out infinite alternate;
}

@keyframes float-logo {
  0% { transform: translateY(0); filter: brightness(0) invert(1) drop-shadow(0 0 10px rgba(255,255,255,0.1)); }
  100% { transform: translateY(-5px); filter: brightness(0) invert(1) drop-shadow(0 5px 15px rgba(255,255,255,0.3)); }
}

.cps-gemini-center {
  text-align: center;
  z-index: 2;
  margin-bottom: 3rem;
  animation: cps-fade-in 1s ease-out;
}

.cps-gemini-center h1 {
  font-family: var(--font-main);
  font-size: 2.5rem;
  font-weight: 400;
  color: #ffffff;
  margin: 0 0 0.5rem 0;
  letter-spacing: -0.02em;
}

.cps-animated-text {
  background: linear-gradient(to right, #4285F4, #EA4335, #FBBC05, #34A853, #4285F4);
  background-size: 200% auto;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shine-text 4s linear infinite;
  display: inline-block;
  font-weight: 700;
}

@keyframes shine-text {
  to {
    background-position: 200% center;
  }
}

.cps-gemini-center p {
  font-size: 1.25rem;
  color: #9ca3af;
  font-weight: 300;
  margin: 0;
}

.cps-login-tagline-fade {
  transition: opacity 0.5s ease;
}

.cps-festival-banner {
  margin-top: 0.9rem !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.38rem 0.78rem;
  border-radius: 999px;
  border: 1px solid rgba(74, 222, 128, 0.55);
  background: rgba(34, 197, 94, 0.18);
  color: #dcfce7 !important;
  font-size: 0.9rem !important;
  font-weight: 500 !important;
  line-height: 1.35;
  letter-spacing: 0.01em;
  text-shadow: none;
}

.cps-festival-banner:not([hidden])::before {
  content: "";
  width: 0.46rem;
  height: 0.46rem;
  border-radius: 999px;
  background: #4ade80;
  box-shadow: 0 0 0.55rem rgba(74, 222, 128, 0.9);
}

.cps-festival-banner[hidden] {
  display: none !important;
}

.cps-gemini-bottom {
  z-index: 2;
  width: 100%;
  max-width: 600px;
  animation: cps-fade-in 1s ease-out 0.2s both;
}

.cps-gemini-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.cps-gemini-pill {
  display: flex;
  align-items: center;
  background: #111111;
  border: 1px solid #27272a;
  border-radius: 100px;
  padding: 0.5rem 0.5rem 0.5rem 1.5rem;
  width: 100%;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  transition: border-color 0.3s, box-shadow 0.3s;
}

.cps-gemini-pill:focus-within {
  border-color: #4285F4;
  box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.2), 0 10px 30px rgba(0,0,0,0.5);
}

.cps-gemini-pill input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  color: #ffffff;
  font-family: inherit;
  font-size: 1rem;
  padding: 0.75rem 0;
  outline: none;
  width: 100%;
}

.cps-gemini-pill input::placeholder {
  color: #71717a;
}

.cps-gemini-divider {
  width: 1px;
  height: 24px;
  background: #27272a;
  margin: 0 1rem;
}

.cps-gemini-pill button {
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: #71717a; /* Subtle gray when inactive */
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  cursor: pointer;
  transition: all 0.3s ease;
  flex-shrink: 0;
  margin-right: 0.2rem;
}

.cps-gemini-pill:focus-within button {
  color: #e5e7eb; /* Lights up when form is active */
}

.cps-gemini-pill button:hover {
  background: rgba(66, 133, 244, 0.15);
  color: #4285F4; /* Google Blue highlight */
  transform: scale(1.1);
}

.cps-gemini-auth .cps-error {
  color: #EA4335; /* Google Red */
  margin-top: 1.5rem;
}

.cps-gemini-footer {
  position: absolute;
  bottom: 2rem;
  z-index: 2;
  text-align: center;
}

.cps-gemini-footer p {
  color: #ffffff;
  font-family: var(--font-display), sans-serif;
  font-size: 0.65rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  opacity: 0.85;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
  margin: 0;
}

/* QR step in login flow uses the same Gemini theme shell as main login. */
#screen-qr.cps-gemini-auth {
  justify-content: center;
  align-items: center;
}

#screen-qr .cps-screen-body {
  flex: 0 1 auto;
  width: min(100%, 720px);
  padding: 0;
  overflow: visible;
  z-index: 2;
}

#screen-qr .cps-login-card {
  width: 100%;
  max-width: 640px;
  padding: 2rem 2rem 1.6rem;
  gap: 1.2rem;
  background: #111111;
  border: 1px solid #27272a;
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.55);
}

#screen-qr .cps-login-card::after {
  display: none;
}

#screen-qr .cps-brand-header {
  margin-bottom: 0;
}

#screen-qr .cps-brand-logo--hero {
  filter: brightness(0) invert(1);
  opacity: 0.92;
}

#screen-qr .cps-logo-title {
  color: #ffffff;
}

#screen-qr .cps-logo-tagline {
  color: #9ca3af;
}

#screen-qr .cps-header-hud h2 {
  color: #ffffff;
}

#screen-qr .cps-header-hud p {
  color: #9ca3af;
}

#screen-qr .cps-qr-frame {
  background: #0a0a0a;
  border-color: #27272a;
}

#screen-qr .cps-hud-status {
  background: rgba(66, 133, 244, 0.12);
  color: #9ec4ff;
}

#screen-qr .cps-qr-json {
  background: #0a0a0a;
  border-color: #27272a;
  color: #ffffff;
}

#screen-qr .cps-qr-json::placeholder {
  color: #71717a;
}

#screen-qr .cps-btn-prime {
  width: 100%;
  min-height: 2.9rem;
}

@media (max-width: 600px) {
  .cps-gemini-center h1 { font-size: 2rem; }
  .cps-gemini-center p { font-size: 1rem; }
  .cps-gemini-pill {
    flex-direction: column;
    border-radius: 16px;
    padding: 1rem;
  }
  .cps-gemini-divider {
    width: 100%;
    height: 1px;
    margin: 1rem 0;
  }
  .cps-gemini-pill input {
    padding: 0.5rem;
  }
  .cps-gemini-pill button {
    width: 100%;
    border-radius: 8px;
    margin-top: 1rem;
  }
}

.cps-login-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

#login-credentials-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin: 0;
  padding: 0;
  border: none;
  width: 100%;
}

.cps-brand-logo {
  display: block;
  flex-shrink: 0;
  width: auto;
  height: auto;
  object-fit: contain;
}

.cps-brand-logo--full {
  max-height: 44px;
  max-width: min(100%, 260px);
}

@media (min-width: 520px) {
  .cps-brand-logo--full {
    max-height: 48px;
    max-width: 300px;
  }
}

.cps-brand-logo--hero {
  margin: 0 auto 0.85rem;
  max-height: clamp(56px, 14vw, 84px);
  max-width: min(100%, 340px);
}

.cps-logo-circle {
  display: inline-block;
  flex-shrink: 0;
  vertical-align: middle;
  object-fit: contain;
}

.cps-logo-circle--inline {
  opacity: 0.88;
}

.cps-brand-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 0.25rem;
  gap: 0.35rem;
}

a.cps-brand-header__logo-home {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  border-radius: 0.35rem;
  outline-offset: 4px;
}

a.cps-brand-header__logo-home:focus-visible {
  outline: 2px solid var(--accent);
}

a.cps-brand-header__logo-home:hover .cps-brand-logo {
  opacity: 0.94;
}

.cps-brand-header__text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.cps-logo-title {
  font-family: var(--font-display);
  font-size: 1.75rem;
  color: var(--text-main);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--text-main), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.cps-logo-tagline {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 0.5rem;
}

.cps-header-hud {
  padding-left: 1.25rem;
  border-left: 5px solid var(--accent);
  margin-bottom: 0.25rem;
}

.cps-header-hud h2 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  line-height: 1.3;
  margin: 0 0 0.5rem;
  color: var(--text-main);
}

.cps-header-hud p {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
  margin: 0;
}

.cps-input-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.cps-input-group label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 2px;
}

.cps-input-group input {
  padding: 0.75rem 1rem;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--outline);
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.9375rem;
  outline: none;
  transition: all var(--transition-fast);
  color: var(--text-main);
}

.cps-input-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-glow);
  background: rgba(255, 255, 255, 0.08);
}

.cps-btn-prime {
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
  min-height: 2.75rem;
  padding: 0.5rem var(--space-4);
  border-radius: var(--border-radius-sm);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-normal);
  box-shadow: var(--shadow-accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.cps-btn-prime:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px -4px hsla(var(--accent-h), var(--accent-s), var(--accent-l), 0.4);
}

.cps-btn-prime:active {
  transform: translateY(0);
}

.cps-btn-secondary {
  background: var(--surface);
  color: var(--text-main);
  border: 1px solid var(--outline);
  min-height: 2.75rem;
  padding: 0.5rem var(--space-4);
  border-radius: var(--border-radius-sm);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-normal);
  box-shadow: var(--shadow-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.cps-btn-secondary:hover {
  background: var(--surface-variant);
  border-color: var(--input-border);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.cps-btn-prime:focus-visible,
.cps-btn-secondary:focus-visible,
.cps-btn-link:focus-visible {
  outline: 3px solid rgba(var(--accent-rgb), 0.3);
  outline-offset: 1px;
}

.cps-btn-success {
  background: #22c55e;
}

.cps-btn-success:hover {
  background: #16a34a;
}

button.cps-btn-secondary.cps-btn-danger {
  background: #b91c1c;
}

button.cps-btn-secondary.cps-btn-danger:hover:not(:disabled) {
  background: #991b1b;
}

button.cps-btn-secondary.cps-btn-danger:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.cps-error {
  color: #dc2626;
  font-size: 0.8rem;
  font-weight: 800;
  text-align: center;
  min-height: 1.25rem;
}

.cps-login-api-hint {
  margin: 0 0 0.85rem;
  font-size: 0.72rem;
  line-height: 1.45;
  color: var(--text-muted);
  text-align: center;
  max-width: 26rem;
  align-self: center;
}

.cps-login-api-hint code {
  font-size: 0.68rem;
}

.cps-auth-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 2rem var(--cps-layout-gutter-inline);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-muted); /* Visible on light background */
  background: transparent;
  z-index: 10;
}

.cps-auth-footer .cps-warning {
  color: #ef4444;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.cps-footer-hud__line {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 500;
}

.cps-footer-hud .cps-warning {
  display: block;
  font-weight: 800;
  color: var(--text-main);
  margin-top: 0.35rem;
  letter-spacing: 0.03em;
  font-size: 0.65rem;
  text-transform: none;
}

/* QR step */
.cps-qr-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  padding: 0.5rem 0;
}

.cps-qr-frame {
  width: 180px;
  height: 180px;
  border-radius: var(--border-radius-md);
  border: 2px solid hsla(var(--accent-h), var(--accent-s), var(--accent-l), 0.3);
  position: relative;
  background: hsla(var(--accent-h), var(--accent-s), var(--accent-l), 0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 20px hsla(var(--accent-h), var(--accent-s), var(--accent-l), 0.1);
}

.cps-qr-corners {
  position: absolute;
  inset: -2px;
  pointer-events: none;
}

.cps-qr-corners::before,
.cps-qr-corners::after {
  content: "";
  position: absolute;
  width: 30px;
  height: 30px;
  border-color: var(--accent);
  border-style: solid;
  border-width: 0;
}

.cps-qr-corners::before {
  top: 0;
  left: 0;
  border-top-width: 3px;
  border-left-width: 3px;
  border-top-left-radius: var(--border-radius-md);
}

.cps-qr-corners::after {
  bottom: 0;
  right: 0;
  border-bottom-width: 3px;
  border-right-width: 3px;
  border-bottom-right-radius: var(--border-radius-md);
}

.cps-qr-laser {
  position: absolute;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, transparent, #ef4444, transparent);
  box-shadow: 0 0 15px #ef4444;
  top: 0;
  z-index: 2;
  animation: cps-scan 2.5s infinite alternate ease-in-out;
}

@keyframes cps-scan {
  from { top: 5%; }
  to { top: 95%; }
}

.cps-hud-status {
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--accent);
  letter-spacing: 0.05em;
  font-family: ui-monospace, monospace;
}

.cps-qr-json {
  width: 100%;
  min-height: 80px;
  padding: 0.75rem 1rem;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--input-border);
  font-family: ui-monospace, monospace;
  font-size: 0.8125rem;
  background: var(--surface-variant);
  color: var(--text-main);
  resize: none;
}

.cps-qr-icon-dim {
  opacity: 0.4;
}

.cps-w-full {
  width: 100%;
}

.cps-maxw-100 {
  max-width: 100px;
}

.cps-maxh-60vh {
  max-height: 60vh;
}

.cps-flex-gap-sm {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.cps-flex-1 {
  flex: 1;
}

.cps-mb-035 {
  margin-bottom: 0.35rem;
}

.cps-mb-050 {
  margin-bottom: 0.5rem;
}

.cps-mb-065 {
  margin-bottom: 0.65rem;
}

.cps-mb-085 {
  margin-bottom: 0.85rem;
}

.cps-mt-075 {
  margin-top: 0.75rem;
}

.cps-mt-085 {
  margin-top: 0.85rem;
}

/* Site directory (Settings): one value per line */
.cps-directory-textarea {
  width: 100%;
  min-height: 9rem;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  border: 1.5px solid var(--input-border);
  font-family: inherit;
  font-size: 0.85rem;
  line-height: 1.45;
  resize: vertical;
  box-sizing: border-box;
}

/* Settings: operator × tool access matrix */
.cps-access-matrix tbody tr[data-operator-tool-frozen="1"] td {
  background: rgba(255, 255, 255, 0.05);
}

.cps-access-matrix tbody tr[data-operator-tool-frozen="1"] .cps-access-matrix__name {
  font-style: italic;
}

.cps-access-matrix__hint {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.cps-access-matrix-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 0.75rem;
}

.cps-access-matrix {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  background: var(--surface);
  color: var(--text-main);
}

.cps-access-matrix th,
.cps-access-matrix td {
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--outline);
  text-align: center;
  vertical-align: middle;
}

.cps-access-matrix__name {
  text-align: left !important;
  font-weight: 700;
  white-space: nowrap;
}

.cps-access-matrix thead th {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.64rem;
  color: var(--label-secondary);
  background: var(--surface-variant);
  position: sticky;
  top: 0;
  z-index: 1;
}

.cps-access-matrix tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

.cps-access-matrix tbody tr:hover {
  background: rgba(var(--accent-rgb), 0.06);
}

.cps-access-matrix__th-actions {
  min-width: 6rem;
}

.cps-access-matrix__cell input[type="checkbox"] {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--accent);
}

.cps-access-matrix__actions {
  white-space: nowrap;
}

.cps-access-matrix__actions .cps-btn-link {
  padding: 0.35rem 0.55rem;
  font-size: 0.72rem;
}

.cps-access-matrix__legend {
  margin: 0.75rem 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.55;
}

/* Administration: cps_users table */
.cps-admin-users-table {
  min-width: 680px;
}

.cps-admin-users-table th,
.cps-admin-users-table td {
  text-align: left;
}

.cps-admin-users-table td.cps-admin-users__mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.75rem;
  line-height: 1.45;
}

.cps-admin-users__actions {
  min-width: 14rem;
  vertical-align: top;
}

.cps-admin-users__actions input[type="text"],
.cps-admin-users__actions input[type="password"],
.cps-admin-users__actions select.admin-users-role-select {
  width: 100%;
  max-width: 12rem;
  margin-bottom: 0.35rem;
  padding: 0.35rem 0.45rem;
  border-radius: 0.45rem;
  border: 1.5px solid var(--input-border);
  font-size: 0.78rem;
}

.admin-users-role-select {
  min-height: unset !important;
  resize: none;
  line-height: 1.35;
}

.admin-users-create-panel .admin-users-role-select {
  max-width: 16rem;
}

.cps-admin-users__actions .cps-btn-secondary {
  margin-top: 0.25rem;
  margin-right: 0.35rem;
}

.admin-users-scope-host {
  margin-top: 0.35rem;
}

.admin-users-scope-grids {
  margin-top: 0.45rem;
  padding: 0.5rem 0.55rem;
  border-radius: 0.5rem;
  border: 1px solid var(--input-border);
  background: rgba(248, 250, 252, 0.85);
  max-width: min(28rem, 100%);
}

.admin-users-scope-fieldset {
  margin-bottom: 0.65rem;
}

.admin-users-scope-fieldset:last-child {
  margin-bottom: 0;
}

.admin-users-scope-fieldset__legend {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--label-secondary);
  margin-bottom: 0.35rem;
}

.admin-users-scope-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
}

.admin-users-scope-item {
  display: inline-flex;
  align-items: flex-start;
  gap: 0.3rem;
  font-size: 0.74rem;
  line-height: 1.35;
  cursor: pointer;
  max-width: 100%;
}

.admin-users-scope-item input {
  margin-top: 0.12rem;
  flex-shrink: 0;
}

.admin-users-create-panel .admin-users-scope-grids {
  max-width: 100%;
}

/* Dashboard */
.cps-dashboard {
  width: 100%;
  flex: 1;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-body);
}

.cps-dash-header,
.cps-tool-topbar {
  flex: 0 0 auto;
  min-height: var(--cps-chrome-header-height);
  height: auto;
  padding: 0 var(--cps-layout-gutter-inline);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  border-bottom: 1px solid var(--outline);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.cps-dash-header__brand,
.cps-tool-topbar__brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}

.cps-dash-header .cps-brand-logo--full,
.cps-tool-topbar .cps-brand-logo--full {
  height: 32px;
  width: auto;
}

.cps-tool-session {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  background: rgba(255, 255, 255, 0.04);
  padding: 6px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
}

.cps-tool-session__field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-dim);
}

.cps-tool-session__field label {
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.625rem;
  opacity: 0.7;
}

.cps-tool-session__field input {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  font-weight: 800;
  color: var(--accent);
  width: auto;
  min-width: 3rem;
  pointer-events: none;
  font-size: 0.8125rem;
}

.cps-tool-topbar {
  z-index: 50;
}

@media (max-width: 760px) {
  .cps-dash-header,
  .cps-tool-topbar {
    flex-wrap: wrap;
    align-items: flex-start;
    padding-top: clamp(6px, 2vw, 10px);
    padding-bottom: clamp(6px, 2vw, 10px);
    gap: 10px clamp(12px, 3vw, 18px);
  }

  .cps-dash-header__brand,
  .cps-tool-topbar__brand {
    flex: 1 1 auto;
    order: 1;
    min-width: 0;
  }

  .cps-tool-topbar__actions,
  .cps-dash-header .cps-tool-topbar__actions {
    flex: 0 0 auto;
    order: 2;
    align-self: center;
    width: auto;
    margin-inline-start: auto;
  }

  .cps-tool-session {
    flex-basis: 100%;
    order: 10;
    justify-content: flex-end;
    row-gap: 0.4rem;
  }

  .cps-tool-session__field:nth-child(1) input[readonly],
  .cps-tool-session__field:nth-child(2) input[readonly],
  .cps-tool-session__field:nth-child(3) input[readonly] {
    max-width: 100%;
  }
}

@media (max-width: 480px) {
  .cps-tool-session {
    flex-direction: column;
    align-items: stretch;
  }

  .cps-tool-session__field:nth-child(1) input[readonly],
  .cps-tool-session__field:nth-child(2) input[readonly],
  .cps-tool-session__field:nth-child(3) input[readonly] {
    min-width: 0;
    width: 100%;
  }

  time.cps-header-clock {
    width: 100%;
    justify-content: center;
    white-space: normal;
  }

  time.cps-header-clock .cps-header-clock__skew {
    max-width: 100%;
  }
}

.cps-dash-header__brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  flex-shrink: 0;
}

.cps-dash-header .cps-brand-logo--full {
  display: block;
  width: auto;
  height: auto;
  max-width: min(260px, 46vw);
  max-height: min(48px, calc(var(--cps-chrome-header-height) - 18px));
  object-fit: contain;
  object-position: left center;
}

.cps-dash-main {
  flex: 1;
  overflow-y: auto;
  padding: 4rem var(--cps-layout-gutter-inline); /* Increased top padding */
  display: flex;
  flex-direction: column;
  gap: 3rem; /* More breathing room before the grid */
  width: 100%;
}

.cps-dash-intro-box {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  animation: cps-rise-soft var(--transition-normal) forwards;
}

.cps-dash-page-title {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
  margin: 0;
}

.cps-dash-page-tagline {
  font-size: 1.125rem;
  color: var(--text-muted);
  margin: 0;
}

.cps-dash-tool-empty {
  margin: 1rem 0 0;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
}

.cps-dash-repo-line {
  margin: 0.85rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 0.95rem;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}

.cps-dash-repo-line.cps-dash-repo-muted {
  color: var(--text-muted);
  font-weight: 500;
}

.cps-dash-repo-line .cps-btn-prime.cps-dash-repo-zip {
  font-size: 0.8rem;
  padding: 0.42rem 1rem;
}

.cps-app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  animation: cps-rise-soft var(--transition-normal) 100ms forwards;
}

.cps-tool-card {
  text-decoration: none;
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  padding: var(--space-5);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-radius: var(--border-radius-md);
  border: 1px solid var(--glass-outline);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
  min-height: auto;
}

.cps-tool-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent);
}

.cps-tool-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top right, hsla(var(--accent-h), var(--accent-s), var(--accent-l), 0.05), transparent 70%);
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.cps-tool-card:hover::before {
  opacity: 1;
}

.cps-tool-icon {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-variant);
  border-radius: var(--border-radius-sm);
  color: var(--accent);
  transition: all var(--transition-normal);
  margin-bottom: 0;
}

.cps-tool-card:hover .cps-tool-icon {
  background: var(--accent);
  color: #fff;
  transform: scale(1.05);
}

.cps-tool-svg {
  width: 28px;
  height: 28px;
  stroke-width: 2.25;
}

.cps-tool-info {
  border: none;
  padding: 0;
}

.cps-tool-info h3 {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.125rem;
}

.cps-tool-info p {
  font-size: 0.875rem;
  color: var(--text-dim);
  line-height: 1.5;
  margin: 0;
}

.cps-dash-footer,
.cps-tool-footer {
  flex: 0 0 auto;
  box-sizing: border-box;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.2rem 0.65rem;
  min-height: var(--cps-footer-min-height);
  max-height: none;
  padding: var(--cps-footer-pad-y) var(--cps-layout-gutter-inline);
  padding-bottom: calc(var(--cps-footer-pad-y) + env(safe-area-inset-bottom, 0px));
  text-align: left;
  font-size: 0.72rem;
  line-height: 1.3;
  color: var(--text-muted);
  background: var(--glass-header);
  border-top: 1px solid var(--outline);
  position: sticky;
  bottom: 0;
  overflow: hidden;
}

.cps-dash-footer {
  z-index: 90;
}

.cps-tool-footer {
  z-index: 40;
}

.cps-dash-footer__primary,
.cps-tool-footer__primary {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.35rem;
  flex-wrap: wrap;
  min-width: 0;
}

.cps-dash-footer strong,
.cps-tool-footer__warn {
  display: block;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 0;
  text-transform: none;
  font-size: 0.62rem;
  line-height: 1.3;
}

.cps-dash-footer.cps-footer--split,
.cps-tool-footer.cps-footer--split {
  min-height: var(--cps-footer-min-height);
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem 0.65rem;
  padding: var(--cps-footer-pad-y) var(--cps-layout-gutter-inline);
  padding-bottom: calc(var(--cps-footer-pad-y) + env(safe-area-inset-bottom, 0px));
  text-align: left;
}

.cps-footer-legal {
  margin-left: auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 0.08rem;
  text-align: right;
}

.cps-footer-legal .cps-dash-footer__primary,
.cps-footer-legal .cps-tool-footer__primary {
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 0.2rem;
  max-width: 100%;
}

.cps-footer-legal .cps-tool-footer__warn,
.cps-footer-legal > strong {
  text-align: right;
  line-height: 1.08;
  max-width: 100%;
  margin-top: 0;
}

.cps-dash-footer.cps-footer--split .cps-port-status,
.cps-tool-footer.cps-footer--split .cps-port-status {
  margin-top: 0;
  flex: 0 1 auto;
  max-width: 60%;
  min-width: 0;
  justify-content: flex-start;
  flex-wrap: nowrap;
  gap: 0.14rem;
}

.cps-dash-footer.cps-footer--split .cps-port-status__group,
.cps-tool-footer.cps-footer--split .cps-port-status__group,
.cps-dash-footer.cps-footer--split .cps-port-status__group-chips,
.cps-tool-footer.cps-footer--split .cps-port-status__group-chips {
  flex-wrap: nowrap;
  justify-content: flex-start;
  gap: 0.14rem;
}

.cps-dash-footer.cps-footer--split .cps-port-status__title,
.cps-tool-footer.cps-footer--split .cps-port-status__title {
  font-size: 0.46rem;
}

.cps-dash-footer.cps-footer--split .cps-port-status__group-label,
.cps-tool-footer.cps-footer--split .cps-port-status__group-label {
  font-size: 0.45rem;
}

.cps-dash-footer.cps-footer--split .cps-port-chip,
.cps-tool-footer.cps-footer--split .cps-port-chip {
  padding: 0.06rem 0.28rem;
  font-size: 0.5rem;
}

.cps-dash-footer.cps-footer--split .cps-port-chip::before,
.cps-tool-footer.cps-footer--split .cps-port-chip::before {
  width: 0.26rem;
  height: 0.26rem;
  margin-right: 0.18rem;
}

@media (max-width: 520px) {
  .cps-dash-footer.cps-footer--split,
  .cps-tool-footer.cps-footer--split {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.12rem;
  }

  .cps-footer-legal {
    margin-left: 0;
    align-items: center;
    text-align: center;
  }

  .cps-footer-legal .cps-dash-footer__primary,
  .cps-footer-legal .cps-tool-footer__primary {
    justify-content: center;
    flex-wrap: wrap;
  }

  .cps-footer-legal .cps-tool-footer__warn,
  .cps-footer-legal > strong {
    text-align: center;
  }

  .cps-dash-footer.cps-footer--split .cps-port-status,
  .cps-tool-footer.cps-footer--split .cps-port-status,
  .cps-dash-footer.cps-footer--split .cps-port-status__group,
  .cps-tool-footer.cps-footer--split .cps-port-status__group,
  .cps-dash-footer.cps-footer--split .cps-port-status__group-chips,
  .cps-tool-footer.cps-footer--split .cps-port-status__group-chips {
    max-width: none;
    justify-content: center;
    flex-wrap: wrap;
  }
}

.cps-port-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.2rem;
  margin-top: 0.08rem;
}

.cps-port-status__title {
  font-size: 0.52rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.cps-port-status__group {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  flex-wrap: wrap;
  justify-content: center;
}

.cps-port-status__group-label {
  font-size: 0.5rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.cps-port-status__group-chips {
  display: inline-flex;
  gap: 0.2rem;
  flex-wrap: wrap;
  justify-content: center;
}

.cps-port-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.1rem 0.36rem;
  font-size: 0.54rem;
  font-weight: 700;
  border: 1px solid var(--outline);
  background: var(--surface);
  color: var(--text-main);
  white-space: nowrap;
}

.cps-port-chip::before {
  content: "";
  width: 0.32rem;
  height: 0.32rem;
  border-radius: 50%;
  margin-right: 0.24rem;
  background: #6b7280;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.1) inset;
}

.cps-port-chip--ok {
  border-color: rgba(22, 163, 74, 0.3);
  background: rgba(22, 163, 74, 0.1);
  color: #4ade80;
}

.cps-port-chip--ok::before {
  background: #4ade80;
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.5);
}

.cps-port-chip--bad {
  border-color: rgba(220, 38, 38, 0.3);
  background: rgba(220, 38, 38, 0.1);
  color: #f87171;
}

.cps-port-chip--bad::before {
  background: #f87171;
  box-shadow: 0 0 8px rgba(248, 113, 113, 0.5);
}

/* Tool pages: viewport shell + scroll body */
.cps-page-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.cps-page-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Tool topbar brand / title (shared chrome) */
.cps-tool-topbar__brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

a.cps-tool-topbar__logo-home {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  text-decoration: none;
  color: inherit;
  border-radius: 0.35rem;
  outline-offset: 3px;
}

a.cps-tool-topbar__logo-home:focus-visible {
  outline: 2px solid var(--accent);
}

a.cps-tool-topbar__logo-home:hover .cps-logo-circle,
a.cps-tool-topbar__logo-home:hover .cps-brand-logo {
  opacity: 0.9;
}

a.cps-dash-header__logo-home {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  text-decoration: none;
  outline-offset: 3px;
}

a.cps-dash-header__logo-home:focus-visible {
  outline: 2px solid var(--accent);
}

a.cps-dash-header__logo-home:hover .cps-brand-logo {
  opacity: 0.92;
}

.cps-tool-topbar,
.cps-dash-header {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  color: var(--text-main);
  height: 72px;
  padding: 0 var(--cps-layout-gutter-inline);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--glass-outline);
  z-index: 1000;
  position: sticky;
  top: 0;
}

.cps-tool-topbar__brand {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex: 1 1 0%;
}

.cps-tool-topbar__brand .cps-brand-logo--full {
  max-height: 28px;
  /* Logo remains its native color on the white background */
}

.cps-tool-topbar__brand h1 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-main);
  margin: 0;
  letter-spacing: 0.01em;
  padding-left: 1.25rem;
  border-left: 1px solid rgba(255, 255, 255, 0.12);
}

/* Central Telemetry Pill */
.cps-tool-session {
  display: flex;
  align-items: center;
  background: #111111;
  border: 1px solid #27272a;
  border-radius: 100px;
  padding: 0.25rem 1.5rem;
  height: 48px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  flex: 0 1 auto;
}

.cps-tool-session__field {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 1.5rem;
  position: relative;
}

/* Dividers between fields */
.cps-tool-session__field:not(:last-child)::after {
  content: "";
  position: absolute;
  right: 0;
  top: 20%;
  height: 60%;
  width: 1px;
  background: var(--outline);
}

.cps-tool-session__field label {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: 2px;
}

.cps-tool-session__field input[readonly] {
  background: transparent;
  border: none;
  padding: 0;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main);
  width: auto;
  text-align: left;
}

.cps-tool-session__field:nth-child(1) input[readonly] { min-width: 120px; color: var(--accent); font-weight: 700; }
.cps-tool-session__field:nth-child(2) input[readonly] { min-width: 60px; }
.cps-tool-session__field:nth-child(3) input[readonly] { min-width: 100px; }

.cps-tool-session__field--clock {
  padding-left: 2rem;
  padding-right: 0;
}

.cps-tool-session__field--clock::after {
  display: none;
}

.cps-tool-topbar__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  flex: 1 1 0%;
  flex-wrap: wrap;
  align-self: center;
  flex-shrink: 0;
}

.cps-status-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem;
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.25);
  border-radius: 100px;
  font-size: 0.68rem;
  font-weight: 700;
  color: #4ade80;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.cps-status-indicator::before {
  content: "";
  width: 6px;
  height: 6px;
  background: #22c55e;
  border-radius: 50%;
  box-shadow: 0 0 8px #22c55e;
  animation: cps-pulse-pro 2s infinite;
}

@keyframes cps-pulse-pro {
  0% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.2); }
  100% { opacity: 1; transform: scale(1); }
}

.cps-btn-link--header {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  background: transparent;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.cps-btn-link--header:hover {
  color: var(--accent);
  background: var(--surface-variant);
  border-color: var(--outline);
}

.cps-btn-link--header svg {
  width: 16px;
  height: 16px;
}

/* Live clock — injected by assets/js/header-clock.js?v=1778476638679 */
/* Live clock */
time.cps-header-clock {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
}

/* Simple clock value used in PPFT header pill */
.cps-header-clock-value {
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  letter-spacing: 0.04em;
}

.cps-header-clock__row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cps-header-clock__label {
  font-size: 0.55rem;
  font-weight: 700;
  color: var(--text-dim);
  width: 36px;
}

.cps-header-clock__value--local,
.cps-header-clock__value--server {
  color: var(--text-muted);
}

time.cps-header-clock .cps-header-clock__value--server {
  font-variant-numeric: tabular-nums;
  min-width: 6.25rem;
  display: inline-block;
}

/* Local vs server clock skew (server authoritative; from SELECT NOW() instant) */
time.cps-header-clock .cps-header-clock__skew {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  max-width: 7rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

time.cps-header-clock .cps-header-clock__skew--warn {
  color: #b45309;
}

.cps-btn-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  border-radius: 10px;
  border: 1px solid var(--outline);
  background: var(--surface);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.875rem;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-sm);
}

.cps-btn-link:hover {
  background: var(--surface-variant);
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.cps-btn-prime {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.75rem 2rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 
    0 4px 12px hsla(var(--accent-h), var(--accent-s), var(--accent-l), 0.3),
    0 2px 4px rgba(0, 0, 0, 0.1);
}

.cps-btn-prime:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 
    0 8px 24px hsla(var(--accent-h), var(--accent-s), var(--accent-l), 0.4),
    0 4px 8px rgba(0, 0, 0, 0.1);
}

.cps-btn-prime:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.cps-btn-prime:disabled,
.cps-btn-secondary:disabled,
.cps-btn-link[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

.cps-btn-link[aria-disabled="true"] {
  pointer-events: none;
}

.cps-btn-link:hover {
  background: rgba(var(--accent-rgb), 0.08);
  border-color: rgba(var(--accent-rgb), 0.3);
  color: var(--accent-hover);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

.cps-fade-in {
  animation: cps-fade-in 0.7s ease-out forwards;
}

@keyframes cps-fade-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Site-wide motion --- */
@keyframes cps-rise-soft {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes cps-toolbar-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes cps-footer-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.cps-auth-header {
  animation: cps-toolbar-in 0.42s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.cps-dash-header,
.cps-tool-topbar {
  animation: cps-toolbar-in 0.42s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.cps-auth-footer,
.cps-dash-footer,
.cps-tool-footer {
  animation: cps-footer-in 0.48s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.cps-dash-intro-box {
  animation: cps-rise-soft 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.cps-dash-main {
  animation: cps-rise-soft 0.42s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.cps-app-grid .cps-tool-card {
  animation: cps-rise-soft 0.48s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.cps-app-grid .cps-tool-card:nth-child(1) {
  animation-delay: 0.04s;
}
.cps-app-grid .cps-tool-card:nth-child(2) {
  animation-delay: 0.09s;
}
.cps-app-grid .cps-tool-card:nth-child(3) {
  animation-delay: 0.14s;
}
.cps-app-grid .cps-tool-card:nth-child(4) {
  animation-delay: 0.19s;
}
.cps-app-grid .cps-tool-card:nth-child(5) {
  animation-delay: 0.24s;
}

body.ppft-tool .ppft-app.cps-page-body {
  animation: cps-rise-soft 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.cps-btn-prime {
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.cps-btn-prime:hover {
  transform: none;
}

.cps-btn-prime:active {
  transform: none;
}

/* --- Documentation & Kickers --- */
.cps-docs-kicker,
.cps-docs-label {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

/* --- Admin & Data View Utilities --- */
.cps-data-meta {
  font-size: 0.825rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.cps-admin-status {
  padding: 0.65rem 1rem;
  border-radius: 6px;
  margin-bottom: 1.25rem;
  border: 1px solid currentColor;
  font-weight: 700;
}

.cps-admin-status--ok {
  background: hsla(142, 70%, 45%, 0.1);
  color: #15803d;
}

.cps-admin-status--err {
  background: hsla(0, 84%, 60%, 0.1);
  color: #dc2626;
}

.cps-code-block {
  margin: 0;
  padding: 1.25rem;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: var(--border-radius-md);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.8125rem;
  line-height: 1.6;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.cps-admin-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
  margin-bottom: 1.5rem;
  padding: 1.25rem;
}

.tool-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-outline);
  border-radius: var(--border-radius-lg);
  padding: 1.5rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  flex: 1 1 300px;
  display: flex;
  flex-direction: column;
}

.cps-admin-controls label {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.cps-admin-input-group label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

input.cps-directory-textarea {
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--input-border);
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-main);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

input.cps-directory-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 
    0 0 0 4px var(--accent-glow),
    inset 0 1px 2px rgba(0, 0, 0, 0.05);
  background: var(--surface);
}

.cps-admin-input {
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--input-border);
  border-radius: var(--border-radius-sm);
  font: inherit;
  font-size: 0.875rem;
  background: var(--surface);
  transition: all 0.2s ease;
}

.cps-admin-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.cps-admin-select {
  padding: 0.625rem 2.5rem 0.625rem 0.875rem;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--input-border);
  font: inherit;
  font-size: 0.875rem;
  background: var(--surface);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
}

.cps-admin-view-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding: 0.25rem;
  background: var(--surface-variant);
  border-radius: var(--border-radius-sm);
  width: fit-content;
}

.cps-admin-view-bar button {
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.8125rem;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.cps-admin-view-bar button.is-active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

/* --- QR Scanner UI --- */
.cps-qr-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  margin: 1rem 0;
}

.cps-qr-frame {
  position: relative;
  width: 220px;
  height: 220px;
  background: rgba(15, 23, 42, 0.4);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.3);
}

.cps-qr-laser {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  box-shadow: 0 0 15px var(--accent), 0 0 30px var(--accent);
  z-index: 2;
  animation: qr-laser 3s infinite ease-in-out;
}

.cps-qr-corners {
  position: absolute;
  inset: 20px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
}

.cps-qr-corners::before,
.cps-qr-corners::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  border-color: var(--accent);
  border-style: solid;
}

.cps-qr-corners::before {
  top: -2px;
  left: -2px;
  border-width: 3px 0 0 3px;
  border-top-left-radius: 8px;
}

.cps-qr-corners::after {
  bottom: -2px;
  right: -2px;
  border-width: 0 3px 3px 0;
  border-bottom-right-radius: 8px;
}

@keyframes qr-laser {
  0%, 100% { top: 15%; opacity: 0.8; }
  50% { top: 85%; opacity: 1; }
}

.cps-hud-status {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  background: hsla(var(--accent-h), var(--accent-s), var(--accent-l), 0.1);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.cps-qr-json {
  width: 100%;
  height: 80px;
  padding: 0.75rem;
  background: rgba(15, 23, 42, 0.2);
  border: 1px solid var(--input-border);
  border-radius: 12px;
  color: var(--text-main);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.8125rem;
  resize: none;
  transition: all 0.2s ease;
}

.cps-qr-json:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(15, 23, 42, 0.3);
  box-shadow: 0 0 0 4px var(--accent-glow);
}

@media (prefers-reduced-motion: reduce) {
  .cps-auth-header,
  .cps-dash-header,
  .cps-tool-topbar,
  .cps-auth-footer,
  .cps-dash-footer,
  .cps-tool-footer,
  .cps-dash-intro-box,
  .cps-dash-main,
  .cps-app-grid .cps-tool-card,
  body.ppft-tool .ppft-app.cps-page-body,
  .tool-workbench__hero,
  .tool-panel,
  .cps-fade-in {
    animation: none !important;
    animation-delay: 0s !important;
  }

  .cps-btn-link:hover,
  .cps-btn-prime:hover,
  .cps-tool-card:hover,
  .tool-panel:hover {
    transform: none;
  }

  .cps-screen {
    transition: opacity 0.2s ease;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
  }
}

@media (max-width: 520px) {
  .cps-login-card {
    padding: 2rem 1.35rem;
  }

  .cps-tool-card {
    padding: 1.25rem 1.1rem;
  }

  .cps-tool-session__field:nth-child(1) input[readonly],
  .cps-tool-session__field:nth-child(2) input[readonly],
  .cps-tool-session__field:nth-child(3) input[readonly] {
    font-size: 0.765rem;
    padding-inline: 0.45rem;
  }

  .cps-tool-topbar h1 {
    font-size: clamp(1rem, 4.5vw, 1.2rem);
    min-height: 2rem;
    padding: 0.32rem 0.62rem;
  }
}

@media (max-width: 380px) {
  .cps-app-grid {
    grid-template-columns: 1fr;
  }

  .cps-tool-svg {
    width: 40px;
    height: 40px;
  }
}

/* ============================================================
   Session pill label with icon — standard across all tool pages
   ============================================================ */
.cps-tool-session__field label {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2px;
  min-height: 16px;
}

.cps-tool-session__field label svg {
  flex-shrink: 0;
  opacity: 0.7;
  color: var(--accent);
  transition: opacity 0.2s, transform 0.2s;
}

.cps-tool-session__field:hover label svg {
  opacity: 1;
  transform: scale(1.1);
}
/* Global premium app header — dark bar, icon session HUD, local/server clocks (PPFT-style). */

.cps-tool-topbar.cps-premium-header,
.cps-dash-header.cps-premium-header {
  height: 64px !important;
  min-height: 64px !important;
  background: rgba(10, 10, 10, 0.95) !important;
  backdrop-filter: blur(24px) !important;
  -webkit-backdrop-filter: blur(24px) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12) !important;
  padding: 0 var(--cps-layout-gutter-inline) !important;
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: space-between !important;
  box-sizing: border-box;
}

.cps-dash-header.cps-premium-header {
  width: 100%;
}

.cps-premium-header .cps-tool-topbar__brand {
  flex: 0 1 auto !important;
  min-width: 0 !important;
  max-width: min(28rem, 44vw) !important;
  display: flex !important;
  align-items: center !important;
  gap: clamp(0.5rem, 1.4vw, 0.9rem) !important;
  margin-right: clamp(0.35rem, 1.5vw, 1rem) !important;
}

.cps-premium-header a.cps-tool-topbar__logo-home,
.cps-premium-header a.cps-dash-header__logo-home {
  flex: 0 0 auto;
  align-self: center;
}

.cps-premium-header .cps-tool-topbar__brand .cps-brand-logo--full,
.cps-premium-header .cps-dash-header__logo-home .cps-brand-logo--full {
  max-height: min(36px, calc(var(--cps-chrome-header-height, 72px) - 20px)) !important;
  width: auto !important;
  display: block;
}

.cps-premium-header__title-wrap {
  margin-left: 0 !important;
  padding-left: clamp(0.65rem, 1.6vw, 1rem) !important;
  border-left: 1px solid rgba(255, 255, 255, 0.12);
  min-width: 0 !important;
  flex: 1 1 auto !important;
  display: flex !important;
  align-items: center !important;
  align-self: stretch;
  height: auto !important;
}

.cps-premium-header__title {
  font-family: var(--font-display, "Inter", system-ui, sans-serif);
  font-size: 1.15rem !important;
  font-weight: 500 !important;
  color: #fff !important;
  letter-spacing: -0.01em !important;
  margin: 0 !important;
  padding-left: 0 !important;
  border-left: none !important;
  white-space: nowrap !important;
  line-height: 1.25 !important;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cps-premium-header .cps-tool-topbar__brand h1.cps-premium-header__title {
  padding-left: 0 !important;
  border-left: none !important;
}

.cps-premium-header .cps-tool-session.cps-premium-session-hud {
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  padding: 0 !important;
  gap: 0 !important;
  box-shadow: none !important;
  display: flex !important;
  align-items: center !important;
  flex: 1 1 auto !important;
  min-width: 0 !important;
  margin-left: auto !important;
  margin-right: clamp(0.35rem, 1.2vw, 0.75rem) !important;
  justify-content: flex-end !important;
  flex-wrap: nowrap !important;
  height: auto !important;
}

.cps-premium-session-hud .cps-tool-session__field {
  padding: 0 clamp(6px, 1.2vw, 14px) !important;
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 6px !important;
  min-height: 32px !important;
  position: relative !important;
  flex: 0 0 auto !important;
  border-right: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.cps-premium-session-hud .cps-tool-session__field:last-child {
  border-right: none !important;
}

.cps-premium-hud-icon {
  color: var(--accent) !important;
  opacity: 0.75;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
}

.cps-premium-session-val,
.cps-premium-session-hud input[readonly],
.cps-premium-hud-clock-val {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.85rem !important;
  font-weight: 500 !important;
  color: rgba(255, 255, 255, 0.9) !important;
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  letter-spacing: 0;
}

.cps-premium-session-val {
  white-space: nowrap !important;
  display: inline-block !important;
}

.cps-premium-session-hud .cps-tool-session__field label {
  display: none !important;
}

.cps-premium-session-hud input[readonly] {
  width: auto !important;
  min-width: 0 !important;
  max-width: 12rem;
}

.cps-premium-session-hud .cps-header-clock {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 0.35rem !important;
  white-space: nowrap !important;
}

.cps-premium-session-hud .cps-header-clock__label,
.cps-premium-session-hud .cps-header-clock__divider {
  display: none !important;
}

.cps-premium-hud-status-badge {
  font-size: 0.65rem !important;
  font-weight: 700 !important;
  padding: 2px 7px !important;
  border-radius: 4px !important;
  margin-left: 0 !important;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  display: inline-flex !important;
  align-items: center !important;
  flex-shrink: 0;
}

.cps-premium-session-hud .cps-tool-session__field--clock:not([title]) {
  display: none !important;
}

.cps-premium-header__dash-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.cps-premium-header__dash-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.cps-premium-header__dash-btn svg {
  opacity: 0.75;
  flex-shrink: 0;
}

.cps-premium-header .cps-tool-topbar__actions {
  flex: 0 0 auto !important;
  display: flex !important;
  align-items: center !important;
  gap: 0.65rem !important;
  margin-left: 0 !important;
}

.cps-premium-header .cps-status-indicator {
  font-size: 0.62rem !important;
  padding: 4px 10px !important;
}

.cps-premium-header .cps-btn-link--header {
  color: rgba(255, 255, 255, 0.88) !important;
}

.cps-premium-header .cps-btn-link--header:hover {
  color: var(--accent) !important;
}

@media (max-width: 720px) {
  .cps-premium-header .cps-tool-topbar__brand {
    max-width: min(16rem, 52vw) !important;
    gap: 0.35rem !important;
  }

  .cps-premium-header .cps-tool-topbar__brand .cps-brand-logo--full,
  .cps-premium-header .cps-dash-header__logo-home .cps-brand-logo--full {
    max-height: 26px !important;
  }

  .cps-premium-header__title {
    font-size: 1rem !important;
  }

  .cps-premium-session-hud .cps-tool-session__field {
    padding: 0 5px !important;
  }
}

@media (max-width: 1180px) {
  .cps-premium-header .cps-tool-session.cps-premium-session-hud {
    flex-wrap: wrap !important;
    justify-content: flex-end !important;
    row-gap: 4px !important;
  }

  .cps-premium-session-hud .cps-tool-session__field {
    border-right: none !important;
    padding: 0 8px !important;
  }
}

.cps-header-clock__status--ok.cps-premium-hud-status-badge,
.cps-premium-hud-status-badge.cps-header-clock__status--ok {
  background: rgba(34, 197, 94, 0.15) !important;
  color: #4ade80 !important;
  border: 1px solid rgba(34, 197, 94, 0.3) !important;
}

.cps-header-clock__status--warn.cps-premium-hud-status-badge,
.cps-premium-hud-status-badge.cps-header-clock__status--warn {
  background: rgba(239, 68, 68, 0.25) !important;
  color: #f87171 !important;
  border: 1px solid rgba(239, 68, 68, 0.5) !important;
}

/* =============================================================================
   Production typography — 16px root on all pages; post-login UI never below ~13px
   (secondary copy / footers use 0.8125rem; micro-badges floor at 12px)
   ============================================================================= */

body.cps-app:not(.cps-login-page) .cps-dashboard,
body.cps-app:not(.cps-login-page) .cps-dash-main,
body.cps-app:not(.cps-login-page) .cps-page-body {
  font-size: 1rem;
}

body.cps-app:not(.cps-login-page) .cps-dash-page-tagline {
  font-size: 1.0625rem;
}

body.cps-app:not(.cps-login-page) .cps-tool-info h3 {
  font-size: 1.0625rem !important;
}

body.cps-app:not(.cps-login-page) .cps-tool-info p {
  font-size: 1rem !important;
  line-height: 1.55 !important;
}

body.cps-app:not(.cps-login-page) .cps-dash-footer,
body.cps-app:not(.cps-login-page) .cps-tool-footer,
body.cps-app:not(.cps-login-page) .admin-hub__footer.cps-dash-footer,
body.cps-app:not(.cps-login-page) .cps-tool-footer.admin-hub__footer {
  font-size: 0.72rem !important;
  line-height: 1.3 !important;
}

body.cps-app:not(.cps-login-page) .cps-dash-footer strong,
body.cps-app:not(.cps-login-page) .cps-tool-footer__warn {
  font-size: 0.62rem !important;
  line-height: 1.3 !important;
}

body.cps-app:not(.cps-login-page) .cps-port-chip {
  font-size: 0.8125rem !important;
}

body.cps-app:not(.cps-login-page) .cps-port-status__title,
body.cps-app:not(.cps-login-page) .cps-port-status__group-label {
  font-size: 0.8125rem !important;
}

body.cps-app:not(.cps-login-page) .cps-tool-session__field label {
  font-size: 0.8125rem !important;
}

body.cps-app:not(.cps-login-page) time.cps-header-clock {
  font-size: 0.875rem !important;
}

body.cps-app:not(.cps-login-page) time.cps-header-clock .cps-header-clock__skew {
  font-size: 0.8125rem !important;
}

body.cps-app:not(.cps-login-page) .cps-premium-hud-status-badge {
  font-size: 0.75rem !important;
}

body.cps-app:not(.cps-login-page) .cps-premium-header .cps-status-indicator {
  font-size: 0.75rem !important;
}

body.cps-app:not(.cps-login-page) .cps-premium-header__dash-btn {
  font-size: 0.9375rem !important;
}

body.cps-app:not(.cps-login-page) .cps-admin-input,
body.cps-app:not(.cps-login-page) .cps-admin-select,
body.cps-app:not(.cps-login-page) .cps-directory-textarea {
  font-size: 1rem !important;
}

body.cps-app:not(.cps-login-page) .cps-admin-controls label,
body.cps-app:not(.cps-login-page) .cps-admin-input-group label {
  font-size: 0.8125rem !important;
}

body.cps-app:not(.cps-login-page) .cps-access-matrix {
  font-size: 0.875rem !important;
}

body.cps-app:not(.cps-login-page) .cps-access-matrix thead th {
  font-size: 0.75rem !important;
}

body.cps-app:not(.cps-login-page) .cps-admin-users-table td,
body.cps-app:not(.cps-login-page) .cps-admin-users-table th {
  font-size: 0.875rem !important;
}

/* Global readability guard: keep post-login table text visible on all tools/pages. */
body.cps-app:not(.cps-login-page) table {
  color: var(--text-main);
}

body.cps-app:not(.cps-login-page) table th {
  color: var(--label-secondary);
}

/* Cross-page dark guard for any remaining light panel/table wrappers. */
body.cps-app:not(.cps-login-page) .cps-tool-sql-scroll,
body.cps-app:not(.cps-login-page) .admin-map-tools-scroll,
body.cps-app:not(.cps-login-page) .admin-map-grid-scroll,
body.cps-app:not(.cps-login-page) .admin-users-table-scroll,
body.cps-app:not(.cps-login-page) .lqp-pairs-table-wrap,
body.cps-app:not(.cps-login-page) .lqp-directory-textarea {
  background: var(--surface) !important;
  color: var(--text-main) !important;
  border-color: var(--outline) !important;
}

/* =========================================================
   THEME: DAY MODE
   ========================================================= */
body.theme-day.cps-app {
  --bg-body: #f8fafc;
  --surface: #ffffff;
  --surface-variant: #f1f5f9;
  --surface-elevated: #ffffff;
  --outline: #e2e8f0;
  --input-border: #cbd5e1;
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #64748b;
  --label-secondary: #334155;
  color-scheme: light;
  background-color: var(--bg-body);
  color: var(--text-main);
}

body.theme-day.cps-app:not(.cps-login-page) {
  --bg-body: #f8fafc;
  --surface: #ffffff;
  --surface-variant: #f1f5f9;
  --surface-elevated: #ffffff;
  --outline: #e2e8f0;
  --input-border: #cbd5e1;
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #64748b;
  --label-secondary: #334155;
}

body.theme-day .cps-dash-header-wrap,
body.theme-day .cps-auth-header,
body.theme-day .cps-tool-header,
body.theme-day .cps-premium-header,
body.theme-day .cps-tool-topbar,
body.theme-day .cps-dash-footer,
body.theme-day .cps-tool-footer {
  background: var(--surface) !important;
  border-color: var(--outline) !important;
}

body.theme-day .cps-theme-toggle {
  color: var(--text-main) !important;
  border-color: var(--outline) !important;
}
body.theme-day .cps-theme-toggle:hover {
  background: rgba(0,0,0,0.05) !important;
}

/* =========================================================
   THEME: GRAY MODE
   ========================================================= */
body.theme-gray.cps-app {
  --bg-body: #e5e7eb;
  --surface: #ffffff;
  --surface-variant: #f3f4f6;
  --surface-elevated: #ffffff;
  --outline: #d1d5db;
  --input-border: #9ca3af;
  --text-main: #111827;
  --text-muted: #374151;
  --text-dim: #4b5563;
  --label-secondary: #1f2937;
  color-scheme: light;
  background-color: var(--bg-body);
  color: var(--text-main);
}

body.theme-gray.cps-app:not(.cps-login-page) {
  --bg-body: #e5e7eb;
  --surface: #ffffff;
  --surface-variant: #f3f4f6;
  --surface-elevated: #ffffff;
  --outline: #d1d5db;
  --input-border: #9ca3af;
  --text-main: #111827;
  --text-muted: #374151;
  --text-dim: #4b5563;
  --label-secondary: #1f2937;
}

body.theme-gray .cps-dash-header-wrap,
body.theme-gray .cps-auth-header,
body.theme-gray .cps-tool-header,
body.theme-gray .cps-premium-header,
body.theme-gray .cps-tool-topbar,
body.theme-gray .cps-dash-footer,
body.theme-gray .cps-tool-footer {
  background: var(--surface) !important;
  border-color: var(--outline) !important;
}

body.theme-gray .cps-theme-toggle {
  color: var(--text-main) !important;
  border-color: var(--outline) !important;
}
body.theme-gray .cps-theme-toggle:hover {
  background: rgba(0,0,0,0.05) !important;
}
