:root {
    --navy: #0b1220;
    --navy-soft: #151e2e;
    --red: #e31235;
    --red-dark: #bd0d2a;
    --red-pale: #fff1f3;
    --ink: #172033;
    --muted: #667085;
    --line: #e5e9f0;
    --surface: #ffffff;
    --canvas: #f6f7fa;
    --success: #12b76a;
    --shadow: 0 10px 30px rgba(16, 24, 40, .08);
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    background: var(--canvas);
}

body {
    margin: 0;
    color: var(--ink);
    background: var(--canvas);
    font: 15px/1.5 Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}

button,
input,
select {
    font: inherit;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
.table-scroll:focus-visible {
    outline: 3px solid rgba(227, 18, 53, .25);
    outline-offset: 2px;
}

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

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    display: flex;
    width: 256px;
    flex-direction: column;
    color: #fff;
    background:
        radial-gradient(circle at 10% 5%, rgba(227, 18, 53, .24), transparent 26%),
        var(--navy);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 84px;
    padding: 0 25px;
}

.brand__mark {
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    border-radius: 12px;
    color: #fff;
    background: var(--red);
    box-shadow: 0 8px 20px rgba(227, 18, 53, .3);
    font-size: 20px;
    font-weight: 800;
}

.brand > span:last-child {
    display: grid;
}

.brand strong {
    letter-spacing: .12em;
}

.brand small {
    color: #98a2b3;
    font-size: 11px;
}

.nav {
    display: grid;
    gap: 7px;
    padding: 22px 15px;
    border-top: 1px solid rgba(255,255,255,.07);
}

.nav__item {
    display: flex;
    align-items: center;
    gap: 13px;
    min-height: 47px;
    padding: 0 14px;
    border-radius: 11px;
    color: #b7c0cf;
    font-weight: 600;
    transition: background .18s ease, color .18s ease;
}

.nav__item:hover,
.nav__item--active {
    color: #fff;
    background: rgba(255,255,255,.09);
}

.nav__item--active {
    box-shadow: inset 3px 0 0 var(--red);
}

.nav__icon {
    width: 20px;
    color: #fff;
    text-align: center;
}

.sidebar__footer {
    display: flex;
    align-items: center;
    gap: 11px;
    margin: auto 18px 20px;
    padding: 14px;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 12px;
    background: rgba(255,255,255,.04);
}

.sidebar__footer > span:last-child {
    display: grid;
}

.sidebar__footer strong {
    font-size: 12px;
}

.sidebar__footer small {
    color: #98a2b3;
    font-size: 10px;
}

.status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 4px rgba(18, 183, 106, .12);
}

.scrim {
    display: none;
}

.main {
    min-width: 0;
    padding-left: 256px;
}

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

.topbar__title {
    display: grid;
}

.topbar__title small {
    color: var(--muted);
    font-size: 11px;
}

.topbar__title strong {
    font-size: 16px;
}

.profile {
    display: flex;
    align-items: center;
    gap: 10px;
}

.profile__text {
    display: grid;
    text-align: right;
}

.profile__text strong {
    font-size: 13px;
}

.profile__text small {
    color: var(--muted);
    font-size: 10px;
}

.profile__avatar {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border-radius: 11px;
    color: var(--red);
    background: var(--red-pale);
    font-weight: 800;
}

.logout,
.icon-button {
    border: 0;
    cursor: pointer;
    color: var(--muted);
    background: transparent;
}

.logout {
    padding: 9px;
    font-size: 12px;
}

.logout:hover {
    color: var(--red);
}

.mobile-menu {
    display: none;
    font-size: 20px;
}

.content {
    width: min(1480px, 100%);
    margin: 0 auto;
    padding: clamp(24px, 4vw, 54px);
}

.hero {
    display: flex;
    min-height: 240px;
    align-items: center;
    justify-content: space-between;
    gap: 38px;
    padding: clamp(28px, 5vw, 58px);
    overflow: hidden;
    border-radius: 24px;
    color: #fff;
    background:
        radial-gradient(circle at 85% 15%, rgba(227, 18, 53, .42), transparent 32%),
        linear-gradient(130deg, #111a2a, #0b1220);
    box-shadow: var(--shadow);
}

.hero h1 {
    max-width: 700px;
    margin: 10px 0 13px;
    font-size: clamp(29px, 3.4vw, 49px);
    line-height: 1.1;
    letter-spacing: -.035em;
}

.hero p {
    max-width: 620px;
    margin: 0;
    color: #b8c1cf;
    font-size: 16px;
}

.eyebrow {
    color: #ff7188;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .16em;
}

.hero__stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    align-self: stretch;
    min-width: 360px;
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 18px;
    background: rgba(255,255,255,.05);
}

.hero__stats span {
    display: grid;
    place-content: center;
    padding: 18px;
    text-align: center;
}

.hero__stats span + span {
    border-left: 1px solid rgba(255,255,255,.1);
}

.hero__stats strong {
    font-size: 21px;
}

.hero__stats small {
    color: #98a2b3;
}

.toolbar {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 27px 0;
}

.search {
    display: flex;
    min-width: min(410px, 100%);
    min-height: 48px;
    align-items: center;
    gap: 10px;
    padding: 0 15px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
}

.search span {
    color: var(--muted);
    font-size: 22px;
}

.search input {
    width: 100%;
    border: 0;
    outline: 0;
    color: var(--ink);
    background: transparent;
}

.chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
}

.chips::-webkit-scrollbar {
    display: none;
}

.chip {
    min-height: 39px;
    padding: 0 16px;
    border: 1px solid var(--line);
    border-radius: 999px;
    cursor: pointer;
    white-space: nowrap;
    color: var(--muted);
    background: var(--surface);
}

.chip:hover,
.chip--active {
    border-color: var(--red);
    color: #fff;
    background: var(--red);
}

.section-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 18px;
    margin: 32px 0 16px;
}

.section-heading h2 {
    margin: 0;
    font-size: 20px;
}

.section-heading span {
    color: var(--muted);
    font-size: 12px;
}

.report-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 17px;
}

.report-card {
    position: relative;
    display: flex;
    min-height: 246px;
    flex-direction: column;
    padding: 22px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 17px;
    background: var(--surface);
    box-shadow: 0 2px 5px rgba(16,24,40,.03);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.report-card::before {
    position: absolute;
    inset: 0 0 auto;
    height: 3px;
    content: "";
    opacity: 0;
    background: var(--red);
}

.report-card:hover {
    transform: translateY(-3px);
    border-color: #f5bcc5;
    box-shadow: var(--shadow);
}

.report-card:hover::before {
    opacity: 1;
}

.report-card__icon {
    display: grid;
    width: 45px;
    height: 45px;
    place-items: center;
    border-radius: 12px;
    color: #fff;
    background: var(--red);
    box-shadow: 0 8px 18px rgba(227,18,53,.23);
    font-weight: 800;
}

.report-card__body {
    padding: 17px 0;
}

.report-card__body small {
    color: var(--red);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .13em;
    text-transform: uppercase;
}

.report-card h3 {
    margin: 5px 0 7px;
    font-size: 17px;
}

.report-card p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.report-card > a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid var(--line);
    color: var(--red);
    font-size: 13px;
    font-weight: 700;
}

.report-card > a i {
    display: grid;
    width: 30px;
    height: 30px;
    place-items: center;
    border-radius: 50%;
    background: var(--red-pale);
    font-size: 20px;
    font-style: normal;
}

.empty-state,
.report-placeholder {
    display: grid;
    min-height: 220px;
    place-content: center;
    gap: 5px;
    padding: 24px;
    border: 1px dashed #ccd2dc;
    border-radius: 16px;
    color: var(--muted);
    text-align: center;
    background: rgba(255,255,255,.55);
}

.empty-state[hidden] {
    display: none;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 22px;
    color: var(--muted);
    font-size: 12px;
}

.breadcrumb a:hover {
    color: var(--red);
}

.report-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 28px 30px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
}

.report-header h1 {
    margin: 5px 0;
    font-size: clamp(24px, 3vw, 35px);
}

.report-header p {
    margin: 0;
    color: var(--muted);
}

.readonly-badge {
    flex: 0 0 auto;
    padding: 8px 12px;
    border-radius: 999px;
    color: #087443;
    background: #e9fbf2;
    font-size: 11px;
    font-weight: 800;
}

.filter-panel {
    display: flex;
    align-items: end;
    gap: 14px;
    margin: 18px 0;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: var(--surface);
}

.field {
    display: grid;
    min-width: 0;
    gap: 7px;
}

.field > span {
    color: #344054;
    font-size: 12px;
    font-weight: 700;
}

.field input,
.field select {
    width: 100%;
    min-height: 46px;
    padding: 0 13px;
    border: 1px solid #d7dce4;
    border-radius: 10px;
    outline: 0;
    color: var(--ink);
    background: #fff;
}

.field input:focus,
.field select:focus {
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(227,18,53,.09);
}

.primary-button,
.secondary-button {
    display: inline-flex;
    min-height: 47px;
    align-items: center;
    justify-content: center;
    padding: 0 18px;
    border: 0;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 800;
}

.primary-button {
    color: #fff;
    background: var(--red);
}

.primary-button:hover {
    background: var(--red-dark);
}

.primary-button--compact {
    min-width: 145px;
}

.secondary-button {
    border: 1px solid var(--line);
    color: var(--ink);
    background: #fff;
}

.result-panel {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
}

.result-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 15px 18px;
    border-bottom: 1px solid var(--line);
}

.result-toolbar > div {
    display: grid;
}

.result-toolbar span {
    color: var(--muted);
    font-size: 11px;
}

.table-scroll {
    max-height: 62vh;
    overflow: auto;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    white-space: nowrap;
}

th,
td {
    padding: 12px 15px;
    border-bottom: 1px solid #edf0f4;
    text-align: left;
}

th {
    position: sticky;
    top: 0;
    z-index: 2;
    color: #475467;
    background: #f8f9fb;
    font-size: 11px;
    letter-spacing: .04em;
}

td {
    color: #344054;
    font-size: 12px;
}

tbody tr:hover td {
    background: #fff9fa;
}

.is-number {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.alert {
    margin: 15px 0;
    padding: 13px 15px;
    border-radius: 10px;
    font-size: 13px;
}

.alert--error {
    border: 1px solid #fecdd3;
    color: #a40e29;
    background: #fff1f2;
}

.login-page {
    min-height: 100vh;
    background: #fff;
}

.login-shell {
    display: grid;
    min-height: 100vh;
    grid-template-columns: minmax(360px, .9fr) minmax(480px, 1.1fr);
}

.login-visual {
    display: flex;
    min-height: 100vh;
    flex-direction: column;
    padding: clamp(30px, 5vw, 70px);
    color: #fff;
    background:
        radial-gradient(circle at 20% 78%, rgba(227, 18, 53, .31), transparent 28%),
        linear-gradient(150deg, #131e31, #080e18);
}

.brand--login {
    min-height: auto;
    padding: 0;
}

.login-visual__copy {
    margin: auto 0;
}

.login-visual__copy h1 {
    max-width: 610px;
    margin: 14px 0;
    font-size: clamp(37px, 5vw, 67px);
    line-height: 1.04;
    letter-spacing: -.05em;
}

.login-visual__copy p {
    max-width: 560px;
    color: #aab4c4;
    font-size: 16px;
}

.security-note {
    display: flex;
    gap: 13px;
    align-items: center;
    padding-top: 22px;
    border-top: 1px solid rgba(255,255,255,.09);
}

.security-note > span {
    display: grid;
    width: 33px;
    height: 33px;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: rgba(18,183,106,.22);
}

.security-note p {
    display: grid;
    margin: 0;
}

.security-note small {
    color: #98a2b3;
}

.login-form-wrap {
    display: grid;
    place-items: center;
    padding: 35px;
}

.login-form {
    display: grid;
    width: min(420px, 100%);
    gap: 19px;
}

.login-form__heading {
    margin-bottom: 10px;
}

.login-form__heading > span {
    color: var(--red);
    font-size: 12px;
    font-weight: 800;
}

.login-form__heading h2 {
    margin: 9px 0 6px;
    font-size: 30px;
}

.login-form__heading p {
    margin: 0;
    color: var(--muted);
}

.admin-grid {
    display: grid;
    grid-template-columns: minmax(300px, .75fr) minmax(460px, 1.25fr);
    gap: 18px;
}

.panel {
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
}

.panel h2 {
    margin: 0 0 18px;
    font-size: 18px;
}

.stack-form {
    display: grid;
    gap: 14px;
}

.user-list {
    display: grid;
    gap: 9px;
}

.user-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 0;
    border-bottom: 1px solid var(--line);
}

.user-row:last-child {
    border-bottom: 0;
}

.user-row > span:first-child {
    display: grid;
}

.user-row small {
    color: var(--muted);
}

.role-badge {
    padding: 6px 9px;
    border-radius: 999px;
    color: var(--red);
    background: var(--red-pale);
    font-size: 10px;
    font-weight: 800;
}

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

.error-card {
    width: min(540px, 100%);
    padding: 36px;
    border: 1px solid var(--line);
    border-radius: 18px;
    text-align: center;
    background: #fff;
    box-shadow: var(--shadow);
}

@media (max-width: 1120px) {
    .report-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

    .hero__stats {
        min-width: 0;
    }
}

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

    body.menu-open {
        overflow: hidden;
    }

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

    .scrim {
        position: fixed;
        inset: 0;
        z-index: 25;
        border: 0;
        opacity: 0;
        pointer-events: none;
        background: rgba(4, 9, 17, .55);
        transition: opacity .2s ease;
    }

    body.menu-open .scrim {
        display: block;
        opacity: 1;
        pointer-events: auto;
    }

    .main {
        padding-left: 0;
    }

    .mobile-menu {
        display: block;
    }

    .topbar {
        justify-content: flex-start;
        padding: 12px 18px;
    }

    .profile {
        margin-left: auto;
    }

    .profile__text {
        display: none;
    }

    .content {
        padding: 22px 17px 40px;
    }

    .toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .search {
        min-width: 0;
    }

    .filter-panel {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .primary-button--compact {
        grid-column: 1 / -1;
    }

    .admin-grid {
        grid-template-columns: 1fr;
    }

    .login-shell {
        grid-template-columns: 1fr;
    }

    .login-visual {
        min-height: 310px;
        padding: 30px;
    }

    .login-visual__copy {
        margin: 50px 0 30px;
    }

    .login-visual__copy h1 {
        font-size: 39px;
    }

    .login-form-wrap {
        padding: 45px 24px 60px;
    }
}

@media (max-width: 580px) {
    .report-grid {
        grid-template-columns: 1fr;
    }

    .hero {
        padding: 27px 22px;
        border-radius: 17px;
    }

    .hero__stats {
        grid-template-columns: 1fr;
    }

    .hero__stats span + span {
        border-top: 1px solid rgba(255,255,255,.1);
        border-left: 0;
    }

    .report-card {
        min-height: 220px;
    }

    .filter-panel {
        grid-template-columns: 1fr;
    }

    .primary-button--compact {
        grid-column: auto;
    }

    .report-header {
        align-items: flex-start;
        flex-direction: column;
        padding: 22px;
    }

    .result-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .result-toolbar .secondary-button {
        width: 100%;
    }

    .topbar__title small,
    .profile__avatar {
        display: none;
    }

    .topbar__title strong {
        max-width: 145px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition: none !important;
    }
}
