/* Settings Modal Styles */
.settings-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}

.settings-modal-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.settings-modal {
    background: #1a1a1a;
    border: 1px solid #444;
    border-radius: 10px;
    width: 90vw;
    max-width: 1200px;
    height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
}

.settings-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid #333;
    background: #0f0f0f;
    border-radius: 10px 10px 0 0;
}

.settings-modal-header h2 {
    margin: 0;
    color: #00cc66;
    font-size: 18px;
    font-weight: 400;
    display: flex;
    align-items: center;
    gap: 10px;
}

.settings-close-btn {
    background: transparent;
    border: 1px solid #444;
    color: #888;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-close-btn:hover {
    background: #333;
    color: #fff;
    border-color: #666;
}

/* Tabs Container with scroll buttons */
.settings-tabs-container {
    display: flex;
    align-items: stretch;
    background: #151515;
    border-bottom: 1px solid #333;
    position: relative;
}

.settings-tabs-scroll-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 32px;
    min-width: 32px;
    background: #151515;
    border: none;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 1;
}

.settings-tabs-scroll-btn.visible {
    display: flex;
}

.settings-tabs-scroll-btn:hover {
    color: #00cc66;
    background: #222;
}

.settings-tabs-scroll-btn.left {
    border-right: 1px solid #333;
}

.settings-tabs-scroll-btn.right {
    border-left: 1px solid #333;
}

/* Tabs */
.settings-tabs {
    display: flex;
    gap: 0;
    background: #151515;
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

.settings-tabs::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.settings-tab {
    padding: 14px 20px;
    background: transparent;
    border: none;
    color: #888;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
    flex-shrink: 0;
}

.settings-tab:hover {
    color: #ccc;
    background: rgba(255,255,255,0.03);
}

.settings-tab.active {
    color: #00cc66;
    border-bottom-color: #00cc66;
}

/* Content */
.settings-content {
    flex: 1;
    overflow: auto;
    padding: 0;
}

.settings-panel {
    height: 100%;
    padding: 20px 24px;
}

/* ============================================
   Sub-Tabs System (Two-Level Tabs)
   ============================================ */
.settings-panel.has-subtabs {
    display: flex;
    flex-direction: column;
    padding: 0;
    height: 100%;
}

.sub-tabs-container {
    display: flex;
    background: #1a1a1a;
    border-bottom: 1px solid #333;
    padding: 0 16px;
    flex-shrink: 0;
}

.sub-tab {
    padding: 10px 5px;
    background: transparent;
    border: none;
    color: #888;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
}

.sub-tab:hover {
    color: #ccc;
    background: rgba(255, 255, 255, 0.03);
}

.sub-tab.active {
    color: #00cc66;
    border-bottom-color: #00cc66;
}

.sub-tab i {
    font-size: 12px;
}

.sub-panel-content {
    flex: 1;
    overflow: auto;
}

.sub-panel {
    display: none;
    height: 100%;
    padding: 20px 24px;
}

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

.sub-panel.active.has-subtabs {
    display: flex;
    flex-direction: column;
    padding: 0px;
}

/* Sensors + General panels - vertical left side menu */
#panel-sensors,
#panel-general,
#panel-filters {
    flex-direction: row;
}

#panel-sensors > .sub-tabs-container,
#panel-general > .sub-tabs-container,
#panel-filters > .sub-tabs-container {
    flex-direction: column;
    border-bottom: none;
    border-right: 1px solid #333;
    padding: 8px 0;
    width: 150px;
    min-width: 150px;
    overflow-y: auto;
}

#panel-sensors > .sub-tabs-container .sub-tab,
#panel-general > .sub-tabs-container .sub-tab,
#panel-filters > .sub-tabs-container .sub-tab {
    border-bottom: none;
    border-left: 3px solid transparent;
    margin-bottom: 0;
    border-radius: 0;
    justify-content: flex-start;
    width: 100%;
}

#panel-sensors > .sub-tabs-container .sub-tab.active,
#panel-general > .sub-tabs-container .sub-tab.active,
#panel-filters > .sub-tabs-container .sub-tab.active {
    border-left-color: #00cc66;
    border-bottom-color: transparent;
    background: rgba(0, 204, 102, 0.08);
}

#panel-sensors > .sub-panel-content,
#panel-general > .sub-panel-content,
#panel-filters > .sub-panel-content {
    padding: 0;
    flex: 1;
}

#panel-sensors > .sub-panel-content > .sub-panel.active,
#panel-general > .sub-panel-content > .sub-panel.active,
#panel-filters > .sub-panel-content > .sub-panel.active {
    overflow: auto;
}

body.light-mode #panel-sensors > .sub-tabs-container,
body.light-mode #panel-general > .sub-tabs-container,
body.light-mode #panel-filters > .sub-tabs-container {
    border-right-color: #d0d0d0;
    border-bottom: none;
    background: #f5f5f5;
}

body.light-mode #panel-sensors > .sub-tabs-container .sub-tab.active,
body.light-mode #panel-general > .sub-tabs-container .sub-tab.active,
body.light-mode #panel-filters > .sub-tabs-container .sub-tab.active {
    border-left-color: #00aa55;
    border-bottom-color: transparent;
    background: rgba(0, 170, 85, 0.08);
}

/* Light mode - Sub-tabs */
body.light-mode .sub-tabs-container {
    background: #f5f5f5;
    border-bottom-color: #d0d0d0;
}

body.light-mode .sub-tab {
    color: #666;
}

body.light-mode .sub-tab:hover {
    color: #333;
    background: rgba(0, 0, 0, 0.03);
}

body.light-mode .sub-tab.active {
    color: #00aa55;
    border-bottom-color: #00aa55;
}

/* Toolbar */
.panel-toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.settings-action-btn {
    padding: 8px 16px;
    background: #00cc66;
    border: none;
    color: #000;
    border-radius: 5px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s;
}

.settings-action-btn:hover {
    background: #00ff88;
}

.settings-action-btn.secondary {
    background: #333;
    color: #e0e0e0;
    border: 1px solid #444;
}

.settings-action-btn.secondary:hover {
    background: #444;
    border-color: #555;
}

/* Table */
.nodes-table-container {
    overflow: auto;
    max-height: calc(100% - 60px);
}

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

.settings-table th {
    background: #0f0f0f;
    color: #888;
    font-weight: 500;
    text-align: left;
    padding: 10px 12px;
    border-bottom: 2px solid #333;
    text-transform: uppercase;
    font-size: 11px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.settings-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #252525;
    color: #e0e0e0;
}

.settings-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

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

.action-btn {
    background: transparent;
    border: 1px solid #444;
    color: #888;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    cursor: pointer;
    margin-right: 4px;
    transition: all 0.2s;
}

.action-btn:hover {
    background: #333;
    color: #fff;
    border-color: #666;
}

.action-btn.delete-node:hover,
.action-btn.delete-preset:hover {
    background: rgba(255, 68, 68, 0.2);
    border-color: #ff4444;
    color: #ff4444;
}

/* Presets Grid */
.presets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.preset-card {
    background: #222;
    border: 1px solid #444;
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.2s;
}

.preset-card:hover {
    border-color: #666;
}

.preset-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #1a1a1a;
    border-bottom: 1px solid #333;
}

.preset-card-header i {
    color: #00cc66;
    font-size: 16px;
}

.preset-name {
    flex: 1;
    font-weight: 500;
    color: #e0e0e0;
}

.preset-actions {
    display: flex;
    gap: 4px;
}

.preset-card-body {
    padding: 14px 16px;
}

.preset-detail {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 12px;
}

.preset-detail span {
    color: #888;
}

.preset-detail strong {
    color: #e0e0e0;
}

/* Footer */
.settings-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 10px 24px;
    border-top: 1px solid #333;
    background: #0f0f0f;
    border-radius: 0 0 10px 10px;
}

.settings-status {
    flex: 1;
    font-size: 13px;
    color: #888;
}

.settings-status.success { color: #00cc66; }
.settings-status.error { color: #ff4444; }
.settings-status.info { color: #0088ff; }

.settings-btn {
    padding: 10px 20px;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.settings-btn.primary {
    background: #00cc66;
    border: none;
    color: #fff;
}

.settings-btn.primary:hover {
    background: #00ff88;
}

.settings-btn.secondary {
    background: transparent;
    border: 1px solid #444;
    color: #888;
}

.settings-btn.secondary:hover {
    background: #333;
    color: #fff;
    border-color: #666;
}

.settings-btn.danger {
    background: #dc3545;
    border: none;
    color: #fff;
}

.settings-btn.danger:hover {
    background: #c82333;
}

/* Confirmation Dialog */
.confirm-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10002;
}

.confirm-dialog {
    background: #1a1a1a;
    border: 1px solid #444;
    border-radius: 8px;
    width: 400px;
    max-width: 90vw;
}

.confirm-dialog-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid #333;
    background: #0f0f0f;
    border-radius: 8px 8px 0 0;
}

.confirm-dialog-header i {
    color: #dc3545;
    font-size: 20px;
}

.confirm-dialog-header h3 {
    margin: 0;
    color: #e0e0e0;
    font-size: 16px;
    font-weight: 500;
}

.confirm-dialog-body {
    padding: 20px;
    color: #b0b0b0;
    font-size: 14px;
    line-height: 1.5;
}

.confirm-dialog-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid #333;
    background: #0f0f0f;
    border-radius: 0 0 8px 8px;
}

/* Editor Overlay */
.editor-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
}

.editor-modal {
    background: #1a1a1a;
    border: 1px solid #444;
    border-radius: 8px;
    width: 500px;
    max-width: 95vw;
    max-height: 90vh;
    overflow: auto;
}

.editor-modal.preset-editor {
    width: 600px;
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid #333;
    background: #0f0f0f;
}

.editor-header h3 {
    margin: 0;
    color: #00cc66;
    font-size: 16px;
    font-weight: 500;
}

.editor-close {
    background: transparent;
    border: none;
    color: #888;
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
}

.editor-close:hover {
    color: #fff;
}

.editor-body {
    padding: 20px;
}

.form-row {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.form-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group.full-width {
    flex: none;
    width: 100%;
}

.form-group label {
    font-size: 12px;
    color: #888;
    
    letter-spacing: 0.5px;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 10px 12px;
    background: #222;
    border: 1px solid #444;
    border-radius: 5px;
    color: #e0e0e0;
    font-size: 14px;
    transition: border-color 0.2s;
    width: 100%;
    box-sizing: border-box;
}

.form-group textarea {
    resize: vertical;
    font-family: monospace;
    min-height: 80px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #00cc66;
}

.form-group input:disabled,
.form-group textarea:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.form-section-title {
    font-size: 12px;
    color: #00cc66;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 20px 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid #333;
}

.band-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.band-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 8px 12px;
    background: #222;
    border: 1px solid #444;
    border-radius: 5px;
    transition: all 0.2s;
}

.band-checkbox:hover {
    border-color: #666;
}

.band-checkbox input {
    accent-color: #00cc66;
}

.band-checkbox input:checked + span {
    color: #00cc66;
}

.band-checkbox span {
    font-size: 13px;
    color: #aaa;
}

/* Checkbox label for inline checkboxes */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: #e0e0e0;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #00cc66;
    cursor: pointer;
}

/* Form hint text */
.form-hint {
    display: block;
    font-size: 11px;
    color: #666;
    margin-top: 4px;
    line-height: 1.4;
}

/* Form info box */
.form-info-box {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 12px;
    color: #888;
    background: rgba(0, 150, 200, 0.1);
    border: 1px solid rgba(0, 150, 200, 0.3);
    border-radius: 6px;
    padding: 12px 14px;
    line-height: 1.5;
}

.form-info-box i {
    color: #0096c8;
    margin-top: 2px;
    flex-shrink: 0;
}

/* Form error message */
.form-error {
    display: block;
    font-size: 13px;
    color: var(--danger);
    background: rgba(255, 68, 68, 0.1);
    border: 1px solid rgba(255, 68, 68, 0.3);
    border-radius: 4px;
    padding: 10px 12px;
    line-height: 1.4;
}

.editor-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid #333;
    background: #0f0f0f;
    flex-wrap: wrap;
}

.editor-error {
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 10px;
    background: rgba(255, 68, 68, 0.15);
    border: 1px solid #ff4444;
    border-radius: 4px;
    color: #ff6666;
    font-size: 13px;
}

.editor-error i {
    margin-right: 8px;
}

/* Scrollbar */
.settings-content::-webkit-scrollbar,
.nodes-table-container::-webkit-scrollbar,
.editor-modal::-webkit-scrollbar {
    width: 8px;
}

.settings-content::-webkit-scrollbar-track,
.nodes-table-container::-webkit-scrollbar-track,
.editor-modal::-webkit-scrollbar-track {
    background: #1a1a1a;
}

.settings-content::-webkit-scrollbar-thumb,
.nodes-table-container::-webkit-scrollbar-thumb,
.editor-modal::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 4px;
}

/* Responsive */
@media (max-width: 768px) {
    .settings-modal { width: 98vw; height: 95vh; }
    .form-row { flex-direction: column; gap: 12px; }
    .presets-grid { grid-template-columns: 1fr; }
}


/* Required field indicator */
.required {
    color: #ff4444;
    margin-left: 2px;
}

/* Validation error state */
.form-group input.validation-error,
.form-group select.validation-error {
    border-color: #ff4444 !important;
    background: rgba(255, 68, 68, 0.1);
}

.form-group input.validation-error:focus,
.form-group select.validation-error:focus {
    border-color: #ff6666 !important;
    box-shadow: 0 0 0 2px rgba(255, 68, 68, 0.2);
}

/* Field error message */
.field-error {
    display: block;
    color: #ff4444;
    font-size: 11px;
    margin-top: 4px;
}

/* Field hint (shows valid range) */
.field-hint {
    display: block;
    color: #666;
    font-size: 10px;
    margin-top: 2px;
}

/* Form section hint (longer description) */
.form-section-hint {
    color: #777;
    font-size: 12px;
    margin: -8px 0 16px 0;
    line-height: 1.4;
}

/* Range slider styles */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: #333;
    border-radius: 3px;
    outline: none;
    margin: 8px 0;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #00cc66;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    background: #00ff88;
}

input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #00cc66;
    border: none;
    border-radius: 50%;
    cursor: pointer;
}

.range-value {
    display: inline-block;
    min-width: 30px;
    text-align: center;
    color: #00cc66;
    font-weight: bold;
    font-size: 12px;
    margin-left: 8px;
}

/* Ensure form-group can contain absolute positioned error */
.form-group {
    position: relative;
}

/* ============================================
   General Settings Panel
   ============================================ */
.general-settings-container {
    max-width: 600px;
}

.settings-description {
    color: #888;
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 20px;
}

.form-help {
    font-size: 11px;
    color: #666;
    margin-top: 6px;
    line-height: 1.5;
}

.link-budget-info {
    background: #0f0f0f;
    border: 1px solid #333;
    border-radius: 8px;
    margin-top: 24px;
    overflow: hidden;
}

.link-budget-info .info-header {
    background: #1a1a1a;
    padding: 12px 16px;
    font-size: 13px;
    color: #00cc66;
    border-bottom: 1px solid #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.link-budget-info .info-content {
    padding: 16px;
}

.link-budget-info code {
    display: block;
    background: #222;
    padding: 12px 16px;
    border-radius: 5px;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 13px;
    color: #e0e0e0;
    margin-bottom: 12px;
}

.formula-examples {
    display: flex;
    gap: 20px;
    font-size: 12px;
    color: #888;
}

.formula-examples span {
    padding: 6px 12px;
    background: #222;
    border-radius: 4px;
}

/* ============================================
   Configuration Profiles Panel
   ============================================ */
.profiles-panel-container {
    width: 100%;
}

.profiles-panel-header {
    margin-bottom: 16px;
}

.current-profile-display {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.current-profile-label {
    font-size: 13px;
    color: #888;
}

.current-profile-name {
    font-size: 16px;
    color: #00cc66;
    font-weight: 500;
}

.profiles-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
}

.profile-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #222;
    border: 1px solid #333;
    border-radius: 6px;
    transition: all 0.2s;
}

.profile-item:hover {
    border-color: #444;
    background: #252525;
}

.profile-item.current {
    border-color: #00cc66;
    background: rgba(0, 204, 102, 0.1);
}

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

.profile-name {
    font-size: 14px;
    color: #e0e0e0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.profile-active-badge {
    font-size: 10px;
    background: #00cc66;
    color: #000;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 500;
    text-transform: uppercase;
}

.profile-date {
    font-size: 11px;
    color: #666;
}

.profile-item-actions {
    display: flex;
    gap: 6px;
}

.profile-item-actions .action-btn.disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.empty-profiles {
    color: #666;
    font-size: 13px;
    text-align: center;
    padding: 30px 20px;
    background: #1a1a1a;
    border: 1px dashed #333;
    border-radius: 6px;
}

/* ============================================
   User Management Styles
   ============================================ */

.user-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #222;
    border: 1px solid #333;
    border-radius: 6px;
    transition: all 0.2s;
}

.user-item:hover {
    border-color: #444;
    background: #252525;
}

.user-item.current {
    border-color: #00cc66;
    background: rgba(0, 204, 102, 0.1);
}

.user-item-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 16px;
}

.user-item-icon.administrator {
    background: rgba(255, 68, 68, 0.2);
    color: #ff4444;
}

.user-item-icon.operator {
    background: rgba(0, 204, 102, 0.2);
    color: #00cc66;
}

.user-item-icon.viewer {
    background: rgba(68, 138, 255, 0.2);
    color: #448aff;
}

.user-item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.user-item-name {
    font-size: 14px;
    color: #e0e0e0;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.user-active-badge {
    font-size: 10px;
    background: #00cc66;
    color: #000;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 500;
    text-transform: uppercase;
}

.user-role-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 500;
    text-transform: capitalize;
}

.user-role-badge.administrator {
    background: rgba(255, 68, 68, 0.3);
    color: #ff6666;
}

.user-role-badge.operator {
    background: rgba(0, 204, 102, 0.3);
    color: #00dd77;
}

.user-role-badge.viewer {
    background: rgba(68, 138, 255, 0.3);
    color: #66aaff;
}

.user-mfa-badge {
    font-size: 10px;
    background: rgba(255, 193, 7, 0.3);
    color: #ffbb33;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 500;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.user-mfa-badge i {
    font-size: 9px;
}

.user-item-meta {
    font-size: 11px;
    color: #666;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.user-item-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.user-item-meta i {
    font-size: 10px;
}

.user-item-actions {
    display: flex;
    gap: 6px;
}

.user-item-actions .action-btn.disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* ============================================
   Light Mode Theme Support
   ============================================ */

body.light-mode .settings-modal-overlay {
    background: rgba(200, 200, 200, 0.75);
}

body.light-mode .settings-modal {
    background: #ffffff;
    border: 1px solid #d0d0d0;
}

body.light-mode .settings-modal-header {
    background: #f5f5f5;
    border-bottom: 1px solid #d0d0d0;
}

body.light-mode .settings-modal-header h2 {
    color: #00aa55;
}

body.light-mode .settings-close-btn {
    border-color: #c0c0c0;
    color: #666;
}

body.light-mode .settings-close-btn:hover {
    background: #e8e8e8;
    color: #333;
    border-color: #999;
}

body.light-mode .settings-sidebar {
    background: #f5f5f5;
    border-right: 1px solid #d0d0d0;
}

body.light-mode .settings-tab {
    color: #666;
    border-left: 2px solid transparent;
}

body.light-mode .settings-tab:hover {
    background: #e8e8e8;
    color: #2a2a2a;
}

body.light-mode .settings-tab.active {
    background: #ffffff;
    color: #00aa55;
    border-left-color: #00aa55;
}

body.light-mode .settings-content {
    background: #ffffff;
}

body.light-mode .settings-section h3 {
    color: #2a2a2a;
    border-bottom-color: #e8e8e8;
}

body.light-mode .settings-form-group label {
    color: #666;
}

body.light-mode .settings-input,
body.light-mode .settings-textarea {
    background: #ffffff;
    border-color: #c0c0c0;
    color: #2a2a2a;
}

body.light-mode .settings-input:focus,
body.light-mode .settings-textarea:focus {
    border-color: #00aa55;
}

body.light-mode .settings-help-text {
    color: #888;
}

body.light-mode .node-list-item {
    background: #fafafa;
    border-color: #d0d0d0;
}

body.light-mode .node-list-item:hover {
    background: #f0f0f0;
    border-color: #c0c0c0;
}

body.light-mode .node-list-item.selected {
    background: #e8f5e9;
    border-color: #00aa55;
}

body.light-mode .node-name {
    color: #2a2a2a;
}

body.light-mode .node-address {
    color: #888;
}

body.light-mode .node-remove-btn {
    color: #666;
    border-color: #c0c0c0;
}

body.light-mode .node-remove-btn:hover {
    background: #ffebee;
    color: #d32f2f;
    border-color: #ef5350;
}

body.light-mode .preset-card {
    background: #fafafa;
    border-color: #d0d0d0;
}

body.light-mode .preset-card:hover {
    background: #f0f0f0;
    border-color: #c0c0c0;
}

body.light-mode .preset-card.selected {
    background: #e8f5e9;
    border-color: #00aa55;
}

body.light-mode .preset-header h4 {
    color: #2a2a2a;
}

body.light-mode .preset-mode-badge {
    color: #666;
    border-color: #c0c0c0;
}

body.light-mode .preset-details {
    color: #666;
}

body.light-mode .preset-remove-btn {
    color: #666;
    border-color: #c0c0c0;
}

body.light-mode .preset-remove-btn:hover {
    background: #ffebee;
    color: #d32f2f;
    border-color: #ef5350;
}

body.light-mode .settings-footer {
    background: #f5f5f5;
    border-top: 1px solid #d0d0d0;
}

body.light-mode .settings-btn.secondary {
    background: #ffffff;
    border-color: #c0c0c0;
    color: #666;
}

body.light-mode .settings-btn.secondary:hover {
    background: #f0f0f0;
    border-color: #999;
    color: #2a2a2a;
}

body.light-mode .settings-btn.danger {
    background: #dc3545;
    color: #fff;
}

body.light-mode .settings-btn.danger:hover {
    background: #c82333;
}

body.light-mode .confirm-dialog-overlay {
    background: rgba(0, 0, 0, 0.5);
}

body.light-mode .confirm-dialog {
    background: #ffffff;
    border-color: #d0d0d0;
}

body.light-mode .confirm-dialog-header {
    background: #f5f5f5;
    border-bottom-color: #d0d0d0;
}

body.light-mode .confirm-dialog-header h3 {
    color: #2a2a2a;
}

body.light-mode .confirm-dialog-body {
    color: #555;
}

body.light-mode .confirm-dialog-footer {
    background: #f5f5f5;
    border-top-color: #d0d0d0;
}

body.light-mode .settings-cancel-btn {
    background: transparent;
    border-color: #c0c0c0;
    color: #666;
}

body.light-mode .settings-cancel-btn:hover {
    background: #f0f0f0;
    border-color: #999;
}

body.light-mode .settings-save-btn {
    background: #00aa55;
    border-color: #00aa55;
}

body.light-mode .settings-save-btn:hover {
    background: #008844;
    border-color: #008844;
}

body.light-mode .settings-add-btn {
    background: transparent;
    border-color: #00aa55;
    color: #00aa55;
}

body.light-mode .settings-add-btn:hover {
    background: #e8f5e9;
}

body.light-mode .field-hint {
    color: #888;
}

body.light-mode .validation-error {
    color: #d32f2f;
    background: #ffebee;
    border-color: #ef5350;
}

/* Additional comprehensive fixes for settings modal */
body.light-mode .preset-card-header {
    background: #f5f5f5;
    border-bottom-color: #e8e8e8;
}

body.light-mode .preset-card-header i {
    color: #00aa55;
}

body.light-mode .preset-name {
    color: #2a2a2a;
}

body.light-mode .preset-card-body {
    background: #fafafa;
}

body.light-mode .preset-detail span {
    color: #888;
}

body.light-mode .preset-detail strong {
    color: #2a2a2a;
}

body.light-mode .action-btn {
    background: transparent;
    border-color: #c0c0c0;
    color: #666;
}

body.light-mode .action-btn:hover {
    background: #f0f0f0;
    border-color: #999;
    color: #2a2a2a;
}

body.light-mode .action-btn.add-node,
body.light-mode .action-btn.add-preset {
    color: #00aa55;
    border-color: #00aa55;
}

body.light-mode .action-btn.add-node:hover,
body.light-mode .action-btn.add-preset:hover {
    background: #e8f5e9;
}

body.light-mode .action-btn.delete-node:hover,
body.light-mode .action-btn.delete-preset:hover {
    background: #ffebee;
    border-color: #ef5350;
    color: #d32f2f;
}

body.light-mode .settings-status {
    color: #666;
}

body.light-mode .settings-status.success {
    color: #00aa55;
}

body.light-mode .settings-status.error {
    color: #d32f2f;
}

body.light-mode .settings-status.info {
    color: #1976d2;
}

/* Fix text brightness - make it darker for better readability */
body.light-mode .settings-form-group label,
body.light-mode .settings-section h3,
body.light-mode .preset-detail span {
    color: #555;
}

body.light-mode .settings-help-text {
    color: #777;
}

/* Scrollbar styling for light mode */
body.light-mode .settings-content::-webkit-scrollbar-track {
    background: #f5f5f5;
}

body.light-mode .settings-content::-webkit-scrollbar-thumb {
    background: #c0c0c0;
}

body.light-mode .settings-content::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Fix Editor Modals (Add/Edit Node and Add/Edit Preset) in Light Mode */
body.light-mode .editor-overlay {
    background: rgba(0, 0, 0, 0.5);
}

body.light-mode .editor-modal {
    background: #ffffff;
    border-color: #d0d0d0;
}

body.light-mode .editor-header {
    background: #f5f5f5;
    border-bottom-color: #d0d0d0;
}

body.light-mode .editor-header h3 {
    color: #00aa55;
}

body.light-mode .editor-close {
    color: #666;
}

body.light-mode .editor-close:hover {
    color: #2a2a2a;
}

body.light-mode .editor-body {
    background: #ffffff;
}

body.light-mode .form-group label {
    color: #555;
}

body.light-mode .form-group input,
body.light-mode .form-group select,
body.light-mode .form-group textarea {
    background: #ffffff;
    border-color: #c0c0c0;
    color: #2a2a2a;
}

body.light-mode .form-group input:focus,
body.light-mode .form-group select:focus,
body.light-mode .form-group textarea:focus {
    border-color: #00aa55;
}

body.light-mode .form-group input:disabled,
body.light-mode .form-group textarea:disabled {
    background: #f5f5f5;
    color: #888;
}

body.light-mode .form-section-title {
    color: #00aa55;
    border-bottom-color: #e8e8e8;
}

body.light-mode .band-checkboxes {
    background: transparent;
}

body.light-mode .band-checkbox {
    background: #fafafa;
    border-color: #c0c0c0;
}

body.light-mode .band-checkbox:hover {
    border-color: #999;
    background: #f0f0f0;
}

body.light-mode .band-checkbox input {
    accent-color: #00aa55;
}

body.light-mode .band-checkbox span {
    color: #555;
}

body.light-mode .band-checkbox input:checked + span {
    color: #00aa55;
}

body.light-mode .checkbox-label {
    color: #2a2a2a;
}

body.light-mode .form-hint {
    color: #888;
}

body.light-mode .form-info-box {
    background: rgba(0, 150, 200, 0.08);
    border-color: rgba(0, 150, 200, 0.25);
    color: #555;
}

body.light-mode .form-error {
    color: #cc0000;
    background: rgba(255, 68, 68, 0.08);
    border-color: rgba(255, 68, 68, 0.25);
}

body.light-mode .editor-footer {
    background: #f5f5f5;
    border-top-color: #d0d0d0;
}

body.light-mode .editor-error {
    background: rgba(211, 47, 47, 0.1);
    border-color: #d32f2f;
    color: #c62828;
}

body.light-mode .required {
    color: #d32f2f;
}

body.light-mode .field-error {
    color: #d32f2f;
}

body.light-mode .form-group input.validation-error,
body.light-mode .form-group select.validation-error {
    border-color: #d32f2f !important;
    background: #ffebee;
}

body.light-mode .form-group input.validation-error:focus,
body.light-mode .form-group select.validation-error:focus {
    border-color: #c62828 !important;
    box-shadow: 0 0 0 2px rgba(211, 47, 47, 0.2);
}

body.light-mode .editor-modal::-webkit-scrollbar-track {
    background: #f5f5f5;
}

body.light-mode .editor-modal::-webkit-scrollbar-thumb {
    background: #c0c0c0;
}

body.light-mode .editor-modal::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Fix Settings Tabs Background in Light Mode */
body.light-mode .settings-tabs-container {
    background: #f5f5f5;
    border-bottom-color: #d0d0d0;
}

body.light-mode .settings-tabs {
    background: #f5f5f5;
}

body.light-mode .settings-tabs-scroll-btn {
    background: #f5f5f5;
    color: #999;
}

body.light-mode .settings-tabs-scroll-btn:hover {
    color: #00aa55;
    background: #e8e8e8;
}

body.light-mode .settings-tabs-scroll-btn.left {
    border-right-color: #d0d0d0;
}

body.light-mode .settings-tabs-scroll-btn.right {
    border-left-color: #d0d0d0;
}

/* Fix Settings Table in Light Mode */
body.light-mode .nodes-table-container {
    background: #ffffff;
}

body.light-mode .settings-table th {
    background: #f5f5f5;
    color: #555;
    border-bottom-color: #d0d0d0;
}

body.light-mode .settings-table td {
    color: #2a2a2a;
    border-bottom-color: #e8e8e8;
}

body.light-mode .settings-table tbody tr:hover {
    background: #f9f9f9;
}

body.light-mode .nodes-table-container::-webkit-scrollbar-track {
    background: #f5f5f5;
}

body.light-mode .nodes-table-container::-webkit-scrollbar-thumb {
    background: #c0c0c0;
}

body.light-mode .nodes-table-container::-webkit-scrollbar-thumb:hover {
    background: #999;
}

body.light-mode .settings-action-btn {
    background: #00aa55;
    color: #ffffff;
}

body.light-mode .settings-action-btn:hover {
    background: #008844;
}

body.light-mode .settings-action-btn.secondary {
    background: #e8e8e8;
    color: #333;
    border: 1px solid #c0c0c0;
}

body.light-mode .settings-action-btn.secondary:hover {
    background: #d8d8d8;
    border-color: #aaa;
}

/* Light mode - General Settings Panel */
body.light-mode .settings-description {
    color: #666;
}

body.light-mode .form-help {
    color: #888;
}

body.light-mode .link-budget-info {
    background: #f9f9f9;
    border-color: #d0d0d0;
}

body.light-mode .link-budget-info .info-header {
    background: #f5f5f5;
    color: #00aa55;
    border-bottom-color: #d0d0d0;
}

body.light-mode .link-budget-info .info-content {
    background: #ffffff;
}

body.light-mode .link-budget-info code {
    background: #f5f5f5;
    color: #2a2a2a;
}

body.light-mode .formula-examples span {
    background: #f5f5f5;
    color: #555;
}

/* Light mode - Configuration Profiles */
body.light-mode .current-profile-label {
    color: #666;
}

body.light-mode .current-profile-name {
    color: #00aa55;
}

body.light-mode .profile-item {
    background: #ffffff;
    border-color: #d0d0d0;
}

body.light-mode .profile-item:hover {
    background: #fafafa;
    border-color: #c0c0c0;
}

body.light-mode .profile-item.current {
    border-color: #00aa55;
    background: rgba(0, 170, 85, 0.1);
}

body.light-mode .profile-name {
    color: #2a2a2a;
}

body.light-mode .profile-active-badge {
    background: #00aa55;
}

body.light-mode .profile-date {
    color: #888;
}

body.light-mode .empty-profiles {
    color: #888;
    background: #f5f5f5;
    border-color: #d0d0d0;
}

body.light-mode .user-item {
    background: #ffffff;
    border-color: #d0d0d0;
}

body.light-mode .user-item:hover {
    background: #fafafa;
    border-color: #c0c0c0;
}

body.light-mode .user-item.current {
    border-color: #00aa55;
    background: rgba(0, 170, 85, 0.1);
}

body.light-mode .user-item-icon.administrator {
    background: rgba(255, 68, 68, 0.1);
    color: #cc0000;
}

body.light-mode .user-item-icon.operator {
    background: rgba(0, 170, 85, 0.1);
    color: #00aa55;
}

body.light-mode .user-item-icon.viewer {
    background: rgba(68, 138, 255, 0.1);
    color: #0066dd;
}

body.light-mode .user-item-name {
    color: #2a2a2a;
}

body.light-mode .user-active-badge {
    background: #00aa55;
}

body.light-mode .user-role-badge.administrator {
    background: rgba(255, 68, 68, 0.15);
    color: #cc0000;
}

body.light-mode .user-role-badge.operator {
    background: rgba(0, 170, 85, 0.15);
    color: #00aa55;
}

body.light-mode .user-role-badge.viewer {
    background: rgba(68, 138, 255, 0.15);
    color: #0066dd;
}

body.light-mode .user-mfa-badge {
    background: rgba(255, 193, 7, 0.2);
    color: #cc8800;
}

body.light-mode .user-item-meta {
    color: #888;
}

/* ============================================
   Server Metrics Panel
   ============================================ */
.server-metrics-container {
    max-width: 900px;
}

.metrics-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #333;
}

.metrics-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    color: #e0e0e0;
}

.metrics-title i {
    color: #00cc66;
    font-size: 18px;
}

.metrics-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #888;
}

.metrics-status .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #666;
    animation: pulse 2s infinite;
}

.metrics-status.connected .status-dot {
    background: #00cc66;
}

.metrics-status.connected .status-text {
    color: #00cc66;
}

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

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.metric-card {
    background: #222;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 16px;
    display: flex;
    gap: 14px;
}

.metric-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: rgba(0, 204, 102, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.metric-icon i {
    color: #00cc66;
    font-size: 18px;
}

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

.metric-label {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.metric-value {
    font-size: 24px;
    font-weight: 500;
    color: #e0e0e0;
    margin-bottom: 6px;
}

.metric-details {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    font-size: 11px;
    color: #666;
}

.metric-bar {
    height: 4px;
    background: #333;
    border-radius: 2px;
    margin-top: 10px;
    overflow: hidden;
}

.metric-bar-fill {
    height: 100%;
    background: #00cc66;
    border-radius: 2px;
    transition: width 0.3s ease;
}

.metric-bar-fill.warning {
    background: #f59e0b;
}

.metric-bar-fill.critical {
    background: #ef4444;
}

.server-info-section {
    margin-top: 24px;
}

.server-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.info-item {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 6px;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.info-label {
    font-size: 12px;
    color: #888;
}

.info-value {
    font-size: 13px;
    color: #e0e0e0;
    font-family: 'Monaco', 'Menlo', monospace;
}

.server-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 12px;
}

.server-actions .action-hint {
    font-size: 12px;
    color: #666;
    font-style: italic;
}

/* Light mode - Server Metrics */
body.light-mode .metrics-header {
    border-bottom-color: #e8e8e8;
}

body.light-mode .metrics-title {
    color: #2a2a2a;
}

body.light-mode .metrics-title i {
    color: #00aa55;
}

body.light-mode .metrics-status {
    color: #888;
}

body.light-mode .metrics-status .status-dot {
    background: #c0c0c0;
}

body.light-mode .metrics-status.connected .status-dot {
    background: #00aa55;
}

body.light-mode .metrics-status.connected .status-text {
    color: #00aa55;
}

body.light-mode .metric-card {
    background: #fafafa;
    border-color: #d0d0d0;
}

body.light-mode .metric-icon {
    background: rgba(0, 170, 85, 0.1);
}

body.light-mode .metric-icon i {
    color: #00aa55;
}

body.light-mode .metric-label {
    color: #666;
}

body.light-mode .metric-value {
    color: #2a2a2a;
}

body.light-mode .metric-details {
    color: #888;
}

body.light-mode .metric-bar {
    background: #e8e8e8;
}

body.light-mode .metric-bar-fill {
    background: #00aa55;
}

body.light-mode .info-item {
    background: #f5f5f5;
    border-color: #d0d0d0;
}

body.light-mode .info-label {
    color: #666;
}

body.light-mode .info-value {
    color: #2a2a2a;
}

/* CPU Cores Grid */
.cpu-cores-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.cpu-core-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #222;
    border: 1px solid #333;
    border-radius: 6px;
    padding: 10px 12px;
}

.cpu-core-label {
    font-size: 12px;
    color: #888;
    min-width: 50px;
}

.cpu-core-bar-container {
    flex: 1;
    height: 8px;
    background: #333;
    border-radius: 4px;
    overflow: hidden;
}

.cpu-core-bar {
    height: 100%;
    background: #00cc66;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.cpu-core-bar.warning {
    background: #f0ad4e;
}

.cpu-core-bar.critical {
    background: #e74c3c;
}

.cpu-core-percent {
    font-size: 13px;
    font-weight: 600;
    color: #eee;
    min-width: 40px;
    text-align: right;
}

.cpu-core-placeholder {
    color: #666;
    font-style: italic;
    padding: 20px;
    text-align: center;
}

body.light-mode .cpu-core-item {
    background: #f5f5f5;
    border-color: #d0d0d0;
}

body.light-mode .cpu-core-bar-container {
    background: #ddd;
}

body.light-mode .cpu-core-percent {
    color: #333;
}

.users-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 20px;
}

.user-card {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: border-color 0.2s ease;
}

.user-card:hover {
    border-color: #555;
}

.user-card-header {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
}

.user-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #fff;
}

.user-icon.administrator {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.user-icon.operator {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.user-icon.viewer {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.user-info h4 {
    margin: 0;
    font-size: 16px;
    color: #e0e0e0;
    font-weight: 600;
}

.user-info p {
    margin: 4px 0 0 0;
    font-size: 13px;
    color: #888;
}

.user-role {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #333;
    color: #aaa;
}

.user-meta {
    font-size: 12px !important;
    color: #666 !important;
}

.user-meta i {
    opacity: 0.5;
    font-size: 11px;
}

.user-card-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.icon-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 14px;
}

.icon-btn.danger:hover {
    background: #ff4444;
    border-color: #ff4444;
    color: #fff;
}

/* Password strength indicator */
.password-strength {
    margin-top: 12px;
}

.strength-bar {
    height: 4px;
    background: #2a2a2a;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 6px;
}

.strength-bar-fill {
    height: 100%;
    transition: width 0.3s ease, background-color 0.3s ease;
    border-radius: 2px;
}

.strength-bar-fill.weak {
    background: #ff4444;
}

.strength-bar-fill.fair {
    background: #ff9900;
}

.strength-bar-fill.good {
    background: #00aa55;
}

.strength-bar-fill.strong {
    background: #00dd66;
}

.strength-text {
    font-size: 12px;
    color: #888;
}

/* Light mode - Security Panel */
body.light-mode .user-card {
    background: #fafafa;
    border-color: #d0d0d0;
}

body.light-mode .user-card:hover {
    border-color: #b0b0b0;
}

body.light-mode .user-info h4 {
    color: #2a2a2a;
}

body.light-mode .user-info p {
    color: #666;
}

body.light-mode .user-role {
    background: #e0e0e0;
    color: #666;
}

body.light-mode .user-meta {
    color: #888 !important;
}

body.light-mode .strength-bar {
    background: #e8e8e8;
}

body.light-mode .strength-text {
    color: #666;
}

/* ============================================
   MFA Management UI
   ============================================ */

.mfa-options-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mfa-option-btn {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    width: 100%;
}

.mfa-option-btn:hover {
    background: #333;
    border-color: var(--primary);
}

.mfa-option-btn.danger:hover {
    background: rgba(255, 68, 68, 0.15);
    border-color: var(--danger);
}

.mfa-option-btn i {
    font-size: 24px;
    color: var(--primary);
}

.mfa-option-btn.danger i {
    color: var(--danger);
}

.mfa-option-btn div {
    flex: 1;
}

.mfa-option-btn strong {
    display: block;
    margin-bottom: 3px;
    color: #fff;
}

.mfa-option-btn span {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
}

.manual-entry-section {
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 6px;
    padding: 15px;
    margin-top: 20px;
}

.manual-code {
    background: #1a1a1a;
    border: 1px solid #555;
    border-radius: 4px;
    padding: 12px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    letter-spacing: 1px;
    text-align: center;
    color: var(--primary);
    margin-top: 10px;
    user-select: all;
    word-wrap: break-word;
    word-break: break-all;
    overflow-wrap: break-word;
}

.backup-codes-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 15px;
}

.backup-code {
    background: #1a1a1a;
    border: 1px solid #555;
    border-radius: 4px;
    padding: 12px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    letter-spacing: 1px;
    text-align: center;
    color: #fff;
    user-select: all;
}

/* Light mode MFA UI */

body.light-mode .mfa-option-btn {
    background: #f5f5f5;
    border-color: #d0d0d0;
}

body.light-mode .mfa-option-btn:hover {
    background: #e8e8e8;
    border-color: #00aa55;
}

body.light-mode .mfa-option-btn.danger:hover {
    background: rgba(255, 68, 68, 0.1);
    border-color: #cc0000;
}

body.light-mode .mfa-option-btn strong {
    color: #2a2a2a;
}

body.light-mode .manual-entry-section {
    background: #f5f5f5;
    border-color: #d0d0d0;
}

body.light-mode .manual-code {
    background: #fff;
    border-color: #c0c0c0;
    color: #00aa55;
}

body.light-mode .backup-code {
    background: #fff;
    border-color: #c0c0c0;
    color: #2a2a2a;
}

/* ============== Playbook Panel Styles ============== */

.playbook-name {
    font-weight: 500;
    color: #e0e0e0;
}

.playbook-desc {
    color: #888;
    font-size: 12px;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.checkbox-label.compact {
    justify-content: center;
}

.checkbox-label.compact span {
    display: none;
}

/* Playbook Editor */
.playbook-editor {
    width: 900px;
}

.playbook-editor .editor-body {
    padding: 20px;
}

/* Conditions List */
.conditions-list {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 6px;
    padding: 10px;
    min-height: 60px;
}

.condition-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: #222;
    border-radius: 4px;
    margin-bottom: 6px;
}

.condition-row:last-child {
    margin-bottom: 0;
}

.condition-row select {
    padding: 6px 10px;
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 13px;
}

.condition-row select.condition-field {
    width: 140px;
}

.condition-row select.condition-operator {
    width: 110px;
}

.condition-row input.condition-value {
    flex: 1;
    padding: 6px 10px;
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 13px;
}

.condition-row .action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
}

/* Custom dropdowns in condition rows */
.condition-row .custom-dropdown {
    flex-shrink: 0;
}

.condition-row .custom-dropdown.condition-field {
    width: 140px;
}

.condition-row .custom-dropdown.condition-operator {
    width: 110px;
}

.condition-row .custom-dropdown.condition-value {
    flex: 1;
    min-width: 120px;
}

.condition-row .custom-dropdown .dropdown-toggle {
    padding: 6px 10px;
    font-size: 13px;
    min-height: 32px;
    background: #2a2a2a;
    border: 1px solid #444;
}

.condition-row .custom-dropdown .dropdown-menu {
    font-size: 13px;
    z-index: 1000;
}

.condition-row .custom-dropdown .dropdown-item {
    padding: 8px 10px;
}

/* Actions List */
.actions-list {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 6px;
    padding: 10px;
    min-height: 80px;
}

.action-step {
    background: #222;
    border: 1px solid #333;
    border-radius: 6px;
    margin-bottom: 10px;
    overflow: visible;
}

.action-step:last-child {
    margin-bottom: 0;
}

.action-step-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: #2a2a2a;
    border-bottom: 1px solid #333;
}

.step-label {
    font-weight: 500;
    color: #00cc66;
    font-size: 13px;
}

.action-step-header .settings-action-btn {
    margin-left: auto;
}

.action-step-header .delete-step {
    margin-left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.parallel-actions {
    padding: 10px;
}

.parallel-actions .dropdown-menu {
    position: fixed;
    z-index: 10002;
}

.action-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 4px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.action-row:last-child {
    margin-bottom: 0;
}

.action-row select.action-type {
    width: 100px;
    padding: 6px 10px;
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 13px;
}

/* Custom dropdown for action type */
.action-row .custom-dropdown.action-type {
    width: 100px;
    flex-shrink: 0;
}

.action-row .custom-dropdown .dropdown-toggle {
    padding: 6px 10px;
    font-size: 13px;
    min-height: 32px;
    background: #2a2a2a;
    border: 1px solid #444;
}

.action-row .custom-dropdown .dropdown-menu {
    font-size: 13px;
    z-index: 1000;
}

.action-row .custom-dropdown .dropdown-item {
    padding: 8px 10px;
}

/* Custom dropdowns in action config */
.action-config .custom-dropdown {
    flex-shrink: 0;
}

.action-config .custom-dropdown.config-nodes {
    width: 170px;
}

.action-config .custom-dropdown.config-node {
    width: 130px;
}

.action-config .custom-dropdown.config-preset {
    width: 150px;
}

.action-config .custom-dropdown.config-level {
    width: 100px;
}

.action-config .custom-dropdown .dropdown-toggle {
    padding: 6px 10px;
    font-size: 13px;
    min-height: 32px;
    background: #2a2a2a;
    border: 1px solid #444;
}

.action-config .custom-dropdown .dropdown-menu {
    font-size: 13px;
    z-index: 1000;
}

.action-config .custom-dropdown .dropdown-item {
    padding: 8px 10px;
}

.action-config {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    flex-wrap: wrap;
}

.action-config select,
.action-config input {
    padding: 6px 10px;
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 13px;
}

.action-config .config-label {
    color: #888;
    font-size: 12px;
    font-style: italic;
}

.action-row .action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
    align-self: flex-start;
    margin-top: 2px;
}

/* Empty list placeholder */
.empty-list {
    color: #666;
    font-style: italic;
    font-size: 13px;
    text-align: center;
    padding: 20px;
}

/* Small toolbar button variant */
.settings-action-btn.small {
    padding: 4px 10px;
    font-size: 12px;
}

/* Fixed-width variant for stacked rows of equally-sized actions */
.settings-action-btn.fixed-width {
    min-width: 150px;
    justify-content: left;
}

/* Light mode playbook styles */
body.light-mode .conditions-list,
body.light-mode .actions-list {
    background: #f5f5f5;
    border-color: #d0d0d0;
}

body.light-mode .condition-row,
body.light-mode .action-step {
    background: #fff;
    border-color: #d0d0d0;
}

body.light-mode .action-step-header {
    background: #f0f0f0;
    border-color: #d0d0d0;
}

body.light-mode .action-row {
    background: #f8f8f8;
    border-color: #d0d0d0;
}

body.light-mode .condition-row select,
body.light-mode .condition-row input,
body.light-mode .action-row select,
body.light-mode .action-config select,
body.light-mode .action-config input {
    background: #fff;
    border-color: #c0c0c0;
    color: #2a2a2a;
}

body.light-mode .condition-row .custom-dropdown .dropdown-toggle,
body.light-mode .action-row .custom-dropdown .dropdown-toggle,
body.light-mode .action-config .custom-dropdown .dropdown-toggle {
    background: #fff;
    border-color: #c0c0c0;
    color: #2a2a2a;
}

body.light-mode .condition-row .custom-dropdown .dropdown-menu,
body.light-mode .action-row .custom-dropdown .dropdown-menu,
body.light-mode .action-config .custom-dropdown .dropdown-menu {
    background: #fff;
    border-color: #c0c0c0;
}

body.light-mode .condition-row .custom-dropdown .dropdown-item,
body.light-mode .action-row .custom-dropdown .dropdown-item,
body.light-mode .action-config .custom-dropdown .dropdown-item {
    color: #2a2a2a;
}

body.light-mode .condition-row .custom-dropdown .dropdown-item:hover,
body.light-mode .action-row .custom-dropdown .dropdown-item:hover,
body.light-mode .action-config .custom-dropdown .dropdown-item:hover {
    background: #f0f0f0;
}

body.light-mode .playbook-name {
    color: #2a2a2a;
}

/* Trigger subsection (zone/tripwire selection) */
.trigger-subsection {
    margin-top: 10px;
    padding: 12px;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 6px;
}

.trigger-subsection .form-row {
    margin-bottom: 10px;
}

.trigger-subsection .form-row:last-child {
    margin-bottom: 0;
}

.checkbox-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 20px;
}

.checkbox-scroll-list {
    max-height: 150px;
    overflow-y: auto;
    background: #252525;
    border: 1px solid #3a3a3a;
    border-radius: 4px;
    padding: 8px;
}

.checkbox-scroll-list .checkbox-label {
    display: flex;
    align-items: center;
    padding: 4px 0;
    border-bottom: 1px solid #333;
}

.checkbox-scroll-list .checkbox-label:last-child {
    border-bottom: none;
}

.zone-type-badge {
    display: inline-block;
    padding: 2px 6px;
    margin-left: 8px;
    font-size: 10px;
    background: #3a3a3a;
    border-radius: 3px;
    color: #aaa;
    text-transform: capitalize;
}

.zone-list-container,
.tripwire-list-container {
    margin-top: 6px;
}

/* Light mode trigger subsection */
body.light-mode .trigger-subsection {
    background: #f5f5f5;
    border-color: #d0d0d0;
}

body.light-mode .checkbox-scroll-list {
    background: #fff;
    border-color: #c0c0c0;
}

body.light-mode .checkbox-scroll-list .checkbox-label {
    border-color: #e0e0e0;
}

body.light-mode .zone-type-badge {
    background: #e0e0e0;
    color: #666;
}

/* ============================================
   Offline Maps Styles
   ============================================ */
.offline-maps-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.empty-offline-maps {
    color: #666;
    font-size: 13px;
    padding: 24px;
    text-align: center;
    background: #1a1a1a;
    border: 1px dashed #333;
    border-radius: 6px;
}

.offline-map-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #1f1f1f;
    border: 1px solid #333;
    border-radius: 6px;
    transition: all 0.2s;
}

.offline-map-item:hover {
    border-color: #444;
    background: #252525;
}

.offline-map-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.offline-map-name {
    color: #fff;
    font-weight: 500;
    font-size: 14px;
}

.offline-map-details {
    color: #888;
    font-size: 12px;
}

.offline-map-actions {
    display: flex;
    gap: 6px;
}

.offline-map-estimate {
    color: #aaa;
    font-size: 13px;
}

/* Download progress */
.download-progress {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.download-progress-text {
    color: #fff;
    font-size: 13px;
}

.download-progress-bar-container {
    height: 8px;
    background: #333;
    border-radius: 4px;
    overflow: hidden;
}

.download-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #00cc66, #00ff88);
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* Map selector modal */
#offline-map-container {
    background: #0a0a0a;
}

.map-draw-instructions {
    pointer-events: none;
}

/* Light mode offline maps */
body.light-mode .empty-offline-maps {
    color: #888;
    background: #f5f5f5;
    border-color: #d0d0d0;
}

body.light-mode .offline-map-item {
    background: #ffffff;
    border-color: #d0d0d0;
}

body.light-mode .offline-map-item:hover {
    background: #fafafa;
    border-color: #c0c0c0;
}

body.light-mode .offline-map-name {
    color: #2a2a2a;
}

body.light-mode .offline-map-details {
    color: #666;
}

body.light-mode .download-progress-bar-container {
    background: #e0e0e0;
}

body.light-mode .download-progress-text {
    color: #2a2a2a;
}

/* ============== Spoof Scenario Config ============== */
.scenario-config {
    width: 100%;
    margin-top: 8px;
    padding: 12px;
    background: #252525;
    border: 1px solid #333;
    border-radius: 6px;
}

.scenario-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    margin-bottom: 10px;
}

.scenario-row:last-child {
    margin-bottom: 0;
}

.scenario-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.scenario-field label {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.scenario-field input[type="number"],
.scenario-field input[type="text"] {
    padding: 6px 10px;
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 13px;
    width: 100%;
    box-sizing: border-box;
}

.scenario-field input:focus {
    outline: none;
    border-color: #00cc66;
}

.scenario-field textarea {
    padding: 8px 10px;
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 12px;
    font-family: monospace;
    resize: vertical;
    width: 100%;
    box-sizing: border-box;
}

.scenario-field textarea:focus {
    outline: none;
    border-color: #00cc66;
}

.scenario-field .custom-dropdown .dropdown-toggle {
    padding: 6px 10px;
    font-size: 13px;
    min-height: 32px;
    background: #2a2a2a;
    border: 1px solid #444;
}

.scenario-field .custom-dropdown .dropdown-menu {
    font-size: 13px;
    z-index: 1000;
}

.scenario-field .custom-dropdown .dropdown-item {
    padding: 8px 10px;
}

.band-checkboxes-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.band-checkbox-sm {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 12px;
    color: #aaa;
}

.band-checkbox-sm:hover {
    border-color: #666;
}

.band-checkbox-sm:has(input:checked) {
    border-color: #00cc66;
    background: rgba(0, 204, 102, 0.1);
}

.band-checkbox-sm:has(input:checked) span {
    color: #00cc66;
}

.band-checkbox-sm input {
    width: 14px;
    height: 14px;
    accent-color: #00cc66;
}

/* Node checkboxes in action config */
.node-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
    width: 100%;
}

.node-checkbox {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #ccc;
    cursor: pointer;
}

.node-checkbox input {
    width: 14px;
    height: 14px;
    accent-color: #00cc66;
}

/* Step header duration */
.step-timing {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    font-size: 12px;
    color: #888;
}

.step-timing input {
    width: 55px;
    padding: 4px 6px;
    background: #333;
    border: 1px solid #444;
    border-radius: 3px;
    color: #e0e0e0;
    font-size: 12px;
    text-align: center;
}

.step-timing input:focus {
    outline: none;
    border-color: #00cc66;
}

.step-timing .unit {
    color: #666;
}

/* Light mode - Scenario config */
body.light-mode .scenario-config {
    background: #f5f5f5;
    border-color: #d0d0d0;
}

body.light-mode .scenario-field label {
    color: #666;
}

body.light-mode .scenario-field input,
body.light-mode .scenario-field textarea {
    background: #fff;
    border-color: #c0c0c0;
    color: #2a2a2a;
}

body.light-mode .scenario-field .custom-dropdown .dropdown-toggle {
    background: #fff;
    border-color: #c0c0c0;
    color: #2a2a2a;
}

body.light-mode .band-checkbox-sm {
    background: #fff;
    border-color: #c0c0c0;
    color: #555;
}

body.light-mode .band-checkbox-sm:has(input:checked) {
    border-color: #00aa55;
    background: rgba(0, 170, 85, 0.1);
}

body.light-mode .band-checkbox-sm:has(input:checked) span {
    color: #00aa55;
}

body.light-mode .step-timing input {
    background: #e8e8e8;
    border-color: #c0c0c0;
    color: #2a2a2a;
}

/* ============== Camera Detection Settings ============== */
.detection-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

.detection-badge.active {
    background: rgba(0, 200, 100, 0.2);
    color: #00c864;
}

.detection-badge.inactive {
    background: rgba(128, 128, 128, 0.2);
    color: #888;
}

.form-section-divider {
    border-top: 1px solid #333;
    margin: 20px 0 15px;
}

.form-section-title {
    color: #00cc66;
    font-size: 14px;
    font-weight: 500;
    margin: 0 0 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-section-title i {
    font-size: 12px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: #ccc;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #00cc66;
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.detect-type-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #252525;
    border: 1px solid #333;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.detect-type-checkbox:hover {
    border-color: #444;
    background: #2a2a2a;
}

.detect-type-checkbox:has(input:checked) {
    border-color: #00cc66;
    background: rgba(0, 200, 100, 0.1);
}

.detect-type-checkbox input {
    width: 14px;
    height: 14px;
    accent-color: #00cc66;
}

.detect-type-checkbox i {
    color: #888;
    font-size: 12px;
}

.detect-type-checkbox:has(input:checked) i {
    color: #00cc66;
}

.detect-type-checkbox span {
    color: #ccc;
    font-size: 12px;
}

.zone-count {
    font-size: 11px;
    color: #00cc66;
    margin-left: 4px;
}

/* ============== Zone Editor Modal ============== */
.zone-editor-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
}

.zone-editor-modal {
    background: #1a1a1a;
    border: 1px solid #444;
    border-radius: 10px;
    width: 90vw;
    max-width: 1100px;
    height: 80vh;
    display: flex;
    flex-direction: column;
}

.zone-editor-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.zone-video-container {
    flex: 1;
    position: relative;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.zone-video-container video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.zone-video-container canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: auto;
}

.zone-video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
    color: #888;
    gap: 10px;
}

.zone-video-overlay i {
    font-size: 32px;
}

.zone-instructions {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 200, 100, 0.9);
    color: #000;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
}

.zone-sidebar {
    width: 280px;
    background: #151515;
    border-left: 1px solid #333;
    display: flex;
    flex-direction: column;
}

.zone-toolbar {
    padding: 15px;
    border-bottom: 1px solid #333;
}

.zone-list {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.zone-list-empty {
    color: #666;
    font-size: 13px;
    text-align: center;
    padding: 20px;
}

.zone-list-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: #1e1e1e;
    border: 1px solid #333;
    border-radius: 4px;
    margin-bottom: 8px;
}

.zone-item-color {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    flex-shrink: 0;
}

.zone-name-input {
    flex: 1;
    background: transparent;
    border: none;
    color: #ccc;
    font-size: 13px;
    padding: 4px;
}

.zone-name-input:focus {
    outline: none;
    background: #252525;
    border-radius: 3px;
}

.zone-item-btn {
    background: transparent;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 4px 8px;
    transition: color 0.2s;
}

.zone-item-btn:hover {
    color: #ff4444;
}

.zone-help {
    padding: 15px;
    border-top: 1px solid #333;
    color: #888;
    font-size: 12px;
}

.zone-help p {
    margin: 0 0 8px;
}

.zone-help ul {
    margin: 0;
    padding-left: 16px;
}

.zone-help li {
    margin-bottom: 4px;
}

/* Light mode for detection settings */
body.light-mode .detection-badge.active {
    background: rgba(0, 180, 80, 0.15);
    color: #00994d;
}

body.light-mode .detection-badge.inactive {
    background: rgba(128, 128, 128, 0.15);
    color: #666;
}

body.light-mode .form-section-divider {
    border-color: #ddd;
}

body.light-mode .form-section-title {
    color: #00994d;
}

body.light-mode .checkbox-label {
    color: #333;
}

body.light-mode .detect-type-checkbox {
    background: #f5f5f5;
    border-color: #ddd;
}

body.light-mode .detect-type-checkbox:hover {
    background: #eee;
    border-color: #ccc;
}

body.light-mode .detect-type-checkbox:has(input:checked) {
    border-color: #00994d;
    background: rgba(0, 180, 80, 0.1);
}

body.light-mode .detect-type-checkbox:has(input:checked) i {
    color: #00994d;
}

body.light-mode .detect-type-checkbox span {
    color: #333;
}

body.light-mode .zone-count {
    color: #00994d;
}

body.light-mode .zone-editor-modal {
    background: #fff;
    border-color: #ccc;
}

body.light-mode .zone-sidebar {
    background: #f5f5f5;
    border-color: #ddd;
}

body.light-mode .zone-toolbar {
    border-color: #ddd;
}

body.light-mode .zone-list-empty {
    color: #999;
}

body.light-mode .zone-list-item {
    background: #fff;
    border-color: #ddd;
}

body.light-mode .zone-name-input {
    color: #333;
}

body.light-mode .zone-name-input:focus {
    background: #f0f0f0;
}

body.light-mode .zone-help {
    border-color: #ddd;
    color: #666;
}

/* ============== Playbooks Sidebar Tab ============== */
.playbooks-sidebar-list {
    padding: 8px;
    overflow-y: auto;
}

.playbook-sidebar-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 6px;
    margin-bottom: 8px;
    transition: all 0.2s;
}

.playbook-sidebar-item:hover {
    background: #222;
    border-color: #444;
}

.playbook-sidebar-item.pb-disabled {
    opacity: 0.5;
}

.playbook-sidebar-info {
    flex: 1;
    min-width: 0;
}

.playbook-sidebar-name {
    display: block;
    font-weight: 500;
    color: #e0e0e0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.playbook-sidebar-desc {
    display: block;
    font-size: 11px;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 4px;
}

.playbook-sidebar-steps {
    margin-top: 4px;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.pb-step {
    font-size: 11px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pb-step-done {
    color: #555;
    text-decoration: line-through;
}

.pb-step-active {
    color: #00cc66;
    font-weight: 600;
}

.pb-step-pending {
    color: #666;
}

.playbook-run-btn {
    background: #00cc66;
    border: none;
    color: #000;
    border-radius: 4px;
    width: 28px;
    height: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 11px;
}

.playbook-run-btn:hover {
    background: #00ff88;
}

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

/* ============== Playbook Confirmation Modal ============== */
.playbook-confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.playbook-confirm-modal {
    background: #1a1a1a;
    border: 1px solid #444;
    border-radius: 8px;
    padding: 24px;
    max-width: 440px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

.playbook-confirm-modal h3 {
    color: #e0e0e0;
    margin: 0 0 12px;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.playbook-confirm-modal .target-name {
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 4px;
}

.playbook-confirm-modal .countdown {
    font-size: 13px;
    color: #888;
    margin-bottom: 16px;
}

.playbook-confirm-modal .dropdown-toggle {
    padding: 8px 12px;
    font-size: 13px;
}

.playbook-confirm-modal .dropdown-item {
    padding: 8px 12px;
    font-size: 13px;
}

.playbook-confirm-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* Node availability warning in playbook run modal */
.pb-node-warning {
    background: rgba(255, 170, 0, 0.1);
    border: 1px solid #ffaa00;
    border-radius: 6px;
    padding: 10px 12px;
    margin-bottom: 14px;
}

.pb-node-warning.pb-node-warning-error {
    background: rgba(204, 51, 51, 0.1);
    border-color: #cc3333;
}

.pb-node-warning-title {
    font-size: 12px;
    font-weight: 600;
    color: #ffaa00;
    margin-bottom: 6px;
}

.pb-node-warning-error .pb-node-warning-title {
    color: #cc3333;
}

.pb-node-warning-item {
    font-size: 12px;
    color: #ccc;
    padding: 2px 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.pb-node-warning-item i {
    color: #888;
    width: 14px;
    text-align: center;
    font-size: 11px;
}

.pb-node-reason {
    color: #888;
    font-size: 11px;
    margin-left: auto;
}

.pb-node-warning-note {
    font-size: 11px;
    color: #999;
    margin-top: 6px;
    font-style: italic;
}

body.light-mode .pb-node-warning {
    background: rgba(255, 170, 0, 0.08);
}

body.light-mode .pb-node-warning.pb-node-warning-error {
    background: rgba(204, 51, 51, 0.08);
}

body.light-mode .pb-node-warning-item {
    color: #333;
}

body.light-mode .pb-node-warning-item i {
    color: #666;
}

body.light-mode .pb-node-reason {
    color: #666;
}

body.light-mode .pb-node-warning-note {
    color: #666;
}

/* Auto-generated description (plain text, no box) */
.playbook-desc-auto {
    font-size: 12px;
    color: #888;
    line-height: 1.5;
    padding: 4px 0;
}

/* Stop button */
.playbook-stop-btn {
    background: #cc3333;
    border: none;
    color: #fff;
    border-radius: 4px;
    width: 28px;
    height: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 11px;
}

.playbook-stop-btn:hover {
    background: #ff4444;
}

/* Running state */
.playbook-sidebar-item.pb-running {
    border-color: #00cc66;
}

/* Progress bar */
.playbook-progress-bar {
    height: 3px;
    background: #333;
    border-radius: 2px;
    margin-top: 8px;
    overflow: hidden;
}

.playbook-progress-fill {
    height: 100%;
    background: #00cc66;
    border-radius: 2px;
    transition: width 0.5s linear;
}

@keyframes pb-indeterminate {
    0%   { transform: translateX(-100%); width: 40%; }
    100% { transform: translateX(350%);  width: 40%; }
}

.playbook-progress-fill.pb-indeterminate {
    width: 40% !important;
    animation: pb-indeterminate 1.4s ease-in-out infinite;
}

/* Light mode */
body.light-mode .playbook-sidebar-item {
    background: #f8f8f8;
    border-color: #ddd;
}

body.light-mode .playbook-sidebar-item:hover {
    background: #f0f0f0;
    border-color: #ccc;
}

body.light-mode .playbook-sidebar-name {
    color: #333;
}

body.light-mode .playbook-sidebar-desc {
    color: #666;
}

body.light-mode .pb-step { color: #999; }
body.light-mode .pb-step-done { color: #aaa; }
body.light-mode .pb-step-active { color: #00aa55; }

body.light-mode .playbook-confirm-modal {
    background: #fff;
    border-color: #ccc;
    color: #222;
}

body.light-mode .playbook-confirm-modal h3 {
    color: #222;
}

body.light-mode .playbook-confirm-modal .target-name {
    color: #111;
}

body.light-mode .playbook-desc-auto {
    color: #666;
}

body.light-mode .playbook-progress-bar {
    background: #ddd;
}

body.light-mode .playbook-sidebar-item.pb-running {
    border-color: #00aa55;
}

/* ============== Playbook Alert Popup ============== */
.pb-alert-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pb-alert-modal {
    background: #1a1a1a;
    border: 2px solid #00cc66;
    border-radius: 10px;
    padding: 24px 28px;
    max-width: 460px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

.pb-alert-header {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pb-alert-message {
    font-size: 18px;
    font-weight: 500;
    color: #fff;
    margin-bottom: 16px;
    line-height: 1.4;
}


.pb-alert-progress-bar {
    height: 4px;
    background: #333;
    border-radius: 2px;
    overflow: hidden;
}

.pb-alert-progress-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.1s linear;
}

body.light-mode .pb-alert-modal {
    background: #fff;
    color: #222;
}

body.light-mode .pb-alert-message {
    color: #111;
}

body.light-mode .pb-alert-progress-bar {
    background: #ddd;
}
