/* ============================================
   Healthcare Admin Panel - Design System
   ============================================ */

/* CSS Custom Properties */
:root {
    --bg-primary: #FFFFFF;
    --bg-secondary: #F8FAFC;
    --bg-tertiary: #F1F5F9;
    --bg-sidebar: #0F172A;
    --text-primary: #0F172A;
    --text-secondary: #475569;
    --text-muted: #94A3B8;
    --text-sidebar: rgba(255, 255, 255, 0.7);
    --text-sidebar-active: #FFFFFF;
    --accent-emerald: #10B981;
    --accent-emerald-dark: #059669;
    --accent-emerald-light: #D1FAE5;
    --accent-purple: #8B5CF6;
    --accent-purple-light: #EDE9FE;
    --accent-amber: #F59E0B;
    --accent-amber-light: #FEF3C7;
    --accent-rose: #F43F5E;
    --accent-rose-light: #FFE4E6;
    --accent-cyan: #06B6D4;
    --accent-cyan-light: #CFFAFE;
    --accent-gray: #64748B;
    --border: #E2E8F0;
    --border-dark: #CBD5E1;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -1px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -2px rgba(15, 23, 42, 0.04);
    --shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, 0.1), 0 10px 10px -5px rgba(15, 23, 42, 0.04);
    
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;
    
    --radius-sm: 4px;
    --radius: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;
    
    --transition-fast: 150ms ease-out;
    --transition: 200ms ease-out;
    --transition-slow: 300ms ease-in-out;
    
    --sidebar-width: 260px;
    --topbar-height: 64px;
}

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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-secondary);
}

/* App Layout */
.app {
    display: flex;
    min-height: 100vh;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform var(--transition-slow);
}

.sidebar-close {
    display: none;
}

.sidebar-header {
    padding: var(--space-5) var(--space-5);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: 16px;
    font-weight: 600;
    color: white;
    text-decoration: none;
}

.logo:hover {
    color: white;
}

.logo strong {
    font-weight: 700;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-4) var(--space-3);
}

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

.nav-section-title {
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.4);
    padding: var(--space-2) var(--space-3);
    margin-bottom: var(--space-1);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-sidebar);
    text-decoration: none;
    border-radius: var(--radius);
    transition: all var(--transition-fast);
    margin-bottom: var(--space-1);
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-sidebar-active);
}

.nav-item.active {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-emerald);
}

.nav-item.active svg {
    color: var(--accent-emerald);
}

.nav-badge {
    margin-left: auto;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: var(--radius-full);
}

.nav-badge-warning {
    background: var(--accent-amber);
    color: white;
}

.nav-item svg {
    flex-shrink: 0;
}

.sidebar-footer {
    padding: var(--space-4);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-top: var(--space-4);
    padding: var(--space-3);
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius);
}

.user-avatar {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-emerald);
    border-radius: 50%;
    font-size: 13px;
    font-weight: 600;
}

.user-details {
    flex: 1;
}

.user-details strong {
    display: block;
    font-size: 14px;
}

.user-details span {
    font-size: 12px;
    color: var(--text-sidebar);
}

@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .sidebar-close {
        display: flex;
        align-items: center;
        justify-content: center;
        position: absolute;
        top: var(--space-4);
        right: var(--space-4);
        width: 32px;
        height: 32px;
        background: none;
        border: none;
        color: var(--text-sidebar);
        cursor: pointer;
        border-radius: var(--radius);
    }
    
    .sidebar-close:hover {
        background: rgba(255, 255, 255, 0.1);
    }
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ============================================
   TOPBAR
   ============================================ */
.topbar {
    height: var(--topbar-height);
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-6);
    position: sticky;
    top: 0;
    z-index: 50;
}

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

.sidebar-toggle {
    display: none;
    padding: var(--space-2);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius);
}

.sidebar-toggle:hover {
    background: var(--bg-tertiary);
}

.breadcrumb {
    font-size: 14px;
    color: var(--text-secondary);
}

.breadcrumb-item {
    font-weight: 500;
    color: var(--text-primary);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box svg {
    position: absolute;
    left: var(--space-3);
    color: var(--text-muted);
}

.search-box input {
    width: 280px;
    padding: var(--space-2) var(--space-3) var(--space-2) 40px;
    font-family: inherit;
    font-size: 14px;
    background: var(--bg-tertiary);
    border: 1px solid transparent;
    border-radius: var(--radius);
    transition: all var(--transition-fast);
}

.search-box input:focus {
    outline: none;
    background: var(--bg-primary);
    border-color: var(--accent-emerald);
    box-shadow: 0 0 0 3px var(--accent-emerald-light);
}

.search-box-md input {
    width: 320px;
}

.topbar-btn {
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius);
    transition: all var(--transition-fast);
}

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

.topbar-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-rose);
    color: white;
    font-size: 10px;
    font-weight: 700;
    border-radius: 50%;
}

@media (max-width: 1024px) {
    .main {
        margin-left: 0;
    }
    
    .sidebar-toggle {
        display: flex;
    }
    
    .search-box {
        display: none;
    }
}

/* ============================================
   CONTENT AREA
   ============================================ */
.content {
    flex: 1;
    padding: var(--space-6);
}

.page {
    display: none;
}

.page.active {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

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

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-6);
}

.page-title {
    font-size: 24px;
    font-weight: 700;
}

.page-actions {
    display: flex;
    gap: var(--space-3);
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

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

.btn-primary {
    background: var(--accent-emerald);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-emerald-dark);
}

.btn-outline {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-dark);
}

.btn-outline:hover:not(:disabled) {
    background: var(--bg-tertiary);
}

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

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

.btn-danger {
    background: var(--accent-rose);
    color: white;
}

.btn-sm {
    padding: var(--space-1) var(--space-3);
    font-size: 13px;
}

.btn-block {
    width: 100%;
}

/* ============================================
   KPI CARDS
   ============================================ */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.kpi-card {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
}

.kpi-card-urgent {
    border-color: var(--accent-rose);
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--accent-rose-light) 100%);
}

.kpi-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-2);
}

.kpi-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.kpi-trend {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    font-size: 12px;
    font-weight: 600;
}

.kpi-trend-up {
    color: var(--accent-emerald);
}

.kpi-trend-down {
    color: var(--accent-rose);
}

.kpi-badge {
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 700;
    border-radius: var(--radius-full);
}

.kpi-badge-success {
    background: var(--accent-emerald-light);
    color: var(--accent-emerald);
}

.kpi-value {
    font-size: 32px;
    font-weight: 700;
    line-height: 1;
    margin-bottom: var(--space-1);
}

.kpi-sub {
    font-size: 12px;
    color: var(--text-muted);
}

.kpi-indicator {
    width: 8px;
    height: 8px;
    background: var(--accent-rose);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

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

@media (max-width: 1200px) {
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .kpi-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   CHARTS
   ============================================ */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-6);
    margin-bottom: var(--space-6);
}

.chart-card {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-5);
}

.chart-title {
    font-size: 16px;
    font-weight: 600;
}

.chart-filter {
    padding: var(--space-1) var(--space-3);
    font-family: inherit;
    font-size: 13px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
}

/* Funnel Chart */
.funnel-chart {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.funnel-stage {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.funnel-bar {
    height: 32px;
    background: linear-gradient(90deg, var(--accent-emerald) 0%, var(--accent-cyan) 100%);
    border-radius: var(--radius);
    width: var(--percent);
    min-width: 60px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: var(--space-3);
    transition: width 1s ease-out;
}

.funnel-bar::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: rgba(255, 255, 255, 0.3);
}

.funnel-info {
    display: flex;
    justify-content: space-between;
    flex: 1;
    min-width: 150px;
}

.funnel-label {
    font-size: 13px;
    font-weight: 500;
}

.funnel-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Source Chart */
.source-chart {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

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

.source-bar {
    height: 24px;
    background: var(--accent-emerald-light);
    border-radius: var(--radius);
    width: var(--percent);
    min-width: 60px;
    position: relative;
    transition: width 1s ease-out;
}

.source-bar::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--percent);
    background: var(--accent-emerald);
    border-radius: var(--radius);
}

.source-value {
    position: relative;
    z-index: 1;
    padding-left: var(--space-3);
    font-size: 12px;
    font-weight: 600;
    color: white;
}

.source-label {
    font-size: 13px;
    color: var(--text-secondary);
    min-width: 120px;
}

@media (max-width: 1024px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   TABLES
   ============================================ */
.table-card {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-5);
    border-bottom: 1px solid var(--border);
}

.table-title {
    font-size: 16px;
    font-weight: 600;
}

.table-actions {
    display: flex;
    gap: var(--space-3);
}

.table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: var(--space-3) var(--space-4);
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    background: var(--bg-tertiary);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    white-space: nowrap;
}

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

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

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

.data-table tbody tr:hover {
    background: var(--bg-secondary);
}

.data-table tbody tr.row-urgent {
    background: var(--accent-rose-light);
}

.data-table tbody tr.row-urgent:hover {
    background: #FFE4E6;
}

.cell-mono {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--accent-emerald);
}

.cell-time {
    color: var(--text-muted);
    font-size: 13px;
}

/* Institution Cell */
.institution-cell {
    display: flex;
    flex-direction: column;
}

.institution-name {
    font-weight: 500;
    margin-bottom: 2px;
}

.institution-location {
    font-size: 12px;
    color: var(--text-muted);
}

/* Owner Cell */
.owner-cell {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.owner-avatar {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-purple);
    color: white;
    font-size: 10px;
    font-weight: 600;
    border-radius: 50%;
}

.owner-avatar-empty {
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: var(--space-1);
}

.action-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius);
    transition: all var(--transition-fast);
}

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

.action-btn-view:hover {
    color: var(--accent-cyan);
}

.action-btn-edit:hover {
    color: var(--accent-emerald);
}

/* Table Footer */
.table-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-4) var(--space-5);
    border-top: 1px solid var(--border);
}

.table-info {
    font-size: 13px;
    color: var(--text-muted);
}

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

.pagination-btn {
    min-width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius);
    transition: all var(--transition-fast);
}

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

.pagination-btn.active {
    background: var(--accent-emerald);
    border-color: var(--accent-emerald);
    color: white;
}

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

.pagination-ellipsis {
    padding: 0 var(--space-2);
    color: var(--text-muted);
}

/* ============================================
   BADGES
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: var(--radius-sm);
}

.badge-lg {
    padding: var(--space-2) var(--space-3);
    font-size: 13px;
    border-radius: var(--radius);
}

.badge-gray {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.badge-emerald {
    background: var(--accent-emerald-light);
    color: var(--accent-emerald);
}

.badge-cyan {
    background: var(--accent-cyan-light);
    color: #0E7490;
}

.badge-purple {
    background: var(--accent-purple-light);
    color: var(--accent-purple);
}

.badge-amber {
    background: var(--accent-amber-light);
    color: #B45309;
}

.badge-rose {
    background: var(--accent-rose-light);
    color: var(--accent-rose);
}

/* ============================================
   FILTERS
   ============================================ */
.filters-bar {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    margin-bottom: var(--space-4);
}

.filters-row {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    gap: var(--space-3);
    margin-left: auto;
}

.filter-select {
    padding: var(--space-2) var(--space-3);
    font-family: inherit;
    font-size: 13px;
    background: var(--bg-tertiary);
    border: 1px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    min-width: 140px;
}

.filter-select:focus {
    outline: none;
    border-color: var(--accent-emerald);
}

@media (max-width: 1024px) {
    .filters-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-group {
        margin-left: 0;
        flex-wrap: wrap;
    }
    
    .filter-select {
        flex: 1;
    }
}

/* ============================================
   DETAIL PANEL
   ============================================ */
.detail-panel {
    position: fixed;
    inset: 0;
    z-index: 200;
    visibility: hidden;
}

.detail-panel.open {
    visibility: visible;
}

.detail-panel-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    opacity: 0;
    transition: opacity var(--transition-slow);
}

.detail-panel.open .detail-panel-backdrop {
    opacity: 1;
}

.detail-panel-content {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 480px;
    max-width: 100%;
    background: var(--bg-primary);
    box-shadow: var(--shadow-xl);
    transform: translateX(100%);
    transition: transform var(--transition-slow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.detail-panel.open .detail-panel-content {
    transform: translateX(0);
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: var(--space-5);
    border-bottom: 1px solid var(--border);
}

.detail-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: var(--space-1);
}

.detail-case-id {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--accent-emerald);
}

.detail-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius);
    transition: all var(--transition-fast);
}

.detail-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.detail-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-5);
}

.detail-stage {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-6);
}

.detail-stage-hint {
    font-size: 13px;
    color: var(--text-muted);
}

.detail-section {
    margin-bottom: var(--space-6);
    padding-bottom: var(--space-6);
    border-bottom: 1px solid var(--border);
}

.detail-section:last-child {
    border-bottom: none;
}

.detail-section-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: var(--space-4);
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-4);
}

.detail-field {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.detail-field label {
    font-size: 12px;
    color: var(--text-muted);
}

.detail-field span {
    font-size: 14px;
    font-weight: 500;
}

.detail-field a {
    color: var(--accent-cyan);
}

/* Timeline */
.timeline {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.timeline-item {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-2) 0;
}

.timeline-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    border-radius: 50%;
    flex-shrink: 0;
}

.timeline-item-done .timeline-icon {
    background: var(--accent-emerald-light);
    color: var(--accent-emerald);
}

.timeline-item-active .timeline-icon {
    background: var(--accent-cyan);
    color: white;
    animation: pulse 2s infinite;
}

.timeline-content {
    flex: 1;
}

.timeline-content strong {
    display: block;
    font-size: 13px;
    font-weight: 600;
}

.timeline-content span {
    font-size: 12px;
    color: var(--text-muted);
}

/* Consent Status */
.consent-status {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.consent-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    font-size: 13px;
}

.consent-granted {
    color: var(--accent-emerald);
}

.consent-denied {
    color: var(--accent-rose);
}

/* Next Action Form */
.next-action-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.form-group label {
    font-size: 13px;
    font-weight: 500;
}

.form-input,
.form-select {
    padding: var(--space-2) var(--space-3);
    font-family: inherit;
    font-size: 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all var(--transition-fast);
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--accent-emerald);
    box-shadow: 0 0 0 3px var(--accent-emerald-light);
}

/* ============================================
   TOAST
   ============================================ */
.toast-container {
    position: fixed;
    top: calc(var(--topbar-height) + var(--space-4));
    right: var(--space-6);
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    border-left: 4px solid;
    min-width: 300px;
    animation: toastIn 0.3s ease-out;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast svg {
    flex-shrink: 0;
}

.toast-content strong {
    display: block;
    font-size: 14px;
    margin-bottom: 2px;
}

.toast-content span {
    font-size: 13px;
    color: var(--text-secondary);
}

.toast-success {
    border-color: var(--accent-emerald);
}

.toast-success svg {
    color: var(--accent-emerald);
}

.toast-error {
    border-color: var(--accent-rose);
}

.toast-error svg {
    color: var(--accent-rose);
}

.toast-warning {
    border-color: var(--accent-amber);
}

.toast-warning svg {
    color: var(--accent-amber);
}

/* ============================================
   UTILITIES
   ============================================ */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 640px) {
    .content {
        padding: var(--space-4);
    }
    
    .detail-panel-content {
        width: 100%;
    }
    
    .detail-grid {
        grid-template-columns: 1fr;
    }
}
