/* Global Styles - LiveFabric */
/* IBM Carbon Design System - Inline Theming (g10 Light / g90 Dark) */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@300;400;600&family=IBM+Plex+Mono:wght@400&display=swap');

/* ============================================================
   Carbon Icons - Base Styles
   ============================================================ */
.carbon-icon {
    display: inline-block;
    fill: currentColor;
    vertical-align: middle;
    flex-shrink: 0;
}

.carbon-icon-container {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 1;
}

@keyframes spinning {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.carbon-icon-container.spinning .carbon-icon,
.spinning .carbon-icon {
    animation: spinning 1s linear infinite;
}

.carbon-icon-container.spinning {
    animation: none;
}

/* ============================================================
   Carbon Design Tokens - g10 (Light) Theme
   ============================================================ */
:root,
[data-carbon-theme="g10"] {
    /* Primary - Carbon Blue */
    --md-sys-color-primary: #0f62fe;
    --md-sys-color-on-primary: #ffffff;
    --md-sys-color-primary-container: #d0e2ff;
    --md-sys-color-on-primary-container: #001d6c;
    
    /* Surface - Carbon Gray Scale */
    --md-sys-color-surface: #f4f4f4;
    --md-sys-color-surface-dim: #e0e0e0;
    --md-sys-color-surface-bright: #ffffff;
    --md-sys-color-surface-container-lowest: #ffffff;
    --md-sys-color-surface-container-low: #ffffff;
    --md-sys-color-surface-container: #f4f4f4;
    --md-sys-color-surface-container-high: #e8e8e8;
    --md-sys-color-surface-container-highest: #c6c6c6;
    --md-sys-color-on-surface: #161616;
    --md-sys-color-on-surface-variant: #525252;
    
    /* Secondary - Carbon Cool Gray */
    --md-sys-color-secondary: #393939;
    --md-sys-color-on-secondary: #ffffff;
    --md-sys-color-secondary-container: #e0e0e0;
    --md-sys-color-on-secondary-container: #161616;
    
    /* Tertiary - Carbon Teal */
    --md-sys-color-tertiary: #005d5d;
    --md-sys-color-on-tertiary: #ffffff;
    --md-sys-color-tertiary-container: #9ef0f0;
    --md-sys-color-on-tertiary-container: #004144;
    
    /* Error - Carbon Red */
    --md-sys-color-error: #da1e28;
    --md-sys-color-on-error: #ffffff;
    --md-sys-color-error-container: #fff1f1;
    --md-sys-color-on-error-container: #750e13;
    
    /* Outline - Carbon Gray */
    --md-sys-color-outline: #8d8d8d;
    --md-sys-color-outline-variant: #e0e0e0;
    
    /* Success - Carbon Green */
    --md-sys-color-success: #24a148;
    --md-sys-color-on-success: #ffffff;
    --md-sys-color-success-container: #defbe6;
    
    /* Warning - Carbon Yellow */
    --md-sys-color-warning: #f1c21b;
    --md-sys-color-on-warning: #161616;
    --md-sys-color-warning-container: #fcf4d6;
    
    /* Info - Carbon Blue */
    --md-sys-color-info: #0043ce;
    --md-sys-color-on-info: #ffffff;
    --md-sys-color-info-container: #edf5ff;
    
    /* Elevation - Carbon subtle shadows */
    --md-sys-elevation-1: 0 2px 6px 0 rgba(0, 0, 0, 0.1);
    --md-sys-elevation-2: 0 2px 6px 0 rgba(0, 0, 0, 0.2);
    --md-sys-elevation-3: 0 4px 16px 0 rgba(0, 0, 0, 0.15);
    --md-sys-elevation-4: 0 8px 24px 0 rgba(0, 0, 0, 0.15);
    --md-sys-elevation-5: 0 12px 28px 0 rgba(0, 0, 0, 0.2);

    /* Carbon Shell */
    --cds-header-bg: #161616;
    --cds-header-text: #f4f4f4;
    --cds-header-height: 48px;
    --cds-side-nav-width: 256px;
    --cds-focus: #0f62fe;
    --cds-overlay: rgba(0, 0, 0, 0.6);

    /* Component-specific tokens */
    --cds-nav-bg: #ffffff;
    --cds-code-bg: #f4f4f4;
    --cds-code-text: #161616;
    --cds-chassis-bg: linear-gradient(135deg, #c6c6c6 0%, #a8a8a8 100%);
    --cds-chassis-border: #8d8d8d;
    --cds-port-bg: #e0e0e0;
    --cds-port-border: #8d8d8d;
    --cds-port-text: #161616;
    --cds-port-group-label: #525252;
    --cds-port-group-border: #c6c6c6;
    --cds-status-online: #24a148;
    --cds-status-offline: #da1e28;
    --cds-interactive-01: #0f62fe;
    --cds-link-color: #0f62fe;
    --cds-highlight: #d0e2ff;
    --cds-scrollbar-track: #e0e0e0;
    --cds-scrollbar-thumb: #c6c6c6;
    --cds-scrollbar-thumb-hover: #a8a8a8;
    --cds-raw-output-bg: #161616;
    --cds-raw-output-text: #f4f4f4;

    /* Button hover states */
    --cds-btn-primary-hover: #0353e9;
    --cds-btn-success-hover: #198038;
    --cds-btn-danger-hover: #b81921;
    --cds-btn-secondary-hover: #c6c6c6;

    /* Port type colors */
    --cds-port-sfp-bg: #2a3a4a;
    --cds-port-sfp-border: #4a6a8a;
    --cds-port-qsfp-bg: #3a2a4a;
    --cds-port-qsfp-border: #6a4a8a;
    --cds-port-trunk-gradient: linear-gradient(45deg, #7B1FA2, #C2185B, #F57C00);
    --cds-port-trunk-gradient-short: linear-gradient(45deg, #7B1FA2, #C2185B);

    /* Warning/fix buttons */
    --cds-warning-gradient: linear-gradient(135deg, #ff9800, #f57c00);
    --cds-warning-gradient-hover: linear-gradient(135deg, #f57c00, #e65100);
    --cds-warning-accent: #ff9800;

    /* Topology legend */
    --cds-topology-router: #2196F3;
    --cds-topology-ap: #FF9800;
    --cds-topology-device: #9E9E9E;
    --cds-topology-loading-bg: rgba(244, 244, 244, 0.9);

    /* Misc */
    --cds-webui-bg: #ffffff;
    --cds-muted-text: #525252;
    --cds-info-accent: #0f62fe;
    --cds-info-box-bg: #edf5ff;
    --cds-info-box-border: #0f62fe;
    --cds-info-box-text: #525252;
    --cds-info-box-highlight: #0043ce;
    --cds-row-hover: rgba(74, 144, 226, 0.08);
    --cds-legend-access: #4285F4;

    /* Chart tokens (Carbon data viz) */
    --cds-chart-grid: #e0e0e0;
    --cds-chart-axis-line: #8d8d8d;
    --cds-chart-tick-text: #525252;
    --cds-chart-axis-title: #161616;
    --cds-chart-legend-text: #525252;
    --cds-chart-tooltip-bg: #161616;
    --cds-chart-tooltip-text: #f4f4f4;
    --cds-chart-tooltip-border: #393939;
    --cds-chart-tooltip-line: #393939;
    --cds-chart-tooltip-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    --cds-chart-ruler: #e0e0e0;
    --cds-chart-grid-bg: #ffffff;

    /* Notification tokens (Carbon inline notification - low contrast) */
    --cds-notification-bg: #ffffff;
    --cds-notification-border: #e0e0e0;
    --cds-notification-text-title: #161616;
    --cds-notification-text-body: #525252;
    --cds-notification-close: #525252;
    --cds-notification-close-hover: #161616;
}

/* ============================================================
   Carbon Design Tokens - g90 (Dark) Theme
   ============================================================ */
[data-carbon-theme="g90"] {
    /* Primary - Carbon Blue (dark) */
    --md-sys-color-primary: #4589ff;
    --md-sys-color-on-primary: #ffffff;
    --md-sys-color-primary-container: #002d9c;
    --md-sys-color-on-primary-container: #d0e2ff;
    
    /* Surface - Carbon g90 */
    --md-sys-color-surface: #262626;
    --md-sys-color-surface-dim: #1a1a1a;
    --md-sys-color-surface-bright: #393939;
    --md-sys-color-surface-container-lowest: #161616;
    --md-sys-color-surface-container-low: #262626;
    --md-sys-color-surface-container: #353535;
    --md-sys-color-surface-container-high: #393939;
    --md-sys-color-surface-container-highest: #525252;
    --md-sys-color-on-surface: #f4f4f4;
    --md-sys-color-on-surface-variant: #c6c6c6;
    
    /* Secondary */
    --md-sys-color-secondary: #c6c6c6;
    --md-sys-color-on-secondary: #161616;
    --md-sys-color-secondary-container: #525252;
    --md-sys-color-on-secondary-container: #f4f4f4;
    
    /* Tertiary - Carbon Teal (dark) */
    --md-sys-color-tertiary: #3ddbd9;
    --md-sys-color-on-tertiary: #161616;
    --md-sys-color-tertiary-container: #004144;
    --md-sys-color-on-tertiary-container: #9ef0f0;
    
    /* Error - Carbon Red (dark) */
    --md-sys-color-error: #ff8389;
    --md-sys-color-on-error: #161616;
    --md-sys-color-error-container: #750e13;
    --md-sys-color-on-error-container: #fff1f1;
    
    /* Outline */
    --md-sys-color-outline: #6f6f6f;
    --md-sys-color-outline-variant: #525252;
    
    /* Success */
    --md-sys-color-success: #42be65;
    --md-sys-color-on-success: #161616;
    --md-sys-color-success-container: #044317;
    
    /* Warning */
    --md-sys-color-warning: #f1c21b;
    --md-sys-color-on-warning: #161616;
    --md-sys-color-warning-container: #684e00;
    
    /* Info */
    --md-sys-color-info: #4589ff;
    --md-sys-color-on-info: #161616;
    --md-sys-color-info-container: #002d9c;
    
    /* Elevation - deeper shadows for dark */
    --md-sys-elevation-1: 0 2px 6px 0 rgba(0, 0, 0, 0.3);
    --md-sys-elevation-2: 0 2px 6px 0 rgba(0, 0, 0, 0.4);
    --md-sys-elevation-3: 0 4px 16px 0 rgba(0, 0, 0, 0.4);
    --md-sys-elevation-4: 0 8px 24px 0 rgba(0, 0, 0, 0.4);
    --md-sys-elevation-5: 0 12px 28px 0 rgba(0, 0, 0, 0.5);

    /* Carbon Shell - stays dark in both */
    --cds-header-bg: #161616;
    --cds-header-text: #f4f4f4;
    --cds-focus: #ffffff;
    --cds-overlay: rgba(0, 0, 0, 0.6);

    /* Component-specific tokens (dark) */
    --cds-nav-bg: #262626;
    --cds-code-bg: #161616;
    --cds-code-text: #f4f4f4;
    --cds-chassis-bg: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
    --cds-chassis-border: #525252;
    --cds-port-bg: #393939;
    --cds-port-border: #6f6f6f;
    --cds-port-text: #f4f4f4;
    --cds-port-group-label: #c6c6c6;
    --cds-port-group-border: #525252;
    --cds-status-online: #42be65;
    --cds-status-offline: #ff8389;
    --cds-interactive-01: #4589ff;
    --cds-link-color: #78a9ff;
    --cds-highlight: #002d9c;
    --cds-scrollbar-track: #262626;
    --cds-scrollbar-thumb: #525252;
    --cds-scrollbar-thumb-hover: #6f6f6f;
    --cds-raw-output-bg: #161616;
    --cds-raw-output-text: #f4f4f4;

    /* Button hover states */
    --cds-btn-primary-hover: #0353e9;
    --cds-btn-success-hover: #3bab5a;
    --cds-btn-danger-hover: #fa4d56;
    --cds-btn-secondary-hover: #474747;

    /* Port type colors */
    --cds-port-sfp-bg: #1a3040;
    --cds-port-sfp-border: #3a5a7a;
    --cds-port-qsfp-bg: #2a1a3a;
    --cds-port-qsfp-border: #5a3a7a;
    --cds-port-trunk-gradient: linear-gradient(45deg, #9C27B0, #E91E63, #FF9800);
    --cds-port-trunk-gradient-short: linear-gradient(45deg, #9C27B0, #E91E63);

    /* Warning/fix buttons */
    --cds-warning-gradient: linear-gradient(135deg, #ff9800, #f57c00);
    --cds-warning-gradient-hover: linear-gradient(135deg, #f57c00, #e65100);
    --cds-warning-accent: #ffb74d;

    /* Topology legend */
    --cds-topology-router: #4589ff;
    --cds-topology-ap: #ffb74d;
    --cds-topology-device: #8d8d8d;
    --cds-topology-loading-bg: rgba(38, 38, 38, 0.9);

    /* Misc */
    --cds-webui-bg: #262626;
    --cds-muted-text: #c6c6c6;
    --cds-info-accent: #4589ff;
    --cds-info-box-bg: #262626;
    --cds-info-box-border: #4589ff;
    --cds-info-box-text: #c6c6c6;
    --cds-info-box-highlight: #78a9ff;
    --cds-row-hover: rgba(69, 137, 255, 0.1);
    --cds-legend-access: #4589ff;

    /* Chart tokens (Carbon data viz) */
    --cds-chart-grid: #393939;
    --cds-chart-axis-line: #6f6f6f;
    --cds-chart-tick-text: #c6c6c6;
    --cds-chart-axis-title: #f4f4f4;
    --cds-chart-legend-text: #c6c6c6;
    --cds-chart-tooltip-bg: #393939;
    --cds-chart-tooltip-text: #f4f4f4;
    --cds-chart-tooltip-border: #525252;
    --cds-chart-tooltip-line: #525252;
    --cds-chart-tooltip-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
    --cds-chart-ruler: #525252;
    --cds-chart-grid-bg: #262626;

    /* Notification tokens (Carbon inline notification - low contrast) */
    --cds-notification-bg: #393939;
    --cds-notification-border: #525252;
    --cds-notification-text-title: #f4f4f4;
    --cds-notification-text-body: #c6c6c6;
    --cds-notification-close: #c6c6c6;
    --cds-notification-close-hover: #f4f4f4;
}

/* ============================================================
   Theme Toggle Button
   ============================================================ */
.theme-toggle {
    background: none;
    border: none;
    color: var(--cds-header-text);
    cursor: pointer;
    padding: 0 1rem;
    height: var(--cds-header-height);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s;
}

.theme-toggle:hover {
    background: #353535;
}

.theme-toggle:focus {
    outline: 2px solid var(--cds-focus);
    outline-offset: -2px;
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Theme transition for all surfaces */
.card,
.nav-menu,
.nav-header,
.modal,
.modal-header,
.toast,
.stat-box,
.switch-card,
.monitoring-status-bar,
.monitoring-card,
.monitoring-chart-container,
.grid-panel,
.device-topbar,
.device-sidebar,
.content-section,
.port-layout-container,
.settings-card,
.settings-card-header,
.settings-card-body,
.accordion-header,
.info-card,
table th,
.form-group input,
.form-group select,
.form-group textarea {
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

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

body {
    font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Oxygen, Ubuntu, sans-serif;
    background: var(--md-sys-color-surface);
    color: var(--md-sys-color-on-surface);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.2s ease, color 0.2s ease;
}

/* Header - Carbon UI Shell */
.header {
    background: var(--cds-header-bg);
    color: var(--cds-header-text);
    padding: 0 1rem;
    height: var(--cds-header-height);
    border-bottom: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 8000;
    box-shadow: none;
}

.header h1 {
    font-size: 0.875rem;
    font-weight: 400;
    letter-spacing: 0.16px;
    color: var(--cds-header-text);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0;
}

.header-name-prefix {
    font-weight: 600;
}

.header-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

/* Header Stats */
.header-stats {
    display: flex;
    gap: 1.5rem;
    padding-right: 1.5rem;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
}

.header-stat {
    text-align: center;
}

.header-stat-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: #78a9ff;
    line-height: 1;
}

.header-stat-label {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.32px;
    margin-top: 0.25rem;
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    padding-top: calc(var(--cds-header-height) + 2rem);
}

/* Cards */
.card {
    background: var(--md-sys-color-surface-container-low);
    border-radius: 0;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: none;
    border: 1px solid var(--md-sys-color-outline-variant);
    transition: box-shadow 0.2s ease;
}

.card:hover {
    box-shadow: var(--md-sys-elevation-1);
    border-color: var(--md-sys-color-outline);
}

.card h2 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--md-sys-color-on-surface);
    font-weight: 600;
    letter-spacing: 0;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 400;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.875rem;
    letter-spacing: 0.16px;
}

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    border-bottom: 1px solid var(--md-sys-color-outline);
    border-radius: 0;
    font-size: 0.875rem;
    background: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-on-surface);
    transition: border-color 0.15s, background 0.15s;
    font-family: inherit;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-bottom: 2px solid var(--md-sys-color-primary);
    background: var(--md-sys-color-surface-container-high);
    box-shadow: none;
}

.form-group input::placeholder, .form-group textarea::placeholder {
    color: var(--md-sys-color-outline);
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
}

/* Buttons - Carbon Design */
.btn {
    padding: 0.6875rem 1rem;
    border: none;
    border-radius: 0;
    font-size: 0.875rem;
    font-weight: 400;
    cursor: pointer;
    transition: background-color 0.15s ease;
    letter-spacing: 0.16px;
    text-transform: none;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 2.5rem;
}

.btn:hover {
    box-shadow: none;
}

.btn:active {
    transform: none;
}

.btn:focus {
    outline: 2px solid var(--cds-focus);
    outline-offset: -2px;
}

.btn-primary {
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
}

.btn-primary:hover {
    background: var(--cds-btn-primary-hover);
    box-shadow: none;
}

.btn-success {
    background: var(--md-sys-color-success);
    color: var(--md-sys-color-on-success);
}

.btn-success:hover {
    background: var(--cds-btn-success-hover);
    box-shadow: none;
}

.btn-danger {
    background: var(--md-sys-color-error);
    color: var(--md-sys-color-on-error);
}

.btn-danger:hover {
    background: var(--cds-btn-danger-hover);
    box-shadow: none;
}

.btn-secondary {
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
    border: 1px solid var(--md-sys-color-outline);
}

.btn-secondary:hover {
    background: var(--cds-btn-secondary-hover);
    box-shadow: none;
}

.btn-small {
    padding: 0.375rem 1rem;
    font-size: 0.75rem;
    min-height: 2rem;
}

.btn:disabled,
.btn[disabled] {
    opacity: 0.25;
    cursor: not-allowed;
    pointer-events: none;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

th {
    background: var(--md-sys-color-surface-container-high);
    font-weight: 600;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.75rem;
    letter-spacing: 0.16px;
    text-transform: uppercase;
}

td {
    color: var(--md-sys-color-on-surface);
    font-size: 0.875rem;
}

tr:hover {
    background: var(--md-sys-color-surface-container-highest);
}

/* Toast Notification System */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: var(--cds-notification-bg);
    color: var(--cds-notification-text-body);
    padding: 0.875rem 1rem;
    border-radius: 0;
    box-shadow: var(--md-sys-elevation-2);
    border: 1px solid var(--cds-notification-border);
    border-left: 3px solid var(--md-sys-color-on-surface-variant);
    min-width: 320px;
    max-width: 400px;
    pointer-events: auto;
    animation: toastSlideIn 0.3s ease;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.toast.removing {
    animation: toastSlideOut 0.3s ease forwards;
}

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

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

.toast-icon {
    font-size: 1.125rem;
    flex-shrink: 0;
    margin-top: 1px;
    color: var(--md-sys-color-on-surface-variant);
}

.toast-content {
    flex: 1;
    font-size: 0.875rem;
    line-height: 1.25rem;
}

.toast-timestamp {
    font-size: 0.75rem;
    line-height: 1rem;
    letter-spacing: 0.32px;
    color: var(--md-sys-color-on-surface-variant);
    font-variant-numeric: tabular-nums;
}

.toast-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.375rem;
    gap: 0.5rem;
}

.toast-content strong {
    color: var(--cds-notification-text-title);
    font-weight: 600;
}

.toast-close {
    background: none;
    border: none;
    color: var(--cds-notification-close);
    cursor: pointer;
    padding: 2px;
    font-size: 1.125rem;
    line-height: 1;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s;
    flex-shrink: 0;
    margin-top: -2px;
}

.toast-close:hover {
    color: var(--cds-notification-close-hover);
}

.toast-device-link {
    color: var(--cds-link-color);
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 2px;
    cursor: pointer;
}

.toast-device-link:hover {
    text-decoration-style: solid;
}

.toast-mute-btn {
    margin-left: auto;
    padding: 0.125rem 0.5rem;
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 0.6875rem;
    font-weight: 500;
    background: transparent;
    border: 1px solid currentColor;
    border-radius: 0;
    color: inherit;
    opacity: 0.55;
    cursor: pointer;
    transition: opacity 0.15s;
    white-space: nowrap;
}

.toast-mute-btn:hover {
    opacity: 1;
}

.toast-sev-label {
    font-size: 0.75rem;
    opacity: 0.7;
    font-weight: 400;
}

.toast.success {
    border-left: 3px solid var(--md-sys-color-success);
}

.toast.success .toast-icon {
    color: var(--md-sys-color-success);
}

.toast.error {
    border-left: 3px solid var(--md-sys-color-error);
}

.toast.error .toast-icon {
    color: var(--md-sys-color-error);
}

.toast.info {
    border-left: 3px solid var(--md-sys-color-info);
}

.toast.info .toast-icon {
    color: var(--md-sys-color-info);
}

.toast.warning {
    border-left: 3px solid var(--md-sys-color-warning);
}

.toast.warning .toast-icon {
    color: var(--md-sys-color-warning);
}

/* Status Indicators */
.status {
    padding: 0.125rem 0.5rem;
    border-radius: 10000px;
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0.32px;
    display: inline-block;
}

.status-connected {
    background: var(--md-sys-color-success-container);
    color: var(--md-sys-color-success);
}

.status-online {
    background: var(--md-sys-color-success-container);
    color: var(--md-sys-color-success);
}

.status-offline {
    background: var(--md-sys-color-error-container);
    color: var(--md-sys-color-error);
}

.status-unknown {
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-surface-variant);
}

.status-disconnected {
    background: var(--md-sys-color-error-container);
    color: var(--md-sys-color-error);
}

/* Latency display */
.latency {
    font-family: 'IBM Plex Mono', 'Courier New', monospace;
    font-size: 0.75rem;
    color: var(--md-sys-color-on-surface-variant);
}

.latency-offline {
    color: var(--md-sys-color-outline);
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 0.5rem;
}

.status-indicator.active {
    background: var(--md-sys-color-success);
    animation: pulse 2s infinite;
}

.status-indicator.inactive {
    background: var(--md-sys-color-outline);
}

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

/* Badges */
.badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 10000px;
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0.32px;
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
}

/* Grid Utilities */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--md-sys-color-on-surface-variant);
}

.loading {
    text-align: center;
    color: var(--md-sys-color-on-surface-variant);
    font-style: italic;
}

/* Actions */
.actions {
    display: flex;
    gap: 0.5rem;
}

/* Navigation Menu - Carbon Side Nav */
.nav-toggle {
    background: none;
    border: none;
    color: var(--cds-header-text);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s;
    z-index: 1001;
    border-radius: 0;
    height: var(--cds-header-height);
}

.nav-toggle:hover {
    background: #353535;
    color: var(--cds-header-text);
}

.nav-menu {
    position: fixed;
    top: var(--cds-header-height);
    left: calc(-1 * var(--cds-side-nav-width));
    width: var(--cds-side-nav-width);
    height: calc(100vh - var(--cds-header-height));
    background: var(--cds-nav-bg);
    box-shadow: none;
    transition: left 0.15s ease;
    z-index: 7000;
    overflow-y: auto;
    border-right: 1px solid var(--md-sys-color-outline-variant);
}

.nav-menu.open {
    left: 0;
}

.nav-menu.pinned {
    left: 0;
    box-shadow: none;
}

.nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1rem;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    background: var(--cds-nav-bg);
}

.nav-header h3 {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--md-sys-color-on-surface);
    text-transform: uppercase;
    letter-spacing: 0.32px;
}

.nav-controls {
    display: flex;
    gap: 0.5rem;
}

.nav-pin-btn, .nav-close-btn {
    background: none;
    border: none;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 1rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    transition: background-color 0.15s;
    border-radius: 0;
}

.nav-pin-btn:hover, .nav-close-btn:hover {
    background: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-primary);
}

.nav-pin-btn.pinned {
    color: var(--md-sys-color-primary);
}

.nav-content {
    padding: 1rem 0;
}

.nav-group {
    margin-bottom: 1.5rem;
}

.nav-group-title {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--md-sys-color-on-surface-variant);
    text-transform: uppercase;
    letter-spacing: 0.32px;
}

.nav-item {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--md-sys-color-on-surface);
    text-decoration: none;
    transition: background-color 0.15s;
    border-left: 3px solid transparent;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
}

.nav-item:hover {
    background: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-on-surface);
    border-left-color: transparent;
}

.nav-item.active {
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-primary);
    border-left-color: var(--md-sys-color-primary);
    font-weight: 600;
}

.nav-item .icon {
    font-size: 1.25rem;
    width: 1.5rem;
    text-align: center;
}

.nav-submenu {
    background: var(--md-sys-color-surface);
    border-left: 2px solid var(--md-sys-color-outline-variant);
    margin-left: 1.5rem;
}

.nav-submenu .nav-item {
    padding-left: 2.5rem;
    font-size: 0.875rem;
}

.nav-overlay {
    position: fixed;
    top: var(--cds-header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--cds-overlay);
    z-index: 6999;
    display: none;
}

.nav-overlay.visible {
    display: block;
}

/* Adjust layout when menu is pinned */
body.nav-pinned {
    margin-left: var(--cds-side-nav-width);
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
        padding-top: calc(var(--cds-header-height) + 1rem);
    }

    .grid-2, .grid-3 {
        grid-template-columns: 1fr;
    }

    .header {
        /* Already fixed position in base style */
    }

    .header-actions {
        flex-wrap: wrap;
    }

    .nav-menu {
        width: 256px;
        left: -256px;
    }

    body.nav-pinned {
        margin-left: 0;
    }
}

/* Syslog-specific styles */
.filters {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-group label {
    font-size: 0.875rem;
    color: var(--md-sys-color-on-surface-variant);
    letter-spacing: 0.16px;
    white-space: nowrap;
}

.filter-group input, .filter-group select {
    padding: 0.5rem;
    border: none;
    border-bottom: 1px solid var(--md-sys-color-outline);
    border-radius: 0;
    background: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-on-surface);
    font-size: 0.875rem;
    min-width: 150px;
}

.filter-group input:focus, .filter-group select:focus {
    outline: none;
    border-bottom: 2px solid var(--md-sys-color-primary);
    box-shadow: none;
}

.autocomplete-wrapper {
    position: relative;
    display: inline-block;
}

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--md-sys-color-surface-container-low);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 0;
    max-height: 250px;
    overflow-y: auto;
    z-index: 1000;
    margin-top: 0;
    box-shadow: var(--md-sys-elevation-2);
    display: none;
}

.autocomplete-dropdown.active {
    display: block;
}

.autocomplete-item {
    padding: 0.6rem 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    transition: background 0.2s;
}

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

.autocomplete-item:hover, .autocomplete-item.selected {
    background: var(--md-sys-color-surface-container-highest);
}

.autocomplete-item-name {
    color: var(--md-sys-color-on-surface);
    font-size: 0.875rem;
}

.autocomplete-item-ip {
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.75rem;
    margin-left: 0.5rem;
}

.log-viewer {
    background: var(--md-sys-color-surface-container);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 0;
    padding: 0;
    max-height: 600px;
    overflow-y: auto;
    font-family: 'IBM Plex Mono', 'Courier New', monospace;
    font-size: 0.75rem;
}

.log-entry {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    border-left: 3px solid transparent;
    display: grid;
    grid-template-columns: 160px 140px 150px 1fr auto;
    gap: 0.75rem;
    align-items: center;
    transition: background 0.2s, opacity 0.2s;
    animation: slideIn 0.3s ease;
    cursor: pointer;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.log-entry:hover {
    background: var(--md-sys-color-surface-container-high);
}

.log-entry.new {
    background: var(--md-sys-color-primary-container);
}

.log-timestamp {
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.75rem;
}

/* CDS-style left border strip per severity */
.log-entry.severity-emergency,
.log-entry.severity-alert,
.log-entry.severity-critical {
    border-left-color: var(--md-sys-color-error);
}

.log-entry.severity-error {
    border-left-color: var(--md-sys-color-error);
}

.log-entry.severity-warning {
    border-left-color: var(--md-sys-color-warning);
}

.log-entry.severity-notice,
.log-entry.severity-informational {
    border-left-color: var(--md-sys-color-success);
}

.log-entry.severity-debug {
    border-left-color: var(--md-sys-color-info);
}

.log-host {
    color: var(--md-sys-color-success);
    font-weight: 600;
}

.log-ip {
    color: var(--md-sys-color-primary);
    font-size: 0.875rem;
}

.log-ip .device-link {
    color: var(--md-sys-color-primary);
    text-decoration: none;
    font-weight: 600;
}

.log-ip .device-link:hover {
    text-decoration: underline;
}

.log-message {
    color: var(--md-sys-color-on-surface);
    word-break: break-word;
}

/* Muted log entry */
.log-entry--muted {
    opacity: 0.45;
}

.log-entry--muted:hover {
    opacity: 0.7;
}

.log-muted-badge {
    font-size: 0.6875rem;
    line-height: 1rem;
    letter-spacing: 0.32px;
    color: var(--cds-muted-text, var(--md-sys-color-on-surface-variant));
    background: var(--md-sys-color-surface-container-high);
    padding: 0.125rem 0.5rem;
    border-radius: 10000px;
    white-space: nowrap;
}

.log-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.log-mute-btn {
    font-size: 0.75rem;
    line-height: 1rem;
    letter-spacing: 0.32px;
    padding: 0.25rem 0.625rem;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 4px;
    background: transparent;
    color: var(--md-sys-color-on-surface-variant);
    cursor: pointer;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.15s, background 0.15s;
}

.log-entry:hover .log-mute-btn {
    opacity: 1;
}

.log-mute-btn:hover {
    background: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-on-surface);
}

.log-mute-btn:disabled {
    cursor: default;
    opacity: 0.5;
}

.whois-content {
    font-family: 'IBM Plex Mono', 'Courier New', monospace;
    font-size: 0.75rem;
    line-height: 1.25rem;
    white-space: pre-wrap;
    color: var(--md-sys-color-on-surface-variant);
    background: var(--md-sys-color-surface-container);
    padding: 1rem;
    border-radius: 0;
    border: 1px solid var(--md-sys-color-outline-variant);
    max-height: 500px;
    overflow-y: auto;
}

.whois-content .loading {
    text-align: center;
    color: var(--md-sys-color-on-surface-variant);
    font-style: italic;
    font-family: 'IBM Plex Sans', sans-serif;
}

.ip-link {
    color: var(--md-sys-color-primary);
    text-decoration: underline;
    cursor: pointer;
    transition: color 0.2s ease;
}

.ip-link:hover {
    color: var(--md-sys-color-on-primary-container);
}

/* Modal Styles */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--cds-overlay);
    z-index: 1000;
    backdrop-filter: none;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.modal-overlay.active {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

.modal {
    background: var(--md-sys-color-surface-container-low);
    border-radius: 0;
    padding: 0;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--md-sys-elevation-4);
    transform: translateY(16px);
    transition: transform 0.15s ease;
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    padding: 1rem 1.5rem;
    background: var(--md-sys-color-surface-container);
}

.modal-header h2 {
    margin: 0;
    color: var(--md-sys-color-on-surface);
    font-size: 1rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    transition: background-color 0.15s;
    border-radius: 0;
}

.modal-close:hover {
    background: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-on-surface);
}

.modal-body, .modal form {
    padding: 1.5rem;
}


/* Raw Output Section */
.raw-output-section {
    margin-top: 1rem;
}

.raw-output-section details {
    margin-bottom: 1rem;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 8px;
    padding: 0.5rem;
}

.raw-output-section summary {
    cursor: pointer;
    padding: 0.5rem;
    font-weight: 600;
    user-select: none;
}

.raw-output-section summary:hover {
    background-color: var(--md-sys-color-surface-container);
}

.raw-output {
    margin: 1rem 0 0 0;
    padding: 1rem;
    background-color: var(--cds-raw-output-bg);
    color: var(--cds-raw-output-text);
    border-radius: 0;
    font-family: 'IBM Plex Mono', 'Courier New', Courier, monospace;
    font-size: 0.75rem;
    line-height: 1rem;
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Device Page Grid Layout */
.device-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 20px;
    background: var(--md-sys-color-surface-container-low);
    border-radius: 0;
    box-shadow: none;
    border: 1px solid var(--md-sys-color-outline-variant);
}

.device-header > div {
    display: flex;
    align-items: center;
    gap: 12px;
}

.device-header h2 {
    margin: 0;
    font-size: 1.75rem;
    color: var(--md-sys-color-on-surface);
    display: flex;
    align-items: center;
    gap: 8px;
}

.edit-icon {
    cursor: pointer;
    font-size: 1rem;
    opacity: 0.6;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.edit-icon:hover {
    opacity: 1;
    transform: scale(1.1);
}

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

.grid-panel {
    background: var(--md-sys-color-surface-container-low);
    border-radius: 0;
    padding: 20px;
    box-shadow: none;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--md-sys-color-outline-variant);
}

.grid-panel h3 {
    margin: 0 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--md-sys-color-outline-variant);
    font-size: 1.25rem;
    color: var(--md-sys-color-on-surface);
}

.grid-panel .table-container {
    flex: 1;
    overflow-y: auto;
    max-height: 500px;
}

/* Info panel - full width at top */
.info-panel {
    grid-column: 1 / -1;
}

/* Interfaces and VLANs side by side */
.interfaces-panel {
    grid-column: 1;
}

.vlans-panel {
    grid-column: 2;
}

/* Modules and Neighbors */
.modules-panel {
    grid-column: 1;
}

.neighbors-panel {
    grid-column: 2;
}

/* Raw output full width at bottom */
.raw-panel {
    grid-column: 1 / -1;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    .device-grid {
        grid-template-columns: 1fr;
    }
    
    .interfaces-panel,
    .vlans-panel,
    .modules-panel,
    .neighbors-panel {
        grid-column: 1;
    }
}

/* Scrollable tables in grid panels */
.grid-panel table {
    width: 100%;
    font-size: 0.875rem;
}

.grid-panel tbody tr:hover {
    background-color: var(--cds-row-hover);
}

/* Info grid within info panel */
.grid-panel .info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.grid-panel .info-grid .info-item {
    padding: 12px;
    background: var(--md-sys-color-surface-container);
    border-radius: 8px;
}

.grid-panel .info-grid .info-label {
    font-size: 0.75rem;
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.32px;
    font-weight: 400;
}

.grid-panel .info-grid .info-value {
    font-size: 0.875rem;
    color: var(--md-sys-color-on-surface);
    font-weight: 400;
}

/* Backup Panel Styles */
.backup-panel {
    grid-column: span 2;
}

.backup-actions {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.backups-list table {
    width: 100%;
}

.backups-list td.actions-cell {
    display: flex;
    gap: 0.5rem;
}

/* Device List Table Styles */
#deviceList table {
    width: 100%;
    border-collapse: collapse;
    background: var(--md-sys-color-surface-container-low);
}

#deviceList table thead {
    background: var(--md-sys-color-surface-container-high);
    position: sticky;
    top: 0;
    z-index: 10;
}

#deviceList table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: var(--md-sys-color-on-surface);
    border-bottom: 2px solid var(--md-sys-color-outline-variant);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.32px;
}

#deviceList table td {
    padding: 12px;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.875rem;
}

#deviceList table tbody tr:hover {
    background: var(--md-sys-color-surface-container);
    cursor: pointer;
}

#deviceList table tbody tr td:first-child {
    color: var(--md-sys-color-on-surface);
    font-weight: 600;
}

.actions-cell {
    white-space: nowrap;
}

.actions-cell .btn {
    margin-right: 4px;
    display: inline-block;
}

.actions-cell .btn:last-child {
    margin-right: 0;
}

.btn-sm {
    padding: 6px 10px;
    font-size: 0.75rem;
    min-width: auto;
    line-height: 1rem;
}

/* Drag and Drop Reordering */
.drag-handle-cell {
    width: 40px;
    text-align: center;
    padding: 8px 4px !important;
}

.drag-handle {
    cursor: grab;
    color: var(--md-sys-color-outline);
    padding: 4px 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.15s ease;
    user-select: none;
}

.drag-handle:hover {
    background: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-on-surface);
}

.drag-handle:active {
    cursor: grabbing;
}

.drag-handle .carbon-icon {
    width: 1.25rem;
    height: 1.25rem;
}

#deviceList table tbody tr.dragging {
    opacity: 0.5;
    background: var(--md-sys-color-primary-container);
}

#deviceList table tbody tr.drag-over {
    border-top: 2px solid var(--md-sys-color-primary);
}

#deviceList table tbody tr.drag-over-below {
    border-bottom: 2px solid var(--md-sys-color-primary);
}

/* VLAN Matrix Styles */
/* ==================================================================
   Card Header - Carbon structured header
   ================================================================== */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.card-header h2 {
    margin: 0;
}

.card-header-title {
    flex: 1;
}

.card-header-title h2 {
    margin-bottom: 0.25rem;
}

.card-header-description {
    font-size: 0.875rem;
    color: var(--md-sys-color-on-surface-variant);
    letter-spacing: 0.16px;
    line-height: 1.25rem;
    margin: 0;
}

.card-header-count {
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--md-sys-color-on-surface-variant);
}

.vlan-check-indicator {
    color: var(--md-sys-color-success);
    font-weight: 600;
}

/* CDS Tag (inline label) */
.cds-tag {
    display: inline-flex;
    align-items: center;
    padding: 0 0.5rem;
    height: 1.5rem;
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0.32px;
    border-radius: 24px;
    margin-left: 0.25rem;
    vertical-align: middle;
}

.cds-tag--red {
    background: var(--md-sys-color-error-container);
    color: var(--md-sys-color-on-error-container);
}

/* ==================================================================
   VLAN Matrix - Carbon Data Table
   ================================================================== */
.vlan-matrix-container {
    overflow: hidden;
}

.vlan-matrix-wrapper {
    overflow-x: auto;
    max-width: 100%;
    border: 1px solid var(--md-sys-color-outline-variant);
}

.vlan-matrix {
    border-collapse: collapse;
    min-width: 100%;
    font-size: 0.875rem;
}

.vlan-matrix th,
.vlan-matrix td {
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    border-right: 1px solid var(--md-sys-color-outline-variant);
}

.vlan-matrix th:last-child,
.vlan-matrix td:last-child {
    border-right: none;
}

.vlan-matrix .device-header {
    position: sticky;
    left: 0;
    background: var(--md-sys-color-surface-container-high);
    z-index: 2;
    white-space: nowrap;
    padding: 0.5rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    letter-spacing: 0.16px;
    text-transform: uppercase;
    color: var(--md-sys-color-on-surface-variant);
    vertical-align: bottom;
}

.vlan-matrix .vlan-header {
    padding: 0.25rem 0;
    text-align: center;
    width: 2rem;
    min-width: 2rem;
    max-width: 2rem;
    height: 3.5rem;
    font-weight: 400;
    font-size: 0.75rem;
    letter-spacing: 0.16px;
    color: var(--md-sys-color-on-surface-variant);
    background: var(--md-sys-color-surface-container-high);
    position: relative;
    vertical-align: bottom;
    overflow: hidden;
}

.vlan-matrix .vlan-header.global-vlan {
    background: var(--md-sys-color-surface-container-high);
}

.vlan-matrix .vlan-header.unknown-vlan {
    background: var(--md-sys-color-error-container);
    color: var(--md-sys-color-on-error-container);
}

.vlan-matrix .vlan-header .vlan-id {
    font-weight: 600;
    font-size: 0.75rem;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    white-space: nowrap;
    display: inline-block;
    line-height: 1;
    letter-spacing: 0.16px;
}

.vlan-matrix .device-cell {
    position: sticky;
    left: 0;
    background: var(--md-sys-color-surface);
    z-index: 1;
    white-space: nowrap;
    padding: 0.5rem 1rem;
    height: 2.5rem;
    vertical-align: middle;
}

.vlan-matrix tbody tr:hover .device-cell {
    background: var(--md-sys-color-surface-container);
}

.vlan-matrix .device-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--md-sys-color-on-surface);
    white-space: nowrap;
    line-height: 1.125rem;
}

.vlan-matrix .device-info {
    font-size: 0.75rem;
    color: var(--md-sys-color-on-surface-variant);
    white-space: nowrap;
    line-height: 1rem;
    letter-spacing: 0.32px;
}

/* Fix All button in device cell */
.fix-all-btn {
    margin-top: 0.25rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0.16px;
    background: var(--md-sys-color-warning);
    color: var(--md-sys-color-on-warning);
    border: none;
    border-radius: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    transition: background-color 0.15s ease;
}

.fix-all-btn:hover {
    background: var(--md-sys-color-warning-container);
    color: var(--md-sys-color-on-surface);
}

.fix-all-btn:active {
    background: var(--md-sys-color-warning-container);
}

.vlan-matrix .vlan-cell {
    text-align: center;
    vertical-align: middle;
    padding: 0;
    width: 2rem;
    min-width: 2rem;
    max-width: 2rem;
    height: 2.5rem;
    transition: background-color 0.15s ease;
}

.vlan-matrix .vlan-cell.has-vlan {
    background: var(--md-sys-color-success-container);
}

.vlan-matrix .vlan-cell.has-vlan.unknown {
    background: var(--md-sys-color-tertiary-container);
}

.vlan-matrix .vlan-cell.no-vlan {
    background: var(--md-sys-color-surface);
}

.vlan-matrix .vlan-cell .check-mark {
    color: var(--md-sys-color-success);
    font-weight: 600;
    font-size: 0.75rem;
    line-height: 1;
}

.vlan-matrix .vlan-cell.unknown .check-mark {
    color: var(--md-sys-color-tertiary);
}

.vlan-matrix tbody tr:hover {
    background: var(--md-sys-color-surface-container);
}

/* Quick add button in header */
.quick-add-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    border-radius: 0;
    border: none;
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s ease;
}

.quick-add-btn:hover {
    background: var(--cds-btn-primary-hover);
    color: var(--md-sys-color-on-primary);
}

/* Matrix Legend - Carbon structured list style */
.matrix-legend {
    display: flex;
    gap: 1rem;
    padding: 0.75rem 1rem;
    margin-top: 0;
    border-top: none;
    background: var(--md-sys-color-surface-container-high);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-top: none;
    flex-wrap: wrap;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--md-sys-color-on-surface-variant);
    letter-spacing: 0.32px;
}

.legend-color {
    width: 1rem;
    height: 1rem;
    border-radius: 0;
    border: 1px solid var(--md-sys-color-outline-variant);
    flex-shrink: 0;
}

.legend-color.global-present {
    background: var(--md-sys-color-success-container);
}

.legend-color.unknown-present {
    background: var(--md-sys-color-tertiary-container);
}

.legend-color.missing {
    background: var(--md-sys-color-surface);
}

.legend-color.name-mismatch-legend {
    background: linear-gradient(135deg, var(--md-sys-color-success-container) 50%, var(--md-sys-color-warning) 50%);
}

/* Name mismatch cell styling */
.vlan-matrix .vlan-cell.name-mismatch {
    background: linear-gradient(135deg, var(--md-sys-color-success-container) 50%, rgba(241, 194, 27, 0.3) 50%);
    cursor: pointer;
}

.vlan-matrix .vlan-cell.name-mismatch:hover {
    background: linear-gradient(135deg, var(--md-sys-color-success-container) 50%, rgba(241, 194, 27, 0.5) 50%);
}

/* Name fix button in cell */
.name-fix-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.name-fix-btn .warning-icon {
    font-size: 1rem;
    line-height: 1;
    animation: pulse-warning 2s infinite;
}

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

/* Spinning animation for refresh buttons */
.spinning {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Credential selector in device details */
.credential-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.credential-dropdown {
    flex: 1;
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--md-sys-color-outline);
    border-radius: 4px;
    background: var(--md-sys-color-surface);
    color: var(--md-sys-color-on-surface);
    font-size: 0.875rem;
    min-width: 150px;
}

.credential-dropdown:focus {
    outline: none;
    border-color: var(--md-sys-color-primary);
}

.btn-small {
    padding: 0.3rem 0.5rem;
    min-width: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-small .carbon-icon {
    width: 1.25rem;
    height: 1.25rem;
}

.credential-item {
    grid-column: span 2;
}

/* Add VLAN button in matrix cell */
.add-vlan-btn {
    background: transparent;
    border: 1px dashed var(--md-sys-color-outline);
    border-radius: 0;
    color: var(--md-sys-color-outline);
    cursor: pointer;
    padding: 0;
    width: 1rem;
    height: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.add-vlan-btn:hover {
    background: var(--md-sys-color-primary);
    border-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
}

.add-vlan-btn .carbon-icon {
    width: 0.75rem;
    height: 0.75rem;
}

/* Make the cell show the button on hover */
.vlan-cell.no-vlan {
    position: relative;
}

.vlan-cell.no-vlan .add-vlan-btn {
    opacity: 0.4;
}

.vlan-cell.no-vlan:hover .add-vlan-btn {
    opacity: 1;
}

/* VLAN color swatches */
.vlan-color-swatch {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border-radius: 0;
    border: 1px solid var(--md-sys-color-outline-variant);
    vertical-align: middle;
}

.vlan-header-swatch {
    display: none;
}

.vlan-matrix .vlan-header[style*="--vlan-color"]::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--vlan-color);
}

/* VLAN config name code block */
.vlan-config-name {
    background: var(--md-sys-color-surface-container-highest);
    padding: 0.125rem 0.5rem;
    border-radius: 0;
    font-size: 0.75rem;
    font-family: 'IBM Plex Mono', 'Courier New', monospace;
    letter-spacing: 0.32px;
}

/* Muted text helper */
.text-muted {
    color: var(--md-sys-color-on-surface-variant);
    opacity: 0.6;
}

/* Form label helper text */
.form-label-helper {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--md-sys-color-on-surface-variant);
    letter-spacing: 0.32px;
}

/* Toggle label for checkboxes in forms */
.toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 500;
}

/* Read-only form input */
.form-input-readonly {
    background: var(--md-sys-color-surface-container) !important;
    cursor: not-allowed;
    opacity: 0.7;
}

/* VLAN color picker row */
.vlan-color-picker {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.color-input {
    width: 3rem;
    height: 2rem;
    border: 1px solid var(--md-sys-color-outline);
    border-radius: 0;
    cursor: pointer;
    padding: 0.125rem;
    background: transparent;
}

.color-hex-input {
    width: 5.5rem;
    font-family: 'IBM Plex Mono', 'Courier New', monospace;
    font-size: 0.875rem;
    letter-spacing: 0.32px;
}

/* Modal actions bar */
.modal-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    padding-top: 1.5rem;
    border-top: 1px solid var(--md-sys-color-outline-variant);
    margin-top: 0.5rem;
}

/* ====================================================
   Device Page Layout - Sidebar & Topbar
   ==================================================== */

.device-page-layout {
    margin: 0;
    padding: 0;
    overflow: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Device Top Bar */
.device-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 48px;
    background: var(--cds-header-bg);
    border-bottom: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 100;
    box-shadow: none;
    color: var(--cds-header-text);
}

/* Carbon-style inline loading bar */
.loading-bar {
    position: fixed;
    top: 48px;
    left: 0;
    right: 0;
    height: 3px;
    z-index: 101;
    background: transparent;
    pointer-events: none;
    overflow: hidden;
}
.loading-bar.active {
    background: var(--cds-border-subtle, #e0e0e0);
}
.loading-bar.active::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 40%;
    background: var(--cds-interactive, #0f62fe);
    animation: loading-bar-move 1.2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
@keyframes loading-bar-move {
    0%   { left: -40%; width: 40%; }
    50%  { left: 30%;  width: 50%; }
    100% { left: 100%; width: 10%; }
}

.device-topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.device-back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 0;
    background: transparent;
    color: var(--cds-header-text);
    text-decoration: none;
    transition: background-color 0.15s;
}

.device-back-btn:hover {
    background: #353535;
}

.device-topbar-info {
    display: flex;
    flex-direction: column;
}

.device-topbar-info h1 {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--cds-header-text);
    line-height: 1.125rem;
}

.device-topbar-ip {
    font-size: 0.75rem;
    color: #78a9ff;
    font-family: 'IBM Plex Mono', Monaco, monospace;
    text-decoration: none;
    transition: color 0.15s;
}

.device-topbar-ip:hover {
    color: #a6c8ff;
    text-decoration: underline;
}

.device-topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 400;
    text-transform: uppercase;
}

.status-badge.status-online {
    background: var(--md-sys-color-success-container);
    color: var(--md-sys-color-success);
}

.status-badge.status-offline {
    background: var(--md-sys-color-error-container);
    color: var(--md-sys-color-error);
}

.status-badge.status-unknown {
    background: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-on-surface-variant);
}

/* Device Layout Container */
.device-layout {
    display: flex;
    margin-top: 48px;
    height: calc(100vh - 48px);
    overflow: hidden;
}

/* Device Sidebar */
.device-sidebar {
    width: 240px;
    min-width: 240px;
    height: 100%;
    background: var(--md-sys-color-surface-container-lowest);
    border-right: 1px solid var(--md-sys-color-outline-variant);
    display: flex;
    flex-direction: column;
    position: relative;
    transition: width 0.2s ease, min-width 0.2s ease;
    overflow: hidden;
}

.device-sidebar.collapsed {
    width: 60px;
    min-width: 60px;
}

.sidebar-toggle {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border: none;
    background: var(--md-sys-color-surface-container);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, background 0.2s;
    z-index: 10;
}

.sidebar-toggle:hover {
    background: var(--md-sys-color-surface-container-high);
}

.device-sidebar.collapsed .sidebar-toggle {
    right: 14px;
}

.device-sidebar.collapsed .sidebar-toggle .carbon-icon {
    transform: rotate(180deg);
}

.sidebar-nav {
    padding: 60px 12px 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
}

.sidebar-section {
    margin-bottom: 16px;
}

.sidebar-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--md-sys-color-on-surface-variant);
    text-transform: uppercase;
    letter-spacing: 0.32px;
    padding: 8px 12px 4px;
    display: block;
    white-space: nowrap;
    overflow: hidden;
}

.device-sidebar.collapsed .sidebar-section-title {
    opacity: 0;
    height: 0;
    padding: 0;
    margin: 0;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 0;
    color: var(--md-sys-color-on-surface-variant);
    text-decoration: none;
    transition: background-color 0.15s;
    white-space: nowrap;
    position: relative;
}

.sidebar-link:hover {
    background: var(--md-sys-color-surface-container);
    color: var(--md-sys-color-on-surface);
}

.sidebar-link.active {
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-primary);
}

.sidebar-link .carbon-icon-container {
    flex-shrink: 0;
}

.sidebar-link .carbon-icon {
    width: 1.25rem;
    height: 1.25rem;
}

.sidebar-link-text {
    font-size: 0.875rem;
    font-weight: 400;
}

.device-sidebar.collapsed .sidebar-link-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.sidebar-badge {
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: auto;
}

.device-sidebar.collapsed .sidebar-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    font-size: 0.75rem;
    padding: 1px 4px;
}

/* Device Content Area */
.device-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    background: var(--md-sys-color-surface);
}

.content-section {
    background: var(--md-sys-color-surface-container-lowest);
    border-radius: 0;
    padding: 24px;
    box-shadow: none;
    display: none;
    height: calc(100% - 48px);
    overflow: auto;
    border: 1px solid var(--md-sys-color-outline-variant);
}

.content-section.active {
    display: block;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.section-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--md-sys-color-on-surface);
}

.section-actions {
    display: flex;
    gap: 8px;
}

/* Info Cards Grid */
.info-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.info-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--md-sys-color-surface-container);
    border-radius: 0;
    transition: background 0.15s;
}

.info-card:hover {
    background: var(--md-sys-color-surface-container-high);
}

.info-card-icon {
    font-size: 1.5rem;
    color: var(--md-sys-color-primary);
}

.info-card-content {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.info-card-label {
    font-size: 0.75rem;
    color: var(--md-sys-color-on-surface-variant);
    text-transform: uppercase;
    letter-spacing: 0.32px;
}

.info-card-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--md-sys-color-on-surface);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Editable Info Cards */
.info-card.editable {
    cursor: pointer;
    position: relative;
}

.info-card.editable:hover {
    background: var(--md-sys-color-primary-container);
}

.info-card-edit {
    display: none;
    font-size: 1.25rem;
    color: var(--md-sys-color-on-surface-variant);
    margin-left: auto;
}

.info-card.editable:hover .info-card-edit {
    display: block;
}

/* Config health warning card */
.info-card.warning {
    border-left: 3px solid var(--status-offline-color, #da1e28);
}

.info-card.warning:hover {
    background: color-mix(in srgb, var(--status-offline-color, #da1e28) 8%, var(--md-sys-color-surface-container));
}

/* Credential Section */
.credential-section {
    padding-top: 16px;
    border-top: 1px solid var(--md-sys-color-outline-variant);
}

.credential-section label {
    display: block;
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: 8px;
}

.credential-selector {
    display: flex;
    gap: 8px;
    align-items: center;
}

.credential-dropdown {
    flex: 1;
    max-width: 300px;
}

/* Empty State */
.empty-state {
    color: var(--md-sys-color-on-surface-variant);
    font-style: italic;
    text-align: center;
    padding: 32px;
}

/* Button Icon Only */
.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.btn-icon .carbon-icon {
    width: 1.25rem;
    height: 1.25rem;
}

/* ====================================================
   Terminal Styles (xterm.js)
   ==================================================== */

.terminal-container {
    display: flex;
    flex-direction: column;
    height: calc(100% - 80px);
    background: var(--cds-raw-output-bg);
    border-radius: 0;
    overflow: hidden;
    padding: 8px;
}

#xterm-container {
    flex: 1;
    width: 100%;
    height: 100%;
}

#xterm-container .xterm {
    height: 100%;
    padding: 8px;
}

#xterm-container .xterm-viewport {
    overflow-y: auto !important;
}

/* Override xterm.js terminal scrollbar */
#xterm-container .xterm-viewport::-webkit-scrollbar {
    width: 10px;
}

#xterm-container .xterm-viewport::-webkit-scrollbar-track {
    background: var(--cds-scrollbar-track);
}

#xterm-container .xterm-viewport::-webkit-scrollbar-thumb {
    background: var(--cds-scrollbar-thumb);
    border-radius: 5px;
}

#xterm-container .xterm-viewport::-webkit-scrollbar-thumb:hover {
    background: var(--cds-scrollbar-thumb-hover);
}

/* ====================================================
   Web UI Styles
   ==================================================== */

.webui-container {
    height: calc(100% - 80px);
    border-radius: 8px;
    overflow: hidden;
    background: var(--cds-webui-bg);
    border: 1px solid var(--md-sys-color-outline-variant);
}

.webui-frame {
    width: 100%;
    height: 100%;
    border: none;
}

.webui-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--md-sys-color-on-surface-variant);
    text-align: center;
    padding: 40px;
}

.webui-error .carbon-icon {
    width: 3rem;
    height: 3rem;
    margin-bottom: 16px;
    color: var(--md-sys-color-outline);
}

/* ====================================================
   Settings Cards
   ==================================================== */

.settings-cards {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.settings-card {
    background: var(--md-sys-color-surface);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 0;
    overflow: visible;
}

.settings-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--md-sys-color-surface-container-low);
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

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

.settings-card-title h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.settings-card-title .carbon-icon {
    width: 1.5rem;
    height: 1.5rem;
    color: var(--md-sys-color-primary);
}

.settings-card-title .material-symbols-outlined {
    font-size: 1.5rem;
    color: var(--md-sys-color-primary);
}

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

/* Syslog Settings */
.syslog-status {
    margin-bottom: 20px;
}

.status-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
}

.status-label {
    color: var(--md-sys-color-on-surface-variant);
    min-width: 140px;
}

.status-value {
    font-weight: 600;
}

.status-enabled {
    color: var(--md-sys-color-tertiary);
}

.status-disabled {
    color: var(--md-sys-color-error);
}

.syslog-hosts {
    margin-bottom: 20px;
}

.syslog-host-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: var(--md-sys-color-surface-container);
    border-radius: 0;
    margin-bottom: 8px;
}

.syslog-host-ip {
    font-family: 'IBM Plex Mono', Monaco, monospace;
    font-weight: 400;
}

.syslog-add-form {
    padding-top: 16px;
    border-top: 1px solid var(--md-sys-color-outline-variant);
}

.syslog-add-form label {
    display: block;
    font-weight: 400;
    margin-bottom: 8px;
}

.settings-card-body .input-group {
    display: flex;
    gap: 12px;
    margin-bottom: 8px;
}

.settings-card-body input[type="text"] {
    flex: 1;
    padding: 10px 14px;
    border: none;
    border-bottom: 1px solid var(--md-sys-color-outline);
    border-radius: 0;
    font-size: 0.875rem;
    background: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-on-surface);
    min-width: 0;
}

.settings-card-body input[type="text"]:focus {
    outline: none;
    border-bottom: 2px solid var(--md-sys-color-primary);
}

.settings-card-body .hint {
    font-size: 0.875rem;
    color: var(--md-sys-color-on-surface-variant);
    margin: 0;
}

.loading-inline {
    color: var(--md-sys-color-on-surface-variant);
    font-style: italic;
}

.error-inline {
    color: var(--md-sys-color-error);
}

.warning-inline {
    color: var(--md-sys-color-warning, #f59e0b);
}

.empty-state-small {
    color: var(--md-sys-color-on-surface-variant);
    font-style: italic;
    margin: 0;
    padding: 8px 0;
}

.btn-danger {
    background: var(--md-sys-color-error);
    color: var(--md-sys-color-on-error);
}

.btn-danger:hover {
    background: var(--md-sys-color-error-container);
    color: var(--md-sys-color-on-error-container);
}

/* Backup needed state */
.backup-needed {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
}

.backup-needed .btn {
    display: flex;
    align-items: center;
    gap: 8px;
}

.backup-info {
    font-size: 0.875rem;
    color: var(--md-sys-color-on-surface-variant);
    font-family: 'IBM Plex Mono', Monaco, monospace;
}

/* ========== PORT LAYOUT STYLES ========== */

.view-toggle {
    display: flex;
    gap: 4px;
    margin-right: 8px;
}

.view-toggle .btn {
    padding: 6px 8px;
}

.view-toggle .btn.active {
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
}

.interface-view {
    display: none;
}

.interface-view.active {
    display: block;
}

.port-layout-container {
    padding: 1rem;
    background: var(--md-sys-color-surface-container);
    border-radius: 0;
    overflow-x: auto;
}

.switch-chassis {
    display: inline-flex;
    flex-direction: row;
    gap: 16px;
    padding: 16px;
    background: var(--cds-chassis-bg);
    border-radius: 4px;
    border: 2px solid var(--cds-chassis-border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    min-width: fit-content;
}

/* Port groups container - horizontal layout */
.port-groups-container {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

/* Individual port group section */
.port-group-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.port-group-label {
    font-size: 0.75rem;
    color: var(--cds-port-group-label);
    text-transform: uppercase;
    letter-spacing: 0.32px;
    text-align: center;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--cds-port-group-border);
    margin-bottom: 4px;
}

.port-group-rows {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Column layout for groups (e.g. SFP+ ports in vertical pairs) */
.port-group-columns {
    display: flex;
    gap: 4px;
}

.port-column {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.port-row {
    display: flex;
    align-items: center;
    gap: 4px;
}

.port-row-label {
    min-width: 80px;
    font-size: 0.75rem;
    color: var(--cds-port-group-label);
    text-transform: uppercase;
    letter-spacing: 0.32px;
}

.port-group {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.port {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.port-rj45 {
    background: var(--cds-port-bg);
    border-color: var(--cds-port-border);
}

.port-sfp, .port-combo {
    background: var(--cds-port-sfp-bg);
    border-color: var(--cds-port-sfp-border);
    border-radius: 6px;
}

.port-qsfp {
    background: var(--cds-port-qsfp-bg);
    border-color: var(--cds-port-qsfp-border);
    width: 36px;
}

.port-up {
    border-color: var(--cds-status-online);
    box-shadow: 0 0 4px rgba(76, 175, 80, 0.4);
}

.port-down {
    opacity: 0.6;
    border-color: var(--cds-port-border);
}

.port-disabled {
    opacity: 0.35;
    border-color: var(--md-sys-color-error);
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 3px,
        rgba(218, 30, 40, 0.15) 3px,
        rgba(218, 30, 40, 0.15) 6px
    );
}

.port-access {
    background: var(--vlan-color, #444);
}

.port-trunk {
    background: var(--cds-port-trunk-gradient);
    background-size: 200% 200%;
}

.port-number {
    color: var(--port-text-color, var(--cds-port-text));
    text-shadow: none;
    z-index: 1;
}

/* port-led removed - using green border for up status instead */

.port:hover {
    transform: scale(1.15);
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* Live syslog port state change flash */
@keyframes port-state-flash {
    0%   { box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.8); transform: scale(1.15); z-index: 10; }
    60%  { box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.3); transform: scale(1.05); }
    100% { box-shadow: none; transform: scale(1); }
}

.port-state-changed {
    animation: port-state-flash 0.9s ease-out forwards;
    z-index: 10;
}

.port.selected {
    border-color: var(--md-sys-color-primary) !important;
    box-shadow: 0 0 0 3px rgba(94, 92, 113, 0.3);
    transform: scale(1.1);
}

.port-legend {
    display: flex;
    gap: 16px;
    margin-top: 16px;
    padding: 12px;
    background: var(--md-sys-color-surface-container-high);
    border-radius: 8px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--md-sys-color-on-surface-variant);
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 4px;
}

.legend-up {
    border: 2px solid var(--md-sys-color-success);
    background: var(--cds-port-bg);
}

.legend-down {
    background: var(--cds-port-bg);
    border: 2px solid var(--cds-port-border);
    opacity: 0.6;
}

.legend-trunk {
    background: var(--cds-port-trunk-gradient);
}

.legend-disabled {
    background: var(--cds-port-bg);
    border: 2px solid var(--md-sys-color-error);
    opacity: 0.4;
}

.legend-access {
    background: var(--cds-legend-access);
}

.port-legend.vlan-legend {
    margin-top: 8px;
    gap: 12px;
}

.vlan-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
}

/* VLAN Port Mapping Accordion */
.accordion {
    margin-top: 16px;
    background: var(--md-sys-color-surface-container);
    border-radius: 0;
    overflow: hidden;
    border: 1px solid var(--md-sys-color-outline-variant);
}

.accordion-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    cursor: pointer;
    font-weight: 600;
    color: var(--md-sys-color-on-surface);
    background: var(--md-sys-color-surface-container-high);
    transition: background-color 0.2s;
}

.accordion-header:hover {
    background: var(--md-sys-color-surface-container-highest);
}

.accordion-header .carbon-icon {
    width: 1.25rem;
    height: 1.25rem;
    transition: transform 0.2s;
}

.accordion-content {
    padding: 16px;
    max-height: 400px;
    overflow-y: auto;
}

.accordion-content.hidden {
    display: none;
}

.vlan-port-mapping {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.vlan-item {
    padding: 12px;
    background: var(--md-sys-color-surface-container-high);
    border-radius: 8px;
}

.vlan-header-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.vlan-color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.vlan-ports {
    font-size: 0.875rem;
    color: var(--md-sys-color-on-surface-variant);
    margin-left: 20px;
    line-height: 1.25rem;
}

.vlan-ports.tagged {
    font-style: italic;
    opacity: 0.8;
}

.vlan-ports.empty {
    color: var(--md-sys-color-on-surface-variant);
    opacity: 0.6;
}

.port-type-label {
    font-weight: 600;
    color: var(--md-sys-color-on-surface);
    margin-right: 4px;
}

.simple-port-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 16px;
    background: var(--cds-chassis-bg);
    border-radius: 4px;
}

.port-layout-fallback {
    text-align: center;
    color: var(--md-sys-color-on-surface-variant);
}

.port-layout-fallback p {
    margin-bottom: 1rem;
}

.port-mode {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 400;
    text-transform: uppercase;
}

.port-mode-access {
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
}

.port-mode-trunk {
    background: var(--cds-port-trunk-gradient-short);
    color: #fff;
}

.port-mode-general {
    background: var(--md-sys-color-tertiary-container);
    color: var(--md-sys-color-on-tertiary-container);
}

/* Port Selection Controls */
.port-selection-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 12px 0;
    padding: 8px 12px;
    background: var(--md-sys-color-surface-container);
    border-radius: 8px;
    flex-wrap: wrap;
}

.selection-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    border-radius: 16px;
    font-size: 0.75rem;
    font-weight: 600;
}

.selection-badge.hidden {
    display: none;
}

.port-selection-controls .btn-sm {
    font-size: 0.75rem;
    padding: 4px 10px;
}

.multi-select-info .port-info-value {
    font-size: 0.75rem;
    word-break: break-all;
}

/* Port Edit Panel */
.port-edit-panel {
    margin-top: 16px;
    background: var(--md-sys-color-surface-container);
    border-radius: 0;
    border: 1px solid var(--md-sys-color-outline-variant);
    overflow: hidden;
}

.port-edit-panel.hidden {
    display: none;
}

.port-edit-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--md-sys-color-surface-container-high);
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.port-edit-header h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 1rem;
    color: var(--md-sys-color-on-surface);
}

.port-edit-body {
    padding: 16px;
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

.port-edit-status {
    flex: 1;
    min-width: 200px;
}

.port-info-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.port-info-row:last-child {
    border-bottom: none;
}

.port-info-label {
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.875rem;
}

.port-info-value {
    font-weight: 600;
    color: var(--md-sys-color-on-surface);
}

.port-info-value.status-up {
    color: var(--md-sys-color-success);
}

.port-info-value.status-down {
    color: var(--md-sys-color-error);
}

.port-info-value.status-disabled {
    color: var(--md-sys-color-on-surface-variant);
    font-style: italic;
}

.port-edit-form {
    flex: 1;
    min-width: 250px;
}

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

.port-edit-form .form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--md-sys-color-on-surface);
}

.port-edit-form .form-control {
    width: 100%;
    padding: 10px 12px;
    border: none;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 0;
    background: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-on-surface);
    font-size: 0.875rem;
}

.port-edit-form .form-control:focus {
    outline: none;
    border-bottom: 2px solid var(--md-sys-color-primary);
    box-shadow: none;
}

.trunk-vlans-info {
    padding: 10px 12px;
    background: var(--md-sys-color-surface-container-high);
    border-radius: 8px;
    font-size: 0.875rem;
    color: var(--md-sys-color-on-surface-variant);
}

.port-edit-actions {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.port-shut-actions {
    display: flex;
    gap: 8px;
}

/* Port Config Notice */
.port-config-notice {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    margin-bottom: 16px;
    background: var(--md-sys-color-surface-container-high);
    border-radius: 0;
    border-left: 4px solid var(--md-sys-color-primary);
    font-size: 0.875rem;
    color: var(--md-sys-color-on-surface);
}

.port-config-notice .carbon-icon-container {
    color: var(--md-sys-color-primary);
    flex-shrink: 0;
}

.port-config-notice span:not(.carbon-icon-container) {
    flex: 1;
}

/* ==================== Network Topology ==================== */

.topology-container {
    padding: 0 !important;
    padding-top: var(--cds-header-height) !important;
    max-width: none !important;
}

.topology-card {
    margin: 0;
    border-radius: 0;
    height: calc(100vh - var(--cds-header-height));
    display: flex;
    flex-direction: column;
    border: none;
    box-shadow: none;
}

/* Toolbar */
.topology-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1rem;
    height: 48px;
    background: var(--md-sys-color-surface-container);
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    flex-shrink: 0;
}

.topology-toolbar-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.topology-toolbar-left h2 {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.16px;
    color: var(--md-sys-color-on-surface);
}

.topology-node-count {
    font-size: 0.75rem;
    color: var(--md-sys-color-on-surface-variant);
    background: var(--md-sys-color-surface-container-high);
    padding: 0.125rem 0.5rem;
    border-radius: 10000px;
}

.topology-toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.topology-toolbar-divider {
    width: 1px;
    height: 24px;
    background: var(--md-sys-color-outline-variant);
    margin: 0 0.25rem;
}

/* Toggle */
.topology-toggle {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    cursor: pointer;
    user-select: none;
}

.topology-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--md-sys-color-primary);
    cursor: pointer;
    margin: 0;
}

.topology-toggle-label {
    font-size: 0.75rem;
    color: var(--md-sys-color-on-surface-variant);
    white-space: nowrap;
}

/* Select */
.topology-select {
    height: 32px;
    padding: 0 2rem 0 0.75rem;
    font-size: 0.75rem;
    font-family: 'IBM Plex Sans', sans-serif;
    color: var(--md-sys-color-on-surface);
    background: var(--md-sys-color-surface-container-high);
    border: none;
    border-bottom: 1px solid var(--md-sys-color-outline);
    border-radius: 0;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 32 32'%3E%3Cpath fill='%23525252' d='M16 22L6 12l1.4-1.4 8.6 8.6 8.6-8.6L26 12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    cursor: pointer;
    outline: none;
    transition: border-color 0.15s, background-color 0.15s;
}

.topology-select:hover {
    background-color: var(--md-sys-color-surface-container-highest);
}

.topology-select:focus {
    border-bottom-color: var(--md-sys-color-primary);
}

/* Icon buttons */
.topology-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    color: var(--md-sys-color-on-surface);
    cursor: pointer;
    transition: background-color 0.15s;
}

.topology-icon-btn:hover {
    background: var(--md-sys-color-surface-container-high);
}

.topology-icon-btn:active {
    background: var(--md-sys-color-surface-container-highest);
}

.topology-icon-btn .carbon-icon-container,
.topology-icon-btn .carbon-icon {
    width: 1rem;
    height: 1rem;
}

.topology-btn-group {
    display: flex;
    gap: 0;
}

.topology-btn-group .topology-icon-btn {
    border-right: 1px solid var(--md-sys-color-outline-variant);
}

.topology-btn-group .topology-icon-btn:last-child {
    border-right: none;
}

/* Canvas */
.topology-canvas-wrapper {
    flex: 1;
    position: relative;
    background: var(--md-sys-color-surface-container-lowest);
    overflow: hidden;
}

#topologyCanvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* Loading */
.topology-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    background: var(--cds-topology-loading-bg);
    z-index: 10;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.875rem;
}

.topology-loading .spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--md-sys-color-outline-variant);
    border-top-color: var(--md-sys-color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Legend bar */
.topology-legend {
    display: flex;
    gap: 1.5rem;
    padding: 0.5rem 1rem;
    border-top: 1px solid var(--md-sys-color-outline-variant);
    background: var(--md-sys-color-surface-container);
    flex-shrink: 0;
    height: 36px;
    align-items: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    color: var(--md-sys-color-on-surface-variant);
    letter-spacing: 0.32px;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.legend-dot-unmanaged {
    opacity: 0.5;
    border: 1.5px dashed var(--md-sys-color-outline);
    width: 8px;
    height: 8px;
}
.legend-line-dashed {
    width: 20px;
    height: 0;
    border-top: 2px dashed var(--md-sys-color-outline);
}

/* Details Panel */
.topology-details-panel {
    position: fixed;
    top: var(--cds-header-height);
    right: -340px;
    width: 320px;
    max-height: calc(100vh - var(--cds-header-height));
    background: var(--md-sys-color-surface);
    border-radius: 0;
    border-left: 1px solid var(--md-sys-color-outline-variant);
    box-shadow: var(--md-sys-elevation-3);
    transition: right 0.15s ease;
    z-index: 100;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.topology-details-panel.visible {
    right: 0;
}

.details-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    background: var(--md-sys-color-surface-container);
    min-height: 48px;
}

.details-header h3 {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 240px;
    color: var(--md-sys-color-on-surface);
}

.details-close-btn {
    background: none;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    color: var(--md-sys-color-on-surface-variant);
    padding: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 0;
    transition: background-color 0.15s;
}

.details-close-btn:hover {
    background: var(--md-sys-color-surface-container-highest);
}

.details-content {
    padding: 1rem;
    overflow-y: auto;
    flex: 1;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.detail-label {
    font-size: 0.75rem;
    color: var(--md-sys-color-on-surface-variant);
    letter-spacing: 0.32px;
}

.detail-value {
    font-size: 0.875rem;
    font-weight: 600;
    text-align: right;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--md-sys-color-on-surface);
}

.detail-section {
    margin-top: 1rem;
    padding: 0.5rem 0;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--md-sys-color-primary);
    border-bottom: 1px solid var(--md-sys-color-primary);
    letter-spacing: 0.32px;
    text-transform: uppercase;
}

.detail-neighbor {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.375rem 0;
    font-size: 0.75rem;
    color: var(--md-sys-color-on-surface);
}

.neighbor-port {
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.75rem;
    font-family: 'IBM Plex Mono', monospace;
}

.detail-more {
    padding: 0.375rem 0;
    font-size: 0.75rem;
    color: var(--md-sys-color-on-surface-variant);
    font-style: italic;
}

.detail-view-btn {
    width: 100%;
    margin-top: 1rem;
}

/* Responsive */
@media (max-width: 640px) {
    .topology-toolbar {
        flex-wrap: wrap;
        height: auto;
        padding: 0.5rem 0.75rem;
        gap: 0.5rem;
    }
    .topology-toolbar-right {
        flex-wrap: wrap;
    }
    .topology-details-panel {
        width: 100%;
        right: -100%;
    }
}

/* TFTP Browser Layout */
.tftp-browser {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1rem;
    align-items: start;
}

.tftp-tree-panel {
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.tftp-files-panel {
    min-height: 400px;
}

/* Folder Tree Styles */
.folder-tree {
    font-size: 0.875rem;
}

.tree-item {
    cursor: pointer;
    user-select: none;
}

.tree-node {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 8px;
    border-radius: 6px;
    transition: background-color 0.15s;
}

.tree-node:hover {
    background: var(--md-sys-color-surface-container-high);
}

.tree-node.active {
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
}

.tree-node .carbon-icon {
    width: 1.25rem;
    height: 1.25rem;
    color: var(--md-sys-color-on-surface-variant);
}

.tree-node.active .carbon-icon {
    color: var(--md-sys-color-on-primary-container);
}

.tree-expand {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    color: var(--md-sys-color-on-surface-variant);
    transition: transform 0.2s;
}

.tree-expand.expanded {
    transform: rotate(90deg);
}

.tree-expand.hidden {
    visibility: hidden;
}

.tree-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tree-children {
    margin-left: 20px;
    display: none;
}

.tree-children.expanded {
    display: block;
}

/* Breadcrumb Path */
.path-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    align-items: center;
    font-size: 0.875rem;
    color: var(--md-sys-color-on-surface-variant);
    padding: 8px 12px;
    background: var(--md-sys-color-surface-container-low);
    border-radius: 8px;
}

.breadcrumb-item {
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background-color 0.15s;
}

.breadcrumb-item:hover:not(.active) {
    background: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-on-surface);
}

.breadcrumb-item.active {
    color: var(--md-sys-color-on-surface);
    font-weight: 600;
}

.breadcrumb-separator {
    color: var(--md-sys-color-outline);
    font-size: 0.75rem;
}

/* File row folder styling */
.file-row.folder {
    background: var(--md-sys-color-surface-container-low);
}

.file-row.folder:hover {
    background: var(--md-sys-color-surface-container);
}

@media (max-width: 900px) {
    .tftp-browser {
        grid-template-columns: 1fr;
    }
    
    .tftp-tree-panel {
        position: static;
        max-height: 300px;
    }
}

/* SW-P-08 / Stat boxes */
.stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--md-sys-color-surface-container-low);
    border-radius: 0;
    min-width: 100px;
    border: 1px solid var(--md-sys-color-outline-variant);
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--md-sys-color-primary);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--md-sys-color-on-surface-variant);
    text-transform: uppercase;
    letter-spacing: 0.32px;
    margin-top: 0.25rem;
}

/* Status badge */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    border-radius: 0;
    background: var(--md-sys-color-surface-container);
    font-size: 0.75rem;
}

.status-badge.success {
    background: var(--md-sys-color-success-container);
    color: var(--md-sys-color-on-success-container);
}

.status-badge.error {
    background: var(--md-sys-color-error-container);
    color: var(--md-sys-color-on-error-container);
}

/* Chip */
.chip {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
    border-radius: 10000px;
    font-size: 0.75rem;
    font-weight: 400;
}

.chip.primary {
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
}

/* ========== SWITCH OVERVIEW PAGE ========== */

#switches-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    padding: 1rem 0;
    justify-content: center;
}

.switch-card {
    background: var(--md-sys-color-surface-container);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 0;
    padding: 1rem 1.25rem;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
    min-width: 280px;
    max-width: 100%;
}

.switch-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    border-color: var(--md-sys-color-primary);
}

.switch-card-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
}

.switch-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.switch-status-dot.online {
    background: var(--cds-status-online);
    box-shadow: 0 0 4px rgba(76, 175, 80, 0.5);
}

.switch-status-dot.offline {
    background: var(--md-sys-color-outline);
}

.switch-hostname {
    font-weight: 600;
    color: var(--md-sys-color-on-surface);
}

.switch-model {
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.75rem;
    margin-left: auto;
}

.switch-port-counts {
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.75rem;
    white-space: nowrap;
}

.switch-chassis-wrapper {
    overflow-x: auto;
}

/* Global VLAN legend at bottom */

.switches-totals {
    display: flex;
    gap: 1.5rem;
    padding: 0.75rem 1.25rem;
    margin-top: 1.5rem;
    background: var(--md-sys-color-surface-container);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 0;
    font-size: 0.875rem;
    color: var(--md-sys-color-on-surface-variant);
}

.totals-label strong {
    color: var(--md-sys-color-on-surface);
}

#global-legend {
    margin-top: 1.5rem;
    padding: 1rem 1.25rem;
    background: var(--md-sys-color-surface-container);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 0;
}

.global-legend-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: var(--md-sys-color-on-surface-variant);
}

.global-legend-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.35rem 1.5rem;
}

.global-legend-grid .legend-item {
    display: grid;
    grid-template-columns: 16px 36px 1fr;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    color: var(--md-sys-color-on-surface-variant);
    padding: 0.15rem 0;
}

.global-legend-grid .legend-color {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    flex-shrink: 0;
}

.global-legend-grid .legend-id {
    font-weight: 600;
    color: var(--md-sys-color-on-surface);
    text-align: right;
}

.global-legend-grid .legend-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===== Monitoring Page ===== */

.monitoring-status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.25rem;
    background: var(--md-sys-color-surface-container);
    border-radius: 0;
    margin-bottom: 1.5rem;
    box-shadow: none;
    border: 1px solid var(--md-sys-color-outline-variant);
}

.monitoring-status-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--md-sys-color-on-surface-variant);
}

.monitoring-status-item .status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--md-sys-color-outline);
    display: inline-block;
}

.monitoring-status-item .status-indicator.active {
    background: var(--md-sys-color-success);
    box-shadow: 0 0 6px rgba(20, 108, 46, 0.4);
}

.monitoring-status-item .status-indicator.error {
    background: var(--md-sys-color-error);
    box-shadow: 0 0 6px rgba(179, 38, 30, 0.4);
}

.monitoring-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.monitoring-select {
    padding: 0.4rem 0.75rem;
    border-radius: 0;
    border: none;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    background: var(--md-sys-color-surface-container-low);
    color: var(--md-sys-color-on-surface);
    font-size: 0.875rem;
    cursor: pointer;
}

.monitoring-select:focus {
    outline: 2px solid var(--md-sys-color-primary);
    outline-offset: -2px;
}

.btn-refresh {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--md-sys-color-outline-variant);
    background: var(--md-sys-color-surface-container-low);
    color: var(--md-sys-color-on-surface);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.btn-refresh:hover {
    background: var(--md-sys-color-surface-container-high);
}

.btn-refresh:disabled {
    opacity: 0.5;
    cursor: default;
}

/* Live streaming indicator */
.monitoring-live-indicator {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    color: var(--md-sys-color-on-surface-variant);
    margin-left: auto;
    padding-right: 0.5rem;
    user-select: none;
}

.streaming-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #24a148;
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.75); }
}

.monitoring-live-indicator .live-label {
    font-weight: 600;
    color: #24a148;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.monitoring-last-update {
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.75rem;
}

.monitoring-section {
    margin-bottom: 2rem;
}

.monitoring-section-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--md-sys-color-on-surface);
    margin-bottom: 1rem;
    padding-left: 0.25rem;
}

.monitoring-chart-toggles {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem;
    margin-bottom: 0.5rem;
}

.monitoring-legend-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.625rem;
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 0;
    border: 1px solid var(--md-sys-color-outline-variant);
    background: var(--md-sys-color-surface);
    color: var(--md-sys-color-on-surface-variant);
    cursor: pointer;
    user-select: none;
    transition: background 0.15s, color 0.15s, opacity 0.15s;
    line-height: 1.4;
}

.monitoring-legend-btn:hover {
    background: var(--md-sys-color-surface-variant);
}

.monitoring-legend-btn--action {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    font-size: 0.6875rem;
}

.monitoring-legend-btn--device {
    opacity: 0.45;
}

.monitoring-legend-btn--device.active {
    opacity: 1;
    border-color: var(--md-sys-color-outline);
    background: var(--md-sys-color-surface-variant);
    color: var(--md-sys-color-on-surface);
}

.monitoring-legend-swatch {
    display: inline-block;
    width: 12px;
    height: 3px;
    border-radius: 0;
}

.monitoring-chart-container {
    background: var(--cds-chart-grid-bg);
    border-radius: 0;
    padding: 1.25rem;
    box-shadow: none;
    height: 340px;
    position: relative;
    border: 1px solid var(--md-sys-color-outline-variant);
}

/* Carbon tooltip for Chart.js */
.cds--chart-tooltip {
    position: absolute;
    pointer-events: none;
    font-family: 'IBM Plex Sans', sans-serif;
    background: var(--cds-chart-tooltip-bg);
    color: var(--cds-chart-tooltip-text);
    box-shadow: var(--cds-chart-tooltip-shadow);
    z-index: 1059;
    opacity: 0;
    transition: opacity 0.1s ease, transform 0.1s ease;
    min-width: 120px;
    max-width: 320px;
}

.cds--chart-tooltip.visible {
    opacity: 1;
}

.cds--chart-tooltip-header {
    padding: 8px 12px 4px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--cds-chart-tooltip-text);
    border-bottom: 1px solid var(--cds-chart-tooltip-line);
    white-space: nowrap;
}

.cds--chart-tooltip-body {
    padding: 4px 0;
}

.cds--chart-tooltip-item {
    display: flex;
    align-items: center;
    padding: 4px 12px;
    font-size: 0.75rem;
    line-height: 1rem;
    position: relative;
}

.cds--chart-tooltip-color {
    position: absolute;
    left: 0;
    top: 0;
    width: 4px;
    height: 100%;
}

.cds--chart-tooltip-label {
    flex: 1;
    padding-right: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cds--chart-tooltip-value {
    font-weight: 600;
    white-space: nowrap;
    margin-left: auto;
}

/* Ping status cards */

.monitoring-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.monitoring-card {
    background: var(--md-sys-color-surface-container-lowest);
    border-radius: 0;
    padding: 1rem;
    box-shadow: none;
    text-align: center;
    border-left: 4px solid var(--md-sys-color-outline);
    border-top: 1px solid var(--md-sys-color-outline-variant);
    border-right: 1px solid var(--md-sys-color-outline-variant);
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    transition: box-shadow 0.15s;
}

.monitoring-card:hover {
    box-shadow: var(--md-sys-elevation-1);
}

.monitoring-card.up {
    border-left-color: var(--md-sys-color-success);
}

.monitoring-card.down {
    border-left-color: var(--md-sys-color-error);
    background: var(--md-sys-color-error-container);
}

.monitoring-card.unknown {
    border-left-color: var(--md-sys-color-outline);
}

.monitoring-card-status {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.32px;
    margin-bottom: 0.25rem;
}

.monitoring-card.up .monitoring-card-status {
    color: var(--md-sys-color-success);
}

.monitoring-card.down .monitoring-card-status {
    color: var(--md-sys-color-error);
}

.monitoring-card.unknown .monitoring-card-status {
    color: var(--md-sys-color-outline);
}

.monitoring-card-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--md-sys-color-on-surface);
    margin-bottom: 0.15rem;
}

.monitoring-card-ip {
    font-size: 0.75rem;
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: 0.5rem;
}

.monitoring-card-latency {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--md-sys-color-primary);
}

.monitoring-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2rem;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.875rem;
}

/* Traffic charts */

.monitoring-traffic-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.monitoring-toggle {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.875rem;
    color: var(--md-sys-color-on-surface-variant);
    cursor: pointer;
    user-select: none;
}

.monitoring-toggle input {
    accent-color: var(--md-sys-color-primary);
}

.monitoring-traffic-device {
    margin-bottom: 2rem;
}

.monitoring-traffic-device-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--md-sys-color-on-surface);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.monitoring-traffic-device-ip {
    font-size: 0.75rem;
    color: var(--md-sys-color-on-surface-variant);
    font-weight: 400;
}

.monitoring-traffic-port-count {
    font-size: 0.75rem;
    color: var(--md-sys-color-primary);
    background: var(--md-sys-color-primary-container);
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-weight: 400;
}

.monitoring-traffic-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 900px) {
    .monitoring-traffic-pair {
        grid-template-columns: 1fr;
    }
}

.monitoring-chart-half {
    height: 300px;
}

.monitoring-chart-label {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--md-sys-color-on-surface-variant);
    text-transform: uppercase;
    letter-spacing: 0.32px;
    margin-bottom: 0.5rem;
}

/* ================================================================
   SERVICE MANAGER — Carbon Design
   ================================================================ */

.services-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.services-header h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--md-sys-color-on-surface);
    letter-spacing: 0;
}

.services-header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.services-summary {
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.16px;
}

.services-summary .svc-count-ok {
    color: var(--cds-status-online);
}

.services-summary .svc-count-warn {
    color: var(--md-sys-color-error);
}

.services-section {
    margin-bottom: 2rem;
}

.services-section-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--md-sys-color-on-surface);
    letter-spacing: 0.16px;
    margin-bottom: 0.25rem;
}

.services-section-description {
    font-size: 0.875rem;
    color: var(--md-sys-color-on-surface-variant);
    letter-spacing: 0.16px;
    line-height: 1.25rem;
    margin-bottom: 1rem;
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1rem;
}

/* Service card — mirrors .card (sharp corners, subtle border) */
.svc-card {
    background: var(--md-sys-color-surface-container-low);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 0;
    padding: 1.5rem;
    transition: box-shadow 0.2s ease, border-color 0.15s;
}

.svc-card:hover {
    box-shadow: var(--md-sys-elevation-1);
    border-color: var(--md-sys-color-outline);
}

.svc-card.running {
    border-left: 3px solid var(--cds-status-online);
}

.svc-card.stopped {
    border-left: 3px solid var(--md-sys-color-error);
}

.svc-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.svc-card-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.svc-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--md-sys-color-on-surface);
    letter-spacing: 0;
}

/* Status dot — reuses pulse-dot keyframes from streaming indicator */
.svc-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.svc-status-dot.running {
    background: var(--cds-status-online);
    box-shadow: 0 0 6px rgba(36, 161, 72, 0.4);
    animation: pulse-dot 2s ease-in-out infinite;
}

.svc-status-dot.stopped {
    background: var(--md-sys-color-error);
}

/* Status badge — follows .cds-tag pattern */
.svc-status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0 0.5rem;
    height: 1.5rem;
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0.32px;
    border-radius: 24px;
    text-transform: uppercase;
}

.svc-status-badge.running {
    background: var(--md-sys-color-success-container);
    color: var(--cds-status-online);
}

.svc-status-badge.stopped {
    background: var(--md-sys-color-error-container);
    color: var(--md-sys-color-on-error-container);
}

.svc-description {
    font-size: 0.875rem;
    color: var(--md-sys-color-on-surface-variant);
    letter-spacing: 0.16px;
    line-height: 1.25rem;
    margin-bottom: 0.75rem;
}

.svc-meta {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.svc-meta-item {
    font-size: 0.75rem;
    color: var(--md-sys-color-on-surface-variant);
    background: var(--md-sys-color-surface-container-high);
    padding: 0.25rem 0.5rem;
    border-radius: 0;
    font-family: 'IBM Plex Mono', monospace;
    letter-spacing: 0.32px;
}

.svc-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding-top: 0.75rem;
    border-top: 1px solid var(--md-sys-color-outline-variant);
}

.svc-actions .btn {
    gap: 0.25rem;
}

.svc-actions .btn .carbon-icon {
    fill: currentColor;
}

.svc-web-link {
    font-size: 0.75rem;
    color: var(--cds-link-color);
    text-decoration: none;
    letter-spacing: 0.16px;
    transition: color 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.svc-web-link:hover {
    color: var(--md-sys-color-primary);
    text-decoration: underline;
}

.svc-web-link .carbon-icon {
    fill: currentColor;
}

/* ─── NDI Process Log Viewer ─── */

.ndi-log-container {
    background: var(--md-sys-color-surface-container);
    border: 1px solid var(--md-sys-color-outline-variant);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    line-height: 1.4;
    letter-spacing: 0.32px;
    color: var(--md-sys-color-on-surface);
    max-height: 400px;
    overflow-y: auto;
    padding: 1rem;
}

.ndi-log-line {
    margin-bottom: 0.25rem;
    white-space: pre-wrap;
    word-break: break-all;
}

.ndi-log-line .log-timestamp {
    color: var(--md-sys-color-on-surface-variant);
    margin-right: 0.5rem;
}

.ndi-log-error {
    color: var(--md-sys-color-error);
}

.ndi-log-warn {
    color: var(--cds-support-warning, #f1c21b);
}

.ndi-log-info {
    color: var(--md-sys-color-on-surface-variant);
}

.ndi-log-empty {
    color: var(--md-sys-color-on-surface-variant);
    font-style: italic;
}

/* ============================================================
   AWS Media — Shared Styles (Carbon Design System)
   ============================================================ */

/* ── CDS Data Table ─────────────────────────────────────────── */
.aws-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    font-family: 'IBM Plex Sans', sans-serif;
    table-layout: fixed;
}

.aws-table th {
    text-align: left;
    padding: 0 1rem;
    height: 3rem; /* CDS lg row = 48px */
    background: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-on-surface-variant);
    font-weight: 600;
    font-size: 0.875rem;
    letter-spacing: 0.16px;
    text-transform: none; /* CDS: sentence case, not uppercase */
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    vertical-align: middle;
}

.aws-table td {
    padding: 0 1rem;
    height: 3rem; /* CDS lg row */
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    color: var(--md-sys-color-on-surface);
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.aws-table tbody tr:hover {
    background: var(--md-sys-color-surface-container);
}

.aws-mono {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.8rem;
}

.aws-actions {
    display: flex;
    gap: 0.375rem;
    flex-wrap: wrap;
}

.aws-link {
    color: var(--md-sys-color-primary);
    text-decoration: none;
    font-weight: 500;
}

.aws-link:hover {
    text-decoration: underline;
}

/* ── CDS Tags (status) ──────────────────────────────────────── */
.aws-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 1.5rem; /* CDS md tag = 24px */
    padding: 0 0.5rem; /* CDS $spacing-03 */
    border-radius: 1rem; /* CDS pill shape */
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0.32px;
    text-transform: none; /* CDS: sentence case */
    white-space: nowrap;
    min-width: 5rem;
}

.aws-badge-active {
    background: var(--md-sys-color-success-container);
    color: #0e6027;
}

[data-carbon-theme="g90"] .aws-badge-active {
    background: rgba(36, 161, 72, 0.2);
    color: #42be65;
}

.aws-badge-standby {
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
}

.aws-badge-pending {
    background: var(--md-sys-color-info-container);
    color: var(--md-sys-color-info);
}

.aws-badge-warning {
    background: var(--md-sys-color-warning-container);
    color: #8a6d08;
}

[data-carbon-theme="g90"] .aws-badge-warning {
    background: rgba(241, 194, 27, 0.15);
    color: #f1c21b;
}

.aws-badge-error {
    background: var(--md-sys-color-error-container);
    color: var(--md-sys-color-error);
}

.aws-badge-default {
    background: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-on-surface-variant);
}

.aws-type-badge {
    display: inline-flex;
    align-items: center;
    height: 1.125rem; /* CDS sm tag = 18px */
    padding: 0 0.5rem;
    border-radius: 1rem; /* CDS pill */
    font-size: 0.75rem;
    font-weight: 400;
    font-family: 'IBM Plex Mono', monospace;
    background: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-on-surface-variant);
    letter-spacing: 0.32px;
}

/* ── CDS Modal ──────────────────────────────────────────────── */
.aws-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(22, 22, 22, 0.7); /* CDS $overlay */
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.aws-modal {
    background: var(--md-sys-color-surface-container-low);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 0; /* CDS: no radius */
    width: 100%;
    max-width: 500px;
    max-height: 72vh; /* CDS sm modal max-height */
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.aws-modal-wide {
    max-width: 750px;
    max-height: 84vh; /* CDS md modal max-height */
}

.aws-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 1rem 1rem 1rem 1rem; /* CDS $spacing-05 */
    border-bottom: none; /* CDS: no border between header & content */
}

.aws-modal-header h3 {
    margin: 0;
    font-size: 1.25rem; /* CDS $heading-03: 20px */
    font-weight: 400; /* CDS heading: regular 400 */
    color: var(--md-sys-color-on-surface);
    line-height: 1.4;
}

.aws-modal-close {
    background: none;
    border: none;
    width: 3rem; /* CDS close: 48x48 click target */
    height: 3rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 1.25rem;
    line-height: 1;
    flex-shrink: 0;
    margin: -0.5rem -0.5rem 0 0;
    transition: background 0.15s;
}

.aws-modal-close:hover {
    background: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-on-surface);
}

.aws-modal-body {
    padding: 0 1rem 1rem; /* CDS: 16px L/R */
    overflow-y: auto;
    flex: 1;
}

.aws-modal-footer {
    display: flex;
    gap: 0; /* CDS: fluid buttons, no gap */
    border-top: 1px solid var(--md-sys-color-outline-variant);
    justify-content: flex-end;
}

.aws-modal-footer .btn {
    flex: 1; /* CDS: fluid, equal-width buttons */
    border-radius: 0;
    min-height: 3rem; /* CDS lg button = 48px */
    justify-content: center;
}

.aws-modal-footer .btn + .btn {
    border-left: 1px solid var(--md-sys-color-outline-variant);
}

/* ── Detail Grid ────────────────────────────────────────────── */
.aws-detail-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.aws-detail-section h4 {
    margin: 0 0 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--md-sys-color-on-surface);
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

/* CDS structured list pattern for detail rows */
.aws-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0.5rem 0; /* CDS $spacing-03 vertical */
    gap: 1rem;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

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

.aws-detail-label {
    font-size: 0.75rem; /* CDS $label-01: 12px */
    color: var(--md-sys-color-on-surface-variant);
    font-weight: 400;
    min-width: 120px;
    flex-shrink: 0;
    letter-spacing: 0.32px;
}

.aws-detail-value {
    font-size: 0.875rem; /* CDS $body-compact-01: 14px */
    color: var(--md-sys-color-on-surface);
    text-align: right;
    word-break: break-word;
}

/* CDS contained-list pattern */
.aws-output-card {
    background: var(--md-sys-color-surface-container);
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    padding: 0.75rem 1rem;
    border-radius: 0; /* CDS: no radius */
}

.aws-output-card:first-child {
    border-top: 1px solid var(--md-sys-color-outline-variant);
}

.aws-output-card:last-child {
    margin-bottom: 0;
}

/* ── Collapsible Sections ───────────────────────────────────── */
.aws-collapsible {
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 4px;
    margin-bottom: 0.75rem;
    overflow: hidden;
}

.aws-collapsible-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.625rem 0.75rem;
    background: var(--md-sys-color-surface-container);
    border: none;
    color: var(--md-sys-color-on-surface);
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s ease;
}

.aws-collapsible-toggle:hover {
    background: var(--md-sys-color-surface-container-high);
}

.aws-collapsible-chevron {
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.aws-collapsible-open .aws-collapsible-chevron {
    transform: rotate(90deg);
}

.aws-collapsible-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease, padding 0.25s ease;
    padding: 0 0.75rem;
}

.aws-collapsible-open .aws-collapsible-body {
    max-height: 600px;
    padding: 0.75rem;
}

.aws-muted {
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.8125rem;
    margin: 0;
}

/* ── Table Accordion Rows ───────────────────────────────────── */
.aws-table-accordion .aws-accordion-header {
    cursor: pointer;
    transition: background 0.1s ease;
}

.aws-table-accordion .aws-accordion-header:hover {
    background: var(--md-sys-color-surface-container-high);
}

.aws-accordion-chevron-cell {
    width: 2rem;
    text-align: center;
    padding: 0 0.25rem !important;
}

.aws-accordion-chevron {
    transition: transform 0.2s ease;
    opacity: 0.5;
    vertical-align: middle;
}

.aws-accordion-expanded .aws-accordion-chevron {
    transform: rotate(90deg);
    opacity: 1;
}

/* Inline row thumbnail (visible when accordion is collapsed) */
.aws-actions-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.aws-actions-btns {
    display: flex;
    gap: 0.375rem;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.aws-row-thumb {
    flex-shrink: 0;
    width: 72px;
    height: 40px;
    border-radius: 0; /* CDS: no radius */
    overflow: hidden;
    border: 1px solid var(--md-sys-color-outline-variant);
}

.aws-row-thumb:empty {
    display: none;
}

.aws-row-thumb-stopped {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--md-sys-color-surface-container);
    color: var(--md-sys-color-on-surface-variant);
    font-size: 1rem;
    line-height: 1;
}

.aws-row-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.aws-accordion-expanded .aws-row-thumb {
    display: none;
}

.aws-accordion-body > td {
    padding: 0 !important;
    border-top: none !important;
    background: var(--md-sys-color-surface-container-low);
}

.aws-accordion-content {
    padding: 0.75rem 0 1.5rem 0;
    border-top: 1px solid var(--md-sys-color-outline-variant);
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    transition: opacity 0.15s ease;
    background: transparent; /* CDS: accordion panel bg = transparent */
}

/* Accordion detail: thumbnail + info grid */
.aws-accordion-detail-layout {
    display: grid;
    grid-template-columns: minmax(200px, 25%) 1fr;
    gap: 1.25rem;
    align-items: start;
}

.aws-accordion-detail-info {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1.25rem;
}

.aws-accordion-col-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.aws-accordion-col-header h5 {
    margin: 0;
}
/* CDS ghost button for add output */
.aws-add-output-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem; /* CDS sm button = 32px */
    height: 2rem;
    border-radius: 0; /* CDS: no radius */
    border: none;
    background: transparent; /* CDS ghost */
    color: var(--md-sys-color-primary);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: background 0.15s;
}
.aws-add-output-btn:hover {
    background: var(--md-sys-color-surface-container-high); /* CDS ghost hover */
}
.aws-add-output-btn:focus {
    outline: 2px solid var(--md-sys-color-primary);
    outline-offset: -2px;
}

.aws-section-divider {
    height: 1px;
    background: var(--md-sys-color-outline-variant);
    margin: 0.625rem 0 0.5rem;
}

.aws-accordion-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1.5rem;
}

.aws-accordion-detail-col h5,
.aws-thumb-panel h5 {
    margin: 0 0 0.5rem;
    font-size: 0.75rem; /* CDS $label-01 */
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.32px; /* CDS letter-spacing */
    color: var(--md-sys-color-on-surface-variant); /* CDS $text-secondary */
}

/* CDS contained-list item */
.aws-accordion-output-card {
    background: var(--md-sys-color-surface-container);
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 0; /* CDS: no radius */
    padding: 0.5rem 1rem; /* CDS $spacing-05 padding */
    position: relative;
    border-left: 3px solid transparent;
    transition: border-left-color 0.2s;
}

.aws-accordion-output-card.aws-output-connected { border-left-color: #24a148; }
.aws-accordion-output-card.aws-output-disconnected { border-left-color: #da1e28; }
.aws-accordion-output-card.aws-output-disabled { border-left-color: #6f6f6f; }
.aws-accordion-output-card.aws-output-stopped { border-left-color: #6f6f6f; }
.aws-accordion-output-card.aws-output-unknown { border-left-color: #f2b000; }

.aws-output-conn-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.32px;
    padding: 0.125rem 0.5rem;
    border-radius: 1rem;
    white-space: nowrap;
    line-height: 1.2;
}

.aws-conn-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.aws-conn-connected { background: rgba(36,161,72,0.12); color: #24a148; }
.aws-conn-connected .aws-conn-dot { background: #24a148; box-shadow: 0 0 4px #24a148; }
.aws-conn-disconnected { background: rgba(218,30,40,0.12); color: #da1e28; }
.aws-conn-disconnected .aws-conn-dot { background: #da1e28; }
.aws-conn-disabled { background: rgba(111,111,111,0.12); color: #6f6f6f; }
.aws-conn-disabled .aws-conn-dot { background: #6f6f6f; }
.aws-conn-stopped { background: rgba(111,111,111,0.12); color: #6f6f6f; }
.aws-conn-stopped .aws-conn-dot { background: #6f6f6f; }
.aws-conn-unknown { background: rgba(242,176,0,0.12); color: #b28600; }
.aws-conn-unknown .aws-conn-dot { background: #f2b000; }

.aws-accordion-output-card:first-child {
    border-top: 1px solid var(--md-sys-color-outline-variant);
}

.aws-accordion-output-card:last-child {
    margin-bottom: 0;
}
.aws-remove-output-btn {
    background: none;
    border: none;
    color: var(--md-sys-color-error);
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0 0.25rem;
    line-height: 1;
    opacity: 0.5;
    transition: opacity 0.15s;
}
.aws-remove-output-btn:hover {
    opacity: 1;
}

/* ── CloudWatch metric widgets ──────────────── */
.aws-metric-bar {
    height: 4px;
    background: var(--md-sys-color-surface-container-high);
    border-radius: 2px;
    overflow: hidden;
    margin: 0.125rem 0 0.375rem;
}

.aws-metric-bar-fill {
    height: 100%;
    border-radius: 2px;
    min-width: 2px;
    transition: width 0.3s ease;
}

.aws-metric-warning {
    font-size: 0.6875rem;
    color: var(--md-sys-color-error);
    padding: 0.25rem 0.375rem;
    border-radius: 0.25rem;
    background: color-mix(in srgb, var(--md-sys-color-error) 8%, transparent);
    margin: 0.25rem 0 0.375rem;
}

.aws-sparkline-label {
    font-size: 0.75rem; /* CDS $label-01 */
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.32px;
    color: var(--md-sys-color-on-surface-variant);
    margin-top: 0.75rem;
    margin-bottom: 0.5rem;
}

.aws-sparkline-wrap {
    display: flex;
    gap: 0.25rem;
    align-items: stretch;
}

.aws-sparkline-y-axis {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 2px 0;
    min-width: 2.5rem;
    text-align: right;
}

.aws-sparkline-y-axis span {
    font-size: 0.625rem;
    font-family: 'IBM Plex Mono', monospace;
    color: var(--md-sys-color-on-surface-variant);
    line-height: 1;
}

.aws-sparkline-chart {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.aws-sparkline {
    width: 100%;
    flex: 1;
    display: block;
    border-radius: 0; /* CDS: no radius */
    background: var(--md-sys-color-surface-container-high);
    border: 1px solid var(--md-sys-color-outline-variant);
}

.aws-sparkline-x-axis {
    display: flex;
    justify-content: space-between;
    padding-top: 0.25rem;
}

.aws-sparkline-x-axis span {
    font-size: 0.625rem;
    font-family: 'IBM Plex Mono', monospace;
    color: var(--md-sys-color-on-surface-variant);
}

.aws-sparkline-unit {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    font-size: 0.625rem;
    font-family: 'IBM Plex Mono', monospace;
    color: var(--md-sys-color-on-surface-variant);
    display: flex;
    align-items: center;
    justify-content: center;
    padding-left: 0.125rem;
}

/* ── Thumbnail panel ─────────────────────────── */
.aws-thumb-panel {
    min-width: 0;
    width: 100%;
}

.aws-thumb-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: var(--md-sys-color-surface-container-high);
    border-radius: 0; /* CDS: no border-radius */
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--md-sys-color-outline-variant);
}

.aws-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.aws-thumb-live-badge {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    background: rgba(220, 38, 38, 0.88);
    color: #fff;
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    padding: 0.15rem 0.5rem 0.15rem 0.375rem;
    border-radius: 0.25rem;
    line-height: 1;
}

.aws-thumb-live-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #fff;
    animation: thumbLivePulse 1.6s ease-in-out infinite;
}

@keyframes thumbLivePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

.aws-thumb-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1.25rem 0.625rem 0.375rem;
    background: linear-gradient(transparent, rgba(0,0,0,0.72));
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Animated bars placeholder (active, no signal) */
.aws-thumb-no-signal {
    background: var(--md-sys-color-surface-container-highest);
}

.aws-thumb-bars {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 40%;
}

.aws-thumb-bar {
    width: 6px;
    background: var(--md-sys-color-primary);
    border-radius: 2px 2px 0 0;
    animation: thumbBar 1.2s ease-in-out infinite alternate;
    opacity: 0.55;
}

@keyframes thumbBar {
    0%   { height: 20%; }
    100% { height: 100%; }
}

/* Stopped state */
.aws-thumb-stopped {
    flex-direction: column;
    gap: 0.25rem;
    color: var(--md-sys-color-on-surface-variant);
}

.aws-thumb-stopped-icon {
    font-size: 1.5rem;
    opacity: 0.5;
}

.aws-thumb-stopped-text {
    font-size: 0.75rem;
    font-weight: 500;
    opacity: 0.6;
}

@media (max-width: 1100px) {
    .aws-accordion-detail-layout {
        grid-template-columns: 1fr;
    }
    .aws-thumb-panel {
        max-width: 320px;
    }
}

@media (max-width: 900px) {
    .aws-accordion-detail-info {
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }
    .aws-accordion-detail-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

@media (max-width: 600px) {
    .aws-accordion-detail-info {
        grid-template-columns: 1fr;
    }
}

/* ── Pipeline Cards ─────────────────────────────────────────── */
.aws-pipeline-card {
    transition: border-color 0.15s ease;
}

.aws-pipeline-card:hover {
    border-color: var(--md-sys-color-primary);
}

.aws-pipeline-actions {
    display: flex;
    gap: 0.375rem;
    flex-wrap: wrap;
    padding-top: 0.5rem;
    border-top: 1px solid var(--md-sys-color-outline-variant);
}

/* Task progress pips */
.aws-task-pip {
    flex: 1;
    height: 4px;
    border-radius: 1px;
    background: var(--md-sys-color-surface-container-high);
}

.aws-task-pip.complete {
    background: var(--md-sys-color-success);
}

.aws-task-pip.running {
    background: var(--md-sys-color-primary);
    animation: taskPulse 1.5s ease-in-out infinite;
}

.aws-task-pip.error {
    background: var(--md-sys-color-error);
}

@keyframes taskPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ── Task List (detail view) ────────────────────────────────── */
.aws-task-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.aws-task-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: 2px;
    font-size: 0.8rem;
    background: var(--md-sys-color-surface-container);
}

.aws-task-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.aws-task-indicator.pending {
    background: var(--md-sys-color-outline);
}

.aws-task-indicator.running {
    background: var(--md-sys-color-primary);
    animation: taskPulse 1.5s ease-in-out infinite;
}

.aws-task-indicator.complete {
    background: var(--md-sys-color-success);
}

.aws-task-indicator.error {
    background: var(--md-sys-color-error);
}

.aws-task-name {
    flex: 1;
    color: var(--md-sys-color-on-surface);
}

.aws-task-status {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.32px;
    color: var(--md-sys-color-on-surface-variant);
}

.aws-task-error {
    font-size: 0.75rem;
    color: var(--md-sys-color-error);
    width: 100%;
    display: block;
    margin-top: 0.25rem;
}

/* ── Wizard Steps ───────────────────────────────────────────── */
.aws-wizard-steps {
    display: flex;
    gap: 0;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--md-sys-color-outline-variant);
}

.aws-wizard-step {
    flex: 1;
    text-align: center;
    padding: 0.75rem 0.5rem;
    font-size: 0.8rem;
    color: var(--md-sys-color-on-surface-variant);
    position: relative;
    cursor: default;
}

.aws-wizard-step span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--md-sys-color-surface-container-high);
    font-size: 0.7rem;
    font-weight: 600;
    margin-right: 0.375rem;
}

.aws-wizard-step.active {
    color: var(--md-sys-color-primary);
    font-weight: 600;
}

.aws-wizard-step.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--md-sys-color-primary);
}

.aws-wizard-step.active span {
    background: var(--md-sys-color-primary);
    color: white;
}

.aws-wizard-step.completed span {
    background: var(--md-sys-color-success);
    color: white;
}

.aws-wizard-panel {
    min-height: 150px;
}

/* ── Output rows (wizard) ───────────────────────────────────── */
.aws-output-row {
    padding: 0.75rem;
    background: var(--md-sys-color-surface-container);
    border: 1px solid var(--md-sys-color-outline-variant);
    margin-bottom: 0.5rem;
}

.aws-output-row .form-group input {
    padding: 0.5rem 0.75rem;
}

/* ── CDS Page Header & Toolbar ────────────────────────────────── */

.aws-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    min-height: 3rem; /* CDS toolbar lg = 48px */
}

.aws-page-header h2 {
    margin: 0;
    font-size: 1.25rem; /* CDS $heading-03 */
    font-weight: 400;
}

.aws-header-actions {
    display: flex;
    gap: 0; /* CDS: ghost icon buttons have no gap */
    align-items: center;
}

/* CDS Ghost icon-only button (48x48 click target, transparent bg) */
.aws-icon-btn {
    width: 3rem; /* CDS: 48px click target */
    height: 3rem;
    min-width: 3rem;
    border-radius: 0; /* CDS: no radius on ghost buttons */
    border: none;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    line-height: 1;
    background: transparent;
    color: var(--md-sys-color-primary);
    cursor: pointer;
    transition: background 0.15s;
}

.aws-icon-btn:hover {
    background: var(--md-sys-color-surface-container-high);
}

.aws-icon-btn:focus {
    outline: 2px solid var(--md-sys-color-primary);
    outline-offset: -2px;
}

.aws-icon-btn.aws-icon-btn-lg {
    font-size: 1.25rem;
}

.aws-cidr-row {
    display: flex;
    align-items: center;
    margin-bottom: 0.375rem;
}

.aws-cidr-row input {
    flex: 1;
}

.aws-cidr-row .aws-cidr-remove {
    min-width: 2rem;
    height: 2rem;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    color: var(--md-sys-color-error);
    font-size: 1.125rem;
    cursor: pointer;
    margin-left: 0.375rem;
}

.aws-cidr-row .aws-cidr-remove:hover {
    background: rgba(218, 30, 40, 0.08);
}

/* ── CDS Utility classes for inline-style elimination ────────── */

.aws-empty-state {
    color: var(--md-sys-color-on-surface-variant);
    text-align: center;
    padding: 2rem;
    font-size: 0.875rem;
}

.aws-error-state {
    color: var(--md-sys-color-error);
    text-align: center;
    padding: 2rem;
    font-size: 0.875rem;
}

.aws-output-card-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.aws-output-card-name {
    font-weight: 600;
    font-size: 0.875rem; /* CDS $body-compact-01 */
    color: var(--md-sys-color-on-surface);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.aws-program-heading {
    font-weight: 600;
    font-size: 0.875rem;
    margin: 0.375rem 0 0.125rem;
    color: var(--md-sys-color-on-surface);
}

.aws-detail-arn {
    font-size: 0.75rem;
    word-break: break-all;
}

.aws-thumb-detail-img {
    max-width: 100%;
    border: 1px solid var(--md-sys-color-outline-variant);
    display: block;
    margin: 0.5rem 0;
}

.aws-monitor-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.5rem;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--md-sys-color-on-primary);
    background: var(--md-sys-color-primary);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    transition: background 120ms ease;
}
.aws-monitor-btn:hover {
    background: var(--md-sys-color-primary-hover, #3a5fdb);
    text-decoration: none;
}
.aws-monitor-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* ── SRT Monitor Modal ───────────────────────────────────────── */
.aws-modal-monitor {
    max-width: 900px;
    max-height: 90vh;
}
.srt-monitor-video-wrap {
    position: relative;
    background: #000;
    width: 100%;
    aspect-ratio: 16 / 9;
}
.srt-monitor-video-wrap video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}
.srt-monitor-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 0.875rem;
    z-index: 1;
    pointer-events: none;
    transition: opacity 200ms;
}
.srt-monitor-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}
.srt-monitor-status-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    font-size: 0.75rem;
    z-index: 2;
}
.srt-monitor-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--md-sys-color-outline);
    flex-shrink: 0;
}
.srt-monitor-status-dot.live { background: #24a148; }
.srt-monitor-status-dot.connecting { background: #f1c21b; }
.srt-monitor-status-dot.error { background: #da1e28; }
.srt-monitor-uri {
    margin-left: auto;
    opacity: 0.7;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 50%;
}
.srt-monitor-log {
    font-size: 0.75rem;
    color: var(--md-sys-color-on-surface-variant);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 60%;
}

/* Manual Links */
.manual-links-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.manual-link-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    background: var(--md-sys-color-surface-container);
    border-radius: 6px;
    gap: 0.5rem;
}
.manual-link-info {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    min-width: 0;
    flex-wrap: wrap;
}
.manual-link-device {
    font-weight: 500;
    color: var(--md-sys-color-on-surface);
}
.manual-link-port {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.8rem;
    color: var(--md-sys-color-primary);
    background: var(--md-sys-color-surface-container-high);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
}
.manual-link-arrow {
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.9rem;
}

/* ====================================================
   ATEM I/O Tabs, Grid & Modal
   ==================================================== */

.atem-io-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    margin-bottom: 0;
}

.atem-io-tab {
    padding: 10px 24px;
    border: none;
    background: transparent;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
    font-family: inherit;
}

.atem-io-tab:hover {
    color: var(--md-sys-color-on-surface);
    background: var(--md-sys-color-surface-container-high);
}

.atem-io-tab.active {
    color: var(--md-sys-color-primary);
    border-bottom-color: var(--md-sys-color-primary);
}

.atem-io-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 32px;
    padding: 0;
}

.atem-io-col {
    min-width: 0;
}

.atem-io-col-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.32px;
    color: var(--md-sys-color-on-surface-variant);
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    background: var(--md-sys-color-surface-container);
}

.atem-io-hdr-port {
    width: 52px;
    flex-shrink: 0;
}

.atem-io-hdr-name {
    flex: 1;
}

.atem-io-hdr-label {
    width: 64px;
    flex-shrink: 0;
}

.atem-io-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    cursor: pointer;
    transition: background 0.1s;
}

.atem-io-row:hover {
    background: var(--md-sys-color-surface-container-high);
}

.atem-io-num {
    width: 24px;
    flex-shrink: 0;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--md-sys-color-on-surface-variant);
    text-align: center;
}

.atem-io-port {
    width: 52px;
    flex-shrink: 0;
    font-size: 0.75rem;
    color: var(--md-sys-color-on-surface-variant);
}

.atem-io-name,
.atem-io-label {
    border: none;
    background: transparent;
    color: var(--md-sys-color-on-surface);
    font-size: 0.875rem;
    font-family: inherit;
    padding: 4px 6px;
    border-radius: 4px;
    cursor: pointer;
}

.atem-io-name {
    flex: 1;
    min-width: 0;
}

.atem-io-label {
    width: 64px;
    flex-shrink: 0;
    font-family: 'IBM Plex Mono', Monaco, monospace;
    font-size: 0.8rem;
}

.atem-io-name:hover,
.atem-io-label:hover {
    background: var(--md-sys-color-surface-container-highest);
}

/* ATEM rename modal */
.atem-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.atem-modal {
    background: var(--md-sys-color-surface);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 4px;
    width: 400px;
    max-width: 90vw;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.atem-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.atem-modal-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.atem-modal-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--md-sys-color-on-surface-variant);
    padding: 4px 8px;
}

.atem-modal-close:hover {
    color: var(--md-sys-color-on-surface);
}

.atem-modal-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.atem-modal-body label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.32px;
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: 6px;
}

.atem-modal-body label small {
    font-weight: 400;
    text-transform: none;
    letter-spacing: normal;
}

.atem-modal-body input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    border: none;
    border-bottom: 1px solid var(--md-sys-color-outline);
    border-radius: 0;
    background: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-on-surface);
    font-size: 0.875rem;
    font-family: inherit;
    box-sizing: border-box;
}

.atem-modal-body input[type="text"]:focus {
    outline: none;
    border-bottom: 2px solid var(--md-sys-color-primary);
}

.atem-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid var(--md-sys-color-outline-variant);
}


