/* NetMap-style OTA UI */

:root {
    --bg: #e8ebf2;
    --bg2: #f7f8fd;
    --bg3: #eceef6;
    --surface: #ffffff;
    --surface-2: #f5f7fc;
    --surface-3: #eef2ff;
    --border: #cfd6e4;
    --border-strong: #94a3b8;
    --text: #0f172a;
    --text-2: #1e293b;
    --text-3: #4b5563;
    --muted: #6b7280;
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --accent: #f59e0b;
    --accent-dark: #d97706;
    --success: #059669;
    --danger: #dc2626;
    --warning: #d97706;
    --shadow-sm: 0 1px 3px rgba(79,70,229,.07), 0 4px 12px rgba(79,70,229,.06);
    --shadow-md: 0 2px 8px rgba(79,70,229,.10), 0 8px 24px rgba(79,70,229,.09);
    --shadow-lg: 0 20px 50px rgba(15,23,42,.18);
    --radius-xs: 6px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --t: 150ms ease;
    --focus: 0 0 0 3px rgba(99,102,241,.18);
    --font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    --mono: "SF Mono", "Cascadia Code", "Fira Code", monospace;
}

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

html, body { min-height: 100%; }

body {
    margin: 0;
    padding: 24px;
    font-family: var(--font);
    background:
        radial-gradient(circle at 12% 18%, rgba(99,102,241,.08), transparent 24%),
        radial-gradient(circle at 84% 10%, rgba(245,158,11,.10), transparent 22%),
        linear-gradient(145deg, var(--bg), var(--bg2) 45%, var(--bg3));
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { color: inherit; }
code, pre, kbd { font-family: var(--mono); }

.container {
    max-width: 1240px;
    margin: 0 auto;
    overflow: clip;
    border: 1px solid rgba(148,163,184,.35);
    border-radius: 28px;
    box-shadow: 0 24px 60px rgba(15,23,42,.16);
    background: rgba(255,255,255,.92);
    backdrop-filter: blur(4px);
}

header {
    position: relative;
    padding: 28px 28px 20px;
    background:
        radial-gradient(circle at top left, rgba(255,255,255,.08), transparent 34%),
        linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

header::after {
    content: "";
    position: absolute;
    left: 28px;
    right: 28px;
    bottom: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(245,158,11,.8), transparent);
}

header h1 {
    margin: 0;
    font-size: clamp(2rem, 4vw, 2.8rem);
    font-weight: 850;
    letter-spacing: -0.05em;
}

header p {
    margin: 8px 0 0;
    max-width: 74ch;
    color: rgba(255,255,255,.76);
    font-size: 0.98rem;
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    padding: 9px 14px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,.12);
    background: rgba(255,255,255,.06);
    color: #fff;
    text-decoration: none;
    font-weight: 650;
    transition: transform var(--t), background var(--t), border-color var(--t);
}
.btn-back:hover {
    transform: translateY(-1px);
    background: rgba(255,255,255,.10);
    border-color: rgba(245,158,11,.45);
}

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.tab-btn {
    height: 40px;
    padding: 0 16px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,.12);
    background: rgba(255,255,255,.05);
    color: rgba(255,255,255,.84);
    font: inherit;
    font-weight: 650;
    cursor: pointer;
    transition: transform var(--t), background var(--t), color var(--t), border-color var(--t), box-shadow var(--t);
}
.tab-btn:hover {
    transform: translateY(-1px);
    background: rgba(255,255,255,.10);
    border-color: rgba(255,255,255,.18);
    color: #fff;
}
.tab-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-color: rgba(255,255,255,.15);
    color: #fff;
    box-shadow: 0 10px 24px rgba(99,102,241,.24);
}

.tab-content { animation: fade-in 220ms ease; }
@keyframes fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.hero-panel {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 18px;
    margin: 22px 28px 0;
    padding: 20px;
    border: 1px solid rgba(148,163,184,.35);
    border-radius: 24px;
    background:
        linear-gradient(180deg, rgba(255,255,255,.96), rgba(248,250,255,.92));
    box-shadow: var(--shadow-md);
}

.hero-panel--admin { margin-top: 18px; }

.hero-panel__copy h2 {
    margin: 0;
    color: var(--text-2);
    font-size: clamp(1.55rem, 3vw, 2.15rem);
    line-height: 1.15;
    letter-spacing: -0.04em;
}

.hero-kicker {
    margin: 0 0 10px;
    color: var(--accent-dark);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.hero-text {
    margin: 12px 0 0;
    color: var(--text-3);
    max-width: 62ch;
}

.hero-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.hero-chip {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid rgba(99,102,241,.16);
    background: #eef2ff;
    color: var(--primary-dark);
    font-size: 0.8rem;
    font-weight: 750;
}

.hero-panel__stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.hero-stat {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100px;
    padding: 14px 16px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: linear-gradient(180deg, #fff, #f8faff);
    box-shadow: var(--shadow-sm);
}

.hero-stat__label {
    color: var(--text-3);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.10em;
}

.hero-stat strong {
    margin-top: 8px;
    color: var(--text-2);
    font-size: 1.7rem;
    line-height: 1;
    letter-spacing: -0.05em;
}

.admin-layout {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 24px 28px 28px;
}

.upload-section,
.files-section,
.security-section,
.info-card,
.cicd-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 20px;
}

.upload-section h2,
.files-section h2,
.security-section h2,
.info-card h2,
.cicd-section h2 {
    margin: 0 0 16px;
    color: var(--text-2);
    font-size: 1.05rem;
    font-weight: 750;
    letter-spacing: -0.02em;
}

.section-description {
    margin: 0 0 16px;
    color: var(--text-3);
    font-size: 0.94rem;
}

.file-input-group,
.upload-actions,
.profile-search-row,
.config-item,
.key-display-box,
.cicd-trigger-form .form-row {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.file-input-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.btn-file,
.btn-upload,
.btn-refresh,
.btn-admin,
.btn-action,
.btn-update-creds,
.btn-create,
.btn-toggle,
.btn-copy,
.btn-show,
.btn-trigger,
.btn-sm,
.ip-list li button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 40px;
    padding: 0 14px;
    border-radius: 12px;
    border: 1px solid transparent;
    cursor: pointer;
    font: inherit;
    font-weight: 650;
    text-decoration: none;
    transition: transform var(--t), background var(--t), border-color var(--t), box-shadow var(--t), color var(--t);
}

.btn-file,
.btn-upload,
.btn-admin,
.btn-update-creds,
.btn-create,
.btn-trigger {
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    box-shadow: 0 10px 20px rgba(99,102,241,.18);
}
.btn-file:hover,
.btn-upload:hover,
.btn-admin:hover,
.btn-update-creds:hover,
.btn-create:hover,
.btn-trigger:hover {
    transform: translateY(-1px);
    background: linear-gradient(135deg, #7172f2, #4f46e5);
}

.btn-refresh {
    background: var(--surface-2);
    border-color: var(--border);
    color: var(--text);
}
.btn-refresh:hover {
    transform: translateY(-1px);
    border-color: var(--primary);
    background: #fff;
}

.btn-action {
    color: #fff;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    box-shadow: 0 10px 20px rgba(245,158,11,.18);
}
.btn-action:hover { transform: translateY(-1px); }

.btn-show,
.btn-copy,
.btn-sm,
.btn-toggle,
.ip-list li button {
    background: var(--surface-2);
    border-color: var(--border);
    color: var(--text);
}
.btn-show:hover,
.btn-copy:hover,
.btn-sm:hover,
.btn-toggle:hover,
.ip-list li button:hover {
    border-color: var(--primary);
    background: #fff;
}

.btn-delete-small {
    height: 34px;
    padding: 0 12px;
    border-radius: 10px;
    border: 1px solid rgba(220,38,38,.22);
    background: rgba(220,38,38,.10);
    color: #b91c1c;
}
.btn-delete-small:hover { background: rgba(220,38,38,.18); }
.btn-delete-small.confirm-pending {
    box-shadow: 0 0 0 3px rgba(220,38,38,.20);
}
.btn-toggle.btn-danger { background: rgba(220,38,38,.12); color: #b91c1c; }
.btn-toggle.btn-success { background: rgba(5,150,105,.12); color: #047857; }

.file-selected-name-inline {
    display: flex;
    align-items: center;
    min-height: 40px;
    flex: 1;
    min-width: 0;
    padding: 0 14px;
    border-radius: 12px;
    border: 1px dashed var(--border);
    background: var(--surface-2);
    color: var(--text-3);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.drop-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 150px;
    padding: 18px 18px 20px;
    border-radius: var(--radius-lg);
    border: 2px dashed #cbd5e1;
    background:
        radial-gradient(circle at top, rgba(99,102,241,.08), transparent 55%),
        var(--surface-2);
    text-align: center;
    cursor: pointer;
    transition: transform var(--t), border-color var(--t), box-shadow var(--t), background var(--t);
}
.drop-zone:hover,
.drop-zone:focus,
.drop-zone--active {
    transform: translateY(-1px);
    border-color: var(--primary);
    background:
        radial-gradient(circle at top, rgba(99,102,241,.12), transparent 55%),
        #fff;
    box-shadow: var(--shadow-md);
}
.drop-zone__icon { font-size: 2rem; }
.drop-zone__title { color: var(--text-2); font-weight: 700; }
.drop-zone__sub { color: var(--text-3); font-size: 0.9rem; }

.progress-bar {
    width: 100%;
    height: 10px;
    border-radius: 999px;
    background: #e2e8f0;
    overflow: hidden;
}
.progress-fill {
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    transition: width 240ms ease;
}
.upload-progress-wrap {
    display: none;
    gap: 10px;
    align-items: center;
    margin-top: 10px;
}
.progress-pct {
    min-width: 42px;
    text-align: right;
    color: var(--text-3);
    font-weight: 700;
}

.status-message {
    display: none;
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
}
.status-message.success {
    display: block;
    border-color: rgba(5,150,105,.22);
    background: rgba(5,150,105,.08);
    color: #047857;
}
.status-message.error {
    display: block;
    border-color: rgba(220,38,38,.22);
    background: rgba(220,38,38,.08);
    color: #b91c1c;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 14px;
}
.dash-card {
    padding: 18px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: linear-gradient(180deg, #fff, #f8faff);
    text-align: center;
    box-shadow: var(--shadow-sm);
}
.dash-card:hover { border-color: rgba(99,102,241,.30); }
.dash-card__icon { font-size: 1.55rem; margin-bottom: 8px; }
.dash-card__value {
    font-size: 2rem;
    line-height: 1;
    letter-spacing: -0.05em;
    font-weight: 850;
    color: var(--text-2);
}
.dash-card__label {
    margin-top: 6px;
    color: var(--text-3);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.10em;
}
.dash-card--accent .dash-card__value { color: var(--primary); }
.dash-card--success .dash-card__value { color: var(--success); }
.dash-card--danger .dash-card__value { color: var(--danger); }

.endpoint-list,
.dash-endpoint-list,
.security-list,
.api-keys-table,
.profile-browser,
.profile-lifecycle {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.endpoint,
.dash-endpoint-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(99,102,241,.12);
    background: linear-gradient(180deg, #fff, #f8faff);
}
.dash-endpoint-row {
    flex-direction: row;
    align-items: baseline;
    gap: 10px;
}
.endpoint code,
.dash-endpoint-row code {
    color: var(--primary-dark);
    font-weight: 700;
    font-size: 0.9rem;
}
.endpoint span,
.dash-endpoint-row span {
    color: var(--text-3);
    font-size: 0.9rem;
}

.dash-section-title {
    margin: 18px 0 10px;
    color: var(--text-3);
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.table-container {
    width: 100%;
    overflow-x: auto;
}
.table-container h3 {
    margin: 18px 0 10px;
    padding: 10px 14px;
    border-radius: 12px;
    background: #eef2ff;
    border: 1px solid rgba(99,102,241,.14);
    color: var(--primary-dark);
    font-size: 0.84rem;
    font-weight: 750;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.file-table,
.cicd-table {
    width: 100%;
    border-collapse: collapse;
    border-radius: 16px;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--border);
}
.file-table thead,
.cicd-table th {
    background: #eef2ff;
}
.file-table thead th,
.cicd-table th {
    padding: 10px 12px;
    text-align: left;
    color: var(--text-2);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 1px solid var(--border);
}
.file-table tbody tr,
.cicd-table tbody tr {
    border-bottom: 1px solid rgba(148,163,184,.16);
    transition: background var(--t);
}
.file-table tbody tr:hover,
.cicd-table tbody tr:hover { background: rgba(99,102,241,.05); }
.file-table tbody td,
.cicd-table td {
    padding: 10px 12px;
    vertical-align: top;
    font-size: 0.92rem;
    color: var(--text);
}
.file-table tbody td code,
.cicd-table td code {
    padding: 2px 6px;
    border-radius: 6px;
    background: #eef2ff;
    color: var(--primary-dark);
}

.badge,
.status-badge,
.version-latest-badge,
.badge-success,
.badge-failure,
.badge-running,
.badge-queued,
.badge-cancelled,
.badge-neutral,
.badge-info,
.badge-primary,
.badge-secondary {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 800;
    white-space: nowrap;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}
.badge-primary,
.version-latest-badge,
.badge-running {
    background: rgba(99,102,241,.12);
    color: var(--primary-dark);
    border: 1px solid rgba(99,102,241,.18);
}
.version-latest-badge {
    background: rgba(245,158,11,.12);
    color: var(--accent-dark);
    border-color: rgba(245,158,11,.20);
}
.badge-secondary,
.badge-neutral {
    background: #f3f4f6;
    color: var(--text-3);
    border: 1px solid var(--border);
}
.badge-info,
.status-badge.status-enabled {
    background: rgba(5,150,105,.10);
    color: #047857;
    border: 1px solid rgba(5,150,105,.18);
}
.badge-success { background: rgba(5,150,105,.12); color: #047857; border: 1px solid rgba(5,150,105,.18); }
.badge-failure { background: rgba(220,38,38,.12); color: #b91c1c; border: 1px solid rgba(220,38,38,.18); }
.badge-queued { background: rgba(245,158,11,.12); color: var(--accent-dark); border: 1px solid rgba(245,158,11,.18); }
.badge-cancelled { background: #f3f4f6; color: var(--text-3); border: 1px solid var(--border); }
.status-badge.status-disabled {
    background: rgba(245,158,11,.12);
    color: var(--accent-dark);
    border: 1px solid rgba(245,158,11,.18);
}

.ip-list {
    list-style: none;
    padding: 0;
    margin: 0;
    gap: 10px;
}
.ip-list li,
.api-key-item,
.config-item,
.profile-row,
.lifecycle-step {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: linear-gradient(180deg, #fff, #fafbff);
}
.ip-list li,
.api-key-item,
.config-item { justify-content: space-between; }
.key-info { flex: 1; line-height: 1.6; }
.key-info code,
.api-key-value {
    padding: 2px 6px;
    border-radius: 6px;
    background: #eef2ff;
    color: var(--primary-dark);
}
.api-key-preview {
    background: rgba(99,102,241,.12);
    color: var(--primary-dark);
    border: 1px solid rgba(99,102,241,.18);
}
.key-hidden { filter: blur(6px); user-select: none; }
.key-note { display: block; margin-top: 4px; color: var(--accent-dark); font-size: 0.78rem; }

.credentials-form,
.create-api-key-form,
.config-json-viewer,
.cicd-trigger-form,
.cicd-config-bar {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 16px;
}
.credentials-form,
.create-api-key-form,
.cicd-trigger-form { padding: 16px; }
.credentials-form h3,
.create-api-key-form h3 {
    margin: 0 0 12px;
    color: var(--text-2);
    font-size: 0.96rem;
}

.form-group,
.cicd-trigger-form .form-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}
.form-group label,
.cicd-trigger-form .form-row label {
    font-size: 0.76rem;
    font-weight: 800;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.form-group input,
.create-api-key-form input[type="text"],
.profile-search-input,
.cicd-select,
.cicd-input {
    width: 100%;
    min-height: 40px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    font: inherit;
    outline: none;
    transition: border-color var(--t), box-shadow var(--t), background var(--t);
}
.form-group input:hover,
.create-api-key-form input[type="text"]:hover,
.profile-search-input:hover,
.cicd-select:hover,
.cicd-input:hover {
    border-color: rgba(99,102,241,.34);
}
.form-group input:focus,
.create-api-key-form input[type="text"]:focus,
.profile-search-input:focus,
.cicd-select:focus,
.cicd-input:focus {
    border-color: var(--primary);
    box-shadow: var(--focus);
    background: #fff;
}
.form-group input::placeholder,
.create-api-key-form input[type="text"]::placeholder,
.profile-search-input::placeholder,
.cicd-input::placeholder {
    color: #9ca3af;
}
.form-group small,
.create-api-key-form small {
    color: var(--text-3);
    font-size: 0.78rem;
}

.config-info { flex: 1; }
.config-info strong { display: block; margin-bottom: 4px; font-size: 0.95rem; color: var(--text-2); }
.config-info p { margin: 0 0 6px; color: var(--text-3); font-size: 0.88rem; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}
.stat-card {
    padding: 16px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: linear-gradient(180deg, #fff, #f8faff);
    text-align: center;
    box-shadow: var(--shadow-sm);
}
.stat-card h3 {
    margin: 0 0 8px;
    color: var(--text-3);
    font-size: 0.74rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 850;
    color: var(--text-2);
}

.profile-search-row { margin-bottom: 16px; }
.profile-search-input { flex: 1; min-width: 220px; }
.profile-filter-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-3);
    user-select: none;
}
.profile-filter-toggle input { accent-color: var(--primary); }
.profile-browser {
    max-height: 540px;
    overflow-y: auto;
    padding-right: 4px;
}
.profile-row {
    justify-content: space-between;
    flex-wrap: wrap;
    background: linear-gradient(180deg, #fff, #fafbff);
}
.profile-row--experimental {
    border-color: rgba(245,158,11,.24);
    background: rgba(245,158,11,.05);
}
.profile-row__name { flex: 1; min-width: 180px; font-weight: 700; color: var(--text-2); }
.profile-row__brands { color: var(--text-3); font-size: 0.88rem; }
.profile-row__proto {
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(99,102,241,.12);
    color: var(--primary-dark);
    border: 1px solid rgba(99,102,241,.18);
    font-size: 0.74rem;
    font-weight: 800;
    white-space: nowrap;
}
.profile-row__proto--obd {
    background: rgba(5,150,105,.12);
    color: #047857;
    border-color: rgba(5,150,105,.18);
}
.profile-row__badge-exp {
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(245,158,11,.12);
    color: var(--accent-dark);
    border: 1px solid rgba(245,158,11,.18);
    font-size: 0.70rem;
    font-weight: 800;
}
.profile-no-results,
.loading {
    padding: 18px 0;
    text-align: center;
    color: var(--text-3);
}

.profile-lifecycle { gap: 12px; }
.lifecycle-step {
    align-items: flex-start;
    background: linear-gradient(180deg, #fff, #fafbff);
}
.lifecycle-step__num {
    flex: 0 0 30px;
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    font-weight: 800;
}
.lifecycle-step__body strong { display: block; margin-bottom: 4px; color: var(--text-2); }
.lifecycle-step__body p { margin: 0; color: var(--text-3); }
.lifecycle-step__body code {
    padding: 2px 6px;
    border-radius: 6px;
    background: #eef2ff;
    color: var(--primary-dark);
}

.config-json-viewer {
    padding: 6px;
    overflow: auto;
    max-height: 560px;
}
.config-json-pre {
    margin: 0;
    padding: 14px 16px;
    white-space: pre;
    overflow-x: auto;
    color: #0f172a;
    font-size: 0.82rem;
    line-height: 1.6;
}
.cjv-key-section { color: var(--accent-dark); font-weight: 800; }
.cjv-key { color: var(--primary-dark); }
.cjv-str { color: var(--success); }
.cjv-num { color: #db2777; }
.cjv-bool { color: #0891b2; font-weight: 800; }
.cjv-null { color: var(--text-3); font-style: italic; }

.config-field-table-wrap { overflow-x: auto; }
.config-field-table { font-size: 0.88rem; }
.config-field-table code { font-size: 0.8rem; }
.cfg-section-row td {
    background: rgba(99,102,241,.08);
    color: var(--primary-dark);
    font-weight: 800;
}

.diffs-result {
    display: none;
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(5,150,105,.18);
    background: rgba(5,150,105,.08);
}
.diffs-result__title { margin-bottom: 6px; color: #047857; font-weight: 800; }
.diffs-result__list { margin: 0; padding-left: 18px; }
.diffs-result__list li { color: var(--text-3); }
.diffs-result--error {
    border-color: rgba(220,38,38,.18);
    background: rgba(220,38,38,.08);
}
.diffs-result--error .diffs-result__title { color: #b91c1c; }

#toast-container {
    position: fixed;
    top: 18px;
    right: 18px;
    width: min(380px, calc(100vw - 36px));
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 9999;
    pointer-events: none;
}
.toast {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 13px 16px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: #fff;
    box-shadow: var(--shadow-md);
    color: var(--text);
    pointer-events: auto;
}
.toast__icon { flex: 0 0 auto; }
.toast__body { flex: 1; }
.toast__close {
    border: 0;
    background: transparent;
    color: var(--text-3);
    font-size: 1rem;
    cursor: pointer;
}
.toast--success { border-color: rgba(5,150,105,.22); }
.toast--error { border-color: rgba(220,38,38,.22); }
.toast--warning { border-color: rgba(245,158,11,.22); }
.toast--info { border-color: rgba(99,102,241,.22); }
.toast--out { animation: toast-out 220ms ease forwards; }
@keyframes toast-out { to { opacity: 0; transform: translateX(18px); } }

.cicd-section { background: linear-gradient(180deg, #fff, #fafbff); }
.cicd-config-bar { padding: 12px 14px; }
.cicd-config-ok {
    background: rgba(5,150,105,.08);
    border-color: rgba(5,150,105,.18);
    color: #047857;
}
.cicd-config-warn {
    background: rgba(245,158,11,.08);
    border-color: rgba(245,158,11,.18);
    color: var(--accent-dark);
}
.cicd-trigger-form { padding: 16px; }
.cicd-select,
.cicd-input {
    border-color: var(--border);
}
.cicd-table-container { overflow-x: auto; margin-top: 10px; }
.commit-msg {
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-3);
}
.run-link {
    color: var(--primary-dark);
    font-weight: 800;
    text-decoration: none;
}
.run-link:hover { text-decoration: underline; }
.branch-tag,
.sha-tag {
    display: inline-flex;
    align-items: center;
    padding: 3px 7px;
    border-radius: 999px;
    background: #eef2ff;
    color: var(--primary-dark);
    font-size: 0.78rem;
}
.empty-state { color: var(--text-3); font-style: italic; padding: 14px 0; }
.error-text { color: #b91c1c; }

footer {
    padding: 18px 28px 26px;
    border-top: 1px solid var(--border);
    color: var(--text-3);
    text-align: center;
    background: rgba(255,255,255,.75);
}
footer a {
    color: var(--primary-dark);
    text-decoration: none;
}
footer a:hover { text-decoration: underline; }

@media (max-width: 900px) {
    body { padding: 14px; }
    .container { border-radius: 22px; }
    header,
    .admin-layout,
    footer { padding-left: 18px; padding-right: 18px; }
    .dashboard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
    .file-input-group,
    .upload-actions,
    .profile-search-row,
    .config-item,
    .key-display-box,
    .dash-endpoint-row,
    .ip-list li,
    .api-key-item,
    .profile-row,
    .lifecycle-step {
        align-items: stretch;
    }
    .profile-row__name,
    .profile-row__brands,
    .profile-row__proto { width: 100%; }
    .tabs { gap: 8px; }
    .tab-btn { width: 100%; justify-content: center; }
    .dashboard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 540px) {
    body { padding: 10px; }
    .container { border-radius: 18px; }
    header h1 { font-size: 1.7rem; }
    .dashboard-grid,
    .stats-grid { grid-template-columns: 1fr; }
    .btn-file,
    .btn-upload,
    .btn-refresh,
    .btn-admin,
    .btn-action,
    .btn-update-creds,
    .btn-create,
    .btn-trigger,
    .btn-sm,
    .btn-copy,
    .btn-show {
        width: 100%;
    }
    #toast-container {
        left: 10px;
        right: 10px;
        width: auto;
    }
}

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