:root {
    --app-bg: #f4f7fb;
    --app-card: #ffffff;
    --app-border: #e6ebf2;
    --app-muted: #6b7280;
    --app-heading: #111827;
    --app-primary: #4f46e5;
    --app-primary-dark: #3730a3;
    --sidebar-bg: #0f172a;
    --sidebar-soft: rgba(255, 255, 255, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--app-bg);
    color: #1f2937;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

.app-sidebar {
    width: 280px;
    min-height: 100vh;
    background: linear-gradient(180deg, #0f172a 0%, #111827 100%);
    color: #fff;
    padding: 22px 18px;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
}

.app-main {
    margin-left: 280px;
    width: calc(100% - 280px);
    min-height: 100vh;
}

.brand-box {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 8px 22px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    margin-bottom: 16px;
}

.brand-icon {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    background: linear-gradient(135deg, #6366f1, #22c55e);
    font-size: 23px;
    flex: 0 0 auto;
}

.brand-title {
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -.02em;
}

.brand-subtitle {
    color: #cbd5e1;
    font-size: 12px;
    margin-top: 3px;
}

.sidebar-nav .nav-link {
    color: #cbd5e1;
    border-radius: 13px;
    padding: 11px 12px;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.sidebar-nav .nav-link i {
    width: 20px;
    text-align: center;
}

.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link.active {
    color: #fff;
    background: var(--sidebar-soft);
}

.sidebar-section {
    color: #94a3b8;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em;
    padding: 16px 12px 8px;
}

.topbar {
    min-height: 76px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 28px;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--app-border);
    position: sticky;
    top: 0;
    z-index: 20;
}

.topbar-title {
    font-size: 19px;
    font-weight: 800;
    color: var(--app-heading);
}

.topbar-subtitle {
    font-size: 13px;
    color: var(--app-muted);
}

.content-wrap {
    padding: 28px;
}

.page-hero {
    background: linear-gradient(135deg, #ffffff 0%, #eef2ff 100%);
    border: 1px solid var(--app-border);
    border-radius: 22px;
    padding: 24px;
    margin-bottom: 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.page-hero h1 {
    margin: 0;
    font-size: 27px;
    font-weight: 850;
    letter-spacing: -.03em;
    color: var(--app-heading);
}

.page-hero p {
    margin: 6px 0 0;
    color: var(--app-muted);
}

.app-card {
    background: var(--app-card);
    border: 1px solid var(--app-border);
    border-radius: 18px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.04);
    margin-bottom: 20px;
}

.app-card-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--app-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.app-card-title {
    margin: 0;
    font-size: 16px;
    font-weight: 800;
    color: var(--app-heading);
}

.app-card-body {
    padding: 20px;
}

.stat-card {
    border: 1px solid var(--app-border);
    background: #fff;
    border-radius: 18px;
    padding: 18px;
    min-height: 120px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.04);
}

.stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: #eef2ff;
    display: grid;
    place-items: center;
    color: var(--app-primary);
    font-size: 21px;
    margin-bottom: 14px;
}

.stat-label {
    color: var(--app-muted);
    font-size: 13px;
    font-weight: 700;
}

.stat-value {
    color: var(--app-heading);
    font-size: 29px;
    font-weight: 850;
    margin-top: 4px;
    letter-spacing: -.03em;
}

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

.btn-primary:hover {
    background: var(--app-primary-dark);
    border-color: var(--app-primary-dark);
}

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

.form-control,
.form-select {
    border-radius: 12px;
    border-color: #d8dee9;
    padding: 10px 12px;
}

.table {
    margin-bottom: 0;
}

.table th {
    color: #64748b;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
    white-space: nowrap;
}

.table td {
    vertical-align: middle;
}

.primary-cell {
    font-weight: 800;
    color: #111827;
}

.support-text {
    color: var(--app-muted);
    font-size: 13px;
}

.empty-state {
    text-align: center;
    color: var(--app-muted);
    padding: 34px 20px;
}

.scan-panel {
    border-radius: 24px;
    padding: 28px;
    background: linear-gradient(135deg, #111827 0%, #312e81 100%);
    color: #fff;
}

.scan-input {
    font-size: 23px;
    font-weight: 700;
    border: 0;
    border-radius: 16px;
    padding: 16px 18px;
}

.scan-result-card {
    border-radius: 22px;
    border: 1px solid var(--app-border);
    background: #fff;
    padding: 26px;
    min-height: 220px;
}

.result-big {
    font-size: 32px;
    font-weight: 900;
    letter-spacing: -.03em;
}

.qr-card {
    border: 1px dashed #cbd5e1;
    border-radius: 18px;
    padding: 16px;
    text-align: center;
    background: #f8fafc;
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: radial-gradient(circle at top left, #e0e7ff 0, transparent 34%), linear-gradient(135deg, #f8fafc, #eef2ff);
}

.login-card {
    width: 100%;
    max-width: 440px;
    background: #fff;
    border: 1px solid var(--app-border);
    border-radius: 26px;
    box-shadow: 0 24px 70px rgba(15, 23, 42, .12);
    padding: 30px;
}

.login-logo {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    border-radius: 20px;
    background: linear-gradient(135deg, #4f46e5, #22c55e);
    color: #fff;
    font-size: 28px;
    margin-bottom: 18px;
}

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

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

    .app-main {
        margin-left: 0;
        width: 100%;
    }

    .content-wrap {
        padding: 18px;
    }

    .page-hero {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media print {
    .app-sidebar,
    .topbar,
    .no-print {
        display: none !important;
    }
    .app-main,
    .content-wrap {
        margin: 0 !important;
        width: 100% !important;
        padding: 0 !important;
    }
    body {
        background: #fff !important;
    }
}
