/* ══════════════════════════════════════════════════════════════
   Exhibit A — Desktop App Styles
   Design: MikeOSS-inspired (clean, legal, professional)
   Fonts: EB Garamond (serif) + Inter (sans-serif)
   ══════════════════════════════════════════════════════════════ */

:root {
  --white: #ffffff;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --green: #22c55e;
  --green-light: #bbf7d0;
  --red: #ef4444;
  --red-light: #fecaca;
  --blue: #3b82f6;
  --blue-light: #bfdbfe;
  --amber: #f59e0b;
  --font-serif: 'EB Garamond', Georgia, 'Times New Roman', serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 999px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 12px 32px -8px rgba(17,24,39,0.1);
  --transition: 150ms ease;
}

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

html, body {
  height: 100%;
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--gray-900);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* ── Mac Title Bar Drag Region ─────────────────────────────── */
.titlebar-drag-region {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 52px;
  -webkit-app-region: drag;
  z-index: 100;
}

/* ── View System ───────────────────────────────────────────── */
.view {
  display: none;
  height: 100vh;
  overflow-y: auto;
  animation: viewFadeIn 250ms ease;
}
.view.active { display: flex; flex-direction: column; }
@keyframes viewFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ══════════════════════════════════════════════════════════════
   WELCOME VIEW
   ══════════════════════════════════════════════════════════════ */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
.welcome-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 32px 48px;
  text-align: center;
  animation: fadeInUp 600ms ease forwards;
}

.welcome-icon {
  color: var(--gray-400);
  margin-bottom: 24px;
}

.welcome-title {
  font-family: var(--font-serif);
  font-size: 48px;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--gray-900);
  margin-bottom: 12px;
}

.welcome-subtitle {
  font-size: 18px;
  font-weight: 400;
  color: var(--gray-500);
  max-width: 360px;
  line-height: 1.6;
  margin-bottom: 40px;
}

.welcome-note {
  margin-top: 16px;
  font-size: 13px;
  color: var(--gray-400);
}

.sync-status {
  margin-top: 12px;
  padding: 8px 20px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-full);
  font-size: 12px;
  color: var(--gray-500);
}
.sync-status .count {
  font-weight: 600;
  color: var(--gray-700);
}
.sync-status .time-ago {
  color: var(--gray-400);
}

.sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-full);
  font-size: 11px;
  color: var(--gray-500);
  margin-left: 8px;
}
.sync-badge .count {
  font-weight: 600;
  color: var(--green);
}

.error-box {
  margin-top: 20px;
  padding: 12px 20px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius-md);
  color: #991b1b;
  font-size: 13px;
  max-width: 440px;
  line-height: 1.5;
}

.hidden { display: none !important; }

/* ── Buttons ───────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  background: var(--gray-900);
  color: var(--white);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: opacity var(--transition);
  -webkit-app-region: no-drag;
  box-shadow: inset 0 1px 0 0 rgba(255,255,255,0.12);
}
.btn-primary:hover { opacity: 0.88; }
.btn-primary:active { opacity: 0.76; transform: scale(0.97); }
.btn-primary.btn-sm { padding: 8px 20px; font-size: 13px; }

.btn-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-full);
  background: var(--white);
  cursor: pointer;
  color: var(--gray-600);
  transition: background var(--transition);
  -webkit-app-region: no-drag;
}
.btn-back:hover { background: var(--gray-50); }

/* ── Spinner ───────────────────────────────────────────────── */
.spinner {
  width: 18px;
  height: 18px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════════════════════════
   APP HEADER
   ══════════════════════════════════════════════════════════════ */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 28px;
  padding-top: 48px; /* traffic lights */
  border-bottom: 1px solid var(--gray-200);
  background: var(--white);
  position: sticky;
  top: 0;
  z-index: 10;
  -webkit-app-region: drag;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-back-home {
  -webkit-app-region: no-drag;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  background: var(--gray-50);
  color: var(--gray-600);
  cursor: pointer;
  transition: all 0.15s;
}
.btn-back-home:hover {
  background: var(--gray-100);
  color: var(--gray-900);
}

.header-logo {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 400;
  color: var(--gray-900);
}

.header-meta {
  font-size: 13px;
  color: var(--gray-500);
}

.header-right {
  -webkit-app-region: no-drag;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ══════════════════════════════════════════════════════════════
   CONTACTS VIEW
   ══════════════════════════════════════════════════════════════ */
.contacts-body {
  flex: 1;
  padding: 32px 40px;
  overflow-y: auto;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}

.section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gray-500);
  margin-bottom: 8px;
}

.section-heading {
  font-family: var(--font-serif);
  font-size: 32px;
  font-weight: 400;
  color: var(--gray-900);
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin-bottom: 24px;
}

.search-wrapper {
  position: relative;
  margin-bottom: 20px;
}
.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
}
#contact-search {
  width: 100%;
  padding: 12px 12px 12px 40px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--gray-900);
  background: var(--gray-50);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
#contact-search:focus {
  border-color: var(--gray-400);
  box-shadow: 0 0 0 3px rgba(107,114,128,0.1);
  background: var(--white);
}
#contact-search::placeholder { color: var(--gray-400); }

.contact-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 10px;
}

.contact-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}
.contact-card:hover {
  border-color: var(--gray-300);
  box-shadow: var(--shadow-md);
  background: var(--gray-50);
}
.contact-card:active { transform: scale(0.985); }
.contact-card.loading {
  pointer-events: none;
  opacity: 0.6;
}
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.contact-card.loading .contact-avatar {
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

.contact-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--gray-500);
  font-size: 16px;
  font-weight: 500;
}

.contact-info { flex: 1; min-width: 0; }
.contact-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--gray-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.contact-number {
  font-weight: 500;
  font-size: 14px;
  color: var(--gray-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.contact-meta {
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 2px;
}

.contact-arrow {
  color: var(--gray-300);
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════════
   EXHIBIT VIEW
   ══════════════════════════════════════════════════════════════ */
.exhibit-body {
  flex: 1;
  padding: 32px 40px 48px;
  overflow-y: auto;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}

.exhibit-title-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 28px;
}
.exhibit-date-range {
  font-size: 13px;
  color: var(--gray-500);
  text-align: right;
  line-height: 1.5;
}

/* ── Stats Row ─────────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
}
.stat-value {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 400;
  color: var(--gray-900);
  line-height: 1;
  margin-bottom: 4px;
}
.stat-value.green { color: var(--green); }
.stat-value.red { color: var(--red); }
.stat-label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-500);
}

/* ── Legend ─────────────────────────────────────────────────── */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 12px;
  padding: 10px 16px;
  background: var(--gray-50);
  border-radius: var(--radius-md);
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--gray-600);
}
.legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  flex-shrink: 0;
}
.swatch-connected { background: var(--green); }
.swatch-denied { background: var(--red); }
.swatch-none { background: var(--gray-200); border: 1px solid var(--gray-300); }
.swatch-incident { background: var(--white); border: 2px solid var(--blue); }

/* ── Calendar Heatmap ──────────────────────────────────────── */
.calendar-container {
  margin-bottom: 32px;
}

.calendar-month {
  margin-bottom: 28px;
}
.calendar-month-label {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 400;
  color: var(--gray-800);
  margin-bottom: 10px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.calendar-dow {
  font-size: 10px;
  font-weight: 600;
  color: var(--gray-400);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding-bottom: 4px;
}

.calendar-day {
  width: 100%;
  aspect-ratio: 1.4;
  border-radius: 6px;
  position: relative;
  cursor: pointer;
  transition: transform 100ms ease, box-shadow 100ms ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 500;
  color: rgba(0,0,0,0.35);
}
.calendar-day:hover {
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  z-index: 2;
}

/* Status colors */
.calendar-day.connected { background: var(--green); color: rgba(255,255,255,0.7); }
.calendar-day.controlled { background: #facc15; color: rgba(0,0,0,0.4); }
.calendar-day.denied { background: var(--red); color: rgba(255,255,255,0.7); }
.calendar-day.no-data { background: var(--gray-200); color: var(--gray-400); }
.calendar-day.empty { background: transparent; cursor: default; color: transparent; }
.calendar-day.empty:hover { transform: none; box-shadow: none; }
.calendar-day.blackout { background: var(--gray-800); color: rgba(255,255,255,0.4); }

/* Today indicator */
.calendar-day.today {
  box-shadow: 0 2px 0 0 var(--gray-900);
}
.calendar-day.today.incident {
  box-shadow: inset 0 0 0 2.5px var(--blue), 0 2px 0 0 var(--gray-900);
}

/* Month summary */
.calendar-month-summary {
  font-size: 11px;
  color: var(--gray-500);
  margin-top: 6px;
  padding: 4px 0;
  letter-spacing: 0.01em;
}

/* Incident ring */
.calendar-day.incident { box-shadow: inset 0 0 0 2.5px var(--blue); }

/* Active popover ring */
.calendar-day.popover-active {
  box-shadow: 0 0 0 2px var(--gray-900);
  transform: scale(1.1);
  z-index: 3;
}

/* Note indicator dot */
.calendar-day .note-dot {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--blue);
}

/* ── Day Popover (click to edit) ───────────────────────────── */
.day-popover {
  position: fixed;
  z-index: 55;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 14px;
  min-width: 240px;
  max-width: 290px;
  animation: popoverIn 150ms ease;
}
@keyframes popoverIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.day-popover::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 6px;
  background: var(--white);
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}
.day-popover::after {
  content: '';
  position: absolute;
  top: -7px;
  left: 50%;
  transform: translateX(-50%);
  width: 14px;
  height: 7px;
  background: var(--gray-200);
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
  z-index: -1;
}
.day-popover-date {
  font-weight: 600;
  font-size: 13px;
  color: var(--gray-900);
  margin-bottom: 8px;
}
.day-popover-section {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-400);
  margin-top: 10px;
  margin-bottom: 6px;
}
.day-popover-colors {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}
.day-color-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color 100ms ease, transform 100ms ease;
  position: relative;
}
.day-color-btn:hover { transform: scale(1.12); }
.day-color-btn.active { border-color: var(--gray-900); }
.day-color-btn.green { background: var(--green); }
.day-color-btn.yellow { background: #facc15; }
.day-color-btn.red { background: var(--red); }
.day-color-btn.black { background: var(--gray-800); }
.day-color-btn.gray { background: var(--gray-200); }

.day-color-label {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.day-color-label span {
  font-size: 10px;
  color: var(--gray-500);
}

.day-note-input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--gray-900);
  outline: none;
  margin-top: 4px;
  resize: none;
  min-height: 48px;
}
.day-note-input:focus {
  border-color: var(--gray-400);
  box-shadow: 0 0 0 2px rgba(107,114,128,0.1);
}

.day-popover-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  justify-content: flex-end;
}
.day-popover-actions button {
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 100ms ease;
}
.day-popover-actions .btn-save {
  background: var(--gray-900);
  color: var(--white);
  border: none;
}
.day-popover-actions .btn-save:hover { opacity: 0.85; }
.day-popover-actions .btn-cancel {
  background: none;
  border: 1px solid var(--gray-200);
  color: var(--gray-600);
}
.day-popover-actions .btn-cancel:hover { background: var(--gray-50); }

/* ── Multi-select ─────────────────────────────────────────── */
.calendar-day.multi-selected {
  outline: 2px solid var(--primary);
  outline-offset: -1px;
  animation: pulse-ring 1.5s ease-in-out infinite;
  z-index: 2;
}
@keyframes pulse-ring {
  0%, 100% { outline-color: var(--primary); }
  50% { outline-color: rgba(96, 165, 250, 0.4); }
}

/* ── Batch Panel (bottom bar) ─────────────────────────────── */
.batch-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.batch-panel.visible {
  transform: translateY(0);
}
.batch-panel-inner {
  background: var(--white);
  border-top: 1px solid var(--gray-200);
  box-shadow: 0 -8px 32px rgba(0,0,0,0.12);
  padding: 14px 24px;
  max-width: 800px;
  margin: 0 auto;
}
.batch-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.batch-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-900);
  display: flex;
  align-items: center;
  gap: 8px;
}
.batch-title span:first-child {
  background: var(--primary);
  color: white;
  font-size: 13px;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: var(--radius-full);
  min-width: 22px;
  text-align: center;
}
.batch-hint {
  font-size: 11px;
  font-weight: 400;
  color: var(--gray-400);
}
.batch-clear {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--gray-400);
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.batch-clear:hover { color: var(--gray-700); }
.batch-chips {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  max-height: 56px;
  overflow-y: auto;
  padding-bottom: 8px;
  margin-bottom: 4px;
}
.batch-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 500;
  background: var(--gray-100);
  color: var(--gray-700);
  border: 1px solid var(--gray-200);
  white-space: nowrap;
  animation: chip-in 0.15s ease;
}
@keyframes chip-in {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}
.batch-chip.status-connected { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.batch-chip.status-controlled { background: #fef9c3; color: #854d0e; border-color: #fde68a; }
.batch-chip.status-denied { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.batch-chip.status-blackout { background: var(--gray-200); color: var(--gray-700); border-color: var(--gray-300); }
.batch-chip-remove {
  background: none;
  border: none;
  font-size: 13px;
  line-height: 1;
  color: inherit;
  opacity: 0.5;
  cursor: pointer;
  padding: 0 1px;
}
.batch-chip-remove:hover { opacity: 1; }
.batch-body {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.batch-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.batch-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gray-500);
  white-space: nowrap;
}
.batch-colors {
  display: flex;
  gap: 4px;
}
.batch-color-btn {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-md);
  border: 2px solid transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: white;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}
.batch-color-btn.green { background: var(--green); }
.batch-color-btn.yellow { background: #facc15; color: #713f12; }
.batch-color-btn.red { background: var(--red); }
.batch-color-btn.black { background: var(--gray-800); }
.batch-color-btn.gray { background: var(--gray-200); color: var(--gray-500); }
.batch-color-btn:hover { transform: scale(1.12); }
.batch-color-btn.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.3);
  transform: scale(1.12);
}
.batch-note-input {
  font-size: 13px;
  padding: 6px 10px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  color: var(--gray-700);
  width: 200px;
  transition: border-color 0.15s;
}
.batch-note-input:focus {
  outline: none;
  border-color: var(--primary);
}
.batch-incident {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--gray-500);
  cursor: pointer;
  white-space: nowrap;
}
.batch-apply-btn {
  margin-left: auto;
  padding: 7px 18px;
  font-size: 13px;
  white-space: nowrap;
}
.batch-apply-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── Tooltip ───────────────────────────────────────────────── */
.tooltip {
  position: fixed;
  z-index: 50;
  background: var(--gray-900);
  color: var(--white);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  line-height: 1.5;
  max-width: 260px;
  pointer-events: none;
  box-shadow: var(--shadow-lg);
}
.tooltip-date {
  font-weight: 600;
  margin-bottom: 2px;
}
.tooltip-detail {
  color: rgba(255,255,255,0.7);
}

/* ── Call Table ─────────────────────────────────────────────── */
.table-section {
  margin-top: 8px;
}
.table-wrapper {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-top: 12px;
}

/* ── Collapsible Call Details ────────────────────────────────── */
.section-label.collapsible {
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-label.collapsible:hover {
  color: var(--gray-700);
}
.collapse-chevron {
  font-size: 10px;
  transition: transform 0.2s ease;
  color: var(--gray-400);
}
.collapse-chevron.open {
  transform: rotate(90deg);
}
.collapsible-content {
  transition: max-height 0.3s ease, opacity 0.2s ease;
  overflow: hidden;
}
.collapsible-content.collapsed {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
}
.collapsible-content.expanded {
  max-height: 5000px;
  opacity: 1;
  pointer-events: auto;
}
.call-count-badge {
  font-size: 10px;
  font-weight: 600;
  background: var(--gray-100);
  color: var(--gray-500);
  padding: 1px 8px;
  border-radius: var(--radius-full);
}
.pdf-toggle {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--gray-400);
}
.pdf-toggle:hover { color: var(--gray-600); }
.pdf-toggle input[type="checkbox"] {
  width: 14px;
  height: 14px;
  cursor: pointer;
  accent-color: var(--primary);
}
.pdf-toggle-label { font-weight: 500; }

.call-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.call-table thead th {
  background: var(--gray-50);
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-500);
  border-bottom: 1px solid var(--gray-200);
}
.call-table tbody tr {
  border-bottom: 1px solid var(--gray-100);
  transition: background var(--transition);
}
.call-table tbody tr:last-child { border-bottom: none; }
.call-table tbody tr:nth-child(even) { background: var(--gray-50); }
.call-table tbody tr:hover { background: var(--gray-100); }
.call-table td {
  padding: 10px 14px;
  color: var(--gray-700);
}

.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 500;
}
.status-badge.connected { background: var(--green-light); color: #166534; }
.status-badge.denied { background: var(--red-light); color: #991b1b; }

.direction-badge {
  font-size: 12px;
  color: var(--gray-500);
}

/* ── Exhibit Footer ────────────────────────────────────────── */
.exhibit-footer {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--gray-200);
  text-align: center;
  font-size: 11px;
  color: var(--gray-400);
  line-height: 1.8;
}
.exhibit-footer .disclaimer {
  font-style: italic;
  margin-top: 4px;
}

/* ── Focus-Visible Outlines ────────────────────────────────── */
.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.btn-back:focus-visible,
.tab-btn:focus-visible,
.filter-btn:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

/* ── Empty States ──────────────────────────────────────────── */
.empty-state {
  padding: 48px 24px;
  text-align: center;
  color: var(--gray-400);
  font-size: 14px;
}
.empty-state-icon {
  font-size: 32px;
  margin-bottom: 12px;
  opacity: 0.5;
}

/* ── Print Header (hidden on screen) ──────────────────────── */
.print-header { display: none; }

/* ══════════════════════════════════════════════════════════════
   PERMISSION FLOW
   ══════════════════════════════════════════════════════════════ */
.permission-status {
  margin-bottom: 24px;
  width: 100%;
  max-width: 340px;
}
.permission-card {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  padding: 12px 16px;
}
.permission-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  font-size: 13px;
  color: var(--gray-700);
}
.permission-row + .permission-row {
  border-top: 1px solid var(--gray-200);
}
.perm-icon { font-size: 16px; }
.perm-icon.granted { color: var(--green); }
.perm-icon.denied { color: var(--red); }
.perm-label {
  margin-left: auto;
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-400);
}
.perm-label.granted { color: var(--green); }
.perm-label.denied { color: var(--red); }

.permission-guide {
  margin-top: 20px;
  width: 100%;
  max-width: 480px;
}
.permission-guide-inner {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 28px;
  text-align: left;
}
.permission-guide-icon {
  font-size: 32px;
  margin-bottom: 12px;
}
.permission-guide h3 {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 400;
  margin-bottom: 8px;
}
.permission-guide p {
  font-size: 14px;
  color: var(--gray-600);
  line-height: 1.6;
  margin-bottom: 16px;
}
.permission-steps {
  padding-left: 20px;
  margin-bottom: 20px;
}
.permission-steps li {
  font-size: 13px;
  color: var(--gray-600);
  line-height: 1.7;
  margin-bottom: 4px;
}
.permission-steps strong {
  color: var(--gray-900);
}

.permission-guide-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.permission-hint {
  margin-top: 14px;
  font-size: 12px;
  color: var(--gray-400);
  line-height: 1.5;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  background: var(--white);
  color: var(--gray-900);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
  -webkit-app-region: no-drag;
}
.btn-secondary:hover {
  background: var(--gray-50);
  border-color: var(--gray-400);
}
.btn-secondary:active { transform: scale(0.97); }

/* ══════════════════════════════════════════════════════════════
   TAB SYSTEM
   ══════════════════════════════════════════════════════════════ */
.tab-group {
  display: inline-flex;
  background: var(--gray-100);
  border-radius: var(--radius-full);
  padding: 3px;
  margin-right: 12px;
}
.tab-btn {
  padding: 6px 16px;
  border: none;
  background: none;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-500);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition);
}
.tab-btn:hover { color: var(--gray-700); }
.tab-btn.active {
  background: var(--white);
  color: var(--gray-900);
  box-shadow: var(--shadow-sm);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ══════════════════════════════════════════════════════════════
   MESSAGES TAB
   ══════════════════════════════════════════════════════════════ */
.msg-filters {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  margin-top: 8px;
}
.filter-btn {
  padding: 5px 14px;
  border: 1px solid var(--gray-200);
  background: var(--white);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-500);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition);
}
.filter-btn:hover { border-color: var(--gray-300); color: var(--gray-700); }
.filter-btn.active {
  background: var(--gray-900);
  color: var(--white);
  border-color: var(--gray-900);
}

.message-list {
  max-height: calc(100vh - 340px);
  overflow-y: auto;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
}

.msg-date-group {
  padding: 8px 16px;
  background: var(--gray-50);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-500);
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  z-index: 1;
}

.msg-bubble {
  padding: 10px 16px;
  border-bottom: 1px solid var(--gray-100);
  transition: background var(--transition);
}
.msg-bubble:hover { background: var(--gray-50); }
.msg-bubble:last-child { border-bottom: none; }

.msg-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.msg-direction {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.msg-direction.sent { color: var(--blue); }
.msg-direction.received { color: var(--gray-500); }
.msg-time {
  font-size: 11px;
  color: var(--gray-400);
}
.msg-text {
  font-size: 13px;
  color: var(--gray-700);
  line-height: 1.5;
  word-break: break-word;
}
.msg-text.empty {
  color: var(--gray-400);
  font-style: italic;
}

/* ══════════════════════════════════════════════════════════════
   CROSS-REFERENCE TAB
   ══════════════════════════════════════════════════════════════ */
.crossref-note {
  font-size: 13px;
  color: var(--gray-500);
  line-height: 1.6;
  margin-bottom: 20px;
}

.crossref-timeline {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.crossref-day {
  border-bottom: 1px solid var(--gray-100);
}
.crossref-day:last-child { border-bottom: none; }

.crossref-day-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--gray-50);
  cursor: pointer;
  transition: background var(--transition);
}
.crossref-day-header:hover { background: var(--gray-100); }
.crossref-day-header svg {
  transition: transform 200ms ease;
  flex-shrink: 0;
}
.crossref-day-header.expanded svg {
  transform: rotate(180deg);
}

.crossref-date {
  font-weight: 600;
  font-size: 13px;
  color: var(--gray-900);
  min-width: 110px;
}
.crossref-badges {
  display: flex;
  gap: 6px;
  flex: 1;
}
.crossref-badge {
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.crossref-badge.calls-connected { background: var(--green-light); color: #166534; }
.crossref-badge.calls-denied { background: var(--red-light); color: #991b1b; }
.crossref-badge.messages { background: var(--blue-light); color: #1e40af; }
.crossref-badge.incident { background: #fef3c7; color: #92400e; }

.crossref-detail {
  padding: 0 16px 12px;
  display: none;
}
.crossref-detail.open { display: block; }

.crossref-entry {
  padding: 6px 0;
  font-size: 12px;
  color: var(--gray-600);
  border-bottom: 1px dotted var(--gray-200);
}
.crossref-entry:last-child { border-bottom: none; }
.crossref-entry-type {
  font-weight: 600;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-right: 6px;
}
.crossref-entry-type.call { color: var(--green); }
.crossref-entry-type.text { color: var(--blue); }
.crossref-entry-type.denied { color: var(--red); }

/* ══════════════════════════════════════════════════════════════
   PRINT STYLES
   ══════════════════════════════════════════════════════════════ */
@media print {
  body { overflow: visible; }
  .view { overflow: visible; height: auto; }
  .titlebar-drag-region,
  .app-header,
  .btn-back,
  .btn-primary,
  .btn-secondary,
  .search-wrapper,
  .context-menu,
  .tooltip,
  .tab-group,
  .msg-filters,
  .permission-status,
  .permission-guide,
  .batch-panel { display: none !important; }

  .print-header {
    display: block;
    text-align: center;
    padding: 24px 0;
    border-bottom: 2px solid var(--gray-900);
    margin-bottom: 24px;
  }
  .print-title {
    font-family: var(--font-serif);
    font-size: 24px;
    font-weight: 400;
  }
  .print-meta {
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 4px;
  }

  /* Court caption (attorney tier): exactly one of the two headers prints.
     body.has-caption is set by the renderer when caption fields exist. */
  body.has-caption #print-header-generic { display: none !important; }
  body:not(.has-caption) #print-caption { display: none !important; }

  .print-caption { text-align: left; }
  .caption-court {
    text-align: center;
    font-family: var(--font-serif);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 1.5px;
    margin-bottom: 12px;
  }
  .caption-row {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    border-top: 1.5px solid var(--gray-900);
    border-bottom: 1.5px solid var(--gray-900);
    padding: 8px 2px;
  }
  .caption-parties {
    font-family: var(--font-serif);
    font-size: 11.5px;
    line-height: 1.5;
    padding-right: 18px;
    border-right: 1.5px solid var(--gray-900);
    flex: 1;
  }
  .caption-party { font-weight: 600; letter-spacing: 0.5px; }
  .caption-party-role { padding-left: 18px; font-style: italic; }
  .caption-vs { padding: 2px 0; }
  .caption-case {
    font-family: var(--font-serif);
    font-size: 11.5px;
    padding-left: 18px;
    display: flex;
    align-items: center;
    min-width: 160px;
  }
  .caption-title {
    text-align: center;
    margin-top: 12px;
    letter-spacing: 1px;
  }
  #caption-prepared { text-align: center; }

  .tab-content { display: block !important; }
  .tab-content + .tab-content { page-break-before: always; }

  .exhibit-body { padding: 0; }
  .stats-row { grid-template-columns: repeat(5, 1fr); }
  .stat-card { border: 1px solid #ccc; }
  .calendar-day:hover { transform: none; box-shadow: none; }

  /* ── Compact print layout: more calendar per page ──────────── */
  .section-heading { font-size: 19px; white-space: nowrap; }
  .section-label { font-size: 9px; }
  .exhibit-title-row { margin-bottom: 12px; align-items: baseline; }
  .exhibit-date-range { font-size: 9.5px; }
  .print-header { padding: 10px 0; margin-bottom: 14px; }
  .print-title { font-size: 17px; }
  .print-meta { font-size: 9px; margin-top: 2px; }
  .stats-row { gap: 6px; margin-bottom: 12px; }
  .stat-card { padding: 8px 6px; }
  .stat-value { font-size: 17px; }
  .stat-label { font-size: 8px; }
  .legend { padding: 5px 8px; margin-bottom: 8px; }
  .legend-item { font-size: 9px; }
  .calendar-hint, .hint-text { font-size: 8px; }
  .calendar-month { margin-bottom: 14px; page-break-inside: avoid; }
  .calendar-month-label { font-size: 13px; margin-bottom: 5px; }
  .calendar-grid { gap: 3px; }
  .calendar-dow { font-size: 8px; padding-bottom: 2px; }
  .calendar-day { aspect-ratio: 2.4; border-radius: 4px; font-size: 9px; }
  .calendar-month-summary { font-size: 9px; margin-top: 4px; }

  .call-table { font-size: 11px; }
  .call-table th, .call-table td { padding: 6px 10px; }

  /* Collapsible: always show expanded in print (if included) */
  .collapsible-content { max-height: none !important; opacity: 1 !important; overflow: visible !important; }
  .collapse-chevron { display: none; }
  .pdf-toggle { display: none !important; }
  .call-count-badge { display: none; }

  /* Hide call details in PDF when user unchecks the toggle */
  .call-details-excluded #call-details-section { display: none !important; }

  .message-list { max-height: none; overflow: visible; }
  .crossref-detail { display: block !important; }

  @page {
    size: letter;
    margin: 0.75in;
  }
}

/* ══════════════════════════════════════════════════════════════
   ATTORNEY TIER — gated UI & Case Details modal
   ══════════════════════════════════════════════════════════════ */

/* Elements only attorneys see; body.attorney is set from license state. */
.attorney-only { display: none !important; }
body.attorney .attorney-only { display: inline-flex !important; }

/* Exception: with several matters on disk, the switcher stays reachable
   even after a downgrade — a lapsed license must never lock data away. */
body.multi-matter .matter-pill { display: inline-flex !important; }

/* Toast */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--gray-900);
  color: var(--white);
  font-size: 13px;
  padding: 10px 18px;
  border-radius: 999px;
  box-shadow: var(--shadow-lg);
  z-index: 400;
}
@media print { .toast { display: none !important; } }

/* Message marks — key evidence & excluded (attorney tier) */
.msg-bubble.key {
  border-left: 3px solid var(--amber);
  background: #fffbeb;
}
.msg-bubble.excluded { opacity: 0.55; }
.msg-key-badge {
  font-size: 10px;
  font-weight: 600;
  color: #92400e;
  background: #fef3c7;
  padding: 1px 7px;
  border-radius: 999px;
  letter-spacing: 0.3px;
}
.msg-mark-controls {
  margin-left: auto;
  display: none;
  gap: 2px;
}
.msg-bubble:hover .msg-mark-controls { display: inline-flex; }
.msg-mark-btn {
  border: none;
  background: none;
  color: var(--gray-300);
  font-size: 13px;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 5px;
  cursor: pointer;
}
.msg-mark-btn:hover { color: var(--gray-700); background: var(--gray-100); }
.msg-mark-btn.on { color: var(--amber); }
.msg-mark-btn[data-mark="excluded"].on { color: #b91c1c; }
.msg-excluded-note {
  font-size: 11.5px;
  color: var(--gray-500);
  font-style: italic;
  margin: -8px 0 16px;
}

/* Key Messages block — full text of starred evidence */
.key-messages-list { margin-top: 4px; }
.key-message {
  border-left: 3px solid var(--amber);
  background: #fffbeb;
  border-radius: 0 8px 8px 0;
  padding: 10px 14px;
  margin-bottom: 8px;
}
.key-message-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--gray-500);
  margin-bottom: 4px;
}
.key-message-text {
  font-size: 13px;
  color: var(--gray-800);
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

@media print {
  .msg-mark-controls { display: none !important; }
  .msg-bubble.key {
    border-left: 3px solid var(--amber);
    background: #fffbeb !important;
    -webkit-print-color-adjust: exact;
  }
  .key-message {
    page-break-inside: avoid;
    background: #fffbeb !important;
    -webkit-print-color-adjust: exact;
  }
  .key-message-text { font-size: 11px; }
  .key-message-meta { font-size: 9px; }
}

/* Matter pill — current workspace, click to switch */
.matter-pill {
  align-items: center;
  gap: 5px;
  max-width: 220px;
  margin-left: 10px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-sans);
  color: var(--gray-600);
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.matter-pill:hover { border-color: var(--gray-300); color: var(--gray-800); }
.matter-pill:disabled { opacity: 0.5; cursor: default; }
.matter-pill-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Matter switcher dropdown */
.matter-menu {
  position: fixed;
  z-index: 300;
  min-width: 240px;
  max-width: 320px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
  padding: 6px;
}
.matter-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  font-size: 13px;
  font-family: var(--font-sans);
  color: var(--gray-700);
  background: none;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
}
.matter-menu-item:hover { background: var(--gray-50); }
.matter-menu-item .matter-item-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.matter-menu-item.active { font-weight: 600; color: var(--gray-900); }
.matter-menu-item .matter-item-check { color: var(--green); width: 14px; }
.matter-item-action {
  border: none;
  background: none;
  color: var(--gray-300);
  font-size: 13px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
}
.matter-item-action:hover { color: var(--gray-700); background: var(--gray-100); }
.matter-item-action.danger:hover { color: #b91c1c; background: #fef2f2; }
.matter-menu-divider { height: 1px; background: var(--gray-100); margin: 6px 4px; }
.matter-modal-card { max-width: 420px; }

@media print {
  .matter-pill, .matter-menu { display: none !important; }
}

/* Date-range filter (screen-only; scopes the exhibit and thus the export) */
.exhibit-title-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
.exhibit-range-filter {
  display: flex;
  align-items: center;
  gap: 6px;
}
.exhibit-range-filter input[type="date"] {
  font-family: var(--font-sans);
  font-size: 11.5px;
  color: var(--gray-600);
  padding: 3px 6px;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  background: var(--white);
  outline: none;
}
.exhibit-range-filter input[type="date"]:focus { border-color: var(--gray-400); }
.range-sep { color: var(--gray-400); font-size: 12px; }
.range-clear {
  border: none;
  background: var(--gray-100);
  color: var(--gray-500);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}
.range-clear:hover { background: var(--gray-200); color: var(--gray-800); }

/* Declaration page — print-only, appended when enabled in Case Details */
.declaration-page { display: none; }

@media print {
  .exhibit-range-filter { display: none !important; }

  body.declaration-on .declaration-page {
    display: block;
    page-break-before: always;
    font-family: var(--font-serif);
    color: var(--gray-900);
    padding-top: 24px;
  }
  .declaration-title {
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 1px;
    margin-bottom: 20px;
  }
  .declaration-intro { font-size: 12.5px; margin-bottom: 12px; }
  .declaration-list {
    font-size: 12.5px;
    line-height: 1.7;
    padding-left: 22px;
  }
  .declaration-list li { margin-bottom: 10px; }
  .decl-value { font-weight: 600; }
  .declaration-sign-row {
    display: flex;
    gap: 48px;
    margin-top: 48px;
  }
  .declaration-sign { flex: 1; max-width: 260px; }
  .declaration-sign .sign-line { border-bottom: 1px solid var(--gray-900); height: 28px; }
  .declaration-sign p { font-size: 10.5px; color: var(--gray-500); margin-top: 4px; }
  .declaration-note {
    margin-top: 36px;
    font-size: 9.5px;
    color: var(--gray-500);
    font-family: var(--font-sans);
  }
}

.case-details-card {
  max-width: 520px;
  width: 520px;
  max-height: 85vh;
  overflow-y: auto;
}
.case-form { text-align: left; margin-top: 8px; }
.case-field {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  flex: 1;
}
.case-field input {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 400;
  font-family: var(--font-sans);
  color: var(--gray-800);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  background: var(--white);
  outline: none;
  box-sizing: border-box;
  text-transform: none;
  letter-spacing: normal;
}
.case-field input:focus { border-color: var(--gray-400); }
.case-field-row { display: flex; gap: 12px; }
.case-field-hint {
  font-weight: 400;
  color: var(--gray-400);
  text-transform: none;
  letter-spacing: normal;
}
.case-section-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-700);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-top: 1px solid var(--gray-100);
  padding-top: 14px;
  margin: 6px 0 12px;
}
.case-section-label span {
  font-weight: 400;
  color: var(--gray-400);
  text-transform: none;
  letter-spacing: normal;
}
.case-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--gray-700);
  margin-bottom: 12px;
  cursor: pointer;
}

/* ══════════════════════════════════════════════════════════════
   LICENSE MODAL & UPGRADE PROMPT
   ══════════════════════════════════════════════════════════════ */

.btn-license {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: 1px solid var(--gray-200);
  background: var(--white);
  color: var(--gray-400);
  cursor: pointer;
  transition: all 0.15s ease;
  margin-left: 8px;
}
.btn-license:hover {
  color: var(--gray-700);
  border-color: var(--gray-300);
  background: var(--gray-50);
}
.btn-license.license-active {
  color: var(--green);
  border-color: var(--green);
  background: #f0fdf4;
}

.btn-locked {
  opacity: 0.6;
  position: relative;
}
.btn-locked::after {
  content: "🔒";
  font-size: 8px;
  position: absolute;
  top: -2px;
  right: -4px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.15s ease;
}

.modal-card {
  background: var(--white);
  border-radius: 16px;
  padding: 36px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  position: relative;
  text-align: center;
  animation: slideUp 0.2s ease;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  font-size: 20px;
  color: var(--gray-400);
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}
.modal-close:hover { color: var(--gray-700); }

.modal-title {
  font-family: "EB Garamond", serif;
  font-size: 22px;
  font-weight: 600;
  color: var(--gray-900);
  margin: 12px 0 8px;
}

.modal-desc {
  font-size: 13px;
  color: var(--gray-500);
  line-height: 1.5;
  margin-bottom: 20px;
}

.license-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--gray-100);
  color: var(--gray-500);
  margin: 0 auto;
}
.license-icon-active {
  background: #f0fdf4;
  color: var(--green);
}

.license-state.hidden { display: none; }

.license-input-group {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.license-input {
  flex: 1;
  font-family: "SF Mono", "Menlo", monospace;
  font-size: 14px;
  letter-spacing: 0.5px;
  padding: 10px 14px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  outline: none;
  text-transform: uppercase;
}
.license-input:focus {
  border-color: var(--gray-400);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

.license-error {
  font-size: 12px;
  color: #ef4444;
  margin-bottom: 12px;
}

.license-buy-link {
  display: block;
  font-size: 12px;
  color: var(--gray-400);
  text-decoration: none;
  transition: color 0.15s;
}
.license-buy-link:hover {
  color: var(--gray-700);
}

.btn-deactivate {
  background: none;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 8px 20px;
  font-size: 12px;
  color: var(--gray-500);
  cursor: pointer;
  transition: all 0.15s;
}
.btn-deactivate:hover {
  border-color: #ef4444;
  color: #ef4444;
}

.btn-sample-link {
  display: block;
  margin: 14px auto 0;
  background: none;
  border: none;
  font-size: 13px;
  color: var(--gray-400);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.15s;
}
.btn-sample-link:hover {
  color: var(--gray-700);
}

.sample-banner {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  background: #1f2937;
  color: #f9fafb;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 12.5px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  z-index: 9000;
}
.sample-banner button {
  background: #f9fafb;
  color: #111827;
  border: none;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.telemetry-setting {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--gray-100);
  text-align: left;
}
.telemetry-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--gray-700);
  cursor: pointer;
}
.telemetry-desc {
  margin: 6px 0 0 22px;
  font-size: 11px;
  color: var(--gray-400);
  line-height: 1.5;
}

.upgrade-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.upgrade-buttons .btn-primary {
  display: block;
  text-align: center;
  text-decoration: none;
}
.btn-secondary {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 13px;
  color: var(--gray-600);
  cursor: pointer;
  transition: all 0.15s;
}
.btn-secondary:hover {
  background: var(--gray-50);
  border-color: var(--gray-300);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideUp {
  from { transform: translateY(10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ══════════════════════════════════════════════════════════════
   IPHONE BACKUP IMPORT
   ══════════════════════════════════════════════════════════════ */
.backup-list {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.backup-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
}
.backup-item.encrypted {
  background: var(--gray-50);
}
.backup-item-info {
  min-width: 0;
}
.backup-item-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--gray-900);
}
.backup-item-meta {
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 2px;
}
.backup-item-lock {
  color: var(--red);
}
.backup-item-hint {
  flex-shrink: 0;
  max-width: 180px;
  font-size: 11px;
  color: var(--gray-400);
  text-align: right;
  line-height: 1.4;
}
.backup-item .btn-secondary {
  flex-shrink: 0;
  padding: 7px 18px;
  font-size: 13px;
}
.backup-error {
  margin-top: 14px;
  font-size: 12px;
  color: var(--red);
  line-height: 1.5;
}

/* ── Hearing Prep (flag-guarded module) ─────────────────────── */
.hp-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.hp-toolbar-spacer { flex: 1; }
.hp-pack-title { font-family: var(--font-serif); font-size: 17px; color: var(--gray-800); }
.hp-drillbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 8px 12px; background: var(--gray-50); border: 1px solid var(--gray-200);
  border-radius: 8px; margin-bottom: 14px; }
.hp-check { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--gray-600); }
.hp-drill-status { font-size: 12.5px; font-weight: 600; color: var(--blue); }
.hp-layout { display: flex; gap: 18px; align-items: flex-start; }
.hp-sidebar { width: 290px; flex-shrink: 0; }
.hp-cat { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--gray-500); margin: 12px 0 4px; }
.hp-q-item { display: block; width: 100%; text-align: left; padding: 6px 9px; margin-bottom: 2px;
  font-size: 12.5px; line-height: 1.35; color: var(--gray-700); background: none;
  border: 1px solid transparent; border-radius: 6px; cursor: pointer; }
.hp-q-item:hover { background: var(--gray-100); }
.hp-q-item.active { background: var(--blue-light); border-color: var(--blue); color: var(--gray-900); }
.hp-rules { margin: 0; padding-left: 18px; font-size: 12px; color: var(--gray-600); line-height: 1.5; }
.hp-detail { flex: 1; min-width: 0; border: 1px solid var(--gray-200); border-radius: 10px; padding: 16px 18px; }
.hp-q-header { display: flex; gap: 10px; align-items: flex-start; }
.hp-q-text { font-family: var(--font-serif); font-size: 19px; line-height: 1.35; color: var(--gray-900); flex: 1; }
.hp-meta { margin: 10px 0 4px; font-size: 12.5px; color: var(--gray-700); line-height: 1.6; }
.hp-meta-label { font-weight: 700; color: var(--gray-500); }
.hp-answer { font-size: 14.5px; line-height: 1.65; color: var(--gray-800); padding: 10px 12px;
  background: var(--gray-50); border-left: 3px solid var(--green); border-radius: 0 6px 6px 0;
  transition: filter 0.2s; }
.hp-answer.hp-blurred { filter: blur(6px); }
.hp-pause { color: var(--amber); font-size: 9px; vertical-align: middle; }
.hp-target { font-weight: 400; color: var(--gray-500); font-size: 11px; }
.hp-actions { display: flex; gap: 8px; margin: 12px 0; }
#hp-record.recording { background: var(--red); border-color: var(--red); color: white; animation: hp-pulse 1.2s infinite; }
@keyframes hp-pulse { 50% { opacity: 0.65; } }
.hp-metrics { font-size: 12.5px; color: var(--gray-700); background: var(--blue-light);
  padding: 7px 10px; border-radius: 6px; margin-bottom: 8px; }
.hp-take { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--gray-700);
  padding: 5px 0; border-bottom: 1px solid var(--gray-100); }
.hp-take span { flex: 1; }
.hp-take button { border: 1px solid var(--gray-300); background: var(--white); border-radius: 5px;
  padding: 2px 8px; cursor: pointer; font-size: 12px; }
.hp-muted { font-size: 12.5px; color: var(--gray-400); }
.hp-toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--gray-900); color: var(--white); font-size: 13px; padding: 9px 16px;
  border-radius: 8px; z-index: 300; }
.hp-toast.error { background: var(--red); }
.hp-prompt-card { width: min(860px, 92vw); height: min(660px, 78vh); background: #0b0d12;
  border-radius: 14px; display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45); animation: slideUp 0.2s ease; }
.hp-prompter-bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  background: #161a22; color: var(--gray-300); font-size: 12.5px; flex-shrink: 0; }
.hp-prompt-title { flex: 1; font-size: 12px; color: var(--gray-400); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.hp-prompt-close { background: none; border: none; color: var(--gray-400); font-size: 16px;
  cursor: pointer; padding: 2px 6px; }
.hp-prompt-close:hover { color: #fff; }
#hp-prompt-record.recording { background: var(--red); border-color: var(--red); color: #fff;
  animation: hp-pulse 1.2s infinite; }
.hp-prompt-scroll { flex: 1; overflow-y: auto; padding: 6vh 0; position: relative; }
/* subtle "read here" guide line a third of the way down */
.hp-prompt-scroll::before { content: ""; position: sticky; top: 30%; display: block; height: 0;
  border-top: 1px solid rgba(255, 212, 121, 0.25); margin: 0 26px; }
#hp-prompt-text { max-width: 720px; margin: 0 auto; font-family: var(--font-serif);
  font-size: 28px; line-height: 40px; color: #e8eaf0; padding: 0 28px 55vh; }
#hp-prompt-text strong { color: #ffd479; }
#hp-prompt-text .hp-pause { color: var(--amber); font-size: 12px; }

/* Hearing Prep — locked (free tier) state */
#tab-hearingprep.hp-is-locked > :not(#hp-locked) { display: none; }
.hp-locked { display: flex; justify-content: center; padding: 48px 16px; }
.hp-locked-card { max-width: 520px; text-align: center; padding: 36px 32px;
  border: 1px solid var(--gray-200, #e5e7eb); border-radius: 14px;
  background: var(--gray-50, #f9fafb); }
.hp-locked-card h2 { margin: 0 0 10px; font-size: 22px; }
.hp-locked-card p { color: var(--gray-600, #4b5563); font-size: 14px; line-height: 1.55; }
.hp-locked-card ul { text-align: left; margin: 18px auto; max-width: 400px;
  color: var(--gray-700, #374151); font-size: 13.5px; line-height: 1.7; }
.hp-locked-card .btn-primary { margin-top: 6px; }
.hp-locked-note { margin-top: 14px; font-size: 12px; color: var(--gray-500, #6b7280); }
