/* ═══════════════════════════════════════════════════════════════════════════════
   Evidence Management System — Production Dashboard Styles
   ============================================================================
   Case No. 2021-001951 | Montgomery County Juvenile Court | Ohio
   Design System: EMS-BP-2021-001951-RevB Sections 2, 4, 5
   ============================================================================
   Color Reference:
     Trust / Primary:    #1a3a5c (Deep Blue)
     Success / Verified: #2e7d32 (Forest Green)
     Warning / Review:   #ed6c02 (Amber)
     Critical / Fraud:   #c62828 (Crimson Red)
     Neutral / Bg:       #f5f7fa (Cool Gray)
     Text / Primary:     #1e293b (Dark Slate)
     Text / Secondary:   #64748b (Muted Gray)
     Accent / Blue Ink:  #2563eb (Royal Blue)
     Border / Divider:   #e2e8f0 (Light Gray)
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ─── CSS Variables ─────────────────────────────────────────────────────────── */
:root {
  /* Primary palette */
  --primary:            #1a3a5c;
  --primary-light:      #2c5282;
  --primary-dark:       #0f2440;
  --primary-bg:         #e8f0fe;

  /* Semantic colors */
  --success:            #2e7d32;
  --success-light:      #e6f5ed;
  --success-dark:       #1b5e20;
  --warning:            #ed6c02;
  --warning-light:      #fff3e0;
  --warning-dark:       #c25d00;
  --danger:             #c62828;
  --danger-light:       #fce4ec;
  --danger-dark:        #8b0000;

  /* Accent */
  --blue-ink:           #2563eb;
  --blue-ink-bg:        #dbeafe;
  --blue-ink-dark:      #1d4ed8;

  /* Neutrals */
  --bg:                 #f5f7fa;
  --bg-card:            #ffffff;
  --text:               #1e293b;
  --text-secondary:     #64748b;
  --text-muted:         #94a3b8;
  --border:             #e2e8f0;
  --border-light:       #f1f5f9;

  /* Typography */
  --font-sans:          "Inter", system-ui, -apple-system, BlinkMacSystemFont,
                        "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono:          "JetBrains Mono", "SF Mono", "Fira Code", "Fira Mono",
                        "Roboto Mono", Consolas, "Courier New", monospace;

  /* Spacing */
  --max-width:          1280px;
  --card-padding:       16px;
  --card-gap:           16px;
  --section-gap:        32px;
  --radius-sm:          4px;
  --radius:             8px;
  --radius-lg:          12px;

  /* Shadows */
  --shadow-sm:          0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md:          0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg:          0 8px 24px rgba(0, 0, 0, 0.12);

  /* Transitions */
  --transition:         0.2s ease;
  --transition-slow:    0.3s ease;

  /* Layout */
  --header-height:      56px;
  --nav-height:         48px;
}

/* ─── Reset & Base ──────────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
  font-weight: 600;
  color: var(--primary);
  line-height: 1.3;
  letter-spacing: -0.01em;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.0625rem; }

a {
  color: var(--blue-ink);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--primary-light);
  text-decoration: underline;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--blue-ink);
  outline-offset: 2px;
}

img { max-width: 100%; height: auto; }

/* ─── Utility Classes ───────────────────────────────────────────────────────── */
.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;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.text-sm { font-size: 0.8125rem; }
.text-xs { font-size: 0.75rem; }
.text-muted { color: var(--text-secondary); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }

/* ─── Navigation ────────────────────────────────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--primary);
  box-shadow: var(--shadow-md);
  height: var(--nav-height);
}

.nav__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 1.5rem;
  gap: 0.25rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.nav__brand {
  font-size: 0.875rem;
  font-weight: 700;
  color: #ffffff;
  margin-right: auto;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.nav__link {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0 1rem;
  height: 100%;
  font-size: 0.8125rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.72);
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 3px solid transparent;
  transition: all var(--transition);
  letter-spacing: 0.01em;
}

.nav__link:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.06);
  text-decoration: none;
}

.nav__link--active {
  color: #ffffff;
  border-bottom-color: #ffffff;
  font-weight: 600;
}

.nav__link-icon {
  font-size: 1rem;
}

.nav__right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: 1rem;
}

.nav__email {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.64);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ─── Header ────────────────────────────────────────────────────────────────── */
.header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #ffffff;
  padding: 2.5rem 1.5rem 2rem;
  text-align: center;
}

.header__inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.header__title {
  font-size: 2rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 0.375rem;
  letter-spacing: -0.02em;
}

.header__subtitle {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 0.5rem;
  font-weight: 400;
}

.header__meta {
  font-size: 0.8125rem;
  color: rgba(255, 255, 255, 0.6);
}

.header__actions {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}

/* ─── Main Content ──────────────────────────────────────────────────────────── */
.main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.page {
  display: none;
  animation: pageFadeIn 0.3s ease;
}

@keyframes pageFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.page.active {
  display: block;
}

.page__header {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--border);
}

.page__title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.375rem;
}

.page__description {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  max-width: 700px;
}

/* ─── Cards ─────────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--card-padding);
  margin-bottom: var(--card-gap);
  box-shadow: var(--shadow-sm);
}

.card--interactive {
  cursor: pointer;
  transition: box-shadow var(--transition), transform var(--transition),
              border-color var(--transition);
}

.card--interactive:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  border-color: var(--primary-light);
}

.card--interactive:focus-visible {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.card__title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-light);
}

.card__title--danger { color: var(--danger); border-bottom-color: var(--danger-light); }
.card__title--warning { color: var(--warning); border-bottom-color: var(--warning-light); }
.card__title--success { color: var(--success); border-bottom-color: var(--success-light); }

/* ─── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: var(--font-sans);
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  line-height: 1.4;
  letter-spacing: 0.01em;
}

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

.btn--primary {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.btn--primary:hover:not(:disabled) {
  background: var(--primary-light);
  border-color: var(--primary-light);
}

.btn--success {
  background: var(--success);
  color: #ffffff;
  border-color: var(--success);
}

.btn--success:hover:not(:disabled) {
  background: var(--success-dark);
  border-color: var(--success-dark);
}

.btn--danger {
  background: var(--danger);
  color: #ffffff;
  border-color: var(--danger);
}

.btn--danger:hover:not(:disabled) {
  background: var(--danger-dark);
  border-color: var(--danger-dark);
}

.btn--warning {
  background: var(--warning);
  color: #ffffff;
  border-color: var(--warning);
}

.btn--warning:hover:not(:disabled) {
  background: var(--warning-dark);
  border-color: var(--warning-dark);
}

.btn--outline {
  background: transparent;
  color: var(--primary);
  border-color: var(--border);
}

.btn--outline:hover:not(:disabled) {
  background: var(--primary-bg);
  border-color: var(--primary-light);
}

.btn--ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}

.btn--ghost:hover:not(:disabled) {
  background: var(--border-light);
  color: var(--text);
}

.btn--sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  border-radius: var(--radius-sm);
}

.btn--lg {
  padding: 0.75rem 1.75rem;
  font-size: 1rem;
}

.btn--icon {
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border-radius: var(--radius);
}

.btn-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ─── Forms ─────────────────────────────────────────────────────────────────── */
.form-group {
  margin-bottom: 1rem;
}

.form-group__label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.375rem;
}

.form-group__input,
.form-group__textarea,
.form-group__select {
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: 0.9375rem;
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-group__input:focus,
.form-group__textarea:focus,
.form-group__select:focus {
  border-color: var(--blue-ink);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
  outline: none;
}

.form-group__input::placeholder,
.form-group__textarea::placeholder {
  color: var(--text-muted);
}

.form-group__input--mono {
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.form-group__textarea {
  min-height: 80px;
  resize: vertical;
}

.form-group__hint {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.form-group__error {
  font-size: 0.75rem;
  color: var(--danger);
  margin-top: 0.25rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-inline {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
}

.form-inline .form-group {
  flex: 1;
  margin-bottom: 0;
}

.form-inline .btn {
  height: 2.625rem;
}

/* ─── Tags / Badges ─────────────────────────────────────────────────────────── */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.6rem;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  background: var(--border-light);
  color: var(--text-secondary);
  white-space: nowrap;
}

.tag--blue-ink     { background: var(--blue-ink-bg);  color: var(--blue-ink-dark); }
.tag--forged       { background: var(--danger-light); color: var(--danger); }
.tag--fake-notary  { background: var(--danger-light); color: var(--danger); }
.tag--verified     { background: var(--success-light); color: var(--success-dark); }
.tag--conspiracy   { background: var(--danger-light); color: var(--danger); border: 1px solid var(--danger); }
.tag--co-parenting { background: var(--primary-bg);   color: var(--primary); }
.tag--interference { background: var(--warning-light); color: var(--warning-dark); }
.tag--critical     { background: var(--danger-light); color: var(--danger-dark); font-weight: 700; }
.tag--high         { background: var(--warning-light); color: var(--warning-dark); }
.tag--medium       { background: var(--primary-bg);   color: var(--primary); }
.tag--low          { background: var(--border-light); color: var(--text-muted); }
.tag--ghostwriting          { background: var(--danger-light); color: var(--danger-dark); font-weight: 600; }
.tag--perjury               { background: var(--danger-light); color: var(--danger); border: 1px solid var(--danger); font-weight: 700; }
.tag--confession            { background: var(--danger-light); color: var(--danger); border: 1px solid var(--danger); font-weight: 700; }
.tag--blue-ink-chain        { background: var(--blue-ink-bg);  color: var(--blue-ink-dark); border: 1px solid var(--blue-ink-dark); }
.tag--tampering             { background: var(--danger-light); color: var(--danger-dark); }
.tag--handwriting           { background: var(--primary-bg);   color: var(--primary); }
.tag--exemplar              { background: var(--success-light); color: var(--success-dark); border: 1px dashed var(--success-dark); }
.tag--mail-fraud            { background: var(--warning-light); color: var(--warning-dark); }
.tag--authorship            { background: var(--primary-bg);   color: var(--primary); }
.tag--custody-chain         { background: var(--border-light); color: var(--text-muted); border: 1px solid var(--border); }
.tag--false-statement       { background: var(--danger-light); color: var(--danger-dark); }
.tag--unauthorized-practice { background: var(--warning-light); color: var(--warning-dark); font-weight: 600; }

.tag__tooltip {
  position: relative;
  cursor: help;
  border-bottom: 1px dotted currentColor;
}

.tag__tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  padding: 0.5rem 0.75rem;
  font-size: 0.7rem;
  font-weight: 400;
  line-height: 1.4;
  color: #ffffff;
  background: var(--text);
  border-radius: var(--radius-sm);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition);
  z-index: 999;
  max-width: 280px;
  white-space: normal;
  text-align: center;
}

.tag__tooltip:hover::after,
.tag__tooltip:focus-visible::after {
  opacity: 1;
}

/* ─── Badge (status indicator dot) ──────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.625rem;
  border-radius: 100px;
}

.badge--verified { background: var(--success-light); color: var(--success-dark); }
.badge--review   { background: var(--warning-light); color: var(--warning-dark); }
.badge--fraud    { background: var(--danger-light); color: var(--danger); }
.badge--pending  { background: var(--border-light); color: var(--text-secondary); }

.badge__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.badge__dot--success { background: var(--success); }
.badge__dot--warning { background: var(--warning); }
.badge__dot--danger  { background: var(--danger); }
.badge__dot--muted   { background: var(--text-muted); }

/* ─── Verification Badge ────────────────────────────────────────────────────── */
.verification-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 100px;
  cursor: help;
}

.verification-badge.verified {
  background: var(--success-light);
  color: var(--success-dark);
  border: 1px solid var(--success);
}

.verification-badge.unverified {
  background: var(--danger-light);
  color: var(--danger);
  border: 1px solid var(--danger);
}

.verification-badge.pending {
  background: var(--warning-light);
  color: var(--warning-dark);
  border: 1px solid var(--warning);
}

.verification-badge[data-tooltip] {
  position: relative;
}

.verification-badge[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  padding: 0.5rem 0.75rem;
  font-size: 0.7rem;
  font-weight: 400;
  white-space: nowrap;
  color: #ffffff;
  background: var(--text);
  border-radius: var(--radius-sm);
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition);
  z-index: 999;
}

.verification-badge[data-tooltip]:hover::after,
.verification-badge[data-tooltip]:focus-visible::after {
  opacity: 1;
}

/* ─── Exhibit Cards ─────────────────────────────────────────────────────────── */
.exhibit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--card-gap);
}

.exhibit-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--card-padding);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

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

.exhibit-card:focus-visible {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.exhibit-card--blue-ink {
  background: linear-gradient(135deg, var(--blue-ink-bg) 0%, var(--bg-card) 30%);
}

.exhibit-card--fraud {
  border-left: 3px solid var(--danger);
}

.exhibit-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.exhibit-card__letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  font-size: 1rem;
  font-weight: 700;
  color: #ffffff;
  background: var(--primary);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.exhibit-card__letter--blue { background: var(--blue-ink); }
.exhibit-card__letter--fraud { background: var(--danger); }

.exhibit-card__title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.exhibit-card__desc {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.exhibit-card__desc--expanded {
  -webkit-line-clamp: unset;
}

.exhibit-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.exhibit-card__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-light);
}

.exhibit-card__hash {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--text-muted);
}

.exhibit-card__actions {
  display: flex;
  gap: 0.375rem;
}

/* ─── Filters ───────────────────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.filter-btn {
  padding: 0.375rem 0.875rem;
  font-size: 0.8125rem;
  font-weight: 500;
  font-family: var(--font-sans);
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 100px;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.filter-btn:hover {
  border-color: var(--primary-light);
  color: var(--primary);
}

.filter-btn.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.filter-btn--blue-ink.active { background: var(--blue-ink); border-color: var(--blue-ink); }
.filter-btn--danger.active  { background: var(--danger); border-color: var(--danger); }
.filter-btn--success.active { background: var(--success); border-color: var(--success); }
.filter-btn--warning.active { background: var(--warning); border-color: var(--warning); }

/* ─── Table ─────────────────────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

th {
  text-align: left;
  padding: 0.625rem 0.75rem;
  font-weight: 600;
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  background: var(--bg);
}

td {
  padding: 0.625rem 0.75rem;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

tr:hover td {
  background: var(--border-light);
}

th.sortable {
  cursor: pointer;
  user-select: none;
}

th.sortable:hover {
  color: var(--primary);
}

th.sortable::after {
  content: " ↕";
  font-size: 0.65rem;
  opacity: 0.4;
}

th.sortable.sorted-asc::after  { content: " ↑"; opacity: 1; }
th.sortable.sorted-desc::after { content: " ↓"; opacity: 1; }

/* ─── Modal ─────────────────────────────────────────────────────────────────── */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal--open {
  display: flex;
}

.modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 36, 64, 0.6);
  backdrop-filter: blur(2px);
}

.modal__content {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  max-width: 640px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 2rem;
  box-shadow: var(--shadow-lg);
  animation: modalSlideIn 0.25s ease;
}

@keyframes modalSlideIn {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal--sm .modal__content { max-width: 420px; }
.modal--lg .modal__content { max-width: 800px; }

.modal__close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--text-secondary);
  background: none;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  z-index: 1;
}

.modal__close:hover {
  background: var(--border-light);
  color: var(--text);
}

.modal__title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 1rem;
  padding-right: 2rem;
}

.modal__section {
  margin-bottom: 1.25rem;
}

.modal__section-title {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.modal__hash {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
  word-break: break-all;
  background: var(--border-light);
  padding: 0.75rem;
  border-radius: var(--radius-sm);
}

.modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* ─── Hash Verification Result ──────────────────────────────────────────────── */
.verify-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.verify-result {
  padding: 1rem;
  border-radius: var(--radius);
  margin-top: 1rem;
  display: none;
}

.verify-result--success {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--success-light);
  border: 1px solid var(--success);
  color: var(--success-dark);
}

.verify-result--error {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--danger-light);
  border: 1px solid var(--danger);
  color: var(--danger);
}

.verify-result--pending {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--border-light);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.verify-result__icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.verify-result__body {
  flex: 1;
  font-size: 0.875rem;
}

.verify-result__timestamp {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

/* ─── Notary Stamp Overlay ─────────────────────────────────────────────────── */
.notary-stamp {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  padding: 0.375rem 0.75rem;
  font-size: 0.675rem;
  font-weight: 800;
  color: var(--danger);
  border: 2px solid var(--danger);
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(198, 40, 40, 0.04);
  transform: rotate(3deg);
  pointer-events: none;
  z-index: 2;
}

/* ─── Toast Notifications ──────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 400px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  animation: toastSlideIn 0.3s ease;
  font-size: 0.875rem;
}

@keyframes toastSlideIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

.toast--success { border-left: 3px solid var(--success); }
.toast--error   { border-left: 3px solid var(--danger); }
.toast--warning { border-left: 3px solid var(--warning); }
.toast--info    { border-left: 3px solid var(--blue-ink); }

.toast__icon { font-size: 1.25rem; flex-shrink: 0; }
.toast__body { flex: 1; }
.toast__close {
  font-size: 1.25rem;
  color: var(--text-muted);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0.25rem;
}

/* ─── Loading States ────────────────────────────────────────────────────────── */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  color: var(--text-secondary);
  gap: 0.75rem;
}

.spinner {
  width: 1.5rem;
  height: 1.5rem;
  border: 2.5px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

.spinner--sm { width: 1rem; height: 1rem; border-width: 2px; }
.spinner--lg { width: 2.5rem; height: 2.5rem; border-width: 3px; }

.skeleton {
  background: linear-gradient(90deg, var(--border-light) 25%, var(--border) 50%, var(--border-light) 75%);
  background-size: 200% 100%;
  animation: skeletonPulse 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

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

/* ─── Empty State ───────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-secondary);
}

.empty-state__icon {
  font-size: 3rem;
  margin-bottom: 0.75rem;
}

.empty-state__title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.empty-state__text {
  font-size: 0.875rem;
  max-width: 400px;
  margin: 0 auto;
}

/* ─── Alerts ────────────────────────────────────────────────────────────────── */
.alert {
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  margin-bottom: 1rem;
  display: none;
  border: 1px solid transparent;
}

.alert--visible { display: block; }

.alert--danger  { background: var(--danger-light);  border-color: var(--danger);  color: var(--danger-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--info    { background: var(--primary-bg);    border-color: var(--primary); color: var(--primary-dark); }

.alert a {
  font-weight: 600;
  text-decoration: underline;
}

/* ─── Timeline ──────────────────────────────────────────────────────────────── */
.timeline {
  position: relative;
  padding-left: 2rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0.5rem;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  padding-bottom: 1.5rem;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -1.65rem;
  top: 0.3rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--bg-card);
  background: var(--text-muted);
  z-index: 1;
}

.timeline-item--critical::before { background: var(--danger); }
.timeline-item--high::before     { background: var(--warning); }
.timeline-item--medium::before   { background: var(--blue-ink); }
.timeline-item--low::before      { background: var(--text-muted); }

.timeline-item__date {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.125rem;
}

.timeline-item__title {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.timeline-item__desc {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-bottom: 0.375rem;
  line-height: 1.5;
}

.timeline-item__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.timeline-item__parties {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

/* ─── Timeline Slider (optional) ────────────────────────────────────────────── */
.timeline-slider {
  position: relative;
  height: 80px;
  margin-bottom: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
}

.timeline-slider__track {
  position: absolute;
  bottom: 16px;
  left: 16px;
  right: 16px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
}

.timeline-slider__thumb {
  position: absolute;
  bottom: 10px;
  left: 50%;
  width: 16px;
  height: 16px;
  background: var(--primary);
  border: 3px solid #ffffff;
  border-radius: 50%;
  box-shadow: var(--shadow-md);
  cursor: grab;
  transform: translateX(-50%);
  transition: left 0.1s ease;
}

.timeline-slider__dot {
  position: absolute;
  bottom: 12px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  transform: translateX(-50%);
  cursor: pointer;
}

.timeline-slider__dot--critical { background: var(--danger); }
.timeline-slider__dot--high     { background: var(--warning); }

/* ─── Party Rolodex ─────────────────────────────────────────────────────────── */
.party-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--card-gap);
}

.party-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--card-padding);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all var(--transition);
}

.party-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.party-card--flagged {
  border: 2px solid var(--danger);
  background: linear-gradient(135deg, var(--danger-light) 0%, var(--bg-card) 20%);
}

.party-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

.party-card__name {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--text);
}

.party-card__role {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}

.party-card__stats {
  display: flex;
  gap: 1rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}

.party-card__stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.party-card__stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  font-family: var(--font-mono);
}

.party-card__stat-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ─── Print History Table ──────────────────────────────────────────────────── */
.print-history-table td {
  font-size: 0.8125rem;
}

.print-history-table .hash-cell {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ─── Progress Bar ──────────────────────────────────────────────────────────── */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--border-light);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar__fill {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.progress-bar__fill--success { background: var(--success); }
.progress-bar__fill--warning { background: var(--warning); }
.progress-bar__fill--danger  { background: var(--danger); }

.progress-text {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
  text-align: right;
}

/* ─── Print Footer ──────────────────────────────────────────────────────────── */
@media print {
  @page {
    margin: 0.75in;
    @bottom-center {
      content: "Case No. 2021-001951 | Print ID: " attr(data-print-id) " | Generated: " attr(data-generated) " | SHA-256: " attr(data-page-hash);
      font-size: 7pt;
      font-family: var(--font-mono);
      color: var(--text-secondary);
    }
  }

  .nav, .modal, .toast-container, .btn, .filter-bar,
  .exhibit-card__actions, .modal__close,
  .nav__right, .nav__brand {
    display: none !important;
  }

  body {
    background: #ffffff;
    color: #000000;
  }

  .page {
    display: block !important;
  }

  .header {
    background: none !important;
    color: #000000 !important;
    padding: 1rem 0;
    border-bottom: 2px solid #000000;
  }

  .header__title, .header__subtitle, .header__meta {
    color: #000000 !important;
  }

  .exhibit-card {
    break-inside: avoid;
    page-break-inside: avoid;
    border: 1px solid #cccccc;
    box-shadow: none;
  }

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

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

  .footer {
    position: fixed;
    bottom: 0;
    width: 100%;
    font-size: 7pt;
    border-top: 1px solid #cccccc;
    padding: 0.5rem 0;
    color: #666666;
  }
}

/* ─── Footer ────────────────────────────────────────────────────────────────── */
.footer {
  background: var(--primary);
  color: rgba(255, 255, 255, 0.7);
  padding: 2rem 1.5rem;
  text-align: center;
  font-size: 0.8125rem;
}

.footer__inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.footer__text {
  margin-bottom: 0.375rem;
  font-size: 0.8rem;
}

.footer__text--small {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.5);
}

.footer__hash {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.5);
  word-break: break-all;
}

/* ─── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .header { padding: 2rem 1rem 1.5rem; }
  .header__title { font-size: 1.5rem; }
  .main { padding: 1.5rem 1rem 3rem; }
  .page__title { font-size: 1.25rem; }

  .exhibit-grid { grid-template-columns: 1fr; }
  .party-grid   { grid-template-columns: 1fr; }

  .form-row { grid-template-columns: 1fr; }
  .form-inline { flex-direction: column; }

  .nav__brand { font-size: 0.75rem; }
  .nav__link  { padding: 0 0.75rem; font-size: 0.75rem; }
  .nav__email { display: none; }

  .modal__content { padding: 1.5rem; }
  .modal__title { font-size: 1.125rem; }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .exhibit-grid { grid-template-columns: repeat(2, 1fr); }
  .party-grid   { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1025px) {
  .exhibit-grid { grid-template-columns: repeat(3, 1fr); }
  .party-grid   { grid-template-columns: repeat(3, 1fr); }
}

/* ─── Accessibility / High Contrast ─────────────────────────────────────────── */
@media (prefers-contrast: high) {
  :root {
    --primary:            #000080;
    --success:            #006400;
    --warning:            #8B4500;
    --danger:             #8B0000;
    --text:               #000000;
    --text-secondary:     #333333;
    --border:             #666666;
    --bg:                 #ffffff;
    --bg-card:            #ffffff;
  }

  .exhibit-card, .card, .party-card {
    border-width: 2px;
  }

  .tag {
    border: 1px solid currentColor;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ─── Focus visible fallback ───────────────────────────────────────────────── */
*:focus {
  outline: none;
}

*:focus-visible {
  outline: 2px solid var(--blue-ink);
  outline-offset: 2px;
}
