/* ============================================
   ZAI Monitor - Dark Dashboard Theme
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0a0e17;
    --bg-card: #111827;
    --bg-nav: #0f1420;
    --bg-modal: #1a1f2e;
    --border: #1e293b;
    --border-hover: #334155;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent: #06b6d4;
    --accent-hover: #22d3ee;
    --primary: #3b82f6;
    --primary-hover: #60a5fa;
    --healthy: #22c55e;
    --warning: #eab308;
    --critical: #ef4444;
    --error: #ef4444;
    --pending: #64748b;
    --collecting: #06b6d4;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

html {
    font-size: 14px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    color: var(--accent-hover);
}

/* --- Navigation --- */
.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 56px;
    background: var(--bg-nav);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 32px;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent);
}

.logo-text {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text-primary);
}

.nav-tabs {
    display: flex;
    gap: 4px;
}

.nav-tab {
    padding: 8px 16px;
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-tab:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.nav-tab.active {
    color: var(--accent);
    background: rgba(6, 182, 212, 0.1);
}

/* --- Collector Status --- */
.collector-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.collector-status .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--pending);
    transition: background 0.3s;
}

.collector-status.running .status-dot {
    background: var(--healthy);
    box-shadow: 0 0 6px var(--healthy);
}

.collector-status.error .status-dot {
    background: var(--critical);
}

/* --- Views --- */
.view {
    max-width: 1280px;
    margin: 0 auto;
    padding: 24px;
}

/* --- Summary Grid --- */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.summary-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    border: 1px solid var(--border);
    border-left: 4px solid var(--border);
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, border-color 0.2s;
}

.summary-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-hover);
}

.summary-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0.04;
    pointer-events: none;
}

.summary-card.status-healthy {
    border-left-color: var(--healthy);
}

.summary-card.status-healthy::before {
    background: linear-gradient(135deg, var(--healthy), transparent);
}

.summary-card.status-error {
    border-left-color: var(--error);
}

.summary-card.status-error::before {
    background: linear-gradient(135deg, var(--error), transparent);
}

.summary-card.status-info {
    border-left-color: var(--accent);
}

.summary-card.status-info::before {
    background: linear-gradient(135deg, var(--accent), transparent);
}

.summary-card .summary-icon {
    font-size: 1.5rem;
    margin-bottom: 8px;
    opacity: 0.8;
}

.summary-card .summary-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.2;
}

.summary-card .summary-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* --- Real-time Activity --- */
.rt-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}
.rt-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.rt-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
}
.rt-status {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.rt-status::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
    margin-right: 4px;
    vertical-align: middle;
}
.rt-chart-wrap {
    width: 100%;
    height: 140px;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 8px;
}
.rt-chart-wrap canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.rt-tooltip {
    position: absolute;
    background: rgba(15, 20, 35, 0.95);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 12px;
    pointer-events: none;
    z-index: 10;
    font-size: 0.75rem;
    min-width: 120px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.rt-tooltip-time {
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 4px;
}

.rt-tooltip-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--text-secondary);
    padding: 1px 0;
}

.rt-tooltip-row span:last-child {
    color: var(--text-primary);
    font-weight: 500;
    font-family: monospace;
    font-size: 0.7rem;
}

/* --- RT Stats (inside real-time section) --- */
.rt-stats-divider {
    height: 1px;
    background: var(--border);
    margin: 16px 0 12px 0;
}

.rt-stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.rt-stats-tabs {
    display: flex;
    gap: 4px;
}

.rt-stats-summary {
    display: flex;
    gap: 16px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.rt-stat-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 80px;
}

.rt-stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.rt-stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* --- Filter Bar --- */
.filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 16px;
}

.filter-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.filter-tabs {
    display: flex;
    gap: 4px;
}

.filter-btn {
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.filter-btn.active {
    background: rgba(6, 182, 212, 0.15);
    border-color: var(--accent);
    color: var(--accent);
}

/* --- Account Cards Grid --- */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.account-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.25s;
    position: relative;
}

.account-card:hover {
    transform: translateY(-3px);
    border-color: var(--border-hover);
    box-shadow: var(--shadow);
}

.account-card.status-healthy {
    border-color: rgba(34, 197, 94, 0.3);
}

.account-card.status-warning {
    border-color: rgba(234, 179, 8, 0.3);
}

.account-card.status-critical {
    border-color: rgba(239, 68, 68, 0.5);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.15);
}

.account-card.status-error {
    border-style: dashed;
    border-color: var(--error);
}

.account-card.status-pending {
    border-color: rgba(100, 116, 139, 0.3);
}

.account-card.status-collecting {
    border-color: rgba(6, 182, 212, 0.4);
}

.card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.card-name {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
}

.card-status-badge {
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-status-badge.healthy {
    background: rgba(34, 197, 94, 0.15);
    color: var(--healthy);
}

.card-status-badge.warning {
    background: rgba(234, 179, 8, 0.15);
    color: var(--warning);
}

.card-status-badge.critical {
    background: rgba(239, 68, 68, 0.15);
    color: var(--critical);
}

.card-status-badge.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
}

.card-status-badge.pending {
    background: rgba(100, 116, 139, 0.15);
    color: var(--pending);
}

.card-status-badge.collecting {
    background: rgba(6, 182, 212, 0.15);
    color: var(--collecting);
}

.card-body {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
}

/* --- Progress Ring (SVG) --- */
.progress-ring-container {
    width: 72px;
    height: 72px;
    flex-shrink: 0;
    position: relative;
}

.progress-ring-container svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.progress-ring-container .ring-bg {
    fill: none;
    stroke: var(--border);
    stroke-width: 4;
}

.progress-ring-container .ring-fg {
    fill: none;
    stroke-width: 4;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.6s ease;
}

.progress-ring-container .ring-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.card-stats {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.card-stat-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
}

.card-stat-row .stat-label {
    color: var(--text-muted);
}

.card-stat-row .stat-value {
    color: var(--text-secondary);
    font-weight: 500;
}

/* --- Sparkline --- */
.sparkline {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 32px;
    margin-top: 8px;
}

.sparkline .spark-bar {
    flex: 1;
    min-width: 0;
    border-radius: 2px 2px 0 0;
    transition: height 0.3s ease;
}

.sparkline .spark-bar.status-healthy {
    background: rgba(34, 197, 94, 0.5);
}

.sparkline .spark-bar.status-warning {
    background: rgba(234, 179, 8, 0.5);
}

.sparkline .spark-bar.status-critical {
    background: rgba(239, 68, 68, 0.5);
}

.sparkline .spark-bar.status-pending {
    background: rgba(100, 116, 139, 0.4);
}

.sparkline .spark-bar.status-collecting {
    background: rgba(6, 182, 212, 0.5);
}

/* --- Progress / Heatmap Section --- */
.progress-section {
    margin-top: 8px;
}

.progress-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
}

.progress-info {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.heatmap {
    display: flex;
    gap: 3px;
    align-items: flex-end;
    min-height: 12px;
    flex-wrap: wrap;
}

.heatmap-bar {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    position: relative;
    cursor: pointer;
    transition: transform 0.2s;
}

.heatmap-bar:hover {
    transform: scaleY(2);
    z-index: 2;
}

.heatmap-bar::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 8px;
    background: #1e293b;
    color: var(--text-primary);
    font-size: 0.7rem;
    border-radius: 4px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 10;
}

.heatmap-bar:hover::after {
    opacity: 1;
}

.heatmap-bar.status-healthy {
    background: var(--healthy);
}

.heatmap-bar.status-warning {
    background: var(--warning);
}

.heatmap-bar.status-critical {
    background: var(--critical);
}

.heatmap-bar.status-error {
    background: var(--error);
    opacity: 0.7;
}

.heatmap-bar.status-pending {
    background: var(--pending);
    opacity: 0.5;
}

.heatmap-bar.status-collecting {
    background: var(--collecting);
    animation: pulse-glow 1.5s infinite;
}

@keyframes pulse-glow {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* --- Detail View --- */
.detail-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.back-link {
    color: var(--text-muted);
    font-size: 0.9rem;
    transition: color 0.2s;
}

.back-link:hover {
    color: var(--accent);
}

.detail-name {
    font-size: 1.3rem;
    font-weight: 700;
}

.detail-level {
    padding: 3px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.detail-stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.detail-stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}

.detail-stat-card .stat-title {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.detail-stat-card .stat-num {
    font-size: 1.5rem;
    font-weight: 700;
}

.detail-stat-card .stat-sub {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.detail-account-level {
    font-size: 0.8rem;
    padding: 3px 10px;
    background: rgba(59, 130, 246, 0.15);
    color: var(--primary);
    border-radius: 4px;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

/* --- Quota Section --- */
.detail-quota {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
}

.detail-quota h3 {
    font-size: 0.95rem;
    margin-bottom: 16px;
    color: var(--text-secondary);
}

.quota-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.quota-card {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}

.quota-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.quota-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.quota-pct {
    font-size: 1.1rem;
    font-weight: 700;
}

.quota-pct.healthy { color: var(--healthy); }
.quota-pct.mid { color: var(--accent); }
.quota-pct.warning { color: var(--warning); }
.quota-pct.critical { color: var(--critical); }

.quota-bar {
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.quota-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.4s ease;
}

.quota-bar-fill.healthy { background: var(--healthy); }
.quota-bar-fill.mid { background: var(--accent); }
.quota-bar-fill.warning { background: var(--warning); }
.quota-bar-fill.critical { background: var(--critical); }

.quota-detail {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.quota-hint {
    margin-left: 6px;
    font-weight: 500;
}

.quota-hint.healthy { color: var(--healthy); }
.quota-hint.mid { color: var(--accent); }
.quota-hint.warning { color: var(--warning); }
.quota-hint.critical { color: var(--critical); }

.tools-summary td {
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
}

.detail-chart {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
}

.detail-chart h3 {
    font-size: 0.95rem;
    margin-bottom: 16px;
    color: var(--text-secondary);
}

.detail-chart canvas {
    width: 100%;
    height: 200px;
}

.detail-tools {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.detail-tools h3 {
    font-size: 0.95rem;
    margin-bottom: 16px;
    color: var(--text-secondary);
}

/* --- Tables --- */
.tools-table,
.accounts-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.tools-table th,
.accounts-table th {
    text-align: left;
    padding: 10px 12px;
    color: var(--text-muted);
    font-weight: 500;
    border-bottom: 1px solid var(--border);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tools-table td,
.accounts-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(30, 41, 59, 0.5);
    color: var(--text-secondary);
}

.tools-table tr:hover,
.accounts-table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* --- Accounts View --- */
.accounts-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.accounts-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
}

.token-masked {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* --- Status Badges --- */
.status-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.healthy {
    background: rgba(34, 197, 94, 0.15);
    color: var(--healthy);
}

.status-badge.warning {
    background: rgba(234, 179, 8, 0.15);
    color: var(--warning);
}

.status-badge.critical {
    background: rgba(239, 68, 68, 0.15);
    color: var(--critical);
}

.status-badge.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
}

.status-badge.pending {
    background: rgba(100, 116, 139, 0.15);
    color: var(--pending);
}

.status-badge.collecting {
    background: rgba(6, 182, 212, 0.15);
    color: var(--collecting);
}

/* --- Buttons --- */
.btn-primary {
    padding: 8px 20px;
    border-radius: var(--radius);
    border: none;
    background: var(--primary);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-primary:active {
    transform: scale(0.97);
}

.btn-cancel {
    padding: 8px 20px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-cancel:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.btn-sm {
    padding: 4px 12px;
    font-size: 0.75rem;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-sm:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.btn-sm.btn-danger {
    color: var(--critical);
    border-color: rgba(239, 68, 68, 0.3);
}

.btn-sm.btn-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--critical);
}

.btn-sm.btn-edit {
    color: var(--accent);
    border-color: rgba(6, 182, 212, 0.3);
}

.btn-sm.btn-edit:hover {
    background: rgba(6, 182, 212, 0.1);
    border-color: var(--accent);
}

/* --- Sync Button (Dashboard Card) --- */
.btn-sync {
    background: rgba(6, 182, 212, 0.1);
    border: 1px solid rgba(6, 182, 212, 0.3);
    color: var(--accent);
    border-radius: 4px;
    padding: 3px 10px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1;
    white-space: nowrap;
}

.btn-sync:hover {
    border-color: var(--accent);
    color: var(--accent-hover);
    background: rgba(6, 182, 212, 0.2);
}

.btn-sync:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    color: var(--text-muted);
    background: transparent;
}

/* --- Detail Page Sync --- */
.detail-sync-btn {
    padding: 6px 16px;
    font-size: 0.85rem;
    background: var(--accent);
    color: var(--bg-primary);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    white-space: nowrap;
}

.detail-sync-btn:hover {
    background: var(--accent-hover);
}

.detail-sync-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* --- Modal --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.modal {
    background: var(--bg-modal);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 560px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 1.05rem;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: var(--radius);
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 1.3rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

/* --- Form --- */
form {
    padding: 24px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--accent);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.form-group select {
    cursor: pointer;
}

.form-group select option {
    background: var(--bg-card);
    color: var(--text-primary);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

/* --- Usage Bar (in tools table) --- */
.usage-bar-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.usage-bar {
    flex: 1;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.usage-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.4s ease;
}

.usage-bar-fill.low {
    background: var(--healthy);
}

.usage-bar-fill.mid {
    background: var(--warning);
}

.usage-bar-fill.high {
    background: var(--critical);
}

.usage-pct {
    font-size: 0.75rem;
    color: var(--text-muted);
    min-width: 36px;
    text-align: right;
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.empty-state .empty-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
    opacity: 0.4;
}

.empty-state p {
    font-size: 0.9rem;
}

/* --- Loading Skeleton --- */
.skeleton {
    background: linear-gradient(90deg, var(--border) 25%, rgba(30, 41, 59, 0.5) 50%, var(--border) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* --- Hamburger Menu (mobile) --- */
.nav-toggle-cb {
    display: none;
}

.nav-hamburger {
    display: none;
    width: 36px;
    height: 36px;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    z-index: 110;
    border-radius: var(--radius);
    transition: background 0.2s;
}

.nav-hamburger:hover {
    background: rgba(255, 255, 255, 0.05);
}

.nav-hamburger span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .nav {
        padding: 0 12px;
    }

    /* --- Mobile Hamburger Navigation --- */
    .nav-hamburger {
        display: flex;
    }

    .nav-left {
        gap: 12px;
        flex: 1;
    }

    .nav-tabs {
        display: none;
        position: fixed;
        top: 56px;
        left: 0;
        right: 0;
        bottom: 0;
        background: var(--bg-nav);
        border-top: 1px solid var(--border);
        flex-direction: column;
        padding: 8px 0;
        gap: 0;
        z-index: 105;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .nav-toggle-cb:checked ~ .nav-tabs {
        display: flex;
    }

    .nav-tab {
        padding: 14px 24px;
        border-radius: 0;
        font-size: 1rem;
    }

    .nav-tab.active {
        background: rgba(6, 182, 212, 0.1);
    }

    /* Hamburger → X animation */
    .nav-toggle-cb:checked ~ .nav-hamburger span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }
    .nav-toggle-cb:checked ~ .nav-hamburger span:nth-child(2) {
        opacity: 0;
    }
    .nav-toggle-cb:checked ~ .nav-hamburger span:nth-child(3) {
        transform: rotate(-45deg) translate(5px, -5px);
    }

    .nav-right {
        gap: 8px;
    }

    .nav-settings-btn {
        width: 36px;
        height: 36px;
        font-size: 1.2rem;
    }

    .view {
        padding: 16px;
    }

    .summary-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 10px;
    }

    .summary-card .summary-value {
        font-size: 1.5rem;
    }

    .cards-grid {
        grid-template-columns: 1fr;
    }

    .filter-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .detail-header {
        flex-wrap: wrap;
    }

    .detail-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    /* --- Full-screen modals on mobile --- */
    .modal-overlay {
        align-items: stretch;
        justify-content: stretch;
        padding: 0;
    }

    .modal {
        margin: 0;
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .modal-header {
        padding: 16px;
        position: sticky;
        top: 0;
        background: var(--bg-modal);
        z-index: 5;
    }

    .modal-close {
        width: 44px;
        height: 44px;
    }

    #custom-modal .modal,
    #pwd-modal .modal {
        max-width: 100% !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
    }

    .accounts-table {
        font-size: 0.75rem;
    }

    .accounts-table th,
    .accounts-table td {
        padding: 8px 6px;
    }

    /* --- Table scroll wrapper --- */
    .table-scroll-wrapper {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: var(--radius);
        border: 1px solid var(--border);
    }

    /* --- Form touch optimization --- */
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 12px 14px;
        font-size: 16px; /* prevent iOS auto-zoom on focus */
    }

    .form-group label {
        margin-bottom: 8px;
    }

    .btn-primary,
    .btn-cancel {
        padding: 12px 20px;
        min-height: 44px;
    }

    .form-actions {
        flex-direction: column;
        gap: 8px;
    }

    .form-actions .btn-primary,
    .form-actions .btn-cancel {
        width: 100%;
        text-align: center;
    }

    .btn-sm {
        padding: 8px 14px;
        min-height: 36px;
    }

    .filter-tabs {
        flex-wrap: wrap;
    }

    /* --- General mobile spacing --- */
    .view {
        padding: 12px;
    }

    .summary-card {
        padding: 14px;
    }

    .summary-card .summary-value {
        font-size: 1.3rem;
    }

    .detail-header {
        gap: 8px;
    }

    .detail-name {
        font-size: 1.1rem;
    }

    /* Toast full-width on mobile */
    .toast-container {
        right: 8px;
        left: 8px;
        top: 64px;
    }

    .toast {
        min-width: auto;
        width: 100%;
    }

    /* Chart toolbar stack vertically */
    .chart-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }

    /* Security tabs scrollable */
    .security-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }

    .security-tab {
        flex-shrink: 0;
    }

    /* Provider items wrap on mobile */
    .provider-item {
        flex-wrap: wrap;
        padding: 10px;
    }

    .provider-item-actions {
        width: 100%;
        justify-content: flex-end;
        margin-top: 8px;
    }

    /* RT header wrap */
    .rt-header {
        flex-wrap: wrap;
        gap: 8px;
    }

    .rt-stats-header {
        flex-wrap: wrap;
        gap: 8px;
    }

    .rt-section {
        padding: 12px;
    }

    /* Model routes mobile stacked layout */
    .mr-mobile-layout {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    #mr-detail table {
        min-width: 500px;
    }
}

@media (max-width: 480px) {
    .summary-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .detail-stats {
        grid-template-columns: 1fr;
    }

    .quota-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .rt-stats-summary {
        flex-direction: column;
        gap: 4px;
    }

    .rt-stat-item {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        min-width: auto;
    }
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}

/* --- Utility --- */
.text-healthy { color: var(--healthy); }
.text-warning { color: var(--warning); }
.text-critical { color: var(--critical); }
.text-pending { color: var(--pending); }
.text-collecting { color: var(--collecting); }
.text-muted { color: var(--text-muted); }

/* --- Settings Button --- */
.nav-settings-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 1.1rem;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.nav-settings-btn:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

/* --- Chart Toolbar --- */
.chart-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.chart-toolbar h3 {
    margin-bottom: 0;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.chart-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.chart-tabs,
.chart-range-tabs {
    display: inline-flex;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}

.chart-tab,
.range-btn {
    padding: 6px 14px;
    border: none;
    border-right: 1px solid var(--border);
    background: var(--bg-primary);
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s;
    outline: none;
}

.chart-tab:last-child,
.range-btn:last-child {
    border-right: none;
}

.chart-tab:hover,
.range-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
}

.chart-tab.active,
.range-btn.active {
    background: rgba(6, 182, 212, 0.15);
    color: var(--accent);
    font-weight: 600;
}

/* --- Chart Tooltip --- */
.chart-container {
    position: relative;
}

.chart-tooltip {
    display: none;
    position: absolute;
    background: rgba(15, 20, 35, 0.95);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 14px;
    pointer-events: none;
    z-index: 10;
    font-size: 0.8rem;
    min-width: 160px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.tooltip-time {
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 0.75rem;
}

.tooltip-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    color: var(--text-secondary);
    padding: 2px 0;
}

.tooltip-row span:last-child {
    color: var(--text-primary);
    font-weight: 500;
}

/* --- Toggle Switch --- */
.toggle-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--border);
    border-radius: 11px;
    transition: background 0.2s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    left: 3px;
    bottom: 3px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: all 0.2s;
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--accent);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(18px);
    background: white;
}

.toggle-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* --- Settings Divider --- */
.settings-divider {
    height: 1px;
    background: var(--border);
    margin: 0 24px;
}

/* --- Proxy Section --- */
.proxy-section {
    padding: 20px 24px;
}

.proxy-section-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.proxy-info-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 0.85rem;
}

.proxy-info-row label {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.proxy-info-row span {
    color: var(--text-secondary);
    font-weight: 500;
}

.proxy-url-box {
    display: flex;
    align-items: center;
    gap: 8px;
}

.proxy-url-box code {
    background: var(--bg-primary);
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.8rem;
    color: var(--accent);
    border: 1px solid var(--border);
}

.btn-copy {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    width: 30px;
    height: 30px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-copy:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.proxy-keys-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 16px 0 10px 0;
}

.proxy-keys-header label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.proxy-keys-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
}

.proxy-key-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    gap: 10px;
}

.proxy-key-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    flex: 1;
}

.proxy-key-name {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-primary);
}

.proxy-key-value {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: 'SF Mono', 'Fira Code', monospace;
}

/* --- Toast Notification --- */
.toast-container {
    position: fixed;
    top: 72px;
    right: 24px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 20px;
    font-size: 0.85rem;
    color: var(--text-primary);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    transition: all 0.3s ease;
    min-width: 200px;
}

.toast-success {
    border-left: 3px solid var(--healthy);
}

.toast-error {
    border-left: 3px solid var(--critical);
}

.toast-info {
    border-left: 3px solid var(--accent);
}

/* --- Custom Modal (reuse overlay) --- */
#custom-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 250;
}

#custom-modal .modal {
    max-height: 85vh;
    overflow-y: auto;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.form-actions .btn-cancel {
    padding: 8px 20px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
}

.form-actions .btn-cancel:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.form-actions .btn-primary {
    padding: 8px 20px;
    border-radius: var(--radius);
    border: none;
    background: var(--primary);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.form-actions .btn-primary:hover {
    background: var(--primary-hover);
}

/* --- Keys Management View --- */
.keys-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.keys-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
}

.keys-config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.keys-config-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.keys-config-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 10px;
    font-weight: 500;
}

.keys-config-card .proxy-url-box {
    margin-bottom: 0;
}

.keys-config-card span {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
}

.keys-list-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.keys-list-header {
    margin-bottom: 16px;
}

.keys-list-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.keys-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.key-card {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    transition: border-color 0.2s;
}

.key-card:hover {
    border-color: var(--border-hover);
}

.key-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.key-card-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.key-card-actions {
    display: flex;
    gap: 8px;
}

.key-card-actions .btn-copy-key {
    color: var(--accent);
    border-color: rgba(6, 182, 212, 0.3);
}

.key-card-actions .btn-copy-key:hover {
    background: rgba(6, 182, 212, 0.1);
    border-color: var(--accent);
}

.key-card-value {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.8rem;
    color: var(--text-muted);
    word-break: break-all;
}

/* --- Compatibility Dialog --- */
.compat-section {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
}

.compat-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 4px;
}

.compat-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.compat-field {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.compat-field:last-child {
    margin-bottom: 0;
}

.compat-field label {
    font-size: 0.75rem;
    color: var(--text-muted);
    min-width: 80px;
    flex-shrink: 0;
}

.compat-field code {
    flex: 1;
    background: var(--bg-card);
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--accent);
    border: 1px solid var(--border);
    word-break: break-all;
    font-family: 'SF Mono', 'Fira Code', monospace;
}

.btn-copy-small {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.7rem;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 4px;
    white-space: nowrap;
    transition: all 0.2s;
}

.btn-copy-small:hover {
    border-color: var(--accent);
    color: var(--accent);
}

@media (max-width: 768px) {
    .keys-config-grid {
        grid-template-columns: 1fr;
    }

    .key-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .compat-field {
        flex-wrap: wrap;
    }

    .compat-field label {
        min-width: auto;
    }

    .compat-field code {
        flex: 1 1 100%;
    }
}

/* --- Request Logs Table --- */
.logs-section {
    background: var(--bg-card);
    border-radius: 8px;
    border: 1px solid var(--border);
    overflow-x: auto;
}

.logs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.logs-table thead th {
    padding: 10px 12px;
    text-align: left;
    color: var(--text-secondary);
    font-weight: 500;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.logs-table tbody td {
    padding: 8px 12px;
    border-bottom: 1px solid rgba(30, 41, 59, 0.3);
    color: var(--text-primary);
    white-space: nowrap;
}

.logs-table tbody tr:hover {
    background: rgba(30, 41, 59, 0.3);
}

.logs-empty {
    text-align: center;
    color: var(--text-secondary);
    padding: 24px !important;
}

/* --- Logs Pagination --- */
.logs-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 0;
}

.logs-pagination button {
    padding: 4px 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s;
}

.logs-pagination button:hover:not(:disabled) {
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.logs-pagination button.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.logs-pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.log-time { color: var(--text-secondary); }
.log-account { font-weight: 500; }
.log-model { color: var(--text-secondary); font-family: monospace; font-size: 12px; }
.log-type { text-align: center; }
.log-tokens { font-family: monospace; font-size: 12px; }
.log-duration { font-family: monospace; font-size: 12px; min-width: 120px; }
.log-chain-bar { display: flex; height: 4px; border-radius: 2px; overflow: hidden; margin-top: 3px; gap: 1px; }
.log-chain-seg { height: 100%; border-radius: 1px; min-width: 2px; }
.log-chain-info { display: flex; align-items: center; gap: 2px; margin-top: 2px; font-size: 10px; color: var(--text-muted); white-space: nowrap; }
.log-chain-label { font-family: monospace; }
.log-chain-arrow { color: var(--border); font-size: 9px; }
.log-status-ok { color: #22c55e; font-weight: 500; }
.log-status-error { color: #ef4444; font-weight: 500; }
.prompt-row { cursor: pointer; }
.prompt-row:hover { background: rgba(139,92,246,0.06); }
.prompt-detail table tbody tr { background: rgba(0,0,0,0.15); }
.prompt-detail td { padding: 0 12px !important; }

/* --- Stats Grid --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
}

.stat-card-key {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.stat-card-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 3px 0;
    font-size: 13px;
}

.stat-card-row .stat-label {
    color: var(--text-secondary);
}

.stat-card-row .stat-value {
    color: var(--text-primary);
    font-family: monospace;
    font-size: 12px;
}

.stat-error-high {
    color: #ef4444 !important;
}

/* Stats tab buttons */
.stats-tab {
    padding: 4px 12px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.15s;
}

.stats-tab.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.stats-tab:hover:not(.active) {
    border-color: var(--border-hover);
    color: var(--text-primary);
}

/* --- Provider Management --- */
.provider-section {
    padding: 20px 24px;
}

.provider-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.provider-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.provider-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    gap: 12px;
}

.provider-item-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    flex: 1;
}

.provider-item-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.provider-item-detail {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.provider-item-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* --- Log Detail Modal --- */
.log-detail-modal {
    max-width: 860px;
    max-height: 90vh;
}

.log-detail-body {
    padding: 20px 24px;
    overflow-y: auto;
    max-height: calc(90vh - 60px);
}

/* Loading state */
.log-detail-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 48px 24px;
    color: var(--text-muted);
}

.log-detail-loading .spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Status banner */
.log-detail-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.log-detail-banner.ok {
    background: rgba(34, 197, 94, 0.08);
    border: 1px solid rgba(34, 197, 94, 0.2);
    color: var(--healthy);
}

.log-detail-banner.error {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--critical);
}

.log-detail-banner-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.log-detail-banner-text {
    flex: 1;
    min-width: 0;
}

.log-detail-banner-meta {
    font-size: 0.78rem;
    opacity: 0.75;
    margin-top: 2px;
}

/* Metadata grid */
.log-detail-meta {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
    margin-bottom: 20px;
}

.log-meta-item {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px 12px;
}

.log-meta-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 4px;
}

.log-meta-value {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    word-break: break-all;
}

.log-meta-value.mono {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.82rem;
}

.log-meta-value.accent {
    color: var(--accent);
}

/* Body sections */
.log-detail-section {
    margin-bottom: 16px;
}

.log-detail-section:last-child {
    margin-bottom: 0;
}

.log-detail-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.log-detail-section-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.log-detail-section-title .section-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.log-detail-section-title .section-dot.req {
    background: var(--primary);
}

.log-detail-section-title .section-dot.res {
    background: var(--healthy);
}

/* JSON code block */
.log-detail-code-wrap {
    position: relative;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.log-detail-code {
    padding: 14px 16px;
    overflow-x: auto;
    overflow-y: auto;
    max-height: 400px;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.78rem;
    line-height: 1.6;
    color: var(--text-primary);
    white-space: pre;
    margin: 0;
}

.log-detail-empty {
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.82rem;
    background: var(--bg-primary);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
}

/* Copy button in code block */
.log-detail-copy {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 4px 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-muted);
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.15s;
    z-index: 2;
}

.log-detail-copy:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.log-detail-copy.copied {
    color: var(--healthy);
    border-color: var(--healthy);
}

/* JSON syntax highlighting */
.json-key { color: #7dd3fc; }
.json-string { color: #86efac; }
.json-number { color: #fde68a; }
.json-bool { color: #c4b5fd; }
.json-null { color: var(--text-muted); }

/* Error message in detail */
.log-detail-error-msg {
    background: rgba(239, 68, 68, 0.06);
    border: 1px solid rgba(239, 68, 68, 0.15);
    border-radius: 6px;
    padding: 10px 14px;
    color: var(--critical);
    font-size: 0.82rem;
    font-family: 'SF Mono', 'Fira Code', monospace;
    word-break: break-all;
    margin-bottom: 16px;
}

/* Responsive for log detail */
@media (max-width: 768px) {
    .log-detail-modal {
        margin: 8px;
        max-height: 95vh;
    }

    .log-detail-body {
        padding: 16px;
    }

    .log-detail-meta {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .log-detail-meta {
        grid-template-columns: 1fr 1fr;
    }
}

/* ============================================
   Security Audit Page
   ============================================ */

.security-score-banner {
    position: relative;
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 24px 32px;
    border-radius: var(--radius-lg, 12px);
    margin-bottom: 24px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
}

.security-score-banner.score-pass { border-left: 4px solid var(--success, #10b981); }
.security-score-banner.score-warn { border-left: 4px solid var(--warning, #f59e0b); }
.security-score-banner.score-fail { border-left: 4px solid var(--danger, #ef4444); }

.security-score-number {
    font-size: 2.8rem;
    font-weight: 700;
    line-height: 1;
    color: var(--text-primary);
}

.security-score-pct {
    font-size: 1.2rem;
    color: var(--text-secondary);
}

.security-score-label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.security-score-detail {
    display: flex;
    gap: 16px;
    font-size: 0.85rem;
}

.sec-stat {
    padding: 2px 10px;
    border-radius: 12px;
    font-weight: 500;
}

.sec-pass { background: rgba(16,185,129,0.15); color: var(--success, #10b981); }
.sec-warn { background: rgba(245,158,11,0.15); color: var(--warning, #f59e0b); }
.sec-fail { background: rgba(239,68,68,0.15); color: var(--danger, #ef4444); }

.security-checks-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.security-category {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg, 12px);
    overflow: hidden;
}

.security-category-title {
    font-size: 0.95rem;
    font-weight: 600;
    padding: 14px 20px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}

.security-checks-list {
    display: flex;
    flex-direction: column;
}

.security-check-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
}

.security-check-item:last-child {
    border-bottom: none;
}

.security-check-status {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    margin-top: 2px;
}

.security-check-status.check-pass {
    background: rgba(16,185,129,0.15);
    color: var(--success, #10b981);
}

.security-check-status.check-warn {
    background: rgba(245,158,11,0.15);
    color: var(--warning, #f59e0b);
}

.security-check-status.check-fail {
    background: rgba(239,68,68,0.15);
    color: var(--danger, #ef4444);
}

.security-check-info {
    flex: 1;
    min-width: 0;
}

.security-check-title {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.security-check-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.severity-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    vertical-align: middle;
}

.severity-high { background: rgba(239,68,68,0.15); color: var(--danger, #ef4444); }
.severity-medium { background: rgba(245,158,11,0.15); color: var(--warning, #f59e0b); }
.severity-low { background: rgba(16,185,129,0.15); color: var(--success, #10b981); }

/* --- Security Page Tabs & Settings --- */
.security-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.security-tab {
    padding: 10px 20px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-secondary);
    border: none;
    border-bottom: 2px solid transparent;
    background: none;
    transition: color 0.2s, border-color 0.2s;
    font-family: inherit;
}

.security-tab:hover {
    color: var(--text-primary);
}

.security-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.security-settings-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg, 12px);
    padding: 24px;
}

.security-settings-card h4 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 16px 0;
    color: var(--text-primary);
}

.security-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-hint {
    font-size: 0.72rem;
    color: var(--text-muted, #6b7280);
    margin-top: 4px;
}

.security-form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}


/* ===== Dashboard Enterprise Redesign ===== */

/* Status Bar */
.status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
}
.status-bar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.status-indicator {
    font-size: 10px;
    color: var(--healthy);
}
.status-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
}
.status-divider {
    width: 1px;
    height: 14px;
    background: var(--border);
}
.status-item {
    font-size: 0.78rem;
    color: var(--text-muted);
}
.status-bar-right {
    display: flex;
    gap: 6px;
}
.alert-badge {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 500;
}
.alert-badge.critical {
    background: rgba(239,68,68,0.15);
    color: #ef4444;
}
.alert-badge.warning {
    background: rgba(234,179,8,0.15);
    color: #eab308;
}

/* KPI Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}
.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    position: relative;
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.kpi-card:hover {
    border-color: #334155;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}
.kpi-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 120px;
    height: 120px;
    background: radial-gradient(circle at top right, rgba(6,182,212,0.04), transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}
.kpi-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-weight: 500;
}
.kpi-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}
.kpi-change {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    font-size: 0.75rem;
}
.kpi-change .badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.72rem;
}
.kpi-change .up, .kpi-change .badge.up {
    background: rgba(34, 197, 94, 0.12);
    color: var(--healthy);
}
.kpi-change .down, .kpi-change .badge.down {
    background: rgba(239, 68, 68, 0.12);
    color: var(--error);
}
.kpi-change .meta {
    color: var(--text-muted);
}
.kpi-sparkline {
    margin-top: 14px;
    height: 32px;
    display: flex;
    align-items: flex-end;
    gap: 2px;
}
.kpi-sparkline .bar {
    flex: 1;
    border-radius: 2px 2px 0 0;
    transition: height 0.3s;
    min-height: 2px;
}
.kpi-sparkline .bar.active {
    background: var(--accent);
}

/* Latency Breakdown - Per-Provider */
.kpi-latency-breakdown {
    margin-top: 10px;
}
.latency-provider-row {
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border, #eee);
}
.latency-provider-row:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}
.latency-provider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}
.latency-provider-name {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-primary);
    font-family: monospace;
}
.latency-provider-stats {
    font-size: 9px;
    color: var(--text-muted);
}
.latency-provider-empty {
    text-align: center;
    color: var(--text-muted);
    font-size: 11px;
    padding: 10px 0;
}
.kpi-latency-breakdown .latency-bar {
    display: flex;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    gap: 2px;
}
.kpi-latency-breakdown .latency-seg {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s;
    min-width: 4px;
}
.kpi-latency-breakdown .latency-labels {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
    font-size: 9px;
    color: var(--text-muted);
}
.kpi-latency-breakdown .latency-dot {
    width: 6px;
    height: 6px;
    border-radius: 2px;
    display: inline-block;
    vertical-align: middle;
    margin-right: 3px;
}
.kpi-account-blocks {
    margin-top: 14px;
    display: flex;
    gap: 3px;
}
.kpi-account-blocks .block {
    flex: 1;
    height: 8px;
    border-radius: 4px;
    transition: background 0.3s;
}

/* Dashboard 3-column Row */
.dashboard-row-3col {
    display: grid;
    grid-template-columns: 3fr 1.2fr 1.2fr;
    gap: 14px;
    margin-bottom: 20px;
}
.dcol {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    min-width: 0;
}
.dcol-wide {
    grid-column: span 1;
}
.dcol-narrow {
    grid-column: span 1;
}
.dcol-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}
.dcol-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Chart Legend */
.chart-legend {
    display: flex;
    gap: 16px;
    margin-top: 8px;
}
.legend-item {
    font-size: 0.72rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
}
.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

/* Model Heat List */
.model-heat-list {
    overflow-y: auto;
    max-height: 320px;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
.model-heat-item {
    margin-bottom: 8px;
}
.model-heat-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    margin-bottom: 3px;
}
.model-heat-name {
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.model-heat-count {
    color: var(--text-muted);
    flex-shrink: 0;
}
.model-heat-bar {
    height: 5px;
    background: rgba(10,14,23,0.6);
    border-radius: 3px;
    overflow: hidden;
}
.model-heat-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s;
}
.model-heat-empty {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    padding: 16px 0;
}

/* Alerts List */
.alerts-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 320px;
    overflow-y: auto;
}
.alert-count {
    font-size: 0.7rem;
    background: var(--error);
    color: #fff;
    padding: 1px 6px;
    border-radius: 8px;
    font-weight: 600;
}
.alert-item {
    padding: 10px 12px;
    border-radius: var(--radius);
    border-left: 3px solid;
    background: rgba(10,14,23,0.4);
}
.alert-item.critical {
    border-left-color: var(--error);
}
.alert-item.warning {
    border-left-color: var(--warning);
}
.alert-item.info {
    border-left-color: #3b82f6;
}
.alert-title {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}
.alert-detail {
    font-size: 0.7rem;
    color: var(--text-muted);
}
.alert-time {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 4px;
    opacity: 0.7;
}
.alerts-empty {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    padding: 24px 0;
}

/* Account Health List */
.account-health-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 300px;
    overflow-y: auto;
}
.acc-health-item {
    padding: 10px 12px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    transition: border-color 0.2s;
}
.acc-health-item.error {
    border-color: var(--error);
}
.acc-health-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}
.acc-health-name {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-primary);
}
.acc-health-status {
    font-size: 0.65rem;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 500;
}
.acc-health-status.healthy {
    background: rgba(34,197,94,0.15);
    color: #22c55e;
}
.acc-health-status.warning {
    background: rgba(234,179,8,0.15);
    color: #eab308;
}
.acc-health-status.error {
    background: rgba(239,68,68,0.15);
    color: #ef4444;
}
.acc-health-stats {
    display: flex;
    gap: 12px;
    font-size: 0.7rem;
    color: var(--text-muted);
}
.acc-health-bar-wrap {
    margin-top: 6px;
    height: 4px;
    background: rgba(10,14,23,0.6);
    border-radius: 2px;
    overflow: hidden;
}
.acc-health-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s;
}

/* Error Trend Chart */
.error-trend-chart {
    height: 180px;
    display: flex;
    align-items: flex-end;
    gap: 3px;
    padding-top: 16px;
}
.error-trend-bar {
    flex: 1;
    border-radius: 2px 2px 0 0;
    position: relative;
    min-height: 1px;
    transition: height 0.4s ease;
}
.error-trend-bar.green {
    background: linear-gradient(180deg, #22c55e, #16a34a);
}
.error-trend-bar.yellow {
    background: linear-gradient(180deg, #eab308, #ca8a04);
}
.error-trend-bar.red {
    background: linear-gradient(180deg, #ef4444, #dc2626);
}
.error-trend-axis {
    display: flex;
    justify-content: space-between;
    padding: 0 2px;
    margin-top: 6px;
    font-size: 9px;
    color: var(--text-muted);
}
.error-trend-legend {
    display: flex;
    gap: 12px;
    margin-top: 8px;
    font-size: 10px;
    color: var(--text-secondary);
}
.error-trend-legend .dot {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    display: inline-block;
    vertical-align: middle;
    margin-right: 3px;
}

/* Type Distribution (Conic Gradient Donut) */
.type-dist-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 0;
}
.type-donut {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    position: relative;
    margin-bottom: 12px;
}
.type-donut-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}
.type-donut-total {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
}
.type-donut-label {
    font-size: 0.6rem;
    color: var(--text-muted);
    text-transform: uppercase;
}
.type-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    width: 100%;
}
.type-legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    color: var(--text-muted);
}
.type-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 2px;
}

/* Bottom Row: Logs + Quick Actions */
.dashboard-row-bottom {
    display: grid;
    grid-template-columns: 3fr 1fr;
    gap: 14px;
    margin-bottom: 20px;
}
.logs-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    overflow-x: auto;
}
.quick-actions-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
}
.quick-actions-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.quick-action-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: rgba(10,14,23,0.4);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
    width: 100%;
    text-align: left;
}
.quick-action-btn:hover {
    background: rgba(59,130,246,0.1);
    border-color: #3b82f6;
    color: var(--text-primary);
}
.qa-icon {
    font-size: 1rem;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

/* Responsive Adjustments */
@media (max-width: 1024px) {
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .dashboard-row-3col {
        grid-template-columns: 1fr 1fr;
    }
    .dashboard-row-3col .dcol:first-child {
        grid-column: 1 / -1;
    }
    .dashboard-row-bottom {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 640px) {
    .kpi-grid {
        grid-template-columns: 1fr;
    }
    .dashboard-row-3col {
        grid-template-columns: 1fr;
    }
    .status-bar-left {
        gap: 6px;
    }
    .status-divider {
        display: none;
    }
}


/* Type Tags for Logs Table */
.type-tag {
    font-size: 0.65rem;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 500;
    white-space: nowrap;
}
.type-tag.stream {
    background: rgba(59,130,246,0.15);
    color: #3b82f6;
}
.type-tag.sync {
    background: rgba(6,182,212,0.15);
    color: #06b6d4;
}

/* Status Dots for Logs Table */
.status-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-right: 4px;
    vertical-align: middle;
}
.status-dot.ok {
    background: var(--healthy);
}
.status-dot.error {
    background: var(--error);
}
