/* ============================================================
   ZeroTier VPN Management - Dashboard Styles
   ============================================================ */

/* ---- CSS Variables ---- */
:root {
    --zt-bg: #f8fafc;
    --zt-surface: #ffffff;
    --zt-surface-hover: #f1f5f9;
    --zt-border: #e2e8f0;
    --zt-text: #1e293b;
    --zt-text-secondary: #64748b;
    --zt-text-muted: #94a3b8;
    --zt-primary: #2563eb;
    --zt-primary-hover: #1d4ed8;
    --zt-primary-light: rgba(37, 99, 235, 0.1);
    --zt-success: #16a34a;
    --zt-success-light: rgba(22, 163, 74, 0.1);
    --zt-warning: #d97706;
    --zt-warning-light: rgba(217, 119, 6, 0.1);
    --zt-danger: #dc2626;
    --zt-danger-light: rgba(220, 38, 38, 0.1);
    --zt-online: #22c55e;
    --zt-offline: #94a3b8;
    --zt-unauthorized: #f59e0b;
    --zt-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    --zt-shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.08);
    --zt-radius: 8px;
    --zt-radius-sm: 4px;
}

/* ---- Dark Mode Variables ---- */
[data-theme="dark"] {
    --zt-bg: #0f172a;
    --zt-surface: #1e293b;
    --zt-surface-hover: #334155;
    --zt-border: #334155;
    --zt-text: #e2e8f0;
    --zt-text-secondary: #94a3b8;
    --zt-text-muted: #64748b;
    --zt-primary: #3b82f6;
    --zt-primary-hover: #60a5fa;
    --zt-primary-light: rgba(59, 130, 246, 0.15);
    --zt-success-light: rgba(22, 163, 74, 0.15);
    --zt-warning-light: rgba(217, 119, 6, 0.15);
    --zt-danger-light: rgba(220, 38, 38, 0.15);
    --zt-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    --zt-shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.3);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--zt-bg) url('../img/network-bg.svg') no-repeat center top / cover;
    background-attachment: fixed;
    color: var(--zt-text);
    line-height: 1.5;
}

[data-theme="dark"] body {
    background: var(--zt-bg) url('../img/network-bg-dark.svg') no-repeat center top / cover;
    background-attachment: fixed;
}

.zt-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px 24px;
}

/* ---- Setup Banner ---- */
.zt-setup-banner {
    background: var(--zt-warning-light);
    border: 1px solid var(--zt-warning);
    border-radius: var(--zt-radius);
    padding: 24px;
    text-align: center;
    margin-bottom: 24px;
}

.zt-setup-banner h2 {
    color: var(--zt-warning);
    margin-bottom: 8px;
    font-size: 18px;
}

.zt-setup-banner p {
    color: var(--zt-text-secondary);
    margin-bottom: 16px;
}

.zt-setup-btn {
    display: inline-block;
    padding: 10px 24px;
    background: var(--zt-warning);
    color: #fff;
    border: none;
    border-radius: var(--zt-radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.zt-setup-btn:hover {
    opacity: 0.85;
}

/* ---- Header Bar ---- */
.zt-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

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

.zt-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ---- Network Selector ---- */
.zt-network-select {
    padding: 8px 32px 8px 12px;
    border: 1px solid var(--zt-border);
    border-radius: var(--zt-radius-sm);
    background: var(--zt-surface);
    color: var(--zt-text);
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    min-width: 200px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.zt-network-select:focus {
    outline: none;
    border-color: var(--zt-primary);
    box-shadow: 0 0 0 2px var(--zt-primary-light);
}

/* ---- Action Buttons ---- */
.zt-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid var(--zt-border);
    border-radius: var(--zt-radius-sm);
    background: var(--zt-surface);
    color: var(--zt-text);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.zt-btn:hover {
    background: var(--zt-surface-hover);
    border-color: var(--zt-text-muted);
}

.zt-btn-primary {
    background: var(--zt-primary);
    color: #fff;
    border-color: var(--zt-primary);
}

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

.zt-btn-success {
    background: var(--zt-success);
    color: #fff;
    border-color: var(--zt-success);
}

.zt-btn-success:hover {
    opacity: 0.85;
}

.zt-btn-danger {
    background: var(--zt-danger);
    color: #fff;
    border-color: var(--zt-danger);
}

.zt-btn-danger:hover {
    opacity: 0.85;
}

.zt-btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

.zt-btn-icon {
    padding: 6px 8px;
    font-size: 16px;
    line-height: 1;
}

/* ---- Summary Cards ---- */
.zt-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.zt-summary-card {
    background: var(--zt-surface);
    border: 1px solid var(--zt-border);
    border-radius: var(--zt-radius);
    padding: 16px 20px;
    box-shadow: var(--zt-shadow);
}

.zt-summary-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--zt-text-muted);
    margin-bottom: 4px;
}

.zt-summary-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--zt-text);
    line-height: 1.2;
}

.zt-summary-card[data-type="online"] .zt-summary-value { color: var(--zt-online); }
.zt-summary-card[data-type="offline"] .zt-summary-value { color: var(--zt-offline); }
.zt-summary-card[data-type="unauthorized"] .zt-summary-value { color: var(--zt-unauthorized); }

/* ---- Search & Filter Bar ---- */
.zt-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.zt-search {
    flex: 1;
    min-width: 200px;
    padding: 8px 12px 8px 36px;
    border: 1px solid var(--zt-border);
    border-radius: var(--zt-radius-sm);
    background: var(--zt-surface);
    color: var(--zt-text);
    font-size: 14px;
    font-family: inherit;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 10px center;
}

.zt-search:focus {
    outline: none;
    border-color: var(--zt-primary);
    box-shadow: 0 0 0 2px var(--zt-primary-light);
}

.zt-search::placeholder {
    color: var(--zt-text-muted);
}

/* Filter pill group (iOS-style segmented control) */
.zt-filter-group {
    display: inline-flex;
    background: var(--zt-surface-hover);
    border: 1px solid var(--zt-border);
    border-radius: 20px;
    padding: 3px;
    gap: 2px;
    flex-shrink: 0;
}

.zt-filter-pill {
    padding: 6px 14px;
    border: none;
    border-radius: 17px;
    background: transparent;
    color: var(--zt-text-secondary);
    font-size: 13px;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    line-height: 1.2;
}

.zt-filter-pill:hover {
    color: var(--zt-text);
    background: var(--zt-border);
}

.zt-filter-pill.active {
    background: var(--zt-primary);
    color: #fff;
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.3);
}

.zt-filter-pill.active:hover {
    background: var(--zt-primary-hover);
    color: #fff;
}

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

/* ---- Member Table ---- */
.zt-table-wrap {
    background: var(--zt-surface);
    border: 1px solid var(--zt-border);
    border-radius: var(--zt-radius);
    box-shadow: var(--zt-shadow);
    overflow-x: auto;
}

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

.zt-table th {
    background: var(--zt-surface-hover);
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--zt-text-secondary);
    border-bottom: 1px solid var(--zt-border);
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
    transition: background 0.15s;
}

.zt-table th:hover {
    background: var(--zt-border);
}

.zt-table th.zt-sorted-asc::after { content: ' \25B2'; font-size: 0.7em; opacity: 0.6; }
.zt-table th.zt-sorted-desc::after { content: ' \25BC'; font-size: 0.7em; opacity: 0.6; }

.zt-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--zt-border);
    vertical-align: middle;
}

.zt-table tbody tr {
    cursor: pointer;
    transition: background 0.1s;
}

.zt-table tbody tr:hover {
    background: var(--zt-primary-light);
}

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

.zt-table tbody tr.zt-row-selected {
    background: var(--zt-primary-light);
}

/* Status dot */
.zt-status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
}

.zt-status-dot.online { background: var(--zt-online); box-shadow: 0 0 4px var(--zt-online); }
.zt-status-dot.offline { background: var(--zt-offline); }
.zt-status-dot.unauthorized { background: var(--zt-unauthorized); }

.zt-status-text {
    font-size: 12px;
    font-weight: 500;
}

.zt-status-text.online { color: var(--zt-online); }
.zt-status-text.offline { color: var(--zt-text-muted); }
.zt-status-text.unauthorized { color: var(--zt-unauthorized); }

/* IP badges */
.zt-ip-badge {
    display: inline-block;
    padding: 2px 8px;
    background: var(--zt-primary-light);
    color: var(--zt-primary);
    border-radius: 3px;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 12px;
    margin: 1px 4px 1px 0;
}

/* Name / node cell */
.zt-member-name {
    font-weight: 600;
    color: var(--zt-text);
}

.zt-member-node {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 11px;
    color: var(--zt-text-muted);
}

/* Camera badge in table */
.zt-camera-badge {
    display: inline-block;
    padding: 1px 6px;
    background: var(--zt-success-light);
    color: var(--zt-success);
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
    margin-top: 2px;
}

/* Camera link in detail panel */
.zt-camera-link {
    color: var(--zt-primary);
    text-decoration: none;
    font-weight: 500;
}

.zt-camera-link:hover {
    text-decoration: underline;
}

.zt-camera-meta {
    font-size: 12px;
    color: var(--zt-text-muted);
    margin-top: 2px;
}

/* Last seen cell */
.zt-last-seen {
    font-size: 12px;
    color: var(--zt-text-muted);
}

/* Muted detail text (e.g., absolute timestamp under relative time) */
.zt-detail-muted {
    color: var(--zt-text-muted);
    font-size: 0.85em;
}

/* Empty state */
.zt-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--zt-text-muted);
}

.zt-empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.zt-empty h3 {
    font-size: 16px;
    margin-bottom: 6px;
    color: var(--zt-text-secondary);
}

.zt-empty p {
    font-size: 14px;
}

/* Loading spinner */
.zt-loading {
    text-align: center;
    padding: 40px;
    color: var(--zt-text-muted);
}

.zt-spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid var(--zt-border);
    border-top-color: var(--zt-primary);
    border-radius: 50%;
    animation: zt-spin 0.7s linear infinite;
    margin-bottom: 8px;
}

@keyframes zt-spin {
    to { transform: rotate(360deg); }
}

/* ---- Member Detail Panel (Slide-in) ---- */
.zt-detail-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 900;
}

.zt-detail-backdrop.active {
    display: block;
}

.zt-detail-panel {
    display: none;
    position: fixed;
    top: 0;
    right: -480px;
    width: 480px;
    max-width: 100vw;
    height: 100vh;
    background: var(--zt-surface);
    border-left: 1px solid var(--zt-border);
    box-shadow: var(--zt-shadow-lg);
    z-index: 950;
    overflow-y: auto;
    transition: right 0.25s ease;
}

.zt-detail-panel.active {
    display: block;
    right: 0;
}

.zt-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--zt-border);
    position: sticky;
    top: 0;
    background: var(--zt-surface);
    z-index: 1;
}

.zt-detail-title {
    font-size: 16px;
    font-weight: 700;
}

.zt-detail-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--zt-text-muted);
    padding: 4px 8px;
    line-height: 1;
    border-radius: var(--zt-radius-sm);
    transition: background 0.15s;
}

.zt-detail-close:hover {
    background: var(--zt-surface-hover);
    color: var(--zt-text);
}

.zt-detail-body {
    padding: 20px;
}

.zt-detail-section {
    margin-bottom: 24px;
}

.zt-detail-section-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--zt-text-muted);
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--zt-border);
}

.zt-detail-row {
    display: flex;
    align-items: flex-start;
    padding: 8px 0;
}

.zt-detail-label {
    flex: 0 0 130px;
    font-size: 13px;
    font-weight: 500;
    color: var(--zt-text-secondary);
}

.zt-detail-value {
    flex: 1;
    font-size: 13px;
    color: var(--zt-text);
    word-break: break-all;
}

.zt-detail-value .zt-ip-badge {
    margin-bottom: 4px;
}

/* Editable fields in detail panel */
.zt-edit-input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid var(--zt-border);
    border-radius: var(--zt-radius-sm);
    background: var(--zt-bg);
    color: var(--zt-text);
    font-size: 13px;
    font-family: inherit;
}

.zt-edit-input:focus {
    outline: none;
    border-color: var(--zt-primary);
    box-shadow: 0 0 0 2px var(--zt-primary-light);
}

.zt-ip-edit-row {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-bottom: 6px;
}

.zt-ip-edit-row input {
    flex: 1;
}

.zt-ip-remove-btn {
    background: none;
    border: none;
    color: var(--zt-danger);
    cursor: pointer;
    font-size: 18px;
    padding: 2px 6px;
    line-height: 1;
}

.zt-detail-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 16px 20px;
    border-top: 1px solid var(--zt-border);
    position: sticky;
    bottom: 0;
    background: var(--zt-surface);
}

/* ---- Settings Panel ---- */
.zt-settings-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.zt-settings-backdrop.active {
    display: flex;
}

.zt-settings-panel {
    background: var(--zt-surface);
    border: 1px solid var(--zt-border);
    border-radius: var(--zt-radius);
    box-shadow: var(--zt-shadow-lg);
    width: 500px;
    max-width: 95vw;
    max-height: 90vh;
    overflow-y: auto;
}

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

.zt-settings-header h2 {
    font-size: 16px;
    font-weight: 700;
}

.zt-settings-body {
    padding: 20px;
}

.zt-form-group {
    margin-bottom: 16px;
}

.zt-form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--zt-text-secondary);
    margin-bottom: 4px;
}

.zt-form-hint {
    font-size: 11px;
    color: var(--zt-text-muted);
    margin-top: 2px;
}

.zt-form-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--zt-border);
    border-radius: var(--zt-radius-sm);
    background: var(--zt-bg);
    color: var(--zt-text);
    font-size: 14px;
    font-family: inherit;
}

.zt-form-input:focus {
    outline: none;
    border-color: var(--zt-primary);
    box-shadow: 0 0 0 2px var(--zt-primary-light);
}

.zt-settings-footer {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    padding: 16px 20px;
    border-top: 1px solid var(--zt-border);
}

/* ---- Confirmation Overlay ---- */
.zt-confirm-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1100;
    justify-content: center;
    align-items: center;
}

.zt-confirm-backdrop.active {
    display: flex;
}

.zt-confirm-box {
    background: var(--zt-surface);
    border: 1px solid var(--zt-border);
    border-radius: var(--zt-radius);
    box-shadow: var(--zt-shadow-lg);
    padding: 28px;
    max-width: 420px;
    width: 90vw;
    text-align: center;
}

.zt-confirm-box h3 {
    font-size: 16px;
    margin-bottom: 8px;
}

.zt-confirm-box p {
    font-size: 14px;
    color: var(--zt-text-secondary);
    margin-bottom: 20px;
}

.zt-confirm-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* ---- Toast Notifications ---- */
.zt-toast-container {
    position: fixed;
    top: 60px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.zt-toast {
    background: var(--zt-surface);
    border: 1px solid var(--zt-border);
    border-radius: var(--zt-radius);
    box-shadow: var(--zt-shadow-lg);
    padding: 12px 20px;
    font-size: 14px;
    min-width: 280px;
    max-width: 420px;
    pointer-events: auto;
    animation: zt-toast-in 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.zt-toast.success { border-left: 3px solid var(--zt-success); }
.zt-toast.error { border-left: 3px solid var(--zt-danger); }
.zt-toast.warning { border-left: 3px solid var(--zt-warning); }
.zt-toast.info { border-left: 3px solid var(--zt-primary); }

.zt-toast.removing {
    animation: zt-toast-out 0.3s ease forwards;
}

@keyframes zt-toast-in {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes zt-toast-out {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(40px); }
}

/* ---- Network Info Row ---- */
.zt-network-info {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 16px;
    background: var(--zt-surface);
    border: 1px solid var(--zt-border);
    border-radius: var(--zt-radius);
    margin-bottom: 16px;
    font-size: 13px;
    color: var(--zt-text-secondary);
    flex-wrap: wrap;
}

.zt-network-info strong {
    color: var(--zt-text);
    font-weight: 600;
}

.zt-network-info-sep {
    color: var(--zt-border);
}

/* ---- Authorization Badge ---- */
.zt-auth-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
}

.zt-auth-badge.authorized {
    background: var(--zt-success-light);
    color: var(--zt-success);
}

.zt-auth-badge.unauthorized {
    background: var(--zt-warning-light);
    color: var(--zt-warning);
}

/* ---- History Timeline ---- */
.zt-history-timeline {
    max-height: 300px;
    overflow-y: auto;
    padding-right: 4px;
}

.zt-history-event {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--zt-border);
}

.zt-history-event:last-child {
    border-bottom: none;
}

.zt-history-dot {
    flex-shrink: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 5px;
    background: var(--zt-text-muted);
}

.zt-history-dot.online {
    background: var(--zt-online);
    box-shadow: 0 0 4px var(--zt-online);
}

.zt-history-dot.offline {
    background: var(--zt-offline);
}

.zt-history-dot.authorized {
    background: var(--zt-success);
}

.zt-history-dot.deauthorized {
    background: var(--zt-warning);
}

.zt-history-dot.change {
    background: var(--zt-primary);
}

.zt-history-dot.new_member {
    background: var(--zt-primary);
}

.zt-history-content {
    flex: 1;
    min-width: 0;
}

.zt-history-label {
    font-size: 13px;
    color: var(--zt-text);
    line-height: 1.3;
}

.zt-history-detail {
    font-size: 11px;
    color: var(--zt-text-muted);
    margin-top: 2px;
    word-break: break-all;
}

.zt-history-time {
    flex-shrink: 0;
    font-size: 11px;
    color: var(--zt-text-muted);
    white-space: nowrap;
    margin-top: 2px;
}

.zt-history-loading,
.zt-history-empty {
    text-align: center;
    padding: 16px 0;
    color: var(--zt-text-muted);
    font-size: 13px;
}

.zt-history-loading .zt-spinner {
    width: 18px;
    height: 18px;
    border-width: 2px;
    margin-bottom: 6px;
}

.zt-history-error {
    text-align: center;
    padding: 12px 0;
    color: var(--zt-danger);
    font-size: 12px;
}

/* ---- Uptime Column ---- */
.zt-uptime {
    font-size: 12px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.zt-uptime-high { color: var(--zt-success); }
.zt-uptime-mid  { color: var(--zt-warning); }
.zt-uptime-low  { color: var(--zt-danger); }
.zt-uptime-na   { color: var(--zt-text-muted); }

/* ---- History Link (header) ---- */
.zt-history-link {
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    color: var(--zt-primary);
    border-color: var(--zt-primary);
}

.zt-history-link:hover {
    background: var(--zt-primary-light);
}

/* ---- View All link in detail section title ---- */
.zt-history-view-all {
    float: right;
    font-size: 11px;
    font-weight: 500;
    color: var(--zt-primary);
    text-decoration: none;
    text-transform: none;
    letter-spacing: 0;
}

.zt-history-view-all:hover {
    text-decoration: underline;
}

/* ---- Green Pulse Animation (discreet auto-refresh) ---- */
@keyframes zt-pulse-green {
    0%   { background-color: rgba(34, 197, 94, 0.25); }
    100% { background-color: transparent; }
}

.zt-pulse-green {
    animation: zt-pulse-green 2s ease-out;
}

/* ---- Offline Cache Banner ---- */
.zt-offline-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--zt-warning-light);
    border: 1px solid var(--zt-warning);
    border-radius: var(--zt-radius);
    padding: 10px 16px;
    margin: 0 auto 12px;
    max-width: 1400px;
    font-size: 14px;
    color: var(--zt-warning);
    font-weight: 500;
}

.zt-offline-banner-icon {
    font-size: 18px;
    line-height: 1;
}

.zt-offline-banner-text {
    flex: 1;
}

.zt-offline-banner-retry {
    background: transparent;
    color: var(--zt-warning);
    border: 1px solid var(--zt-warning);
    border-radius: var(--zt-radius-sm);
    padding: 4px 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 120ms ease;
}

.zt-offline-banner-retry:hover {
    background: var(--zt-warning);
    color: #fff;
}

/* ---- Responsive ---- */
@media (max-width: 1024px) {
    .zt-summary {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .zt-container {
        padding: 12px 16px;
    }

    .zt-summary {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .zt-summary-value {
        font-size: 22px;
    }

    .zt-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .zt-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .zt-search {
        min-width: unset;
    }

    .zt-filter-group {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .zt-filter-pill {
        padding: 5px 11px;
        font-size: 12px;
    }

    .zt-detail-panel {
        width: 100vw;
    }

    .zt-table th,
    .zt-table td {
        padding: 8px 10px;
    }

    /* Hide less important columns on mobile */
    .zt-table .zt-col-physical,
    .zt-table .zt-col-version,
    .zt-table .zt-col-lastseen,
    .zt-table .zt-col-uptime {
        display: none;
    }
}

@media (max-width: 480px) {
    .zt-summary {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .zt-summary-card {
        padding: 12px 14px;
    }

    .zt-summary-value {
        font-size: 20px;
    }
}

/* ========== T-13: Failover status card ========== */
.zt-failover-card {
    background: var(--zt-surface);
    border: 1px solid var(--zt-border);
    border-radius: 8px;
    padding: 12px 16px;
    margin: 16px 0;
    font-size: 13px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.zt-failover-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.zt-failover-label {
    font-weight: 600;
    color: var(--zt-text);
    letter-spacing: 0.02em;
}
.zt-failover-health {
    text-transform: capitalize;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
    line-height: 1.5;
}
.zt-failover-health[data-state="healthy"] {
    background: var(--zt-success-light);
    color: var(--zt-success);
}
.zt-failover-health[data-state="degraded"] {
    background: var(--zt-warning-light);
    color: var(--zt-warning);
}
.zt-failover-health[data-state="critical"] {
    background: var(--zt-danger-light, rgba(220, 38, 38, 0.1));
    color: var(--zt-danger);
}
.zt-failover-health[data-state="loading"],
.zt-failover-health[data-state="unknown"] {
    background: var(--zt-surface-hover);
    color: var(--zt-text-secondary);
}
.zt-failover-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 6px 16px;
}
.zt-failover-cell {
    display: flex;
    flex-direction: column;
    line-height: 1.35;
}
.zt-failover-k {
    color: var(--zt-text-muted);
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.zt-failover-v {
    color: var(--zt-text);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px;
}
.zt-failover-alerts {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--zt-border);
    font-size: 12px;
    color: var(--zt-danger);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.zt-failover-alert {
    display: inline-block;
}

[data-theme="dark"] .zt-failover-card {
    background: var(--zt-surface);
    border-color: var(--zt-border);
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

/* Pending Approvals (inside failover card) */
.zt-failover-approvals {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--zt-border);
}
.zt-failover-approvals-head {
    font-weight: 600;
    font-size: 12px;
    color: var(--zt-warning);
    margin-bottom: 6px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}
.zt-failover-approval-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 12px;
    border-bottom: 1px solid var(--zt-border);
}
.zt-failover-approval-row:last-child { border-bottom: none; }
.zt-failover-approval-row code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    color: var(--zt-text);
    font-size: 11px;
}
.zt-failover-approval-net,
.zt-failover-approval-phys {
    color: var(--zt-text-muted);
    font-size: 11px;
}
.zt-failover-approval-row button {
    margin-left: auto;
    padding: 3px 10px;
    border: 1px solid var(--zt-border);
    background: var(--zt-surface);
    color: var(--zt-text);
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
}
.zt-failover-approval-approve { color: var(--zt-success); }
.zt-failover-approval-reject  { color: var(--zt-danger); }
.zt-failover-approval-row button:hover { background: var(--zt-surface-hover); }
.zt-failover-approval-row button:disabled { opacity: 0.5; cursor: wait; }
