:root {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-card: #0f3460;
    --bg-input: #1a1a2e;
    --accent: #00b4d8;
    --accent-hover: #0096c7;
    --text: #e0e0e0;
    --text-muted: #888;
    --danger: #e63946;
    --success: #2ecc71;
    --warning: #f39c12;
    --border: #2a2a4a;
    --sidebar-width: 280px;
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: system-ui, -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* Layout */
.layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: #0f0f23;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.sidebar .logo {
    font-size: 1.5rem;
    font-weight: 700;
    padding: 1.5rem;
    color: var(--accent);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar nav {
    padding: 1rem 0;
    flex: 1;
}

.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.95rem;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sidebar nav a:hover {
    background: rgba(0, 180, 216, 0.08);
    color: var(--text);
}

.sidebar nav a.active {
    background: rgba(0, 180, 216, 0.12);
    color: var(--accent);
    border-left-color: var(--accent);
}

.main {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 2rem;
    min-width: 0;
}

/* Full-bleed main when the sidebar renders nothing (logged-out / login view) */
#sidebar:empty ~ .main {
    margin-left: 0;
}

/* Cards */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    margin-bottom: 1.5rem;
}

.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 1.05rem;
}

.card-body {
    padding: 1.25rem;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    text-align: left;
    padding: 0.75rem 1rem;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
    background: rgba(0, 0, 0, 0.15);
    position: sticky;
    top: 0;
}

.table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
}

.table tr:nth-child(even) {
    background: rgba(0, 0, 0, 0.1);
}

.table tbody tr:hover {
    background: rgba(0, 180, 216, 0.06);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
    font-weight: 500;
    font-family: inherit;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    line-height: 1.4;
}

.btn:active {
    transform: scale(0.97);
}

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

.btn-primary:hover {
    background: var(--accent-hover);
}

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

.btn-danger:hover {
    background: #c0392b;
}

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

.btn-success:hover {
    background: #27ae60;
}

.btn-outline {
    background: transparent;
    border-color: var(--border);
    color: var(--text);
}

.btn-outline:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(0, 180, 216, 0.08);
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.6rem 0.85rem;
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--text);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    transition: border-color 0.2s;
    outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 180, 216, 0.15);
}

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

/* Login */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    width: 100%;
    max-width: 380px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    padding: 2.5rem 2rem;
}

.login-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
}

.login-subtitle {
    color: var(--text-muted);
    margin-bottom: 1.75rem;
}

.login-form .form-group {
    margin-bottom: 1rem;
}

.login-error {
    min-height: 1.25rem;
    margin-bottom: 0.75rem;
    color: var(--danger);
    font-size: 0.85rem;
}

.login-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.5rem 0;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.btn-login,
.btn-passkey {
    width: 100%;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.2rem 0.65rem;
    font-size: 0.78rem;
    font-weight: 600;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-success {
    background: rgba(46, 204, 113, 0.15);
    color: var(--success);
}

.badge-warning {
    background: rgba(243, 156, 18, 0.15);
    color: var(--warning);
}

.badge-danger {
    background: rgba(230, 57, 70, 0.15);
    color: var(--danger);
}

/* Application tag (a badge wrapped in a Link) in the Port Forward table */
.app-tag {
    text-decoration: none;
    cursor: pointer;
}

/* Toasts */
.toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 360px;
}

.toast-message {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    animation: toastSlideIn 0.3s ease forwards;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.6rem;
    word-break: break-word;
}

.toast-message .toast-text {
    flex: 1;
    min-width: 0;
    white-space: pre-wrap;
}

/* Compact rendering for long messages: single line, ellipsized. */
.toast-message .toast-text-long {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.toast-message .toast-details {
    font-size: 12px;
    text-decoration: underline;
    text-underline-offset: 2px;
    padding: 0 4px;
}

/* Full message inside the toast Details modal. */
.toast-details-msg {
    font-family: monospace;
    font-size: 0.8rem;
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--border);
    border-radius: 6px;
    max-height: 60vh;
    overflow-y: auto;
    color: var(--text);
}

.toast-message .toast-actions {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
    align-items: center;
    height: 1.4em;
}

.toast-message .toast-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    font-size: 14px;
    padding: 0 2px;
    line-height: 1;
    opacity: 0.6;
    transition: opacity 0.15s;
}

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

.toast-message.toast-success {
    background: var(--success);
    color: #fff;
}

.toast-message.toast-error {
    background: var(--danger);
    color: #fff;
}

.toast-message.toast-warning {
    background: var(--warning);
    color: #fff;
}

.toast-message.toast-info {
    background: var(--accent);
    color: #fff;
}

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

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}

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

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-overlay .modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.5rem;
    width: 90%;
    max-width: 480px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    transform: scale(0.95);
    transition: transform 0.2s;
}

.modal-title {
    margin: 0 0 1rem;
    font-size: 1.1rem;
}

.btn-link {
    background: none;
    border: none;
    padding: 0;
    font-size: 0.8rem;
    font-family: inherit;
    color: var(--accent);
    cursor: pointer;
}

.btn-link:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* Multi-select picker (MultiSelectModal) */
.ms-toolbar {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.5rem;
}

.ms-search {
    flex: 1;
    padding: 0.45rem 0.7rem;
    font-size: 0.9rem;
    font-family: inherit;
    color: var(--text);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    outline: none;
    transition: border-color 0.2s;
}

.ms-search:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 180, 216, 0.15);
}

.ms-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.ms-subbar {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 0.5rem;
}

.ms-advanced {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
}

.ms-list {
    max-height: 280px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-input);
}

.ms-row {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    padding: 0.4rem 0.7rem;
    font-size: 0.9rem;
    cursor: pointer;
}

/* Author display rules beat the [hidden] UA rule unless re-declared. */
.ms-row[hidden] {
    display: none;
}

.ms-row:not(:last-child) {
    border-bottom: 1px solid var(--border);
}

.ms-row:hover {
    background: var(--bg-secondary);
}

.ms-check {
    width: 14px;
    height: 14px;
    margin: 0;
    flex-shrink: 0;
    accent-color: var(--accent);
    align-self: center;
}

.ms-name {
    font-weight: 500;
    white-space: nowrap;
}

.ms-desc {
    flex: 1;
    color: var(--text-muted);
    font-size: 0.78rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ms-empty {
    padding: 1rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

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

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

.toggle-switch .slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--border);
    border-radius: 24px;
    transition: 0.2s;
}

.toggle-switch .slider::before {
    content: "";
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: 0.2s;
}

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

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

/* Grid */
.grid {
    display: grid;
    gap: 1.25rem;
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

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

.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* SuggestInput (autocomplete; dropdown is portaled to body) */
.suggest {
    position: relative;
    display: flex;
    min-width: 0;
}

.suggest-input {
    flex: 1;
    min-width: 0;
}

.suggest-dropdown {
    position: fixed;
    z-index: 400;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
    max-height: 240px;
    overflow-y: auto;
    overflow-x: hidden;
}

.suggest-row {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    padding: 0.4rem 0.7rem;
    font-size: 0.9rem;
    cursor: pointer;
    white-space: nowrap;
}

.suggest-row:not(:last-child) {
    border-bottom: 1px solid var(--border);
}

.suggest-row:hover,
.suggest-row.active {
    background: rgba(0, 180, 216, 0.12);
}

.suggest-val {
    font-weight: 500;
}

.suggest-label {
    color: var(--text);
}

.suggest-sub {
    margin-left: auto;
    padding-left: 1rem;
    color: var(--text-muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.suggest-empty {
    padding: 0.6rem 0.7rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
}

/* Horizontal-scroll wrapper for wide tables (mobile) */
.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Application editor — row tables with column headers */
.editor-table th {
    padding: 0.5rem 0.6rem;
    font-size: 0.72rem;
}

.editor-table td {
    padding: 0.3rem 0.4rem;
    vertical-align: middle;
}

.editor-table tbody tr:nth-child(even) {
    background: transparent;
}

.editor-table input,
.editor-table select {
    padding: 0.35rem 0.5rem;
    font-size: 0.85rem;
}

.editor-table .path-field {
    min-width: 110px;
}

.editor-table .host-field {
    min-width: 170px;
}

.editor-table .port-field {
    width: 92px;
    min-width: 92px;
}

.editor-table .proto-field {
    min-width: 84px;
}

.editor-table .check-cell {
    text-align: center;
}

.editor-table .check-input {
    width: 14px;
    height: 14px;
    margin: 0;
    cursor: pointer;
    accent-color: var(--accent);
}

.editor-table .row-actions {
    width: 1%;
    text-align: right;
}

.editor-table .row-remove {
    padding: 0.15rem 0.45rem;
}

.editor-block {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.editor-help {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin: -0.2rem 0 0.5rem;
}

.editor-footer {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

/* Text Colors */
.text-success {
    color: var(--success);
}

.text-warning {
    color: var(--warning);
}

.text-danger {
    color: var(--danger);
}

/* Flex Utilities */
.flex {
    display: flex;
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

/* Spacing */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }

/* Page header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.page-header h1 {
    font-size: 22px;
    font-weight: 600;
}

.page-header .subtitle {
    color: var(--text-muted);
    font-size: 13px;
}

/* Stat cards */
.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    border-top: 3px solid var(--accent);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.stat-card:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.stat-card .label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.stat-card .value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-card .meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
}

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

.status-up { background: var(--success); }
.status-down { background: var(--danger); }
.status-pending { background: var(--warning); }

/* Badge info */
.badge-info {
    background: rgba(0, 180, 216, 0.15);
    color: var(--accent);
}

/* Modal actions */
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 1rem;
}

/* Section title */
.section-title {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 1rem;
    margin-top: 1.5rem;
}

.section-title:first-child { margin-top: 0; }

/* Card grid */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.card .card-grid {
    padding: 1.25rem;
}

/* Service list */
.service-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.service-list li {
    padding: 8px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--border);
}

.service-list li:last-child {
    border-bottom: none;
}

.service-list .svc-name {
    flex: 1;
}

/* Pending changes summary list */
.pending-list {
    list-style: none;
    padding: 0;
    margin: 0 0 12px;
}

.pending-list > li {
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
}

.pending-list > li:last-child {
    border-bottom: none;
}

.pending-list > li > strong {
    display: block;
    margin-bottom: 4px;
}

.pending-list > li > ul {
    margin: 0;
    padding-left: 18px;
}

.pending-list li li {
    padding: 1px 0;
}

/* Service status inline badge */
.service-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    font-size: 14px;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
}

.tab {
    padding: 0.75rem 1.25rem;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 14px;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.tab:hover {
    color: var(--text);
}

.tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.tab-content {
    display: none;
}

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

/* Logs area */
.logs-area {
    max-height: 60vh;
    overflow-y: auto;
    font-family: monospace;
    font-size: 12px;
    line-height: 1.5;
    padding: 1rem;
    background: #0d0d1a;
    border-radius: 6px;
    border: 1px solid var(--border);
}

.log-line {
    padding: 2px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

.log-line.error { color: var(--danger); }
.log-line.warn { color: var(--warning); }
.log-line.info { color: var(--text); }

/* Auto-refresh indicator */
.refresh-active::before {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    margin-right: 6px;
    animation: pulse 1.5s infinite;
}

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

/* Loading / error */
.loading {
    color: var(--text-muted);
    padding: 2rem;
    text-align: center;
}

.error-msg {
    color: var(--danger);
    padding: 2rem;
    text-align: center;
}

/* Spinner animation for buttons during pending operations */
@keyframes btn-spin {
    to { transform: rotate(360deg); }
}

.btn-spinner {
    display: inline-block;
    width: 1em;
    height: 1em;
    margin: 0 0.5em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: btn-spin 0.5s linear infinite;
    vertical-align: middle;
}

/* Pending deletion row indicator */
.pending-delete td {
    opacity: 0.5;
}

.pending-delete td:last-child {
    border-left: 3px solid var(--danger);
}

.pending-delete td:first-child {
    border-left: 0;
}

/* Disabled button styling */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ApplyConfirm modal */
.apply-subsystem-row {
    display: flex;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    cursor: default;
}

.apply-subsystem-row.pending {
    cursor: pointer;
}

.apply-subsystem-row.pending:hover {
    background: rgba(0, 180, 216, 0.08);
}

.apply-subsystem-name {
    flex: 1;
    font-weight: 600;
    font-size: 14px;
}

.apply-subsystem-status {
    margin-left: 12px;
    color: var(--text-muted);
    font-size: 13px;
}

.apply-subsystem-status.pending {
    color: var(--warning);
    font-weight: 500;
}

.apply-expand-icon {
    margin-left: 8px;
    transition: transform 0.2s;
    font-size: 12px;
}

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

.apply-detail-section {
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.15);
    margin: 4px 0 4px 12px;
    border-radius: 4px;
    font-size: 13px;
}

.apply-detail-item {
    padding: 4px 0;
    border-bottom: 1px solid var(--border);
}

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

.apply-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 12px;
    margin-top: 12px;
    border-top: 1px solid var(--border);
}

.apply-no-changes {
    padding: 16px;
    text-align: center;
    color: var(--text-muted);
}

/* Pending (edited, not yet applied) marker — amber, distinct from the red
   .pending-delete. Applied to rows/cards/sections whose config is dirty. */
.config-dirty {
    background: rgba(243, 156, 18, 0.07);
}

tr.config-dirty > td:first-child {
    box-shadow: inset 3px 0 0 var(--warning);
}

/* A row queued for deletion (red) takes precedence over the dirty marker. */
tr.pending-delete.config-dirty > td:first-child {
    box-shadow: none;
}

.card.config-dirty,
.backend-section.config-dirty,
.domain-config.config-dirty {
    box-shadow: inset 3px 0 0 var(--warning);
}

.pending-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--warning);
    margin-right: 6px;
    vertical-align: middle;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main {
        margin-left: 0;
        padding: 1rem;
    }

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