.header-link {
    color: var(--text-primary);
    text-decoration: none;
}

.admin-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    background: linear-gradient(135deg, #60a5fa, #818cf8);
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 1px;
    vertical-align: middle;
    margin-left: 8px;
}

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

.admin-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 24px 32px;
}

/* Navigation tabs */
.admin-nav {
    display: flex;
    gap: 2px;
    margin-bottom: 28px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 4px;
}

.admin-tab {
    padding: 10px 20px;
    background: none;
    border: none;
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.tab-icon {
    font-size: 12px;
    opacity: 0.6;
}

.admin-tab.active .tab-icon {
    opacity: 1;
}

.admin-tab.active {
    color: var(--text-primary);
    background: var(--bg-tertiary);
    box-shadow: 0 1px 3px var(--shadow);
}

.admin-tab:hover:not(.active) {
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.03);
}

/* Panels */
.admin-panel {
    display: none;
    animation: fadeIn 0.3s ease;
}

.admin-panel.active {
    display: block;
}

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

/* Stats cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 20px 16px;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-green));
    opacity: 0;
    transition: opacity 0.2s;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px var(--shadow);
    border-color: rgba(96, 165, 250, 0.3);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    font-family: "SF Mono", "Fira Code", monospace;
    line-height: 1.2;
}

.stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-top: 6px;
    font-weight: 500;
}

/* Charts */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.chart-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 20px;
}

.chart-card h3 {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 16px;
}

.chart-wrap {
    height: 200px;
    position: relative;
}

/* Section card */
.section-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 20px;
    margin-bottom: 24px;
}

.section-card h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.section-header {
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 12px;
}
.section-header h2 + .section-desc { flex-basis: 100%; margin-top: -8px; }

/* Dashboard time range picker */
.dash-range-picker {
    margin-left: auto;
    display: flex;
    gap: 2px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    padding: 3px;
}
.range-btn {
    font-size: 12px;
    font-weight: 600;
    padding: 5px 14px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
}
.range-btn:hover { color: var(--text-primary); background: var(--bg-secondary); }
.range-btn.active { color: #fff; background: var(--accent-blue, #60a5fa); }

/* Alert strip */
.alert-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
    padding: 10px 14px;
    border-radius: 10px;
    background: rgba(239, 68, 68, 0.06);
    border: 1px solid rgba(239, 68, 68, 0.2);
}
.alert-strip.hidden { display: none; }
.alert-strip-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
}
.alert-strip-item.alert-danger { color: #ef4444; background: rgba(239, 68, 68, 0.1); }
.alert-strip-item.alert-danger:hover { background: rgba(239, 68, 68, 0.18); }
.alert-strip-item.alert-warn { color: #eab308; background: rgba(234, 179, 8, 0.1); }
.alert-strip-item.alert-warn:hover { background: rgba(234, 179, 8, 0.18); }
.alert-strip-item.alert-info { color: #60a5fa; background: rgba(96, 165, 250, 0.1); }
.alert-strip-calm { color: var(--text-muted); font-size: 12px; }

.section-header h2 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.phone-pool-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.phone-pool-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-add-phone {
    white-space: nowrap;
    width: auto;
    padding: 8px 20px;
}

.twilio-balance-badge {
    font-size: 12px;
    font-weight: 600;
    font-family: "SF Mono", "Fira Code", monospace;
    color: var(--accent-green);
    padding: 6px 14px;
    border: 1px solid rgba(74, 222, 128, 0.3);
    border-radius: 10px;
    background: rgba(74, 222, 128, 0.08);
    white-space: nowrap;
}

.twilio-balance-badge.low {
    color: var(--accent-red);
    border-color: rgba(248, 113, 113, 0.3);
    background: rgba(248, 113, 113, 0.08);
}

/* Logs */
.logs-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.logs-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 12px;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
    white-space: nowrap;
    user-select: none;
    cursor: pointer;
    white-space: nowrap;
}

.logs-toggle:hover { border-color: var(--accent-blue); color: var(--text-primary); }
.logs-toggle input {
    margin: 0;
    width: 15px;
    height: 15px;
    accent-color: var(--accent-blue);
    cursor: pointer;
}

.logs-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px 20px;
    max-height: 600px;
    overflow-y: auto;
    font-family: "SF Mono", "Fira Code", monospace;
    font-size: 12px;
    line-height: 1.7;
}

.logs-empty {
    color: var(--text-muted);
    text-align: center;
    padding: 48px 0;
    font-family: inherit;
    font-size: 14px;
}

.log-line {
    padding: 2px 0;
    white-space: pre-wrap;
    word-break: break-all;
    overflow-wrap: anywhere;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.log-line:last-child {
    border-bottom: none;
}

.log-error {
    color: var(--accent-red);
}

.log-warn {
    color: var(--accent-orange, #fb923c);
}

.log-info {
    color: var(--text-primary);
}

.log-debug {
    color: var(--text-muted);
}

/* Tables — wrapped in card-style containers */
.admin-table-wrap {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow-x: auto;
    margin-bottom: 24px;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.admin-table th {
    text-align: left;
    padding: 14px 16px;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--border);
}

.admin-table td {
    padding: 16px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    vertical-align: middle;
}

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

.admin-table tbody tr {
    transition: background 0.15s;
}

.admin-table tbody tr:hover {
    background: rgba(96, 165, 250, 0.04);
}

.mono {
    font-family: "SF Mono", "Fira Code", monospace;
    font-size: 12px;
}

/* Status badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.status-badge::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-badge.active {
    background: rgba(74, 222, 128, 0.12);
    color: var(--accent-green);
}

.status-badge.active::before {
    background: var(--accent-green);
    box-shadow: 0 0 6px rgba(74, 222, 128, 0.4);
}

.status-badge.ended {
    background: rgba(96, 165, 250, 0.12);
    color: var(--accent-blue);
}

.status-badge.ended::before {
    background: var(--accent-blue);
}

.status-badge.failed {
    background: rgba(248, 113, 113, 0.12);
    color: var(--accent-red);
}

.status-badge.failed::before {
    background: var(--accent-red);
}

.status-badge.pending {
    background: rgba(251, 146, 60, 0.12);
    color: var(--accent-orange, #fb923c);
}

.status-badge.pending::before {
    background: var(--accent-orange, #fb923c);
}

/* Action buttons — pill style */
.btn-sm {
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    margin-right: 6px;
    transition: all 0.15s;
    white-space: nowrap;
}

.btn-sm:hover {
    background: var(--border);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.btn-sm:active {
    transform: translateY(0);
}

.btn-edit {
    color: var(--accent-blue);
    border-color: rgba(96, 165, 250, 0.3);
    background: rgba(96, 165, 250, 0.08);
}

.btn-edit:hover {
    background: rgba(96, 165, 250, 0.15);
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

.btn-delete {
    color: var(--accent-red);
    border-color: rgba(248, 113, 113, 0.3);
    background: rgba(248, 113, 113, 0.06);
}

.btn-delete:hover {
    background: rgba(248, 113, 113, 0.15);
    border-color: var(--accent-red);
}

/* Admin select — filter dropdowns */
.admin-select {
    padding: 7px 12px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    transition: all 0.15s;
    outline: none;
}

.admin-select:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.1);
}

/* Admin buttons — used inline */
.admin-btn {
    padding: 7px 16px;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    transition: all 0.15s;
    white-space: nowrap;
}

.admin-btn:hover {
    background: var(--border);
    color: var(--text-primary);
}

.admin-btn-green {
    color: var(--accent-green);
    border-color: rgba(74, 222, 128, 0.3);
    background: rgba(74, 222, 128, 0.08);
}

.admin-btn-green:hover {
    background: rgba(74, 222, 128, 0.15);
    border-color: var(--accent-green);
}

/* Admin form */
.admin-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.form-row {
    display: flex;
    gap: 12px;
}

.form-row .form-group {
    flex: 1;
}

.form-row .btn-start,
.form-row .btn-hangup {
    flex: 1;
}

/* Pending badge */
.pending-count {
    font-size: 11px;
    font-weight: 700;
    background: linear-gradient(135deg, #fb923c, #f97316);
    color: #fff;
    padding: 2px 9px;
    border-radius: 12px;
    margin-left: 8px;
}

/* Approve button */
.btn-approve {
    color: var(--accent-green);
    border-color: rgba(74, 222, 128, 0.3);
    background: rgba(74, 222, 128, 0.08);
}

.btn-approve:hover {
    background: rgba(74, 222, 128, 0.15);
    border-color: var(--accent-green);
}

/* Actions cell */
.actions-cell {
    white-space: nowrap;
}

/* Telemetry cell */
.telemetry-cell {
    position: relative;
}

.telemetry-badge {
    display: inline-block;
    font-size: 11px;
    font-family: var(--font-mono, monospace);
    padding: 2px 8px;
    border-radius: 6px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s;
}

.telemetry-badge:hover,
.telemetry-badge:focus {
    background: var(--accent-blue);
    color: #fff;
    outline: none;
}

.telemetry-popup {
    position: absolute;
    z-index: 100;
    top: 100%;
    left: 0;
    margin-top: 4px;
    min-width: 280px;
    padding: 12px 14px;
    border-radius: 10px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    font-size: 12px;
    line-height: 1.6;
    white-space: normal;
}

.telemetry-popup .tp-row {
    display: flex;
    gap: 8px;
    padding: 2px 0;
}

.telemetry-popup .tp-label {
    color: var(--text-muted);
    min-width: 80px;
    flex-shrink: 0;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.telemetry-popup .tp-value {
    color: var(--text-primary);
    word-break: break-all;
    font-family: var(--font-mono, monospace);
}

.telemetry-popup .tp-ip-copy {
    cursor: pointer;
    border-radius: 4px;
    padding: 1px 4px;
    transition: background 0.15s;
}

.telemetry-popup .tp-ip-copy:hover {
    background: var(--bg-secondary);
}

.ip-flag {
    margin-right: 4px;
    font-size: 14px;
    font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
    line-height: 1;
}

/* User quick-inspection drawer */
.user-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 380px;
    max-width: 90vw;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border);
    box-shadow: -8px 0 32px rgba(0,0,0,0.3);
    z-index: 200;
    transform: translateX(100%);
    transition: transform 0.25s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.user-drawer.open { transform: translateX(0); }
.user-drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    backdrop-filter: blur(2px);
    z-index: 199;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.user-drawer-backdrop.open { opacity: 1; }
.user-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border);
}
.user-drawer-header h3 { margin: 0; font-size: 18px; }
.drawer-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 22px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}
.drawer-close:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.user-drawer-body {
    padding: 16px 24px;
    overflow-y: auto;
    flex: 1;
}
.drawer-section {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
.drawer-section:last-of-type { border-bottom: none; }
.drawer-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 10px;
}
.drawer-field {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
}
.drawer-label {
    font-size: 13px;
    color: var(--text-muted);
}
.drawer-value {
    font-size: 13px;
    color: var(--text-primary);
    text-align: right;
    max-width: 60%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.drawer-actions {
    padding: 16px 0;
    display: flex;
    gap: 8px;
}

/* Whitelist form */
#whitelistForm {
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    padding: 16px 20px;
}

#whitelistForm .form-group label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

#whitelistForm input {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}

#whitelistForm input:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.1);
}

#wlCurrentList {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 2;
}

#wlCurrentList span {
    background: var(--bg-tertiary) !important;
    border: 1px solid var(--border);
    border-radius: 8px !important;
    padding: 4px 10px !important;
    font-size: 12px;
    font-family: "SF Mono", "Fira Code", monospace;
}

/* Transcript panel (admin calls tab) */
.transcript-panel {
    margin-top: 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--bg-secondary);
    overflow: hidden;
}

.transcript-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.02);
}

.transcript-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.transcript-header h3 span {
    font-family: "SF Mono", "Fira Code", monospace;
    color: var(--accent-blue);
}

.transcript-content {
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
    font-size: 13px;
    line-height: 1.7;
}

.transcript-line {
    margin-bottom: 8px;
    padding: 6px 0;
}

.transcript-line .speaker {
    font-weight: 700;
    color: var(--accent-blue);
    margin-right: 8px;
}

.transcript-line .speaker.phone {
    color: var(--accent-green);
}

.transcript-empty {
    color: var(--text-muted);
    text-align: center;
    padding: 32px;
}

#callsTable tbody tr {
    cursor: pointer;
    transition: background 0.15s;
}

/* Call detail expandable rows */
.call-detail-row td { padding: 0 !important; }
.call-detail-content { padding: 12px 20px; background: var(--bg-tertiary); border-left: 3px solid var(--accent-blue, #60a5fa); margin: 4px 0; border-radius: 0 8px 8px 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.call-detail-section { line-height: 1.5; }
.call-detail-section strong { color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }

#callsTable tbody tr:hover {
    background: rgba(96, 165, 250, 0.04);
}

/* Settings */
.settings-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

.settings-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 20px;
}

.settings-section h3 {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.setting-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.setting-label {
    font-size: 14px;
    color: var(--text-primary);
    flex: 1;
}

.setting-input {
    width: 140px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 13px;
    font-family: "SF Mono", "Fira Code", monospace;
    transition: border-color 0.2s;
}

.setting-input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.1);
}

/* Toggle switch */
.toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 24px;
    transition: background 0.25s, border-color 0.25s;
}

.toggle-slider::before {
    content: "";
    position: absolute;
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), background 0.25s;
}

.toggle input:checked + .toggle-slider {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
}

.toggle input:checked + .toggle-slider::before {
    transform: translateX(20px);
    background: #fff;
}

.settings-actions {
    margin-top: 12px;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(6px);
    animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 28px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 24px 48px var(--shadow);
    animation: modalSlideIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.modal-content h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
    letter-spacing: -0.3px;
}

/* Hidden utility */
.hidden {
    display: none !important;
}

/* Responsive - Tablet */
@media (max-width: 768px) {
    .admin-main {
        padding: 16px;
    }
    .admin-nav {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .admin-nav::-webkit-scrollbar {
        display: none;
    }
    .charts-grid {
        grid-template-columns: 1fr;
    }
    .form-row {
        flex-direction: column;
    }
    .setting-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    .setting-input {
        width: 100%;
    }
    .actions-cell {
        flex-wrap: wrap;
    }
}

/* Responsive - Mobile (iPhone Pro ~393px) */
@media (max-width: 480px) {
    .admin-main {
        padding: 12px;
    }
    /* Nav tabs: smaller padding, allow scroll */
    .admin-nav {
        gap: 1px;
        padding: 3px;
        border-radius: 10px;
    }
    .admin-tab {
        padding: 8px 12px;
        font-size: 12px;
    }
    /* Stats grids: force 2 columns that fit within viewport */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        margin-bottom: 20px;
    }
    .stats-grid-kpi {
        grid-template-columns: repeat(2, 1fr);
    }
    .stats-grid-sm {
        grid-template-columns: repeat(2, 1fr);
    }
    .stat-card {
        padding: 14px 10px;
        border-radius: 10px;
    }
    .stat-value {
        font-size: 20px;
    }
    .stat-label {
        font-size: 10px;
    }
    /* Dashboard zones */
    .dash-zone {
        padding: 14px;
        margin-bottom: 14px;
        border-radius: 10px;
    }
    .zone-header {
        gap: 10px;
    }
    .zone-title {
        font-size: 15px;
    }
    .zone-desc {
        font-size: 12px;
    }
    .subzone-title {
        font-size: 11px;
    }
    .dash-subzone {
        padding: 12px;
    }
    /* Section header */
    .section-header h2 {
        font-size: 18px;
    }
    .section-desc {
        font-size: 12px;
    }
    /* Range picker */
    .dash-range-picker {
        margin-left: 0;
        flex-basis: 100%;
    }
    .range-btn {
        padding: 5px 10px;
        font-size: 11px;
    }
    /* Tables: allow horizontal scroll */
    .table-wrapper,
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    /* Admin header */
    header {
        padding: 10px 12px;
    }
    header h1 {
        font-size: 16px;
    }
    .admin-badge {
        font-size: 10px;
        padding: 3px 8px;
    }
    .admin-user {
        font-size: 13px;
    }
    /* Charts */
    .charts-grid {
        gap: 12px;
    }
    /* Alert strip */
    .alert-strip {
        font-size: 13px;
        padding: 10px 14px;
    }
}

/* Restart button */
.btn-restart {
    margin-top: 8px;
    background: rgba(251, 146, 60, 0.08);
    color: var(--accent-orange);
    border: 1px solid rgba(251, 146, 60, 0.3);
    border-radius: 8px;
}

.btn-restart:hover {
    background: rgba(251, 146, 60, 0.15);
    border-color: var(--accent-orange);
}

/* Smooth scrollbar for admin main */
.admin-main::-webkit-scrollbar {
    width: 6px;
}

.admin-main::-webkit-scrollbar-track {
    background: transparent;
}

.admin-main::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

/* SMS sub-tabs */
.sms-subtabs {
    display: flex;
    gap: 2px;
    margin-bottom: 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 3px;
    width: fit-content;
}

.sms-subtab {
    padding: 8px 18px;
    background: none;
    border: none;
    border-radius: 7px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}

.sms-subtab.active {
    color: var(--text-primary);
    background: var(--bg-tertiary);
    box-shadow: 0 1px 3px var(--shadow);
}

.sms-subtab:hover:not(.active) {
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.03);
}

.sms-subpanel.hidden {
    display: none;
}

.admin-main::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Section descriptions */
.section-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
    font-weight: 400;
}

/* Dashboard zones */
.dash-zone {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 20px;
    margin-bottom: 20px;
}

.zone-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.zone-icon {
    font-size: 18px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.zone-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.3;
}

.zone-desc {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 400;
}

.dash-zone .stats-grid {
    margin-bottom: 0;
}

.dash-zone .charts-grid {
    margin-top: 20px;
    margin-bottom: 0;
}

.stats-grid-sm {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.stat-card-health {
    border-left: 3px solid var(--accent-green);
}

/* Log summary bar */
.log-summary-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.log-summary-chip {
    font-size: 12px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
    white-space: nowrap;
}

.log-summary-chip.error {
    background: rgba(248, 113, 113, 0.12);
    color: var(--accent-red);
}

.log-summary-chip.warn {
    background: rgba(251, 146, 60, 0.12);
    color: var(--accent-orange, #fb923c);
}

.log-summary-chip.info {
    background: rgba(96, 165, 250, 0.12);
    color: var(--accent-blue);
}

.log-summary-chip.spike {
    background: rgba(248, 113, 113, 0.2);
    color: var(--accent-red);
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Log quick filters */
.log-quick-filters {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.log-chip {
    font-size: 11px;
    font-weight: 600;
    padding: 5px 14px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--bg-tertiary);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
}

.log-chip:hover {
    color: var(--text-secondary);
    border-color: rgba(96, 165, 250, 0.3);
}

.log-chip.active {
    background: rgba(96, 165, 250, 0.12);
    color: var(--accent-blue);
    border-color: rgba(96, 165, 250, 0.4);
}

/* Logs filter bar */
.logs-filter-bar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-primary);
    padding: 8px 0;
    margin-bottom: 8px;
}

.logs-filter-bar .logs-controls {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

/* Dashboard accent zone */
.dash-zone-accent {
    border-color: rgba(96, 165, 250, 0.2);
    background: linear-gradient(180deg, rgba(96, 165, 250, 0.04) 0%, var(--bg-secondary) 100%);
}

/* KPI stat cards */
.stats-grid-kpi {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}

.stat-card-kpi {
    text-align: center;
}

.stat-card-kpi[data-goto], .stat-card[data-goto] { cursor: pointer; }
.stat-card-kpi[data-goto]:hover, .stat-card[data-goto]:hover { border-color: var(--accent-blue, #60a5fa); }

.attention-item { cursor: pointer; transition: background 0.15s; }
.attention-item:hover { filter: brightness(1.15); }

/* Pulsing zone icon */
.zone-icon-pulse {
    animation: pulse 2s ease-in-out infinite;
}

/* 2-column grid */
.dash-grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 768px) {
    .dash-grid-2col {
        grid-template-columns: 1fr;
    }
}

/* Sub-zones */
.dash-subzone {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
}

.subzone-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin: 0 0 12px;
}

/* Attention items */
.dash-attention {
    margin-top: 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
}

.attention-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.attention-empty {
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
    padding: 16px;
}

.attention-item {
    font-size: 13px;
    padding: 8px 12px;
    border-radius: 8px;
    border-left: 3px solid;
}

.attention-danger {
    background: rgba(248, 113, 113, 0.08);
    border-color: var(--accent-red);
    color: var(--accent-red);
}

.attention-warn {
    background: rgba(251, 146, 60, 0.08);
    border-color: var(--accent-orange, #fb923c);
    color: var(--accent-orange, #fb923c);
}

.attention-info {
    background: rgba(96, 165, 250, 0.08);
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

/* Health matrix */
.health-matrix {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
}

.health-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 10px;
    position: relative;
}

.health-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--text-muted);
}

.health-indicator.health-online {
    background: var(--accent-green);
    box-shadow: 0 0 8px rgba(74, 222, 128, 0.5);
}

.health-indicator.health-configured {
    background: var(--accent-blue);
    box-shadow: 0 0 6px rgba(96, 165, 250, 0.4);
}

.health-indicator.health-stopped {
    background: var(--accent-orange, #fb923c);
}

.health-indicator.health-unconfigured {
    background: var(--text-muted);
    opacity: 0.5;
}

.health-indicator.health-offline {
    background: var(--accent-red);
    box-shadow: 0 0 8px rgba(248, 113, 113, 0.5);
}

.health-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.health-status {
    font-size: 11px;
    color: var(--text-muted);
    margin-left: auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}

.health-card .btn-restart {
    font-size: 10px;
    padding: 3px 8px;
    margin-left: 4px;
    margin-top: 0;
}

/* System incidents */
.sys-incidents {
    margin-top: 12px;
}

/* System events */
.sys-events {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 300px;
    overflow-y: auto;
}

.sys-event-item {
    display: flex;
    gap: 12px;
    padding: 6px 0;
    font-size: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.sys-event-item:last-child {
    border-bottom: none;
}

.sys-event-time {
    color: var(--text-muted);
    font-family: "SF Mono", "Fira Code", monospace;
    font-size: 11px;
    white-space: nowrap;
    flex-shrink: 0;
}

.sys-event-action {
    color: var(--accent-blue);
    font-weight: 600;
    white-space: nowrap;
}

.sys-event-detail {
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
