:root {
    --navy: #0f2747;
    --navy-strong: #0a1b33;
    --blue: #2563eb;
    --blue-soft: #e8f0ff;
    --slate: #64748b;
    --text: #162033;
    --muted: #6b778c;
    --line: #e5eaf2;
    --bg: #f4f7fb;
    --white: #ffffff;
    --success: #16a34a;
    --warning: #d97706;
    --info: #0284c7;
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0;
}

a {
    text-decoration: none;
}

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

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1040;
    display: flex;
    width: 282px;
    flex-direction: column;
    padding: 24px 18px;
    background: linear-gradient(180deg, var(--navy-strong), var(--navy));
    color: var(--white);
    box-shadow: 12px 0 34px rgba(15, 39, 71, 0.16);
}

.brand,
.sidebar-nav a,
.logout-link {
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(255, 255, 255, 0.78);
}

.brand {
    padding: 6px 8px 26px;
    color: var(--white);
}

.brand strong,
.login-brand h1,
.install-heading h1 {
    display: block;
    margin: 0;
    font-size: 1rem;
    line-height: 1.15;
}

.brand small,
.login-brand p,
.install-heading p {
    display: block;
    margin: 4px 0 0;
    color: rgba(255, 255, 255, 0.64);
    font-size: 0.82rem;
}

.brand-mark {
    display: inline-flex;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: #2f74ff;
    color: #ffffff;
    font-size: 1.35rem;
    box-shadow: 0 14px 30px rgba(47, 116, 255, 0.28);
}

.sidebar-nav {
    display: grid;
    gap: 8px;
}

.sidebar-nav a,
.logout-link {
    min-height: 48px;
    border-radius: 10px;
    padding: 12px 14px;
    font-weight: 600;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.sidebar-nav a:hover,
.sidebar-nav a.active,
.logout-link:hover {
    background: rgba(255, 255, 255, 0.11);
    color: var(--white);
    transform: translateX(2px);
}

.logout-link {
    margin-top: auto;
}

.main-panel {
    min-width: 0;
    width: 100%;
    margin-left: 282px;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    min-height: 86px;
    align-items: center;
    gap: 18px;
    padding: 18px 30px;
    border-bottom: 1px solid rgba(229, 234, 242, 0.84);
    background: rgba(244, 247, 251, 0.9);
    backdrop-filter: blur(14px);
}

.topbar h1 {
    margin: 2px 0 0;
    font-size: 1.6rem;
    font-weight: 800;
}

.eyebrow {
    display: block;
    color: var(--blue);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    margin-left: auto;
    padding: 8px 12px 8px 8px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--white);
    color: var(--navy);
    font-weight: 700;
}

.user-avatar {
    display: inline-flex;
    width: 30px;
    height: 30px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--blue-soft);
    color: var(--blue);
}

.content-wrap {
    width: min(100%, 1320px);
    margin: 0 auto;
    padding: 30px;
}

.stats-grid,
.report-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.stat-card,
.report-card,
.panel,
.login-panel,
.install-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--white);
    box-shadow: 0 18px 46px rgba(15, 39, 71, 0.07);
}

.stat-card {
    display: grid;
    gap: 10px;
    min-height: 170px;
    padding: 20px;
}

.stat-icon {
    display: inline-flex;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    color: #ffffff;
    font-size: 1.2rem;
}

.bg-blue { background: #2563eb; }
.bg-green { background: #16a34a; }
.bg-amber { background: #d97706; }
.bg-indigo { background: #4f46e5; }
.bg-slate { background: #475569; }

.stat-label,
.report-card span {
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 700;
}

.stat-card strong,
.report-card strong {
    align-self: end;
    font-size: clamp(1.35rem, 2vw, 1.85rem);
    color: var(--navy-strong);
    line-height: 1.15;
}

.panel {
    padding: 22px;
    margin-bottom: 24px;
}

.panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.panel-heading h2 {
    margin: 2px 0 0;
    font-size: 1.18rem;
    font-weight: 800;
}

.app-alert {
    border-radius: 8px;
}

.app-table {
    margin-bottom: 0;
}

.app-table thead th {
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    white-space: nowrap;
}

.app-table tbody td {
    border-color: #edf1f6;
    color: #263447;
    vertical-align: middle;
}

.status-badge {
    display: inline-flex;
    min-width: 86px;
    justify-content: center;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 0.78rem;
    font-weight: 800;
    white-space: nowrap;
}

.badge-soft-success {
    background: #e8f7ee;
    color: #16723a;
}

.badge-soft-warning {
    background: #fff3db;
    color: #9a5a06;
}

.badge-soft-primary {
    background: #e8f0ff;
    color: #1d4ed8;
}

.badge-soft-info {
    background: #e6f6fd;
    color: #036b92;
}

.badge-soft-secondary {
    background: #eef2f6;
    color: #475569;
}

.empty-state {
    padding: 42px 20px !important;
    color: var(--muted) !important;
    text-align: center;
}

.filter-panel {
    margin-bottom: 18px;
}

.form-panel {
    max-width: 980px;
}

.form-label {
    color: #334155;
    font-weight: 700;
}

.form-control,
.form-select,
.input-group-text {
    min-height: 46px;
    border-color: #dbe3ee;
    border-radius: 8px;
}

.input-group > .form-control,
.input-group > .form-select,
.input-group > .input-group-text {
    border-radius: 8px;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 0.18rem rgba(37, 99, 235, 0.14);
}

.btn {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 8px;
    font-weight: 800;
}

.btn-primary {
    border-color: var(--blue);
    background: var(--blue);
}

.btn-primary:hover {
    border-color: #1d4ed8;
    background: #1d4ed8;
}

.btn-light {
    border-color: #dce4ef;
    background: #f7f9fc;
}

.form-actions,
.action-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.action-buttons .btn {
    width: 38px;
    min-height: 36px;
    padding: 0;
}

.note-dot {
    display: inline-flex;
    width: 8px;
    height: 8px;
    margin-left: 8px;
    border-radius: 50%;
    background: var(--blue);
    vertical-align: middle;
}

.report-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.report-card {
    display: grid;
    gap: 18px;
    min-height: 140px;
    padding: 20px;
}

.summary-row {
    display: grid;
    grid-template-columns: minmax(180px, 260px) 1fr;
    align-items: center;
    gap: 18px;
    padding: 16px 0;
    border-top: 1px solid var(--line);
}

.summary-row:first-of-type {
    border-top: 0;
}

.summary-row span {
    display: block;
    color: var(--muted);
    font-weight: 700;
}

.summary-row strong {
    color: var(--navy);
    font-size: 1.1rem;
}

.progress {
    height: 12px;
    border-radius: 999px;
    background: #edf2f7;
}

.icon-button {
    display: inline-flex;
    width: 42px;
    height: 42px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--white);
    color: var(--navy);
    font-size: 1.5rem;
}

.sidebar-backdrop {
    display: none;
}

.login-body,
.install-body {
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.18), transparent 34%),
        linear-gradient(135deg, #eef4ff 0%, #f8fbff 52%, #edf2f7 100%);
}

.login-page,
.install-page {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 24px;
}

.login-panel,
.install-panel {
    width: min(100%, 460px);
    padding: 30px;
}

.install-panel {
    width: min(100%, 720px);
}

.login-brand,
.install-heading {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 28px;
}

.login-brand h1,
.install-heading h1 {
    color: var(--navy-strong);
    font-size: 1.35rem;
}

.login-brand p,
.install-heading p {
    color: var(--muted);
}

.login-form .input-group-text {
    background: #f6f9fd;
    color: var(--blue);
}

.demo-note,
.security-reminder,
.config-box {
    border-radius: 8px;
    background: #f6f9fd;
    color: var(--muted);
}

.demo-note {
    margin-top: 22px;
    padding: 12px 14px;
    text-align: center;
}

.security-reminder {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px;
    color: #334155;
}

.security-reminder i {
    color: var(--success);
    font-size: 1.4rem;
}

.config-box {
    display: grid;
    gap: 4px;
    margin-bottom: 18px;
    padding: 16px;
}

.config-box span,
.config-box small {
    color: var(--muted);
}

.config-box strong {
    color: var(--navy);
}

@media (max-width: 1199px) {
    .stats-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .report-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 991px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.24s ease;
    }

    .sidebar-open .sidebar {
        transform: translateX(0);
    }

    .sidebar-open .sidebar-backdrop {
        position: fixed;
        inset: 0;
        z-index: 1030;
        display: block;
        background: rgba(15, 23, 42, 0.42);
    }

    .main-panel {
        margin-left: 0;
    }

    .content-wrap {
        padding: 22px;
    }
}

@media (max-width: 767px) {
    .topbar {
        min-height: 76px;
        padding: 14px 18px;
    }

    .topbar h1 {
        font-size: 1.28rem;
    }

    .user-chip {
        padding-right: 8px;
    }

    .user-chip span:last-child {
        display: none;
    }

    .stats-grid,
    .report-grid {
        grid-template-columns: 1fr;
    }

    .stat-card {
        min-height: 132px;
    }

    .panel {
        padding: 18px;
    }

    .panel-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .panel-heading .btn {
        width: 100%;
    }

    .summary-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .form-actions {
        flex-direction: column-reverse;
    }

    .form-actions .btn {
        width: 100%;
    }

    .login-panel,
    .install-panel {
        padding: 24px;
    }
}

