/* ============================================================
   QRUCIBLE IP — Design System CSS
   Engineering Manager Patent Governance Frontend
   ============================================================
   Brand: Nunito Sans + Roboto Mono
   Theme: Silverish grey-black dark mode (#18181F series)
   Pattern: CSS Custom Properties with [data-theme] switching
   ============================================================ */

/* ============================================================
   1. CUSTOM PROPERTIES — Dark Theme (Default)
   ============================================================ */
:root {
  /* ---- Background Palette (Silverish Grey-Black) ---- */
  --bg-primary:    #18181F;
  --bg-secondary:  #1E1E26;
  --bg-tertiary:   #252530;
  --bg-elevated:   #2C2C38;
  --bg-surface:    #32323E;
  --bg-hover:      #38384A;
  --bg-active:     #3E3E52;
  --bg-overlay:    rgba(24, 24, 31, 0.92);

  /* ---- Text ---- */
  --text-primary:   #F0F0F5;
  --text-secondary: #A0A0B0;
  --text-tertiary:  #6E6E82;
  --text-muted:     #52526A;
  --text-inverse:   #18181F;

  /* ---- Accent: Cyan → Green (Primary) ---- */
  --cyan:          #22C55E;
  --cyan-dim:      #16A34A;
  --cyan-glow:     rgba(34, 197, 94, 0.35);
  --cyan-subtle:   rgba(34, 197, 94, 0.10);
  --cyan-border:   rgba(34, 197, 94, 0.25);

  /* ---- Accent: Purple ---- */
  --purple:        #8B5CF6;
  --purple-dim:    #7C3AED;
  --purple-glow:   rgba(139, 92, 246, 0.35);
  --purple-subtle: rgba(139, 92, 246, 0.10);
  --purple-border: rgba(139, 92, 246, 0.25);

  /* ---- Accent: Green ---- */
  --green:         #22C55E;
  --green-dim:     #16A34A;
  --green-glow:    rgba(34, 197, 94, 0.35);
  --green-subtle:  rgba(34, 197, 94, 0.10);
  --green-border:  rgba(34, 197, 94, 0.25);

  /* ---- Accent: Orange / Gold ---- */
  --orange:        #D4A017;
  --orange-dim:    #B8860B;
  --orange-glow:   rgba(212, 160, 23, 0.35);
  --orange-subtle: rgba(212, 160, 23, 0.10);
  --orange-border: rgba(212, 160, 23, 0.25);

  /* ---- Accent: Red ---- */
  --red:           #EF4444;
  --red-dim:       #DC2626;
  --red-glow:      rgba(239, 68, 68, 0.35);
  --red-subtle:    rgba(239, 68, 68, 0.10);
  --red-border:    rgba(239, 68, 68, 0.25);

  /* ---- Accent: Blue ---- */
  --blue:          #2563EB;
  --blue-dim:      #1D4ED8;
  --blue-glow:     rgba(37, 99, 235, 0.35);
  --blue-subtle:   rgba(37, 99, 235, 0.10);
  --blue-border:   rgba(37, 99, 235, 0.25);

  /* ---- Accent: Teal ---- */
  --teal:          #2E8B7A;
  --teal-dim:      #267367;
  --teal-glow:     rgba(46, 139, 122, 0.35);
  --teal-subtle:   rgba(46, 139, 122, 0.10);
  --teal-border:   rgba(46, 139, 122, 0.25);

  /* ---- Accent: Rose ---- */
  --rose:          #F43F5E;
  --rose-dim:      #E11D48;
  --rose-glow:     rgba(244, 63, 94, 0.35);
  --rose-subtle:   rgba(244, 63, 94, 0.10);
  --rose-border:   rgba(244, 63, 94, 0.25);

  /* ---- Typography ---- */
  --font-sans: 'Nunito Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'Roboto Mono', 'Courier New', monospace;

  --text-xs:   0.75rem;
  --text-sm:   0.8125rem;
  --text-base: 0.9375rem;
  --text-lg:   1.125rem;
  --text-xl:   1.375rem;
  --text-2xl:  1.75rem;
  --text-3xl:  2.25rem;
  --text-4xl:  3rem;
  --text-5xl:  4rem;

  --leading-tight:  1.15;
  --leading-normal: 1.6;
  --leading-code:   1.8;

  --tracking-tight:  -0.01em;
  --tracking-normal:  0;
  --tracking-wide:    0.05em;
  --tracking-hero:    0.15em;

  /* ---- Spacing ---- */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;

  /* ---- Radii ---- */
  --radius-sm:   4px;
  --radius-md:   8px;
  --radius-lg:   12px;
  --radius-xl:   16px;
  --radius-2xl:  24px;
  --radius-full: 9999px;

  /* ---- Borders ---- */
  --border-default: 1px solid rgba(240, 240, 245, 0.08);
  --border-subtle:  1px solid rgba(240, 240, 245, 0.04);
  --border-accent:  1px solid var(--cyan-border);

  /* ---- Shadows ---- */
  --shadow-sm:   0 1px 2px rgba(0,0,0,0.3);
  --shadow-md:   0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg:   0 8px 24px rgba(0,0,0,0.5);
  --shadow-xl:   0 16px 48px rgba(0,0,0,0.6);
  --shadow-glow: 0 0 20px var(--cyan-glow);

  /* ---- Glass Morphism ---- */
  --glass-bg:       rgba(24, 24, 31, 0.85);
  --glass-border:   1px solid rgba(34, 197, 94, 0.10);
  --glass-blur:     blur(16px);
  --glass-radius:   var(--radius-lg);

  /* ---- Gradients ---- */
  --gradient-cyan:    linear-gradient(135deg, var(--cyan), var(--teal));
  --gradient-purple:  linear-gradient(135deg, var(--purple), var(--rose));
  --gradient-green:   linear-gradient(135deg, var(--green), var(--teal));
  --gradient-orange:  linear-gradient(135deg, var(--orange), #E8A317);
  --gradient-surface: linear-gradient(180deg, var(--bg-secondary), var(--bg-primary));

  /* ---- Transitions ---- */
  --transition-fast:   150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base:   250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow:   400ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* ---- Z-Index ---- */
  --z-base:     1;
  --z-dropdown: 100;
  --z-sticky:   200;
  --z-overlay:  300;
  --z-modal:    400;
  --z-toast:    500;
  --z-tooltip:  600;

  /* ---- Layout ---- */
  --topbar-height:      56px;
  --sidebar-width:      240px;
  --sidebar-collapsed:  64px;
  --guide-width:        320px;
  --statusbar-height:   28px;
  --content-max-width:  1400px;
}


/* ============================================================
   2. LIGHT THEME
   ============================================================ */
[data-theme="light"] {
  --bg-primary:    #F5F5F5;
  --bg-secondary:  #EBEBEB;
  --bg-tertiary:   #E0E0E0;
  --bg-elevated:   #FFFFFF;
  --bg-surface:    #FAFAFA;
  --bg-hover:      #D9D9D9;
  --bg-active:     #CCCCCC;
  --bg-overlay:    rgba(245, 245, 245, 0.92);

  --text-primary:   #1A1A2E;
  --text-secondary: #4A4A6A;
  --text-tertiary:  #7A7A9A;
  --text-muted:     #9A9AB0;
  --text-inverse:   #F5F5F5;

  --cyan:          #16A34A;
  --cyan-dim:      #15803D;
  --cyan-glow:     rgba(22, 163, 74, 0.25);
  --cyan-subtle:   rgba(22, 163, 74, 0.08);
  --cyan-border:   rgba(22, 163, 74, 0.20);

  --purple:        #7C3AED;
  --purple-dim:    #6D28D9;
  --purple-glow:   rgba(124, 58, 237, 0.25);
  --purple-subtle: rgba(124, 58, 237, 0.08);
  --purple-border: rgba(124, 58, 237, 0.20);

  --green:         #16A34A;
  --green-dim:     #15803D;
  --green-glow:    rgba(22, 163, 74, 0.25);
  --green-subtle:  rgba(22, 163, 74, 0.08);
  --green-border:  rgba(22, 163, 74, 0.20);

  --orange:        #B8860B;
  --orange-dim:    #996F00;
  --orange-glow:   rgba(184, 134, 11, 0.25);
  --orange-subtle: rgba(184, 134, 11, 0.08);
  --orange-border: rgba(184, 134, 11, 0.20);

  --red:           #DC2626;
  --red-dim:       #B91C1C;
  --red-glow:      rgba(220, 38, 38, 0.25);
  --red-subtle:    rgba(220, 38, 38, 0.08);
  --red-border:    rgba(220, 38, 38, 0.20);

  --blue:          #1D4ED8;
  --blue-dim:      #1E40AF;
  --blue-glow:     rgba(29, 78, 216, 0.25);
  --blue-subtle:   rgba(29, 78, 216, 0.08);
  --blue-border:   rgba(29, 78, 216, 0.20);

  --teal:          #267367;
  --teal-dim:      #1F5F54;
  --teal-glow:     rgba(38, 115, 103, 0.25);
  --teal-subtle:   rgba(38, 115, 103, 0.08);
  --teal-border:   rgba(38, 115, 103, 0.20);

  --rose:          #E11D48;
  --rose-dim:      #BE123C;
  --rose-glow:     rgba(225, 29, 72, 0.25);
  --rose-subtle:   rgba(225, 29, 72, 0.08);
  --rose-border:   rgba(225, 29, 72, 0.20);

  --border-default: 1px solid rgba(26, 26, 46, 0.10);
  --border-subtle:  1px solid rgba(26, 26, 46, 0.05);
  --border-accent:  1px solid var(--cyan-border);

  --shadow-sm:   0 1px 2px rgba(0,0,0,0.06);
  --shadow-md:   0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg:   0 8px 24px rgba(0,0,0,0.12);
  --shadow-xl:   0 16px 48px rgba(0,0,0,0.16);
  --shadow-glow: 0 0 20px var(--cyan-glow);

  --glass-bg:     rgba(255, 255, 255, 0.85);
  --glass-border: 1px solid rgba(22, 163, 74, 0.12);
}


/* ============================================================
   2b. SILVER THEME (Grey-Black Dark)
   ============================================================ */
[data-theme="silver"] {
  --bg-primary:    #222228;
  --bg-secondary:  #2A2A30;
  --bg-tertiary:   #333338;
  --bg-elevated:   #3A3A42;
  --bg-surface:    #42424A;
  --bg-hover:      #4A4A52;
  --bg-active:     #52525A;
  --bg-overlay:    rgba(34, 34, 40, 0.92);

  --text-primary:   #E8E8EC;
  --text-secondary: #B0B0BA;
  --text-tertiary:  #88888F;
  --text-muted:     #666670;
  --text-inverse:   #222228;

  --cyan:          #34D399;
  --cyan-dim:      #10B981;
  --cyan-glow:     rgba(52, 211, 153, 0.20);
  --cyan-subtle:   rgba(52, 211, 153, 0.06);
  --cyan-border:   rgba(52, 211, 153, 0.15);

  --purple:        #A78BFA;
  --purple-dim:    #8B5CF6;
  --purple-glow:   rgba(167, 139, 250, 0.20);
  --purple-subtle: rgba(167, 139, 250, 0.06);
  --purple-border: rgba(167, 139, 250, 0.15);

  --green:         #34D399;
  --green-dim:     #10B981;
  --green-glow:    rgba(52, 211, 153, 0.20);
  --green-subtle:  rgba(52, 211, 153, 0.06);
  --green-border:  rgba(52, 211, 153, 0.15);

  --orange:        #FBBF24;
  --orange-dim:    #F59E0B;
  --orange-glow:   rgba(251, 191, 36, 0.20);
  --orange-subtle: rgba(251, 191, 36, 0.06);
  --orange-border: rgba(251, 191, 36, 0.15);

  --red:           #FB7185;
  --red-dim:       #F43F5E;
  --red-glow:      rgba(251, 113, 133, 0.20);
  --red-subtle:    rgba(251, 113, 133, 0.06);
  --red-border:    rgba(251, 113, 133, 0.15);

  --blue:          #60A5FA;
  --blue-dim:      #3B82F6;
  --blue-glow:     rgba(96, 165, 250, 0.20);
  --blue-subtle:   rgba(96, 165, 250, 0.06);
  --blue-border:   rgba(96, 165, 250, 0.15);

  --teal:          #2DD4BF;
  --teal-dim:      #14B8A6;
  --teal-glow:     rgba(45, 212, 191, 0.20);
  --teal-subtle:   rgba(45, 212, 191, 0.06);
  --teal-border:   rgba(45, 212, 191, 0.15);

  --rose:          #FB7185;
  --rose-dim:      #F43F5E;
  --rose-glow:     rgba(251, 113, 133, 0.20);
  --rose-subtle:   rgba(251, 113, 133, 0.06);
  --rose-border:   rgba(251, 113, 133, 0.15);

  --border-default: 1px solid rgba(255, 255, 255, 0.08);
  --border-subtle:  1px solid rgba(255, 255, 255, 0.04);
  --border-accent:  1px solid var(--cyan-border);

  --shadow-sm:   0 1px 2px rgba(0,0,0,0.3);
  --shadow-md:   0 4px 12px rgba(0,0,0,0.35);
  --shadow-lg:   0 8px 24px rgba(0,0,0,0.4);
  --shadow-xl:   0 16px 48px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 20px var(--cyan-glow);

  --glass-bg:     rgba(34, 34, 40, 0.80);
  --glass-border: 1px solid rgba(52, 211, 153, 0.08);
}


/* ============================================================
   3. MIDNIGHT THEME (Deep Blue-Black)
   ============================================================ */
[data-theme="midnight"] {
  --bg-primary:    #0D1117;
  --bg-secondary:  #131920;
  --bg-tertiary:   #1A2230;
  --bg-elevated:   #212B3A;
  --bg-surface:    #283444;
  --bg-hover:      #2E3D50;
  --bg-active:     #34465C;
  --bg-overlay:    rgba(13, 17, 23, 0.92);

  --glass-bg:     rgba(13, 17, 23, 0.85);
  --glass-border: 1px solid rgba(34, 197, 94, 0.08);

  --shadow-sm:   0 1px 2px rgba(0,0,0,0.4);
  --shadow-md:   0 4px 12px rgba(0,0,0,0.5);
  --shadow-lg:   0 8px 24px rgba(0,0,0,0.6);
  --shadow-xl:   0 16px 48px rgba(0,0,0,0.7);
}


/* ============================================================
   4. RESET & BASE
   ============================================================ */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background: var(--bg-primary);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background var(--transition-base), color var(--transition-base);
}

a {
  color: var(--cyan);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover { color: var(--cyan-dim); }

code, pre, kbd, samp {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: var(--leading-code);
}

pre {
  background: var(--bg-tertiary);
  border: var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  overflow-x: auto;
}

code {
  background: var(--bg-tertiary);
  padding: 0.15em 0.4em;
  border-radius: var(--radius-sm);
  font-size: 0.875em;
}
pre code {
  background: none;
  padding: 0;
  border-radius: 0;
}

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

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  border: none;
  background: none;
  outline: none;
}

button { cursor: pointer; }

::selection {
  background: var(--cyan-glow);
  color: var(--text-primary);
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }


/* ============================================================
   5. NOISE TEXTURE OVERLAY
   ============================================================ */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.015;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px;
}
[data-theme="light"] body::before { opacity: 0.02; }


/* ============================================================
   6. APP SHELL LAYOUT
   ============================================================ */
.app-shell {
  display: grid;
  grid-template-areas:
    "topbar topbar topbar"
    "sidebar main guide"
    "statusbar statusbar statusbar";
  grid-template-columns: var(--sidebar-width) 1fr var(--guide-width);
  grid-template-rows: var(--topbar-height) 1fr var(--statusbar-height);
  min-height: 100vh;
  transition: grid-template-columns var(--transition-base);
}

.app-shell.sidebar-collapsed {
  grid-template-columns: var(--sidebar-collapsed) 1fr var(--guide-width);
}

.app-shell.guide-hidden {
  grid-template-columns: var(--sidebar-width) 1fr 0;
}

.app-shell.sidebar-collapsed.guide-hidden {
  grid-template-columns: var(--sidebar-collapsed) 1fr 0;
}


/* ============================================================
   7. DEMO BAR
   ============================================================ */
.demo-bar {
  grid-column: 1 / -1;
  background: var(--orange-subtle);
  border-bottom: 1px solid var(--orange-border);
  padding: var(--space-1) var(--space-4);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--orange);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}

.demo-bar .demo-badge {
  background: var(--orange);
  color: var(--text-inverse);
  padding: 0.1em 0.5em;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
}


/* ============================================================
   8. TOPBAR
   ============================================================ */
.topbar {
  grid-area: topbar;
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  padding: 0 var(--space-4);
  gap: var(--space-3);
  background: var(--bg-secondary);
  border-bottom: var(--border-default);
  z-index: var(--z-sticky);
  transition: background var(--transition-base);
}

.topbar.glass {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: var(--glass-border);
}

/* ---- Topbar Logo ---- */
.topbar-logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 700;
  font-size: var(--text-lg);
  letter-spacing: var(--tracking-wide);
  flex-shrink: 0;
}

.topbar-logo-img {
  height: 28px;
  width: auto;
  object-fit: contain;
  display: block;
}

.topbar-logo-suffix {
  font-family: var(--font-mono, 'Roboto Mono', monospace);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--cyan);
  letter-spacing: 0.08em;
  opacity: 0.8;
}

/* ---- Breadcrumb ---- */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  margin-left: var(--space-2);
  flex: 1;
  min-width: 0;
}

.breadcrumb-sep {
  color: var(--text-muted);
  font-size: var(--text-xs);
}

.breadcrumb-current {
  color: var(--text-secondary);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- Demo Toggle Badge (Topbar) ---- */
.demo-toggle-badge {
  background: var(--orange);
  color: var(--text-inverse);
  padding: 0.15em 0.55em;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  animation: pulse-badge 2s ease-in-out infinite;
}

@keyframes pulse-badge {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* ---- Topbar Actions ---- */
.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex-shrink: 0;
}


/* ============================================================
   9. ICON BUTTONS
   ============================================================ */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  position: relative;
}

.icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.icon-btn:active {
  background: var(--bg-active);
  transform: scale(0.95);
}

.icon-btn.active {
  color: var(--cyan);
  background: var(--cyan-subtle);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.75;
}

.icon-btn .badge-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
  border: 2px solid var(--bg-secondary);
}


/* ============================================================
   10. USER MENU
   ============================================================ */
.user-menu-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-2) var(--space-1) var(--space-1);
  border-radius: var(--radius-full);
  transition: background var(--transition-fast);
}

.user-menu-btn:hover { background: var(--bg-hover); }

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--gradient-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: 700;
  color: white;
}

.user-menu-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-secondary);
}

.user-menu-dropdown {
  position: absolute;
  top: calc(var(--topbar-height) - 4px);
  right: var(--space-4);
  width: 220px;
  background: var(--bg-elevated);
  border: var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-2);
  z-index: var(--z-dropdown);
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: all var(--transition-fast);
}

.user-menu-dropdown.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

.user-menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  width: 100%;
  transition: all var(--transition-fast);
}

.user-menu-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.user-menu-item svg { width: 16px; height: 16px; }
.user-menu-divider { height: 1px; background: var(--border-default); margin: var(--space-2) 0; }


/* ============================================================
   11. SIDEBAR
   ============================================================ */
.sidebar {
  grid-area: sidebar;
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: var(--border-default);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width var(--transition-base), background var(--transition-base);
  z-index: var(--z-base);
}

.sidebar.glass {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-right: var(--glass-border);
}

.sidebar-collapsed .sidebar {
  width: var(--sidebar-collapsed);
}

/* ---- Sidebar Header ---- */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-3);
  border-bottom: var(--border-subtle);
  min-height: 48px;
}

.sidebar-title {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  transition: opacity var(--transition-fast);
}

.sidebar-collapsed .sidebar-title { opacity: 0; width: 0; }

.sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-md);
  color: var(--text-tertiary);
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.sidebar-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sidebar-toggle svg { width: 16px; height: 16px; }

/* ---- Nav Group ---- */
.nav-group {
  padding: var(--space-2) var(--space-2);
}

.nav-group-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--text-muted);
  padding: var(--space-2) var(--space-2);
  white-space: nowrap;
  overflow: hidden;
  transition: opacity var(--transition-fast);
}

.sidebar-collapsed .nav-group-label { opacity: 0; height: 0; padding: 0; }

/* ---- Nav Item ---- */
.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: all var(--transition-fast);
  white-space: nowrap;
  overflow: hidden;
  text-decoration: none;
  position: relative;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--cyan-subtle);
  color: var(--cyan);
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--cyan);
  border-radius: var(--radius-full);
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke-width: 1.75;
}

.nav-item-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity var(--transition-fast);
}

.sidebar-collapsed .nav-item-text { opacity: 0; width: 0; }

.nav-item .nav-badge {
  font-size: var(--text-xs);
  font-weight: 700;
  padding: 0.1em 0.5em;
  border-radius: var(--radius-full);
  background: var(--cyan-subtle);
  color: var(--cyan);
  flex-shrink: 0;
  transition: opacity var(--transition-fast);
}

.sidebar-collapsed .nav-badge { opacity: 0; width: 0; }

/* Tooltip for collapsed sidebar */
.sidebar-collapsed .nav-item::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-elevated);
  color: var(--text-primary);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  font-weight: 600;
  white-space: nowrap;
  box-shadow: var(--shadow-md);
  border: var(--border-default);
  opacity: 0;
  pointer-events: none;
  z-index: var(--z-tooltip);
  transition: opacity var(--transition-fast);
}

.sidebar-collapsed .nav-item:hover::after { opacity: 1; }


/* ============================================================
   12. MAIN CONTENT AREA
   ============================================================ */
.main-content {
  grid-area: main;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--space-6);
  background: var(--bg-primary);
  transition: background var(--transition-base);
}

.main-content-inner {
  max-width: var(--content-max-width);
  margin: 0 auto;
}


/* ============================================================
   13. GUIDE PANEL (Right Sidebar)
   ============================================================ */
.guide-panel {
  grid-area: guide;
  width: var(--guide-width);
  background: var(--bg-secondary);
  border-left: var(--border-default);
  overflow-y: auto;
  overflow-x: hidden;
  transition: width var(--transition-base), opacity var(--transition-base);
  z-index: var(--z-base);
}

.guide-panel.glass {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-left: var(--glass-border);
}

.guide-hidden .guide-panel {
  width: 0;
  opacity: 0;
  overflow: hidden;
}

.guide-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-bottom: var(--border-subtle);
  min-height: 48px;
}

.guide-title {
  font-size: var(--text-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--text-muted);
}

.guide-content {
  padding: var(--space-4);
}

.guide-section {
  margin-bottom: var(--space-6);
}

.guide-section-title {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.guide-section-title svg { width: 16px; height: 16px; color: var(--cyan); }

.guide-step {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: var(--border-subtle);
}

.guide-step:last-child { border-bottom: none; }

.guide-step-number {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--cyan-subtle);
  color: var(--cyan);
  font-size: var(--text-xs);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.guide-step-content {
  flex: 1;
}

.guide-step-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.guide-step-desc {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  line-height: 1.5;
}

.guide-step.completed .guide-step-number {
  background: var(--green);
  color: white;
}

.guide-tip {
  background: var(--cyan-subtle);
  border: 1px solid var(--cyan-border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  line-height: 1.5;
}

.guide-tip strong { color: var(--cyan); }


/* ============================================================
   14. STATUS BAR
   ============================================================ */
.statusbar {
  grid-area: statusbar;
  height: var(--statusbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-4);
  background: var(--bg-secondary);
  border-top: var(--border-default);
  font-size: 0.6875rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  z-index: var(--z-sticky);
}

.statusbar-left,
.statusbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.statusbar-item {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.statusbar-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
}

.statusbar-dot.warning { background: var(--orange); }
.statusbar-dot.error { background: var(--red); }
.statusbar-dot.syncing { animation: pulse-dot 1.5s ease-in-out infinite; }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}


/* ============================================================
   15. CARDS
   ============================================================ */
.card {
  background: var(--bg-elevated);
  border: var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.card:hover {
  border-color: var(--cyan-border);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card.glass {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: var(--glass-border);
}

/* Card accent stripe on top */
.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--card-accent, var(--cyan));
  opacity: 0;
  transition: opacity var(--transition-fast);
}
.card:hover::before { opacity: 1; }

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--cyan-subtle);
  color: var(--cyan);
  flex-shrink: 0;
}

.card-icon svg { width: 20px; height: 20px; }

.card-icon.purple { background: var(--purple-subtle); color: var(--purple); }
.card-icon.green  { background: var(--green-subtle);  color: var(--green); }
.card-icon.orange { background: var(--orange-subtle); color: var(--orange); }
.card-icon.red    { background: var(--red-subtle);    color: var(--red); }
.card-icon.blue   { background: var(--blue-subtle);   color: var(--blue); }
.card-icon.teal   { background: var(--teal-subtle);   color: var(--teal); }
.card-icon.rose   { background: var(--rose-subtle);   color: var(--rose); }

.card-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.card-desc {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  line-height: 1.5;
}

.card-badge {
  font-size: var(--text-xs);
  font-weight: 700;
  padding: 0.15em 0.6em;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: var(--border-subtle);
}

/* Entry-point card variant */
.card.entry-card {
  cursor: pointer;
  text-decoration: none;
  display: block;
}

.card.entry-card .card-icon { margin-bottom: var(--space-3); }


/* ============================================================
   16. BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.btn svg { width: 16px; height: 16px; }

/* Primary */
.btn-primary {
  background: var(--green);
  color: white;
}
.btn-primary:hover { background: var(--green-dim); box-shadow: 0 0 20px var(--green-glow); }
.btn-primary:active { transform: scale(0.98); }

/* Secondary */
.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: var(--border-default);
}
.btn-secondary:hover { background: var(--bg-hover); color: var(--text-primary); }

/* Ghost */
.btn-ghost {
  color: var(--text-secondary);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

/* Danger */
.btn-danger {
  background: var(--red-subtle);
  color: var(--red);
  border: 1px solid var(--red-border);
}
.btn-danger:hover { background: var(--red); color: white; }

/* Sizes */
.btn-sm { padding: var(--space-1) var(--space-3); font-size: var(--text-xs); }
.btn-lg { padding: var(--space-3) var(--space-6); font-size: var(--text-base); }

/* Button Group */
.btn-group {
  display: flex;
  gap: var(--space-2);
}


/* ============================================================
   17. BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0.15em 0.55em;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 700;
  white-space: nowrap;
  line-height: 1.4;
}

.badge-cyan    { background: var(--cyan-subtle);   color: var(--cyan); }
.badge-purple  { background: var(--purple-subtle); color: var(--purple); }
.badge-green   { background: var(--green-subtle);  color: var(--green); }
.badge-orange  { background: var(--orange-subtle); color: var(--orange); }
.badge-red     { background: var(--red-subtle);    color: var(--red); }
.badge-blue    { background: var(--blue-subtle);   color: var(--blue); }
.badge-teal    { background: var(--teal-subtle);   color: var(--teal); }
.badge-rose    { background: var(--rose-subtle);   color: var(--rose); }

.badge-solid-cyan   { background: var(--cyan);   color: white; }
.badge-solid-green  { background: var(--green);  color: white; }
.badge-solid-orange { background: var(--orange); color: white; }
.badge-solid-red    { background: var(--red);    color: white; }

.badge-dot::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}


/* ============================================================
   18. MODALS
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--bg-elevated);
  border: var(--border-default);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 90%;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
  transform: scale(0.95) translateY(10px);
  transition: transform var(--transition-base);
}

.modal-overlay.open .modal {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5);
  border-bottom: var(--border-default);
}

.modal-title {
  font-size: var(--text-lg);
  font-weight: 700;
}

.modal-body { padding: var(--space-5); }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-top: var(--border-default);
}


/* ============================================================
   19. FORMS
   ============================================================ */
.form-group { margin-bottom: var(--space-4); }

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  background: var(--bg-tertiary);
  border: var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--text-sm);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px var(--cyan-glow);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-muted);
}

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

.form-hint {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--space-1);
}

.form-error {
  font-size: var(--text-xs);
  color: var(--red);
  margin-top: var(--space-1);
}

.form-input.error { border-color: var(--red); }
.form-input.error:focus { box-shadow: 0 0 0 3px var(--red-glow); }

/* Toggle Switch */
.toggle {
  position: relative;
  width: 40px;
  height: 22px;
  cursor: pointer;
}

.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }

.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--bg-tertiary);
  border: var(--border-default);
  border-radius: var(--radius-full);
  transition: background var(--transition-fast);
}

.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text-tertiary);
  transition: all var(--transition-fast);
}

.toggle input:checked ~ .toggle-track { background: var(--cyan); border-color: var(--cyan); }
.toggle input:checked ~ .toggle-thumb { left: 21px; background: white; }


/* ============================================================
   20. TABLES
   ============================================================ */
.table-wrapper { overflow-x: auto; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.table th {
  text-align: left;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--text-muted);
  background: var(--bg-tertiary);
  border-bottom: var(--border-default);
  white-space: nowrap;
}

.table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: var(--border-subtle);
  color: var(--text-secondary);
  vertical-align: middle;
}

.table tbody tr { transition: background var(--transition-fast); }
.table tbody tr:hover { background: var(--bg-hover); }

.table th:first-child { border-radius: var(--radius-md) 0 0 0; }
.table th:last-child  { border-radius: 0 var(--radius-md) 0 0; }

/* Sortable headers */
.table th.sortable {
  cursor: pointer;
  user-select: none;
}
.table th.sortable:hover { color: var(--text-secondary); }


/* ============================================================
   21. KANBAN
   ============================================================ */
.kanban {
  display: flex;
  gap: var(--space-4);
  overflow-x: auto;
  padding-bottom: var(--space-4);
}

.kanban-column {
  min-width: 280px;
  max-width: 320px;
  flex-shrink: 0;
  background: var(--bg-secondary);
  border: var(--border-default);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
}

.kanban-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-bottom: var(--border-subtle);
}

.kanban-column-title {
  font-size: var(--text-sm);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.kanban-column-count {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: 600;
}

.kanban-column-body {
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  flex: 1;
  overflow-y: auto;
}

.kanban-card {
  background: var(--bg-elevated);
  border: var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  cursor: grab;
  transition: all var(--transition-fast);
}

.kanban-card:hover { border-color: var(--cyan-border); box-shadow: var(--shadow-sm); }
.kanban-card:active { cursor: grabbing; }

.kanban-card-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.kanban-card-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}


/* ============================================================
   22. STAT COUNTERS
   ============================================================ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
}

.stat-card {
  background: var(--bg-elevated);
  border: var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  text-align: center;
  transition: all var(--transition-base);
}

.stat-card:hover { border-color: var(--cyan-border); }

.stat-value {
  font-family: var(--font-mono);
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--text-primary);
  line-height: var(--leading-tight);
  margin-bottom: var(--space-1);
}

.stat-label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--text-tertiary);
}

.stat-change {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  font-weight: 600;
  margin-top: var(--space-2);
}

.stat-change.up { color: var(--green); }
.stat-change.down { color: var(--red); }


/* ============================================================
   23. PROGRESS BAR
   ============================================================ */
.progress {
  width: 100%;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--cyan);
  border-radius: var(--radius-full);
  transition: width var(--transition-slow);
}

.progress-bar.green  { background: var(--green); }
.progress-bar.orange { background: var(--orange); }
.progress-bar.red    { background: var(--red); }
.progress-bar.purple { background: var(--purple); }


/* ============================================================
   24. TOAST / NOTIFICATION
   ============================================================ */
.toast-container {
  position: fixed;
  bottom: calc(var(--statusbar-height) + var(--space-4));
  right: var(--space-4);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column-reverse;
  gap: var(--space-2);
}

.toast {
  background: var(--bg-elevated);
  border: var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 280px;
  max-width: 400px;
  font-size: var(--text-sm);
  animation: toast-in var(--transition-spring) forwards;
}

.toast.leaving { animation: toast-out var(--transition-base) forwards; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(16px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to   { opacity: 0; transform: translateY(16px) scale(0.95); }
}

.toast-icon { flex-shrink: 0; }
.toast-icon svg { width: 18px; height: 18px; }
.toast-message { flex: 1; color: var(--text-secondary); }
.toast-close { flex-shrink: 0; color: var(--text-muted); }

.toast.success .toast-icon { color: var(--green); }
.toast.error   .toast-icon { color: var(--red); }
.toast.warning .toast-icon { color: var(--orange); }
.toast.info    .toast-icon { color: var(--cyan); }


/* ============================================================
   25. TABS
   ============================================================ */
.tabs {
  display: flex;
  gap: var(--space-1);
  border-bottom: var(--border-default);
  margin-bottom: var(--space-4);
}

.tab {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-tertiary);
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
  cursor: pointer;
  white-space: nowrap;
}

.tab:hover { color: var(--text-primary); }

.tab.active {
  color: var(--cyan);
  border-bottom-color: var(--cyan);
}


/* ============================================================
   26. TAGS / CHIPS
   ============================================================ */
.tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0.2em 0.6em;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: var(--border-subtle);
  transition: all var(--transition-fast);
}

.tag:hover { background: var(--bg-hover); }

.tag-removable { cursor: pointer; }
.tag-remove {
  display: flex;
  width: 14px;
  height: 14px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  margin-left: var(--space-1);
}
.tag-remove:hover { background: var(--bg-active); }

.tag-cyan   { background: var(--cyan-subtle); color: var(--cyan); border-color: var(--cyan-border); }
.tag-purple { background: var(--purple-subtle); color: var(--purple); border-color: var(--purple-border); }
.tag-green  { background: var(--green-subtle); color: var(--green); border-color: var(--green-border); }


/* ============================================================
   27. EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center;
  padding: var(--space-12) var(--space-6);
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-4);
  color: var(--text-muted);
  opacity: 0.5;
}

.empty-state-title {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

.empty-state-desc {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  max-width: 400px;
  margin: 0 auto var(--space-6);
}


/* ============================================================
   28. LOADING / SKELETON
   ============================================================ */
.skeleton {
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
}

.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(240,240,245,0.04), transparent);
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

@keyframes skeleton-shimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.skeleton-text { height: 14px; margin-bottom: var(--space-2); }
.skeleton-text:last-child { width: 60%; }
.skeleton-heading { height: 24px; width: 50%; margin-bottom: var(--space-3); }
.skeleton-avatar { width: 40px; height: 40px; border-radius: 50%; }

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--bg-tertiary);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

.spinner-lg { width: 32px; height: 32px; border-width: 3px; }


/* ============================================================
   29. GLASS MORPHISM UTILITY
   ============================================================ */
.glass {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: var(--glass-border);
  border-radius: var(--glass-radius);
}


/* ============================================================
   30. COVERSHEET / LANDING PAGE STYLES
   ============================================================ */
.coversheet {
  position: relative;
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.coversheet-canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.coversheet-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(24, 24, 31, 0.3) 0%,
    rgba(24, 24, 31, 0.7) 60%,
    var(--bg-primary) 100%
  );
  z-index: 1;
}

[data-theme="silver"] .coversheet-overlay {
  background: linear-gradient(
    180deg,
    rgba(34, 34, 40, 0.3) 0%,
    rgba(34, 34, 40, 0.7) 60%,
    var(--bg-primary) 100%
  );
}

[data-theme="light"] .coversheet-overlay {
  background: linear-gradient(
    180deg,
    rgba(245, 245, 245, 0.3) 0%,
    rgba(245, 245, 245, 0.7) 60%,
    var(--bg-primary) 100%
  );
}

.coversheet-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: var(--space-8);
}

.coversheet-brand {
  font-family: var(--font-sans);
  font-size: var(--text-5xl);
  font-weight: 700;
  letter-spacing: var(--tracking-hero);
  color: var(--cyan);
  text-shadow: 0 0 40px var(--cyan-glow), 0 0 80px rgba(34, 197, 94, 0.15);
  margin-bottom: var(--space-3);
  line-height: var(--leading-tight);
}

.coversheet-subtitle {
  font-size: var(--text-xl);
  font-weight: 300;
  color: var(--text-secondary);
  letter-spacing: var(--tracking-wide);
  margin-bottom: var(--space-10);
}

/* Animated Counters Row */
.coversheet-stats {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--space-8);
  margin-bottom: var(--space-12);
}

.coversheet-stat {
  text-align: center;
  min-width: 140px;
}

.coversheet-stat-value {
  font-family: var(--font-mono);
  font-size: var(--text-4xl);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: var(--space-2);
}

.coversheet-stat-value .unit {
  font-size: var(--text-xl);
  font-weight: 400;
  color: var(--text-tertiary);
  margin-left: 0.1em;
}

.coversheet-stat-label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--text-muted);
}

/* Scroll Indicator */
.scroll-indicator {
  position: absolute;
  bottom: var(--space-8);
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-muted);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  animation: bounce-down 2s ease-in-out infinite;
  cursor: pointer;
}

.scroll-indicator svg { width: 20px; height: 20px; }

@keyframes bounce-down {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50%      { transform: translateX(-50%) translateY(8px); }
}


/* ============================================================
   31. ENTRY-POINT CARDS GRID
   ============================================================ */
.entry-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-5);
  padding: var(--space-8) 0;
  max-width: var(--content-max-width);
  margin: 0 auto;
}

.entry-card {
  --card-accent: var(--cyan);
  cursor: pointer;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated);
  border: var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.entry-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--card-accent);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.entry-card:hover {
  border-color: var(--cyan-border);
  box-shadow: var(--shadow-md);
  transform: translateY(-4px);
}

.entry-card:hover::before { opacity: 1; }

.entry-card.cyan    { --card-accent: var(--cyan); }
.entry-card.green   { --card-accent: var(--green); }
.entry-card.purple  { --card-accent: var(--purple); }
.entry-card.teal    { --card-accent: var(--teal); }
.entry-card.orange  { --card-accent: var(--orange); }
.entry-card.blue    { --card-accent: var(--blue); }

.entry-card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-4);
}

.entry-card-icon svg { width: 24px; height: 24px; }

.entry-card.cyan .entry-card-icon    { background: var(--cyan-subtle); color: var(--cyan); }
.entry-card.green .entry-card-icon   { background: var(--green-subtle); color: var(--green); }
.entry-card.purple .entry-card-icon  { background: var(--purple-subtle); color: var(--purple); }
.entry-card.teal .entry-card-icon    { background: var(--teal-subtle); color: var(--teal); }
.entry-card.orange .entry-card-icon  { background: var(--orange-subtle); color: var(--orange); }
.entry-card.blue .entry-card-icon    { background: var(--blue-subtle); color: var(--blue); }

.entry-card-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.entry-card-desc {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  line-height: 1.5;
  flex: 1;
}

.entry-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: var(--border-subtle);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.entry-card-arrow {
  color: var(--text-muted);
  transition: transform var(--transition-fast);
}

.entry-card:hover .entry-card-arrow { transform: translateX(4px); }


/* ============================================================
   32. SCROLL ANIMATIONS
   ============================================================ */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--transition-slow), transform var(--transition-slow);
}

.animate-on-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}

.animate-on-scroll.delay-1 { transition-delay: 100ms; }
.animate-on-scroll.delay-2 { transition-delay: 200ms; }
.animate-on-scroll.delay-3 { transition-delay: 300ms; }
.animate-on-scroll.delay-4 { transition-delay: 400ms; }
.animate-on-scroll.delay-5 { transition-delay: 500ms; }
.animate-on-scroll.delay-6 { transition-delay: 600ms; }

/* Counter animation */
@keyframes count-up {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.counter-animate {
  animation: count-up 0.6s ease-out forwards;
}


/* ============================================================
   33. TOOLTIP
   ============================================================ */
[data-tooltip] { position: relative; }

[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  padding: var(--space-1) var(--space-2);
  background: var(--bg-elevated);
  border: var(--border-default);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  z-index: var(--z-tooltip);
  pointer-events: none;
}


/* ============================================================
   34. DROPDOWN MENU
   ============================================================ */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 180px;
  background: var(--bg-elevated);
  border: var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-2);
  z-index: var(--z-dropdown);
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: all var(--transition-fast);
}

.dropdown-menu.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.dropdown-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.dropdown-item svg { width: 16px; height: 16px; }
.dropdown-divider { height: 1px; background: var(--bg-tertiary); margin: var(--space-1) 0; }


/* ============================================================
   35. AVATAR & AVATAR GROUP
   ============================================================ */
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.avatar-sm { width: 24px; height: 24px; font-size: 0.625rem; }
.avatar-lg { width: 40px; height: 40px; font-size: var(--text-sm); }

.avatar-group {
  display: flex;
}

.avatar-group .avatar {
  margin-left: -8px;
  border: 2px solid var(--bg-primary);
}

.avatar-group .avatar:first-child { margin-left: 0; }

.avatar-group .avatar-more {
  background: var(--bg-tertiary);
  color: var(--text-tertiary);
}


/* ============================================================
   36. SCORE / CIIS METER
   ============================================================ */
.score-meter {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.score-ring {
  position: relative;
  width: 48px;
  height: 48px;
}

.score-ring svg {
  width: 48px;
  height: 48px;
  transform: rotate(-90deg);
}

.score-ring-bg {
  fill: none;
  stroke: var(--bg-tertiary);
  stroke-width: 4;
}

.score-ring-fill {
  fill: none;
  stroke: var(--cyan);
  stroke-width: 4;
  stroke-linecap: round;
  transition: stroke-dashoffset var(--transition-slow);
}

.score-ring-value {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 700;
}


/* ============================================================
   37. TIMELINE / AUDIT LOG
   ============================================================ */
.timeline {
  position: relative;
  padding-left: var(--space-6);
}

.timeline::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 11px;
  width: 2px;
  background: var(--bg-tertiary);
}

.timeline-item {
  position: relative;
  padding-bottom: var(--space-5);
}

.timeline-dot {
  position: absolute;
  left: calc(-1 * var(--space-6) + 4px);
  top: 4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 2px solid var(--cyan);
  z-index: 1;
}

.timeline-dot.green  { border-color: var(--green); }
.timeline-dot.orange { border-color: var(--orange); }
.timeline-dot.red    { border-color: var(--red); }
.timeline-dot.purple { border-color: var(--purple); }

.timeline-content {
  background: var(--bg-elevated);
  border: var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
}

.timeline-time {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: var(--text-muted);
  margin-bottom: var(--space-1);
}

.timeline-text {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}


/* ============================================================
   38. SEARCH BAR
   ============================================================ */
.search-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--bg-tertiary);
  border: var(--border-default);
  border-radius: var(--radius-full);
  padding: var(--space-2) var(--space-4);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.search-bar:focus-within {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px var(--cyan-glow);
}

.search-bar svg { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }

.search-bar input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: var(--text-sm);
}

.search-bar input::placeholder { color: var(--text-muted); }

.search-bar kbd {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  padding: 0.1em 0.4em;
  background: var(--bg-secondary);
  border: var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
}


/* ============================================================
   39. RESPONSIVE BREAKPOINTS
   ============================================================ */
@media (max-width: 1200px) {
  .app-shell {
    grid-template-columns: var(--sidebar-width) 1fr 0;
  }
  .guide-panel { width: 0; opacity: 0; overflow: hidden; }
  .entry-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 0 1fr 0;
  }
  .sidebar {
    position: fixed;
    left: 0;
    top: var(--topbar-height);
    bottom: var(--statusbar-height);
    width: var(--sidebar-width);
    z-index: var(--z-overlay);
    transform: translateX(-100%);
    transition: transform var(--transition-base);
  }
  .sidebar.mobile-open { transform: translateX(0); }

  .guide-panel {
    position: fixed;
    right: 0;
    top: var(--topbar-height);
    bottom: var(--statusbar-height);
    width: var(--guide-width);
    z-index: var(--z-overlay);
    transform: translateX(100%);
    transition: transform var(--transition-base);
  }
  .guide-panel.mobile-open { transform: translateX(0); }

  .coversheet-brand { font-size: var(--text-3xl); }
  .coversheet-stats { gap: var(--space-4); }
  .entry-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  :root {
    --topbar-height: 48px;
    --space-6: 1rem;
  }

  .topbar { padding: 0 var(--space-3); gap: var(--space-2); }
  .breadcrumb { display: none; }
  .user-menu-name { display: none; }

  .main-content { padding: var(--space-4); }

  .coversheet-brand { font-size: var(--text-2xl); }
  .coversheet-stat-value { font-size: var(--text-2xl); }

  .stat-grid { grid-template-columns: repeat(2, 1fr); }

  .kanban {
    flex-direction: column;
  }
  .kanban-column { min-width: 100%; max-width: 100%; }

  .table { font-size: var(--text-xs); }
  .table th, .table td { padding: var(--space-2); }
}


/* ============================================================
   40. SIDEBAR OVERLAY (mobile)
   ============================================================ */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: calc(var(--z-overlay) - 1);
}

@media (max-width: 900px) {
  .sidebar-overlay.active { display: block; }
}


/* ============================================================
   41. PRINT STYLES
   ============================================================ */
@media print {
  .topbar,
  .sidebar,
  .guide-panel,
  .statusbar,
  .demo-bar,
  .toast-container {
    display: none !important;
  }

  .app-shell {
    display: block;
  }

  .main-content {
    padding: 0;
  }

  body {
    background: white;
    color: black;
  }

  .card, .entry-card {
    border: 1px solid #ddd;
    box-shadow: none;
    break-inside: avoid;
  }
}


/* ============================================================
   42. ACCESSIBILITY / FOCUS STYLES
   ============================================================ */
:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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


/* ============================================================
   43. HIGH CONTRAST MODE
   ============================================================ */
@media (prefers-contrast: high) {
  :root {
    --border-default: 1px solid rgba(240, 240, 245, 0.25);
    --border-subtle:  1px solid rgba(240, 240, 245, 0.15);
  }

  .card, .entry-card, .kanban-card {
    border-width: 2px;
  }
}


/* ============================================================
   44. SEGMENT BADGE (Pulse Animation)
   ============================================================ */
.segment-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0.15em 0.6em;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 700;
  position: relative;
}

.segment-badge .pulse-ring {
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  border: 2px solid currentColor;
  opacity: 0;
  animation: segment-pulse 2s ease-in-out infinite;
}

@keyframes segment-pulse {
  0%   { opacity: 0.6; transform: scale(1); }
  100% { opacity: 0;   transform: scale(1.3); }
}


/* ============================================================
   45. CONTENT ROW LAYOUT
   ============================================================ */
.content-row {
  display: flex;
  gap: var(--space-6);
}

.content-row .content-primary { flex: 1; min-width: 0; }
.content-row .content-aside   { width: 320px; flex-shrink: 0; }

@media (max-width: 1100px) {
  .content-row { flex-direction: column; }
  .content-row .content-aside { width: 100%; }
}


/* ============================================================
   46. PAGE HEADER
   ============================================================ */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-6);
  gap: var(--space-4);
}

.page-title {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--text-primary);
  line-height: var(--leading-tight);
}

.page-desc {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  margin-top: var(--space-1);
}

.page-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

@media (max-width: 600px) {
  .page-header { flex-direction: column; }
  .page-title { font-size: var(--text-xl); }
}


/* ============================================================
   47. FILTER BAR
   ============================================================ */
.filter-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: var(--border-subtle);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}

.filter-bar .form-select {
  width: auto;
  min-width: 140px;
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
}

.filter-bar .search-bar {
  min-width: 200px;
}

.filter-bar-count {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-left: auto;
}


/* ============================================================
   48. REVIEW ITEM (for Review Queue page)
   ============================================================ */
.review-item {
  background: var(--bg-elevated);
  border: var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  display: flex;
  gap: var(--space-4);
  transition: all var(--transition-base);
  margin-bottom: var(--space-3);
}

.review-item:hover {
  border-color: var(--cyan-border);
  box-shadow: var(--shadow-sm);
}

.review-item-priority {
  width: 4px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.review-item-priority.high    { background: var(--red); }
.review-item-priority.medium  { background: var(--orange); }
.review-item-priority.low     { background: var(--green); }

.review-item-body { flex: 1; min-width: 0; }

.review-item-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.review-item-meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  flex-wrap: wrap;
}

.review-item-actions {
  display: flex;
  gap: var(--space-2);
  align-items: flex-start;
  flex-shrink: 0;
}


/* ============================================================
   END OF DESIGN SYSTEM
   ============================================================ */

/* Coversheet break-out: bust out of main-content padding + inner max-width */
.main-content-inner > #coversheet-section {
  position: relative;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  min-height: 100vh;
}

/* Remove main-content padding when coversheet is the first child */
.main-content:has(#coversheet-section) {
  padding: 0;
}
.main-content:has(#coversheet-section) > .main-content-inner {
  max-width: none;
}

/* Canvas fills coversheet absolutely */
#coversheet-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100% !important;
  height: 100% !important;
}

/* Below-fold restores inner padding */
.below-fold {
  max-width: var(--content-max-width);
  margin: 0 auto;
  padding: var(--space-8) var(--space-6);
}


/* ============================================================
   BEST PRACTICES: Utility States, Micro-animations, Reveal
   ============================================================ */

/* --- Centralized State Indicators (#18) --- */
.q-state-loading, .q-state-error, .q-state-empty {
  display: flex; align-items: center; justify-content: center; gap: var(--space-3);
  padding: var(--space-8); color: var(--text-tertiary); font-size: var(--text-sm);
}
.q-state-error { color: var(--red); }

/* Spinner */
.q-spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--bg-hover);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: q-spin 0.7s linear infinite;
}
@keyframes q-spin { to { transform: rotate(360deg); } }

/* --- Scroll Reveal (#7) --- */
.q-scroll-reveal {
  opacity: 0; transform: translateY(16px);
  transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}
.q-scroll-reveal.revealed {
  opacity: 1; transform: translateY(0);
}

/* --- Micro-animation Enhancements (#3) --- */
.sidebar-nav-item {
  transition: background var(--transition-fast), color var(--transition-fast), transform 0.15s ease;
}
.sidebar-nav-item:active {
  transform: scale(0.97);
}

.stat-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--cyan-border);
}

.table tbody tr {
  transition: background var(--transition-fast), transform 0.1s ease;
}
.table tbody tr:active {
  transform: scale(0.998);
}

/* Card press effect */
.card:active, .q-card:active {
  transform: scale(0.98);
  transition: transform 0.1s ease;
}

/* Button ripple-style press */
.btn:active, .btn-primary:active {
  transform: scale(0.96);
  transition: transform 0.08s ease;
}

/* Icon button hover glow */
.icon-btn {
  transition: background var(--transition-fast), color var(--transition-fast), box-shadow 0.2s ease;
}
.icon-btn:hover {
  box-shadow: 0 0 8px var(--cyan-glow);
}

/* Focus-visible ring for keyboard navigation */
:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

/* Tooltip fade */
[data-tooltip]::after {
  transition: opacity 0.15s ease, transform 0.15s ease;
  transform: translateY(4px);
}
[data-tooltip]:hover::after {
  transform: translateY(0);
}
