/* 
   SIMPLER.CSS v1.0 - Unified Design System
   Consolidated from Dashboard & Monitoring
*/

:root {
  /* Core Palette — Light Mode (Surface C: medium linen, ~85% L, hue 90-100°) */
  --bg-app: #D5CFC0;
  --bg-panel: #C5BFB0;
  --bg-sidebar: #AFA89A;
  --bg-hover: #CCC5B5;
  --bg-selected: #BAB3A1;

  --text-primary: #1B1A14;
  --text-secondary: #3F3D34; /* AA-cleared on bg-sidebar (~5.4:1) — was #4F4D43, failed on darker sidebar */
  --text-tertiary: #5E5C4F; /* AA-cleared on linen surfaces (~5.0:1 on bg-app) */
  --text-link: var(--accent-info-hover);

  --border-subtle: #B5AE9D;
  --border-light: #9D9482;
  --border-strong: #7B7461;
  --border-focus: #CC7361; /* brand-coral focus ring — every focus state is a small brand moment */

  /* Brand Pair — Rose Copper + Verdigris ("same metal, two oxidation states") */
  --brand-primary: #CC7361;
  --brand-coral: #CC7361;
  --brand-coral-hover: #B05A4A;
  --brand-coral-light: #DC8B7A;
  --brand-rose-copper: #CC7361;
  --brand-rose-copper-hover: #B05A4A;
  --brand-verdigris: #3F8A7C;
  --brand-verdigris-hover: #2D6E62;
  --brand-verdigris-light: #5BA597;

  /* Status Colors — accent-error stays distinct from brand-coral so destructive
     buttons read differently from primary CTAs. Two-color brand semantic still
     applies to BADGES (DUE pill = rose copper, PAID = verdigris).
     `-light` variants are auto-applied in dark mode (see [data-theme="dark"]). */
  --accent-success: #3F8A7C;
  --accent-success-hover: #2D6E62;
  --accent-success-light: #5BA597;
  --accent-warning: #F59E0B;
  --accent-warning-hover: #D97706;
  --accent-warning-light: #FBBF24;
  --accent-error: #B91C1C;
  --accent-error-hover: #991B1B;
  --accent-error-light: #F87171;
  --accent-info: #3B82F6;
  --accent-info-hover: #2563EB;
  --accent-info-light: #60A5FA;
  --accent-special: #8B5CF6;          /* "AI / VIP / premium / automation" cluster */
  --accent-special-hover: #7C3AED;
  --accent-special-light: #A78BFA;
  /* Soft chip backgrounds (rgba versions of the accents) */
  --accent-warning-bg: rgba(245, 158, 11, 0.12);
  --accent-error-bg: rgba(185, 28, 28, 0.12);
  --accent-success-bg: rgba(63, 138, 124, 0.12);
  --accent-info-bg: rgba(59, 130, 246, 0.12);
  --accent-special-bg: rgba(139, 92, 246, 0.12);

  /* Shadows — ultra-subtle multi-layer (Stripe/Linear style) */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.02);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.03), 0 1px 2px rgba(0, 0, 0, 0.02);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.03);
  --shadow-float: 0 4px 16px rgba(0, 0, 0, 0.06), 0 2px 6px rgba(0, 0, 0, 0.03);
  --shadow-overlay: 0 8px 32px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.04);
  --shadow-glow-coral: 0 0 20px rgba(204, 115, 97, 0.18);
  --shadow-glow-verdigris: 0 0 20px rgba(63, 138, 124, 0.18);

  /* Radius */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-panel: 16px;
  --radius-card: 12px;
  --radius-pill: 99px;

  /* Animation Durations */
  --duration-micro: 100ms;
  --duration-fast: 150ms;
  --duration-normal: 200ms;
  --duration-smooth: 300ms;
  --duration-lazy: 500ms;

  /* Easing */
  --ease-spring: cubic-bezier(0.4, 0.0, 0.2, 1);
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Fonts — Geist primary (Vercel, MIT), Inter as fallback for cached users */
  --font-sans: 'Geist', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Font size scale — Linear-grade. Use tokens, never raw px.
     iOS-zoom-safe at --fs-md (14px) for form inputs. */
  --fs-xs: 11px;        /* badges · pills · micro-meta — FLOOR */
  --fs-sm: 12px;        /* caption · sub-meta */
  --fs-base: 13px;      /* body — platform default */
  --fs-md: 14px;        /* button label · form input · iOS-zoom-safe */
  --fs-lg: 16px;        /* callout body · subheading */
  --fs-h3: 18px;        /* section title */
  --fs-h2: 20px;        /* page title (desktop) — Linear-grade */
  --fs-h1: 22px;        /* page title (mobile-dedicated) */
  --fs-display: 28px;   /* hero / landing — sparingly */
  --fs-label: 11px;     /* uppercase small-caps kickers */
  --fs-badge: 11px;     /* pills · status badges */

  /* Z-index scale — named layers prevent magic-number collisions.
     Use tokens, never raw `z-index: 9999`. */
  --z-base: 1;          /* default content elevation */
  --z-sticky: 10;       /* sticky table headers, inline pinned UI */
  --z-header: 100;      /* page-level fixed headers */
  --z-dropdown: 200;    /* select menus, autocomplete, popovers */
  --z-overlay: 1000;    /* backdrop scrims behind modals */
  --z-modal: 1100;      /* modal dialogs */
  --z-toast: 1200;      /* notifications above modals */
  --z-orb: 1300;        /* floating orb, command palette — top-most */

  /* Type rhythm — Linear-grade letter-spacing + line-height */
  --tracking-tight: -0.025em;   /* big titles (h1, hero) */
  --tracking-snug: -0.015em;    /* section titles (h2, h3) */
  --tracking-normal: -0.005em;  /* body copy */
  --tracking-loose: 0.04em;     /* small caps labels */
  --tracking-wide: 0.08em;      /* uppercase section headers */

  --leading-tight: 1.15;         /* big titles */
  --leading-snug: 1.3;            /* mid headings */
  --leading-normal: 1.5;          /* body */
  --leading-relaxed: 1.6;         /* long-form prose */

  /* Tactical Colors — aliases for canonical accent/brand tokens.
     Kept for legacy usages; auto-inherits dark-mode swap from accent-* parents. */
  --tactical-blue: var(--accent-info);
  --tactical-blue-hover: var(--accent-info-hover);
  --tactical-orange: var(--accent-warning);
  --tactical-green: var(--accent-success);
  --tactical-coral: var(--brand-coral);
  --tactical-coral-hover: var(--brand-coral-hover);
  --tactical-purple: var(--accent-special);
}

/* Dark Mode Overrides — Surface B locked dark (warm onyx, hue-coherent with light) */
[data-theme="dark"] {
  --bg-app: #1A1916;
  --bg-panel: #25231C;
  --bg-sidebar: #14130F;
  --bg-hover: #312E26;
  --bg-selected: #3D392E;
  --text-primary: #E7E4D6;
  --text-secondary: #A7A493;
  --text-tertiary: #9C998B; /* AA-cleared on warm onyx (~5.0:1 on bg-panel) */
  --border-subtle: #312E26;
  --border-light: #463F35;
  --border-strong: #645B4D;
  --border-focus: #CC7361;

  /* In dark mode, accent tokens auto-swap to their lighter variants —
     saturated colors glare on dark surfaces; lighter variants are easier on the eyes. */
  --accent-success: var(--accent-success-light);
  --accent-warning: var(--accent-warning-light);
  --accent-error: var(--accent-error-light);
  --accent-info: var(--accent-info-light);
  --accent-special: var(--accent-special-light);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.12);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2), 0 1px 2px rgba(0, 0, 0, 0.12);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.25), 0 1px 3px rgba(0, 0, 0, 0.15);
  --shadow-float: 0 4px 16px rgba(0, 0, 0, 0.3), 0 2px 6px rgba(0, 0, 0, 0.2);
  --shadow-overlay: 0 8px 32px rgba(0, 0, 0, 0.4), 0 4px 12px rgba(0, 0, 0, 0.25);
  --shadow-glow-coral: 0 0 24px rgba(204, 115, 97, 0.28);
  --shadow-glow-verdigris: 0 0 24px rgba(63, 138, 124, 0.28);
}

/* Reset & Base */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Anchor reset — naked <a> tags inherit color from parent.
   Prevents browser-default #0000EE blue on links missing a color rule.
   Specific link styles (.nav-link, .text-link, etc.) override via class. */
a {
  color: inherit;
  text-decoration: none;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-app);
  color: var(--text-primary);
  line-height: var(--leading-normal);
  letter-spacing: var(--tracking-normal);
  -webkit-font-smoothing: antialiased;
  height: 100vh;
  /* NOTE: pages scrolling internally rely on this; mobile override at L146 and responsive.css:15 coordinate here */
  overflow: hidden;
}

/* Branded selection color — rose copper */
::selection {
  background: rgba(204, 115, 97, 0.22);
  color: inherit;
}
[data-theme="dark"] ::selection {
  background: rgba(204, 115, 97, 0.32);
}

/* Smooth scroll for scrollable containers */
html { scroll-behavior: smooth; }

/* Mobile: allow page scrolling (desktop uses internal pane scrolling) */
@media (max-width: 768px) {
  body {
    height: auto !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
  }
}

/* ===========================================
   CUSTOM SCROLLBARS - Modern, Minimal Design
   =========================================== */

/* Webkit Browsers (Chrome, Safari, Edge) */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: 3px;
  transition: background 0.2s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-light);
}

/* Dark mode scrollbar adjustments */
[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-subtle) transparent;
}

[data-theme="dark"] * {
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

/* Hide scrollbar until hover (cleaner look) */
.scrollbar-on-hover::-webkit-scrollbar-thumb {
  background: transparent;
}

.scrollbar-on-hover:hover::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
}

[data-theme="dark"] .scrollbar-on-hover:hover::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
}

/* Layout Utilities */
.app-layout {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

.split-pane-layout {
  display: flex;
  flex: 1;
  height: 100%;
  overflow: hidden;
  background: var(--bg-app);
}

.panel {
  background: var(--bg-panel);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.panel-header {
  height: 64px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-panel);
  flex-shrink: 0;
}

.panel-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.panel-content-lg {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* Flex Utilities */
.flex-center {
  display: flex;
  align-items: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.gap-2 {
  gap: 8px;
}

.gap-4 {
  gap: 16px;
}

.mb-1 {
  margin-bottom: 4px;
}

.mb-2 {
  margin-bottom: 8px;
}

.mb-4 {
  margin-bottom: 16px;
}

.mt-2 {
  margin-top: 8px;
}

/* Typography Utilities */
.text-xs {
  font-size: 12px;
}

.text-sm {
  font-size: 14px;
}

.font-mono {
  font-family: var(--font-mono);
}

.font-bold {
  font-weight: 700;
}

.font-medium {
  font-weight: 500;
}

.text-muted {
  color: var(--text-secondary);
}

.uppercase {
  text-transform: uppercase;
}

/* Components */

/* Buttons */
.btn-tech {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-panel);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s var(--ease-spring);
  font-family: var(--font-sans);
}

.btn-tech:hover {
  background: var(--bg-hover);
  border-color: var(--border-light);
}

.btn-tech.active {
  background: var(--bg-selected);
  color: var(--text-link);
  border-color: var(--text-link);
}

/* Note: .btn-primary canonical lives in buttons.css (brand-coral fill).
   Dark-inverted tech button variant should be `.btn-tech.btn-dark` if needed. */

/* Inputs */
.input-tech {
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-panel);
  color: var(--text-primary);
  font-size: 16px;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color 0.2s;
}

.input-tech:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(204, 115, 97, 0.1);
}

/* Status Badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-success {
  background: rgba(63, 138, 124, 0.1);
  color: var(--accent-success);
}

.status-warning {
  background: rgba(245, 158, 11, 0.1);
  color: var(--accent-warning);
}

.status-error {
  background: rgba(185, 28, 28, 0.1);
  color: var(--accent-error);
}

.status-info {
  background: rgba(59, 130, 246, 0.1);
  color: var(--accent-info);
}

/* Cards */
.data-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  padding: 12px;
  margin-bottom: 12px;
  transition: all 0.2s;
  cursor: pointer;
}

.data-card:hover {
  border-color: var(--border-light);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.data-card.selected {
  border-color: var(--border-focus);
  background: var(--bg-selected);
  box-shadow: var(--shadow-md);
}

/* Logo Utility */
.simpler-logo {
  width: 32px;
  height: 32px;
  display: block;
  transition: transform 0.3s var(--ease-spring);
}

.simpler-logo:hover {
  transform: scale(1.1) rotate(-5deg);
}

/* =========================================
   COMPONENT: ROI Ticker (Dashboard)
   ========================================= */
.roi-header {
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-subtle);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 32px;
}

.roi-stat {
  display: flex;
  flex-direction: column;
}

.roi-label {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}

.roi-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  gap: 8px;
}

.roi-delta {
  font-size: 12px;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(63, 138, 124, 0.1);
  color: var(--accent-success);
}

/* =========================================
   COMPONENT: Board Layout (Dashboard)
   ========================================= */
.board-layout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  padding: 16px;
  height: 100%;
  overflow-x: auto;
}

.board-column {
  background: var(--bg-panel);
  border-radius: var(--radius-panel);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  min-width: 280px;
}

.column-header {
  padding: 16px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(10px);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

[data-theme="dark"] .column-header {
  background: rgba(15, 20, 30, 0.6);
}

.column-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.column-content {
  flex: 1;
  padding: 12px;
  overflow-y: auto;
  background: var(--bg-app);
}

/* =========================================
   COMPONENT: Split Pane Grid (Monitoring)
   ========================================= */
.split-pane-grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 12px;
  padding: 12px;
  height: 100%;
  overflow: hidden;
  background: var(--bg-app);
}

/* =========================================
   COMPONENT: Process Tracker (Monitoring)
   =========================================*/
/* --- PIPELINE TRACKER (Onyx Style) --- */
.pipeline-track {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  padding: 24px 40px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-subtle);
}

.pipeline-track::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 60px;
  right: 60px;
  height: 2px;
  background: var(--border-subtle);
  z-index: 0;
  transform: translateY(-50%);
}

.pipeline-step {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: var(--bg-panel);
  padding: 0 12px;
}

.step-indicator {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-app);
  border: 2px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.pipeline-step.completed .step-indicator {
  background: var(--tactical-green);
  border-color: var(--tactical-green);
  color: #fff;
}

.pipeline-step.active .step-indicator {
  background: var(--tactical-blue);
  border-color: var(--tactical-blue);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
}

.step-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pipeline-step.active .step-label {
  color: var(--tactical-blue);
  font-weight: 700;
}

/* --- INSPECTION PANELS (Glass Box) --- */
.inspection-grid {
  display: grid;
  grid-template-columns: 300px 1fr 300px;
  gap: 1px;
  /* For border effect */
  background: var(--border-subtle);
  height: calc(100vh - 180px);
  /* Adjust based on header/pipeline height */
}

.inspection-panel {
  background: var(--bg-panel);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.inspection-header {
  padding: 12px 16px;
  background: var(--bg-app);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}

.inspection-content {
  padding: 16px;
  /* Standardized from 20px to match header */
  overflow-y: auto;
  flex: 1;
}

/* --- GATE ACTIONS --- */
.gate-actions {
  padding: 16px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-panel);
  display: flex;
  gap: 12px;
}

.btn-gate {
  flex: 1;
  padding: 10px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
}

.btn-approve {
  background: var(--tactical-green);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-approve:hover {
  background: var(--accent-success-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn-approve:active {
  transform: translateY(1px);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* --- DEEP GLASS BOX (Palantir Polish) --- */

/* Object Cards (Context) */
.object-card {
  background: var(--bg-app);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--tactical-blue);
  border-radius: 4px;
  padding: 12px;
  margin-bottom: 12px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  /* Smooth "Apple-like" ease */
  cursor: default;
}

.object-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--tactical-blue);
  transform: translateY(-2px);
  /* Subtle lift */
}

.object-meta {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-secondary);
  text-transform: uppercase;
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}

.object-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Telemetry Data (Logic) */
.telemetry-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
  padding: 12px;
  background: var(--bg-app);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
}

.telemetry-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.telemetry-label {
  font-size: 10px;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.telemetry-value {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--tactical-blue);
  font-weight: 600;
}

/* Actionable Canvas (Edit Mode) */
.canvas-overlay {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 8px;
  opacity: 0;
  transition: opacity 0.2s;
}

.inspection-content:hover .canvas-overlay {
  opacity: 1;
}

.btn-icon-sm {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-icon-sm:hover {
  background: var(--tactical-blue);
}

.btn-reject {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-strong);
}

.btn-reject:hover {
  border-color: var(--text-primary);
  color: var(--text-primary);
}

.process-tracker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px;
  background: var(--bg-hover);
  border-bottom: 1px solid var(--border-subtle);
  position: relative;
}

.step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 2;
  position: relative;
  flex: 1;
}

.step-circle {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-panel);
  border: 2px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: bold;
  color: var(--text-tertiary);
  margin-bottom: 8px;
  transition: all 0.3s;
}

.step-item.completed .step-circle {
  background: var(--accent-success);
  border-color: var(--accent-success);
  color: white;
}

.step-item.active .step-circle {
  border-color: var(--accent-warning);
  background: var(--bg-panel);
  color: var(--accent-warning);
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.15);
}

.step-label {
  font-size: 11px;
  color: var(--text-secondary);
  text-align: center;
  font-weight: 500;
  max-width: 100px;
}

.step-item.active .step-label {
  color: var(--text-primary);
  font-weight: 600;
}

.progress-line-bg {
  position: absolute;
  top: 36px;
  left: 50px;
  right: 50px;
  height: 2px;
  background: var(--border-light);
  z-index: 0;
}

.progress-line-fill {
  position: absolute;
  top: 36px;
  left: 50px;
  height: 2px;
  background: var(--accent-success);
  width: 66%;
  z-index: 1;
  transition: width 0.5s ease;
}

/* =========================================
   COMPONENT: Work Grid (Monitoring)
   ========================================= */
.work-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 24px;
}

.media-preview {
  width: 100%;
  aspect-ratio: 1/1;
  background: #000;
  border-radius: var(--radius-card);
  overflow: hidden;
  position: relative;
  border: 1px solid var(--border-light);
}

.media-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
  color: white;
  font-size: 11px;
}

/* =========================================
   COMPONENT: Blueprint Canvas (Chat)
   ========================================= */
.blueprint-canvas {
  background-color: var(--bg-app);
  background-image:
    linear-gradient(var(--border-subtle) 1px, transparent 1px),
    linear-gradient(90deg, var(--border-subtle) 1px, transparent 1px);
  background-size: 20px 20px;
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.node {
  position: absolute;
  width: 280px;
  background: var(--bg-panel);
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
  padding: 0;
  transition: all 0.2s var(--ease-spring);
  cursor: grab;
}

.node:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-float);
  border-color: var(--border-focus);
}

.node-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 12px 12px 0 0;
}

[data-theme="dark"] .node-header {
  background: rgba(15, 20, 30, 0.6);
}

.node-content {
  padding: 16px;
}

.connection {
  position: absolute;
  background: var(--border-strong);
  height: 2px;
  transform-origin: 0 50%;
  z-index: 0;
}

/* =========================================
   COMPONENT: Template Grid (Templates)
   ========================================= */
.template-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  padding: 32px;
  max-width: 1200px;
  margin: 0 auto;
}

.template-card {
  background: var(--bg-panel);
  border-radius: 20px;
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.3s var(--ease-spring);
  position: relative;
  height: 300px;
  cursor: pointer;
}

.template-card:hover {
  transform: translateY(-6px) scale(1.01);
  box-shadow: var(--shadow-float);
  border-color: var(--border-light);
}

.card-preview {
  height: 140px;
  background: var(--bg-hover);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.abstract-art {
  width: 100%;
  height: 100%;
  opacity: 0.8;
  transition: opacity 0.3s;
}

.template-card:hover .abstract-art {
  opacity: 1;
  transform: scale(1.05);
  transition: transform 0.5s ease, opacity 0.3s;
}

.card-content {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.card-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: auto;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}

.cost-pill {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  background: var(--bg-hover);
  padding: 4px 8px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 32px;
}

.page-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border-strong);
  opacity: 0.3;
  cursor: pointer;
  transition: all 0.2s;
}

.page-dot.active {
  opacity: 1;
  background: var(--brand-primary);
  transform: scale(1.2);
}

/* =========================================
   COMPONENT: Wallet / Billing (Billing)
   ========================================= */
.billing-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  padding: 40px;
  max-width: 1000px;
  margin: 0 auto;
}

.credit-card-display {
  background: linear-gradient(135deg, #1C1917 0%, #292524 100%);
  border-radius: 20px;
  padding: 32px;
  color: white;
  position: relative;
  overflow: hidden;
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.3);
  height: 240px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.credit-balance {
  font-size: 48px;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-family: var(--font-mono);
}

.usage-row {
  display: flex;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.usage-row:last-child {
  border-bottom: none;
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 24px;
}

.stat-box {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  padding: 20px;
}

/* =========================================
   COMPONENT: Tactical / Onyx (Dashboard)
   ========================================= */
.tactical-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  padding: 24px;
  height: calc(100vh - 64px);
}

.tactical-column {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  /* Sharper corners for tactical look */
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tactical-header {
  padding: 12px 16px;
  border-top: 3px solid transparent;
  /* For colored status bar */
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--border-subtle);
}

[data-theme="dark"] .tactical-header {
  background: rgba(0, 0, 0, 0.45);
}

.tactical-header.blue {
  border-top-color: var(--tactical-blue);
}

.tactical-header.orange {
  border-top-color: var(--tactical-orange);
}

.tactical-header.green {
  border-top-color: var(--tactical-green);
}

.tactical-header.purple {
  border-top-color: var(--tactical-purple);
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.header-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.agent-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 6px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-secondary);
}

.agent-badge i {
  font-size: 10px;
}

.tactical-card {
  background: var(--bg-app);
  /* Slightly darker than panel */
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--border-subtle);
  border-radius: 4px;
  padding: 12px;
  margin-bottom: 8px;
  transition: all 0.2s;
}

.tactical-card:hover {
  border-color: var(--border-strong);
  transform: translateX(2px);
}

.tactical-card.urgent {
  border-left-color: var(--tactical-orange);
}

.tactical-card.active {
  border-left-color: var(--tactical-blue);
}

.card-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 8px;
  font-family: var(--font-mono);
}

.metric-pill {
  background: var(--tactical-green);
  color: #000;
  font-weight: 700;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 10px;
}

/* =========================================
   POLISH LAYER — Modern Interaction Design
   Inspired by Linear/Stripe/HeyElsa
   ========================================= */

/* --- ENTRANCE ANIMATIONS --- */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInScale {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(12px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes slideInBottom {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@keyframes skeleton-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(204, 115, 97, 0.2); }
  50% { box-shadow: 0 0 0 6px rgba(204, 115, 97, 0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0); }
  to { opacity: 1; transform: scale(1); }
}

/* Utility classes for entrance animations */
.animate-in { animation: fadeInUp var(--duration-smooth) var(--ease-out-expo) both; }
.animate-in-scale { animation: fadeInScale var(--duration-smooth) var(--ease-out-expo) both; }
.animate-in-right { animation: slideInRight var(--duration-smooth) var(--ease-out-expo) both; }

/* Staggered animation delays for lists/grids */
.stagger-1 { animation-delay: 30ms; }
.stagger-2 { animation-delay: 60ms; }
.stagger-3 { animation-delay: 90ms; }
.stagger-4 { animation-delay: 120ms; }
.stagger-5 { animation-delay: 150ms; }
.stagger-6 { animation-delay: 180ms; }

/* --- GRADIENT TEXT --- */
.text-gradient {
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-gradient-coral {
  background: linear-gradient(135deg, var(--brand-coral) 0%, #DC8B7A 50%, var(--brand-coral-hover) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Fading section label — text dissolves at the right edge */
.text-fade-right {
  background: linear-gradient(90deg, var(--text-secondary) 40%, transparent 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* --- ENHANCED INPUT FOCUS --- */
.input-tech:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(204, 115, 97, 0.08);
  background: var(--bg-app);
}

[data-theme="dark"] .input-tech:focus {
  box-shadow: 0 0 0 3px rgba(204, 115, 97, 0.15);
  background: var(--bg-hover);
}

/* --- GLASS VARIANTS (extended) --- */
.glass-input {
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  transition: all var(--duration-normal) var(--ease-spring);
}

.glass-input:focus {
  background: rgba(255, 255, 255, 0.7);
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(204, 115, 97, 0.08);
}

[data-theme="dark"] .glass-input {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .glass-input:focus {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-focus);
}

.glass-overlay {
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

[data-theme="dark"] .glass-overlay {
  background: rgba(0, 0, 0, 0.5);
}

/* --- PARTIAL BORDER CARDS (HeyElsa style) --- */
.card-accent-left {
  border: none;
  border-left: 2px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  transition: all var(--duration-normal) var(--ease-spring);
}

.card-accent-left:hover {
  border-left-color: var(--brand-coral);
  box-shadow: var(--shadow-sm);
}

/* --- SKELETON LOADING --- */
.skeleton {
  background: linear-gradient(90deg,
    var(--bg-hover) 25%,
    var(--bg-panel) 50%,
    var(--bg-hover) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite ease-in-out;
  border-radius: var(--radius-md);
}

.skeleton-text {
  height: 14px;
  margin-bottom: 8px;
  border-radius: var(--radius-xs);
}

.skeleton-title {
  height: 20px;
  width: 60%;
  margin-bottom: 12px;
  border-radius: var(--radius-xs);
}

.skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

/* --- ENHANCED BUTTON HOVER --- */
.btn-primary-action {
  position: relative;
  overflow: hidden;
  transition: all var(--duration-normal) var(--ease-spring);
}

.btn-primary-action::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 50%);
  opacity: 0;
  transition: opacity var(--duration-fast);
}

.btn-primary-action:hover::after {
  opacity: 1;
}

.btn-primary-action:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-float);
}

.btn-primary-action:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

/* Coral CTA glow on hover */
.btn-coral-glow:hover {
  box-shadow: var(--shadow-glow-coral);
}

/* --- ENHANCED TAB INDICATOR --- */
.tab-animated {
  position: relative;
}

.tab-animated::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--brand-coral);
  transition: all var(--duration-smooth) var(--ease-out-expo);
  transform: translateX(-50%);
  border-radius: 1px;
}

.tab-animated:hover::after,
.tab-animated.active::after {
  width: 100%;
}

/* --- INTERACTIVE CARD LIFT --- */
.card-interactive {
  transition: all var(--duration-normal) var(--ease-spring);
}

.card-interactive:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-float);
}

.card-interactive:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

/* --- TOAST NOTIFICATION --- */
.toast-enter {
  animation: fadeInUp var(--duration-smooth) var(--ease-out-expo) both;
}

.toast-exit {
  animation: fadeIn var(--duration-fast) ease reverse both;
}

/* --- FOCUS RING SYSTEM --- */
.focus-ring:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--bg-app), 0 0 0 4px var(--border-focus);
}

[data-theme="dark"] .focus-ring:focus-visible {
  box-shadow: 0 0 0 2px var(--bg-panel), 0 0 0 4px var(--border-focus);
}

/* --- CJK LINE-HEIGHT (SEA market: MY/TH/VN/JP/CN/KR) --- */
:lang(zh), :lang(ja), :lang(ko), :lang(th), :lang(vi) {
  line-height: 1.8;
}

/* --- REDUCED MOTION --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* --- DARK MODE INTERACTIVE GLOW --- */
[data-theme="dark"] .data-card:hover {
  box-shadow: var(--shadow-md), 0 0 0 1px rgba(255, 255, 255, 0.04);
}

[data-theme="dark"] .btn-tech:hover {
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .object-card:hover {
  box-shadow: var(--shadow-md), 0 0 0 1px rgba(59, 130, 246, 0.15);
}

/* --- PAGE CONTENT ENTRANCE --- */
/* Auto-fade-in for main content areas on page load */
.glass-page,
#main-content,
.main-area,
.main-content {
  animation: fadeIn var(--duration-smooth) ease both;
}

/* --- GLOBAL INPUT POLISH --- */
/* Upgrade all text inputs/selects/textareas with subtle transitions */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
input[type="url"],
input[type="tel"],
input[type="date"],
textarea,
select {
  transition: border-color var(--duration-normal) ease, box-shadow var(--duration-normal) ease, background var(--duration-normal) ease;
}

/* --- GLOBAL LINK UNDERLINE ANIMATION --- */
a:not([class]) {
  text-decoration-color: transparent;
  transition: text-decoration-color var(--duration-normal) ease, color var(--duration-normal) ease;
}
a:not([class]):hover {
  text-decoration-color: currentColor;
}

/* --- SCROLL FADE HINT --- */
/* Add to scrollable containers to hint at more content below */
.scroll-fade-bottom {
  position: relative;
}
.scroll-fade-bottom::after {
  content: '';
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40px;
  background: linear-gradient(to top, var(--bg-app), transparent);
  pointer-events: none;
  display: block;
}
[data-theme="dark"] .scroll-fade-bottom::after {
  background: linear-gradient(to top, var(--bg-panel), transparent);
}

/* --- SMOOTH ACCORDION --- */
/* Use with max-height transition instead of display:none/block */
.accordion-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--duration-smooth) var(--ease-spring), opacity var(--duration-normal) ease, padding var(--duration-smooth) ease;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
}
.accordion-item.open .accordion-body {
  max-height: 500px;
  opacity: 1;
}

/* --- MODAL/DIALOG ENTRANCE --- */
/* Apply to modal backdrop + content for smooth entrance */
.modal-backdrop-animated {
  opacity: 0;
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
  transition: opacity var(--duration-smooth) ease, backdrop-filter var(--duration-smooth) ease, -webkit-backdrop-filter var(--duration-smooth) ease;
}
.modal-backdrop-animated.visible {
  opacity: 1;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.modal-content-animated {
  opacity: 0;
  transform: scale(0.96) translateY(8px);
  transition: opacity var(--duration-smooth) var(--ease-out-expo), transform var(--duration-smooth) var(--ease-out-expo);
}
.modal-content-animated.visible {
  opacity: 1;
  transform: scale(1) translateY(0);
}

/* --- STAT CARD HOVER GLOW --- */
/* For metric/stat cards that should feel interactive */
.stat-glow:hover {
  box-shadow: var(--shadow-md), 0 0 0 1px rgba(204, 115, 97, 0.08);
  transform: translateY(-1px);
  transition: all var(--duration-normal) var(--ease-spring);
}
[data-theme="dark"] .stat-glow:hover {
  box-shadow: var(--shadow-md), 0 0 0 1px rgba(204, 115, 97, 0.12);
}

/* --- DIVIDER WITH LABEL --- */
.divider-label {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--text-tertiary);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.divider-label::before,
.divider-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

/* --- NUMBER COUNTER ANIMATION --- */
/* For animated count-up effect on metric values */
.counter-animate {
  display: inline-block;
  transition: transform var(--duration-fast) var(--ease-bounce);
}
.counter-animate.tick {
  transform: translateY(-2px);
}

/* --- PULSE DOT (live indicators) --- */
.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-success);
  position: relative;
}
.pulse-dot::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid var(--accent-success);
  animation: pulseRing 2s var(--ease-out-expo) infinite;
}
@keyframes pulseRing {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(1.8); opacity: 0; }
}

/* ============================================================
   Tabular numerals — platform-wide numeric alignment
   Ensures $1,400.50 aligns column-wise with $815.54 across tiles,
   lists, and stat rows. Applied to any class that holds a number.
   ============================================================ */
.stat-value,
.stat-meta,
.this-month-stat-value,
.quadrant-value,
.summary-value,
.metric-value,
.dash-value,
.balance-amount,
.balance-estimate,
.total-amount,
.total-value,
.cost-amount,
.cost-total,
.cost-value,
.fact-value,
.tab-count,
.badge-count,
.count-badge,
.category-badge,
.pipe-value,
.bar-value,
.kpi-value,
.calendar-day,
[class*="-count"],
[class*="-total"],
[class*="-amount"],
[class*="-value"],
[class*="Count"] {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}