/* ============================================================
   Get SQL — Enterprise dark-blue theme
   ============================================================ */
:root {
    --gs-bg: #0b1220;
    --gs-bg-2: #0f1a2e;
    --gs-surface: #ffffff;
    --gs-sidebar: #0d1830;
    --gs-sidebar-2: #0a1226;
    --gs-navy: #12243f;
    --gs-primary: #2563eb;
    --gs-primary-600: #1d4ed8;
    --gs-primary-700: #1e40af;
    --gs-accent: #38bdf8;
    --gs-ink: #0f172a;
    --gs-muted: #64748b;
    --gs-line: #e5eaf1;
    --gs-body: #eef2f8;
    --gs-success: #16a34a;
    --gs-danger: #dc2626;
    --gs-warning: #d97706;
    --gs-info: #0ea5e9;
    --gs-radius: 14px;
    --gs-radius-sm: 10px;
    --gs-shadow: 0 1px 3px rgba(16,24,40,.06), 0 8px 24px rgba(16,24,40,.06);
    --gs-shadow-lg: 0 10px 40px rgba(16,24,40,.14);
    --sidebar-w: 260px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--gs-body);
    color: var(--gs-ink);
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; }

/* ---------------- Layout shell ---------------- */
.app-shell { display: flex; min-height: 100vh; }

.app-main {
    flex: 1;
    min-width: 0;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
}

.app-content { padding: 26px 30px 28px; flex: 1; }

/* ---------------- Site footer ---------------- */
.app-footer {
    margin-top: auto;
    border-top: 1px solid var(--gs-line);
    background: linear-gradient(180deg, #ffffff 0%, #f7f9fc 100%);
    padding: 16px 30px 18px;
}
.app-footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px 24px;
    flex-wrap: wrap;
    max-width: 1400px;
}
.app-footer-left,
.app-footer-right {
    display: flex;
    align-items: center;
    gap: 8px 12px;
    flex-wrap: wrap;
    font-size: 12.5px;
    color: var(--gs-muted);
}
.app-footer-copy strong { color: var(--gs-ink); font-weight: 700; }
.app-footer-sep { color: #cbd5e1; }
.app-footer-meta { color: #94a3b8; }
.app-footer-dev { color: var(--gs-muted); }
.app-footer-link {
    color: var(--gs-primary-700);
    font-weight: 700;
    transition: color .15s ease;
}
.app-footer-link:hover { color: var(--gs-primary); }
.app-footer-url {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    background: #eef4ff;
    color: var(--gs-primary-700);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .01em;
}
.app-footer-url:hover {
    background: #dbeafe;
    color: var(--gs-primary-600);
}

/* Auth / standalone footer */
.site-footer-standalone {
    text-align: center;
    padding: 18px 20px 24px;
    font-size: 12.5px;
    color: var(--gs-muted);
}
.site-footer-standalone a {
    color: var(--gs-primary-700);
    font-weight: 700;
}
.site-footer-standalone a:hover { color: var(--gs-primary); }
.site-footer-standalone .sep { margin: 0 8px; color: #cbd5e1; }

/* Backup confirm modal extras */
.backup-confirm-meta {
    text-align: left;
    background: #f8fafc;
    border: 1px solid var(--gs-line);
    border-radius: 12px;
    padding: 12px 14px;
    margin: 0 0 16px;
    font-size: 13px;
}
.backup-confirm-meta .row-line {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 4px 0;
}
.backup-confirm-meta .k { color: var(--gs-muted); }
.backup-confirm-meta .v { font-weight: 600; color: var(--gs-ink); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.backup-confirm-input {
    text-align: left;
    margin-bottom: 16px;
}
.backup-confirm-input label {
    display: block;
    font-size: 12.5px;
    color: var(--gs-muted);
    margin-bottom: 6px;
}
.backup-confirm-input input {
    width: 100%;
}

/* ---------------- Sidebar ---------------- */
.sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w);
    background: linear-gradient(180deg, var(--gs-sidebar) 0%, var(--gs-sidebar-2) 100%);
    color: #c7d3e8;
    display: flex;
    flex-direction: column;
    z-index: 1040;
    border-right: 1px solid rgba(255,255,255,.05);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 16px;
}
.brand-link { display: flex; align-items: center; gap: 11px; }
.brand-logo { width: 38px; height: 38px; border-radius: 10px; }
.brand-text { font-size: 21px; font-weight: 800; color: #fff; letter-spacing: -.5px; }
.brand-accent { color: var(--gs-accent); }
.sidebar-close { background: none; border: none; color: #8ea3c4; font-size: 18px; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 12px 20px; }
.nav-heading {
    font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em;
    color: #5f7397; font-weight: 700; padding: 18px 12px 8px;
}
.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 13px; margin: 2px 0;
    border-radius: var(--gs-radius-sm);
    color: #b4c2dc; font-weight: 500;
    transition: all .16s ease;
}
.nav-item i { font-size: 16px; width: 20px; text-align: center; color: #7d90b4; }
.nav-item:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav-item:hover i { color: var(--gs-accent); }
.nav-item.active {
    background: linear-gradient(90deg, rgba(37,99,235,.28), rgba(37,99,235,.05));
    color: #fff;
    box-shadow: inset 3px 0 0 var(--gs-accent);
}
.nav-item.active i { color: var(--gs-accent); }

.sidebar-footer { padding: 14px 20px; border-top: 1px solid rgba(255,255,255,.05); }
.version-badge { font-size: 11px; color: #5f7397; }
.sidebar-dev { margin-top: 6px; font-size: 11px; color: #5f7397; }
.sidebar-dev a { color: #8eb6ff; font-weight: 600; }
.sidebar-dev a:hover { color: var(--gs-accent); }

.sidebar-backdrop {
    display: none; position: fixed; inset: 0;
    background: rgba(4,10,20,.55); z-index: 1035;
}
.sidebar-backdrop.show { display: block; }

/* ---------------- Topbar ---------------- */
.topbar {
    position: sticky; top: 0; z-index: 1020;
    height: 66px;
    background: rgba(255,255,255,.85);
    backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--gs-line);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 30px;
}
.topbar-left { display: flex; align-items: center; gap: 14px; }
.topbar-title { font-size: 19px; font-weight: 700; margin: 0; color: var(--gs-ink); }
.menu-toggle { background: none; border: none; font-size: 22px; color: var(--gs-ink); }

.profile-btn {
    display: flex; align-items: center; gap: 10px;
    background: none; border: none; padding: 5px 8px; border-radius: 10px;
}
.profile-btn:hover { background: #f1f5fb; }
.avatar {
    width: 38px; height: 38px; border-radius: 50%;
    background: linear-gradient(135deg, var(--gs-primary), var(--gs-primary-700));
    color: #fff; font-weight: 700; font-size: 14px;
    display: flex; align-items: center; justify-content: center;
}
.profile-meta { flex-direction: column; align-items: flex-start; line-height: 1.2; }
.profile-name { font-weight: 600; font-size: 13.5px; color: var(--gs-ink); }
.profile-role { font-size: 11.5px; color: var(--gs-muted); }
.profile-dropdown { border: 1px solid var(--gs-line); box-shadow: var(--gs-shadow-lg); border-radius: 12px; min-width: 230px; }

/* ---------------- Cards ---------------- */
.card {
    background: var(--gs-surface);
    border: 1px solid var(--gs-line);
    border-radius: var(--gs-radius);
    box-shadow: var(--gs-shadow);
}
.card-pad { padding: 20px 22px; }
.card-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 22px; border-bottom: 1px solid var(--gs-line);
}
.card-head h2, .card-head h3 { font-size: 15px; font-weight: 700; margin: 0; }

/* Stat cards */
.stat-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 18px; margin-bottom: 22px;
}
.stat-card {
    background: var(--gs-surface); border: 1px solid var(--gs-line);
    border-radius: var(--gs-radius); padding: 20px; box-shadow: var(--gs-shadow);
    display: flex; align-items: center; gap: 16px; position: relative; overflow: hidden;
}
.stat-icon {
    width: 52px; height: 52px; border-radius: 13px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; font-size: 22px; color: #fff;
}
.stat-icon.blue { background: linear-gradient(135deg,#3b82f6,#1d4ed8); }
.stat-icon.green { background: linear-gradient(135deg,#22c55e,#15803d); }
.stat-icon.red { background: linear-gradient(135deg,#ef4444,#b91c1c); }
.stat-icon.amber { background: linear-gradient(135deg,#f59e0b,#b45309); }
.stat-icon.cyan { background: linear-gradient(135deg,#22d3ee,#0891b2); }
.stat-icon.violet { background: linear-gradient(135deg,#8b5cf6,#6d28d9); }
.stat-value { font-size: 24px; font-weight: 800; line-height: 1; color: var(--gs-ink); }
.stat-label { font-size: 12.5px; color: var(--gs-muted); margin-top: 5px; }

/* ---------------- Buttons ---------------- */
.btn { font-weight: 600; border-radius: 10px; padding: 9px 16px; font-size: 13.5px; }
.btn-primary { background: var(--gs-primary); border-color: var(--gs-primary); }
.btn-primary:hover { background: var(--gs-primary-600); border-color: var(--gs-primary-600); }
.btn-soft {
    background: #eef4ff; color: var(--gs-primary-700); border: 1px solid #dbe6ff;
}
.btn-soft:hover { background: #e0ebff; color: var(--gs-primary-700); }
.btn-icon { padding: 7px 10px; line-height: 1; }

/* ---------------- Tables ---------------- */
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.data-table thead th {
    text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
    color: var(--gs-muted); font-weight: 700; padding: 12px 16px;
    border-bottom: 1px solid var(--gs-line); background: #f8fafc;
}
.data-table tbody td { padding: 13px 16px; border-bottom: 1px solid var(--gs-line); vertical-align: middle; }
.data-table tbody tr:hover { background: #f8fbff; }
.data-table tbody tr:last-child td { border-bottom: none; }
.table-wrap { overflow-x: auto; }

/* ---------------- Badges ---------------- */
.badge-status {
    font-weight: 600; font-size: 11.5px; padding: 5px 10px; border-radius: 999px;
    display: inline-flex; align-items: center; gap: 5px;
}
.badge-success { background: #dcfce7; color: #15803d; }
.badge-danger { background: #fee2e2; color: #b91c1c; }
.badge-warning { background: #fef3c7; color: #b45309; }
.badge-info { background: #e0f2fe; color: #0369a1; }
.badge-secondary { background: #eef1f6; color: #475569; }
.badge-role { background: #ede9fe; color: #6d28d9; }

/* ---------------- Forms ---------------- */
.form-label { font-weight: 600; font-size: 13px; color: #334155; margin-bottom: 6px; }
.form-control, .form-select {
    border: 1px solid #d8e0ea; border-radius: 10px; padding: 10px 13px; font-size: 14px;
    background: #fff;
}
.form-control:focus, .form-select:focus {
    border-color: var(--gs-primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.form-text { font-size: 12px; color: var(--gs-muted); }
.input-hint { font-size: 12px; color: var(--gs-muted); }

/* ---------------- Toast ---------------- */
.toast-stack { position: fixed; top: 78px; right: 24px; z-index: 1090; display: flex; flex-direction: column; gap: 10px; }
.gs-toast {
    min-width: 300px; max-width: 380px; background: #fff; border-radius: 12px;
    box-shadow: var(--gs-shadow-lg); padding: 14px 16px; display: flex; gap: 12px; align-items: flex-start;
    border-left: 4px solid var(--gs-primary); animation: toastIn .25s ease;
}
.gs-toast.success { border-left-color: var(--gs-success); }
.gs-toast.error { border-left-color: var(--gs-danger); }
.gs-toast.warning { border-left-color: var(--gs-warning); }
.gs-toast .ti { font-size: 18px; }
.gs-toast.success .ti { color: var(--gs-success); }
.gs-toast.error .ti { color: var(--gs-danger); }
.gs-toast .tclose { margin-left: auto; background: none; border: none; color: #94a3b8; font-size: 18px; }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

/* ---------------- Flash ---------------- */
.flash-alert {
    display: flex; align-items: center; gap: 11px; padding: 13px 16px; border-radius: 12px;
    margin-bottom: 16px; font-weight: 500; border: 1px solid transparent;
}
.flash-alert i { font-size: 17px; }
.flash-success { background: #dcfce7; color: #14532d; border-color: #bbf7d0; }
.flash-danger { background: #fee2e2; color: #7f1d1d; border-color: #fecaca; }
.flash-info { background: #e0f2fe; color: #075985; border-color: #bae6fd; }
.flash-warning { background: #fef3c7; color: #78350f; border-color: #fde68a; }
.flash-close { margin-left: auto; background: none; border: none; font-size: 20px; color: inherit; opacity: .6; }

/* ---------------- Empty / error states ---------------- */
.empty-state { text-align: center; padding: 56px 20px; color: var(--gs-muted); }
.empty-state .icon {
    width: 76px; height: 76px; border-radius: 20px; background: #eef4ff; color: var(--gs-primary);
    font-size: 34px; display: flex; align-items: center; justify-content: center; margin: 0 auto 18px;
}
.empty-state h3 { color: var(--gs-ink); font-size: 17px; font-weight: 700; margin-bottom: 6px; }

/* ---------------- Page header ---------------- */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-header .subtitle { color: var(--gs-muted); font-size: 13.5px; margin-top: 3px; }
.breadcrumb-nav { font-size: 12.5px; color: var(--gs-muted); margin-bottom: 6px; }
.breadcrumb-nav a { color: var(--gs-primary); }

/* ---------------- Filters ---------------- */
.filter-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin-bottom: 18px; }
.filter-bar .form-control, .filter-bar .form-select { min-width: 150px; }

/* ---------------- Pagination ---------------- */
.pagination-bar { display: flex; align-items: center; justify-content: space-between; margin-top: 18px; flex-wrap: wrap; gap: 12px; }
.pagination-info { font-size: 13px; color: var(--gs-muted); }
.page-link { color: var(--gs-primary); border-radius: 8px !important; margin: 0 2px; border-color: var(--gs-line); }
.page-item.active .page-link { background: var(--gs-primary); border-color: var(--gs-primary); }

/* ---------------- Progress ---------------- */
.progress-slim { height: 8px; border-radius: 999px; background: #eef1f6; overflow: hidden; }
.progress-slim > span { display: block; height: 100%; background: linear-gradient(90deg,var(--gs-primary),var(--gs-accent)); }

/* ---------------- Auth / Install ---------------- */
.auth-wrap {
    min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr;
    background: var(--gs-body);
}
.auth-brand {
    background: radial-gradient(1200px 600px at 20% -10%, #1e3a8a 0%, transparent 60%),
                linear-gradient(160deg, #0d1830 0%, #0a1226 100%);
    color: #dbe6ff; padding: 60px; display: flex; flex-direction: column; justify-content: center;
    position: relative; overflow: hidden;
}
.auth-brand::after {
    content: ''; position: absolute; right: -120px; bottom: -120px; width: 360px; height: 360px;
    border-radius: 50%; background: radial-gradient(circle, rgba(56,189,248,.18), transparent 70%);
}
.auth-brand .logo-row { display: flex; align-items: center; gap: 14px; margin-bottom: 30px; }
.auth-brand .logo-row img { width: 52px; height: 52px; border-radius: 13px; }
.auth-brand h1 { font-size: 34px; font-weight: 800; letter-spacing: -.6px; }
.auth-brand .tagline { font-size: 16px; color: #9fb3d6; max-width: 420px; line-height: 1.6; }
.auth-features { margin-top: 40px; display: flex; flex-direction: column; gap: 14px; }
.auth-features .feat { display: flex; align-items: center; gap: 12px; color: #b8c8e6; }
.auth-features .feat i { color: var(--gs-accent); font-size: 18px; }

.auth-form-side { display: flex; align-items: center; justify-content: center; padding: 40px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h2 { font-size: 24px; font-weight: 800; margin-bottom: 6px; }
.auth-card .muted { color: var(--gs-muted); margin-bottom: 28px; }

@media (max-width: 900px) {
    .auth-wrap { grid-template-columns: 1fr; }
    .auth-brand { display: none; }
}

/* ---------------- Install wizard ---------------- */
.install-wrap { max-width: 720px; margin: 40px auto; padding: 0 20px; }
.install-logo { display: flex; align-items: center; gap: 12px; justify-content: center; margin-bottom: 26px; }
.install-logo img { width: 46px; height: 46px; border-radius: 12px; }
.install-logo span { font-size: 26px; font-weight: 800; color: #fff; }
.steps-track { display: flex; justify-content: space-between; margin-bottom: 28px; position: relative; }
.steps-track::before { content: ''; position: absolute; top: 15px; left: 6%; right: 6%; height: 2px; background: rgba(255,255,255,.12); }
.step-dot { display: flex; flex-direction: column; align-items: center; gap: 7px; position: relative; z-index: 1; flex: 1; }
.step-dot .dot { width: 32px; height: 32px; border-radius: 50%; background: #1a2942; color: #6f83a6; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; border: 2px solid rgba(255,255,255,.1); }
.step-dot.active .dot { background: var(--gs-primary); color: #fff; border-color: var(--gs-accent); }
.step-dot.done .dot { background: var(--gs-success); color: #fff; border-color: var(--gs-success); }
.step-dot .lbl { font-size: 11px; color: #8ea3c4; }
.req-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--gs-line); }
.req-row:last-child { border-bottom: none; }

body.install-body {
    background: radial-gradient(1000px 500px at 50% -10%, #16264a 0%, transparent 60%), var(--gs-bg);
    min-height: 100vh;
}

/* ---------------- Misc ---------------- */
.text-muted-2 { color: var(--gs-muted); }
.mono { font-family: "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 8px; background: #eef4ff; color: var(--gs-primary-700); font-size: 12px; font-weight: 600; }
.dot-status { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-online { background: var(--gs-success); }
.dot-offline { background: var(--gs-danger); }
.dot-unknown { background: #cbd5e1; }
.icon-tile { width: 44px; height: 44px; border-radius: 11px; background: #eef4ff; color: var(--gs-primary); display: flex; align-items: center; justify-content: center; font-size: 20px; }

/* ---------------- Responsive ---------------- */
@media (max-width: 991.98px) {
    .app-main { margin-left: 0; }
    .sidebar { transform: translateX(-100%); transition: transform .25s ease; }
    .sidebar.open { transform: none; }
    .app-content { padding: 20px 16px 20px; }
    .topbar { padding: 0 16px; }
    .app-footer { padding: 14px 16px 16px; }
    .app-footer-inner { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 575.98px) {
    .stat-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
    .stat-card { padding: 14px; flex-direction: column; align-items: flex-start; }
    .page-header .btn { width: 100%; }
}
