/* ═══════════════════════════════════════════════════════════════════
   Orchestrator.Pro — Design System v6
   Near-black + Electric Blue — Infrastructure Dashboard
   ═══════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --bg-0: #0A0A0F;
    --bg-1: #0F0F15;
    --bg-2: #16161E;
    --bg-3: #1E1E28;
    --border: #252530;
    --border-light: #2E2E3A;
    --text: #E4E4ED;
    --text-2: #9494A8;
    --text-3: #5E5E72;
    --blue: #3B82F6;
    --blue-hover: #2563EB;
    --blue-soft: rgba(59, 130, 246, 0.1);
    --blue-glow: rgba(59, 130, 246, 0.15);
    --green: #10B981;
    --green-soft: rgba(16, 185, 129, 0.1);
    --amber: #F59E0B;
    --amber-soft: rgba(245, 158, 11, 0.1);
    --red: #EF4444;
    --red-soft: rgba(239, 68, 68, 0.08);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    --radius: 8px;
    --radius-lg: 12px;
    --speed: 150ms ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
button, a, [role="button"], select { cursor: pointer; }
::selection { background: var(--blue-soft); color: var(--blue); }

body {
    background: var(--bg-0);
    color: var(--text);
    font-family: var(--font);
    font-size: 13px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

.background-elements { display: none; }

/* ─── Layout ─────────────────────────────────────────────────── */
.app-body { display: flex; height: 100vh; overflow: hidden; }

/* ─── Sidebar ────────────────────────────────────────────────── */
.sidebar {
    width: 230px; background: var(--bg-0);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    padding: 20px 12px; flex-shrink: 0; overflow-y: auto;
}
.sidebar-header { display: flex; align-items: center; gap: 10px; padding: 0 6px; margin-bottom: 24px; }
.logo-icon {
    width: 30px; height: 30px;
    background: linear-gradient(135deg, #3B82F6 0%, #06B6D4 100%);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 0 16px rgba(59, 130, 246, 0.25);
}
.brand-name { font-size: 14px; font-weight: 700; color: var(--text); letter-spacing: -0.3px; }
.text-accent { background: linear-gradient(135deg, #3B82F6, #06B6D4); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.brand-subtitle { font-size: 10px; color: var(--text-3); margin-top: 1px; letter-spacing: 0.5px; text-transform: uppercase; font-weight: 600; }

.sidebar-section-label {
    font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.8px;
    color: var(--text-3); padding: 16px 6px 6px;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }

.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px; color: var(--text-2);
    text-decoration: none; font-size: 13px; font-weight: 500;
    border-radius: 7px; transition: all var(--speed);
    position: relative; border: none; background: none;
    width: 100%; text-align: left;
}
.nav-item:hover { background: var(--bg-2); color: var(--text); }
.nav-item.active {
    background: var(--blue-soft); color: var(--blue);
    box-shadow: inset 0 0 0 1px rgba(59,130,246,0.15);
}
.nav-icon { width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; opacity: 0.5; background: none; }
.nav-item.active .nav-icon, .nav-item:hover .nav-icon { opacity: 1; }
.nav-label { font-size: 13px; font-weight: 500; display: block; }
.nav-desc { font-size: 10px; color: var(--text-3); display: block; }

.sidebar-status { margin-top: auto; padding-top: 12px; }
.status-card { background: var(--bg-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; display: flex; flex-direction: column; gap: 7px; }
.status-row { display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--text-2); }
.status-row .status-value { margin-left: auto; font-weight: 600; font-size: 10px; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.status-dot.online { background: var(--green); box-shadow: 0 0 6px rgba(16,185,129,0.5); }
.status-dot.offline { background: var(--red); }
.status-dot.warning { background: var(--amber); }
.sidebar-footer { padding: 8px 0 0; }
.theme-toggle-btn { width: 100%; background: none !important; border: none !important; }

/* ─── Main ───────────────────────────────────────────────────── */
.main-wrapper { flex: 1; display: flex; flex-direction: column; overflow-y: auto; background: var(--bg-1); }

.topbar {
    height: 50px; border-bottom: 1px solid var(--border);
    background: rgba(15,15,21,0.85); backdrop-filter: blur(12px);
    display: flex; justify-content: space-between; align-items: center;
    padding: 0 24px; position: sticky; top: 0; z-index: 5; flex-shrink: 0;
}
.breadcrumb { font-size: 12px; color: var(--text-3); }
.breadcrumb span { color: var(--text-2); font-weight: 500; }
.user-menu { display: flex; align-items: center; gap: 10px; }
.user-role { font-size: 10px; font-weight: 600; color: var(--green); background: var(--green-soft); padding: 3px 9px; border-radius: 100px; }
.logout-btn { background: none; border: none; color: var(--text-3); display: flex; align-items: center; gap: 5px; font-size: 12px; font-family: inherit; padding: 5px 8px; border-radius: 6px; transition: all var(--speed); }
.logout-btn:hover { color: var(--red); background: var(--red-soft); }

.content-area { padding: 28px; max-width: 1240px; margin: 0 auto; width: 100%; }
.page-header { margin-bottom: 24px; }
.page-header h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.5px; color: var(--text); margin-bottom: 4px; background: none; -webkit-text-fill-color: unset; }
.page-header p { color: var(--text-3); font-size: 13px; }

/* ─── Stats ──────────────────────────────────────────────────── */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px; }
.stat-card {
    background: var(--bg-2); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px 18px;
    display: flex; align-items: center; gap: 14px;
    transition: all var(--speed);
}
.stat-card:hover { border-color: var(--border-light); background: var(--bg-3); }
.stat-icon { width: 38px; height: 38px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-content { display: flex; flex-direction: column; }
.stat-value { font-size: 22px; font-weight: 700; letter-spacing: -0.5px; line-height: 1.2; }
.stat-label { font-size: 11px; color: var(--text-3); font-weight: 500; margin-top: 2px; }

/* ─── Panels ─────────────────────────────────────────────────── */
.provision-layout { display: grid; grid-template-columns: 3fr 2fr; gap: 16px; align-items: start; }
.panel {
    background: var(--bg-2); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 22px;
    transition: border-color var(--speed);
}
.panel:hover { border-color: var(--border-light); }
.panel-header { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.panel-icon { width: 34px; height: 34px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.panel-title { font-size: 14px; font-weight: 600; margin: 0; border: none; padding: 0; color: var(--text); }
.panel-subtitle { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.panel-divider { height: 1px; background: var(--border); margin: 18px 0; }

/* ─── Forms ──────────────────────────────────────────────────── */
.input-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.full-width { grid-column: 1 / -1; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 12px; font-weight: 500; color: var(--text-2); display: flex; justify-content: space-between; align-items: center; }
.input-group { display: flex; flex-direction: column; gap: 5px; }
.input-group label { font-size: 12px; font-weight: 500; color: var(--text-2); }

textarea, input {
    background: var(--bg-0); border: 1px solid var(--border);
    border-radius: var(--radius); color: var(--text);
    padding: 9px 11px; font-family: var(--font); font-size: 13px;
    transition: all var(--speed); width: 100%;
}
textarea { height: 150px; resize: vertical; }
textarea::placeholder, input::placeholder { color: var(--text-3); }
textarea:focus, input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-glow); }
.helper-text { font-size: 11px; color: var(--text-3); }

.input-with-suffix { display: flex; background: var(--bg-0); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; transition: all var(--speed); }
.input-with-suffix:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-glow); }
.input-with-suffix input { border: none; border-radius: 0; }
.input-with-suffix input:focus { box-shadow: none; }
.suffix { padding: 0 10px; background: var(--bg-2); border-left: 1px solid var(--border); color: var(--text-3); display: flex; align-items: center; font-size: 11px; white-space: nowrap; }

.badge { background: var(--blue-soft); color: var(--blue); padding: 1px 7px; border-radius: 100px; font-size: 10px; font-weight: 600; }
.badge.matched { background: var(--green-soft); color: var(--green); }
.badge.error { background: var(--red-soft); color: var(--red); }

/* ─── Mapping ────────────────────────────────────────────────── */
.mapping-preview { background: var(--bg-0); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; min-height: 80px; }
.mapping-list { display: flex; flex-direction: column; gap: 4px; max-height: 200px; overflow-y: auto; }
.mapping-list::-webkit-scrollbar { width: 3px; }
.mapping-list::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 2px; }
.empty-state { text-align: center; color: var(--text-3); font-size: 12px; padding: 16px 0; }
.mapping-item { display: flex; align-items: center; justify-content: space-between; background: var(--bg-2); padding: 7px 10px; border-radius: 6px; border-left: 2px solid var(--blue); font-size: 12px; }
.mapping-item .domain { font-weight: 600; color: var(--text); }
.mapping-item .ip { color: var(--blue); font-family: 'SF Mono', monospace; font-size: 11px; }
.mapping-item .arrow { opacity: 0.3; }

/* ─── Pipeline ───────────────────────────────────────────────── */
.pipeline-label { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-3); margin-bottom: 8px; }
.pipeline-steps { display: flex; flex-direction: column; gap: 2px; }
.pipeline-step { display: flex; align-items: center; gap: 9px; padding: 5px 7px; border-radius: 6px; transition: background var(--speed); }
.pipeline-step:hover { background: var(--bg-3); }
.step-number { width: 22px; height: 22px; border-radius: 50%; background: var(--blue-soft); color: var(--blue); display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; flex-shrink: 0; }
.step-info { display: flex; flex-direction: column; }
.step-name { font-size: 12px; font-weight: 500; color: var(--text); }
.step-detail { font-size: 10px; color: var(--text-3); }

.deployment-summary { display: flex; flex-direction: column; gap: 7px; margin-bottom: 18px; font-size: 12px; }
.summary-item { display: flex; justify-content: space-between; padding-bottom: 7px; border-bottom: 1px solid var(--border); }
.summary-item:last-child { border-bottom: none; }
.summary-item span:first-child { color: var(--text-3); }
.summary-item span:last-child { font-weight: 600; color: var(--text); }

/* ─── Buttons ────────────────────────────────────────────────── */
.deploy-btn {
    width: 100%; position: relative;
    background: linear-gradient(135deg, #3B82F6, #2563EB);
    color: #fff; border: none; border-radius: var(--radius);
    padding: 10px 16px; font-size: 13px; font-weight: 600;
    font-family: var(--font); transition: all var(--speed); overflow: hidden;
    box-shadow: 0 2px 8px rgba(59,130,246,0.25);
}
.deploy-btn:hover:not(:disabled) { background: linear-gradient(135deg, #2563EB, #1D4ED8); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(59,130,246,0.35); }
.deploy-btn:active:not(:disabled) { transform: translateY(0); }
.deploy-btn:disabled { background: var(--bg-3); color: var(--text-3); cursor: not-allowed; box-shadow: none; }
.btn-content { display: flex; align-items: center; justify-content: center; gap: 7px; }
.btn-icon svg { transition: transform var(--speed); }
.deploy-btn:hover:not(:disabled) .btn-icon svg { transform: translateX(2px); }
.deploy-btn.loading .btn-content { opacity: 0; }
.btn-loader { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.2); border-top-color: #fff; border-radius: 50%; animation: spin 0.6s infinite linear; opacity: 0; }
.deploy-btn.loading .btn-loader { opacity: 1; }

.btn-secondary, .secondary-btn { background: var(--bg-2); border: 1px solid var(--border); color: var(--text); border-radius: var(--radius); padding: 7px 12px; font-size: 12px; font-weight: 500; font-family: var(--font); transition: all var(--speed); }
.btn-secondary:hover, .secondary-btn:hover { background: var(--bg-3); border-color: var(--border-light); }

.action-btn { background: none; border: 1px solid var(--border); color: var(--text-2); padding: 5px 10px; border-radius: 6px; font-size: 11px; font-family: var(--font); transition: all var(--speed); }
.action-btn:hover { background: var(--blue-soft); color: var(--blue); border-color: rgba(59,130,246,0.3); }

/* ─── Tables ─────────────────────────────────────────────────── */
.server-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.server-table th { text-align: left; padding: 9px 18px; color: var(--text-3); font-weight: 600; font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid var(--border); background: var(--bg-1); }
.server-table td { padding: 11px 18px; border-bottom: 1px solid var(--border); color: var(--text); }
.server-table tr:last-child td { border-bottom: none; }
.server-table tbody tr { transition: background var(--speed); }
.server-table tbody tr:hover { background: var(--bg-3); }
.server-table .status-badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 100px; font-size: 11px; font-weight: 600; }
.server-table .status-badge.active { background: var(--green-soft); color: var(--green); }
.server-table .status-badge.deploying { background: var(--blue-soft); color: var(--blue); }
.server-table .status-badge.deploying::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--blue); animation: pulse 1.5s infinite; }
.server-table .status-badge.failed { background: var(--red-soft); color: var(--red); }

/* ─── Settings ───────────────────────────────────────────────── */
.settings-list { display: flex; flex-direction: column; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 0 24px; }
.settings-row { display: grid; grid-template-columns: 1fr 2fr; gap: 32px; padding: 24px 0; border-bottom: 1px solid var(--border); }
.settings-row:last-child { border-bottom: none; }
.settings-meta { display: flex; flex-direction: column; }
.meta-header { display: flex; align-items: center; gap: 9px; margin-bottom: 6px; }
.meta-header h3 { font-size: 14px; font-weight: 600; color: var(--text); }
.settings-meta p { color: var(--text-3); font-size: 12px; line-height: 1.5; }
.settings-icon { width: 30px; height: 30px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.settings-form { display: flex; flex-direction: column; gap: 10px; }
.global-setting-input { width: 100%; background: var(--bg-0); border: 1px solid var(--border); border-radius: var(--radius); padding: 9px 11px; color: var(--text-3); font-family: var(--font); font-size: 13px; transition: all var(--speed); }
.global-setting-input:not([disabled]) { background: var(--bg-0); border-color: var(--border-light); color: var(--text); }
.global-setting-input:not([disabled]):focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-glow); outline: none; }
textarea.global-setting-input { resize: vertical; min-height: 44px; line-height: 1.35; }
.secure-field[disabled] { letter-spacing: 2px; font-family: monospace; }

/* ─── Toasts ─────────────────────────────────────────────────── */
.toast-container { position: fixed; bottom: 16px; right: 16px; z-index: 9999; display: flex; flex-direction: column; gap: 6px; }
.toast { background: var(--bg-2); border: 1px solid var(--border); color: var(--text); padding: 10px 14px; border-radius: var(--radius); box-shadow: 0 8px 30px rgba(0,0,0,0.5); font-size: 12px; border-left: 3px solid var(--blue); transform: translateX(120%); opacity: 0; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
.toast.error { border-left-color: var(--red); }
.toast.success { border-left-color: var(--green); }
.toast.warning { border-left-color: var(--amber); }
.toast.info { border-left-color: var(--cyan, #22d3ee); }
.toast.show { transform: translateX(0); opacity: 1; }

/* Settings save feedback (next to Save / Edit) */
.settings-save-status { font-size: 12px; max-width: min(320px, 42vw); text-align: right; line-height: 1.35; color: var(--text-2); min-height: 1.2em; }
.settings-save-status.saving { color: var(--amber); }
.settings-save-status.ok { color: var(--green); }
.settings-save-status.err { color: var(--red); }

/* ─── Console / Modal ────────────────────────────────────────── */
.console-window { background: var(--bg-2); width: 560px; max-width: 92%; border-radius: var(--radius-lg); border: 1px solid var(--border); box-shadow: 0 24px 48px rgba(0,0,0,0.7); display: flex; flex-direction: column; overflow: hidden; }
.console-header { background: var(--bg-0); padding: 9px 14px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); }
.console-dots span { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; background: #FF5F57; }
.console-dots span:nth-child(2) { background: #FEBC2E; }
.console-dots span:nth-child(3) { background: #28C840; }
.console-title { font-size: 11px; color: var(--text-2); text-align: center; flex: 1; }
.console-close { background: none; border: none; color: var(--text-3); cursor: pointer; font-size: 16px; padding: 2px 6px; border-radius: 4px; }
.console-close:hover { color: var(--text); background: var(--bg-3); }
.console-body { padding: 14px; font-family: 'SF Mono', 'Fira Code', monospace; font-size: 11px; color: var(--text-2); height: 280px; overflow-y: auto; background: var(--bg-0); }
.console-line { margin: 1px 0; opacity: 0; animation: fadeLine 0.1s forwards; }
.console-line .ts { color: var(--text-3); margin-right: 8px; }
.console-line .ok { color: var(--green); }
.console-line .warn { color: var(--amber); }
.console-line .err { color: var(--red); }

.modal-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0,0,0,0.8); backdrop-filter: blur(6px); display: flex; justify-content: center; align-items: center; z-index: 100; opacity: 0; pointer-events: none; transition: opacity 0.2s; }
.modal-overlay.active { opacity: 1; pointer-events: all; }
.modal-content { max-width: 360px; text-align: center; }
.success-icon { color: var(--green); margin-bottom: 10px; }
.modal-content h2 { font-size: 17px; font-weight: 700; margin-bottom: 4px; }
.modal-content p { color: var(--text-3); font-size: 12px; margin-bottom: 16px; }

/* ─── Login ──────────────────────────────────────────────────── */
.split-login-body { display: flex; height: 100vh; width: 100vw; overflow: hidden; background: var(--bg-0); }
.login-left-pane { flex: 1; background-image: url('assets/bg.png'); background-size: cover; background-position: center; position: relative; display: none; }
@media (min-width: 900px) { .login-left-pane { display: block; } }
.login-left-pane::after { content: ''; position: absolute; inset: 0; background: linear-gradient(135deg, rgba(10,10,15,0.3), rgba(10,10,15,0.95)); }
.branding-overlay { position: absolute; bottom: 40px; left: 40px; z-index: 2; }
.branding-overlay h1 { font-size: 34px; font-weight: 700; letter-spacing: -1px; margin-bottom: 4px; }
.branding-overlay p { font-size: 14px; color: var(--text-3); }
.login-right-pane { flex: 1; display: flex; justify-content: center; align-items: center; background: var(--bg-0); }
.login-form-container { width: 100%; max-width: 380px; padding: 28px; }
.login-header { margin-bottom: 24px; }
.login-header h2 { font-size: 24px; font-weight: 700; letter-spacing: -0.5px; margin-bottom: 4px; }
.login-header p { color: var(--text-3); font-size: 13px; }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-error { background: var(--red-soft); border: 1px solid rgba(239,68,68,0.2); color: var(--red); padding: 9px 12px; border-radius: var(--radius); font-size: 12px; font-weight: 500; text-align: center; }
.login-footer { margin-top: 24px; text-align: center; font-size: 11px; color: var(--text-3); opacity: 0.5; }

/* ─── View Router ────────────────────────────────────────────── */
.view-container { display: none; }
.view-container.active-view { display: block; animation: fadeIn 0.15s ease-out; }

/* ─── Animations ─────────────────────────────────────────────── */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInDown { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideIn { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: translateX(0); } }
@keyframes spin { to { transform: translate(-50%, -50%) rotate(360deg); } }
@keyframes pulse { 0% { opacity: 0.4; } 50% { opacity: 1; } 100% { opacity: 0.4; } }
@keyframes fadeLine { to { opacity: 1; } }
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-3px)} 75%{transform:translateX(3px)} }
.shake { animation: shake 0.3s; }

/* ─── Responsive ─────────────────────────────────────────────── */
@media (max-width: 1024px) { .provision-layout { grid-template-columns: 1fr; } .stats-row { grid-template-columns: repeat(2, 1fr); } .settings-row { grid-template-columns: 1fr; gap: 12px; } }
@media (max-width: 768px) { .app-body { flex-direction: column; } .sidebar { width: 100%; height: auto; border-right: none; border-bottom: 1px solid var(--border); flex-direction: row; padding: 10px; } .sidebar-header { margin-bottom: 0; } .sidebar-nav, .sidebar-status, .sidebar-footer, .sidebar-section-label { display: none; } .input-grid, .settings-grid { grid-template-columns: 1fr; } .content-area { padding: 14px; } .stats-row { grid-template-columns: 1fr 1fr; } }

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ═══════════════════════════════════════════════════════════════════
   LIGHT MODE — GitHub-inspired Premium
   ═══════════════════════════════════════════════════════════════════ */
body.light-mode {
    --bg-0: #F6F8FA; --bg-1: #FFFFFF; --bg-2: #FFFFFF; --bg-3: #F0F2F5;
    --border: #D8DEE4; --border-light: #C9D1D9;
    --text: #1F2328; --text-2: #57606A; --text-3: #8B949E;
    --blue: #0969DA; --blue-hover: #0550AE; --blue-soft: rgba(9,105,218,0.08); --blue-glow: rgba(9,105,218,0.15);
    --green: #1A7F37; --green-soft: rgba(26,127,55,0.08);
    --amber: #BF8700; --amber-soft: rgba(191,135,0,0.08);
    --red: #CF222E; --red-soft: rgba(207,34,46,0.06);
}
/* Dark sidebar in light mode */
body.light-mode .sidebar { background: #1C2128; border-right-color: #2D333B; }
body.light-mode .sidebar .nav-item { color: #8B949E; }
body.light-mode .sidebar .nav-item:hover { color: #E6EDF3; background: #2D333B; }
body.light-mode .sidebar .nav-item.active { color: #79C0FF; background: rgba(9,105,218,0.2); }
body.light-mode .sidebar .brand-name { color: #E6EDF3; }
body.light-mode .sidebar .text-accent { -webkit-text-fill-color: #79C0FF; color: #79C0FF; }
body.light-mode .sidebar .sidebar-section-label { color: #636C76; }
body.light-mode .sidebar .status-card { background: #2D333B; border-color: #373E47; }
body.light-mode .sidebar .status-row { color: #8B949E; }
body.light-mode .sidebar .logo-icon { box-shadow: 0 0 12px rgba(9,105,218,0.3); }

/* Content area */
body.light-mode .main-wrapper { background: #F6F8FA; }
body.light-mode .topbar { background: rgba(255,255,255,0.92); backdrop-filter: blur(12px); border-color: #D8DEE4; }
body.light-mode .breadcrumb { color: #57606A; }
body.light-mode .breadcrumb span { color: #1F2328; }

/* Cards */
body.light-mode .panel { background: #FFF; border-color: #D8DEE4; box-shadow: 0 1px 0 rgba(31,35,40,0.04); }
body.light-mode .panel:hover { border-color: #C9D1D9; }
body.light-mode .stat-card { background: #FFF; border-color: #D8DEE4; box-shadow: 0 1px 0 rgba(31,35,40,0.04); }
body.light-mode .stat-card:hover { border-color: #C9D1D9; }

/* Inputs */
body.light-mode textarea, body.light-mode input { background: #FFF; border-color: #D0D7DE; color: #1F2328; }
body.light-mode textarea:focus, body.light-mode input:focus { border-color: #0969DA; box-shadow: 0 0 0 3px rgba(9,105,218,0.15); }
body.light-mode textarea::placeholder, body.light-mode input::placeholder { color: #8B949E; }
body.light-mode .global-setting-input { background: #F6F8FA; color: #57606A; border-color: #D0D7DE; }
body.light-mode .global-setting-input:not([disabled]) { background: #FFF; color: #1F2328; }
body.light-mode .global-setting-input:not([disabled]):focus { border-color: #0969DA; box-shadow: 0 0 0 3px rgba(9,105,218,0.15); }
body.light-mode .input-with-suffix { background: #FFF; border-color: #D0D7DE; }
body.light-mode .suffix { background: #F6F8FA; border-color: #D0D7DE; color: #57606A; }
body.light-mode .mapping-preview { background: #F6F8FA; border-color: #D8DEE4; }
body.light-mode .mapping-item { background: #FFF; }

/* Buttons */
body.light-mode .deploy-btn { background: #1F883D; box-shadow: 0 1px 0 rgba(31,35,40,0.1); }
body.light-mode .deploy-btn:hover:not(:disabled) { background: #1A7F37; }
body.light-mode .deploy-btn:disabled { background: #F0F2F5; color: #8B949E; box-shadow: none; }
body.light-mode .action-btn { border-color: #D0D7DE; color: #57606A; }
body.light-mode .action-btn:hover { background: rgba(9,105,218,0.08); color: #0969DA; border-color: rgba(9,105,218,0.3); }

/* Tables */
body.light-mode .server-table th { background: #F6F8FA; border-color: #D8DEE4; color: #57606A; }
body.light-mode .server-table td { border-color: #D8DEE4; }
body.light-mode .server-table tbody tr:hover { background: #F6F8FA; }

/* Status badges */
body.light-mode .status-badge.active { background: rgba(26,127,55,0.1); color: #1A7F37; }
body.light-mode .status-badge.failed { background: rgba(207,34,46,0.08); color: #CF222E; }
body.light-mode .status-badge.deploying { background: rgba(9,105,218,0.08); color: #0969DA; }

/* Toasts & modals */
body.light-mode .toast { background: #FFF; border-color: #D8DEE4; color: #1F2328; box-shadow: 0 8px 24px rgba(31,35,40,0.12); }
body.light-mode .console-window { border-color: #D8DEE4; box-shadow: 0 16px 40px rgba(31,35,40,0.15); }
body.light-mode .console-header { background: #F6F8FA; border-color: #D8DEE4; }

/* User menu */
body.light-mode .user-role { background: rgba(26,127,55,0.1); color: #1A7F37; }
body.light-mode .logout-btn { color: #57606A; }
body.light-mode .logout-btn:hover { color: #CF222E; background: rgba(207,34,46,0.06); }

/* Scrollbar */
body.light-mode ::-webkit-scrollbar-thumb { background: #C9D1D9; }
body.light-mode ::-webkit-scrollbar-thumb:hover { background: #8B949E; }


/* ═══════════════════════════════════════════════════════════════════
   POLISH & IMPROVEMENTS
   ═══════════════════════════════════════════════════════════════════ */

/* Smooth page transitions */
.view-container.active-view { animation: fadeIn 0.2s ease-out; }

/* Better textarea styling */
textarea { font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace; font-size: 12px; line-height: 1.6; }

/* Panel title consistency */
.panel-title { letter-spacing: -0.2px; }

/* Stat card number alignment */
.stat-value { font-variant-numeric: tabular-nums; }

/* Better empty state */
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.empty-state p { margin: 0; font-weight: 500; }

/* Mapping item hover */
.mapping-item { transition: background var(--speed); }
.mapping-item:hover { background: var(--bg-3); }

/* Deploy button pulse when enabled */
.deploy-btn:not(:disabled) { animation: subtlePulse 3s ease-in-out infinite; }
@keyframes subtlePulse {
    0%, 100% { box-shadow: 0 2px 8px rgba(59,130,246,0.25); }
    50% { box-shadow: 0 2px 16px rgba(59,130,246,0.35); }
}
.deploy-btn:hover:not(:disabled) { animation: none; }

/* Table row transitions */
.server-table td { transition: background var(--speed); }

/* Settings panel spacing */
.panel .input-group + .input-group { margin-top: 0; }

/* Login page improvements */
.login-form-container { animation: fadeIn 0.4s ease-out; }
.login-form input { padding: 10px 12px; }
.login-form .deploy-btn { margin-top: 4px; }

/* Logo large variant for login */
.logo-icon.large { width: 48px; height: 48px; border-radius: 12px; margin-bottom: 16px; box-shadow: 0 0 24px rgba(59,130,246,0.3); }

/* Better focus ring for all interactive elements */
button:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
a:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* Status dot animation for online */
.status-dot.online { animation: dotPulse 2s ease-in-out infinite; }
@keyframes dotPulse {
    0%, 100% { box-shadow: 0 0 4px rgba(16,185,129,0.4); }
    50% { box-shadow: 0 0 8px rgba(16,185,129,0.6); }
}

/* Console modal improvements */
.console-window { animation: modalSlideUp 0.2s ease-out; }
@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Better disabled input styling */
input:disabled, textarea:disabled, .global-setting-input[disabled] {
    opacity: 0.6; cursor: not-allowed;
}

/* Action button in table — consistent sizing */
.server-table .action-btn { padding: 4px 12px; font-size: 11px; font-weight: 500; }

/* Settings card title with bottom border */
.panel > div:first-child { position: relative; }

/* Sidebar logo hover effect */
.sidebar-header:hover .logo-icon { box-shadow: 0 0 20px rgba(59,130,246,0.35); }
.logo-icon { transition: box-shadow 0.3s ease; }

/* Nav item active indicator */
.nav-item.active { font-weight: 600; }

/* Topbar title */
#topbarTitle { font-weight: 600; color: var(--text); font-size: 13px; }

/* User role badge */
.user-role { letter-spacing: 0.3px; }

/* Settings edit/save buttons alignment */
.page-header .action-btn { font-weight: 600; }

/* Responsive stat cards */
@media (max-width: 640px) {
    .stats-row { grid-template-columns: 1fr !important; }
}

/* Print styles */
@media print {
    .sidebar, .topbar, .deploy-btn, .action-btn { display: none; }
    .main-wrapper { overflow: visible; }
    .content-area { padding: 0; }
}
