:root {
    --csg-background: #070809;
    --csg-surface: #111317;
    --csg-surface-raised: #191c21;
    --csg-surface-soft: #15171c;
    --csg-border: #30343c;
    --csg-border-gold: rgb(225 197 100 / 35%);
    --csg-text: #f7f7f4;
    --csg-muted: #a4a8b1;
    --csg-accent: #e1c564;
    --csg-accent-hover: #f0d779;
    --csg-accent-soft: rgb(225 197 100 / 12%);
    --csg-success: #42d392;
    --csg-danger: #ff6874;
    --csg-radius: 14px;
    --csg-shadow: 0 18px 45px rgb(0 0 0 / 30%);
}

* {
    box-sizing: border-box;
}

html {
    color-scheme: dark;
    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--csg-text);
    background:
        radial-gradient(
            circle at top right,
            rgb(225 197 100 / 8%),
            transparent 34rem
        ),
        var(--csg-background);
}

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

a {
    color: var(--csg-accent);
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 0;
    font-size: clamp(1.5rem, 3vw, 2rem);
}

h2 {
    margin-bottom: 0;
    font-size: 1.2rem;
}

h3 {
    margin-bottom: 0;
}

.eyebrow {
    margin-bottom: 0.35rem;
    color: var(--csg-accent);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.lead {
    max-width: 38rem;
    color: var(--csg-muted);
    line-height: 1.7;
}

/*
 * Buttons
 */

.button {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    padding: 0.65rem 1rem;
    border: 1px solid transparent;
    border-radius: 9px;
    font-weight: 750;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition:
        color 140ms ease,
        background 140ms ease,
        border-color 140ms ease,
        transform 140ms ease;
}

.button:hover {
    transform: translateY(-1px);
}

.button-primary {
    color: #10100d;
    background: var(--csg-accent);
    border-color: var(--csg-accent);
}

.button-primary:hover,
.button-primary:focus-visible {
    color: #10100d;
    background: var(--csg-accent-hover);
    border-color: var(--csg-accent-hover);
}

.button-secondary {
    color: var(--csg-text);
    background: transparent;
    border-color: var(--csg-border);
}

.button-secondary:hover,
.button-secondary:focus-visible {
    color: var(--csg-accent-hover);
    background: var(--csg-accent-soft);
    border-color: var(--csg-border-gold);
}

.button:focus-visible {
    outline: 3px solid rgb(225 197 100 / 35%);
    outline-offset: 3px;
}

/*
 * Login
 */

.login-layout {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 1.5rem;
}

.login-panel {
    width: min(100%, 580px);
    padding: clamp(1.5rem, 5vw, 3rem);
    border: 1px solid var(--csg-border);
    border-radius: var(--csg-radius);
    background:
        linear-gradient(
            145deg,
            rgb(225 197 100 / 5%),
            transparent 45%
        ),
        var(--csg-surface);
    box-shadow: var(--csg-shadow);
}

.login-panel .button {
    margin-top: 0.5rem;
}

.notice {
    margin: 1rem 0;
    padding: 0.85rem 1rem;
    border-radius: 9px;
}

.notice-error {
    color: #ffc0c5;
    background: rgb(255 104 116 / 10%);
    border: 1px solid rgb(255 104 116 / 45%);
}

/*
 * Global administration header
 */

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 1.25rem clamp(1rem, 4vw, 3rem);
    background: rgb(7 8 9 / 94%);
    border-bottom: 1px solid var(--csg-border);
}

.account {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--csg-muted);
}

.account form {
    margin: 0;
}

/*
 * Main page layout
 */

.dashboard {
    width: min(1400px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 2rem 0 4rem;
}

.intro,
.panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.intro {
    margin-bottom: 1.5rem;
}

.intro p:last-child {
    margin-top: 0.55rem;
    margin-bottom: 0;
    color: var(--csg-muted);
    line-height: 1.6;
}

.health {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    color: var(--csg-muted);
    white-space: nowrap;
}

.health-dot {
    width: 0.65rem;
    height: 0.65rem;
    border-radius: 50%;
    background: var(--csg-success);
    box-shadow: 0 0 14px var(--csg-success);
}

/*
 * Statistics
 */

.statistics {
    display: grid;
    grid-template-columns:
        repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.statistic,
.panel {
    border: 1px solid var(--csg-border);
    border-radius: var(--csg-radius);
    background: var(--csg-surface);
}

.statistic {
    display: flex;
    min-height: 130px;
    flex-direction: column;
    justify-content: space-between;
    padding: 1.15rem;
    color: var(--csg-muted);
}

.statistic strong {
    color: var(--csg-accent);
    font-size: 2rem;
}

.statistic:hover {
    border-color: var(--csg-border-gold);
}

/*
 * Panels
 */

.panel {
    margin-top: 1rem;
    overflow: hidden;
}

.panel-heading {
    padding: 1.15rem;
    background:
        linear-gradient(
            90deg,
            rgb(225 197 100 / 4%),
            transparent 35%
        );
    border-bottom: 1px solid var(--csg-border);
}

.schema {
    color: var(--csg-muted);
    font-size: 0.85rem;
}

/*
 * Tables
 */

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

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 0.9rem 1.15rem;
    border-bottom: 1px solid var(--csg-border);
    text-align: left;
    white-space: nowrap;
}

th {
    color: var(--csg-muted);
    background: rgb(255 255 255 / 1%);
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

tbody tr {
    transition: background 140ms ease;
}

tbody tr:hover {
    background: var(--csg-surface-raised);
}

tbody tr:last-child td {
    border-bottom: 0;
}

/*
 * General statuses
 */

.status {
    display: inline-flex;
    padding: 0.3rem 0.6rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 750;
}

.status-active {
    color: #9df0c8;
    background: rgb(66 211 146 / 13%);
}

.status-completed,
.status-resolved,
.status-expired,
.status-revoked,
.status-cancelled {
    color: var(--csg-muted);
    background: rgb(156 168 184 / 12%);
}

.case-number {
    color: var(--csg-accent);
    font-weight: 800;
}

.empty {
    padding: 2rem;
    color: var(--csg-muted);
    text-align: center;
}

/*
 * Responsive layout
 */

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

    .site-header,
    .intro {
        align-items: flex-start;
        flex-direction: column;
    }

    .account {
        width: 100%;
        justify-content: space-between;
    }
}

@media (max-width: 520px) {
    .dashboard {
        width: min(100% - 1rem, 1400px);
        padding-top: 1rem;
    }

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

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

    .account form,
    .account .button {
        width: 100%;
    }

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