@font-face {
    font-family: "Inter";
    src: url("/static/fonts/inter-variable.woff2") format("woff2");
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
}

:root {
    color-scheme: light;
    font-size: 16px;

    --font-sans: "Inter", "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    --canvas: #f5f6f7;
    --surface: #ffffff;
    --surface-subtle: #eef1f3;
    --surface-raised: #ffffff;
    --text-strong: #202428;
    --text: #3c4248;
    --text-muted: #606872;
    --text-faint: #666e77;
    --rule: #d6dbe0;
    --rule-strong: #b7bec5;
    --ink-header: #292e33;
    --ink-header-text: #ffffff;
    --focus: #3157a3;

    --neutral-bg: #eceef0;
    --neutral-text: #4f5358;
    --progress-bg: #e8edf5;
    --progress-text: #24427e;
    --success-bg: #e7f0ea;
    --success-text: #22503a;
    --warning-bg: #f4ecd9;
    --warning-text: #7b5012;
    --danger-bg: #f3e2e0;
    --danger-text: #852d27;

    --brand-50: #dfe6f3;
    --brand-100: #c7d3ea;
    --brand-500: #5575b3;
    --brand-600: #3157a3;
    --brand-700: #24427e;

    --space-1: .25rem;
    --space-2: .5rem;
    --space-3: .625rem;
    --space-4: .875rem;
    --space-5: 1rem;
    --space-6: 1.25rem;
    --space-8: 1.5rem;
    --page-title-size: clamp(1.45rem, 1.3rem + .45vw, 1.72rem);
    --record-title-size: clamp(1.25rem, 1.16rem + .3vw, 1.43rem);

    --sidebar-width: 15.5rem;
    --radius: 2px;
    --transition-fast: 120ms ease;
    --transition-page: 150ms ease;
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --canvas: #191a18;
    --surface: #24251f;
    --surface-subtle: #2d2d27;
    --surface-raised: #30312b;
    --text-strong: #f1ebdd;
    --text: #ded7c9;
    --text-muted: #b8b0a1;
    --text-faint: #9a9488;
    --rule: #48463f;
    --rule-strong: #666157;
    --ink-header: #d9d2c5;
    --ink-header-text: #20211d;
    --focus: #7f9ed9;

    --neutral-bg: #34363a;
    --neutral-text: #d4d6d9;
    --progress-bg: #263653;
    --progress-text: #b8caf0;
    --success-bg: #243b2f;
    --success-text: #abd1b9;
    --warning-bg: #493820;
    --warning-text: #e5c37c;
    --danger-bg: #4a2927;
    --danger-text: #efaaa4;

    --brand-50: #252f43;
    --brand-100: #2e3f5e;
    --brand-500: #7f9ed9;
    --brand-600: #7f9ed9;
    --brand-700: #adc2ea;
}

body[data-area="records"] {
    --brand-50: #f2dfe1;
    --brand-100: #e8c7ca;
    --brand-500: #a65158;
    --brand-600: #8b343b;
    --brand-700: #6f272e;
    --focus: #8b343b;
}

body[data-area="operations"] {
    --brand-50: #f2e6ca;
    --brand-100: #e6d09e;
    --brand-500: #bc8a36;
    --brand-600: #986315;
    --brand-700: #70480d;
    --focus: #986315;
}

body[data-active-nav="inventory"] {
    --brand-50: #dce9e0;
    --brand-100: #c3d9ca;
    --brand-500: #548369;
    --brand-600: #2f6b4f;
    --brand-700: #22503a;
    --focus: #2f6b4f;
}

body[data-area="reports"] {
    --brand-50: #dce9e0;
    --brand-100: #c3d9ca;
    --brand-500: #548369;
    --brand-600: #2f6b4f;
    --brand-700: #22503a;
    --focus: #2f6b4f;
}

body[data-area="administration"] {
    --brand-50: #eadfeb;
    --brand-100: #dac6dc;
    --brand-500: #88688b;
    --brand-600: #6b4c6f;
    --brand-700: #513954;
    --focus: #6b4c6f;
}

:root[data-theme="dark"] body[data-area="records"] {
    --brand-50: #43252a;
    --brand-100: #613138;
    --brand-500: #d98286;
    --brand-600: #d98286;
    --brand-700: #efaaad;
    --focus: #d98286;
}

:root[data-theme="dark"] body[data-area="operations"] {
    --brand-50: #3c3020;
    --brand-100: #514027;
    --brand-500: #d6a64f;
    --brand-600: #d6a64f;
    --brand-700: #e9c77e;
    --focus: #d6a64f;
}

:root[data-theme="dark"] body[data-active-nav="inventory"] {
    --brand-50: #22352a;
    --brand-100: #2b4938;
    --brand-500: #72a98b;
    --brand-600: #72a98b;
    --brand-700: #a3c9b3;
    --focus: #72a98b;
}

:root[data-theme="dark"] body[data-area="reports"] {
    --brand-50: #22352a;
    --brand-100: #2b4938;
    --brand-500: #72a98b;
    --brand-600: #72a98b;
    --brand-700: #a3c9b3;
    --focus: #72a98b;
}

:root[data-theme="dark"] body[data-area="administration"] {
    --brand-50: #392d3b;
    --brand-100: #4c3850;
    --brand-500: #a98aae;
    --brand-600: #a98aae;
    --brand-700: #cfb5d2;
    --focus: #a98aae;
}

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--canvas);
}

body {
    min-height: 100vh;
    margin: 0;
    font-family: var(--font-sans);
    font-size: .84rem;
    line-height: 1.45;
    color: var(--text);
    background: var(--canvas);
    text-rendering: optimizeLegibility;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

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

button, a {
    -webkit-tap-highlight-color: transparent;
}

a {
    color: var(--brand-700);
    text-decoration-thickness: 1px;
    text-underline-offset: .18em;
}

a:hover {
    color: var(--brand-600);
}

h1, h2, h3, h4, p, dl, dd, ul, ol {
    margin-top: 0;
}

h1, h2, h3, h4, strong {
    color: var(--text-strong);
}

img {
    max-width: 100%;
}

[hidden] {
    display: none !important;
}

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

.skip-link {
    position: fixed;
    top: var(--space-3);
    left: var(--space-3);
    z-index: 2000;
    padding: var(--space-2) var(--space-3);
    border: 2px solid var(--text-strong);
    border-radius: var(--radius);
    color: var(--text-strong);
    background: var(--surface);
    transform: translateY(-160%);
}

.skip-link:focus {
    transform: translateY(0);
}

/* Application index */
.app-shell {
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 500;
    display: flex;
    width: var(--sidebar-width);
    flex-direction: column;
    overflow: hidden;
    border-right: 1px solid var(--rule-strong);
    background: var(--surface-subtle);
    transition: transform 180ms ease, visibility 0s;
}

.sidebar-head {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    padding: var(--space-5) var(--space-4) var(--space-4);
    border-bottom: 1px solid var(--rule-strong);
}

.wordmark {
    display: flex;
    min-width: 0;
    flex: 1;
    align-items: center;
    gap: var(--space-3);
    color: var(--text-strong);
    text-decoration: none;
}

.wordmark:hover {
    color: var(--text-strong);
    text-decoration: none;
}

.brand-lockup {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: var(--space-3);
}

.logo-plate {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
}

:root[data-theme="dark"] .logo-plate {
    padding: .18rem .28rem;
    border: 1px solid #77736b;
    border-radius: var(--radius);
    background: #e7e3da;
    box-shadow: inset 0 0 0 1px rgb(255 255 255 / .24);
}

.brand-logo {
    display: block;
    width: auto;
    max-width: 3.25rem;
    height: 2.1rem;
    object-fit: contain;
}

.wordmark-mark {
    display: grid;
    width: 2.25rem;
    height: 2.25rem;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid var(--rule-strong);
    border-left: 4px solid #3157a3;
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text-strong);
    font-family: var(--font-mono);
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .03em;
}

.wordmark strong,
.wordmark small {
    display: block;
}

.wordmark strong {
    font-size: .94rem;
    line-height: 1.3;
    white-space: nowrap;
}

.wordmark small {
    margin-top: .08rem;
    color: var(--text-muted);
    font-size: .72rem;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-2) var(--space-4) var(--space-4);
}

.nav-group {
    padding-top: var(--space-4);
}

.nav-group + .nav-group {
    margin-top: var(--space-3);
    border-top: 1px solid var(--rule);
}

.nav-group-label {
    margin-bottom: var(--space-2);
    color: var(--text-faint);
    font-size: .68rem;
    font-weight: 650;
    letter-spacing: .035em;
    text-transform: uppercase;
}

.nav-index-link {
    --nav-accent: var(--text-muted);
    position: relative;
    display: flex;
    min-height: 2.15rem;
    align-items: center;
    gap: var(--space-3);
    padding: .34rem var(--space-2);
    border-bottom: 1px solid transparent;
    color: var(--text);
    font-size: .82rem;
    text-decoration: none;
}

.nav-index-link:hover {
    border-bottom-color: var(--rule);
    color: var(--text-strong);
    text-decoration: none;
    background: color-mix(in srgb, var(--surface) 65%, transparent);
}

.nav-marker {
    width: 3px;
    height: 1.1rem;
    flex: 0 0 auto;
    background: var(--nav-accent);
}

.nav-active {
    border-bottom-color: var(--rule);
    color: var(--text-strong);
    font-weight: 650;
    background: var(--surface);
}

.nav-active .nav-marker {
    width: 5px;
}

.nav-area-overview { --nav-accent: #3157a3; }
.nav-area-records { --nav-accent: #8b343b; }
.nav-area-operations { --nav-accent: #986315; }
.nav-area-inventory { --nav-accent: #2f6b4f; }
.nav-area-reports { --nav-accent: #2f6b4f; }
.nav-area-administration { --nav-accent: #6b4c6f; }

:root[data-theme="dark"] .nav-area-overview { --nav-accent: #7f9ed9; }
:root[data-theme="dark"] .nav-area-records { --nav-accent: #d98286; }
:root[data-theme="dark"] .nav-area-operations { --nav-accent: #d6a64f; }
:root[data-theme="dark"] .nav-area-inventory { --nav-accent: #72a98b; }
:root[data-theme="dark"] .nav-area-reports { --nav-accent: #72a98b; }
:root[data-theme="dark"] .nav-area-administration { --nav-accent: #a98aae; }

.sidebar-footer {
    padding: var(--space-3);
    border-top: 1px solid var(--rule-strong);
}

.account-settings-link {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .62rem;
    border-left: 3px solid transparent;
    color: var(--text);
    text-decoration: none;
}

.account-settings-link:hover {
    border-left-color: var(--rule-strong);
    color: var(--text-strong);
    background: var(--surface);
    text-decoration: none;
}

.account-settings-link.nav-active {
    border-left-color: #6b4c6f;
    color: var(--text-strong);
    background: var(--surface);
}

.account-avatar {
    display: grid;
    width: 1.9rem;
    height: 1.9rem;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid color-mix(in srgb, #6b4c6f 45%, var(--rule));
    border-radius: var(--radius);
    color: var(--text-strong);
    background: color-mix(in srgb, #6b4c6f 13%, var(--surface));
    font-weight: 720;
}

.account-settings-copy {
    min-width: 0;
    flex: 1;
}

.account-settings-copy strong,
.account-settings-copy small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-settings-copy strong {
    color: var(--text-strong);
    font-size: .78rem;
}

.account-settings-copy small {
    margin-top: .1rem;
    color: var(--text-muted);
    font-size: .66rem;
}

.account-settings-icon {
    display: grid;
    width: 1.7rem;
    height: 1.7rem;
    flex: 0 0 auto;
    place-items: center;
    color: var(--text-faint);
}

.account-settings-icon svg,
.sidebar-visibility-button svg {
    width: 1rem;
    height: 1rem;
    stroke: currentColor;
    stroke-width: 1.35;
    stroke-linecap: square;
    stroke-linejoin: miter;
}

.icon-button {
    display: inline-grid;
    width: 2.25rem;
    height: 2.25rem;
    flex: 0 0 auto;
    place-items: center;
    padding: 0;
    border: 1px solid transparent;
    border-radius: var(--radius);
    color: var(--text-muted);
    background: transparent;
    cursor: pointer;
}

.icon-button:hover {
    border-color: var(--rule);
    color: var(--text-strong);
    background: var(--surface);
}

.sidebar-hide-button {
    margin: -.35rem -.35rem 0 0;
}

.main-shell {
    min-height: 100vh;
    margin-left: var(--sidebar-width);
    transition: margin-left var(--transition-page);
}

.mobile-bar {
    display: none;
}

.sidebar-reveal-rail {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 440;
    display: flex;
    width: 0;
    justify-content: center;
    overflow: hidden;
    visibility: hidden;
    border-right: 0 solid transparent;
    background: var(--surface-subtle);
    opacity: 0;
    transition: width 180ms ease, border-color 180ms ease, opacity 120ms ease, visibility 0s linear 180ms;
}

.sidebar-show-button {
    margin-top: var(--space-4);
    visibility: hidden;
    pointer-events: none;
}

:root[data-sidebar-hidden="true"] .sidebar {
    transform: translateX(-100%);
    visibility: hidden;
    pointer-events: none;
    transition: transform 180ms ease, visibility 0s linear 180ms;
}

:root[data-sidebar-hidden="true"] .sidebar-reveal-rail {
    width: 3.25rem;
    visibility: visible;
    border-right-width: 1px;
    border-color: var(--rule-strong);
    opacity: 1;
    transition-delay: 0s;
}

:root[data-sidebar-hidden="true"] .sidebar-show-button {
    visibility: visible;
    pointer-events: auto;
}

:root[data-sidebar-hidden="true"] .main-shell {
    margin-left: 3.25rem;
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 480;
    visibility: hidden;
    padding: 0;
    border: 0;
    background: rgb(0 0 0 / .46);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease, visibility 0s linear 180ms;
}

/* Main document */
.container {
    width: min(100%, 82rem);
    margin: 0 auto;
    padding: clamp(1rem, 2vw, 1.75rem);
    animation: content-in var(--transition-page) both;
}

@keyframes content-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.page-header,
.assets-title-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-5);
    margin-bottom: var(--space-6);
    padding-bottom: var(--space-4);
    border-bottom: 2px solid var(--rule-strong);
}

.page-header > div:first-child,
.assets-title-row > div:first-child {
    min-width: 0;
}

.page-header h1,
.assets-title-row h1,
.assets-title-row > div > h1 {
    margin: 0;
    color: var(--text-strong);
    font-size: var(--page-title-size);
    font-weight: 720;
    letter-spacing: -.025em;
    line-height: 1.14;
}

.page-header h1::after,
.assets-title-row h1::after {
    content: "";
    display: block;
    width: 2.5rem;
    height: 3px;
    margin-top: var(--space-2);
    background: var(--brand-600);
}

.page-lede {
    max-width: 52rem;
    margin: calc(-1 * var(--space-3)) 0 var(--space-5);
    color: var(--text-muted);
    font-size: .84rem;
}

.page-kicker {
    display: block;
    margin-bottom: var(--space-2);
    color: var(--brand-700);
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
}

/* Settings */
.settings-page {
    width: 100%;
    max-width: 76rem;
    margin: 0 auto;
}

.settings-page > * + * {
    margin-top: var(--space-5);
}

.settings-header {
    align-items: flex-start;
}

.settings-header p {
    max-width: 52rem;
    margin: var(--space-3) 0 0;
    color: var(--text-muted);
}

.settings-section > * + * {
    margin-top: var(--space-2);
}

.settings-section-header {
    padding-bottom: var(--space-2);
    border-bottom: 1px solid var(--rule-strong);
}

.settings-section-header h2 {
    margin: 0;
    font-size: .88rem;
    font-weight: 700;
}

.settings-panel {
    overflow: hidden;
    border: 1px solid var(--rule);
    border-top: 2px solid var(--brand-600);
    border-radius: var(--radius);
    background: var(--surface);
}

.settings-panel > * + * {
    border-top: 1px solid var(--rule);
}

.settings-setting-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(15rem, auto);
    align-items: center;
    gap: var(--space-6);
    padding: var(--space-4);
}

.settings-setting-copy h3,
.settings-setting-copy p,
.account-identity h3,
.account-identity p,
.settings-users-header h3,
.settings-users-header p {
    margin: 0;
}

.settings-setting-copy h3,
.account-identity h3,
.settings-users-header h3 {
    color: var(--text-strong);
    font-size: .88rem;
}

.settings-setting-copy p,
.account-identity p,
.settings-users-header p {
    margin-top: var(--space-1);
    color: var(--text-muted);
    font-size: .76rem;
}

.settings-setting-control {
    justify-self: end;
}

.theme-fieldset {
    min-width: 0;
    padding: 0;
    border: 0;
}

.theme-options {
    display: grid;
    grid-template-columns: repeat(3, minmax(5.5rem, 1fr));
    border: 1px solid var(--rule-strong);
}

.theme-option {
    position: relative;
    display: grid;
    min-height: 3.75rem;
    grid-template-columns: 1.15rem 1fr;
    align-content: center;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3);
    border-right: 1px solid var(--rule);
    background: var(--surface);
    cursor: pointer;
}

.theme-option:last-child {
    border-right: 0;
}

.theme-option:has(input:checked) {
    box-shadow: inset 0 -3px 0 var(--brand-600);
    background: var(--brand-50);
}

.theme-option input {
    margin: 0;
}

.theme-option strong {
    font-size: .75rem;
}

.theme-option-icon {
    position: absolute;
    top: var(--space-2);
    right: var(--space-2);
    width: .8rem;
    height: .8rem;
    overflow: hidden;
    border: 1px solid var(--rule-strong);
    background: var(--surface);
}

.theme-option-light {
    background: #f5f6f7;
}

.theme-option-dark {
    background: #24251f;
}

.theme-option-system {
    background: #f5f6f7;
}

.theme-option-system::after {
    position: absolute;
    inset: 0 0 0 50%;
    background: #24251f;
    content: "";
}

.account-setting {
    grid-template-columns: minmax(0, 1fr) auto;
}

.account-identity {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: var(--space-3);
}

.account-avatar-large {
    width: 2.4rem;
    height: 2.4rem;
    font-size: .9rem;
}

.account-inline-meta {
    display: flex;
    gap: var(--space-6);
    margin: 0;
}

.account-inline-meta > div {
    display: grid;
    gap: var(--space-1);
}

.account-inline-meta dt {
    color: var(--text-muted);
    font-size: .66rem;
    font-weight: 650;
}

.account-inline-meta dd {
    margin: 0;
}

.settings-administration-section > .settings-panel + .settings-panel {
    margin-top: var(--space-4);
}

.settings-users-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-4);
}

.settings-users-table {
    border: 0;
    border-top: 1px solid var(--rule);
}

.settings-users-table .table th:first-child,
.settings-users-table .table td:first-child {
    padding-left: var(--space-4);
}

.settings-users-table .table th:last-child,
.settings-users-table .table td:last-child {
    padding-right: var(--space-4);
}

.current-account-label {
    display: block;
    margin-top: var(--space-1);
    color: var(--text-muted);
    font-size: .68rem;
    font-weight: 500;
}

.settings-table-footer {
    padding: var(--space-2) var(--space-4);
    border-top: 1px solid var(--rule);
    color: var(--text-muted);
    background: var(--surface-subtle);
    font-size: .7rem;
}

.settings-disclosure > summary {
    list-style: none;
    cursor: pointer;
}

.settings-disclosure > summary::-webkit-details-marker {
    display: none;
}

.settings-disclosure-chevron {
    width: .65rem;
    height: .65rem;
    justify-self: end;
    border-right: 1px solid var(--text-muted);
    border-bottom: 1px solid var(--text-muted);
    transform: rotate(45deg);
    transition: transform var(--transition-fast);
}

.settings-disclosure[open] .settings-disclosure-chevron {
    transform: rotate(225deg);
}

.settings-disclosure-body {
    padding: var(--space-4);
    border-top: 1px solid var(--rule);
}

.settings-disclosure-intro {
    max-width: 50rem;
    margin: 0 0 var(--space-5);
    color: var(--text-muted);
    font-size: .78rem;
}

.organization-branding-body {
    display: grid;
    grid-template-columns: minmax(14rem, .8fr) minmax(18rem, 1.2fr);
    gap: var(--space-6);
    align-items: start;
}

.field-label {
    display: block;
    margin-bottom: var(--space-2);
    color: var(--text-strong);
    font-size: .74rem;
    font-weight: 650;
}

.organization-branding-preview {
    display: flex;
    min-height: 4.75rem;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4);
    border: 1px solid var(--rule);
    background: var(--surface-subtle);
}

.organization-logo-plate img {
    display: block;
    width: auto;
    max-width: 7rem;
    height: 3.5rem;
    object-fit: contain;
}

.organization-branding-copy strong,
.organization-branding-copy small {
    display: block;
}

.organization-branding-copy strong {
    color: var(--text-strong);
    font-size: 1rem;
}

.organization-branding-copy small {
    margin-top: var(--space-1);
    color: var(--text-muted);
    font-size: .68rem;
}

.organization-branding-controls {
    display: flex;
    align-items: flex-end;
    gap: var(--space-3);
}

.organization-logo-form {
    min-width: 0;
    flex: 1;
}

.organization-logo-form input[type="file"] {
    margin-bottom: var(--space-3);
}

.btn-ghost {
    border-color: transparent;
    color: var(--danger-text);
    background: transparent;
}

.btn-ghost:hover {
    border-color: var(--danger-text);
    color: var(--danger-text);
    background: var(--danger-bg);
}

.section-header {
    margin: var(--space-8) 0 var(--space-3);
    padding: 0 0 var(--space-2);
    border-bottom: 1px solid var(--rule-strong);
}

.section-header h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 680;
}

.breadcrumb {
    margin-bottom: var(--space-2);
    color: var(--text-muted);
    font-size: .75rem;
}

.breadcrumb a {
    color: var(--text-muted);
}

.breadcrumb span {
    margin: 0 .28rem;
    color: var(--brand-600);
}

.assets-header {
    margin-bottom: var(--space-5);
}

.assets-title-row {
    margin-bottom: var(--space-4);
}

.assets-actions,
.btn-group,
.quick-actions,
.form-actions,
.inv-print-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
}

/* Controls */
.btn {
    display: inline-flex;
    min-height: 2.15rem;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    padding: .4rem .68rem;
    border: 1px solid var(--rule-strong);
    border-radius: var(--radius);
    color: var(--text-strong);
    background: var(--surface);
    cursor: pointer;
    font-size: .76rem;
    font-weight: 620;
    line-height: 1.2;
    text-decoration: none;
    transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.btn:hover {
    border-color: var(--brand-600);
    color: var(--brand-700);
    background: var(--brand-50);
    text-decoration: none;
}

.btn-primary {
    border-color: var(--brand-600);
    color: #ffffff;
    background: var(--brand-600);
}

.btn-primary:hover {
    border-color: var(--brand-700);
    color: #ffffff;
    background: var(--brand-700);
}

:root[data-theme="dark"] .btn-primary {
    color: #1e211e;
}

.btn-secondary {
    background: transparent;
}

.btn-danger {
    border-color: var(--danger-text);
    color: var(--danger-text);
    background: transparent;
}

.btn-danger:hover {
    border-color: var(--danger-text);
    color: var(--danger-text);
    background: var(--danger-bg);
}

.btn-sm {
    min-height: 1.75rem;
    padding: .25rem .5rem;
    font-size: .7rem;
}

.btn-full {
    width: 100%;
}

.btn[disabled],
button[disabled],
input[disabled] {
    cursor: not-allowed;
    opacity: .55;
}

.view-switcher {
    display: inline-flex;
    align-self: stretch;
    border-bottom: 1px solid var(--rule-strong);
}

.view-switcher button {
    min-width: 2.15rem;
    min-height: 2.15rem;
    padding: .32rem .55rem;
    border: 0;
    border-bottom: 3px solid transparent;
    color: var(--text-muted);
    background: transparent;
    cursor: pointer;
}

.view-switcher button:hover {
    color: var(--text-strong);
}

.view-switcher button.vs-active {
    border-bottom-color: var(--brand-600);
    color: var(--text-strong);
    font-weight: 700;
}

input[type="text"],
input[type="password"],
input[type="date"],
input[type="number"],
input[type="search"],
input[type="file"],
select,
textarea {
    width: 100%;
    min-height: 2.25rem;
    padding: .42rem .58rem;
    border: 1px solid var(--rule-strong);
    border-radius: var(--radius);
    color: var(--text-strong);
    background: var(--surface);
    font-size: .8rem;
    transition: border-color var(--transition-fast), background var(--transition-fast);
}

input:hover,
select:hover,
textarea:hover {
    border-color: var(--text-muted);
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--focus);
    outline: 2px solid var(--focus);
    outline-offset: 1px;
}

textarea {
    min-height: 5rem;
    resize: vertical;
}

select {
    cursor: pointer;
}

input[type="checkbox"],
input[type="radio"] {
    accent-color: var(--brand-600);
}

::placeholder {
    color: var(--text-faint);
    opacity: .9;
}

/* Forms as documents */
.form-card,
.review-section,
.import-intro {
    position: relative;
    max-width: 64rem;
    padding: var(--space-5) 0 var(--space-6);
    border-top: 3px solid var(--brand-600);
    border-bottom: 1px solid var(--rule-strong);
    border-radius: 0;
    background: transparent;
}

.form-card + .form-card,
.review-section + .review-section {
    margin-top: var(--space-6);
}

.form-narrow {
    max-width: 38rem;
}

.form-card > h3,
.review-section h2,
.import-intro h2 {
    margin-bottom: var(--space-3);
    font-size: 1rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-4);
}

.form-row-single {
    grid-template-columns: minmax(0, calc(50% - .4375rem));
}

.form-section {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.form-section + .form-section {
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--rule-strong);
}

.form-section legend {
    width: 100%;
    margin-bottom: var(--space-3);
    padding: 0;
    color: var(--text-strong);
    font-size: .95rem;
    font-weight: 680;
}

.form-subheading {
    margin: var(--space-2) 0 var(--space-4);
    padding-bottom: var(--space-2);
    border-bottom: 1px solid var(--rule);
    color: var(--text-muted);
    font-size: .76rem;
    font-weight: 650;
}

.conditional-fields {
    margin-top: var(--space-2);
}

.form-group {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: .26rem;
    margin-bottom: var(--space-4);
}

.form-group label {
    color: var(--text-strong);
    font-size: .79rem;
    font-weight: 620;
}

.form-actions {
    margin-top: var(--space-2);
    padding-top: var(--space-4);
    border-top: 1px solid var(--rule);
}

/* Asset dossier form: keep the working set visible as one compact document. */
.asset-form-header {
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-3);
}

.asset-form {
    max-width: 72rem;
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(20rem, .85fr);
    column-gap: var(--space-5);
    padding: var(--space-4) 0;
}

.asset-form > .form-section {
    margin: 0;
    padding: 0;
    border: 0;
}

.asset-form > .form-section + .form-section {
    margin-top: var(--space-3);
    padding-top: var(--space-3);
    border-top: 1px solid var(--rule-strong);
}

.asset-form .asset-form-identity,
.asset-form .asset-form-evidence,
.asset-form > .form-actions {
    grid-column: 1 / -1;
}

.asset-form .asset-form-placement {
    grid-column: 1;
}

.asset-form .asset-form-acquisition {
    grid-column: 2;
}

.asset-form .form-section legend {
    margin-bottom: var(--space-2);
    font-size: .88rem;
}

.asset-form .form-group {
    gap: .18rem;
    margin-bottom: 0;
}

.asset-identity-grid {
    display: grid;
    grid-template-columns: minmax(12rem, 1.35fr) minmax(10rem, 1fr) minmax(8rem, .72fr);
    gap: var(--space-3);
}

.asset-field-serial,
.asset-field-property-tag {
    grid-column: span 1;
}

.asset-form .conditional-fields {
    margin-top: var(--space-3);
}

.asset-form .form-subheading {
    margin: 0 0 var(--space-3);
}

.asset-form .form-row {
    gap: var(--space-3);
}

.asset-evidence-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(18rem, .75fr);
    gap: var(--space-4);
    align-items: start;
}

.asset-form textarea {
    min-height: 4.25rem;
}

.asset-form > .form-actions {
    margin-top: var(--space-3);
    padding-top: var(--space-3);
}

.field-hint,
.help-text {
    color: var(--text-muted);
    font-size: .72rem;
    line-height: 1.4;
}

.help-text {
    margin-top: var(--space-4);
    padding: var(--space-3) var(--space-4);
    border-left: 3px solid var(--brand-600);
    background: var(--brand-50);
}

.req {
    color: var(--danger-text);
}

.checkbox-label {
    display: flex;
    min-height: 2.5rem;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
}

.checkbox-label input {
    width: 1rem;
    height: 1rem;
}

.danger-zone {
    border-top-color: var(--danger-text);
}

.danger-zone-title {
    color: var(--danger-text);
}

.danger-zone-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-6);
}

.danger-zone-row p {
    margin-bottom: 0;
}

.disclosure {
    padding-top: 0;
}

.disclosure > summary,
.form-disclosure > summary {
    cursor: pointer;
    font-weight: 650;
}

.disclosure > summary {
    padding: var(--space-4) 0;
}

.disclosure[open] > summary {
    margin-bottom: var(--space-4);
    border-bottom: 1px solid var(--rule);
}

.form-disclosure {
    margin-bottom: var(--space-5);
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
}

.form-disclosure > summary {
    padding: var(--space-3) var(--space-2);
    color: var(--text-strong);
    background: var(--surface-subtle);
}

.form-disclosure[open] > .form-group {
    margin: 0;
    padding: var(--space-4) var(--space-2);
}

/* Alerts and state */
.alert {
    margin-bottom: var(--space-5);
    padding: var(--space-3) var(--space-4);
    border: 1px solid currentColor;
    border-left-width: 4px;
    border-radius: var(--radius);
    font-size: .8rem;
}

.alert-error {
    color: var(--danger-text);
    background: var(--danger-bg);
}

.alert-success {
    color: var(--success-text);
    background: var(--success-bg);
}

.badge,
.status-badge,
.role-badge,
.assign-tag,
.type-pill,
.ai-badge {
    display: inline-flex;
    max-width: 100%;
    align-items: center;
    gap: .3rem;
    padding: .16rem .42rem;
    border: 1px solid var(--rule-strong);
    border-radius: var(--radius);
    color: var(--neutral-text);
    background: var(--neutral-bg);
    font-size: .68rem;
    font-weight: 650;
    line-height: 1.35;
    text-transform: none;
    vertical-align: middle;
}

.status-badge::before {
    content: "";
    width: .38rem;
    height: .38rem;
    flex: 0 0 auto;
    border: 1px solid currentColor;
    background: currentColor;
}

.badge-green,
.status-active,
.result-success .stat-num {
    border-color: color-mix(in srgb, var(--success-text) 48%, transparent);
    color: var(--success-text);
    background: var(--success-bg);
}

.badge-red,
.status-damaged,
.result-error .stat-num {
    border-color: color-mix(in srgb, var(--danger-text) 48%, transparent);
    color: var(--danger-text);
    background: var(--danger-bg);
}

.badge-yellow,
.status-lost,
.result-warn .stat-num {
    border-color: color-mix(in srgb, var(--warning-text) 48%, transparent);
    color: var(--warning-text);
    background: var(--warning-bg);
}

.status-inactive {
    color: var(--neutral-text);
    background: var(--neutral-bg);
}

.role-admin {
    border-color: color-mix(in srgb, #6b4c6f 55%, var(--rule));
    color: #513954;
    background: #eadfeb;
}

.role-editor {
    border-color: color-mix(in srgb, #3157a3 55%, var(--rule));
    color: #24427e;
    background: #dfe6f3;
}

.role-readonly {
    color: var(--neutral-text);
    background: var(--neutral-bg);
}

:root[data-theme="dark"] .role-admin {
    color: #cfb5d2;
    background: #392d3b;
}

:root[data-theme="dark"] .role-editor {
    color: #adc2ea;
    background: #252f43;
}

.badge-experimental,
.ai-badge {
    border-color: #6b4c6f;
    color: #513954;
    background: #eadfeb;
}

:root[data-theme="dark"] .badge-experimental,
:root[data-theme="dark"] .ai-badge {
    border-color: #a98aae;
    color: #cfb5d2;
    background: #392d3b;
}

/* Ledgers */
.table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--rule-strong);
    border-radius: 0;
    background: var(--surface);
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    border-collapse: collapse;
    border-radius: 0;
    color: var(--text);
    background: var(--surface);
    font-size: .76rem;
}

.table th {
    padding: .48rem .65rem;
    border-right: 1px solid color-mix(in srgb, var(--ink-header-text) 20%, transparent);
    border-bottom: 2px solid var(--brand-600);
    color: var(--ink-header-text);
    background: var(--ink-header);
    font-size: .67rem;
    font-weight: 680;
    letter-spacing: .015em;
    text-align: left;
    text-transform: none;
    white-space: nowrap;
}

.table th:last-child {
    border-right: 0;
}

.table td {
    padding: .5rem .65rem;
    border-bottom: 1px solid var(--rule);
    vertical-align: middle;
}

.table tbody tr:nth-child(even) td {
    background: color-mix(in srgb, var(--surface-subtle) 55%, var(--surface));
}

.table tbody tr:hover td {
    background: var(--brand-50);
}

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

.table a:not(.btn) {
    font-weight: 590;
}

.table .actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

th.sortable a {
    display: flex;
    align-items: center;
    gap: .3rem;
    color: inherit;
    text-decoration: none;
}

th.sortable a:hover {
    color: inherit;
    text-decoration: underline;
}

th.sort-active {
    box-shadow: inset 0 -3px 0 var(--ink-header-text);
}

.sort-idle {
    opacity: .55;
}

.deleted-row td {
    color: var(--text-muted);
}

.deleted-row td:first-child {
    border-left: 3px solid var(--reports-accent, #2f6b4f);
}

.mono {
    font-family: var(--font-mono);
    font-size: .78rem;
    font-variant-numeric: tabular-nums;
}

.nowrap {
    white-space: nowrap;
}

.text-muted {
    color: var(--text-muted);
}

.text-center {
    text-align: center;
}

/* Dashboard */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    margin-bottom: var(--space-8);
    border-top: 3px solid var(--brand-600);
    border-bottom: 1px solid var(--rule-strong);
    background: var(--surface);
}

.stat-card,
.result-card {
    min-width: 0;
    padding: var(--space-4);
    border-right: 1px solid var(--rule);
    background: transparent;
}

.stat-card:last-child,
.result-card:last-child {
    border-right: 0;
}

.stat-num {
    color: var(--text-strong);
    font-family: var(--font-mono);
    font-size: clamp(1.4rem, 1.22rem + .55vw, 1.75rem);
    font-weight: 720;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.stat-label {
    margin-top: var(--space-2);
    color: var(--text-muted);
    font-size: .72rem;
    line-height: 1.35;
}

.stat-muted .stat-num {
    color: var(--text-muted);
}

.quick-actions {
    margin-bottom: var(--space-6);
}

/* Search */
.assets-search-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2);
    border-top: 1px solid var(--rule-strong);
    border-bottom: 1px solid var(--rule-strong);
    background: var(--surface-subtle);
}

.assets-search-inner {
    position: relative;
    flex: 1;
}

.search-icon {
    position: absolute;
    top: 50%;
    left: .72rem;
    color: var(--brand-600);
    font-family: var(--font-mono);
    transform: translateY(-50%);
    pointer-events: none;
}

.assets-search-inner input {
    padding-left: 2rem;
}

.location-filter-select {
    width: auto;
    min-width: 11rem;
    max-width: 16rem;
}

.search-bar {
    margin: var(--space-4) 0 var(--space-5);
}

.search-bar input {
    max-width: 42rem;
}

.search-results-section {
    margin-bottom: var(--space-5);
}

.search-results-header {
    padding: var(--space-2) 0;
    color: var(--text-muted);
    font-size: .78rem;
}

.search-no-results,
.empty-state,
.empty-state-page {
    padding: var(--space-8) var(--space-5);
    border-top: 3px solid var(--brand-600);
    border-bottom: 1px solid var(--rule-strong);
    text-align: left;
    background: var(--surface);
}

.empty-icon {
    display: block;
    width: 2.6rem;
    height: .7rem;
    margin-bottom: var(--space-5);
    border-top: 3px solid var(--brand-600);
    border-bottom: 1px solid var(--brand-600);
    color: transparent;
    font-size: 0;
}

.search-no-results p,
.empty-state p,
.empty-state-page p {
    max-width: 34rem;
    color: var(--text-muted);
}

.empty-state h3,
.empty-state-page h3 {
    margin-bottom: var(--space-2);
    font-size: 1rem;
}

.htmx-indicator {
    display: none;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
    display: block;
}

.search-spinner {
    position: absolute;
    top: calc(50% - .45rem);
    right: .8rem;
    width: .9rem;
    height: .9rem;
    border: 2px solid var(--rule);
    border-top-color: var(--brand-600);
    border-radius: 50%;
    animation: spin 650ms linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.skeleton-rows {
    border: 1px solid var(--rule-strong);
    background: var(--surface);
}

.skeleton-row {
    display: flex;
    gap: var(--space-4);
    padding: .75rem;
    border-bottom: 1px solid var(--rule);
}

.skeleton-cell {
    height: .8rem;
    background: var(--surface-subtle);
    animation: skeleton-pulse 1.2s ease-in-out infinite alternate;
}

@keyframes skeleton-pulse {
    to { opacity: .45; }
}

/* Real-object cards and indexes */
.type-cards-grid,
.entity-cards-grid,
.location-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
    gap: var(--space-3);
}

.type-card,
.entity-card,
.location-card {
    position: relative;
    display: block;
    min-width: 0;
    border: 1px solid var(--rule-strong);
    border-left: 4px solid var(--brand-600);
    border-radius: var(--radius);
    color: var(--text);
    background: var(--surface);
    text-decoration: none;
    transition: border-color var(--transition-fast), background var(--transition-fast);
}

.type-card:hover,
.entity-card:hover,
.location-card:hover {
    border-color: var(--brand-600);
    color: var(--text);
    background: var(--brand-50);
    text-decoration: none;
}

.type-card-main {
    display: flex;
    min-height: 4.5rem;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-4);
}

.type-card-info {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: .16rem;
}

.type-card-name,
.entity-card-name,
.location-card-name {
    color: var(--text-strong);
    font-size: .88rem;
    font-weight: 660;
    overflow-wrap: anywhere;
}

.type-card-count,
.location-card-count {
    color: var(--text-muted);
    font-size: .73rem;
}

.type-card-meta {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.type-pill,
.assign-tag {
    border-color: var(--brand-500);
    color: var(--brand-700);
    background: var(--brand-50);
}

.type-arrow,
.location-card-arrow {
    color: var(--brand-600);
    font-family: var(--font-mono);
}

.entity-card {
    padding: var(--space-4);
}

.entity-card-top,
.entity-card-footer {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-3);
}

.entity-card-top {
    margin-bottom: var(--space-3);
}

.entity-card-fields {
    display: grid;
    gap: .22rem;
}

.entity-card-field {
    display: grid;
    grid-template-columns: 4.8rem minmax(0, 1fr);
    gap: var(--space-2);
    font-size: .76rem;
}

.entity-card-label {
    color: var(--text-muted);
    font-weight: 620;
}

.entity-card-val {
    min-width: 0;
    color: var(--text);
    overflow-wrap: anywhere;
}

.entity-card-footer {
    margin-top: var(--space-3);
    padding-top: var(--space-3);
    border-top: 1px solid var(--rule);
    color: var(--text-muted);
    font-size: .73rem;
}

.entity-card-footer .entity-card-link {
    color: var(--brand-700);
    font-weight: 620;
}

.view-cards {
    display: none;
}

/* Locations as index */
.location-list {
    border-top: 3px solid var(--brand-600);
    border-bottom: 1px solid var(--rule-strong);
    background: var(--surface);
}

.location-item {
    display: flex;
    border-bottom: 1px solid var(--rule);
}

.location-item:last-child {
    border-bottom: 0;
}

.location-item:hover {
    background: var(--brand-50);
}

.location-item-pinned {
    box-shadow: inset 4px 0 0 var(--warning-text);
    background: var(--warning-bg);
}

.location-item-main {
    display: flex;
    min-width: 0;
    flex: 1;
    align-items: center;
    gap: var(--space-3);
    padding: .6rem var(--space-3);
    color: var(--text);
    text-decoration: none;
}

.location-item-main:hover {
    color: var(--text);
    text-decoration: none;
}

.location-item-icon {
    width: 1.2rem;
    color: var(--brand-600);
    font-size: 0;
}

.location-item-icon::before {
    content: "";
    display: block;
    width: .55rem;
    height: .55rem;
    border: 1px solid var(--brand-600);
    background: var(--brand-600);
}

.location-item-pinned .location-item-icon::before {
    border-color: var(--warning-text);
    background: var(--warning-text);
    transform: rotate(45deg);
}

.location-item-body {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;
    gap: .1rem;
}

.location-item-desc {
    overflow: hidden;
    color: var(--text-muted);
    font-size: .74rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.location-item-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: .4rem var(--space-3);
    border-left: 1px solid var(--rule);
}

.location-item-actions:empty {
    display: none;
}

.pin-btn {
    display: grid;
    width: 2.25rem;
    height: 2.25rem;
    place-items: center;
    border: 1px solid var(--rule-strong);
    border-radius: var(--radius);
    color: var(--text-muted);
    background: transparent;
    cursor: pointer;
}

.pin-btn:hover,
.pin-btn-active {
    border-color: var(--warning-text);
    color: var(--warning-text);
    background: var(--warning-bg);
}

/* Record dossier */
.detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(17rem, .65fr);
    gap: var(--space-6);
    margin-bottom: var(--space-6);
}

.detail-card {
    padding: var(--space-4) 0 var(--space-5);
    border-top: 3px solid var(--brand-600);
    border-bottom: 1px solid var(--rule-strong);
}

.detail-card h3,
.card-header h3 {
    margin: 0 0 var(--space-4);
    font-size: .92rem;
}

.card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
}

.detail-list {
    display: grid;
    grid-template-columns: minmax(8rem, 11rem) minmax(0, 1fr);
}

.detail-list dt,
.detail-list dd {
    margin: 0;
    padding: .52rem var(--space-2);
    border-bottom: 1px solid var(--rule);
    overflow-wrap: anywhere;
}

.detail-list dt {
    color: var(--text-muted);
    font-size: .74rem;
    font-weight: 620;
}

.detail-list dd {
    color: var(--text-strong);
}

.assign-form {
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--rule);
}

/* Authentication */
.auth-page {
    background: var(--canvas);
}

.auth-container {
    width: 100%;
    max-width: none;
    min-height: 100vh;
    padding: var(--space-5);
}

.auth-wrap {
    display: grid;
    min-height: calc(100vh - 2.5rem);
    place-items: center;
}

.auth-box {
    width: min(100%, 25rem);
    padding: clamp(1.6rem, 5vw, 2.5rem);
    border: 2px solid var(--rule-strong);
    border-top: 6px solid var(--brand-600);
    border-radius: var(--radius);
    background: var(--surface);
}

.auth-box::before {
    content: "AT / operational register";
    display: block;
    margin-bottom: var(--space-6);
    color: var(--brand-700);
    font-family: var(--font-mono);
    font-size: .7rem;
}

.auth-box:has(.auth-logo-plate)::before {
    display: none;
}

.auth-logo-plate {
    margin-bottom: var(--space-6);
}

.auth-logo-plate img {
    display: block;
    width: auto;
    max-width: 10rem;
    height: 4rem;
    object-fit: contain;
}

.auth-box h1 {
    margin-bottom: var(--space-1);
    font-size: 1.55rem;
    letter-spacing: -.025em;
}

.auth-sub {
    margin-bottom: var(--space-6);
    color: var(--text-muted);
}

/* Dialogs and media */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    background: rgb(0 0 0 / .56);
}

.modal {
    width: min(100%, 29rem);
    padding: var(--space-5);
    border: 2px solid var(--rule-strong);
    border-radius: 3px;
    background: var(--surface);
    box-shadow: 8px 10px 0 rgb(0 0 0 / .2);
}

.modal h3 {
    margin-bottom: var(--space-3);
}

.photo-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr));
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.photo-item {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--rule-strong);
    border-radius: var(--radius);
    background: var(--surface);
}

.photo-expand-btn {
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: zoom-in;
}

.photo-item img {
    display: block;
    width: 100%;
    height: 9rem;
    object-fit: cover;
}

.photo-meta {
    display: flex;
    flex-direction: column;
    gap: .1rem;
    padding: var(--space-2);
    border-top: 1px solid var(--rule);
}

.photo-name,
.photo-by {
    overflow: hidden;
    font-size: .69rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.photo-delete {
    position: absolute;
    top: var(--space-2);
    right: var(--space-2);
}

.photo-upload-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-5);
}

.photo-upload-label input {
    display: none;
}

.photo-lightbox {
    position: relative;
    display: flex;
    width: min(92vw, 68rem);
    max-height: 92vh;
    flex-direction: column;
    gap: var(--space-3);
    padding: 3rem var(--space-4) var(--space-4);
    border: 2px solid #77736b;
    border-radius: 3px;
    background: #171815;
    box-shadow: 8px 10px 0 rgb(0 0 0 / .38);
}

.photo-lightbox-close {
    position: absolute;
    top: .7rem;
    right: .7rem;
    width: 2.25rem;
    height: 2.25rem;
    border: 1px solid #aaa397;
    border-radius: var(--radius);
    color: #f1ebdd;
    background: transparent;
    cursor: pointer;
}

.photo-lightbox-image {
    width: 100%;
    max-height: calc(92vh - 7rem);
    object-fit: contain;
}

.photo-lightbox-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: var(--space-2);
}

.photo-lightbox-name {
    color: #f1ebdd;
    font-weight: 650;
}

.photo-lightbox-by {
    color: #b8b0a1;
    font-size: .75rem;
}

/* Inventory and print */
.inventory-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-top: 1px solid var(--rule-strong);
    border-left: 1px solid var(--rule-strong);
}

.inv-option {
    min-width: 0;
    padding: var(--space-4);
    border-right: 1px solid var(--rule-strong);
    border-bottom: 1px solid var(--rule-strong);
    background: var(--surface);
}

.inv-option h4 {
    margin-bottom: var(--space-2);
    font-size: .9rem;
}

.inv-option p {
    min-height: 2.15rem;
}

.option-label {
    display: block;
    margin-top: var(--space-3);
    color: var(--text-strong);
    font-size: .75rem;
    font-weight: 620;
}

.inv-option select {
    margin: var(--space-2) 0;
}

.print-doc {
    padding: var(--space-6);
    border: 1px solid var(--rule-strong);
    background: var(--surface);
}

.print-header {
    margin-bottom: var(--space-5);
    padding-bottom: var(--space-4);
    border-bottom: 3px solid var(--text-strong);
}

.print-header h2 {
    margin-bottom: var(--space-2);
    font-size: 1.25rem;
}

.print-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-6);
    color: var(--text-muted);
    font-size: .78rem;
}

.print-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .78rem;
}

.print-table th {
    padding: .5rem;
    border-bottom: 2px solid var(--text-strong);
    color: var(--text-strong);
    text-align: left;
}

.print-table td {
    padding: .52rem;
    border-bottom: 1px solid var(--rule);
}

.check-cell {
    text-align: center;
}

.check-column {
    width: 3.5rem;
}

.checkbox-print {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 1.5px solid var(--text-strong);
}

.print-footer {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-8);
    margin-top: 2.5rem;
    padding-top: var(--space-5);
    border-top: 1px solid var(--rule-strong);
}

.sig-line {
    min-width: 13rem;
    padding-bottom: .6rem;
    border-bottom: 1px solid var(--text-strong);
    color: var(--text-muted);
    font-size: .78rem;
}

/* Import */
.import-intro {
    margin-bottom: var(--space-6);
}

.import-intro p,
.review-section > p {
    color: var(--text-muted);
}

.import-steps {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin: var(--space-5) 0 0;
    padding: 0;
    border-top: 1px solid var(--rule-strong);
    list-style: none;
}

.import-steps li {
    padding: var(--space-3);
    border-right: 1px solid var(--rule);
    color: var(--text-muted);
    font-size: .74rem;
}

.import-steps li:last-child {
    border-right: 0;
}

.step-num {
    display: block;
    margin-bottom: var(--space-2);
    color: var(--brand-600);
    font-family: var(--font-mono);
    font-weight: 700;
}

.ai-summary {
    margin-bottom: var(--space-5);
    padding: var(--space-4);
    border: 1px solid #6b4c6f;
    border-left: 4px solid #6b4c6f;
    background: #eadfeb;
}

:root[data-theme="dark"] .ai-summary {
    color: #ded7c9;
    background: #392d3b;
}

.mapping-table select,
.mapping-table input {
    min-width: 10rem;
    min-height: 2rem;
    padding: .3rem .45rem;
    font-size: .75rem;
}

.preview-stats,
.import-location-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.preview-scroll {
    max-height: 28rem;
    overflow: auto;
    border: 1px solid var(--rule-strong);
}

.preview-scroll .table-wrap {
    border: 0;
}

.preview-table {
    min-width: 72rem;
    font-size: .72rem;
}

.preview-table th {
    position: sticky;
    top: 0;
    z-index: 2;
}

.row-error td {
    color: var(--danger-text);
    background: var(--danger-bg) !important;
}

.import-location-list {
    padding: var(--space-3);
    border: 1px solid var(--rule);
    background: var(--surface-subtle);
}

.import-location-pill {
    padding-right: var(--space-2);
    border-right: 1px solid var(--rule-strong);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: .72rem;
}

.import-location-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-3);
}

.import-location-option {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-4);
    border: 1px solid var(--rule-strong);
    border-left: 4px solid var(--brand-600);
    background: var(--surface);
    cursor: pointer;
}

.import-location-option:has(input:checked) {
    border-color: var(--brand-600);
    background: var(--brand-50);
}

.import-location-option input {
    flex: 0 0 auto;
    margin-top: .25rem;
}

.import-location-option strong {
    display: block;
    margin-bottom: var(--space-1);
}

.import-location-option p {
    margin-bottom: 0;
}

.import-result-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: var(--space-6);
    border-top: 3px solid var(--brand-600);
    border-bottom: 1px solid var(--rule-strong);
    background: var(--surface);
}

.import-actions {
    margin-top: var(--space-6);
}

.warn-note {
    color: var(--warning-text);
    font-size: .75rem;
}

/* Responsive */
@media (max-width: 1100px) {
    .stat-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .stat-card:nth-child(3) {
        border-right: 0;
    }

    .stat-card:nth-child(n+4) {
        border-top: 1px solid var(--rule);
    }

    .import-steps {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .import-steps li:nth-child(2) {
        border-right: 0;
    }

    .import-steps li:nth-child(n+3) {
        border-top: 1px solid var(--rule);
    }
}

@media (max-width: 860px) {
    .sidebar {
        width: min(20rem, calc(100vw - 3rem));
        visibility: hidden;
        transform: translateX(-100%);
        pointer-events: none;
        transition: transform 180ms ease, visibility 0s linear 180ms;
    }

    .nav-drawer-open .sidebar {
        visibility: visible;
        transform: translateX(0);
        pointer-events: auto;
        transition-delay: 0s;
    }

    .main-shell,
    :root[data-sidebar-hidden="true"] .main-shell {
        margin-left: 0;
    }

    .sidebar-reveal-rail,
    .sidebar-hide-button {
        display: none !important;
    }

    :root[data-sidebar-hidden="true"] .nav-drawer-open .sidebar {
        visibility: visible;
        transform: translateX(0);
        pointer-events: auto;
    }

    .nav-drawer-open .sidebar-backdrop {
        visibility: visible;
        opacity: 1;
        pointer-events: auto;
        transition-delay: 0s;
    }

    .mobile-bar {
        position: sticky;
        top: 0;
        z-index: 400;
        display: grid;
        min-height: 3.25rem;
        grid-template-columns: 2.75rem 1fr auto;
        align-items: center;
        gap: var(--space-2);
        padding: 0 var(--space-3);
        border-bottom: 1px solid var(--rule-strong);
        background: var(--surface);
    }

    .mobile-menu-trigger {
        display: flex;
        width: 2.75rem;
        height: 2.75rem;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        border: 0;
        background: transparent;
        cursor: pointer;
    }

    .mobile-menu-trigger span {
        display: block;
        width: 1.15rem;
        height: 1px;
        background: var(--text-strong);
    }

    .mobile-wordmark {
        display: flex;
        min-width: 0;
        align-items: center;
        gap: var(--space-2);
        color: var(--text-strong);
        font-weight: 680;
        text-decoration: none;
    }

    .mobile-wordmark img {
        display: block;
        width: auto;
        max-width: 2.75rem;
        height: 1.55rem;
        object-fit: contain;
    }

    .mobile-area {
        color: var(--brand-700);
        font-size: .68rem;
        text-transform: capitalize;
    }

    .container {
        padding: var(--space-5) var(--space-4);
    }

    .page-header,
    .assets-title-row {
        align-items: flex-start;
    }

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

    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .asset-form {
        display: block;
    }

    .asset-form > .form-section + .form-section {
        margin-top: var(--space-4);
        padding-top: var(--space-4);
    }

    .asset-identity-grid,
    .asset-evidence-grid {
        grid-template-columns: 1fr;
        gap: var(--space-3);
    }

    .asset-form .form-row {
        gap: var(--space-3);
    }

    .form-row-single {
        grid-template-columns: 1fr;
    }

    .settings-setting-row,
    .account-setting {
        grid-template-columns: 1fr;
        gap: var(--space-4);
    }

    .settings-setting-control {
        justify-self: stretch;
    }

    .account-inline-meta {
        justify-content: flex-start;
    }

    .organization-branding-body {
        grid-template-columns: 1fr;
    }

    input[type="text"],
    input[type="password"],
    input[type="date"],
    input[type="number"],
    input[type="search"],
    input[type="file"],
    select {
        min-height: 2.75rem;
    }

    .btn {
        min-height: 2.75rem;
    }

    .btn-sm {
        min-height: 2.5rem;
    }

    .view-switcher button {
        min-width: 2.75rem;
        min-height: 2.75rem;
    }

    .nav-index-link {
        min-height: 2.75rem;
    }

    .inventory-options,
    .import-location-options {
        grid-template-columns: 1fr;
    }

    .inv-option p {
        min-height: 0;
    }

    .location-item {
        align-items: stretch;
    }

    .location-item-main {
        flex-wrap: wrap;
        min-height: 2.75rem;
    }

    .location-item-count {
        margin-left: 2rem;
    }

    .location-item-actions {
        flex-wrap: wrap;
        justify-content: flex-end;
    }
}

@media (max-width: 640px) {
    .page-header,
    .assets-title-row {
        flex-direction: column;
        align-items: stretch;
    }

    .assets-actions,
    .btn-group {
        align-items: stretch;
    }

    .assets-actions .btn,
    .page-header > .btn,
    .page-header > .btn-group > .btn {
        flex: 1;
    }

    .settings-users-header,
    .organization-branding-controls {
        align-items: stretch;
        flex-direction: column;
    }

    .settings-users-header .btn,
    .organization-branding-controls .btn {
        width: 100%;
    }

    .theme-options {
        grid-template-columns: 1fr;
    }

    .theme-option {
        min-height: 3.5rem;
        border-right: 0;
        border-bottom: 1px solid var(--rule);
    }

    .theme-option:last-child {
        border-bottom: 0;
    }

    .assets-search-row {
        flex-direction: column;
        align-items: stretch;
    }

    .location-filter-select {
        width: 100%;
        max-width: none;
    }

    .stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .stat-card {
        border-top: 1px solid var(--rule);
    }

    .stat-card:nth-child(odd) {
        border-right: 1px solid var(--rule);
    }

    .stat-card:nth-child(even) {
        border-right: 0;
    }

    .stat-card:first-child,
    .stat-card:nth-child(2) {
        border-top: 0;
    }

    .type-cards-grid,
    .entity-cards-grid {
        grid-template-columns: 1fr;
    }

    .detail-list {
        grid-template-columns: 7rem minmax(0, 1fr);
    }

    .location-item {
        display: block;
    }

    .location-item-actions {
        padding: var(--space-2) var(--space-3);
        border-top: 1px solid var(--rule);
        border-left: 0;
    }

    .location-item-actions form {
        margin: 0;
    }

    .import-result-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .result-card:nth-child(2) {
        border-right: 0;
    }

    .result-card:nth-child(n+3) {
        border-top: 1px solid var(--rule);
    }

    .import-steps {
        grid-template-columns: 1fr;
    }

    .import-steps li {
        border-top: 1px solid var(--rule);
        border-right: 0;
    }

    .import-steps li:first-child {
        border-top: 0;
    }

    .responsive-ledger {
        border: 0;
        background: transparent;
        overflow: visible;
    }

    .responsive-ledger .table,
    .responsive-ledger .table tbody,
    .responsive-ledger .table tr,
    .responsive-ledger .table td {
        display: block;
        width: 100%;
    }

    .responsive-ledger .table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        clip-path: inset(50%);
        white-space: nowrap;
    }

    .responsive-ledger .table tr {
        margin-bottom: var(--space-3);
        border: 1px solid var(--rule-strong);
        border-left: 4px solid var(--brand-600);
        background: var(--surface);
    }

    .responsive-ledger .table td,
    .responsive-ledger .table tbody tr:nth-child(even) td,
    .responsive-ledger .table tbody tr:hover td {
        display: grid;
        min-height: 2.35rem;
        grid-template-columns: minmax(6.5rem, 38%) minmax(0, 1fr);
        align-items: start;
        gap: var(--space-2);
        padding: .55rem .65rem;
        border-bottom: 1px solid var(--rule);
        background: var(--surface);
        white-space: normal;
    }

    .responsive-ledger .table td::before {
        content: attr(data-label);
        color: var(--text-muted);
        font-size: .7rem;
        font-weight: 650;
    }

    .responsive-ledger .table td:last-child {
        border-bottom: 0;
    }

    .responsive-ledger .table td.text-center {
        text-align: left;
    }

    .print-doc {
        padding: var(--space-4);
        overflow-x: auto;
    }
}

@media print {
    :root,
    :root[data-theme="dark"] {
        color-scheme: light;
        --canvas: #ffffff;
        --surface: #ffffff;
        --text-strong: #000000;
        --text: #111111;
        --text-muted: #333333;
        --rule: #bdbdbd;
        --rule-strong: #555555;
    }

    .no-print,
    .sidebar,
    .mobile-bar,
    .sidebar-reveal-rail,
    .sidebar-backdrop,
    .btn,
    .quick-actions {
        display: none !important;
    }

    body,
    .main-shell {
        margin: 0;
        background: #ffffff;
    }

    .container {
        width: 100%;
        max-width: none;
        padding: 0;
    }

    .print-doc {
        padding: 0;
        border: 0;
    }

    .print-table {
        font-size: 10pt;
    }

    .print-table th,
    .print-table td {
        padding: .3rem .4rem;
    }

    a {
        color: inherit;
        text-decoration: none;
    }

    @page {
        margin: .55in;
    }
}

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