:root {
    --theme-dark: #172033;
    --theme-accent: #1f9d8a;
    --theme-accent-contrast: #ffffff;
    --theme-accent-hover: #167c6d;
    --theme-page: #f4f7fb;
    --theme-card: #ffffff;
    --theme-line: #d8e1ec;
    --theme-muted: #637083;
    --theme-ink: #172033;
    --success: #177a57;
    --warning: #9b6a1e;
    --danger: #bf354b;
    --shadow: 0 20px 54px rgba(23, 32, 51, 0.12);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    min-height: 100vh;
    font-family: "Aptos", "Segoe UI", Arial, sans-serif;
    color: var(--theme-ink);
    background: var(--theme-page);
}

a {
    color: inherit;
}

button,
input,
select,
textarea {
    font: inherit;
}

.public-auth-page {
    background:
        linear-gradient(135deg, rgba(31, 157, 138, 0.16), transparent 32%),
        linear-gradient(225deg, rgba(217, 154, 43, 0.14), transparent 28%),
        var(--theme-page);
}

.auth-shell {
    width: min(1180px, calc(100% - 32px));
    min-height: 100vh;
    margin: 0 auto;
    padding: 28px 0;
    display: grid;
    grid-template-columns: minmax(0, 0.98fr) minmax(390px, 0.86fr);
    gap: 24px;
    align-items: center;
}

.auth-left,
.auth-card,
.panel,
.fan-hero {
    border: 1px solid var(--theme-line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: var(--shadow);
}

.auth-left {
    min-height: 0;
    display: grid;
    align-content: center;
    gap: 18px;
    padding: clamp(24px, 3.4vw, 38px);
    background:
        linear-gradient(135deg, rgba(233, 250, 219, 0.92), rgba(255, 249, 234, 0.92)),
        #fff;
}

.auth-left h1,
.fan-hero h2 {
    margin: 0;
    max-width: 9.5ch;
    font-size: clamp(2.7rem, 4.7vw, 4.9rem);
    line-height: 0.97;
}

.auth-topline {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 16px;
    align-items: start;
}

.auth-logo {
    width: 74px;
    height: 74px;
    display: grid;
    place-items: center;
    border-radius: 22px;
    background: linear-gradient(135deg, var(--theme-accent), #f59e0b);
    color: #fff;
    font-size: 1.65rem;
    font-weight: 950;
    box-shadow: 0 18px 34px rgba(31, 157, 138, 0.22);
}

.auth-card {
    padding: 28px;
    min-height: 0;
    display: grid;
    align-content: center;
}

.auth-card h2,
.panel h3 {
    margin: 0 0 18px;
}

.lede,
.app-intro,
.muted,
.auth-bullets span,
.brand p,
.user-badge span,
.mini-row span,
.data-table td span,
.content-item p {
    color: var(--theme-muted);
}

.auth-bullets {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
    display: grid;
    gap: 10px;
}

.auth-bullets li,
.auth-stats span {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    padding: 12px 14px;
    border: 1px solid var(--theme-line);
    border-radius: 8px;
    background: #fff;
}

.auth-bullets li::before {
    content: "✓";
    width: 32px;
    height: 32px;
    display: inline-grid;
    place-items: center;
    border-radius: 10px;
    background: #d8e970;
    color: #172033;
    font-weight: 900;
}

.auth-bullets strong,
.auth-bullets span {
    grid-column: 2;
}

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

.auth-info-card {
    padding: 14px 16px;
    border: 1px solid var(--theme-line);
    border-radius: 8px;
    background: #fff;
    text-align: center;
    font-size: 1.05rem;
}

.secure-label {
    margin: 0 0 12px;
    color: var(--theme-muted);
    text-align: right;
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.auth-card > h2 {
    margin-bottom: 4px;
    font-size: clamp(2rem, 2vw, 2.55rem);
}

.auth-card > .muted {
    margin: 0 0 22px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--theme-line);
}

.auth-links {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    margin-top: 14px;
    color: var(--theme-muted);
}

.auth-links a {
    color: var(--theme-ink);
    font-weight: 900;
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
}

.powered-by {
    margin-top: 42px;
    padding-top: 18px;
    border-top: 1px solid var(--theme-line);
    display: grid;
    gap: 6px;
}

.powered-by span {
    color: var(--theme-muted);
    font-size: 0.74rem;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.powered-by strong {
    color: #5a6472;
    font-size: 1.45rem;
    letter-spacing: -0.04em;
}

.reset-link {
    overflow-wrap: anywhere;
    padding: 12px;
    border: 1px solid var(--theme-line);
    border-radius: 8px;
    background: #f8fafc;
}

.auth-stats span {
    font-weight: 800;
}

.eyebrow,
.brand-label {
    margin: 0;
    color: var(--theme-accent);
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

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

.field {
    display: grid;
    gap: 7px;
}

.field span,
.check {
    font-weight: 700;
    font-size: 0.94rem;
}

.input {
    width: 100%;
    min-height: 46px;
    border: 1px solid var(--theme-line);
    border-radius: 8px;
    padding: 10px 12px;
    background: #fff;
    color: var(--theme-ink);
}

textarea.input {
    resize: vertical;
}

.input:focus {
    outline: 3px solid rgba(31, 157, 138, 0.16);
    border-color: var(--theme-accent);
}

.input-large {
    min-height: 72px;
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.input-money {
    width: 96px;
    min-height: 38px;
    padding: 8px;
}

.input-compact {
    min-height: 38px;
    padding: 8px;
}

.input-reason {
    min-height: 38px;
    min-width: 180px;
    margin-top: 6px;
    padding: 8px;
}

.colour-control {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 8px;
    align-items: center;
}

.colour-swatch {
    width: 52px;
    height: 46px;
    padding: 4px;
    border: 1px solid var(--theme-line);
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    padding: 10px 16px;
    border: 0;
    border-radius: 8px;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
}

.btn-primary {
    background: #86c934;
    color: #fff;
    color: #111827;
}

.btn-primary:hover {
    background: var(--theme-accent-hover);
}

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

.btn-small {
    min-height: 36px;
    padding: 8px 12px;
    font-size: 0.9rem;
}

.alert {
    margin: 0 0 16px;
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid rgba(191, 53, 75, 0.22);
    background: #fff1f3;
    color: #8d2031;
    font-weight: 700;
}

.alert-success {
    border-color: rgba(23, 122, 87, 0.22);
    background: #eefaf4;
    color: #115d40;
}

.alert-warning {
    border-color: rgba(155, 106, 30, 0.24);
    background: #fff7e6;
    color: #7a5115;
}

.app-shell {
    width: min(1480px, calc(100% - 28px));
    min-height: 100vh;
    margin: 0 auto;
    padding: 22px 0 40px;
    display: grid;
    grid-template-columns: 312px minmax(0, 1fr);
    gap: 22px;
}

.app-sidebar {
    position: sticky;
    top: 16px;
    height: fit-content;
    display: grid;
    gap: 22px;
    padding: 20px;
    border-radius: 8px;
    background: linear-gradient(180deg, var(--theme-dark), #0f1728);
    color: #fff;
    box-shadow: var(--shadow);
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand h1 {
    margin: 0;
    font-size: 1.25rem;
    line-height: 1.1;
}

.brand p {
    margin: 4px 0 0;
}

.brand-mark,
.brand-logo-wrap {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    background: var(--theme-accent);
    color: #fff;
    font-weight: 900;
}

.brand-logo-wrap {
    background: #fff;
    padding: 8px;
}

.brand-logo-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.app-sidebar__brand {
    display: grid;
    gap: 14px;
}

.sidebar-logout {
    justify-self: start;
}

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

.app-nav__link {
    display: grid;
    gap: 4px;
    padding: 13px 14px;
    border-radius: 8px;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.app-nav__link span {
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.88rem;
}

.app-nav__link.is-active {
    background: var(--theme-accent);
    color: var(--theme-accent-contrast);
}

.app-nav__link.is-active span {
    color: var(--theme-accent-contrast);
    opacity: 0.78;
}

.app-main {
    display: grid;
    align-content: start;
    gap: 20px;
}

.app-topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    padding: 24px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid var(--theme-line);
}

.app-title {
    margin: 6px 0 0;
    font-size: clamp(2rem, 3vw, 3.4rem);
    line-height: 1;
}

.app-intro {
    margin: 10px 0 0;
    max-width: 760px;
}

.user-badge {
    min-width: 160px;
    display: grid;
    gap: 4px;
    padding: 12px 14px;
    border: 1px solid var(--theme-line);
    border-radius: 8px;
    background: #f8fafc;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
}

.stat-card {
    min-width: 0;
    display: grid;
    gap: 6px;
    padding: 18px;
    border: 1px solid var(--theme-line);
    border-radius: 8px;
    background: #fff;
}

.stat-card span {
    color: var(--theme-muted);
    font-weight: 800;
    font-size: 0.82rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.stat-card strong {
    font-size: clamp(1.5rem, 2.5vw, 2.4rem);
}

.panel {
    padding: 20px;
}

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

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

.split-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

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

.filter-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
    gap: 12px;
    align-items: end;
}

.filter-actions,
.top-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.table-wrap {
    width: 100%;
    overflow: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

.data-table th,
.data-table td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--theme-line);
    text-align: left;
    vertical-align: middle;
}

.data-table th {
    color: var(--theme-muted);
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.pill {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 4px 9px;
    border-radius: 999px;
    background: rgba(31, 157, 138, 0.12);
    color: var(--theme-accent-hover);
    font-weight: 800;
    font-size: 0.82rem;
}

.scan-panel {
    grid-column: span 2;
}

.mini-list {
    display: grid;
    gap: 10px;
}

.mini-row {
    display: grid;
    gap: 3px;
    padding: 12px;
    border: 1px solid var(--theme-line);
    border-radius: 8px;
    background: #fff;
}

.mini-row-actions {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
}

.check {
    display: flex;
    align-items: center;
    gap: 8px;
}

.fan-shell {
    width: min(1180px, calc(100% - 28px));
    margin: 0 auto;
    padding: 22px 0 40px;
    display: grid;
    gap: 20px;
}

.fan-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid var(--theme-line);
}

.fan-hero {
    padding: clamp(28px, 5vw, 56px);
}

.content-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.content-item {
    padding: 16px;
    border: 1px solid var(--theme-line);
    border-radius: 8px;
    background: #fff;
}

.content-item h4 {
    margin: 12px 0 8px;
}

@media (max-width: 1100px) {
    .app-shell,
    .auth-shell {
        grid-template-columns: 1fr;
    }

    .app-sidebar {
        position: static;
    }

    .stats-grid,
    .content-grid,
    .quad-grid,
    .filter-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .scan-panel {
        grid-column: auto;
    }
}

@media (max-width: 680px) {
    .stats-grid,
    .content-grid,
    .split-grid,
    .quad-grid,
    .filter-grid,
    .auth-stats,
    .content-list {
        grid-template-columns: 1fr;
    }

    .app-topbar,
    .fan-header {
        flex-direction: column;
        align-items: stretch;
    }

    .auth-left {
        min-height: 0;
    }
}

@media print {
    .app-sidebar,
    .app-topbar,
    .btn {
        display: none !important;
    }

    .app-shell,
    .app-main,
    .panel {
        display: block;
        width: 100%;
        padding: 0;
        margin: 0;
        box-shadow: none;
        border: 0;
    }
}
