/* Order-immune design tokens live in one shared layer (deep-overhaul Phase 3
   W1). Divergent theme-overlay tokens (brand vs vibrant values, e.g. the auth
   pages' warm look) deliberately stay declared in their source files.
   @import must precede every other rule or the browser ignores it. */
@import url("./assets/css/tokens.css?v=3");

@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 100 700;
  font-display: swap;
  src: url("./assets/fonts/meritus/ibm-plex-sans-latin-wght.woff2")
    format("woff2-variations");
}

@font-face {
  font-family: "Cormorant Garamond";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("./assets/fonts/meritus/cormorant-garamond-400.woff2") format("woff2");
}

@font-face {
  font-family: "Cormorant Garamond";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("./assets/fonts/meritus/cormorant-garamond-600.woff2") format("woff2");
}

@font-face {
  font-family: "Cormorant Garamond";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("./assets/fonts/meritus/cormorant-garamond-700.woff2") format("woff2");
}

/* ============================================
    CORRESPONDENCE TAB & TOOLBAR BRANDING
    ============================================ */

.correspondence-page .toolbar,
.correspondence-page .toolbar-top-row {
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-default);
  padding: var(--space-4);
  box-shadow: var(--shadow-sm);
}

.correspondence-page .section-tab,
.correspondence-page .tab,
.toolbar .btn {
  transition: all var(--duration-fast) var(--ease-default);
  border-radius: var(--radius-md);
}

.correspondence-page .section-tab.active,
.correspondence-page .tab.active,
.toolbar .btn-primary {
  background: linear-gradient(135deg, var(--vericase-teal) 0%, var(--vericase-teal-dark) 100%);
  color: white;
  box-shadow: var(--shadow-teal);
}

.correspondence-page .view-toggle-group .dropdown-item.active {
  background: var(--vericase-teal-ghost);
  color: var(--vericase-teal-dark);
  border: 1px solid var(--vericase-teal);
}

/* Nice pagination branding for correspondence */
.pagination,
.correspondence-page .ag-paging-panel {
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  box-shadow: var(--shadow-sm);
}

/* ============================================
===========================================
=========================================== */

:root {
  --color-line: rgba(10, 16, 20, 0.10);

  /* ============================================
  /* SEMANTIC LAYER — "Confident Parchment" v2.
     Components and pages should consume these roles, not raw colors.
     One canvas mode platform-wide: warm bone canvas, white cards,
     vellum wells. Teal = action, amber = AI insight only. */
  /* ============================================ */
  --surface-canvas: #f5f0e8;
  --surface-card-border: rgba(10, 16, 20, 0.09);
  --surface-well: rgba(237, 229, 214, 0.45);

  --action: var(--color-teal);
  --action-strong: var(--color-teal-dark);
  --action-soft: rgba(14, 106, 106, 0.08);
  --action-contrast: var(--color-ivory);

  --insight: var(--color-amber);
  --insight-strong: var(--color-amber-dim);
  --insight-soft: rgba(159, 122, 68, 0.10);

  --positive: #1a7f4f;
  --positive-soft: rgba(26, 127, 79, 0.10);
  --caution: #9a6b1f;
  --caution-soft: rgba(154, 107, 31, 0.12);
  --critical: #b3362c;
  --critical-soft: rgba(179, 54, 44, 0.10);

  --text-display: var(--color-ink);
  --text-body: var(--color-graphite);
  --text-quiet: var(--color-stone);
  --font-mono: "JetBrains Mono", "SF Mono", "Fira Code", monospace;

  --vericase-teal: var(--color-teal);
  --vericase-teal-dark: var(--color-teal-dark);
  --vericase-teal-darker: #043536;
  --vericase-teal-light: #009588;
  --vericase-teal-lighter: var(--color-teal-soft);
  --vericase-teal-rgb: 11, 59, 36;
  --vericase-teal-ghost: rgba(var(--vericase-teal-rgb), 0.06);

  /* Secondary Accent - Sage Mist (pale green) */
  --vericase-sage-mist: var(--color-teal-soft);

  --vericase-navy: var(--color-ink);
  --vericase-navy-light: #0b3b24;
  --vericase-navy-lighter: #154d35;
  --vericase-blue: var(--color-teal);
  --vericase-blue-dark: var(--color-teal-dark);
  --vericase-blue-light: var(--color-teal-soft);
  --vericase-blue-rgb: 14, 106, 106;

  --vericase-gold: var(--color-amber);
  --vericase-gold-light: #b89157;
  --vericase-gold-muted: var(--color-amber-dim);
  --vericase-gold-rgb: 159, 122, 68;

  /* Legacy Mint Tokens (kept for compatibility; aligned to Spruce) */
  --vericase-mint: var(--vericase-teal);
  --vericase-mint-dark: var(--vericase-teal-dark);
  --vericase-mint-light: var(--vericase-teal-light);

  /* Royal Green - Vintage/Club Aesthetic (Control Centre) */
  --vericase-royal-green: #1a3c34;
  --vericase-royal-green-dark: #0f2621;
  --vericase-royal-green-light: #2c5e52;
  --vericase-royal-green-ghost: rgba(26, 60, 52, 0.08);
  --bg-primary: var(--surface-canvas);
  --bg-secondary: var(--color-ivory);
  --bg-tertiary: var(--color-vellum);
  --bg-elevated: var(--color-paper);
  --bg-dark: var(--color-ink);
  --bg-sidebar: #0b3b24;
  --bg-header: rgba(250, 248, 245, 0.94);

  /* Surface textures: paper-dot grain retired platform-wide (one clean
     canvas mode). Token kept for compatibility; resolves to nothing. */
  --surface-paper-gradient: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.78) 0%,
    rgba(252, 250, 246, 0.96) 100%
  );
  --surface-paper-dots: none;

  /* Text */
  --text-primary: var(--color-graphite);
  --text-secondary: var(--color-stone);
  --text-tertiary: var(--color-stone);
  --text-muted: #7b858e;
  --text-link: var(--vericase-teal);

  /* Borders */
  --border-default: var(--color-line);
  --border-muted: rgba(10, 16, 20, 0.08);
  --border-focus: var(--vericase-teal);

  /* Status Colors */
  --success: #059669;
  --success-light: #d1fae5;
  --success-dark: #047857;

  --warning: #6f542f;
  --warning-light: #ede5d6;
  --warning-dark: #6f542f;

  --error: #dc2626;
  --error-light: #fee2e2;
  --error-dark: #b91c1c;

  --info: var(--vericase-teal);
  --info-light: rgba(var(--vericase-teal-rgb), 0.1); /* 17px */
  --text-xl: 1.25rem; /* 20px */
  --text-2xl: 1.5rem; /* 24px */
  --text-3xl: 1.875rem; /* 30px */
  --text-4xl: 2.25rem; /* 20px */
  --space-6: 1.5rem; /* 24px */
  --space-8: 2rem;

  /* ============================================
  /* SHADOWS - Enhanced Depth */
  /* ============================================ */
  --shadow-xs: 0 1px 2px rgba(28, 25, 23, 0.05);
  --shadow-sm:
    0 1px 3px rgba(28, 25, 23, 0.08), 0 1px 2px rgba(28, 25, 23, 0.06);
  --shadow-md:
    0 4px 6px -1px rgba(28, 25, 23, 0.08), 0 2px 4px -2px rgba(28, 25, 23, 0.05);
  --shadow-card:
    0 2px 8px rgba(28, 25, 23, 0.08), 0 1px 3px rgba(28, 25, 23, 0.04);
  --shadow-lg:
    0 10px 20px -4px rgba(28, 25, 23, 0.12),
    0 4px 8px -4px rgba(28, 25, 23, 0.06);
  --shadow-xl:
    0 20px 30px -6px rgba(28, 25, 23, 0.14),
    0 8px 12px -6px rgba(28, 25, 23, 0.06);

  /* Colored Shadows */
  --shadow-teal: 0 4px 14px rgba(var(--vericase-teal-rgb), 0.25);
  --shadow-teal-lg: 0 8px 24px rgba(var(--vericase-teal-rgb), 0.3);
  --shadow-gold: 0 4px 14px rgba(184, 134, 11, 0.2);
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ============================================
/* GLOBAL RESETS & BASE STYLES */
/* ============================================ */

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

html {
  font-size: 16px;
  height: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

body {
  font-family: var(--font-sans) !important;
  font-feature-settings: "ss01", "ss02", "kern", "liga";
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text-secondary) !important;
  background-color: var(--bg-elevated) !important;
  height: 100%;
  height: 100dvh; /* mobile: track the visible viewport so the shell is never clipped by the URL bar */
  overflow: hidden;
  max-width: 100vw;
}

.app-shell {
  background-color: var(--bg-primary) !important;
  background-image: var(--surface-paper-dots) !important;
  background-size: var(--surface-paper-dots-size) !important;
  background-repeat: repeat !important;
  background-position: 0 0 !important;
}

.app-main {
  background-color: var(--bg-primary) !important;
  background-image: var(--surface-paper-dots) !important;
  background-size: var(--surface-paper-dots-size) !important;
  background-repeat: repeat !important;
  background-position: 0 0 !important;
}

.app-content {
  background-color: transparent !important;
  background-image: none !important;
}

/* ============================================
/* SURFACE TEXTURES (Premium Paper) */
/* Subtle gradient + micro-dot texture for white boxes */
/* ============================================ */

.surface-paper,
.card,
.panel,
.modal-content,
.dropdown-menu,
.popover,
[class*="card"]:not(.workspace-card),
[class*="panel"],
.data-grid-wrapper,
.pst-table-wrap,
.ag-root-wrapper {
  background-color: var(--bg-elevated) !important;
  background-image: var(--surface-paper-dots), var(--surface-paper-gradient) !important;
  background-size: var(--surface-paper-dots-size), auto !important;
  background-repeat: repeat, no-repeat !important;
  background-position: 0 0, 0 0 !important;
}

/* Ensure full width for results and document areas */
.app-main,
.app-content,
.data-grid-wrapper,
.pst-table-wrap,
.ag-root-wrapper,
.page-wrap {
  width: 100% !important;
  max-width: none !important;
  box-sizing: border-box;
}

/* ============================================
/* PAGE WATERMARKS (Decorative Icons) */
/* Subtle legal/professional background marks */
/* ============================================ */

.vericase-watermarks-host {
  position: relative;
  isolation: isolate;
  overflow-x: hidden;
}

.vericase-watermarks {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: -1;
}

.vericase-watermark {
  position: absolute;
  font-size: var(--wm-size, 280px);
  color: var(--vericase-navy);
  opacity: var(--wm-opacity, 0.025);
  transform: rotate(var(--wm-rotate, 0deg));
  filter: saturate(0.9);
}

/* Placement presets (use with `--wm-rotate` / `--wm-size`) */
.vericase-watermark.wm-tr { right: -44px; top: 76px; }
.vericase-watermark.wm-tl { left: -44px; top: 96px; }
.vericase-watermark.wm-br { right: -64px; bottom: -32px; }
.vericase-watermark.wm-bl { left: -64px; bottom: -32px; }
.vericase-watermark.wm-mr { right: -56px; top: 44%; }
.vericase-watermark.wm-ml { left: -56px; top: 46%; }

/* ============================================
/* GLOBAL BORDER-RADIUS NORMALIZATION */
/* Professional corners throughout the app */
/* ============================================ */

/* Cards and containers - professional corners */
.card,
.panel,
.modal-content,
.dropdown-menu,
.popover,
.toast,
[class*="card"],
[class*="panel"],
[class*="container"]:not(.stats-container):not(.toast-container) {
  border-radius: var(--radius-lg) !important;
}

/* Inputs and form controls */
input:not([type="checkbox"]):not([type="radio"]),
select,
textarea,
.form-control,
.input,
[class*="input"],
[class*="select"] {
  border-radius: var(--radius-md) !important;
}

/* Buttons - professional corners */
button,
.btn,
[class*="btn"]:not([class*="btn-pill"]) {
  border-radius: var(--radius-md) !important;
}

/* Pills and badges - keep full radius */
.pill,
.badge,
.tag,
.chip,
[class*="pill"]:not(.stat-pill),
[class*="badge"]:not(.category-badge),
[class*="tag"] {
  border-radius: var(--radius-full) !important;
}

/* Stat pills - professional left-border accent style */
.stat-pill {
  border-radius: var(--radius-md) !important;
}

/* Status indicators - keep full radius */
.status-dot,
.indicator,
.avatar {
  border-radius: var(--radius-full) !important;
}

/* Tabs */
.tab,
[class*="tab"]:not([class*="table"]) {
  border-radius: var(--radius-md) var(--radius-md) 0 0 !important;
}

/* ============================================
/* DIGITAL BARRISTER OVERRIDES */
/* Professional, readable, not cramped */
/* ============================================ */

/* App content container - professional corners, comfortable spacing */
.app-content {
  border-radius: var(--radius-lg) !important; /* 8px, not 26px */
  padding: var(--space-5) !important; /* 20px - readable, not cramped */
  margin: var(--space-3) !important; /* 12px */
}

/* Kill 999px pill shapes - use professional 6px corners */
.search-chip,
.filter-chip,
.keyword-tag,
.entity-pill,
.search-filter,
[class*="chip"]:not(.stat-pill) {
  border-radius: var(--radius-md) !important; /* 6px */
}

/* Reduce shadow depth globally - subtle, not floating */
[class*="card"]:not(.workspace-card),
.modal-content,
.dropdown-menu {
  box-shadow: var(--shadow-sm) !important;
}

/* Empty states - comfortable padding */
.empty-state,
.onboarding-state {
  padding: 32px 24px !important;
  border-radius: var(--radius-lg) !important;
}

/* AG-Grid density - readable rows */
.ag-theme-vericase,
.ag-theme-alpine {
  --ag-row-height: 44px !important; /* Readable, was 100px */
  --ag-header-height: 36px !important;
  --ag-cell-horizontal-padding: 12px !important;
}

/* Workspace grid - readable cards */
.workspace-grid {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)) !important;
  gap: 16px !important;
}

/* Items grid density (workspace-hub) */
.items-grid {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)) !important;
  gap: 16px !important;
}

/* Welcome banner - comfortable */
.welcome-banner {
  padding: 1.25rem 1.5rem !important;
  margin-bottom: 1.25rem !important;
}

/* Detail panel - readable width */
.detail-panel,
.context-panel {
  width: 340px !important;
  max-width: 340px !important;
}

/* Stats bar - comfortable spacing */
.stats-bar {
  gap: 10px !important;
  margin-bottom: 20px !important;
}

/* Header gaps - comfortable */
.dashboard-header {
  gap: 16px !important;
  margin-bottom: 20px !important;
}

/* Section margins - comfortable */
.search-section {
  margin-bottom: 24px !important;
}

/* SIDEBAR - Softer, less overpowering */
.app-sidebar {
  background:
    radial-gradient(120% 85% at 18% 0%,
      rgba(var(--vericase-blue-rgb, 47, 134, 200), 0.22) 0%,
      rgba(var(--vericase-blue-rgb, 47, 134, 200), 0.08) 30%,
      rgba(0, 0, 0, 0) 62%), linear-gradient(180deg, #2c333d 0%, #334155 52%, #2c333d 100%) !important;
}

.app-header {
  height: 64px;
  background: var(--vericase-navy) !important;
  color: var(--text-inverted) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  padding: 0 var(--space-6);
  gap: var(--space-4);
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
}

.app-header-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-inverted);
  font-family: var(--font-serif);
}

.app-header-subtitle {
  font-size: var(--text-sm);
  color: rgba(255, 255, 255, 0.8);
  margin-left: var(--space-2);
}

/* ============================================
/* TYPOGRAPHY SYSTEM */
/* ============================================ */

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-serif);
  font-weight: 700;
  line-height: var(--leading-tight);
  color: var(--vericase-navy);
  letter-spacing: -0.02em;
}

h1 {
  font-size: var(--text-4xl);
  font-weight: 900;
}

h2 {
  font-size: var(--text-3xl);
}

h3 {
  font-size: var(--text-2xl);
}

h4 {
  font-size: var(--text-xl);
}

h5 {
  font-size: var(--text-lg);
}

h6 {
  font-size: var(--text-base);
}

/* Serif Accent Typography */
.font-serif {
  font-family: var(--font-serif);
}

.text-serif-heading {
  font-family: var(--font-serif);
  font-weight: 500;
  font-style: italic;
  letter-spacing: 0.01em;
}

.text-serif-quote {
  font-family: var(--font-serif);
  font-size: var(--text-xl);
  font-style: italic;
  color: var(--text-secondary);
}

/* Monospace */
.font-mono {
  font-family: var(--font-mono);
}

code,
pre,
kbd,
samp {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

/* Text Colors */
.text-primary {
  color: var(--text-primary);
}
.text-secondary {
  color: var(--text-secondary);
}
.text-tertiary {
  color: var(--text-tertiary);
}
.text-muted {
  color: var(--text-muted);
}
.text-teal {
  color: var(--vericase-teal);
}
.text-navy {
  color: var(--vericase-navy);
}
.text-gold {
  color: var(--vericase-gold);
}
.text-success {
  color: var(--success);
}
.text-warning {
  color: var(--warning);
}
.text-error {
  color: var(--error);
}

/* ============================================
/* VERICASE LOGO */
/* ============================================ */

.vericase-logo {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: var(--text-xl);
  text-decoration: none;
  transition: opacity var(--duration-fast) var(--ease-default);
}

.vericase-logo:hover {
  opacity: 0.9;
}

.logo-veri {
  color: var(--vericase-teal);
}

.logo-case {
  color: var(--text-inverted);
}

/* Dark variant */
.vericase-logo--dark .logo-case {
  color: var(--vericase-navy);
}

/* Image logo */
.vericase-logo img {
  height: 32px;
  width: auto;
}

/* ============================================
/* PREMIUM BUTTONS */
/* ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.75rem 1.25rem;
  border: none;
  border-radius: var(--radius-control);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-default);
  position: relative;
  overflow: hidden;
}

.btn:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 3px var(--vericase-teal-ghost),
    0 0 0 1px var(--vericase-teal);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Primary Button - Deep Spruce (Executive Action) */
.btn-primary,
.btn-vericase {
  background: var(--color-ink);
  color: var(--text-inverted);
  border: 1px solid rgba(10, 16, 20, 0.88);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.14) inset;
}

.btn-primary:hover:not(:disabled),
.btn-vericase:hover:not(:disabled) {
  background: var(--color-teal-dark);
  border-color: var(--color-teal-dark);
  box-shadow: 0 8px 22px -18px rgba(10, 16, 20, 0.72);
  transform: translateY(-1px);
}

.btn-primary:active:not(:disabled),
.btn-vericase:active:not(:disabled) {
  transform: translateY(0);
}

/* Secondary Button - Navy */
.btn-secondary,
.btn-navy {
  background: var(--color-vellum);
  color: var(--color-ink);
  border: 1px solid var(--color-line);
  box-shadow: none;
}

.btn-secondary:hover:not(:disabled),
.btn-navy:hover:not(:disabled) {
  background: var(--color-cream);
  border-color: var(--color-line-strong);
  box-shadow: none;
  transform: translateY(-1px);
}

/* Outline Button */
.btn-outline {
  background: transparent;
  color: var(--color-ink);
  border: 1px solid var(--color-line-strong);
}

.btn-outline:hover:not(:disabled) {
  background: rgba(10, 16, 20, 0.04);
  border-color: rgba(10, 16, 20, 0.28);
}

/* Ghost Button */
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--gray-100);
  color: var(--text-primary);
}

/* Button Sizes */
.btn-sm {
  padding: 0.5rem 0.875rem;
  font-size: var(--text-xs);
  border-radius: var(--radius-md);
}

.btn-lg {
  padding: 1rem 1.75rem;
  font-size: var(--text-base);
  border-radius: var(--radius-xl);
}

/* Icon Button */
.btn-icon {
  padding: 0.625rem;
  width: 36px;
  height: 36px;
}

.btn-icon.btn-sm {
  width: 28px;
  height: 28px;
  padding: 0.375rem;
}

/* ============================================
/* PREMIUM CARDS */
/* ============================================ */

.card {
  background-color: var(--bg-elevated);
  border-radius: var(--radius-control);
  border: 1px solid var(--border-default);
  box-shadow: 0 0 0 1px rgba(10, 16, 20, 0.015), 0 8px 60px -48px rgba(35, 30, 25, 0.24);
  padding: var(--space-6);
  transition: all var(--duration-normal) var(--ease-default);
}

.card:hover {
  border-color: var(--color-line-strong);
  box-shadow: 0 0 0 1px rgba(10, 16, 20, 0.02), 0 14px 70px -52px rgba(35, 30, 25, 0.3);
}

.card-interactive:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 60px -48px rgba(10, 16, 20, 0.34);
  border-color: rgba(var(--vericase-teal-rgb), 0.32);
}

/* Card Variants */
.card-teal {
  background: linear-gradient(
    135deg,
    var(--vericase-teal) 0%,
    var(--vericase-teal-dark) 100%
  );
  border: none;
  color: var(--text-inverted);
}

.card-navy {
  background: linear-gradient(
    135deg,
    var(--vericase-navy) 0%,
    var(--vericase-navy-light) 100%
  );
  border: none;
  color: var(--text-inverted);
}

.card-glass {
  background: rgba(255, 255, 255, 0.8);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.5);
}

/* ============================================
/* FORM INPUTS */
/* ============================================ */

.input {
  width: 100%;
  padding: 0.75rem 1rem;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--text-primary);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  transition: all var(--duration-fast) var(--ease-default);
}

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

.input:focus {
  outline: none;
  border-color: var(--vericase-teal);
  box-shadow: 0 0 0 3px var(--vericase-teal-ghost);
}

.input:disabled {
  background: var(--gray-50);
  cursor: not-allowed;
}

/* Input Sizes */
.input-sm {
  padding: 0.5rem 0.75rem;
  font-size: var(--text-xs);
}

.input-lg {
  padding: 1rem 1.25rem;
  font-size: var(--text-base);
}

/* ============================================
/* BADGES & PILLS */
/* ============================================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0.25rem 0.625rem;
  font-size: var(--text-xs);
  font-weight: 600;
  border-radius: var(--radius-full);
  letter-spacing: 0.02em;
}

.badge-teal {
  background: var(--vericase-teal-ghost);
  color: var(--vericase-teal-dark);
}

.badge-navy {
  background: rgba(15, 23, 42, 0.08);
  color: var(--vericase-navy);
}

.badge-success {
  background: var(--success-light);
  color: var(--success-dark);
}

.badge-warning {
  background: var(--warning-light);
  color: var(--warning-dark);
}

.badge-error {
  background: var(--error-light);
  color: var(--error-dark);
}

.badge-gold {
  background: rgba(184, 134, 11, 0.1);
  color: var(--vericase-gold);
}

/* ============================================
/* AI ENTITY PILLS (Seamless Integration) */
/* ============================================ */

.entity-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px 8px;
  font-size: var(--text-xs);
  font-weight: 500;
  border-radius: var(--radius-md);
  background: var(--gray-100);
  color: var(--text-secondary);
  border: 1px solid var(--border-default);
  margin: 0 4px 4px 0;
}

.entity-pill--person {
  background: rgba(14, 106, 106, 0.08);
  color: var(--color-teal-dark);
  border-color: rgba(14, 106, 106, 0.18);
}

.entity-pill--org {
  background: rgba(10, 16, 20, 0.05);
  color: var(--color-graphite);
  border-color: rgba(10, 16, 20, 0.1);
}

.entity-pill--date {
  background: rgba(216, 233, 231, 0.54);
  color: var(--color-teal-dark);
  border-color: rgba(14, 106, 106, 0.15);
}

.entity-pill--location {
  background: rgba(159,122,68, 0.11);
  color: #6f542f;
  border-color: rgba(159,122,68, 0.2);
}

/* ============================================
/* STATUS INDICATORS */
/* ============================================ */

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
}

.status-dot--active,
.status-dot--success {
  background: var(--success);
}

.status-dot--pending,
.status-dot--warning {
  background: var(--warning);
}

.status-dot--error {
  background: var(--error);
}

.status-dot--muted {
  background: var(--gray-400);
}

/* Pulse Animation */
.status-dot--pulse {
  animation: pulse-dot 2s infinite;
}

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

/* ============================================
/* ALERTS & NOTIFICATIONS */
/* ============================================ */

.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  border-left: 4px solid;
  font-size: var(--text-sm);
}

.alert-icon {
  flex-shrink: 0;
  margin-top: 1px;
}

.alert-info {
  background: var(--info-light);
  border-color: var(--info);
  color: var(--vericase-teal-dark);
}

.alert-success {
  background: var(--success-light);
  border-color: var(--success);
  color: var(--success-dark);
}

.alert-warning {
  background: var(--warning-light);
  border-color: var(--warning);
  color: var(--warning-dark);
}

.alert-error {
  background: var(--error-light);
  border-color: var(--error);
  color: var(--error-dark);
}

/* ============================================
/* LOADING STATES */
/* ============================================ */

.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--gray-200);
  border-top-color: var(--vericase-teal);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-spinner--sm {
  width: 14px;
  height: 14px;
  border-width: 1.5px;
}

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

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

/* Skeleton Loading */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--gray-100) 0%,
    var(--gray-200) 20%,
    var(--gray-100) 40%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* ============================================
/* UTILITY CLASSES */
/* ============================================ */

/* Display */
.hidden {
  display: none;
}
.block {
  display: block;
}
.flex {
  display: flex;
}
.inline-flex {
  display: inline-flex;
}
.grid {
  display: grid;
}

/* Flex */
.flex-col {
  flex-direction: column;
}
.flex-wrap {
  flex-wrap: wrap;
}
.items-start {
  align-items: flex-start;
}
.items-center {
  align-items: center;
}
.items-end {
  align-items: flex-end;
}
.justify-start {
  justify-content: flex-start;
}
.justify-center {
  justify-content: center;
}
.justify-end {
  justify-content: flex-end;
}
.justify-between {
  justify-content: space-between;
}
.flex-1 {
  flex: 1;
}
.flex-shrink-0 {
  flex-shrink: 0;
}

/* Gap */
.gap-1 {
  gap: var(--space-1);
}
.gap-2 {
  gap: var(--space-2);
}
.gap-3 {
  gap: var(--space-3);
}
.gap-4 {
  gap: var(--space-4);
}
.gap-6 {
  gap: var(--space-6);
}
.gap-8 {
  gap: var(--space-8);
}

/* Width/Height */
.w-full {
  width: 100%;
}
.h-full {
  height: 100%;
}
.min-h-screen {
  min-height: 100vh;
}

/* Text Alignment */
.text-left {
  text-align: left;
}
.text-center {
  text-align: center;
}
.text-right {
  text-align: right;
}

/* Border Radius */
.rounded {
  border-radius: var(--radius-md);
}
.rounded-lg {
  border-radius: var(--radius-lg);
}
.rounded-xl {
  border-radius: var(--radius-xl);
}
.rounded-full {
  border-radius: var(--radius-full);
}

/* Shadows */
.shadow-sm {
  box-shadow: var(--shadow-sm);
}
.shadow {
  box-shadow: var(--shadow-md);
}
.shadow-lg {
  box-shadow: var(--shadow-lg);
}
.shadow-xl {
  box-shadow: var(--shadow-xl);
}

/* Overflow */
.overflow-hidden {
  overflow: hidden;
}
.overflow-auto {
  overflow: auto;
}
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Cursor */
.cursor-pointer {
  cursor: pointer;
}

/* Transition */
.transition {
  transition: all var(--duration-fast) var(--ease-default);
}

/* ============================================
/* RESPONSIVE */
/* ============================================ */

@media (max-width: 1024px) {
  :root {
    --text-4xl: 2rem;
    --text-3xl: 1.75rem;
    --text-2xl: 1.375rem;
  }
}

/* ---------- Tablet (max-width: 768px) ---------- */
@media (max-width: 768px) {
  /* Workspace and items grids: 2 columns */
  .workspace-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)) !important;
  }

  .items-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)) !important;
  }

  /* Detail/context panels: full-width on tablet.
     .vc-panel is the adoption alias for bespoke panels; min-width guard
     stops desktop min-widths overflowing phones (min-width beats max-width). */
  .detail-panel,
  .context-panel,
  .vc-panel {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  /* Cards: reduce padding */
  .card {
    padding: var(--space-4);
  }

  /* Stats bar: wrap */
  .stats-bar {
    flex-wrap: wrap;
  }

  /* Toolbar: allow wrapping */
  .toolbar {
    flex-wrap: wrap;
  }
}

/* ---------- Mobile (max-width: 640px) ---------- */
@media (max-width: 640px) {
  :root {
    --text-4xl: 1.75rem;
    --text-3xl: 1.5rem;
    --text-2xl: 1.25rem;
    --text-xl: 1.125rem;
    --space-6: 1.25rem;
    --space-8: 1.5rem;
  }

  /* --- Touch targets: ensure minimum 44px --- */
  .btn {
    min-height: 44px;
    padding: 0.625rem 1rem;
  }

  .btn-sm {
    min-height: 36px;
    padding: 0.5rem 0.75rem;
  }

  .btn-icon {
    min-height: 44px;
    min-width: 44px;
    width: 44px;
    height: 44px;
  }

  .btn-icon.btn-sm {
    min-height: 36px;
    min-width: 36px;
    width: 36px;
    height: 36px;
  }

  .nav-item {
    min-height: 44px;
    padding: var(--space-3) var(--space-4);
  }

  /* --- Inputs: full-width and comfortable --- */
  .input,
  input:not([type="checkbox"]):not([type="radio"]),
  select,
  textarea {
    font-size: 16px !important; /* Prevents iOS zoom on focus */
    min-height: 44px;
  }

  /* --- Workspace grid: single column --- */
  .workspace-grid {
    grid-template-columns: 1fr !important;
  }

  .items-grid {
    grid-template-columns: 1fr !important;
  }

  /* --- Welcome banner: compact --- */
  .welcome-banner {
    padding: 1rem !important;
    margin-bottom: 1rem !important;
  }

  /* --- Dashboard header: stack vertically --- */
  .dashboard-header {
    flex-direction: column;
    align-items: flex-start !important;
    gap: var(--space-3) !important;
  }

  /* --- Stats bar: vertical on mobile --- */
  .stats-bar {
    flex-direction: column;
    gap: var(--space-2) !important;
    padding: var(--space-3) !important;
  }

  /* --- Cards: reduced padding --- */
  .card {
    padding: var(--space-4);
  }

  /* --- Alerts: compact --- */
  .alert {
    padding: var(--space-3);
    font-size: var(--text-xs);
  }

  /* --- Badges: slightly smaller --- */
  .badge {
    font-size: 0.6875rem;
    padding: 0.125rem 0.5rem;
  }

  /* --- Utility: hide on mobile --- */
  .hide-mobile {
    display: none !important;
  }

  /* --- Utility: show only on mobile --- */
  .show-mobile {
    display: block !important;
  }

  .show-mobile-flex {
    display: flex !important;
  }

  .show-mobile-inline {
    display: inline !important;
  }

  /* --- AG-Grid: tighter for mobile --- */
  .ag-theme-vericase,
  .ag-theme-alpine {
    --ag-row-height: 40px !important;
    --ag-header-height: 34px !important;
    --ag-cell-horizontal-padding: 8px !important;
    font-size: var(--text-xs) !important;
  }

  /* AG-Grid horizontal scroll container */
  .ag-body-horizontal-scroll {
    display: block !important;
  }

  /* --- Headings: smaller on mobile --- */
  h1 { font-size: var(--text-2xl); }
  h2 { font-size: var(--text-xl); }
  h3 { font-size: var(--text-lg); }
  h4 { font-size: var(--text-base); }

  /* --- Search containers: full-width --- */
  .search-container {
    max-width: 100% !important;
    flex: 1 1 100%;
  }

  /* --- Toolbar: stack vertically --- */
  .toolbar {
    flex-direction: column;
    align-items: stretch !important;
    padding: var(--space-3) !important;
    gap: var(--space-2) !important;
  }

  .toolbar .btn-group,
  .toolbar .filter-group {
    width: 100%;
    justify-content: stretch;
  }
}
