:root {
    --qac-green: #00833D;
    --qac-green-600: #007236;
    --qac-green-soft: rgba(0, 131, 61, .12);
    --ink: #162033;
    --ink-soft: #596477;
    --muted: #8792a3;
    --line: rgba(28, 38, 58, .10);
    --panel: rgba(255, 255, 255, .84);
    --panel-solid: #ffffff;
    --surface: #f5f7fb;
    --danger: #d9304f;
    --warning: #c98a08;
    --info: #0d6efd;
    --shadow-sm: 0 8px 24px rgba(21, 32, 51, .08);
    --shadow-md: 0 18px 46px rgba(21, 32, 51, .12);
    --shadow-lg: 0 24px 70px rgba(21, 32, 51, .18);
    --radius-sm: 12px;
    --radius-md: 18px;
    --radius-lg: 26px;
    --sidebar-width: 292px;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body.premium-body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(0, 131, 61, .15), transparent 34rem),
        radial-gradient(circle at 80% 10%, rgba(55, 110, 255, .12), transparent 30rem),
        linear-gradient(135deg, #f7fafc 0%, #eef3f8 55%, #f8fafc 100%);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.premium-body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(22, 32, 51, .035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(22, 32, 51, .035) 1px, transparent 1px);
    background-size: 38px 38px;
    mask-image: linear-gradient(to bottom, rgba(0,0,0,.7), transparent 78%);
}

a { color: var(--qac-green); text-decoration: none; }
a:hover { color: var(--qac-green-600); }

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

.premium-sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: sticky;
    top: 0;
    flex: 0 0 var(--sidebar-width);
    padding: 18px;
    z-index: 1040;
}

.premium-sidebar::before {
    content: "";
    position: absolute;
    inset: 14px 8px 14px 14px;
    border-radius: 30px;
    background: linear-gradient(165deg, #0e1a2c 0%, #142033 44%, #092618 100%);
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255,255,255,.11);
}

.brand-panel,
.sidebar-scroll { position: relative; z-index: 1; }

.brand-panel {
    padding: 10px 10px 16px 10px;
}

.brand-link {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    padding: 10px;
    border-radius: 20px;
    transition: .2s ease;
}

.brand-link:hover {
    color: #fff;
    background: rgba(255,255,255,.08);
}

.brand-mark {
    width: 46px;
    height: 46px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    color: #fff;
    font-weight: 900;
    letter-spacing: -.05em;
    background: linear-gradient(135deg, var(--qac-green), #50d08c);
    box-shadow: 0 12px 28px rgba(0, 131, 61, .36);
}

.brand-link strong {
    display: block;
    font-size: 1.16rem;
    line-height: 1.05;
    letter-spacing: .02em;
}

.brand-link small {
    display: block;
    color: rgba(255,255,255,.65);
    margin-top: 3px;
    font-size: .76rem;
}

.sidebar-scroll {
    height: calc(100vh - 94px);
    overflow-y: auto;
    padding: 0 8px 18px 8px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.25) transparent;
}

.sidebar-section-title {
    color: rgba(255,255,255,.45);
    text-transform: uppercase;
    letter-spacing: .12em;
    font-size: .70rem;
    font-weight: 800;
    margin: 22px 10px 9px;
}

.sidebar-nav { display: grid; gap: 6px; }
.sidebar-link {
    color: rgba(255,255,255,.72);
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 11px 12px;
    border-radius: 16px;
    font-weight: 650;
    font-size: .94rem;
    transition: .18s ease;
    border: 1px solid transparent;
}

.sidebar-link i {
    width: 24px;
    height: 24px;
    display: inline-grid;
    place-items: center;
    color: rgba(255,255,255,.58);
}

.sidebar-link:hover {
    color: #fff;
    transform: translateX(2px);
    background: rgba(255,255,255,.08);
}

.sidebar-link.active {
    color: #fff;
    background: linear-gradient(135deg, rgba(0,131,61,.95), rgba(37,186,105,.78));
    box-shadow: 0 10px 24px rgba(0,131,61,.26);
    border-color: rgba(255,255,255,.14);
}

.sidebar-link.active i { color: #fff; }

.premium-main {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.premium-topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    margin: 18px 22px 0 0;
    min-height: 84px;
    border-radius: 26px;
    padding: 18px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    background: rgba(255,255,255,.76);
    border: 1px solid rgba(255,255,255,.82);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(18px);
}

.eyebrow {
    color: var(--qac-green);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .12em;
    font-size: .70rem;
}

.topbar-title {
    font-size: clamp(1.35rem, 2vw, 2rem);
    font-weight: 850;
    letter-spacing: -.035em;
    color: var(--ink);
}

.btn-icon {
    width: 44px;
    height: 44px;
    display: inline-grid;
    place-items: center;
    border-radius: 15px;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
}

.user-button {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    border: 1px solid rgba(22,32,51,.08);
    background: linear-gradient(135deg, #fff, #f7faf9);
    border-radius: 18px;
    padding: 8px 12px 8px 8px;
    color: var(--ink);
    box-shadow: 0 10px 24px rgba(21, 32, 51, .07);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    display: inline-grid;
    place-items: center;
    color: #fff;
    font-weight: 900;
    background: linear-gradient(135deg, #162033, var(--qac-green));
}

.user-meta {
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.1;
}

.user-meta strong { font-size: .88rem; }
.user-meta small { color: var(--ink-soft); font-size: .73rem; }

.premium-dropdown {
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    padding: 8px;
}

.premium-content {
    padding: 22px 22px 40px 0;
}

.premium-alert {
    border: 0;
    border-radius: 18px;
    box-shadow: var(--shadow-sm);
    background: #fff;
}

.premium-alert.alert-success { color: #075e32; border-left: 5px solid var(--qac-green); }
.premium-alert.alert-danger { color: #8d1630; border-left: 5px solid var(--danger); }

.card {
    border: 1px solid rgba(22,32,51,.08) !important;
    border-radius: var(--radius-md) !important;
    background: var(--panel) !important;
    box-shadow: var(--shadow-sm) !important;
    backdrop-filter: blur(14px);
    overflow: hidden;
}

.card-header {
    background: linear-gradient(180deg, rgba(255,255,255,.85), rgba(248,250,252,.78)) !important;
    border-bottom: 1px solid rgba(22,32,51,.08) !important;
    color: var(--ink) !important;
    font-weight: 800;
    letter-spacing: -.01em;
    padding: 15px 18px;
}

.card-body { padding: 18px; }
.card-footer {
    border-top: 1px solid rgba(22,32,51,.08) !important;
    background: rgba(255,255,255,.62) !important;
}

.card.text-white,
.card.bg-primary,
.card.bg-success,
.card.bg-danger,
.card.bg-warning,
.card.bg-dark,
.card.bg-info,
.card.bg-secondary {
    color: #fff !important;
    background: linear-gradient(135deg, #152033, #25324a) !important;
    border-color: rgba(255,255,255,.14) !important;
}

.card.bg-success { background: linear-gradient(135deg, #006b34, #21ad68) !important; }
.card.bg-danger { background: linear-gradient(135deg, #951e35, #df4260) !important; }
.card.bg-warning { background: linear-gradient(135deg, #b07100, #f0b23b) !important; color: #fff !important; }
.card.bg-primary, .card.bg-info { background: linear-gradient(135deg, #0d4c91, #39a8ff) !important; }
.card.bg-dark { background: linear-gradient(135deg, #111827, #304057) !important; }

.premium-hero-card {
    position: relative;
    overflow: hidden;
    color: #fff;
    background: linear-gradient(135deg, #102033 0%, #0b5130 60%, #0a8f47 100%) !important;
    border: 1px solid rgba(255,255,255,.15) !important;
}

.premium-hero-card::after {
    content: "";
    position: absolute;
    inset: -40% -10% auto auto;
    width: 420px;
    height: 420px;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(255,255,255,.22), transparent 65%);
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}

.kpi-card {
    position: relative;
    border: 1px solid rgba(22,32,51,.08);
    border-radius: var(--radius-md);
    background: rgba(255,255,255,.82);
    box-shadow: var(--shadow-sm);
    padding: 18px;
    overflow: hidden;
    min-height: 138px;
}

.kpi-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 5px;
    background: var(--qac-green);
}

.kpi-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    color: #fff;
    background: linear-gradient(135deg, var(--qac-green), #36c47a);
    box-shadow: 0 10px 24px rgba(0, 131, 61, .25);
}

.kpi-label {
    color: var(--ink-soft);
    font-size: .76rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em;
    margin: 0;
}

.kpi-value {
    color: var(--ink);
    font-size: clamp(1.55rem, 2.2vw, 2.1rem);
    font-weight: 900;
    letter-spacing: -.04em;
    margin: 10px 0 0;
}

.kpi-subtitle {
    color: var(--muted);
    font-size: .84rem;
    margin-top: 5px;
}

.section-title {
    font-size: 1.18rem;
    font-weight: 850;
    letter-spacing: -.025em;
    color: var(--ink);
}

.table-responsive {
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(22,32,51,.08);
    background: rgba(255,255,255,.78);
    overflow: auto;
}

.table {
    margin-bottom: 0 !important;
    color: var(--ink);
}

.table thead,
.table-primary,
thead.table-primary,
.table thead.table-primary,
.table > thead.table-primary {
    --bs-table-bg: #f3f8f5 !important;
    --bs-table-color: var(--ink) !important;
    background: #f3f8f5 !important;
}

.table thead th,
.table th {
    color: var(--ink-soft) !important;
    font-size: .74rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    font-weight: 850;
    border-bottom: 1px solid rgba(22,32,51,.08) !important;
    white-space: nowrap;
}

.table td {
    border-color: rgba(22,32,51,.06) !important;
    vertical-align: middle;
}

.table-striped > tbody > tr:nth-of-type(odd) > * { --bs-table-bg-type: rgba(0, 131, 61, .025); }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: rgba(0, 131, 61, .065); }

.form-control,
.form-select {
    border-radius: 14px;
    border: 1px solid rgba(22,32,51,.12);
    background-color: rgba(255,255,255,.88);
    min-height: 42px;
    box-shadow: none !important;
}

.form-control:focus,
.form-select:focus {
    border-color: rgba(0, 131, 61, .55);
    box-shadow: 0 0 0 .22rem rgba(0, 131, 61, .10) !important;
}

.form-label {
    font-weight: 750;
    color: var(--ink-soft);
    font-size: .86rem;
}

.btn {
    border-radius: 14px;
    font-weight: 750;
    letter-spacing: -.005em;
    border-width: 1px;
    box-shadow: none !important;
}

.btn-sm { border-radius: 11px; }

.btn-primary,
.btn-success {
    border-color: transparent !important;
    background: linear-gradient(135deg, var(--qac-green), #31bd73) !important;
    color: #fff !important;
}

.btn-primary:hover,
.btn-success:hover {
    transform: translateY(-1px);
    background: linear-gradient(135deg, var(--qac-green-600), #21a961) !important;
}

.btn-secondary { background: #162033 !important; border-color: #162033 !important; }
.btn-info { background: #e8f3ff !important; border-color: #d6e9ff !important; color: #0d4c91 !important; }
.btn-warning { background: #fff5db !important; border-color: #ffe1a3 !important; color: #9b6800 !important; }
.btn-danger { background: #fff0f3 !important; border-color: #ffd5dd !important; color: #b42343 !important; }
.btn-outline-danger { border-color: #f4a9b7 !important; color: #b42343 !important; }
.btn-outline-danger:hover { background: #fff0f3 !important; color: #8d1630 !important; }
.btn-outline-light { border-color: rgba(255,255,255,.4) !important; }

.badge {
    padding: .45em .68em;
    border-radius: 999px;
    font-weight: 800;
    letter-spacing: .01em;
}

.bg-success { background-color: var(--qac-green) !important; }
.bg-danger { background-color: var(--danger) !important; }
.bg-warning { background-color: #f0b23b !important; color: #3f2b00 !important; }
.bg-secondary { background-color: #64748b !important; }
.bg-dark { background-color: #162033 !important; }
.bg-info { background-color: #dbeeff !important; color: #0d4c91 !important; }
.bg-primary { background-color: var(--qac-green) !important; }

.pagination .page-link {
    border-radius: 12px;
    margin: 0 3px;
    border: 1px solid rgba(22,32,51,.10);
    color: var(--ink-soft);
}

.pagination .active .page-link {
    background: var(--qac-green);
    border-color: var(--qac-green);
}

.modal-content {
    border-radius: var(--radius-lg);
    border: 1px solid rgba(22,32,51,.10);
    box-shadow: var(--shadow-lg);
}

.alert { border-radius: 18px; }
hr { border-color: rgba(22,32,51,.12); }

.page-actions,
.d-flex.justify-content-between.align-items-center.mb-3 {
    gap: 14px;
    flex-wrap: wrap;
}

.d-flex.justify-content-between.align-items-center.mb-3 h1,
.container-fluid > h1,
.container-fluid > h2 {
    font-weight: 900;
    letter-spacing: -.04em;
    color: var(--ink);
}

form.card.card-body {
    border-radius: var(--radius-md) !important;
}

.auth-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at 16% 20%, rgba(0,131,61,.22), transparent 32rem),
        radial-gradient(circle at 82% 12%, rgba(39,101,255,.16), transparent 30rem),
        linear-gradient(135deg, #081322, #123322 54%, #eef6f0 54%);
    padding: 28px;
}

.auth-shell {
    width: min(1080px, 100%);
    min-height: 640px;
    display: grid;
    grid-template-columns: 1.05fr .95fr;
    border-radius: 34px;
    overflow: hidden;
    background: rgba(255,255,255,.82);
    border: 1px solid rgba(255,255,255,.55);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(20px);
}

.auth-hero {
    position: relative;
    color: #fff;
    padding: 48px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: linear-gradient(145deg, #0b1422, #0b3c26 72%, var(--qac-green));
}

.auth-hero::after {
    content: "";
    position: absolute;
    width: 420px;
    height: 420px;
    border-radius: 999px;
    right: -130px;
    top: -120px;
    background: radial-gradient(circle, rgba(255,255,255,.22), transparent 65%);
}

.auth-brand { display: flex; align-items: center; gap: 14px; position: relative; z-index: 1; }
.auth-brand .brand-mark { width: 52px; height: 52px; }
.auth-copy { position: relative; z-index: 1; }
.auth-copy h1 { font-size: clamp(2.1rem, 4vw, 3.6rem); font-weight: 950; letter-spacing: -.06em; line-height: .95; }
.auth-copy p { color: rgba(255,255,255,.74); max-width: 440px; font-size: 1rem; }
.auth-badges { display: flex; gap: 10px; flex-wrap: wrap; position: relative; z-index: 1; }
.auth-badge { border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.09); border-radius: 999px; padding: 8px 12px; font-size: .82rem; color: rgba(255,255,255,.86); }
.auth-panel { display: grid; place-items: center; padding: 42px; }
.auth-card { width: min(430px, 100%); }
.auth-card h2 { font-weight: 900; letter-spacing: -.035em; }
.auth-muted { color: var(--ink-soft); }

@media (max-width: 1199.98px) {
    .premium-sidebar {
        position: fixed;
        left: 0;
        transform: translateX(calc(-1 * var(--sidebar-width) - 28px));
        transition: transform .25s ease;
    }
    body.sidebar-open .premium-sidebar { transform: translateX(0); }
    .premium-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(9, 18, 32, .48);
        backdrop-filter: blur(3px);
        z-index: 1035;
    }
    body.sidebar-open .premium-overlay { display: block; }
    .premium-topbar { margin-left: 18px; }
    .premium-content { padding-left: 18px; }
}

@media (max-width: 991.98px) {
    .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .auth-shell { grid-template-columns: 1fr; }
    .auth-hero { min-height: 330px; }
}

@media (max-width: 575.98px) {
    :root { --sidebar-width: 286px; }
    .premium-topbar { margin: 12px; padding: 14px; border-radius: 20px; }
    .premium-content { padding: 6px 12px 28px; }
    .kpi-grid { grid-template-columns: 1fr; }
    .topbar-title { font-size: 1.15rem; }
    .auth-body { padding: 14px; }
    .auth-hero, .auth-panel { padding: 28px; }
    .auth-shell { border-radius: 24px; }
}
