:root {
    color-scheme: light;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #172033;
    background: #eef1f5;
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    margin: 0;
    display: grid;
    place-items: center;
    padding: 2rem;
}

.shell {
    width: min(42rem, 100%);
    padding: clamp(2rem, 7vw, 4rem);
    border: 1px solid #d9dee8;
    border-radius: 1rem;
    background: #fff;
    box-shadow: 0 1rem 3rem rgb(23 32 51 / 10%);
}

.eyebrow {
    margin: 0 0 0.75rem;
    color: #ba1b2f;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

h1 {
    margin: 0;
    font-size: clamp(2rem, 8vw, 4rem);
    line-height: 1;
}

.lead {
    margin: 1.25rem 0 2rem;
    color: #505a6d;
    font-size: 1.05rem;
    line-height: 1.6;
}

.check-form {
    display: grid;
    gap: 1rem;
}

.check-form label {
    color: #394357;
    font-weight: 600;
}

.check-form input {
    width: 100%;
    margin-top: 0.4rem;
    padding: 0.8rem 0.9rem;
    border: 1px solid #bbc3d1;
    border-radius: 0.5rem;
    font: inherit;
}

.check-form button {
    justify-self: start;
    padding: 0.75rem 1.1rem;
    border: 0;
    border-radius: 0.5rem;
    color: #fff;
    background: #172033;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.check-list {
    display: grid;
    gap: 0.75rem;
    margin: 1.5rem 0 0;
    padding: 0;
    list-style: none;
}

.check-list li {
    padding: 0.8rem 1rem;
    border-radius: 0.5rem;
    background: #eef7f1;
    color: #1f6539;
}

.error {
    padding: 0.8rem 1rem;
    border-radius: 0.5rem;
    color: #8d1727;
    background: #fff0f2;
}

.success {
    padding: 0.8rem 1rem;
    border-radius: 0.5rem;
    color: #1f6539;
    background: #eef7f1;
}

.field-error {
    display: block;
    margin-top: 0.35rem;
    color: #8d1727;
    font-weight: 500;
}

.auth-shell {
    width: min(34rem, 100%);
}

.backend-body {
    display: block;
    min-height: 100vh;
    padding: 0;
    background: #f4f6f9;
}

.backend-layout {
    display: grid;
    grid-template-columns: 17rem minmax(0, 1fr);
    min-height: 100vh;
}

.compact-bar,
.navigation-backdrop,
.sidebar-close-button {
    display: none;
}

.backend-sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 2rem 1.25rem 1.25rem;
    color: #fff;
    background: #172033;
}

.brand {
    display: grid;
    gap: 0.15rem;
    margin: 0 0 1.5rem;
    padding: 0 0.75rem;
    color: inherit;
    text-decoration: none;
}

.brand span {
    color: #f3a8b2;
    font-size: 0.68rem;
    font-weight: 650;
    letter-spacing: 0.04em;
}

.brand strong {
    font-size: 2rem;
    letter-spacing: -0.04em;
}

.work-mode-button {
    margin: 0 0.75rem 1.5rem;
    padding: 0.6rem 0.75rem;
    border: 1px solid rgb(255 255 255 / 20%);
    border-radius: 0.5rem;
    color: #d9dfeb;
    background: transparent;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 650;
    text-align: left;
    cursor: pointer;
}

.work-mode-button:hover {
    color: #fff;
    background: rgb(255 255 255 / 10%);
}

.backend-navigation {
    display: grid;
    gap: 0.35rem;
}

.backend-navigation a {
    padding: 0.75rem;
    border-radius: 0.55rem;
    color: #cbd2df;
    font-weight: 650;
    text-decoration: none;
}

.backend-navigation a:hover,
.backend-navigation a[aria-current="page"] {
    color: #fff;
    background: rgb(255 255 255 / 10%);
}

.backend-navigation a[aria-current="page"] {
    box-shadow: inset 0.2rem 0 #e8485f;
}

.sidebar-account {
    display: grid;
    gap: 0.2rem;
    margin-top: auto;
    padding: 1rem 0.75rem 0;
    border-top: 1px solid rgb(255 255 255 / 14%);
}

.sidebar-account span,
.sidebar-account small {
    color: #aeb7c8;
}

.sidebar-help {
    margin-bottom: 0.9rem;
    color: #d9dfeb;
    font-weight: 650;
    text-decoration: none;
}

.sidebar-help:hover,
.sidebar-help[aria-current="page"] {
    color: #fff;
    text-decoration: underline;
    text-underline-offset: 0.25rem;
}

.sidebar-account form {
    margin-top: 0.75rem;
}

.sidebar-logout {
    width: 100%;
    padding: 0.65rem 0.8rem;
    border: 1px solid rgb(255 255 255 / 24%);
    border-radius: 0.5rem;
    color: #fff;
    background: transparent;
    font: inherit;
    font-weight: 650;
    cursor: pointer;
}

.sidebar-logout:hover {
    background: rgb(255 255 255 / 10%);
}

.backend-main {
    width: min(76rem, 100%);
    margin: 0 auto;
    padding: clamp(2rem, 5vw, 4.5rem);
}

.backend-layout[data-sidebar="hidden"] {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
}

.backend-layout[data-sidebar="hidden"] .backend-sidebar {
    display: none;
}

.backend-layout[data-sidebar="hidden"] .compact-bar {
    position: sticky;
    top: 0;
    z-index: 15;
    display: flex;
    grid-column: 1 / -1;
    min-height: 3rem;
}

.backend-layout[data-sidebar="hidden"] .backend-main {
    width: 100%;
    padding: clamp(1.5rem, 3vw, 3rem);
}

.compact-bar {
    align-items: center;
    gap: 0.75rem;
    padding: 0 1rem;
    border-bottom: 1px solid #dfe3eb;
    background: #fff;
    box-shadow: 0 0.2rem 1rem rgb(23 32 51 / 5%);
}

.compact-menu-button {
    display: grid;
    width: 2.25rem;
    height: 2.25rem;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 0.45rem;
    color: #172033;
    background: #eef1f5;
    font: inherit;
    font-size: 1.1rem;
    cursor: pointer;
}

.compact-brand {
    color: #172033;
    font-weight: 750;
    text-decoration: none;
}

.compact-page-title {
    min-width: 0;
    padding-left: 0.75rem;
    border-left: 1px solid #d9dee8;
    overflow: hidden;
    color: #687287;
    font-size: 0.88rem;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: clamp(2.2rem, 5vw, 3.6rem);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.dashboard-card,
.content-panel {
    padding: 1.4rem;
    border: 1px solid #dfe3eb;
    border-radius: 0.9rem;
    background: #fff;
    box-shadow: 0 0.5rem 1.5rem rgb(23 32 51 / 5%);
}

.dashboard-card-highlight {
    border-color: #d3e8da;
    background: #eef7f1;
}

.dashboard-card h2,
.content-panel h2 {
    margin: 0.25rem 0 0.65rem;
    font-size: 1.2rem;
}

.dashboard-card p,
.content-panel p {
    margin: 0;
    color: #566176;
    line-height: 1.55;
}

.card-label,
.panel-kicker {
    color: #ba1b2f !important;
    font-size: 0.72rem;
    font-weight: 750;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.content-panel {
    margin-top: 1rem;
}

.quick-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    margin-top: 1rem;
}

.quick-links a {
    padding: 0.65rem 0.85rem;
    border: 1px solid #d9dee8;
    border-radius: 0.5rem;
    color: #172033;
    font-weight: 650;
    text-decoration: none;
}

.quick-links a:hover {
    border-color: #aeb7c8;
    background: #f4f6f9;
}

.journal-intro {
    margin-top: 0;
}

.journal-list {
    display: grid;
    gap: 0.85rem;
    margin-top: 1rem;
}

.journal-entry {
    padding: 1.25rem 1.4rem;
    border: 1px solid #dfe3eb;
    border-radius: 0.9rem;
    background: #fff;
    box-shadow: 0 0.5rem 1.5rem rgb(23 32 51 / 4%);
}

.journal-entry header {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.65rem;
}

.journal-entry time {
    color: #172033;
    font-weight: 750;
}

.journal-entry header span {
    color: #7a8497;
    font-size: 0.78rem;
}

.journal-entry p {
    margin: 0;
    overflow-wrap: anywhere;
    color: #465166;
    line-height: 1.55;
    white-space: pre-wrap;
}

.empty-state code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.backend-footer {
    margin-top: 3rem;
    color: #7a8497;
    font-size: 0.8rem;
}

@media (max-width: 850px) {
    .backend-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto minmax(0, 1fr);
    }

    .compact-bar,
    .backend-layout[data-sidebar="hidden"] .compact-bar {
        position: sticky;
        top: 0;
        z-index: 15;
        display: flex;
        min-height: 3rem;
    }

    .backend-sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: min(19rem, calc(100vw - 3rem));
        height: 100vh;
        padding: 1.25rem;
        overflow-y: auto;
        visibility: hidden;
        pointer-events: none;
        transform: translateX(-100%);
        transition: transform 160ms ease-out;
    }

    .backend-layout[data-mobile-navigation="open"] .backend-sidebar,
    .backend-layout[data-sidebar="hidden"][data-mobile-navigation="open"] .backend-sidebar {
        display: flex;
        visibility: visible;
        pointer-events: auto;
        transform: translateX(0);
    }

    .sidebar-close-button {
        position: absolute;
        top: 1rem;
        right: 1rem;
        display: grid;
        width: 2.25rem;
        height: 2.25rem;
        place-items: center;
        padding: 0;
        border: 1px solid rgb(255 255 255 / 20%);
        border-radius: 0.45rem;
        color: #fff;
        background: transparent;
        font: inherit;
        font-size: 1.5rem;
        cursor: pointer;
    }

    .backend-layout[data-mobile-navigation="open"] .navigation-backdrop {
        position: fixed;
        inset: 0;
        z-index: 10;
        display: block;
        background: rgb(23 32 51 / 48%);
    }

    .brand {
        margin-bottom: 1rem;
    }

    .work-mode-button {
        display: none;
    }

    .backend-navigation {
        grid-template-columns: 1fr;
    }

    .sidebar-account {
        margin-top: 1rem;
    }

    .sidebar-account form {
        max-width: 12rem;
    }

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

    .backend-main,
    .backend-layout[data-sidebar="hidden"] .backend-main {
        width: 100%;
        padding: 2rem 1.5rem 3rem;
    }
}

@media (max-width: 480px) {
    body {
        padding: 1rem;
    }

    .backend-body {
        padding: 0;
    }

    .backend-main,
    .backend-layout[data-sidebar="hidden"] .backend-main {
        padding: 1.5rem 1rem 2rem;
    }

    .journal-entry header {
        display: grid;
        gap: 0.2rem;
        justify-content: start;
    }
}

@media (prefers-reduced-motion: reduce) {
    .backend-sidebar {
        transition: none;
    }
}
