:root {
    color-scheme: light;
    --paper: #f8f4f2;
    --surface: #fffdfc;
    --surface-muted: #f1e9e6;
    --ink: #211f1e;
    --muted: #665f5c;
    --rule: #ded4d0;
    --rust: #bd5236;
    --rust-dark: #913b27;
    --success: #356a4c;
    --focus: #176c84;
    --radius: 8px;
    font-family: "Avenir Next", "Helvetica Neue", sans-serif;
    color: var(--ink);
    background: var(--paper);
    font-synthesis: none;
    text-rendering: optimizeLegibility;
}

* {
    box-sizing: border-box;
}

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    background: var(--paper);
    color: var(--ink);
}

::selection {
    color: #fff;
    background: var(--rust-dark);
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-thumb {
    border: 3px solid var(--paper);
    border-radius: 8px;
    background: #9e8d86;
}

a {
    color: inherit;
}

button,
input {
    font: inherit;
}

:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 3px;
}

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

.login-wrap {
    width: min(100%, 430px);
    animation: appear 500ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.brand-lockup {
    display: inline-flex;
    align-items: center;
    gap: 13px;
    text-decoration: none;
}

.brand-mark {
    display: grid;
    width: 50px;
    aspect-ratio: 1;
    place-items: center;
    border: 2px solid var(--rust);
    color: var(--rust);
    font-size: 17px;
    font-weight: 800;
    letter-spacing: 0;
}

.brand-name {
    display: grid;
    gap: 1px;
    color: var(--ink);
    font-size: 16px;
    font-weight: 700;
    line-height: 1.05;
}

.brand-name span {
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.login-panel {
    margin-top: 46px;
    padding: 34px;
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    background: var(--surface);
}

h1,
h2,
.module-title {
    font-family: "Iowan Old Style", "Baskerville", "Times New Roman", serif;
    font-weight: 500;
}

.login-panel h1,
.page-heading h1 {
    margin: 0;
    font-size: 34px;
    line-height: 1.14;
}

.login-intro,
.page-heading p {
    margin: 11px 0 0;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.6;
}

.login-form {
    display: grid;
    gap: 10px;
    margin-top: 28px;
}

.login-form label {
    margin-top: 7px;
    font-size: 13px;
    font-weight: 700;
}

.login-form input:not([type="hidden"]) {
    width: 100%;
    min-height: 46px;
    padding: 10px 12px;
    border: 1px solid #b9aaa4;
    border-radius: 4px;
    background: #fff;
    color: var(--ink);
}

.login-form input:focus-visible {
    border-color: var(--focus);
}

.button {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    padding: 9px 15px;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease;
}

.button--primary {
    min-height: 48px;
    margin-top: 13px;
    background: var(--rust);
    color: #fff;
}

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

.button--quiet {
    border-color: var(--rule);
    background: transparent;
    color: var(--ink);
}

.button--quiet:hover {
    border-color: var(--rust);
    color: var(--rust-dark);
}

.notice {
    margin: 22px 0 0;
    padding: 12px 14px;
    border: 1px solid #c8b5ac;
    border-radius: 4px;
    color: #493f3b;
    font-size: 13px;
    line-height: 1.55;
}

.notice code {
    font-size: 12px;
}

.notice--error {
    border-color: #c88570;
    background: #fff7f4;
    color: #762f20;
}

.login-footer {
    margin: 19px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.app-shell {
    display: grid;
    min-height: 100vh;
    grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
    display: flex;
    min-height: 100vh;
    flex-direction: column;
    padding: 28px 20px 22px;
    border-right: 1px solid var(--rule);
    background: #f4eeeb;
}

.sidebar .brand-lockup {
    padding: 4px 5px 27px;
}

.sidebar .brand-mark {
    width: 42px;
    font-size: 14px;
}

.sidebar .brand-name {
    font-size: 14px;
}

.nav-heading {
    margin: 25px 10px 9px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
}

.main-nav {
    display: grid;
    gap: 3px;
}

.nav-link {
    display: flex;
    min-height: 42px;
    align-items: center;
    padding: 9px 11px;
    border-radius: 4px;
    color: #393432;
    font-size: 14px;
    text-decoration: none;
    transition: background-color 140ms ease, color 140ms ease;
}

.nav-link:hover {
    background: #e9ddd8;
}

.nav-link.is-active {
    background: var(--surface);
    color: var(--rust-dark);
    font-weight: 700;
}

.sidebar-note {
    margin-top: auto;
    padding: 15px 10px 0;
    border-top: 1px solid var(--rule);
    color: var(--muted);
    font-size: 12px;
    line-height: 1.55;
}

.workspace {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.topbar {
    display: flex;
    min-height: 76px;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 14px clamp(24px, 5vw, 72px);
    border-bottom: 1px solid var(--rule);
    background: var(--surface);
}

.topbar-brand {
    color: var(--rust-dark);
    font-size: 16px;
    font-weight: 800;
    text-decoration: none;
}

.topbar-brand span {
    color: var(--ink);
    font-weight: 500;
}

.account-actions {
    display: flex;
    align-items: center;
    gap: 17px;
}

.account-name {
    color: var(--muted);
    font-size: 13px;
}

.account-actions form {
    margin: 0;
}

.page-content {
    width: min(100%, 1120px);
    flex: 1;
    padding: 55px clamp(24px, 5vw, 72px) 64px;
    animation: appear 360ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.page-heading {
    margin-bottom: 34px;
}

.page-heading h1 {
    font-size: clamp(31px, 3vw, 42px);
}

.module-list {
    border-top: 1px solid var(--rule);
}

.module-row {
    display: flex;
    min-height: 92px;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
    padding: 18px 7px;
    border-bottom: 1px solid var(--rule);
    text-decoration: none;
    transition: transform 160ms ease, color 160ms ease;
}

.module-row:hover {
    transform: translateX(5px);
    color: var(--rust-dark);
}

.module-copy {
    display: grid;
    gap: 5px;
}

.module-title {
    font-size: 21px;
    line-height: 1.2;
}

.module-description {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.module-open,
.text-link {
    flex: 0 0 auto;
    color: var(--rust-dark);
    font-size: 13px;
    font-weight: 700;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

.empty-state {
    padding: 23px 0;
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
    color: var(--muted);
    font-size: 14px;
}

.demo-note {
    margin: -10px 0 15px;
    color: var(--muted);
    font-size: 12px;
}

.table-wrap {
    overflow-x: auto;
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
}

.legacy-module-frame {
    display: block;
    width: 100%;
    height: min(78vh, 780px);
    min-height: 480px;
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    background: #fff;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.data-table th,
.data-table td {
    padding: 16px 13px;
    border-bottom: 1px solid #e9e1de;
    font-size: 13px;
    line-height: 1.45;
    vertical-align: middle;
}

.data-table thead th {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
}

.data-table tbody th {
    font-weight: 600;
}

.data-table tbody tr:last-child th,
.data-table tbody tr:last-child td {
    border-bottom: 0;
}

.reference-cell {
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.quantity-cell {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.status {
    display: inline-flex;
    min-height: 26px;
    align-items: center;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.status--ok {
    background: #e8f1eb;
    color: #28553b;
}

.status--attention {
    background: #f6e7e0;
    color: #762f20;
}

.workspace-footer {
    padding: 17px clamp(24px, 5vw, 72px);
    border-top: 1px solid var(--rule);
    color: var(--muted);
    font-size: 11px;
}

.workspace-footer span {
    padding: 0 5px;
    color: var(--rust);
}

@keyframes appear {
    from {
        opacity: 0;
        transform: translateY(7px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 760px) {
    .app-shell {
        grid-template-columns: minmax(0, 1fr);
        align-content: start;
    }

    .sidebar {
        min-height: auto;
        padding: 14px 19px 0;
        border-right: 0;
        border-bottom: 1px solid var(--rule);
    }

    .sidebar .brand-lockup {
        padding: 2px 2px 13px;
    }

    .sidebar .brand-mark {
        width: 36px;
        font-size: 12px;
    }

    .nav-heading,
    .sidebar-note {
        display: none;
    }

    .main-nav {
        display: flex;
        overflow-x: auto;
        gap: 5px;
        margin: 0 -19px;
        padding: 0 19px 10px;
        scrollbar-width: thin;
    }

    .nav-link {
        min-height: 37px;
        flex: 0 0 auto;
        padding: 7px 10px;
        white-space: nowrap;
    }

    .topbar {
        min-height: 59px;
        padding: 10px 19px;
    }

    .account-actions {
        gap: 9px;
    }

    .account-name {
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .button--quiet {
        min-height: 36px;
        padding: 7px 9px;
    }

    .page-content {
        padding: 36px 19px 48px;
    }

    .page-heading {
        margin-bottom: 27px;
    }

    .module-row {
        min-height: 82px;
    }

    .workspace-footer {
        padding: 15px 19px;
    }
}

@media (max-width: 520px) {
    .login-page {
        align-items: start;
        padding: 54px 18px 30px;
    }

    .login-panel {
        margin-top: 35px;
        padding: 25px 21px;
    }

    .login-panel h1 {
        font-size: 30px;
    }

    .account-name {
        display: none;
    }

    .data-table {
        min-width: 640px;
    }

    .legacy-module-frame {
        height: 68vh;
        min-height: 420px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}