/* 
  =============================================================
  Sentari Mailroom Demo - Document Intake Interface
  =============================================================
*/

:root {
  color-scheme: light;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: #f1f5f9; /* Slate 100 */
  color: #0f172a; /* Slate 900 */
  line-height: 1.5;

  /* HSL Tailored Civic Palette */
  --teal-50: hsl(171, 96%, 96%);
  --teal-100: hsl(171, 91%, 91%);
  --teal-600: hsl(172, 66%, 50%);
  --teal-700: hsl(173, 80%, 40%);
  --teal-800: hsl(174, 84%, 32%);
  --teal-900: hsl(175, 84%, 25%);

  --slate-50: hsl(210, 40%, 98%);
  --slate-100: hsl(212, 33%, 95%);
  --slate-200: hsl(212, 33%, 89%);
  --slate-300: hsl(210, 31%, 80%);
  --slate-500: hsl(215, 16%, 47%);
  --slate-700: hsl(215, 25%, 27%);
  --slate-800: hsl(217, 33%, 17%);
  --slate-900: hsl(222, 47%, 11%);

  /* Status Colors */
  --status-intake-text: #2563eb;
  --status-intake-bg: #eff6ff;
  --status-intake-border: #dbeafe;

  --status-review-text: #0d9488;
  --status-review-bg: #f0fdfa;
  --status-review-border: #ccfbf1;

  --status-recorded-text: #16a34a;
  --status-recorded-bg: #f0fdf4;
  --status-recorded-border: #dcfce7;

  --status-escalated-text: #d97706;
  --status-escalated-bg: #fffbeb;
  --status-escalated-border: #fef3c7;

  --status-quarantine-text: #dc2626;
  --status-quarantine-bg: #fef2f2;
  --status-quarantine-border: #fee2e2;

  /* Radii & Shadows */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  
  --shadow-flat: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
  --shadow-subtle: 0 4px 6px -1px rgba(15, 23, 42, 0.04), 0 2px 4px -2px rgba(15, 23, 42, 0.03);
  --shadow-premium: 0 10px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
  --shadow-drawer: -20px 0 50px -10px rgba(15, 23, 42, 0.12);

  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Base Reset */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--slate-100);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

/* App Viewport Container */
#app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* 
  =========================================
  1. Split-Screen Login View Redesign
  =========================================
*/
.login-split {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* Left Brand Panel */
.login-brand-panel {
  flex: 1 1 50%;
  background-color: var(--slate-900);
  background-image: 
    radial-gradient(at 0% 0%, hsla(173, 80%, 40%, 0.15) 0, transparent 60%),
    radial-gradient(at 100% 100%, hsla(217, 33%, 17%, 0.2) 0, transparent 70%);
  color: #ffffff;
  padding: 60px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-right: 4px solid var(--teal-600);
  position: relative;
}

.brand-crest {
  width: 60px;
  height: 60px;
  color: var(--teal-600);
  background-color: rgba(45, 212, 191, 0.08);
  padding: 14px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(45, 212, 191, 0.2);
  margin-bottom: 24px;
}

.brand-crest svg {
  width: 100%;
  height: 100%;
}

.brand-eyebrow {
  color: var(--teal-600);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: 8px;
}

.login-brand-panel h2 {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.brand-city {
  color: var(--slate-300);
  font-size: 1.1rem;
  font-weight: 400;
  margin-top: 4px;
  margin-bottom: 40px;
}

.brand-perks {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 60px;
}

.perk-item {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.95rem;
  color: var(--slate-100);
}

.check-icon {
  width: 20px;
  height: 20px;
  color: var(--teal-600);
  background-color: rgba(45, 212, 191, 0.1);
  border-radius: 999px;
  padding: 4px;
}

.brand-footer {
  color: var(--slate-500);
  font-size: 0.8rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 16px;
}

/* Right Form Panel */
.login-form-panel {
  flex: 1 1 50%;
  background-color: var(--slate-50);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.login-form-panel .panel {
  width: 100%;
  max-width: 440px;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg);
  background-color: #ffffff;
  box-shadow: var(--shadow-premium);
  padding: 40px;
  position: relative;
}

.login-form-panel .panel h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--slate-900);
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.login-form-panel .panel p {
  color: var(--slate-500);
  font-size: 0.85rem;
  line-height: 1.5;
  margin-bottom: 28px;
}

/* 
  =========================================
  2. Main Operational Dashboard Layout
  =========================================
*/

/* Sticky Top Dashboard Header - Clean White Theme */
.dashboard-header {
  background-color: #ffffff;
  color: var(--slate-900);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 32px;
  border-bottom: 1px solid var(--slate-200);
  position: sticky;
  top: 0;
  z-index: 40;
}

.dashboard-header .header-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dashboard-header h1 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--slate-900);
  letter-spacing: -0.025em;
  margin: 0;
}

.dashboard-header .subtitle {
  color: var(--slate-500);
  font-size: 0.82rem;
  font-weight: 400;
  margin: 0;
}

/* Double-Column Operational Dashboard */
.dashboard-grid-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
  align-items: start;
}

.dashboard-controls-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: sticky;
  top: 90px; /* Account for sticky header */
}

.dashboard-monitor-pane {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Sidebar Widgets */
.sidebar-widget {
  background-color: #ffffff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-flat);
}

.sidebar-widget h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--slate-900);
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}

.sidebar-widget .widget-desc {
  font-size: 0.78rem;
  color: var(--slate-500);
  margin-bottom: 16px;
  line-height: 1.45;
}

.sidebar-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.sidebar-actions-grid button {
  padding: 8px 12px;
  font-size: 0.78rem;
}

/* Client Trial Workspace sidebar styling */
.trial-panel.sidebar-widget {
  border-left: 5px solid var(--teal-700);
}

.trial-panel .widget-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.limit-indicator {
  background-color: var(--teal-50);
  border: 1px solid var(--teal-100);
  color: var(--teal-800);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
}

.trial-sidebar-form .field {
  margin-bottom: 12px;
}

.trial-sidebar-form input {
  padding: 8px 12px;
  font-size: 0.8rem;
}

.trial-status {
  display: flex;
  flex-direction: column;
  background-color: var(--slate-100);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  gap: 6px;
  margin: 12px 0;
  padding: 10px 12px;
  font-size: 0.78rem;
}

.trial-status span {
  background-color: #ffffff;
  border: 1px solid var(--slate-200);
  border-radius: 4px;
  color: var(--teal-800);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  text-align: center;
  width: 100%;
}

.upload-field input[type="file"] {
  border: 2px dashed var(--slate-300);
  background-color: var(--slate-50);
  padding: 16px;
  cursor: pointer;
  width: 100%;
  font-size: 0.75rem;
  border-radius: var(--radius-md);
}

/* 
  =========================================
  3. Interactive Dashboard Components
  =========================================
*/

/* Queue Section Header */
.queue-section-header {
  border-bottom: 1px solid var(--slate-200);
  padding-bottom: 8px;
  margin-top: 10px;
}

.queue-section-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--slate-900);
  letter-spacing: -0.015em;
}

.queue-sub {
  font-size: 0.78rem;
  color: var(--slate-500);
}

/* Form inputs & selections */
.field {
  display: flex;
  flex-direction: column;
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--slate-800);
  gap: 6px;
  margin-bottom: 16px;
}

.field .muted {
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--slate-500);
}

input,
select {
  background-color: var(--slate-50);
  border: 1px solid var(--slate-300);
  border-radius: var(--radius-md);
  color: var(--slate-900);
  font-family: inherit;
  font-size: 0.82rem;
  padding: 8px 12px;
  outline: none;
  transition: var(--transition-fast);
}

input:focus,
select:focus {
  background-color: #ffffff;
  border-color: var(--teal-700);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.check-field {
  align-items: flex-start;
  display: flex;
  font-size: 0.75rem;
  font-weight: 500;
  gap: 8px;
  line-height: 1.35;
  margin-bottom: 14px;
  color: var(--slate-700);
  cursor: pointer;
}

.check-field input[type="checkbox"] {
  cursor: pointer;
  margin-top: 2px;
  accent-color: var(--teal-700);
}

/* Buttons System */
button {
  background-color: var(--teal-700);
  border: 1px solid var(--teal-700);
  color: #ffffff;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  transition: var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

button:hover {
  background-color: var(--teal-600);
  border-color: var(--teal-600);
  transform: translateY(-0.5px);
  box-shadow: 0 4px 10px rgba(15, 118, 110, 0.12);
}

button:active {
  background-color: var(--teal-800);
  border-color: var(--teal-800);
  transform: translateY(0);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
  box-shadow: none;
}

button.ghost {
  background-color: transparent;
  border: 1px solid var(--slate-300);
  color: var(--slate-700);
}

button.ghost:hover {
  background-color: var(--slate-50);
  border-color: var(--slate-500);
  color: var(--slate-900);
  box-shadow: none;
}

button.primary {
  background-color: hsl(142, 76%, 36%);
  border-color: hsl(142, 76%, 36%);
}

button.primary:hover {
  background-color: hsl(142, 72%, 29%);
  border-color: hsl(142, 72%, 29%);
}

/* Status Notifications */
.email-mode,
.action-status {
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 500;
  margin: 0 0 14px 0;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid;
}

.email-mode {
  background-color: hsl(48, 100%, 96%);
  border-color: hsl(48, 96%, 89%);
  color: hsl(36, 100%, 25%);
}

.email-mode.live {
  background-color: hsl(142, 70%, 96%);
  border-color: hsl(142, 60%, 89%);
  color: hsl(142, 76%, 20%);
}

.action-status {
  background-color: var(--teal-50);
  border-color: var(--teal-100);
  color: var(--teal-900);
  min-height: 40px;
}

.action-status.error,
.error {
  background-color: hsl(0, 100%, 97%);
  border-color: hsl(0, 100%, 91%);
  color: hsl(0, 84%, 38%);
  padding: 10px 12px;
  font-size: 0.78rem;
  font-weight: 600;
}

/* Metric / Summary Cards */
.summary-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.summary-grid .card {
  background-color: #ffffff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-flat);
}

.summary-grid .card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background-color: var(--slate-300);
}

.summary-grid .card:nth-child(1)::before { background-color: var(--status-intake-text); }
.summary-grid .card:nth-child(2)::before { background-color: var(--status-review-text); }
.summary-grid .card:nth-child(3)::before { background-color: var(--status-escalated-text); }
.summary-grid .card:nth-child(4)::before { background-color: var(--status-recorded-text); }
.summary-grid .card:nth-child(5)::before { background-color: var(--status-quarantine-text); }

.summary-grid .metric {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--slate-900);
  line-height: 1.1;
  margin-bottom: 2px;
  letter-spacing: -0.02em;
}

.summary-grid .card div:nth-child(2) {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--slate-500);
}

.summary-grid .card .stat-sub {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  color: var(--slate-400);
  margin-top: 4px;
}

/* View tabs (Operations Queue / Supervisor Statistics) */
.view-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--slate-200);
  margin-bottom: 18px;
}

.view-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--slate-500);
  cursor: pointer;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.view-tab:hover {
  color: var(--slate-800);
}

.view-tab.active {
  color: var(--teal-700);
  border-bottom-color: var(--teal-700);
}

/* Supervisor statistics view */
.stat-block {
  margin-bottom: 24px;
}

.stat-block h3 {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--slate-700);
  margin-bottom: 12px;
}

.workload-table {
  width: 100%;
  border-collapse: collapse;
  background-color: #ffffff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-flat);
}

.workload-table th,
.workload-table td {
  padding: 10px 16px;
  text-align: left;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--slate-100);
}

.workload-table th {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--slate-500);
  background-color: var(--slate-50);
}

.workload-table td.num,
.workload-table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.workload-table tr:last-child td {
  border-bottom: none;
}

.workload-table tr.busiest td {
  background-color: var(--teal-50);
  color: var(--teal-900);
}

.workload-table tr.unassigned-row td {
  color: var(--slate-500);
  font-style: italic;
}

.workload-table .muted {
  color: var(--slate-400);
  font-style: italic;
}

.reason-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.reason-chip {
  background-color: var(--status-quarantine-bg);
  color: var(--status-quarantine-text);
  border: 1px solid var(--status-quarantine-border);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.78rem;
  font-weight: 600;
}

/* SLA note under the aging cards */
.stat-note {
  margin-top: 10px;
  font-size: 0.78rem;
  color: var(--slate-500);
}

/* Office calendar & SLA settings panel */
.settings-block {
  background-color: #ffffff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-flat);
  padding: 20px;
}

.settings-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.settings-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--slate-500);
  min-width: 100px;
}

.weekday-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.weekday-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--slate-700);
  background-color: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  cursor: pointer;
}

.check-field.inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--slate-700);
}

.time-window {
  display: flex;
  gap: 16px;
  align-items: center;
}

.time-window.hidden {
  display: none;
}

.time-window label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--slate-700);
}

.time-window input {
  padding: 6px 8px;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

.holiday-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.holiday-controls input {
  padding: 6px 8px;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

.holiday-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  min-height: 24px;
}

.holiday-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: var(--teal-50);
  color: var(--teal-900);
  border: 1px solid var(--teal-100);
  border-radius: 999px;
  padding: 4px 8px 4px 12px;
  font-size: 0.8rem;
  font-weight: 600;
}

.chip-remove {
  border: none;
  background: none;
  color: var(--teal-800);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
}

.chip-remove:hover {
  color: var(--status-quarantine-text);
}

.settings-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.settings-status {
  font-size: 0.82rem;
  color: var(--slate-500);
}

.settings-status.error {
  color: var(--status-quarantine-text);
}

/* Audit log search */
.audit-search {
  width: 100%;
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 0.88rem;
  color: var(--slate-900);
  background-color: #ffffff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-flat);
}

.audit-search:focus {
  outline: none;
  border-color: var(--teal-600);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.12);
}

/* Audit log table */
.audit-table {
  width: 100%;
  border-collapse: collapse;
  background-color: #ffffff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-flat);
}

.audit-table thead th {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--slate-500);
  background-color: var(--slate-50);
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--slate-200);
}

.audit-row td {
  padding: 10px 14px;
  font-size: 0.83rem;
  color: var(--slate-800);
  border-bottom: 1px solid var(--slate-100);
  vertical-align: top;
}

.audit-row {
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

.audit-row:hover {
  background-color: var(--slate-50);
}

.audit-row.expanded {
  background-color: var(--teal-50);
}

.audit-disposition {
  margin-top: 4px;
  font-size: 0.72rem;
  color: var(--slate-500);
}

.audit-detail td {
  padding: 0 14px 14px;
  background-color: var(--slate-50);
}

.audit-timeline {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  border-left: 2px solid var(--teal-600);
  background-color: #ffffff;
  border-radius: var(--radius-sm);
}

.audit-event {
  display: grid;
  grid-template-columns: 170px 140px 1fr;
  gap: 10px;
  font-size: 0.8rem;
}

.audit-event-time {
  color: var(--slate-500);
  font-variant-numeric: tabular-nums;
}

.audit-event-actor {
  font-weight: 600;
  color: var(--slate-700);
}

.audit-event-text {
  color: var(--slate-800);
}

/* Case Grid & Queue Cards */
.case-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

.case-card {
  background-color: #ffffff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-subtle);
  padding: 18px;
  cursor: pointer;
  position: relative;
  display: flex;
  flex-direction: column;
  transition: var(--transition-normal);
}

.case-card:hover {
  border-color: var(--teal-600);
  box-shadow: var(--shadow-premium);
  transform: translateY(-1px);
}

.case-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.case-card .source {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--slate-500);
  letter-spacing: 0.05em;
  background-color: var(--slate-50);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--slate-200);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.case-card .tracking-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--slate-900);
  letter-spacing: -0.015em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.case-card .parties {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--teal-800);
  margin-bottom: 12px;
  line-height: 1.35;
}

/* Dynamic Confidence Indicator styling */
.confidence-container {
  margin-bottom: 12px;
  background-color: var(--slate-100);
  border-radius: var(--radius-md);
  padding: 8px 10px;
}

.confidence-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.confidence-label {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--slate-500);
}

.confidence-num {
  font-size: 0.75rem;
  font-weight: 700;
}

.confidence-track {
  height: 5px;
  background-color: var(--slate-200);
  border-radius: 99px;
  overflow: hidden;
}

.confidence-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.3s ease;
}

.confidence-fill.high { background-color: var(--status-recorded-text); }
.confidence-fill.medium { background-color: var(--status-escalated-text); }
.confidence-fill.low { background-color: var(--status-quarantine-text); }

.high-text { color: var(--status-recorded-text); }
.medium-text { color: var(--status-escalated-text); }
.low-text { color: var(--status-quarantine-text); }

/* Metadata section */
.meta-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
  background-color: var(--slate-50);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  border: 1px solid var(--slate-200);
}

.meta-section .meta {
  font-size: 0.78rem;
  margin-bottom: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--slate-500);
}

.meta-section .meta strong {
  font-weight: 500;
}

.meta-section .meta span {
  font-weight: 600;
  color: var(--slate-800);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.case-card-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  margin-bottom: 12px;
}

/* Badge/Pill System Styling */
.status {
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 3px 10px;
  text-transform: uppercase;
  border: 1px solid;
}

.status-intake {
  background-color: hsl(217, 100%, 97%);
  border-color: hsl(217, 91%, 91%);
  color: hsl(217, 91%, 38%);
}

.status-in_review {
  background-color: var(--teal-50);
  border-color: var(--teal-100);
  color: var(--teal-800);
}

.status-escalated {
  background-color: hsl(36, 100%, 97%);
  border-color: hsl(36, 96%, 89%);
  color: hsl(36, 100%, 25%);
}

.status-recorded {
  background-color: hsl(142, 70%, 96%);
  border-color: hsl(142, 60%, 89%);
  color: hsl(142, 76%, 20%);
}

.status-quarantined {
  background-color: hsl(0, 100%, 97%);
  border-color: hsl(0, 100%, 91%);
  color: hsl(0, 84%, 38%);
}

.flag {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  background-color: hsl(0, 100%, 97%);
  color: hsl(0, 84%, 38%);
  border: 1px solid hsl(0, 100%, 91%);
  display: inline-flex;
  align-items: center;
}

.flag.ok {
  background-color: hsl(142, 70%, 96%);
  color: hsl(142, 76%, 20%);
  border-color: hsl(142, 60%, 89%);
}

.flag.test-material {
  background-color: hsl(48, 100%, 96%);
  color: hsl(36, 100%, 25%);
  border-color: hsl(48, 96%, 89%);
}

.bullet {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  display: inline-block;
  margin-right: 5px;
}
.ok-bullet { background-color: var(--status-recorded-text); }
.alert-bullet { background-color: var(--status-quarantine-text); }

/* Action Controls */
.case-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--slate-100);
}

.case-actions button {
  font-size: 0.75rem;
  padding: 5px 12px;
}

.link-button {
  background: transparent;
  border: none;
  color: var(--teal-700);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.8rem;
  margin-top: 10px;
  padding: 0;
  text-align: left;
  display: inline-flex;
  align-items: center;
  transition: var(--transition-fast);
}

.link-button:hover {
  color: var(--teal-600);
  text-decoration: underline;
}

/* Vector Graphic UI Icons */
.ui-icon {
  width: 13px;
  height: 13px;
  display: inline-block;
  vertical-align: text-bottom;
  stroke-width: 2.2px;
  stroke: currentColor;
  fill: none;
}

/* Arrival animation */
@keyframes arrive {
  0% { 
    box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.4); 
    transform: scale(1.01); 
    background-color: var(--teal-50);
  }
  100% { 
    box-shadow: var(--shadow-subtle); 
    transform: scale(1); 
    background-color: #ffffff;
  }
}

.case-card.just-arrived {
  animation: arrive 1.5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* 
  =========================================
  4. Case Detail Drawer Workspace
  =========================================
*/
.overlay {
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  inset: 0;
  position: fixed;
  z-index: 50;
  transition: var(--transition-normal);
}

.detail {
  background: #ffffff;
  bottom: 0;
  box-shadow: var(--shadow-drawer);
  max-width: 520px;
  overflow-y: auto;
  padding: 32px 28px;
  position: fixed;
  right: 0;
  top: 0;
  width: 90%;
  z-index: 55;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--slate-200);
  animation: slideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideIn {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.detail-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--slate-100);
  padding-bottom: 16px;
}

.detail-head h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--slate-900);
  margin: 0;
}

.icon-button {
  background: transparent;
  border: none;
  color: var(--slate-500);
  font-size: 1.8rem;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.icon-button:hover {
  color: var(--slate-900);
}

.detail-meta {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.detail-tracking {
  font-size: 1.45rem;
  font-weight: 800;
  margin: 4px 0;
  color: var(--slate-900);
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-tracking .ui-icon {
  width: 22px;
  height: 22px;
  color: var(--slate-700);
}

.detail p.muted {
  font-size: 0.85rem;
  color: var(--slate-500);
  margin-bottom: 20px;
  line-height: 1.5;
}

.detail-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, 1fr);
  margin: 20px 0;
}

.detail-stat {
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  padding: 10px 14px;
  gap: 4px;
}

.detail-stat span.muted {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--slate-500);
  letter-spacing: 0.08em;
}

.detail-stat strong {
  font-size: 0.85rem;
  color: var(--slate-900);
  font-weight: 600;
  word-break: break-all;
}

.detail-section {
  border-top: 1px solid var(--slate-100);
  margin: 28px 0 12px;
  padding-top: 18px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--slate-900);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-section::after {
  content: '';
  flex: 1 1 auto;
  height: 1px;
  background-color: var(--slate-100);
}

.field-table {
  border-collapse: collapse;
  width: 100%;
  margin-bottom: 24px;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.field-table tr:nth-child(even) {
  background-color: var(--slate-50);
}

.field-table td {
  border-bottom: 1px solid var(--slate-100);
  font-size: 0.85rem;
  padding: 10px 12px;
  vertical-align: middle;
}

.field-table tr:last-child td {
  border-bottom: none;
}

.field-table .field-label {
  color: var(--slate-500);
  font-weight: 600;
  width: 38%;
  font-size: 0.8rem;
}

.field-table td:last-child {
  color: var(--slate-900);
  font-weight: 500;
}

.missing-row {
  background-color: hsl(48, 100%, 97%) !important;
}

.missing-tag {
  background-color: hsl(0, 100%, 97%);
  border: 1px solid hsl(0, 100%, 91%);
  border-radius: 4px;
  color: hsl(0, 84%, 38%);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: inline-block;
}

.detail-actions {
  border-top: none;
  padding-top: 0;
  margin-bottom: 24px;
}

/* Audit History Timeline */
.history {
  list-style: none;
  margin: 0 0 20px 0;
  padding: 0;
}

.history li {
  border-left: 2px solid var(--slate-200);
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 18px;
  padding-left: 18px;
  position: relative;
}

.history li:last-child {
  margin-bottom: 0;
}

.history li::before {
  content: '';
  position: absolute;
  left: -6px;
  top: 6px;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background-color: var(--slate-300);
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 2px var(--slate-200);
  transition: var(--transition-fast);
}

.history li:hover::before {
  background-color: var(--teal-600);
  box-shadow: 0 0 0 2px var(--teal-100);
}

.hist-time {
  color: var(--slate-500);
  font-size: 0.72rem;
  font-weight: 500;
}

.hist-actor {
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--slate-900);
}

.hist-event {
  font-size: 0.85rem;
  color: var(--slate-500);
  line-height: 1.4;
}

/* 
  =========================================
  5. Extra Secure Layout Classes
  =========================================
*/
.secure-icon-container {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

.secure-icon {
  width: 54px;
  height: 54px;
  color: var(--teal-700);
  background-color: var(--teal-50);
  padding: 12px;
  border-radius: 999px;
  border: 1.5px solid var(--teal-100);
  box-shadow: var(--shadow-flat);
}

.btn-icon {
  width: 14px;
  height: 14px;
  stroke-width: 2.5px;
  stroke: currentColor;
  fill: none;
  margin-right: 4px;
}

/* 
  =============================================================
  Responsive Layout Media Queries
  =============================================================
*/

@media (max-width: 992px) {
  .login-split {
    flex-direction: column;
  }
  .login-brand-panel,
  .login-form-panel {
    flex: 1 1 100%;
    padding: 30px;
  }
  .login-brand-panel {
    border-right: none;
    border-bottom: 4px solid var(--teal-600);
  }
  .dashboard-grid-layout {
    grid-template-columns: 1fr;
  }
  .dashboard-controls-sidebar {
    position: static;
  }
}

@media (max-width: 768px) {
  header.dashboard-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 24px;
    /* Don't pin a tall stacked header over the content/tabs on small screens */
    position: static;
  }
  
  header.dashboard-header .badge {
    align-self: flex-start;
  }
  
  .toolbar-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    gap: 10px;
  }

  .trial-status {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .detail {
    width: 100%;
    padding: 24px 18px;
  }
}

/* --- Accessibility & small-screen refinements --- */

/* Visible keyboard focus for every interactive element */
:focus-visible {
  outline: 2px solid var(--teal-700);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Honor the OS "reduce motion" setting */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Wide supervisor tables scroll horizontally instead of breaking the layout.
   min-width:0 lets the flex/grid column actually constrain its width so the
   overflow-x container can scroll rather than push the page wider. */
.dashboard-monitor-pane {
  min-width: 0;
}

#audit-table,
#stat-workload {
  overflow-x: auto;
}

@media (max-width: 768px) {
  .view-tabs {
    flex-wrap: wrap;
  }
  .audit-table {
    min-width: 600px; /* 7 columns — scroll inside #audit-table on phones */
  }
  .audit-event {
    grid-template-columns: 1fr;
    gap: 2px;
    padding-bottom: 6px;
  }
  .case-grid {
    grid-template-columns: 1fr;
  }
  .filters {
    flex-direction: column;
    align-items: stretch;
  }
}
