/* ============================================
   Lake Admin — Premium dashboard design
   Palette: Deep navy sidebar, soft grey content,
   accent #0ea5e9 (sky blue), warm shadows
   ============================================ */

/* --- Reset & base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: #f8fafc;
    color: #0f172a;
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
body.login-page {
    background: #0c1929;
    color: #e2e8f0;
}

a { color: #0ea5e9; text-decoration: none; transition: color 0.15s; }
a:hover { color: #0284c7; text-decoration: none; }
code { font-family: 'JetBrains Mono', 'SF Mono', 'Cascadia Code', monospace; font-size: 0.88em; background: #f1f5f9; padding: 2px 6px; border-radius: 4px; color: #0f172a; }

/* --- Layout --- */
.admin-layout {
    display: grid;
    grid-template-columns: 272px 1fr;
    grid-template-rows: 64px 1fr;
    grid-template-areas: "sidebar header" "sidebar main";
    min-height: 100vh;
}

/* ============================================
   HEADER
   ============================================ */
.admin-header {
    grid-area: header;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    height: 64px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.admin-header .breadcrumb {
    font-size: 14px;
    color: #94a3b8;
    font-weight: 500;
}
.admin-header .breadcrumb strong {
    color: #0f172a;
    font-weight: 700;
}
.admin-header .header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}
.admin-header .site-version {
    font-size: 11px;
    color: #94a3b8;
    font-family: monospace;
    background: #f1f5f9;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}
.admin-header .user-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 14px 6px 6px;
    border-radius: 100px;
    background: #f1f5f9;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    cursor: default;
    transition: background 0.15s;
}
.admin-header .user-badge:hover { background: #e2e8f0; }
.admin-header .user-badge .avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0ea5e9, #0369a1);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.5px;
}
.btn-logout {
    padding: 7px 16px;
    border-radius: 100px;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #64748b;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-logout:hover { border-color: #fca5a5; color: #dc2626; background: #fef2f2; }
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: #334155;
    border-radius: 8px;
    transition: background 0.15s;
}
.mobile-menu-btn:hover { background: #f1f5f9; }
.mobile-menu-btn svg { display: block; }

/* ============================================
   SIDEBAR
   ============================================ */
.admin-sidebar {
    grid-area: sidebar;
    background: #0f1b2d;
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    position: sticky;
    top: 0;
    height: 100vh;
}
.admin-sidebar::-webkit-scrollbar { width: 4px; }
.admin-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }
.sidebar-brand {
    padding: 22px 24px;
    font-size: 17px;
    font-weight: 800;
    letter-spacing: -0.4px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    gap: 12px;
}
.sidebar-brand .brand-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #0ea5e9, #0369a1);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: 0 2px 8px rgba(14,165,233,0.3);
}
.sidebar-nav {
    padding: 20px 16px;
    flex: 1;
}
.sidebar-nav .nav-section {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: rgba(255,255,255,0.25);
    padding: 20px 12px 8px;
}
.sidebar-nav .nav-section:first-child { padding-top: 0; }
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 10px;
    color: rgba(255,255,255,0.55);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    text-decoration: none;
    margin-bottom: 2px;
    position: relative;
}
.sidebar-nav a:hover {
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.9);
}
.sidebar-nav a.active {
    background: rgba(14,165,233,0.12);
    color: #38bdf8;
    font-weight: 600;
}
.sidebar-nav a.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: #0ea5e9;
    border-radius: 0 3px 3px 0;
}
.sidebar-nav a .nav-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: 0.5;
    transition: opacity 0.15s;
}
.sidebar-nav a:hover .nav-icon { opacity: 0.8; }
.sidebar-nav a.active .nav-icon { opacity: 1; }
.sidebar-footer {
    padding: 20px 24px;
    border-top: 1px solid rgba(255,255,255,0.06);
    font-size: 11px;
    color: rgba(255,255,255,0.2);
    font-weight: 500;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.admin-main {
    grid-area: main;
    padding: 32px;
    overflow-y: auto;
    max-width: 1440px;
}

/* --- Page header --- */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 12px;
}
.page-header h1 {
    font-size: 24px;
    font-weight: 800;
    color: #0f172a;
    margin: 0;
    letter-spacing: -0.5px;
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: #fff;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.02);
    transition: box-shadow 0.2s;
}
.card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f1f5f9;
}
.card-header h2 {
    font-size: 16px;
    font-weight: 700;
    margin: 0;
    color: #0f172a;
}

/* ============================================
   STATS GRID
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}
.stat-card {
    background: #fff;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    padding: 24px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    overflow: hidden;
}
.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #0ea5e9, #38bdf8);
    opacity: 0;
    transition: opacity 0.2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.08); }
.stat-card:hover::after { opacity: 1; }
.stat-card .stat-label {
    font-size: 12px;
    color: #94a3b8;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}
.stat-card .stat-value {
    font-size: 32px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1;
    letter-spacing: -1px;
}
.stat-card .stat-value.text-success { color: #16a34a; }
.stat-card .stat-value.text-warning { color: #d97706; }
.stat-card .stat-value.text-danger { color: #dc2626; }
.stat-card .stat-value.text-primary { color: #0ea5e9; }
.stat-card .stat-sub { font-size: 12px; color: #94a3b8; margin-top: 6px; }

/* ============================================
   TABLES
   ============================================ */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: -4px;
    padding: 4px;
}
table.admin-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
}
table.admin-table thead th {
    background: #f8fafc;
    padding: 12px 16px;
    text-align: left;
    font-weight: 700;
    color: #64748b;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
    position: sticky;
    top: 0;
}
table.admin-table thead th.sortable {
    cursor: pointer;
    user-select: none;
    transition: color 0.15s, background 0.15s;
}
table.admin-table thead th.sortable:hover {
    color: #0ea5e9;
    background: #f1f5f9;
}
table.admin-table thead th.sortable.sorted {
    color: #0ea5e9;
}
table.admin-table thead th .sort-arrow {
    font-size: 12px;
    font-weight: 800;
    color: #0ea5e9;
    margin-left: 2px;
}
table.admin-table thead th:first-child { border-radius: 8px 0 0 0; }
table.admin-table thead th:last-child { border-radius: 0 8px 0 0; }
table.admin-table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
    transition: background 0.1s;
}
table.admin-table tbody tr { transition: background 0.1s; }
table.admin-table tbody tr:hover { background: #f8fafc; }
table.admin-table tbody tr:last-child td { border-bottom: none; }

/* ============================================
   BADGES
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.3px;
    line-height: 1.5;
    white-space: nowrap;
}
.badge-success { background: #dcfce7; color: #15803d; }
.badge-danger { background: #fee2e2; color: #b91c1c; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info { background: #e0f2fe; color: #0369a1; }
.badge-neutral { background: #f1f5f9; color: #475569; }

/* ============================================
   TOGGLE SWITCH
   ============================================ */
.toggle-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    margin: 0;
    vertical-align: middle;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}
.toggle-slider {
    width: 40px;
    height: 22px;
    background: #cbd5e1;
    border-radius: 22px;
    position: relative;
    transition: background 0.25s ease;
    flex-shrink: 0;
}
.toggle-slider::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.toggle-switch input:checked + .toggle-slider {
    background: #16a34a;
}
.toggle-switch input:checked + .toggle-slider::after {
    transform: translateX(18px);
}
.toggle-switch input:focus + .toggle-slider {
    box-shadow: 0 0 0 3px rgba(14,165,233,0.15);
}
.toggle-switch input:disabled + .toggle-slider {
    opacity: 0.5;
    cursor: not-allowed;
}
/* Info variant (blue instead of green) */
.toggle-switch.toggle-info input:checked + .toggle-slider {
    background: #0ea5e9;
}
/* Warning variant */
.toggle-switch.toggle-warning input:checked + .toggle-slider {
    background: #d97706;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 10px;
    border: 1px solid transparent;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    text-decoration: none;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
    background: linear-gradient(135deg, #0ea5e9, #0284c7);
    color: #fff;
    box-shadow: 0 2px 8px rgba(14,165,233,0.25);
}
.btn-primary:hover { box-shadow: 0 4px 16px rgba(14,165,233,0.35); background: linear-gradient(135deg, #38bdf8, #0ea5e9); }
.btn-secondary { background: #fff; color: #334155; border-color: #e2e8f0; box-shadow: 0 1px 2px rgba(0,0,0,0.04); }
.btn-secondary:hover { background: #f8fafc; border-color: #cbd5e1; }
.btn-danger { background: #fff; color: #dc2626; border-color: #fecaca; }
.btn-danger:hover { background: #fef2f2; border-color: #fca5a5; }
.btn-sm { padding: 6px 14px; font-size: 13px; border-radius: 8px; }
.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: #fff;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    color: #64748b;
    font-size: 16px;
    transition: all 0.2s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.btn-icon:hover { background: #f1f5f9; color: #0f172a; border-color: #cbd5e1; }
.btn-icon.danger:hover { background: #fef2f2; color: #dc2626; border-color: #fecaca; }

/* ============================================
   FORMS
   ============================================ */
.form-group { margin-bottom: 20px; }
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: #334155;
    margin-bottom: 8px;
    letter-spacing: -0.1px;
}
.form-control {
    width: 100%;
    padding: 11px 16px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    color: #0f172a;
    background: #fff;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-control:focus {
    border-color: #0ea5e9;
    box-shadow: 0 0 0 4px rgba(14,165,233,0.08);
}
.form-control::placeholder { color: #cbd5e1; }
select.form-control { appearance: auto; cursor: pointer; }
textarea.form-control {
    resize: vertical;
    min-height: 80px;
    font-family: 'JetBrains Mono', 'SF Mono', monospace;
    font-size: 13px;
    line-height: 1.6;
}
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.form-help {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 6px;
}

/* ============================================
   MODALS
   ============================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s, visibility 0.25s;
}
.modal-overlay.open { opacity: 1; visibility: visible; }
.modal {
    background: #fff;
    border-radius: 20px;
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 24px 80px rgba(0,0,0,0.2), 0 8px 24px rgba(0,0,0,0.1);
    transform: translateY(16px) scale(0.98);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-overlay.open .modal { transform: translateY(0) scale(1); }
.modal::-webkit-scrollbar { width: 6px; }
.modal::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 6px; }
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 28px;
    border-bottom: 1px solid #f1f5f9;
}
.modal-header h3 {
    font-size: 18px;
    font-weight: 800;
    margin: 0;
    letter-spacing: -0.3px;
}
.modal-close {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: none;
    background: #f1f5f9;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #64748b;
    transition: all 0.15s;
}
.modal-close:hover { background: #e2e8f0; color: #0f172a; }
.modal-body { padding: 28px; }
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 20px 28px;
    border-top: 1px solid #f1f5f9;
    background: #fafbfc;
    border-radius: 0 0 20px 20px;
}

/* ============================================
   TOOLBAR
   ============================================ */
.toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.toolbar .search-input {
    flex: 1;
    min-width: 220px;
    max-width: 400px;
    padding: 10px 16px 10px 40px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85zm-5.442.156a5 5 0 1 1 0-10 5 5 0 0 1 0 10z'/%3E%3C/svg%3E") no-repeat 14px center;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.toolbar .search-input:focus {
    border-color: #0ea5e9;
    box-shadow: 0 0 0 4px rgba(14,165,233,0.08);
}
.toolbar select {
    padding: 10px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
}
.toolbar select:focus { border-color: #0ea5e9; }

/* ============================================
   TOASTS
   ============================================ */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column-reverse;
    gap: 10px;
}
.toast {
    padding: 14px 24px 14px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    animation: toastIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    max-width: 420px;
    display: flex;
    align-items: center;
    gap: 10px;
    backdrop-filter: blur(8px);
}
.toast::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
    opacity: 0.5;
}
.toast.success { background: linear-gradient(135deg, #16a34a, #15803d); }
.toast.error { background: linear-gradient(135deg, #dc2626, #b91c1c); }
.toast.warning { background: linear-gradient(135deg, #d97706, #b45309); }
.toast.info { background: linear-gradient(135deg, #0ea5e9, #0284c7); }
@keyframes toastIn {
    from { opacity: 0; transform: translateY(16px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ============================================
   PAGINATION
   ============================================ */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 24px;
}
.pagination button {
    padding: 7px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    color: #334155;
    transition: all 0.2s;
    font-family: inherit;
}
.pagination button:hover:not(:disabled) { background: #f1f5f9; border-color: #cbd5e1; }
.pagination button.active { background: #0ea5e9; color: #fff; border-color: #0ea5e9; box-shadow: 0 2px 8px rgba(14,165,233,0.3); }
.pagination button:disabled { opacity: 0.35; cursor: not-allowed; }

/* ============================================
   LOADING
   ============================================ */
.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e2e8f0;
    border-top-color: #0ea5e9;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin: 48px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 240px;
}

/* ============================================
   MONITORING STATUS
   ============================================ */
.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}
.status-card {
    background: #fff;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    padding: 24px;
    border-left: 4px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    transition: box-shadow 0.2s;
}
.status-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.06); }
.status-card.ok { border-left-color: #16a34a; }
.status-card.warning { border-left-color: #d97706; }
.status-card.critical { border-left-color: #dc2626; }
.status-card h3 {
    font-size: 15px;
    font-weight: 700;
    margin: 0 0 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #0f172a;
}
.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}
.status-dot.ok { background: #16a34a; box-shadow: 0 0 8px rgba(22,163,74,0.4); }
.status-dot.warning { background: #d97706; box-shadow: 0 0 8px rgba(217,119,6,0.4); }
.status-dot.critical { background: #dc2626; box-shadow: 0 0 8px rgba(220,38,38,0.4); animation: pulse 1.5s ease infinite; }
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:0.5; } }
.status-card p { font-size: 13px; color: #64748b; margin: 4px 0 0; line-height: 1.5; }

/* ============================================
   JSON EDITOR
   ============================================ */
.json-editor {
    width: 100%;
    min-height: 320px;
    padding: 20px;
    border: 1.5px solid #1e293b;
    border-radius: 12px;
    font-family: 'JetBrains Mono', 'SF Mono', 'Cascadia Code', monospace;
    font-size: 13px;
    line-height: 1.7;
    background: #0f172a;
    color: #e2e8f0;
    resize: vertical;
    outline: none;
    tab-size: 2;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.json-editor:focus {
    border-color: #0ea5e9;
    box-shadow: 0 0 0 4px rgba(14,165,233,0.1);
}

/* ============================================
   CONFIRM DIALOG
   ============================================ */
.confirm-content { text-align: center; padding: 24px 0; }
.confirm-content .confirm-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}
.confirm-content .confirm-icon.danger { background: #fee2e2; color: #dc2626; }
.confirm-content p { font-size: 16px; color: #0f172a; font-weight: 600; }
.confirm-content .confirm-detail { font-size: 14px; color: #64748b; margin-top: 8px; font-weight: 400; }

/* ============================================
   AUDIT LOG
   ============================================ */
.audit-entry {
    display: flex;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 13px;
    align-items: baseline;
}
.audit-entry:last-child { border-bottom: none; }
.audit-entry .audit-time {
    color: #94a3b8;
    white-space: nowrap;
    min-width: 140px;
    font-family: 'JetBrains Mono', 'SF Mono', monospace;
    font-size: 12px;
}
.audit-entry .audit-action { font-weight: 700; color: #0f172a; }
.audit-entry .audit-detail { color: #64748b; }

/* ============================================
   ENVIRONMENT SELECTOR
   ============================================ */
.env-selector {
    position: relative;
}
.env-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 100px;
    border: 1.5px solid var(--env-color, #94a3b8);
    background: transparent;
    color: var(--env-color, #94a3b8);
    font-size: 11px;
    font-weight: 800;
    font-family: inherit;
    letter-spacing: 0.8px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.env-badge:hover {
    background: color-mix(in srgb, var(--env-color) 10%, transparent);
}
.env-badge .env-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--env-color, #94a3b8);
    animation: pulse 2s ease infinite;
}
.env-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
    z-index: 100;
    min-width: 200px;
    padding: 6px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.env-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.env-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    color: #334155;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s;
}
.env-option:hover {
    background: #f8fafc;
    color: #0f172a;
}
.env-option.active {
    background: #f1f5f9;
}
.env-option .env-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--env-color, #94a3b8);
    flex-shrink: 0;
}
.env-option small {
    margin-left: auto;
    font-size: 11px;
    color: #94a3b8;
    font-weight: 500;
    font-family: 'JetBrains Mono', 'SF Mono', monospace;
}
.env-option.env-disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.env-option.env-disabled:hover {
    background: transparent;
    color: #334155;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
    .admin-layout {
        grid-template-columns: 1fr;
        grid-template-areas: "header" "main";
    }
    .admin-sidebar {
        position: fixed;
        left: -288px;
        top: 0;
        width: 288px;
        height: 100vh;
        z-index: 200;
        transition: left 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        box-shadow: none;
    }
    .admin-sidebar.open {
        left: 0;
        box-shadow: 16px 0 48px rgba(0,0,0,0.2);
    }
    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(15,23,42,0.5);
        backdrop-filter: blur(4px);
        z-index: 190;
        display: none;
        transition: opacity 0.3s;
    }
    .sidebar-backdrop.open { display: block; }
    .mobile-menu-btn { display: flex; }
    .admin-header { padding: 0 16px; }
    .admin-main { padding: 20px 16px; }
    .stats-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
    .stat-card .stat-value { font-size: 24px; }
    .form-row { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .page-header .btn { width: 100%; }
}

@media (max-width: 480px) {
    .admin-header .user-badge span { display: none; }
    .admin-header .btn-sm { display: none; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .stat-card { padding: 16px; }
    .toolbar { flex-direction: column; align-items: stretch; }
    .toolbar .search-input { max-width: none; }
    .modal { margin: 8px; border-radius: 16px; }
    .modal-header, .modal-body, .modal-footer { padding-left: 20px; padding-right: 20px; }
    .status-grid { grid-template-columns: 1fr; }
    .toast-container { bottom: 16px; right: 16px; left: 16px; }
    .toast { max-width: none; }
    .profile-grid { grid-template-columns: 1fr; }
}

/* --- Profile page --- */
.profile-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    max-width: 900px;
}
.profile-grid .card {
    padding: 28px;
}
.profile-grid .card:last-child {
    grid-column: 1 / -1;
}
.card-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e2e8f0;
}
.form-actions {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #f1f5f9;
}
.form-hint {
    font-size: 0.85rem;
    color: #94a3b8;
    margin-top: 16px;
}
.profile-env-roles {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.profile-env-role {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}
.env-role-label {
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    min-width: 50px;
}

/* --- Env role inline (users table) --- */
.env-role-inline {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-right: 8px;
}
.env-role-tag {
    font-size: 0.7rem;
    font-weight: 700;
    color: #64748b;
    letter-spacing: 0.04em;
}

/* --- Form fieldset --- */
.form-fieldset {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 16px 18px 12px;
    margin: 12px 0;
}
.form-fieldset legend {
    font-size: 0.88rem;
    font-weight: 600;
    color: #475569;
    padding: 0 8px;
}

/* --- No-access screen --- */
.no-access-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 80px 24px;
    max-width: 480px;
    margin: 0 auto;
}
.no-access-icon {
    font-size: 3.5rem;
    margin-bottom: 20px;
    opacity: 0.8;
}
.no-access-screen h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 12px;
}
.no-access-screen p {
    color: #475569;
    margin: 0 0 8px;
    line-height: 1.6;
}
.no-access-hint {
    font-size: 0.88rem;
    color: #94a3b8 !important;
    margin-top: 8px !important;
}

/* ============================================
   DEPLOY PAGE
   ============================================ */
.deploy-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    max-width: 1060px;
}
.deploy-card-full {
    grid-column: 1 / -1;
}

/* --- Environment cards grid --- */
.deploy-env-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}
.deploy-env-card {
    border: 1.5px solid #e2e8f0;
    border-top: 3px solid #94a3b8;
    border-radius: 12px;
    padding: 20px;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.deploy-env-header {
    display: flex;
    align-items: center;
    gap: 12px;
}
.deploy-env-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.8px;
    color: #fff;
}
.deploy-env-version {
    font-size: 22px;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.5px;
}
.deploy-env-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 13px;
    color: #64748b;
}
.deploy-env-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 4px;
}

/* --- Deploy source/target selects --- */
.deploy-select-row {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    margin-bottom: 8px;
}
.deploy-select-arrow {
    font-size: 24px;
    color: #94a3b8;
    font-weight: 300;
    padding-bottom: 10px;
    flex-shrink: 0;
}

/* --- Shared --- */
.deploy-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 12px;
}
.deploy-tools {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.deploy-step {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 6px;
}
.deploy-step.active {
    background: #e0f2fe;
    color: #0369a1;
}
.deploy-step.success {
    background: #dcfce7;
    color: #15803d;
}
.deploy-step.warning {
    background: #fef3c7;
    color: #92400e;
}
.deploy-step.error {
    background: #fee2e2;
    color: #b91c1c;
}
.deploy-step-icon {
    font-weight: 800;
    font-size: 16px;
    flex-shrink: 0;
}

/* --- Exclusion tags --- */
.excl-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 4px 8px;
    margin: 0 6px 6px 0;
    font-size: 12px;
}
.excl-tag code {
    font-size: 12px;
    color: #334155;
}
.excl-tag-remove {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0 2px;
    font-weight: 600;
}
.excl-tag-remove:hover {
    color: #dc2626;
}

@media (max-width: 768px) {
    .deploy-env-grid { grid-template-columns: 1fr; }
    .deploy-select-row { flex-direction: column; align-items: stretch; }
    .deploy-select-arrow { text-align: center; transform: rotate(90deg); padding: 0; }
}
