/* ============================================================
   uGIS — Admin Panel Design System
   Theme: Slate dark / GeoServer-ERP hybrid
   ============================================================ */

/* ── Override root palette for admin ── */
:root {
    --rs-bg:        #0c1220;
    --rs-surface:   #111827;
    --rs-surface2:  #1a2236;
    --rs-surface3:  #212f46;
    --rs-border:    rgba(255,255,255,0.06);
    --rs-border-md: rgba(255,255,255,0.10);
    --rs-border-lg: rgba(255,255,255,0.16);
    --rs-blue:      #3b82f6;
    --rs-blue-dim:  rgba(59,130,246,0.12);
    --rs-blue-hov:  #2563eb;
    --rs-green:     #22c55e;
    --rs-green-dim: rgba(34,197,94,0.12);
    --rs-red:       #ef4444;
    --rs-red-dim:   rgba(239,68,68,0.12);
    --rs-amber:     #f59e0b;
    --rs-amber-dim: rgba(245,158,11,0.12);
    --rs-cyan:      #06b6d4;
    --rs-cyan-dim:  rgba(6,182,212,0.12);
    --rs-purple:    #8b5cf6;
    --rs-t1:        #f1f5f9;
    --rs-t2:        #94a3b8;
    --rs-t3:        #64748b;
    --rs-t4:        #475569;
    --rs-sidebar-w: 230px;
    --rs-topbar-h:  48px;
    --rs-radius:    6px;
    --rs-radius-lg: 10px;
    --rs-shadow:    0 4px 20px rgba(0,0,0,0.35);
    --rs-shadow-lg: 0 8px 40px rgba(0,0,0,0.5);
    /* legacy compat */
    --bg-primary: var(--rs-bg);
    --bg-secondary: var(--rs-surface);
    --bg-tertiary: var(--rs-surface2);
    --border: var(--rs-border);
    --border-strong: var(--rs-border-md);
    --text-primary: var(--rs-t1);
    --text-secondary: var(--rs-t2);
    --text-muted: var(--rs-t3);
    --text-dim: var(--rs-t4);
    --accent: var(--rs-blue);
    --accent-hover: var(--rs-blue-hov);
    --success: var(--rs-green);
    --success-light: #4ade80;
    --danger: var(--rs-red);
    --danger-light: #f87171;
    --warning: var(--rs-amber);
    --info: var(--rs-cyan);
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;
    --shadow-sm: 0 2px 8px rgba(0,0,0,.25);
    --shadow-md: 0 4px 16px rgba(0,0,0,.35);
    --shadow-lg: var(--rs-shadow-lg);
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    --navbar-height: 0px; /* admin is fully self-contained */
}

body { background: var(--rs-bg); color: var(--rs-t1); font-family: var(--font-sans); }

/* ── Hide global navbar on admin page ── */
.navbar { display: none !important; }

/* ════════════════════════════════════════
   LOGIN — Split panel
   ════════════════════════════════════════ */
.login-container {
    display: flex;
    min-height: 100vh;
    align-items: stretch;
}
.login-brand-panel {
    flex: 0 0 420px;
    background:
        radial-gradient(circle at 1px 1px, rgba(255,255,255,0.04) 1px, transparent 0) 0 0 / 22px 22px,
        linear-gradient(160deg, #0f1f3d 0%, #0c1220 60%, #162040 100%);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    padding: 60px 52px;
    border-right: 1px solid var(--rs-border-md);
    position: relative;
    overflow: hidden;
}
.login-brand-panel::before {
    content: '';
    position: absolute;
    width: 400px; height: 400px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(59,130,246,0.08) 0%, transparent 70%);
    top: -100px; right: -100px;
    pointer-events: none;
}
.login-brand-panel::after {
    content: '';
    position: absolute;
    width: 300px; height: 300px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(139,92,246,0.06) 0%, transparent 70%);
    bottom: -60px; left: -60px;
    pointer-events: none;
}
.login-logo {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 40px;
}
.login-logo-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 20px rgba(59,130,246,0.35), 0 0 0 1px rgba(255,255,255,0.1);
    overflow: hidden;
    flex-shrink: 0;
}
.login-logo-text {
    font-size: 22px;
    font-weight: 700;
    color: var(--rs-t1);
    letter-spacing: -0.3px;
}
.login-logo-text span { color: var(--rs-blue); }
.login-tagline {
    font-size: 13px;
    color: var(--rs-t3);
    margin-top: -30px;
    margin-bottom: 48px;
    letter-spacing: 0.3px;
}
.login-features {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.login-feature {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: var(--rs-t2);
}
.login-feature-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--rs-blue);
    flex-shrink: 0;
}
.login-form-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--rs-bg);
    padding: 40px;
}
.login-box {
    width: 100%;
    max-width: 360px;
}
.login-box h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--rs-t1);
    margin-bottom: 6px;
}
.login-box p {
    font-size: 13px;
    color: var(--rs-t3);
    margin-bottom: 32px;
}
.login-field-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--rs-t2);
    margin-bottom: 6px;
    letter-spacing: 0.3px;
}
.login-box input {
    width: 100%;
    padding: 10px 14px;
    margin-bottom: 16px;
    border: 1px solid var(--rs-border-md);
    border-radius: var(--rs-radius);
    background: var(--rs-surface);
    color: var(--rs-t1);
    font-size: 14px;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.login-box input:focus {
    border-color: var(--rs-blue);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}
.login-box button {
    width: 100%;
    padding: 11px;
    background: var(--rs-blue);
    color: #fff;
    border: none;
    border-radius: var(--rs-radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, box-shadow .15s;
    letter-spacing: 0.2px;
}
.login-box button:hover {
    background: var(--rs-blue-hov);
    box-shadow: 0 4px 14px rgba(59,130,246,0.3);
}
.login-error {
    color: #f87171;
    font-size: 12px;
    text-align: center;
    margin-top: 10px;
    display: none;
    padding: 8px 12px;
    background: var(--rs-red-dim);
    border-radius: var(--rs-radius);
    border: 1px solid rgba(239,68,68,0.2);
}

/* SSO login section */
.login-separator {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0 12px;
    color: var(--rs-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.login-separator::before,
.login-separator::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255,255,255,0.1);
}
.login-sso-btn {
    width: 100%;
    padding: 10px 16px;
    background: rgba(124,58,237,0.15);
    border: 1px solid rgba(124,58,237,0.3);
    border-radius: var(--rs-radius);
    color: #c4b5fd;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.15s, border-color 0.15s;
}
.login-sso-btn:hover {
    background: rgba(124,58,237,0.25);
    border-color: rgba(124,58,237,0.5);
    color: #ddd6fe;
}
.login-sso-btn svg { flex-shrink: 0; }

/* Login box entrance animation */
@keyframes loginBoxIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
.login-box { animation: loginBoxIn 0.35s ease; }

/* Login button loading state */
@keyframes rs-spin { to { transform: rotate(360deg); } }
.login-spinner {
    display: none;
    width: 14px; height: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: rs-spin 0.65s linear infinite;
    margin-left: 6px;
    vertical-align: middle;
    flex-shrink: 0;
}
.login-box button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.login-box button.loading .login-spinner { display: inline-block; }
.login-box button.loading { pointer-events: none; opacity: 0.8; }

/* ════════════════════════════════════════
   ADMIN SHELL
   ════════════════════════════════════════ */
.admin-container { display: none; }
.rs-shell {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ── Sidebar ── */
.rs-sidebar {
    width: var(--rs-sidebar-w);
    background: var(--rs-surface);
    border-right: 1px solid var(--rs-border-md);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow-y: auto;
    overflow-x: hidden;
}
.rs-sidebar::-webkit-scrollbar { width: 4px; }
.rs-sidebar::-webkit-scrollbar-track { background: transparent; }
.rs-sidebar::-webkit-scrollbar-thumb { background: var(--rs-border-md); border-radius: 4px; }

.rs-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px;
    height: var(--rs-topbar-h);
    border-bottom: 1px solid var(--rs-border);
    flex-shrink: 0;
}
.rs-logo-icon {
    width: 30px; height: 30px;
    border-radius: 7px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.rs-logo-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--rs-t1);
    letter-spacing: -0.2px;
}
.rs-logo-name em {
    color: var(--rs-blue);
    font-style: normal;
}

.rs-nav-section {
    padding: 16px 0 4px;
}
.rs-nav-label {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--rs-t4);
    padding: 0 16px 6px;
    display: block;
}
.rs-nav-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 14px;
    margin: 1px 8px;
    border-radius: var(--rs-radius);
    color: var(--rs-t3);
    text-decoration: none;
    font-size: 13px;
    cursor: pointer;
    transition: all .12s;
    border: 1px solid transparent;
    user-select: none;
}
.rs-nav-item:hover {
    background: rgba(255,255,255,0.04);
    color: var(--rs-t2);
}
.rs-nav-item.active {
    background: var(--rs-blue-dim);
    color: #93c5fd;
    border-color: rgba(59,130,246,0.2);
}
.rs-nav-item.active svg { opacity: 1; color: #93c5fd; }
.rs-nav-item svg { flex-shrink: 0; opacity: 0.5; }
.rs-nav-item:hover svg { opacity: 0.8; }
.rs-nav-item span { flex: 1; }
.rs-nav-count {
    font-size: 10px;
    background: var(--rs-surface3);
    color: var(--rs-t3);
    padding: 1px 6px;
    border-radius: 8px;
    font-weight: 500;
}
.rs-nav-item.active .rs-nav-count {
    background: rgba(59,130,246,0.2);
    color: #93c5fd;
}

/* Service status panel in sidebar */
.rs-svc-panel {
    margin: 4px 8px 8px;
    background: var(--rs-surface2);
    border: 1px solid var(--rs-border);
    border-radius: var(--rs-radius);
    overflow: hidden;
}
.rs-svc-panel-title {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--rs-t4);
    padding: 8px 12px 6px;
    border-bottom: 1px solid var(--rs-border);
}
.rs-svc-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    font-size: 12px;
    color: var(--rs-t2);
    cursor: pointer;
    transition: background .1s;
}
.rs-svc-row:hover { background: rgba(255,255,255,0.03); }
.rs-svc-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
    transition: background .3s;
}
.rs-svc-dot.on  { background: var(--rs-green); box-shadow: 0 0 5px rgba(34,197,94,0.5); }
.rs-svc-dot.off { background: var(--rs-t4); }
.rs-svc-name { flex: 1; font-family: var(--font-mono); font-size: 11px; }
.rs-svc-state { font-size: 10px; color: var(--rs-t4); }
.rs-svc-state.on  { color: var(--rs-green); }
.rs-svc-state.off { color: var(--rs-t4); }

.rs-sidebar-bottom {
    margin-top: auto;
    padding: 8px;
    border-top: 1px solid var(--rs-border);
    flex-shrink: 0;
}
.rs-sidebar-bottom a, .rs-sidebar-bottom button {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 7px 10px;
    border-radius: var(--rs-radius);
    font-size: 12px;
    color: var(--rs-t3);
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    transition: all .12s;
    font-family: var(--font-sans);
}
.rs-sidebar-bottom a:hover, .rs-sidebar-bottom button:hover {
    background: rgba(255,255,255,0.04);
    color: var(--rs-t2);
}

/* ── Top bar ── */
.rs-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--rs-bg);
}
.rs-topbar {
    height: var(--rs-topbar-h);
    background: var(--rs-surface);
    border-bottom: 1px solid var(--rs-border-md);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 12px;
    flex-shrink: 0;
    z-index: 10;
}
.rs-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--rs-t3);
    flex: 1;
}
.rs-breadcrumb .sep { color: var(--rs-t4); }
.rs-breadcrumb .current { color: var(--rs-t2); font-weight: 500; }
.rs-topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.rs-user-chip {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 4px 10px;
    background: var(--rs-surface2);
    border: 1px solid var(--rs-border-md);
    border-radius: 20px;
    font-size: 12px;
    color: var(--rs-t2);
}
.rs-user-avatar {
    width: 22px; height: 22px;
    border-radius: 50%;
    background: var(--rs-blue-dim);
    display: flex; align-items: center; justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: var(--rs-blue);
}
.rs-status-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--rs-green);
    box-shadow: 0 0 6px rgba(34,197,94,0.5);
    animation: pulse-green 2s infinite;
}
@keyframes pulse-green {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ── Content area ── */
.rs-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}
.rs-content::-webkit-scrollbar { width: 6px; }
.rs-content::-webkit-scrollbar-track { background: transparent; }
.rs-content::-webkit-scrollbar-thumb { background: var(--rs-border-md); border-radius: 4px; }

/* ════════════════════════════════════════
   PAGE HEADER + TOOLBAR
   ════════════════════════════════════════ */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--rs-border);
}
.page-title-wrap {}
.page-title-wrap h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--rs-t1);
    letter-spacing: -0.2px;
}
.page-title-wrap p {
    margin: 3px 0 0;
    font-size: 12px;
    color: var(--rs-t3);
}
.page-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Search/filter toolbar */
.rs-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
}
.rs-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--rs-surface);
    border: 1px solid var(--rs-border-md);
    border-radius: var(--rs-radius);
    padding: 6px 10px;
    flex: 1;
    max-width: 320px;
}
.rs-search input {
    background: none;
    border: none;
    outline: none;
    color: var(--rs-t1);
    font-size: 13px;
    width: 100%;
}
.rs-search svg { color: var(--rs-t3); flex-shrink: 0; }

/* ════════════════════════════════════════
   CARDS
   ════════════════════════════════════════ */
.card {
    background: var(--rs-surface);
    border: 1px solid var(--rs-border-md);
    border-radius: var(--rs-radius-lg);
    padding: 20px;
    margin-bottom: 16px;
}
.card h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--rs-t1);
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--rs-border);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ════════════════════════════════════════
   STAT CARDS (Dashboard)
   ════════════════════════════════════════ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}
.stat-card {
    background: var(--rs-surface);
    border: 1px solid var(--rs-border-md);
    border-radius: var(--rs-radius-lg);
    padding: 18px 20px;
    cursor: pointer;
    transition: border-color .2s, transform .2s, box-shadow .2s;
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
}
.stat-card.blue::before   { background: var(--rs-blue); }
.stat-card.green::before  { background: var(--rs-green); }
.stat-card.amber::before  { background: var(--rs-amber); }
.stat-card.cyan::before   { background: var(--rs-cyan); }
.stat-card.purple::before { background: var(--rs-purple); }
.stat-card:hover {
    border-color: rgba(255,255,255,0.16);
    transform: translateY(-2px);
    box-shadow: var(--rs-shadow);
}
.stat-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.stat-card-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--rs-t3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.stat-icon { opacity: 0.25; }
.stat-value {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -1px;
    color: var(--rs-t1);
    line-height: 1;
}
.stat-value.blue   { color: #60a5fa; }
.stat-value.green  { color: #4ade80; }
.stat-value.amber  { color: #fcd34d; }
.stat-value.cyan   { color: #22d3ee; }
.stat-value.purple { color: #c4b5fd; }
.stat-sub {
    font-size: 11px;
    color: var(--rs-t4);
    margin-top: 6px;
}

/* ════════════════════════════════════════
   SERVICE STATUS TABLE (Dashboard)
   ════════════════════════════════════════ */
.svc-status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
}
.svc-status-card {
    background: var(--rs-surface2);
    border: 1px solid var(--rs-border);
    border-radius: var(--rs-radius);
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: border-color .15s;
}
.svc-status-card:hover { border-color: var(--rs-border-md); }
.svc-status-card.running { border-left: 3px solid var(--rs-green); }
.svc-status-card.stopped { border-left: 3px solid var(--rs-t4); }
.svc-status-icon {
    width: 32px; height: 32px;
    border-radius: var(--rs-radius);
    display: flex; align-items: center; justify-content: center;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}
.svc-status-icon.running { background: var(--rs-green-dim); color: #4ade80; }
.svc-status-icon.stopped { background: rgba(255,255,255,0.04); color: var(--rs-t4); }
.svc-status-info { flex: 1; min-width: 0; }
.svc-status-name { font-size: 12px; font-weight: 600; color: var(--rs-t1); }
.svc-status-desc { font-size: 10px; color: var(--rs-t4); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.svc-status-badge {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 6px;
    border-radius: 4px;
}
.svc-status-badge.running { background: var(--rs-green-dim); color: #4ade80; }
.svc-status-badge.stopped { background: rgba(255,255,255,0.05); color: var(--rs-t4); }

/* ════════════════════════════════════════
   OGC ENDPOINTS PANEL
   ════════════════════════════════════════ */
.ogc-endpoints-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.endpoint-url {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--rs-surface2);
    border: 1px solid var(--rs-border);
    border-radius: var(--rs-radius);
    padding: 8px 12px;
}
.endpoint-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #93c5fd;
    background: var(--rs-blue-dim);
    padding: 3px 8px;
    border-radius: 4px;
    flex-shrink: 0;
    font-family: var(--font-mono);
    min-width: 52px;
    text-align: center;
}
.endpoint-url code {
    flex: 1;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--rs-t2);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ════════════════════════════════════════
   QUICK ACTIONS
   ════════════════════════════════════════ */
.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
}
.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 18px 12px;
    background: var(--rs-surface2);
    border: 1px solid var(--rs-border);
    border-radius: var(--rs-radius-lg);
    color: var(--rs-t3);
    cursor: pointer;
    transition: all .15s;
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    font-family: var(--font-sans);
}
.quick-action-btn:hover {
    border-color: var(--rs-blue);
    color: #93c5fd;
    background: var(--rs-blue-dim);
}
.quick-action-btn svg { opacity: 0.6; }
.quick-action-btn:hover svg { opacity: 1; }

/* ════════════════════════════════════════
   CACHE STATS
   ════════════════════════════════════════ */
.cache-stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}
.cache-stat { text-align: center; }
.cache-stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--rs-t1);
    font-variant-numeric: tabular-nums;
}
.cache-stat-label {
    font-size: 10px;
    color: var(--rs-t4);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 3px;
}

/* ════════════════════════════════════════
   TABLES — ERP style
   ════════════════════════════════════════ */
.rs-table-wrap {
    overflow-x: auto;
    border-radius: var(--rs-radius);
    border: 1px solid var(--rs-border);
}
.admin-content table, .rs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.admin-content table th, .rs-table th {
    background: var(--rs-surface2);
    color: var(--rs-t3);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 9px 14px;
    text-align: left;
    border-bottom: 1px solid var(--rs-border-md);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
}
.admin-content table td, .rs-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--rs-border);
    color: var(--rs-t2);
    vertical-align: middle;
    height: 56px;
    box-sizing: border-box;
}
.admin-content table tr:last-child td, .rs-table tr:last-child td {
    border-bottom: none;
}
.admin-content table tr:hover td, .rs-table tr:hover td {
    background: rgba(255,255,255,0.02);
}
.rs-table-in-card { border-radius: 0; border: none; border-top: 1px solid var(--rs-border); }
.rs-table-in-card th { border-radius: 0; }

/* Tab bar */
.tab-bar {
    display: flex;
    gap: 2px;
    background: var(--rs-surface2);
    border: 1px solid var(--rs-border-md);
    border-radius: var(--rs-radius);
    padding: 3px;
    margin-bottom: 14px;
    width: fit-content;
}
.tab {
    padding: 5px 14px;
    border: none;
    background: none;
    color: var(--rs-t3);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 4px;
    transition: all .12s;
    font-family: var(--font-sans);
    display: flex;
    align-items: center;
    gap: 6px;
}
.tab:hover { color: var(--rs-t2); background: rgba(255,255,255,0.04); }
.tab.active { background: var(--rs-surface); color: var(--rs-t1); box-shadow: 0 1px 4px rgba(0,0,0,0.2); }
.tab-count {
    font-size: 10px;
    background: var(--rs-surface3);
    color: var(--rs-t3);
    padding: 1px 6px;
    border-radius: 8px;
}
.tab.active .tab-count { background: var(--rs-blue-dim); color: #93c5fd; }

/* ════════════════════════════════════════
   BUTTONS
   ════════════════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border: 1px solid transparent;
    border-radius: var(--rs-radius);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all .12s;
    font-family: var(--font-sans);
    text-decoration: none;
    white-space: nowrap;
    letter-spacing: 0.2px;
}
.btn-sm { padding: 4px 10px; font-size: 11px; }
.btn-primary { background: var(--rs-blue); color: #fff; border-color: var(--rs-blue); }
.btn-primary:hover { background: var(--rs-blue-hov); box-shadow: 0 2px 10px rgba(59,130,246,0.3); }
.btn-secondary { background: var(--rs-surface2); color: var(--rs-t2); border-color: var(--rs-border-md); }
.btn-secondary:hover { background: var(--rs-surface3); color: var(--rs-t1); border-color: var(--rs-border-lg); }
.btn-danger { background: var(--rs-red-dim); color: #f87171; border-color: rgba(239,68,68,0.25); }
.btn-danger:hover { background: rgba(239,68,68,0.2); }
.btn-success { background: var(--rs-green-dim); color: #4ade80; border-color: rgba(34,197,94,0.25); }
.btn-success:hover { background: rgba(34,197,94,0.2); }
.btn-ghost { background: none; color: var(--rs-t3); border-color: var(--rs-border-md); }
.btn-ghost:hover { background: var(--rs-surface2); color: var(--rs-t2); }
.btn.loading {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}
.btn-copy {
    font-size: 10px;
    padding: 3px 9px;
    border-radius: 4px;
    background: var(--rs-surface3);
    border: 1px solid var(--rs-border-md);
    color: var(--rs-t3);
    cursor: pointer;
    transition: all .12s;
    font-family: var(--font-sans);
    white-space: nowrap;
    flex-shrink: 0;
}
.btn-copy:hover { color: var(--rs-t1); border-color: var(--rs-border-lg); }
.btn-copy.copied { color: #4ade80; border-color: rgba(34,197,94,0.3); }

/* ════════════════════════════════════════
   FORMS
   ════════════════════════════════════════ */
.form-section {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--rs-border);
}
.form-section:last-of-type { border-bottom: none; }
.form-section-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--rs-t4);
    margin-bottom: 14px;
}
.form-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
    min-width: 180px;
    margin-bottom: 12px;
}
.form-group label {
    font-size: 11px;
    font-weight: 600;
    color: var(--rs-t3);
    letter-spacing: 0.3px;
}
.form-group input,
.form-group select,
.form-group textarea {
    padding: 8px 10px;
    background: var(--rs-surface2);
    border: 1px solid var(--rs-border-md);
    border-radius: var(--rs-radius);
    color: var(--rs-t1);
    font-size: 13px;
    font-family: var(--font-sans);
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--rs-blue);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}
.form-group textarea { resize: vertical; min-height: 70px; }
.form-group select option { background: var(--rs-surface2); }

/* ════════════════════════════════════════
   BADGES + PILLS
   ════════════════════════════════════════ */
.badge-type {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.badge-type-raster   { background: var(--rs-red-dim);    color: #fca5a5; }
.badge-type-vector   { background: var(--rs-green-dim);  color: #86efac; }
.badge-type-ramp     { background: var(--rs-blue-dim);   color: #93c5fd; }
.badge-type-intervals{ background: var(--rs-amber-dim);  color: #fcd34d; }
.badge-type-values   { background: var(--rs-cyan-dim);   color: #67e8f9; }
.badge-type-postgis  { background: var(--rs-cyan-dim);   color: #67e8f9; }
.badge-type-shapefile{ background: var(--rs-green-dim);  color: #86efac; }

.crs-badge {
    font-family: var(--font-mono);
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 4px;
    background: var(--rs-blue-dim);
    color: #93c5fd;
}
.role-badge {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 7px;
    border-radius: 4px;
    letter-spacing: 0.4px;
}
.role-admin  { background: var(--rs-red-dim);    color: #fca5a5; }
.role-editor { background: var(--rs-amber-dim);  color: #fcd34d; }
.role-viewer { background: rgba(255,255,255,.06); color: var(--rs-t3); }

.pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 20px;
}
.pill-connected    { background: var(--rs-green-dim); color: #4ade80; }
.pill-disconnected { background: rgba(255,255,255,.05); color: var(--rs-t4); }
.pill-connected::before {
    content: '';
    width: 5px; height: 5px;
    border-radius: 50%;
    background: var(--rs-green);
    animation: pulse-green 2s infinite;
}

/* ════════════════════════════════════════
   LAYER COMPONENTS
   ════════════════════════════════════════ */
.layer-preview-thumb {
    width: 40px; height: 40px;
    border-radius: var(--rs-radius);
    border: 1px solid var(--rs-border-md);
    background: var(--rs-surface2);
    object-fit: cover;
    cursor: pointer;
    transition: transform .15s;
}
.layer-preview-thumb:hover {
    transform: scale(2);
    z-index: 10;
    position: relative;
    box-shadow: var(--rs-shadow);
}
.layer-bounds {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--rs-t4);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
td.layer-actions-cell {
    vertical-align: middle;
    height: 100%;
    padding: 0 10px !important;
}
.layer-actions {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 56px;
    padding: 6px 0;
    box-sizing: border-box;
}
.layer-style-select {
    padding: 3px 6px;
    background: var(--rs-surface2);
    border: 1px solid var(--rs-border-md);
    border-radius: var(--rs-radius);
    color: var(--rs-t2);
    font-size: 11px;
    outline: none;
    font-family: var(--font-sans);
    max-width: 140px;
}
.layer-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    margin: 2px 2px;
    background: var(--rs-blue-dim);
    color: #93c5fd;
}

/* ════════════════════════════════════════
   COLOR RAMP
   ════════════════════════════════════════ */
.color-ramp-preview {
    height: 14px;
    border-radius: 3px;
    border: 1px solid var(--rs-border);
    min-width: 80px;
}

/* ════════════════════════════════════════
   DROPZONE
   ════════════════════════════════════════ */
.dropzone {
    border: 2px dashed var(--rs-border-md);
    border-radius: var(--rs-radius-lg);
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: all .15s;
    background: var(--rs-surface2);
}
.dropzone:hover, .dropzone.active {
    border-color: var(--rs-blue);
    background: var(--rs-blue-dim);
}
.dropzone-icon { margin-bottom: 10px; }
.dropzone-text { font-size: 13px; color: var(--rs-t2); }
.dropzone-text strong { color: var(--rs-blue); }
.dropzone-hint { font-size: 11px; color: var(--rs-t4); margin-top: 6px; }
.dropzone-progress { margin-top: 14px; display: none; }
.dropzone-progress.active { display: block; }
.dropzone-file-list { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.dropzone-file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 10px;
    background: var(--rs-surface);
    border-radius: var(--rs-radius);
    font-size: 12px;
    color: var(--rs-t2);
}
.file-status { font-size: 11px; }
.file-status.success { color: #4ade80; }
.file-status.error   { color: #f87171; }

/* ════════════════════════════════════════
   PROGRESS BAR
   ════════════════════════════════════════ */
.progress-bar {
    background: var(--rs-surface2);
    border-radius: 4px;
    height: 5px;
    overflow: hidden;
}
.progress-bar-lg { height: 8px; }
.progress-bar-fill {
    background: linear-gradient(90deg, var(--rs-blue), #60a5fa);
    height: 100%;
    border-radius: 4px;
    transition: width .3s;
}

/* ════════════════════════════════════════
   MODALS
   ════════════════════════════════════════ */
.admin-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn .15s ease;
    backdrop-filter: blur(4px);
}
.admin-modal {
    background: var(--rs-surface);
    border: 1px solid var(--rs-border-md);
    border-radius: var(--rs-radius-lg);
    padding: 24px;
    min-width: 420px;
    max-width: 560px;
    width: 90%;
    box-shadow: var(--rs-shadow-lg);
    animation: slideUp .2s ease;
    max-height: 85vh;
    overflow-y: auto;
}
.admin-modal h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--rs-t1);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--rs-border);
}
.modal-footer {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--rs-border);
}
.admin-modal textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--rs-border-md);
    border-radius: var(--rs-radius);
    background: var(--rs-surface2);
    color: var(--rs-t1);
    font-size: 12px;
    font-family: var(--font-mono);
    outline: none;
    resize: vertical;
    min-height: 120px;
}
.admin-modal.modal-lg { max-width: 740px; }
.admin-modal input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--rs-border-md);
    border-radius: var(--rs-radius);
    background: var(--rs-surface2);
    color: var(--rs-t1);
    font-size: 13px;
    font-family: var(--font-sans);
    outline: none;
    transition: border-color .15s;
}
.admin-modal input:focus { border-color: var(--rs-blue); }
.admin-modal select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--rs-border-md);
    border-radius: var(--rs-radius);
    background: var(--rs-surface2);
    color: var(--rs-t1);
    font-size: 13px;
    outline: none;
}

/* Confirm dialog */
.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 6000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}
.confirm-box {
    background: var(--rs-surface);
    border: 1px solid var(--rs-border-md);
    border-radius: var(--rs-radius-lg);
    padding: 24px;
    max-width: 400px;
    width: 90%;
    box-shadow: var(--rs-shadow-lg);
}
.confirm-box h3 { font-size: 15px; margin-bottom: 10px; color: var(--rs-t1); }
.confirm-box p  { font-size: 13px; color: var(--rs-t3); margin-bottom: 20px; line-height: 1.5; }
.confirm-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ════════════════════════════════════════
   LAYER DETAIL MODAL
   ════════════════════════════════════════ */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 8px;
    margin-bottom: 16px;
}
.info-item {
    background: var(--rs-surface2);
    border-radius: var(--rs-radius);
    padding: 10px 12px;
    border: 1px solid var(--rs-border);
}
.info-label {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--rs-t4);
    margin-bottom: 4px;
}
.info-value {
    font-size: 13px;
    color: var(--rs-t1);
    font-weight: 500;
}
.info-value.mono { font-family: var(--font-mono); font-size: 11px; }
.layer-preview-img {
    width: 100%;
    max-height: 220px;
    object-fit: contain;
    border-radius: var(--rs-radius);
    border: 1px solid var(--rs-border-md);
    background: var(--rs-surface2);
    margin-bottom: 14px;
}

/* System info grid */
.system-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 10px;
}

/* Card section title */
.card-section-title {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--rs-t4);
    margin-bottom: 8px;
    margin-top: 14px;
    font-weight: 700;
}
.card-section-title:first-child { margin-top: 0; }

/* ════════════════════════════════════════
   ATTRIBUTE TABLE
   ════════════════════════════════════════ */
.attr-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 10px; }
.attr-table th {
    text-align: left;
    padding: 6px 10px;
    background: var(--rs-surface2);
    color: var(--rs-t4);
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--rs-border-md);
}
.attr-table td {
    padding: 5px 10px;
    border-bottom: 1px solid var(--rs-border);
    color: var(--rs-t2);
    font-family: var(--font-mono);
    font-size: 11px;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ════════════════════════════════════════
   MULTI-SELECT (Layer Groups)
   ════════════════════════════════════════ */
.multi-select-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--rs-border-md);
    border-radius: var(--rs-radius);
    background: var(--rs-surface2);
}
.multi-select-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 12px;
    color: var(--rs-t2);
    transition: background .1s;
}
.multi-select-item:hover { background: rgba(255,255,255,0.04); }
.multi-select-item input[type="checkbox"] { accent-color: var(--rs-blue); }
.multi-select-item .layer-type-tag { margin-left: auto; }

/* ════════════════════════════════════════
   DATA SOURCE
   ════════════════════════════════════════ */
.ds-details { display: none; padding: 10px 14px; background: var(--rs-surface2); border-radius: var(--rs-radius); margin-top: 6px; border: 1px solid var(--rs-border); }
.ds-details.open { display: block; }
.ds-details-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.ds-detail-item { font-size: 12px; }
.ds-detail-label { color: var(--rs-t4); font-size: 9px; text-transform: uppercase; letter-spacing: 0.4px; }
.ds-detail-value { color: var(--rs-t2); font-family: var(--font-mono); font-size: 11px; margin-top: 2px; }

/* ════════════════════════════════════════
   EXPORT DROPDOWN
   ════════════════════════════════════════ */
.export-dropdown { position: relative; display: inline-block; }
.export-menu {
    display: none;
    position: fixed;
    z-index: 9999;
    background: var(--rs-surface);
    border: 1px solid var(--rs-border-md);
    border-radius: var(--rs-radius);
    box-shadow: var(--rs-shadow);
    min-width: 155px;
    padding: 4px 0;
}
.export-menu.open { display: block; }
.export-menu a {
    display: block;
    padding: 8px 14px;
    color: var(--rs-t2);
    text-decoration: none;
    font-size: 12px;
    transition: background .1s;
}
.export-menu a:hover { background: var(--rs-surface2); color: var(--rs-t1); }

/* ════════════════════════════════════════
   SERVICE TOGGLE PANEL (Settings)
   ════════════════════════════════════════ */
.svc-grid { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.svc-card {
    border: 1px solid var(--rs-border-md);
    border-radius: var(--rs-radius);
    overflow: hidden;
    transition: border-color .2s;
}
.svc-card.svc-on  { border-left: 3px solid var(--rs-blue); }
.svc-card.svc-off { border-left: 3px solid var(--rs-t4); opacity: .8; }
.svc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: var(--rs-surface2);
    cursor: default;
}
.svc-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.6px;
    padding: 2px 8px;
    border-radius: 4px;
    background: var(--rs-blue);
    color: #fff;
    margin-right: 10px;
    font-family: var(--font-mono);
}
.svc-card.svc-off .svc-badge { background: var(--rs-surface3); color: var(--rs-t3); }
.svc-desc { font-size: 12px; color: var(--rs-t3); }
.svc-settings { padding: 12px 14px; border-top: 1px solid var(--rs-border); background: var(--rs-surface); }
.svc-toggle { position: relative; display: inline-block; width: 38px; height: 20px; flex-shrink: 0; }
.svc-toggle input { opacity: 0; width: 0; height: 0; }
.svc-slider {
    position: absolute;
    inset: 0;
    background: var(--rs-surface3);
    border-radius: 20px;
    transition: .2s;
    cursor: pointer;
    border: 1px solid var(--rs-border-md);
}
.svc-slider:before {
    content: '';
    position: absolute;
    height: 14px; width: 14px;
    left: 2px; bottom: 2px;
    background: var(--rs-t3);
    border-radius: 50%;
    transition: .2s;
}
.svc-toggle input:checked + .svc-slider { background: var(--rs-blue-dim); border-color: var(--rs-blue); }
.svc-toggle input:checked + .svc-slider:before { transform: translateX(18px); background: var(--rs-blue); }

/* CRS Tags */
.crs-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--rs-surface3);
    color: var(--rs-t1);
    border: 1px solid var(--rs-border-lg);
    border-radius: 14px;
    font-size: 11px;
    font-weight: 600;
    font-family: var(--font-mono);
    line-height: 1.4;
    transition: border-color .12s;
}
.crs-tag:hover { border-color: var(--rs-border-md); }
.crs-tag button {
    background: none;
    border: none;
    color: var(--rs-t4);
    cursor: pointer;
    font-size: 13px;
    padding: 0 1px;
    line-height: 1;
    transition: color .12s;
}
.crs-tag button:hover { color: var(--rs-red); }

/* Settings section toggle rows */
.settings-toggle-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--rs-surface2);
    border: 1px solid var(--rs-border);
    border-radius: var(--rs-radius);
    margin-bottom: 12px;
}
.settings-toggle-row .svc-toggle { flex-shrink: 0; }
.settings-toggle-row-info { flex: 1; min-width: 0; }
.settings-toggle-row-label { font-size: 13px; font-weight: 600; color: var(--rs-t2); }
.settings-toggle-row-desc { font-size: 11px; color: var(--rs-t4); margin-top: 2px; }

/* CRS add input row */
.crs-add-row {
    display: flex;
    gap: 6px;
    align-items: center;
}
.crs-add-row input {
    flex: 1;
    max-width: 200px;
    padding: 6px 10px;
    background: var(--rs-surface2);
    border: 1px solid var(--rs-border-md);
    border-radius: var(--rs-radius);
    color: var(--rs-t1);
    font-size: 12px;
    font-family: var(--font-mono);
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.crs-add-row input:focus {
    border-color: var(--rs-blue);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}
.crs-add-row input::placeholder { color: var(--rs-t4); }

/* ════════════════════════════════════════
   TOAST
   ════════════════════════════════════════ */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
    pointer-events: none;
}
.toast-item {
    padding: 10px 16px;
    border-radius: var(--rs-radius);
    font-size: 13px;
    font-weight: 500;
    pointer-events: auto;
    animation: slideInRight .2s ease;
    box-shadow: var(--rs-shadow);
    border: 1px solid transparent;
    max-width: 320px;
}
.toast-item.ok      { background: var(--rs-surface); border-color: rgba(34,197,94,0.3); color: #4ade80; }
.toast-item.error   { background: var(--rs-surface); border-color: rgba(239,68,68,0.3); color: #f87171; }
.toast-item.warn    { background: var(--rs-surface); border-color: rgba(245,158,11,0.3); color: #fcd34d; }
.toast-item.removing { opacity: 0; transform: translateX(10px); transition: all .2s; }

/* ════════════════════════════════════════
   EMPTY STATE
   ════════════════════════════════════════ */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
}
.empty-state-icon { margin-bottom: 14px; opacity: 0.25; }
.empty-state h3 { font-size: 15px; color: var(--rs-t2); margin-bottom: 6px; }
.empty-state p  { font-size: 13px; color: var(--rs-t4); line-height: 1.5; max-width: 320px; }

/* ════════════════════════════════════════
   ANIMATIONS
   ════════════════════════════════════════ */
@keyframes fadeIn    { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp   { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* ════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════ */
@media (max-width: 900px) {
    .login-brand-panel { display: none; }
    .login-form-panel { background: var(--rs-bg); }
}
/* (768px responsive rules moved to MOBILE / RESPONSIVE ENHANCEMENTS section below) */

/* Badge postgis/shapefile */
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 4px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; }
.badge-postgis   { background: var(--rs-cyan-dim);  color: #67e8f9; }
.badge-shapefile { background: var(--rs-green-dim); color: #86efac; }

/* ════════════════════════════════════════
   SEARCHABLE INPUT (Layer selects & multi-selects)
   ════════════════════════════════════════ */
.searchable-input {
    position: sticky;
    top: 0;
    z-index: 2;
    width: 100%;
    padding: 7px 10px;
    background: var(--rs-surface);
    border: none;
    border-bottom: 1px solid var(--rs-border-md);
    color: var(--rs-t1);
    font-size: 12px;
    font-family: var(--font-sans);
    outline: none;
    box-sizing: border-box;
}
.searchable-input::placeholder { color: var(--rs-t4); }
.searchable-input:focus {
    background: var(--rs-surface2);
    border-bottom-color: var(--rs-blue);
}

/* ════════════════════════════════════════
   MOBILE / RESPONSIVE ENHANCEMENTS
   ════════════════════════════════════════ */

/* Hamburger menu button */
.rs-hamburger {
    display: none;
    background: none;
    border: none;
    color: var(--rs-t2);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--rs-radius);
    transition: background .12s;
    flex-shrink: 0;
}
.rs-hamburger:hover { background: rgba(255,255,255,0.06); }
.rs-hamburger svg { display: block; }

/* Sidebar overlay for mobile */
.rs-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
    backdrop-filter: blur(2px);
}
.rs-sidebar-overlay.open { display: block; }

@media (max-width: 768px) {
    .rs-hamburger { display: flex; }

    .rs-sidebar {
        display: flex !important;
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 260px;
        z-index: 100;
        transform: translateX(-100%);
        transition: transform .25s ease;
        box-shadow: none;
    }
    .rs-sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0,0,0,0.5);
    }

    :root { --rs-sidebar-w: 0px; }

    .rs-topbar { padding: 0 12px; }
    .rs-content { padding: 12px; }

    .page-header { flex-direction: column; align-items: flex-start; gap: 10px; }
    .page-actions { width: 100%; }
    .page-actions .btn { flex: 1; justify-content: center; }

    .stats-grid { grid-template-columns: 1fr 1fr; }
    .system-info-grid { grid-template-columns: 1fr 1fr; }
    .cache-stats-row { grid-template-columns: 1fr 1fr; }
    .svc-status-grid { grid-template-columns: 1fr; }
    .quick-actions-grid { grid-template-columns: 1fr 1fr; }
    .detail-grid { grid-template-columns: 1fr 1fr; }

    .admin-modal { min-width: auto; max-width: 95%; width: 95%; }

    .form-row { flex-direction: column; }
    .form-group { min-width: 0; }

    .data-table { font-size: 11px; }
    .data-table th, .data-table td { padding: 6px 8px; }

    .rs-table-wrap { margin: 0 -12px; border-radius: 0; border-left: none; border-right: none; }

    .lang-switcher { display: none; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .system-info-grid { grid-template-columns: 1fr; }
    .quick-actions-grid { grid-template-columns: 1fr; }

    .login-form-panel { padding: 20px; }
    .login-box { max-width: 100%; }

    .stat-value { font-size: 24px; }

    .rs-user-chip span:not(:first-child) { display: none; }
}

/* ════════════════════════════════════════
   LAYER TREE (Hierarchical Groups)
   ════════════════════════════════════════ */
.layer-tree-indent {
    display: inline-block;
    width: 20px;
    height: 1px;
    margin-right: 4px;
}
.layer-tree-toggle {
    background: none;
    border: none;
    color: var(--rs-t3);
    cursor: pointer;
    padding: 2px 4px;
    font-size: 12px;
    border-radius: 3px;
    transition: background .1s;
    flex-shrink: 0;
}
.layer-tree-toggle:hover { background: rgba(255,255,255,0.06); }

/* ════════════════════════════════════════
   EXTERNAL WMS SECTION
   ════════════════════════════════════════ */
.external-wms-card {
    background: var(--rs-surface2);
    border: 1px solid var(--rs-border);
    border-radius: var(--rs-radius);
    padding: 12px 14px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.external-wms-card .wms-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--rs-t1);
    flex: 0 0 120px;
}
.external-wms-card .wms-url {
    flex: 1;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--rs-t3);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ════════════════════════════════════════
   ANALYSIS PANEL (index.html)
   ════════════════════════════════════════ */
.analysis-panel {
    position: absolute;
    top: 60px;
    right: 10px;
    background: var(--bg-secondary, #1a2236);
    border: 1px solid var(--border-strong, rgba(255,255,255,0.1));
    border-radius: 8px;
    padding: 12px;
    z-index: 500;
    width: 280px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
.analysis-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-tertiary, #212f46);
    border: 1px solid var(--border, rgba(255,255,255,0.06));
    border-radius: 6px;
    color: var(--text-secondary, #94a3b8);
    font-size: 12px;
    cursor: pointer;
    transition: all .12s;
    margin-bottom: 4px;
    font-family: var(--font-sans);
}
.analysis-btn:hover {
    background: rgba(59,130,246,0.12);
    color: #93c5fd;
    border-color: rgba(59,130,246,0.3);
}

/* ════════════════════════════════════════
   ELEVATION PROFILE CHART
   ════════════════════════════════════════ */
.profile-chart-container {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    max-width: 90vw;
    background: var(--bg-secondary, #1a2236);
    border: 1px solid var(--border-strong, rgba(255,255,255,0.1));
    border-radius: 10px 10px 0 0;
    padding: 12px;
    z-index: 600;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.4);
}
.profile-chart-container canvas {
    width: 100%;
    height: 150px;
}
.profile-chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.profile-chart-header h4 {
    font-size: 12px;
    color: var(--text-primary, #f1f5f9);
    margin: 0;
}
.profile-close-btn {
    background: none;
    border: none;
    color: var(--text-muted, #64748b);
    cursor: pointer;
    font-size: 16px;
    padding: 2px 6px;
}

/* ════════════════════════════════════════
   PRINT DIALOG
   ════════════════════════════════════════ */
.print-dialog {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-secondary, #1a2236);
    border: 1px solid var(--border-strong, rgba(255,255,255,0.1));
    border-radius: 10px;
    padding: 20px;
    z-index: 700;
    width: 360px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}
.print-dialog h3 {
    font-size: 14px;
    color: var(--text-primary, #f1f5f9);
    margin: 0 0 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border, rgba(255,255,255,0.06));
}

/* ════════════════════════════════════════
   ROUTING PANEL
   ════════════════════════════════════════ */
.routing-panel {
    position: absolute;
    top: 60px;
    left: 10px;
    background: var(--bg-secondary, #1a2236);
    border: 1px solid var(--border-strong, rgba(255,255,255,0.1));
    border-radius: 8px;
    padding: 14px;
    z-index: 500;
    width: 300px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
.routing-panel input {
    width: 100%;
    padding: 8px 10px;
    background: var(--bg-tertiary, #212f46);
    border: 1px solid var(--border, rgba(255,255,255,0.06));
    border-radius: 6px;
    color: var(--text-primary, #f1f5f9);
    font-size: 12px;
    outline: none;
    margin-bottom: 8px;
    box-sizing: border-box;
}
.routing-panel input:focus {
    border-color: rgba(59,130,246,0.5);
}
.routing-result {
    margin-top: 10px;
    padding: 8px 10px;
    background: var(--bg-tertiary, #212f46);
    border-radius: 6px;
    font-size: 12px;
    color: var(--text-secondary, #94a3b8);
}

/* ════════════════════════════════════════
   WORKSPACE SELECTOR
   ════════════════════════════════════════ */
.workspace-selector {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    background: var(--rs-surface2);
    border: 1px solid var(--rs-border-md);
    border-radius: 20px;
    font-size: 11px;
    color: var(--rs-t2);
    cursor: pointer;
    transition: border-color .12s;
}
.workspace-selector:hover { border-color: var(--rs-blue); }
.workspace-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--rs-blue);
}

/* ── File Manager ── */
.fm-breadcrumb {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 8px 12px;
    margin-bottom: 8px;
    background: var(--rs-surface2);
    border-radius: var(--rs-radius);
    font-size: 13px;
    color: var(--rs-t2);
    overflow-x: auto;
}
.fm-bc-link { cursor: pointer; color: var(--rs-blue); }
.fm-bc-link:hover { text-decoration: underline; }
.fm-bc-sep { color: var(--rs-t4); margin: 0 2px; }
.fm-table { width: 100%; border-collapse: collapse; }
.fm-table th {
    text-align: left;
    padding: 8px 10px;
    font-size: 11px;
    font-weight: 600;
    color: var(--rs-t3);
    text-transform: uppercase;
    letter-spacing: .04em;
    border-bottom: 1px solid var(--rs-border-md);
}
.fm-table td { padding: 7px 10px; font-size: 13px; color: var(--rs-t1); border-bottom: 1px solid var(--rs-border); }
.fm-row:hover { background: var(--rs-surface2); }
.fm-parent td { color: var(--rs-t3); }
.fm-actions { display: flex; gap: 4px; align-items: center; }
.fm-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .03em;
}

/* Focus visible */
:focus-visible { outline: 2px solid var(--rs-blue); outline-offset: 2px; }
