/* Colours, type, and sizes come from tokens.css, which loads first. */

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    overflow: hidden;
    background: var(--page);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    font-weight: var(--weight-regular);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

.app-loader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: grid;
    place-items: center;
    background: var(--color-bg);
    opacity: 1;
    visibility: visible;
    transition: opacity 180ms ease, visibility 180ms ease;
}

.app-loader img {
    display: block;
    width: 72px;
    height: 72px;
}

.app-loader.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.app-loader--ajax {
    z-index: 9000;
    background: color-mix(in srgb, var(--page) 88%, transparent);
    backdrop-filter: blur(1px);
}

.app-loader--ajax img {
    width: 52px;
    height: 52px;
}

/* `backwards`, not `both`: a transform left on .app after the animation makes
   it the containing block for every position:fixed descendant, which throws
   dropdowns and popovers off by the page's own offset. */
.app.is-ajax-entering {
    animation: inventiq-ajax-enter 150ms ease-out backwards;
}

@keyframes inventiq-ajax-enter {
    from {
        opacity: .55;
        transform: translateY(2px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }

}

.ajax-focus-target:focus {
    outline: none;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (prefers-reduced-motion: reduce) {
    .app-loader {
        transition: none;
    }

    .app.is-ajax-entering {
        animation: none;
    }

}

a {
    color: var(--link);
    text-decoration: none;
}

a:hover {
    color: var(--link-hover);
    text-decoration: underline;
}

button,
input,
select {
    font: inherit;
}

.icon {
    display: inline-block;
    width: 1em;
    height: 1em;
    flex: none;
    vertical-align: -.125em;
    overflow: visible;
}

.datepicker {
    position: relative;
    width: 100%;
}

.datepicker-input {
    width: 100%;
    padding-right: 32px !important;
    background: var(--panel-bg);
    color: var(--text);
    cursor: pointer;
}

.datepicker-toggle {
    position: absolute;
    top: 1px;
    right: 1px;
    bottom: 1px;
    width: 30px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--icon);
    cursor: pointer;
}

.datepicker.is-open .datepicker-toggle,
.datepicker-toggle:hover {
    color: var(--link);
}

.datepicker-panel {
    position: absolute;
    z-index: 120;
    top: calc(100% + 3px);
    left: 0;
    width: 252px;
    padding: 9px;
    background: var(--panel-bg);
    border: 1px solid var(--line-dark);
    box-shadow: 0 7px 18px rgba(0, 0, 0, .18);
}

.datepicker-panel[hidden] {
    display: none;
}

.datepicker-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 7px;
}

.datepicker-title {
    font-size: 12px;
}

.datepicker-nav {
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    background: var(--button-bg);
    color: var(--text);
    cursor: pointer;
}

.datepicker-nav:hover {
    background: var(--button-hover);
}

.datepicker-weekdays,
.datepicker-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.datepicker-weekdays span {
    padding: 4px 0;
    color: var(--muted);
    text-align: center;
    font-size: 10px;
    font-weight: 700;
}

.datepicker-day {
    min-height: 28px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 11px;
    cursor: pointer;
}

.datepicker-day.is-empty {
    cursor: default;
}

.datepicker-day:not(.is-empty):hover {
    background: var(--row-hover);
    border-color: var(--line-soft);
}

.datepicker-day.is-today {
    border-color: var(--line-dark);
    font-weight: 700;
}

.datepicker-day.is-selected {
    background: var(--top-accent);
    border-color: color-mix(in srgb, var(--top-accent) 70%, black);
    color: var(--color-on-primary);
    font-weight: 700;
}

.datepicker-actions {
    display: flex;
    justify-content: space-between;
    gap: 6px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--line-soft);
}

.datepicker-action {
    padding: 4px 9px;
    border: 1px solid var(--line);
    background: var(--button-bg);
    color: var(--text);
    font: inherit;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
}

.datepicker-action:hover {
    background: var(--button-hover);
}

.searchable-select {
    position: relative;
    width: 100%;
}

.searchable-select-native {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    min-height: 1px !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    clip-path: inset(50%) !important;
    border: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.searchable-select-input {
    width: 100%;
    padding-right: 34px;
}

.searchable-select-toggle {
    position: absolute;
    z-index: 2;
    top: 1px;
    right: 1px;
    width: 32px;
    height: 34px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--icon);
    cursor: pointer;
}

.searchable-select-toggle .icon {
    transition: transform 120ms ease;
}

.searchable-select.is-open .searchable-select-toggle .icon {
    transform: rotate(180deg);
}

.searchable-select-list {
    position: fixed;
    z-index: 200;
    max-height: 260px;
    overflow-y: auto;
    padding: 3px;
    border: 1px solid var(--line-dark);
    background: var(--panel-bg);
    box-shadow: 0 7px 18px rgba(0, 0, 0, .18);
}

.searchable-select-list[hidden] {
    display: none;
}

.searchable-select-option,
.searchable-select-empty {
    display: block;
    width: 100%;
    min-height: 30px;
    padding: 6px 8px;
    border: 0;
    background: transparent;
    color: var(--text);
    text-align: left;
    font: inherit;
}

.searchable-select-option {
    cursor: pointer;
}

.searchable-select-option:hover,
.searchable-select-option.is-active {
    background: var(--row-hover);
    color: var(--link);
}

.searchable-select-option[aria-selected="true"] {
    font-weight: 700;
}

.searchable-select-empty {
    color: var(--muted);
}

.searchable-select-input[aria-invalid="true"] {
    border-color: var(--color-danger);
}

.app {
    height: 100vh;
    border-top: 6px solid var(--top-accent);
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    grid-template-rows: var(--topbar-height) minmax(0, 1fr);
}

.brand {
    display: flex;
    align-items: center;
    min-width: 0;
    padding: 0 12px;
    background: var(--brand-bg);
    border-right: 1px solid var(--line-dark);
    border-bottom: 1px solid var(--line-dark);
}

.brand-link {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    text-decoration: none;
}

.brand-link:hover {
    text-decoration: none;
}

.brand-logo {
    display: block;
    width: auto;
    height: 34px;
    max-width: 100%;
    object-fit: contain;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-width: 0;
    padding: 0 16px;
    background: var(--chrome);
    border-bottom: 1px solid var(--line-dark);
}

.topbar-meta {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 12px;
    font-weight: 700;
}

.topbar-links {
    flex: 0 0 auto;
    white-space: nowrap;
    font-size: 12px;
}

.language-switcher {
    display: inline-flex;
    vertical-align: middle;
    margin-right: 10px;
    border: 1px solid var(--line);
    overflow: hidden;
}

.language-option {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 7px;
    color: var(--muted);
    background: var(--button-bg);
    font-size: 10px;
    font-weight: 700;
    line-height: 18px;
    text-decoration: none;
}

.language-option + .language-option {
    border-left: 1px solid var(--line);
}

.language-option:hover {
    color: var(--text);
    background: var(--button-hover);
    text-decoration: none;
}

.language-option .icon {
    font-size: 12px;
    border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}

.language-option.is-active {
    color: var(--color-on-primary);
    background: var(--top-accent);
}

.language-option.is-active:hover {
    color: var(--color-on-primary);
    background: color-mix(in srgb, var(--top-accent) 85%, black);
}

.sidebar {
    min-height: 0;
    overflow-y: auto;
    background: var(--sidebar);
    border-right: 1px solid var(--line-dark);
}

.sidebar-label {
    padding: 8px 12px 6px;
    border-bottom: 1px solid var(--line-soft);
    color: var(--muted);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.nav {
    padding: 3px 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 7px;
    min-height: 31px;
    padding: 0 12px;
    color: var(--link);
    border-top: 1px solid transparent;
    border-bottom: 1px solid transparent;
}

.nav-link .icon {
    width: 16px;
    color: var(--icon);
    text-align: center;
    font-size: 12px;
}

.nav-link:hover {
    background: var(--sidebar-hover);
    text-decoration: none;
}

.nav-link.active {
    background: var(--sidebar-active);
    border-top-color: transparent;
    border-bottom-color: transparent;
    font-weight: 700;
}

.nav-separator {
    height: 1px;
    margin: 10px 0 5px;
    background: var(--line-soft);
}

.nav-group-label {
    margin-top: 6px;
    padding: 5px 12px 2px;
    color: var(--muted);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.workspace {
    min-width: 0;
    min-height: 0;
    display: grid;
    grid-template-rows: var(--tabs-height) minmax(0, 1fr) 23px;
}

.workspace--no-tabs {
    grid-template-rows: minmax(0, 1fr) 23px;
}

.tabs {
    min-width: 0;
    display: flex;
    overflow-x: auto;
    background: var(--chrome-2);
    border-bottom: 1px solid var(--line);
    scrollbar-width: thin;
}

.tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: max-content;
    padding: 0 16px;
    color: var(--link);
    border-right: 1px solid var(--line-soft);
}

.tab .icon {
    color: var(--icon);
    font-size: 12px;
}

.tab.active {
    background: var(--panel-head);
    color: var(--top-accent);
    font-weight: 700;
}

.content {
    min-width: 0;
    min-height: 0;
    overflow: auto;
    padding: 18px 18px 26px;
    background: var(--page);
}

.content-inner {
    width: 100%;
    min-width: 0;
}

.breadcrumb {
    margin-bottom: 16px;
    color: var(--muted);
    font-size: 11px;
}

.breadcrumb .icon {
    margin: 0 5px;
    font-size: 9px;
}

.page-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}

.page-heading h1 {
    margin: 0;
    font-size: 17px;
    font-weight: 400;
    line-height: 1.2;
}

.page-heading h1 strong {
    font-weight: 700;
}

.page-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    white-space: nowrap;
    font-weight: 700;
}

.panel {
    width: 100%;
    border: 1px solid var(--line-dark);
    background: var(--panel-bg);
}

.panel-head {
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 5px 9px;
    background: var(--panel-head);
    border-bottom: 1px solid var(--line-dark);
    font-weight: 700;
}

.summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    background: var(--summary-bg);
    border-bottom: 1px solid var(--line-soft);
}

.summary-item {
    min-width: 0;
    padding: 11px 12px 10px;
    border-right: 1px solid var(--line-soft);
}

.summary-item:last-child {
    border-right: 0;
}

.summary-value {
    display: block;
    margin-bottom: 2px;
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
}

.summary-label {
    color: var(--muted);
    font-size: 11px;
}

.toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
    padding: 6px;
    background: var(--toolbar-bg);
    border-bottom: 1px solid var(--line);
}

.chart {
    width: 100%;
    min-height: 120px;
}

.chart-error {
    display: grid;
    height: 100%;
    place-items: center;
    color: var(--muted);
    font-size: 11px;
}

.chart-card {
    display: flex;
    flex-direction: column;
    background: var(--panel-bg);
    border: 1px solid var(--line);
}

.chart-card > header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line-soft);
    background: var(--panel-head);
}

.chart-card > header strong {
    font-size: 12px;
}

.chart-card > header span {
    color: var(--muted);
    font-size: 10px;
}

.chart-card > .chart {
    padding: 8px 6px 6px;
}

.chart-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: 12px;
    margin-bottom: 14px;
}

@media (max-width: 1000px) {
    .chart-grid {
        grid-template-columns: 1fr;
    }

}

.list-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    background: var(--toolbar-bg);
    border-top: 1px solid var(--line-soft);
}

.list-pagination > div {
    display: flex;
    align-items: center;
    gap: 8px;
}

.list-pagination span {
    color: var(--muted);
    font-size: 11px;
}

.numbered-pagination {
    display: inline-flex;
    align-items: center;
    gap: 0;
}

.numbered-pagination__link,
.numbered-pagination__ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 11px;
    margin-left: -1px;
    border: 1px solid var(--line);
    background: var(--panel-bg);
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
}

.numbered-pagination__link:first-child {
    margin-left: 0;
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.numbered-pagination__link:last-child {
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

a.numbered-pagination__link:hover {
    position: relative;
    border-color: var(--link);
    color: var(--link);
}

.numbered-pagination__link.is-current {
    position: relative;
    z-index: 1;
    border-color: var(--link);
    background: var(--link);
    color: #fff;
}

.numbered-pagination__link.is-disabled {
    color: var(--muted);
    cursor: not-allowed;
    opacity: .6;
}

.numbered-pagination__direction {
    gap: 7px;
}

.numbered-pagination__ellipsis {
    color: var(--muted);
}

@media (max-width: 640px) {
    .numbered-pagination__direction span {
        display: none;
    }

    .numbered-pagination__link,
    .numbered-pagination__ellipsis {
        min-width: 32px;
        height: 32px;
        padding: 0 8px;
    }
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 27px;
    padding: 3px 8px;
    cursor: pointer;
    color: var(--text);
    background: var(--button-bg);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xs);
}

.btn:hover {
    background: var(--button-hover);
}

.btn:active {
    background: var(--button-active);
    box-shadow: none;
}

.btn .icon {
    color: var(--icon);
    font-size: 11px;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
    table-layout: auto;
}

th,
td {
    padding: 8px 10px;
    border-right: 1px solid var(--line-soft);
    border-bottom: 1px solid var(--line-soft);
    text-align: left;
    vertical-align: middle;
    white-space: nowrap;
}

th:last-child,
td:last-child {
    border-right: 0;
}

thead th {
    background: var(--table-head);
    font-size: 11px;
    font-weight: 700;
}

tbody tr:last-child td {
    border-bottom: 0;
}

tbody tr:hover td {
    background: var(--row-hover);
}

.col-id {
    width: 62px;
}

.col-status {
    width: 120px;
}

.col-date {
    width: 150px;
}

.item-name {
    min-width: 220px;
}

.status {
    display: inline-block;
    padding: 1px 5px;
    color: var(--color-neutral-text);
    background: var(--status);
    border: 1px solid var(--line);
    font-size: 10px;
    line-height: 1.25;
}

.note {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    color: var(--muted);
    font-size: 11px;
}

.note .icon {
    color: var(--icon);
}

.statusbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 9px;
    background: var(--status-bg);
    border-top: 1px solid var(--line-dark);
    color: var(--color-text-muted);
    font-size: var(--text-xs);
}

@media (max-width: 960px) {
    :root {
        --sidebar-width: 196px;
    }

    .content {
        padding: 14px;
    }

    .summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .summary-item:nth-child(2) {
        border-right: 0;
    }

    .summary-item:nth-child(-n + 2) {
        border-bottom: 1px solid var(--line-soft);
    }

}

@media (max-width: 720px) {
    body {
        overflow: auto;
    }

    .app {
        min-height: 100vh;
        height: auto;
        display: block;
    }

    .brand,
    .topbar {
        min-height: 42px;
    }

    .brand {
        border-right: 0;
    }

    .topbar {
        border-top: 1px solid var(--line-dark);
    }

    .topbar-links {
        display: none;
    }

    .sidebar {
        overflow: visible;
        border-right: 0;
        border-bottom: 1px solid var(--line-dark);
    }

    .sidebar-label,
    .nav-separator,
    .nav-group-label {
        display: none;
    }

    .nav {
        display: flex;
        overflow-x: auto;
        padding: 0;
    }

    .nav-link {
        flex: 0 0 auto;
        min-height: 34px;
        border-right: 1px solid var(--line-soft);
    }

    .workspace {
        display: block;
    }

    .tabs {
        min-height: 38px;
    }

    .content {
        overflow: visible;
        padding: 14px 10px 22px;
    }

    .page-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }

    .page-actions {
        font-size: 12px;
    }

    .summary {
        grid-template-columns: 1fr 1fr;
    }

    .statusbar {
        min-height: 22px;
    }

}

@media (max-width: 480px) {
    .summary {
        grid-template-columns: 1fr;
    }

    .summary-item {
        border-right: 0;
        border-bottom: 1px solid var(--line-soft);
    }

    .summary-item:last-child {
        border-bottom: 0;
    }

    .toolbar {
        gap: 4px;
    }

    .btn {
        min-height: 29px;
    }

}

.topbar-meta {
    display: flex;
    align-items: center;
    gap: 7px;
}

.topbar-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}

.logout-form {
    display: inline;
}

.logout-form button {
    padding: 0;
    background: transparent;
    border: 0;
    color: var(--link);
    cursor: pointer;
}

.logout-form button:hover {
    color: var(--link-hover);
    text-decoration: underline;
}

.app-modal {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: none;
}

.app-modal.is-open {
    display: block;
}

body.app-modal-open {
    overflow: hidden;
}

.app-modal__overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--color-overlay);
}

.app-modal__container {
    width: 100%;
    max-width: 640px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    background: var(--panel-bg);
    border: 1px solid var(--line-dark);
    box-shadow: 0 18px 46px rgba(0,0,0,.3);
}

.app-modal__header {
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0 8px 0 14px;
    background: var(--panel-head);
    border-bottom: 1px solid var(--line-dark);
}

.app-modal__title {
    margin: 0;
    font-size: 13px;
    font-weight: 700;
}

.app-modal__close {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    color: var(--text);
    background: transparent;
    border: 0;
    font: inherit;
    cursor: pointer;
}

.app-modal__close::before {
    content: "\2715";
}

.app-modal__close:hover {
    background: var(--button-hover);
}

.app-modal__body {
    overflow: auto;
    padding: 14px;
}

.app-modal__footer {
    display: flex;
    justify-content: flex-end;
    gap: 7px;
    padding: 11px 14px;
    background: var(--toolbar-bg);
    border-top: 1px solid var(--line-soft);
}

.app-confirm .app-modal__container {
    max-width: 420px;
}

.app-confirm__message {
    margin: 0;
    line-height: 1.55;
}

.app-confirm__button {
    min-height: 33px;
    padding: 0 14px;
    border: 1px solid var(--line-dark);
    background: var(--button-bg);
    color: var(--text);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.app-confirm__button:hover {
    background: var(--button-hover);
}

.app-confirm__button--accept {
    background: var(--top-accent);
    border-color: color-mix(in srgb,var(--top-accent) 70%,black);
    color: var(--color-on-primary);
}

.app-confirm__button--accept:hover {
    background: color-mix(in srgb,var(--top-accent) 85%,black);
    color: var(--color-on-primary);
}

.app-confirm__button--accept.is-danger {
    background: var(--color-danger);
    border-color: transparent;
    color: var(--color-on-primary);
}

.app-confirm__button--accept.is-danger:hover {
    background: var(--color-danger-hover);
    color: var(--color-on-primary);
}

.app-confirm__button:focus-visible {
    outline: 2px solid color-mix(in srgb,var(--link) 45%,transparent);
    outline-offset: 1px;
}

.app-modal__body code {
    display: block;
    padding: 9px;
    overflow-wrap: anywhere;
    background: var(--summary-bg);
    border: 1px solid var(--line-soft);
}

.app-modal__body span {
    display: block;
    margin-top: 8px;
    color: var(--muted);
    overflow-wrap: anywhere;
}

.log-meta {
    display: grid;
    margin: 0;
    border: 1px solid var(--line-soft);
}

.log-meta-row {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 10px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--line-soft);
}

.log-meta-row:last-child {
    border-bottom: 0;
}

.log-meta-row dt {
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
}

.log-meta-row dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.log-meta-agent {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--line-soft);
}

@media(max-width:700px) {
    .app-modal__overlay {
        padding: 0;
    }

    .app-modal__container {
        max-width: none;
        max-height: 100vh;
        height: 100vh;
    }

}

/* Error pages (403/404/500/database) ------------------------------------- */

body.error-body {
    overflow: auto;
    background:
        radial-gradient(900px 500px at 50% -8%, color-mix(in srgb, var(--top-accent) 16%, transparent), transparent 70%),
        var(--page);
}

.error-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 32px 20px;
}

.error-card {
    position: relative;
    width: 100%;
    max-width: 520px;
    padding: 40px 36px 32px;
    background: var(--panel-bg);
    border: 1px solid var(--line-soft);
    border-radius: 14px;
    box-shadow:
        0 1px 2px rgba(16, 24, 32, .04),
        0 18px 44px -18px rgba(16, 24, 32, .28);
    overflow: hidden;
    text-align: left;
}

.error-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 3px;
    background: linear-gradient(90deg, var(--top-accent), var(--chart-1) 55%, var(--chart-5));
}

.error-code {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    padding: 4px 10px;
    border: 1px solid var(--line-soft);
    border-radius: 999px;
    background: var(--summary-bg);
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    font-variant-numeric: tabular-nums;
}

.error-code::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--chart-6);
}

.error-page h1 {
    margin: 0 0 10px;
    font-size: 26px;
    line-height: 1.2;
    font-weight: 600;
    letter-spacing: -.01em;
    color: var(--text);
}

.error-page p {
    margin: 0 0 28px;
    max-width: 44ch;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
}

.error-page a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--button-bg);
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.error-page a::after {
    content: "\2192";
    font-size: 14px;
    line-height: 1;
    transition: transform 140ms ease;
}

.error-page a:hover {
    background: var(--button-hover);
    border-color: var(--line-dark);
}

.error-page a:hover::after {
    transform: translateX(3px);
}

.error-page a:active {
    background: var(--button-active);
    transform: translateY(1px);
}

.error-page a:focus-visible {
    outline: 2px solid var(--link);
    outline-offset: 2px;
}

.error-watermark {
    position: absolute;
    right: -14px;
    bottom: -44px;
    font-size: 148px;
    line-height: 1;
    font-weight: 700;
    letter-spacing: -.04em;
    font-variant-numeric: tabular-nums;
    color: var(--text);
    opacity: .05;
    pointer-events: none;
    user-select: none;
}

@media (prefers-color-scheme: dark) {
    /* Error pages carry no user theme, so they follow the system instead,
       using the same values tokens.css gives the dark theme. */
    body.error-body {
        --color-bg: #0b1120;
        --color-surface: #111827;
        --color-surface-muted: #151e2e;
        --color-surface-sunken: #1a2436;
        --color-border: #1f2a3c;
        --color-border-strong: #2e3b52;
        --color-text: #f2f4f7;
        --color-text-muted: #98a2b3;
        --color-primary: #3b82f6;
        --color-primary-hover: #60a5fa;
        color-scheme: dark;
    }

    .error-card {
        box-shadow:
            0 1px 2px rgba(0, 0, 0, .3),
            0 18px 44px -18px rgba(0, 0, 0, .7);
    }
}

@media (max-width: 520px) {
    .error-card {
        padding: 32px 24px 26px;
        border-radius: 12px;
    }

    .error-page h1 {
        font-size: 22px;
    }

    .error-watermark {
        font-size: 108px;
        bottom: -32px;
    }
}

@media (prefers-reduced-motion: reduce) {

    .error-page a,
    .error-page a::after {
        transition: none;
    }
}
