/* ===== RESET & BASE ===== */
* { box-sizing: border-box; }
body {
    margin: 0; padding: 0;
    font-size: 15px;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #1a1a2e; background: #f8f9fb;
    line-height: 1.5;
}
a:link, a:visited { color: #4a6cf7; text-decoration: none; }
a:focus, a:hover { color: #3451b2; }

/* Skip to content (accessibility) */
.sr-only {
    position: absolute; left: -9999px; top: auto;
    width: 1px; height: 1px; overflow: hidden;
}
.sr-only:focus {
    position: fixed; top: 8px; left: 8px; z-index: 9999;
    width: auto; height: auto; padding: 12px 20px;
    background: #4a6cf7; color: #fff; border-radius: 6px;
    font-weight: 600; font-size: 14px;
}

/* ===== HEADER ===== */
#header {
    background: white; height: 64px;
    border-bottom: 1px solid #e2e5ea;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px;
    position: sticky; top: 0; z-index: 100;
}
#branding { display: flex; align-items: center; gap: 12px; }
#branding .logo {
    width: 36px; height: 36px; border-radius: 8px;
    background: linear-gradient(135deg, #4a6cf7, #6366f1);
    display: flex; align-items: center; justify-content: center;
    color: white; font-weight: 700; font-size: 14px;
}
#branding h1 {
    font-size: 16px; font-weight: 600; margin: 0; color: #1a1a2e;
}
#branding h1 span { color: #6b7280; font-weight: 400; }
#user-tools {
    display: flex; align-items: center; gap: 16px;
    font-size: 13px; color: #6b7280;
}
#user-tools a:link, #user-tools a:visited { color: #6b7280; }
#user-tools a:hover { color: #4a6cf7; }
.user-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: #e8ecf4; display: flex; align-items: center;
    justify-content: center; font-weight: 600; font-size: 13px;
    color: #4a6cf7;
}
.btn-ghost {
    background: none; border: 1px solid #e2e5ea; border-radius: 6px;
    padding: 6px 12px; font-size: 13px; color: #6b7280;
    cursor: pointer; font-family: inherit; transition: all 0.15s;
}
.btn-ghost:hover { background: #f3f4f6; color: #1a1a2e; border-color: #d1d5db; }

/* ===== NAV BAR ===== */
.navbar {
    background: white; border-bottom: 1px solid #e2e5ea;
    padding: 0 24px; display: flex; align-items: center; gap: 0;
    overflow-x: auto; flex-wrap: nowrap;
}
.navbar a {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 12px 16px; font-size: 14px; font-weight: 400;
    color: #6b7280; text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
    white-space: nowrap;
}
.navbar a:hover { color: #1a1a2e; }
.navbar a.active {
    color: #4a6cf7; font-weight: 500;
    border-bottom-color: #4a6cf7;
}
.navbar .spacer { flex: 1; }
.navbar form { display: inline; }
.navbar button.logout-btn {
    background: none; border: none; color: #6b7280; cursor: pointer;
    font-size: 14px; font-weight: 400; padding: 12px 16px;
    font-family: inherit; transition: color 0.15s;
}
.navbar button.logout-btn:hover { color: #1a1a2e; }
.nav-badge {
    font-size: 10px; font-weight: 600; background: #e8ecf4;
    color: #4a6cf7; padding: 1px 6px; border-radius: 10px;
}

/* ===== BREADCRUMBS ===== */
.breadcrumbs {
    padding: 10px 24px; font-size: 13px; color: #9ca3af;
    background: #f8f9fb; border-bottom: 1px solid #f0f1f3;
}
.breadcrumbs a:link, .breadcrumbs a:visited { color: #6b7280; }
.breadcrumbs a:hover { color: #4a6cf7; }

/* ===== CONTENT ===== */
#content { margin: 0 auto; padding: 24px; max-width: 1280px; }
h1.page-title {
    font-size: 22px; font-weight: 600; color: #1a1a2e;
    margin: 0 0 20px 0;
}

/* ===== FLASH MESSAGES ===== */
.flash {
    padding: 12px 16px; margin-bottom: 16px; border-radius: 8px;
    font-size: 14px; border: 1px solid;
}
.flash.success { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.flash.error { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.flash.warning { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.flash.info { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }

/* ===== CARDS ===== */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 28px; }
.card {
    background: white; border: 1px solid #e2e5ea; border-radius: 12px;
    padding: 18px 20px; transition: box-shadow 0.2s, border-color 0.2s;
}
.card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.06); border-color: #d1d5db; }
.card h3 {
    margin: 0 0 8px 0; font-size: 11px; font-weight: 600;
    color: #9ca3af; text-transform: uppercase; letter-spacing: 0.8px;
}
.card .value { font-size: 28px; font-weight: 700; color: #1a1a2e; }
.card .sub { font-size: 13px; color: #6b7280; margin-top: 4px; }

/* ===== TABLES ===== */
.table-wrap {
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    border-radius: 12px; border: 1px solid #e2e5ea; background: white;
}
table {
    border: none; border-radius: 0; box-shadow: none;
    border-collapse: collapse; width: 100%;
}
thead th {
    padding: 10px 14px; background: #f8f9fb; border-bottom: 1px solid #e2e5ea;
    color: #6b7280; font-size: 12px; font-weight: 600;
    text-align: left; text-transform: uppercase; letter-spacing: 0.5px;
}
tbody td {
    padding: 12px 14px; border-bottom: 1px solid #f0f1f3;
    font-size: 14px; color: #374151;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.12s; }
tbody tr:hover { background: #f8f9fb; }

/* ===== STATUS BADGES ===== */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 500;
}
.badge-success { background: #ecfdf5; color: #059669; }
.badge-success::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #10b981; }
.badge-danger { background: #fef2f2; color: #dc2626; }
.badge-danger::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #ef4444; }

/* ===== CODE/PREFIX ===== */
code.prefix {
    font-size: 12px; font-family: "SF Mono", "Fira Code", monospace;
    background: #f3f4f6; padding: 2px 8px; border-radius: 4px;
    color: #4b5563; border: 1px solid #e5e7eb;
}

/* ===== BUTTONS ===== */
.btn-row { padding: 16px; text-align: right; }
button[type="submit"], input[type="submit"], a.button {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 14px; font-weight: 500; padding: 8px 18px;
    border-radius: 8px; border: 1px solid #4a6cf7;
    background: #4a6cf7; color: white;
    cursor: pointer; font-family: inherit; line-height: 1.4;
    transition: all 0.15s; text-decoration: none;
}
button[type="submit"]:hover, input[type="submit"]:hover, a.button:hover {
    background: #3b5de7; border-color: #3b5de7; color: white;
}
a.button, a.button:link, a.button:visited { display: inline-block; text-align: center; color: white; }
.btn { /* generic button class */
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 14px; font-weight: 500; padding: 8px 18px;
    border-radius: 8px; border: 1px solid transparent;
    cursor: pointer; font-family: inherit; line-height: 1.4;
    transition: all 0.15s; text-decoration: none;
}
.btn-primary, a.btn-primary:link, a.btn-primary:visited { background: #4a6cf7; color: white; border-color: #4a6cf7; }
.btn-primary:hover, a.btn-primary:hover { background: #3b5de7; border-color: #3b5de7; color: white; }
.btn-secondary, button.btn-secondary {
    background: white; color: #374151; border: 1px solid #d1d5db;
    font-size: 14px; padding: 8px 18px; border-radius: 8px;
    cursor: pointer; font-family: inherit;
}
.btn-secondary:hover, button.btn-secondary:hover { background: #f9fafb; border-color: #9ca3af; color: #374151; }
.btn-danger, button.btn-danger {
    background: #fef2f2; color: #dc2626; border: 1px solid #fecaca;
    font-size: 14px; padding: 8px 18px; border-radius: 8px;
    cursor: pointer; font-family: inherit;
}
.btn-danger:hover, button.btn-danger:hover { background: #fee2e2; border-color: #f87171; }
.btn-sm { font-size: 13px; padding: 5px 12px; border-radius: 6px; }
.btn:disabled, button.btn:disabled, .btn[disabled] { opacity: 0.4; cursor: not-allowed; pointer-events: none; }

/* ===== FORMS ===== */
.form-section {
    background: white; border: 1px solid #e2e5ea; border-radius: 12px;
    margin-bottom: 20px; overflow: hidden;
}
.form-section h2 {
    background: #f8f9fb; margin: 0; padding: 14px 20px;
    font-size: 15px; font-weight: 600; color: #1a1a2e;
    border-bottom: 1px solid #e2e5ea;
}
.form-row {
    display: flex; align-items: center; padding: 14px 20px;
    border-bottom: 1px solid #f0f1f3;
}
.form-row:last-child { border-bottom: none; }
.form-row label {
    width: 280px; min-width: 200px; font-size: 14px; font-weight: 500;
    color: #374151;
}
.form-row .help { font-size: 13px; color: #6b7280; margin-top: 3px; }
.form-row input[type="text"],
.form-row input[type="password"],
.form-row input[type="number"],
.form-row select {
    flex: 1; max-width: 500px; padding: 8px 12px;
    border: 1px solid #d1d5db; border-radius: 8px; font-size: 14px;
    font-family: inherit; transition: border-color 0.15s, box-shadow 0.15s;
    background: white; color: #1a1a2e;
}
.form-row input[type="text"]:focus,
.form-row input[type="password"]:focus,
.form-row input[type="number"]:focus,
.form-row select:focus {
    outline: none; border-color: #4a6cf7;
    box-shadow: 0 0 0 3px rgba(74,108,247,0.15);
}
select, select option { font-family: inherit; font-size: 14px; }
.form-row input[type="checkbox"] { width: 18px; height: 18px; accent-color: #4a6cf7; }
.form-row textarea {
    flex: 1; max-width: 500px; padding: 8px 12px;
    border: 1px solid #d1d5db; border-radius: 8px; font-size: 14px;
    font-family: inherit; min-height: 120px; resize: vertical;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.form-row textarea:focus {
    outline: none; border-color: #4a6cf7;
    box-shadow: 0 0 0 3px rgba(74,108,247,0.15);
}

/* ===== CONFIG SECTIONS (with left accent) ===== */
.config-section, .create-section {
    background: white; border: 1px solid #e2e5ea; border-radius: 12px;
    margin-bottom: 16px; overflow: hidden;
    border-left: 4px solid #4a6cf7;
}
.config-section-header, .create-section-header {
    background: #f8f9fb; padding: 14px 20px;
    border-bottom: 1px solid #e2e5ea;
}
.config-section-header h2, .create-section-header h2 {
    margin: 0; font-size: 15px; font-weight: 600; color: #1a1a2e;
}
.config-section-header p, .create-section-header p {
    margin: 4px 0 0; font-size: 13px; color: #6b7280;
}
.config-section-body, .create-section-body { padding: 0; }
.config-field {
    padding: 14px 20px; border-bottom: 1px solid #f0f1f3;
}
.config-field:last-child { border-bottom: none; }
.config-field label {
    display: block; font-size: 14px; font-weight: 500; color: #374151;
    margin-bottom: 4px;
}
.config-field input[type="text"],
.config-field input[type="password"],
.config-field select,
.config-field textarea {
    width: 100%; max-width: 480px; padding: 8px 12px;
    border: 1px solid #d1d5db; border-radius: 8px;
    font-size: 14px; font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.config-field input:focus,
.config-field select:focus,
.config-field textarea:focus {
    outline: none; border-color: #4a6cf7;
    box-shadow: 0 0 0 3px rgba(74,108,247,0.15);
}
.config-field textarea {
    height: 80px; font-family: monospace; font-size: 13px;
}
.config-field .help-text {
    font-size: 13px; color: #6b7280; margin-top: 3px;
}
.config-field label.checkbox-label {
    display: flex; align-items: center; gap: 8px;
    cursor: pointer; font-weight: 400;
}

/* ===== WIZARD SECTIONS ===== */
.wizard-section {
    background: white; border: 1px solid #e2e5ea; border-radius: 12px;
    margin-bottom: 12px; overflow: hidden;
    transition: border-color 0.2s;
}
.wizard-section:hover { border-color: #d1d5db; }
.wizard-header {
    background: #f8f9fb; padding: 14px 20px;
    border-bottom: 1px solid #e2e5ea;
    cursor: pointer; display: flex; align-items: center;
    justify-content: space-between; user-select: none;
    transition: background 0.15s;
}
.wizard-header:hover { background: #f0f1f3; }
.wizard-header h2 {
    margin: 0; font-size: 15px; font-weight: 500; color: #1a1a2e;
    display: inline;
}
.wizard-header .step-num {
    background: #4a6cf7; color: white; border-radius: 50%;
    width: 28px; height: 28px; display: inline-flex;
    align-items: center; justify-content: center;
    font-size: 13px; font-weight: 600; margin-right: 12px;
    flex-shrink: 0;
}
.wizard-header .chevron {
    font-size: 14px; color: #9ca3af; transition: transform 0.2s;
}
.wizard-header .chevron.open { transform: rotate(90deg); }
.wizard-body { padding: 0; }
.wizard-body.collapsed { display: none; }
.wizard-desc {
    padding: 12px 20px; font-size: 13px; color: #6b7280;
    background: #f8f9fb; border-bottom: 1px solid #f0f1f3;
}

/* Wizard badges */
.badge-existing {
    display: inline-block; padding: 3px 10px; border-radius: 20px;
    font-size: 12px; font-weight: 500; margin-left: 10px;
}
.badge-existing.found { background: #ecfdf5; color: #059669; }
.badge-existing.new { background: #eff6ff; color: #1e40af; }

/* Location grid */
.location-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 4px; padding: 8px 16px;
}
.location-grid label {
    display: flex; align-items: center; gap: 6px; font-size: 14px;
    cursor: pointer; padding: 4px 0;
}

/* Keycloak users section */
#kc-users-section { align-items: flex-start; }
#kc-users-section label { padding-top: 10px; flex-shrink: 0; }
#kc-users-section > div { flex: 1; }

/* Dynamic tables */
.dyn-table { width: 100%; border-collapse: collapse; }
.dyn-table th {
    text-align: left; padding: 10px 14px; font-size: 12px;
    font-weight: 600; color: #6b7280; border-bottom: 1px solid #e2e5ea;
    text-transform: uppercase; letter-spacing: 0.5px;
}
.dyn-table td { padding: 8px 14px; border-bottom: 1px solid #f0f1f3; }
.dyn-table input[type="text"],
.dyn-table input[type="number"],
.dyn-table input[type="password"] {
    width: 100%; padding: 7px 10px; border: 1px solid #d1d5db;
    border-radius: 6px; font-size: 14px; font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.dyn-table input:focus {
    outline: none; border-color: #4a6cf7;
    box-shadow: 0 0 0 3px rgba(74,108,247,0.15);
}
.dyn-table input[type="color"] {
    width: 36px; height: 32px; padding: 2px; border: 1px solid #d1d5db;
    border-radius: 6px; cursor: pointer;
}
.add-row-btn {
    background: none; border: 1px dashed #d1d5db; color: #4a6cf7;
    padding: 8px 16px; font-size: 14px; cursor: pointer;
    border-radius: 8px; margin: 12px; font-family: inherit;
    transition: all 0.15s;
}
.add-row-btn:hover { background: #f0f4ff; border-color: #4a6cf7; }
.remove-btn {
    background: none; border: none; color: #dc2626;
    cursor: pointer; font-size: 16px; padding: 4px 8px;
}
.remove-btn:hover { color: #991b1b; }
.ct-preview {
    padding: 3px 10px; border-radius: 4px; font-size: 12px;
    font-weight: 500; display: inline-block; min-width: 60px;
    text-align: center;
}
.topic-row {
    display: flex; gap: 8px; padding: 8px 14px;
    border-bottom: 1px solid #f0f1f3;
}
.topic-row input {
    flex: 1; padding: 7px 10px; border: 1px solid #d1d5db;
    border-radius: 6px; font-size: 14px; font-family: inherit;
}
.topic-row input:focus {
    outline: none; border-color: #4a6cf7;
    box-shadow: 0 0 0 3px rgba(74,108,247,0.15);
}

/* ===== BANNER SUBJECT + RANDOM TOGGLE ===== */
.banner-subject-row {
    display: flex; align-items: center; gap: 12px; flex: 1; max-width: 500px;
}
.banner-subject-row input[type="text"] {
    flex: 1;
}
.banner-subject-row input[type="text"]:disabled {
    background: #f3f4f6; color: #9ca3af;
}
.banner-random-toggle {
    display: flex; align-items: center; gap: 6px;
    font-size: 13px; color: #374151; cursor: pointer;
    white-space: nowrap; width: auto !important; min-width: auto !important;
}

/* ===== THEME ACTIONS ===== */
.theme-actions-row { align-items: flex-start; }
.theme-actions {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
#theme-action-status {
    font-size: 13px; padding: 3px 10px; border-radius: 6px;
    transition: opacity 0.2s;
}
.theme-status-loading { color: #1e40af; background: #eff6ff; }
.theme-status-success { color: #065f46; background: #ecfdf5; }
.theme-status-error { color: #991b1b; background: #fef2f2; }
.btn-danger-confirm {
    background: #dc2626 !important; color: white !important;
    border-color: #dc2626 !important;
}

/* ===== VERIFY STATUS (create page) ===== */
.verify-status {
    margin-top: 12px; padding: 10px 16px; border-radius: 8px;
    font-size: 14px; display: none;
}
.verify-status.loading { display: block; background: #eff6ff; color: #1e40af; }
.verify-status.success { display: block; background: #ecfdf5; color: #065f46; }
.verify-status.error { display: block; background: #fef2f2; color: #991b1b; }
.verify-btn {
    background: #4a6cf7; color: white; border: none; padding: 10px 24px;
    border-radius: 8px; font-size: 15px; font-weight: 500; cursor: pointer;
    font-family: inherit; width: 100%; margin-top: 8px;
    transition: background 0.15s;
}
.verify-btn:hover { background: #3b5de7; }
.verify-btn:disabled { background: #d1d5db; cursor: not-allowed; }

/* ===== LOG VIEWER ===== */
.log-viewer {
    background: #1a1a2e; color: #e0e0e0; font-family: "SF Mono", "Fira Code", monospace;
    font-size: 13px; padding: 16px; border-radius: 12px; overflow-x: auto;
    white-space: pre-wrap; word-wrap: break-word; max-height: 600px;
    overflow-y: auto;
}
.log-viewer .log-error { color: #f87171; }
.log-viewer .log-warning { color: #fbbf24; }
.log-viewer .log-demo { color: #34d399; }

/* ===== LOGIN PAGE ===== */
.login-container {
    max-width: 420px; margin: 80px auto; padding: 40px;
    background: white; border: 1px solid #e2e5ea; border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.06);
}
.login-container h1 {
    text-align: center; font-size: 22px; font-weight: 600;
    color: #1a1a2e; margin-bottom: 8px;
}
.login-subtitle { text-align: center; font-size: 14px; color: #6b7280; margin-bottom: 28px; }
.login-container .form-group { margin-bottom: 16px; }
.login-container label { display: block; font-size: 14px; font-weight: 500; color: #374151; margin-bottom: 6px; }
.login-container input[type="text"],
.login-container input[type="password"] {
    width: 100%; padding: 10px 14px; border: 1px solid #d1d5db;
    border-radius: 8px; font-size: 14px; font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.login-container input:focus {
    outline: none; border-color: #4a6cf7;
    box-shadow: 0 0 0 3px rgba(74,108,247,0.15);
}
.login-container button[type="submit"] { width: 100%; justify-content: center; margin-top: 8px; }
.login-divider {
    display: flex; align-items: center; gap: 12px;
    margin: 20px 0; color: #9ca3af; font-size: 13px;
}
.login-divider::before, .login-divider::after {
    content: ""; flex: 1; height: 1px; background: #e2e5ea;
}

/* ===== CLASSIFICATION MAP EDITOR ===== */
.map-table input[type="text"] { width: 180px; padding: 4px 8px; border: 1px solid #d1d5db; border-radius: 6px; }
.map-table input[type="number"] { width: 60px; padding: 4px 8px; border: 1px solid #d1d5db; border-radius: 6px; }

/* ===== INSTANCES DROPDOWN ===== */
.nav-dropdown { position: relative; display: inline-block; }
.nav-dropdown > a { cursor: pointer; }
.dropdown-content {
    display: none; position: absolute; top: 100%; left: 0;
    background: white; min-width: 280px; box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    border: 1px solid #e2e5ea; border-radius: 8px; z-index: 1000;
    padding: 4px 0;
}
.nav-dropdown:hover .dropdown-content { display: block; }
.dropdown-content a {
    display: inline-block; padding: 4px 10px; font-size: 13px;
    color: #4a6cf7 !important; text-decoration: none;
}
.dropdown-content a:hover { color: #3451b2 !important; text-decoration: underline; }
.dropdown-instance { padding: 8px 16px; border-bottom: 1px solid #f0f1f3; }
.dropdown-instance:last-child { border-bottom: none; }
.dropdown-instance-name { font-weight: 500; font-size: 14px; color: #1a1a2e; margin-bottom: 2px; }
.dropdown-instance-links { display: flex; gap: 6px; }
.dropdown-sep { border-top: 1px solid #e2e5ea; margin: 2px 0; }
.dropdown-action { padding: 8px 16px; }
.dropdown-action a { font-size: 13px; }

/* ===== EMPTY STATE ===== */
.empty-state {
    border: 2px dashed #e2e5ea; border-radius: 12px;
    padding: 48px 24px; text-align: center; color: #9ca3af;
}
.empty-state h3 { font-size: 15px; font-weight: 500; color: #6b7280; margin: 0 0 6px; }
.empty-state p { font-size: 14px; color: #9ca3af; margin: 0 0 16px; }

/* ===== AUTO-REFRESH STATUS ===== */
.poll-status {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 12px; color: #9ca3af; background: #f3f4f6;
    padding: 4px 10px; border-radius: 20px;
}
.poll-dot {
    width: 6px; height: 6px; border-radius: 50%; background: #10b981;
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ===== STICKY FORM FOOTER ===== */
.form-footer-sticky {
    position: sticky;
    bottom: 0;
    z-index: 50;
    background: #fff;
    border-top: 1px solid #e5e7eb;
    padding: 12px 24px;
    margin: 20px -24px -24px -24px;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    align-items: center;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.06);
}
.form-footer-sticky .btn,
.form-footer-sticky button {
    min-width: 120px;
}
.form-footer-sticky .view-actions-spacer {
    flex: 1;
}
/* ===== DELETE CONFIRMATION ===== */
.delete-confirm-card {
    max-width: 700px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 24px;
    margin-top: 16px;
}
.delete-confirm-card h3 {
    margin: 0 0 16px;
    font-size: 16px;
    color: #374151;
}
.delete-section-label {
    font-size: 14px;
    color: #374151;
    margin: 20px 0 12px;
}
.delete-option {
    display: block;
    padding: 8px 12px;
    margin: 4px 0;
    font-size: 14px;
    cursor: pointer;
    border-radius: 4px;
}
.delete-option:hover {
    background: #f9fafb;
}
.delete-option input[type="checkbox"] {
    margin-right: 8px;
}
.delete-option-hint {
    font-size: 12px;
    color: #6b7280;
}
.delete-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
}
.btn-xs {
    padding: 2px 8px;
    font-size: 11px;
}

.config-actions {
    display: flex; gap: 8px; margin-top: 20px; justify-content: flex-end;
}
.select-with-link {
    display: flex; align-items: center; gap: 8px;
}
.select-with-link select { flex: 1; }
.help-link {
    font-size: 12px; color: #4f46e5; text-decoration: none; white-space: nowrap;
    background: none; border: none; cursor: pointer; padding: 0;
}
.help-link:hover { text-decoration: underline; }

/* ===== SETUP PROGRESS ===== */
.setup-progress {
    background: white;
    border: 1px solid #e2e5ea;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
}
.setup-progress-text {
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    white-space: nowrap;
}
.setup-progress-bar {
    flex: 1;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}
.setup-progress-fill {
    height: 100%;
    background: #10b981;
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.wizard-header .step-num.configured {
    background: #10b981;
}

/* ===== SETUP RESULTS ===== */
.result-row-keycloak td:first-child {
    padding-left: 32px;
}
.result-row-failed {
    background: #fef2f2;
}
.result-row-failed:hover {
    background: #fee2e2;
}

/* ===== WIZARD SUMMARY CHIPS ===== */
.wizard-summary {
    font-size: 12px;
    color: #6b7280;
    font-weight: 400;
    margin-left: 12px;
    max-width: 400px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===== EMPTY HINTS ===== */
.empty-hint {
    color: #9ca3af;
    font-size: 14px;
    margin-bottom: 24px;
}
.empty-hint a {
    color: #4a6cf7;
    font-weight: 500;
}

/* ===== CONNECTIVITY TEST ===== */
.connectivity-status {
    font-size: 12px;
    margin-left: 8px;
    display: inline-block;
    max-width: 300px;
    vertical-align: middle;
}
.connectivity-ok {
    color: #059669;
}
.connectivity-fail {
    color: #dc2626;
}

/* ===== INSTANCE ACTIONS ===== */
.instance-actions {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}
.actions-cell {
    min-width: 200px;
}

/* ===== VIEW PAGE SECTION HEADINGS ===== */
.section-heading {
    font-size: 14px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 24px 0 10px;
}
.config-label {
    font-weight: 500;
}
.input-readonly {
    background: #f3f4f6 !important;
    color: #6b7280 !important;
    cursor: default;
    border-color: #e5e7eb !important;
}

/* ===== INSTANCE CARDS (Dashboard) ===== */
.instance-card {
    background: white; border: 1px solid #e2e5ea; border-radius: 12px;
    margin-bottom: 16px; overflow: hidden;
    transition: box-shadow 0.2s, border-color 0.2s;
}
.instance-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.06); border-color: #d1d5db; }
.instance-card-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 20px; border-bottom: 1px solid #f0f1f3;
}
.instance-card-title {
    font-size: 16px; font-weight: 600; color: #1a1a2e;
}
.instance-card-meta {
    font-size: 13px; color: #9ca3af; font-weight: 400; margin-left: 10px;
}
.instance-card-links {
    display: flex; gap: 8px; align-items: center; font-size: 13px;
}
.instance-card-links a { font-weight: 500; }
.instance-card-links .link-sep { color: #d1d5db; }
.instance-card-links .link-danger { color: #dc2626; }
.instance-card-links .link-danger:hover { color: #991b1b; }
.instance-card-body {
    display: grid; grid-template-columns: 1fr 0.7fr 1.5fr;
    gap: 0; padding: 0;
}
.instance-card-col {
    padding: 18px 20px;
    border-right: 1px solid #f0f1f3;
}
.instance-card-col:last-child { border-right: none; }
.instance-card-col h4 {
    margin: 0 0 12px 0; font-size: 11px; font-weight: 600;
    color: #9ca3af; text-transform: uppercase; letter-spacing: 0.8px;
}
.instance-card-col .info-label {
    font-size: 11px; font-weight: 600; color: #6b7280;
    text-transform: uppercase; letter-spacing: 0.5px; margin: 10px 0 2px;
}
.instance-card-col .info-label:first-child { margin-top: 0; }
.instance-card-col .info-value {
    font-size: 14px; color: #1a1a2e; word-break: break-all;
}
.instance-card-col .info-value a { font-size: 14px; }
.instance-card-col .big-number {
    font-size: 36px; font-weight: 700; color: #1a1a2e; line-height: 1.1;
}
.instance-card-col .big-sub {
    font-size: 13px; color: #9ca3af; margin-top: 4px;
}
.demo-header-row {
    display: flex; gap: 6px; align-items: center; margin-bottom: 10px;
}
.demo-header-row .demo-selector {
    flex: 1; min-width: 0;
}
.btn-xs {
    font-size: 11px; padding: 3px 8px; border-radius: 5px;
}
.demo-action-card {
    background: #f8f9fb; border: 1px solid #e5e7eb; border-radius: 10px;
    padding: 10px 12px; margin-bottom: 10px;
}
.demo-action-card-inner {
    display: flex; align-items: stretch; gap: 0;
}
.demo-launch-zone { flex: 1; min-width: 0; }
.demo-btn-row {
    display: flex; gap: 6px; align-items: center;
}
.demo-btn-row .btn { flex: 1; text-align: center; white-space: nowrap; padding: 6px 8px; font-size: 12px; }
.demo-card-thumb {
    width: 160px; flex-shrink: 0; border-radius: 0 8px 8px 0;
    overflow: hidden; margin: -10px -12px -10px 0;
}
.demo-card-thumb:empty { display: none; }
.demo-card-thumb img {
    width: 100%; height: 100%; object-fit: cover; display: block;
}
.btn-danger-outline {
    background: #fff; color: #dc2626; border: 1px solid #fca5a5;
    font-size: 12px; padding: 6px 8px; border-radius: 8px; cursor: pointer;
    font-family: inherit; font-weight: 500;
}
.btn-danger-outline:hover { background: #fef2f2; border-color: #dc2626; }
.demo-plugins-row {
    display: flex; gap: 6px; align-items: center; margin-top: 8px;
    min-height: 24px;
}
.btn-link-sm {
    font-size: 11px; color: #4a6cf7; cursor: pointer;
    background: none; border: none; font-family: inherit; padding: 0;
    white-space: nowrap;
}
.btn-link-sm:hover { color: #3451b2; text-decoration: underline; }
.demo-flow-header {
    display: flex; align-items: center; gap: 8px; margin: 4px 0 6px;
}
.demo-flow-toggle {
    font-size: 12px; color: #9ca3af; cursor: pointer;
    display: inline-block;
    background: none; border: none; font-family: inherit; padding: 0;
}
.demo-flow-toggle:hover { color: #3451b2; }
.btn-edit-flow {
    font-size: 11px; color: #6b7280;
}
.btn-edit-flow:hover { color: #4a6cf7; }
.demo-flow-container.collapsed { display: none; }
.demo-flow-list {
    font-size: 13px; color: #374151; margin: 0; padding: 0 0 0 18px;
    line-height: 1.8;
}
.demo-flow-list.editing li {
    display: flex; align-items: center; gap: 6px; margin: 3px 0;
}
.flow-step-input {
    flex: 1; padding: 3px 6px; font-size: 13px; font-family: inherit;
    border: 1px solid #d1d5db; border-radius: 4px;
}
.flow-step-remove {
    background: none; border: none; color: #9ca3af; cursor: pointer;
    font-size: 16px; padding: 0 4px; line-height: 1;
}
.flow-step-remove:hover { color: #dc2626; }
.flow-add-step { list-style: none; margin-left: -18px; }
.demo-selector {
    font-size: 13px;
    padding: 4px 8px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    margin-bottom: 8px;
    width: 100%;
    max-width: 280px;
}
.instance-card-details {
    border-top: 1px solid #f0f1f3;
}
.instance-card-details-toggle {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 20px; cursor: pointer;
    font-size: 13px; font-weight: 500; color: #6b7280;
    background: #fafbfc; transition: background 0.15s;
    border: none; width: 100%; text-align: left; font-family: inherit;
}
.instance-card-details-toggle:hover { background: #f3f4f6; }
.instance-card-details-toggle .chevron {
    font-size: 12px; color: #9ca3af; transition: transform 0.2s;
}
.instance-card-details-toggle .chevron.open { transform: rotate(90deg); }
.instance-card-details-body { display: none; }
.instance-card-details-body.open { display: block; }
.instance-card-details-body table {
    width: 100%; border: none;
}
.instance-card-details-body td {
    padding: 10px 20px; font-size: 14px; border-bottom: 1px solid #f0f1f3;
}
.instance-card-details-body tr:last-child td { border-bottom: none; }
.instance-card-details-body td:first-child {
    font-weight: 500; color: #374151; width: 240px;
}
.instance-card-details-body td:last-child { color: #1a1a2e; }
.instance-card .connectivity-status {
    display: block; margin-top: 8px; font-size: 12px;
}

/* Migrated instance badge */
.badge-migrated {
    background: #fffbeb; color: #92400e; font-size: 11px;
    padding: 2px 8px; border-radius: 10px; font-weight: 500;
    margin-left: 8px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 960px) {
    .instance-card-body { grid-template-columns: 1fr 1fr; }
    .instance-card-col:nth-child(2) { border-right: none; }
    .instance-card-col:nth-child(3) { border-top: 1px solid #f0f1f3; grid-column: 1 / -1; }
}
@media (max-width: 768px) {
    #content { padding: 16px; }
    .form-row { flex-direction: column; align-items: flex-start; }
    .form-row label { width: 100%; margin-bottom: 6px; }
    .form-row input, .form-row select, .form-row textarea { max-width: 100%; width: 100%; }
    .cards { grid-template-columns: repeat(2, 1fr); }
    .navbar { padding: 0 12px; }
    .navbar a { padding: 10px 12px; font-size: 13px; }
    #header { padding: 0 16px; }
    .instance-card-body { grid-template-columns: 1fr; }
    .instance-card-col { border-right: none; border-bottom: 1px solid #f0f1f3; }
    .instance-card-col:last-child { border-bottom: none; }
    .instance-card-col:nth-child(3) { border-top: none; grid-column: auto; }
    .instance-card-header { flex-direction: column; align-items: flex-start; gap: 8px; }
    .instance-card-details-body td:first-child { width: auto; }
}
@media (max-width: 480px) {
    .cards { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

.nav-username { font-size: 13px; color: #6b7280; }
.nav-logout-form { display: inline; }
.egress-ip {
    font-size: 11px; color: #9ca3af; background: #f3f4f6; padding: 2px 8px;
    border-radius: 4px; font-family: 'Courier New', monospace; cursor: help;
}

/* ===== DASHBOARD INLINE STYLE REPLACEMENTS ===== */
.dashboard-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 12px;
}
.dashboard-header h2 {
    font-size: 16px; font-weight: 600; margin: 0; color: #1a1a2e;
}
.dashboard-header-actions {
    display: flex; align-items: center; gap: 12px;
}
.badge-gap { margin-left: 8px; }
.text-muted-light { color: #9ca3af; }
.mt-14 { margin-top: 14px; }

/* Connectivity mixed-status spans */
.status-ok { color: #16a34a; }
.status-error { color: #dc2626; }
.text-muted { color: #6b7280; }

/* Activate status container */
.activate-status {
    font-size: 13px; line-height: 1.8; margin-top: 12px;
}
.activate-status-heading {
    font-weight: 600; margin-bottom: 6px;
}
.activate-step-ok { color: #16a34a; }
.activate-step-fail { color: #dc2626; }
.activate-countdown {
    margin-top: 8px; padding: 8px 12px;
    background: #f0fdf4; border: 1px solid #bbf7d0;
    border-radius: 6px; color: #16a34a; font-weight: 500;
}
.activate-countdown-done { background: #dcfce7; }
.activate-error {
    margin-top: 8px; padding: 8px 12px;
    background: #fef2f2; border: 1px solid #fecaca;
    border-radius: 6px; color: #dc2626;
}

/* ===== VIEW PAGE INLINE STYLE REPLACEMENTS ===== */
.mb-24 { margin-bottom: 24px; }
.card-value-lg { font-size: 18px; }
.card-value-md { font-size: 16px; }
.prefix-md { font-size: 15px; }
.td-label { font-weight: 500; }
.classification-preview {
    padding: 3px 10px; border-radius: 4px;
    font-size: 12px; font-weight: 500;
}
.topics-list {
    background: white; border: 1px solid #e2e5ea;
    border-radius: 10px; overflow: hidden;
}
.topic-item {
    font-size: 14px; padding: 10px 16px; color: #374151;
}
.topic-item:not(:last-child) {
    border-bottom: 1px solid #f0f1f3;
}
.conf-details { margin-top: 10px; }
.conf-detail-item {
    padding: 6px 0;
    border-top: 1px solid #f0f1f3;
}
.conf-detail-item:first-child { border-top: none; padding-top: 0; }
.conf-detail-name {
    font-size: 13px; font-weight: 600; color: #1a1a2e;
}
.conf-detail-sub {
    font-size: 12px; color: #6b7280;
}
.hidden { display: none !important; }

/* Dashboard plugin drag & drop */
.dashboard-plugins-panel {
    position: sticky;
    top: 0;
    z-index: 50;
    background: #f9fafb;
    margin: 0 -24px;
    padding: 12px 24px;
    border-bottom: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.dashboard-plugins-title {
    font-size: 14px; font-weight: 600; color: #374151;
    cursor: pointer; user-select: none; margin: 0 0 8px;
    display: flex; align-items: center; gap: 8px;
}
.dashboard-plugins-title .section-chevron {
    font-size: 10px; transition: transform 0.2s; display: inline-block;
}
.dashboard-plugins-title .section-chevron.open {
    transform: rotate(90deg);
}
.dashboard-plugins-list {
    display: flex; flex-wrap: wrap; gap: 6px;
}
.dashboard-plugins-list.collapsed { display: none; }
.dashboard-plugin-chip {
    font-size: 12px; padding: 4px 10px;
    background: #f3f4f6; border: 1px solid #e2e5ea;
    border-radius: 6px; cursor: grab; user-select: none;
    color: #374151; white-space: nowrap;
}
.dashboard-plugin-chip:hover { background: #e5e7eb; }
.dashboard-plugin-chip:active { cursor: grabbing; }
.demo-launch-zone {
    display: inline-flex; flex-direction: column; gap: 4px;
    padding: 4px; border-radius: 8px; border: 2px dashed transparent;
    transition: border-color 0.15s, background 0.15s;
}
.demo-launch-zone.drop-active {
    border-color: #4f46e5; background: #eef2ff;
}
.demo-plugin-tags {
    display: flex; flex-wrap: wrap; gap: 4px;
}
.demo-plugin-tag {
    font-size: 11px; padding: 2px 6px;
    background: #eef2ff; border: 1px solid #c7d2fe;
    border-radius: 4px; color: #4338ca;
    display: inline-flex; align-items: center; gap: 3px;
}
.demo-plugin-tag .tag-remove {
    background: none; border: none; cursor: pointer;
    font-size: 13px; color: #6366f1; padding: 0; line-height: 1;
}
.demo-plugin-tag .tag-remove:hover { color: #dc2626; }
.demo-plugin-summary {
    font-size: 11px; color: #4a6cf7; cursor: pointer;
}
.demo-plugin-summary:hover { text-decoration: underline; }
.demo-plugins-hint {
    font-size: 11px; color: #9ca3af; margin-top: 4px;
}
.section-count { font-weight: 400; color: #9ca3af; }

/* ===== MODAL (shared) ===== */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4); z-index: 1000;
    display: flex; align-items: center; justify-content: center;
}
.modal-overlay[hidden] { display: none; }
.modal {
    background: #fff; border-radius: 12px; padding: 0;
    width: 90%; max-width: 520px; max-height: 80vh;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2); overflow: hidden;
    display: flex; flex-direction: column;
}
.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 20px; border-bottom: 1px solid #e5e7eb;
}
.modal-header h3 { margin: 0; font-size: 16px; }
.modal-close {
    background: none; border: none; font-size: 24px; cursor: pointer;
    color: #6b7280; padding: 0 4px; line-height: 1;
}
.modal-close:hover { color: #111; }
.modal-body { padding: 16px 20px; overflow-y: auto; }
.modal-desc { font-size: 13px; color: #6b7280; margin: 0 0 12px; }

/* Plugin picker items */
.plugin-picker-item {
    display: flex; flex-direction: column; padding: 10px 12px;
    border: 1px solid #e5e7eb; border-radius: 8px; margin-bottom: 6px;
    cursor: pointer; transition: background 0.15s, border-color 0.15s;
}
.plugin-picker-item:hover {
    background: #eff6ff; border-color: #4a6cf7;
}
.plugin-picker-name { font-size: 13px; font-weight: 500; color: #1a1a2e; }
.plugin-picker-desc { font-size: 11px; color: #6b7280; margin-top: 2px; }

/* ===== DEMO WIZARD ===== */
.demo-wizard-panel { max-width: 560px; max-height: 85vh; display: flex; flex-direction: column; }
.demo-wizard-panel .modal-body { overflow-y: auto; flex: 1; min-height: 0; }
.wizard-step-actions { position: sticky; bottom: 0; background: #fff; padding: 12px 0 4px; border-top: 1px solid #f0f1f3; margin-top: 12px; }
.demo-wizard-panel .form-group { margin-bottom: 10px; }
.demo-wizard-panel .form-group > label { display: block; font-size: 13px; font-weight: 500; color: #374151; margin-bottom: 3px; }
.demo-wizard-panel .form-group select,
.demo-wizard-panel .form-group input[type="text"] { width: 100%; max-width: 320px; box-sizing: border-box; }
.demo-wizard-panel .select-with-link select { max-width: none; }
.branding-info-panel { max-width: 420px; }
.branding-drop-zone {
    margin-top: 8px; padding: 16px; border: 2px dashed #d1d5db; border-radius: 8px;
    text-align: center; color: #9ca3af; font-size: 13px; cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.branding-drop-zone.dragover {
    border-color: #4f46e5; background: #eef2ff; color: #4f46e5;
}
.branding-drop-zone.uploaded {
    border-color: #16a34a; background: #f0fdf4; color: #16a34a;
}
.form-value-row {
    display: flex; align-items: center; gap: 6px;
}
.form-value {
    font-size: 13px; color: #4f46e5; font-family: monospace;
    padding: 6px 10px; background: #f3f4f6; border-radius: 6px;
    word-break: break-all;
}
.btn-copy-small {
    background: none; border: 1px solid #d1d5db; border-radius: 4px;
    cursor: pointer; padding: 4px 6px; font-size: 14px; line-height: 1;
}
.btn-copy-small:hover { background: #f3f4f6; }
.kc-users-label { display: block; margin-top: 10px; font-weight: 500; }
.demo-wiz-plugin-group { margin-bottom: 12px; }
.plugin-group-label { display: block; font-size: 12px; font-weight: 600; color: #6b7280; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.demo-wiz-plugin-item { padding: 2px 0; }
.demo-wiz-plugin-item .form-hint { font-weight: normal; }
.sip-summary-table { margin-top: 6px; }
.sip-name-input { width: 100%; padding: 4px 6px; font-size: 13px; border: 1px solid #d1d5db; border-radius: 4px; }
.wizard-step { }
.wizard-step-actions {
    display: flex; gap: 8px; justify-content: flex-end;
    margin-top: 16px; padding-top: 12px; border-top: 1px solid #e5e7eb;
}
.demo-wiz-toggles {
    display: flex; flex-direction: column; gap: 6px; margin-top: 4px;
}
.toggle-label {
    font-size: 13px; cursor: pointer; display: flex; align-items: center; gap: 6px;
}
.form-hint {
    font-size: 11px; color: #9ca3af; margin-top: 2px;
}
.summary-table { font-size: 13px; }
.summary-table td { padding: 3px 12px 3px 0; vertical-align: top; }
#demo-wiz-status {
    margin-top: 12px; padding: 10px 14px; background: #f8f9fb;
    border: 1px solid #e5e7eb; border-radius: 8px; font-size: 13px;
}
.demo-wiz-status-heading { font-weight: 600; margin-bottom: 6px; color: #1a1a2e; }
.demo-wiz-step-pending { color: #9ca3af; line-height: 1.8; }
.demo-wiz-step-confirm { padding: 8px 0; }
.demo-wiz-confirm-btn { margin-left: 8px; }
.demo-wiz-action-btn { margin-top: 12px; }
#demo-wiz-ct-table .ct-col-level { width: 60px; }
#demo-wiz-ct-table .ct-col-color { width: 50px; }
#demo-wiz-ct-table .ct-col-preview { width: 120px; }
#demo-wiz-ct-table .ct-col-remove { width: 40px; }
#demo-wiz-ct-table input[type="number"] { width: 55px; }
#demo-wiz-ct-table input[type="color"] { width: 40px; height: 28px; padding: 1px; border: 1px solid #d1d5db; border-radius: 4px; cursor: pointer; }
.demo-wiz-add-ct-btn { margin-top: 6px; }
.searchable-select-wrap { display: flex; flex-direction: column; flex: 1; }
.searchable-select-filter {
    padding: 4px 8px; font-size: 12px; border: 1px solid #d1d5db;
    border-bottom: none; border-radius: 6px 6px 0 0; box-sizing: border-box;
    font-family: inherit; color: #6b7280;
}
.searchable-select-filter:focus { outline: none; border-color: #4a6cf7; }
.searchable-select-wrap select { border-radius: 0 0 6px 6px; }
.rank-level-input { width: 60px; }
.wizard-step-indicator {
    display: flex; gap: 6px; justify-content: center; padding: 8px 0 4px; margin-bottom: 8px;
}
.wizard-step-dot {
    width: 8px; height: 8px; border-radius: 50%; background: #d1d5db; transition: background 0.2s;
}
.wizard-step-dot.active { background: #4a6cf7; }
.wizard-step-dot.done { background: #16a34a; }
.demo-wiz-add-rank-btn { margin-top: 6px; }
.demo-wiz-ct-success { color: #166534 !important; }
.demo-wiz-ct-error { color: #991b1b !important; }
