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

* {
    box-sizing: border-box;
}

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

main {
    width: min(42rem, 100%);
    padding: clamp(2rem, 7vw, 4.5rem);
    border: 1px solid #dce4ef;
    border-radius: 1.5rem;
    background: #fff;
    box-shadow: 0 1.5rem 4rem rgba(32, 53, 84, 0.12);
}

.eyebrow {
    margin: 0 0 1rem;
    color: #1769aa;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

h1 {
    margin: 0;
    font-size: clamp(2rem, 7vw, 3.8rem);
    line-height: 1;
    letter-spacing: -0.05em;
}

p {
    color: #52637a;
    line-height: 1.7;
}

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

.alert {
    margin: 1.25rem 0;
    padding: 0.9rem 1rem;
    border: 1px solid #efb8b8;
    border-radius: 0.75rem;
    background: #fff4f4;
    color: #9b2525;
}

.alert-warning {
    border-color: #e5c66b;
    background: #fff9e8;
    color: #6f5410;
}

.debug-details {
    margin: 1rem 0 1.5rem;
    border: 1px solid #d59a9a;
    border-radius: 0.75rem;
    background: #fffafa;
    color: #5f1d1d;
}

.debug-details summary {
    cursor: pointer;
    padding: 0.8rem 1rem;
    font-weight: 700;
}

.debug-details pre {
    max-height: 28rem;
    margin: 0;
    padding: 1rem;
    overflow: auto;
    border-top: 1px solid #e4bcbc;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-size: 0.78rem;
    line-height: 1.5;
}

.stack-form {
    display: grid;
    gap: 1.1rem;
    margin-top: 2rem;
}

.turnstile-field {
    min-height: 65px;
    overflow-x: auto;
}

.stack-form label {
    display: grid;
    gap: 0.45rem;
    color: #34445b;
    font-weight: 650;
}

input {
    width: 100%;
    min-height: 2.9rem;
    padding: 0.7rem 0.8rem;
    border: 1px solid #bcc9da;
    border-radius: 0.65rem;
    background: #fff;
    color: #172033;
    font: inherit;
}

select {
    width: 100%;
    min-height: 2.9rem;
    padding: 0.7rem 0.8rem;
    border: 1px solid #bcc9da;
    border-radius: 0.65rem;
    background: #fff;
    color: #172033;
    font: inherit;
}

input:focus,
select:focus {
    border-color: #1769aa;
    outline: 3px solid rgba(23, 105, 170, 0.18);
}

button {
    min-height: 2.9rem;
    padding: 0.7rem 1.2rem;
    border: 1px solid #1769aa;
    border-radius: 0.65rem;
    background: #1769aa;
    color: #fff;
    font: inherit;
    font-weight: 750;
    cursor: pointer;
}

button:hover {
    background: #10578f;
}

button:disabled {
    cursor: wait;
    opacity: 0.72;
}

button:focus-visible {
    outline: 3px solid rgba(23, 105, 170, 0.28);
    outline-offset: 2px;
}

button.secondary {
    background: #fff;
    color: #1769aa;
}

button.danger {
    border-color: #b42318;
    background: #b42318;
}

button.danger:hover {
    background: #8f1c13;
}

button.compact {
    min-height: 2.2rem;
    padding: 0.35rem 0.65rem;
    font-size: 0.82rem;
}

.device-actions {
    display: flex;
    justify-content: flex-end;
    margin: 0 0 1rem;
}

.device-actions form,
.device-admin-actions form {
    margin: 0;
}

.device-admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.subsection-heading {
    margin: 2rem 0 1rem;
}

.subsection-heading h2 {
    margin-bottom: 0.25rem;
}

.logout-form {
    margin-top: 2rem;
}

dl {
    display: grid;
    gap: 0.8rem;
    margin: 2rem 0 0;
}

dl div {
    display: grid;
    grid-template-columns: 8rem 1fr;
    padding-top: 0.8rem;
    border-top: 1px solid #e8edf4;
}

dt {
    color: #718198;
}

dd {
    margin: 0;
    font-weight: 650;
}

a {
    color: #1769aa;
}

code {
    font-family: "Cascadia Code", Consolas, monospace;
}

.app-body {
    display: block;
    padding: 0;
    background: #f4f7fb;
}

.site-header {
    position: sticky;
    z-index: 10;
    top: 0;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 2rem;
    min-height: 4.5rem;
    padding: 0.75rem max(1rem, calc((100vw - 76rem) / 2));
    border-bottom: 1px solid #dce4ef;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 0.35rem 1.3rem rgba(32, 53, 84, 0.06);
}

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

.site-header nav {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
}

.site-header nav a {
    color: #42546d;
    font-weight: 650;
    text-decoration: none;
}

.site-header nav a:hover,
.site-header nav a:focus-visible {
    color: #1769aa;
}

.account-menu {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    color: #52637a;
    font-size: 0.9rem;
}

.account-menu form {
    margin: 0;
}

button.text-button {
    min-height: auto;
    padding: 0.35rem 0.55rem;
    border: 0;
    background: transparent;
    color: #1769aa;
}

button.text-button:hover {
    background: #edf5fc;
}

.app-main {
    width: min(76rem, calc(100% - 2rem));
    margin: 2rem auto 4rem;
    padding: clamp(1.2rem, 3vw, 2.5rem);
    border: 1px solid #dce4ef;
    border-radius: 1.25rem;
    background: #fff;
    box-shadow: 0 1rem 3rem rgba(32, 53, 84, 0.08);
}

.app-main h1 {
    font-size: clamp(2rem, 5vw, 3.25rem);
}

.page-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 2rem;
    margin-bottom: 1.5rem;
}

.page-heading p:not(.eyebrow) {
    margin-bottom: 0;
}

.heading-actions,
.home-actions,
.form-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

.home-actions {
    margin-top: 2rem;
}

.button-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.9rem;
    padding: 0.7rem 1.2rem;
    border: 1px solid #1769aa;
    border-radius: 0.65rem;
    background: #1769aa;
    color: #fff;
    font-weight: 750;
    text-decoration: none;
    white-space: nowrap;
}

.button-link:hover {
    background: #10578f;
}

.secondary-link {
    display: inline-flex;
    align-items: center;
    min-height: 2.9rem;
    padding: 0.65rem 0.4rem;
    font-weight: 700;
    text-decoration: none;
}

.notice {
    margin: 1.25rem 0;
    padding: 0.9rem 1rem;
    border: 1px solid #a8d7bd;
    border-radius: 0.75rem;
    background: #f0fbf5;
    color: #23643f;
}

.helper,
small {
    display: block;
    color: #718198;
    font-size: 0.86rem;
    line-height: 1.5;
}

.filter-form {
    display: grid;
    grid-template-columns: minmax(16rem, 1fr) minmax(9rem, 0.35fr) minmax(10rem, 0.45fr) auto auto;
    align-items: end;
    gap: 0.8rem;
    margin: 1.5rem 0;
    padding: 1rem;
    border-radius: 0.9rem;
    background: #f4f7fb;
}

.filter-form label,
.asset-form label,
.admin-actions label {
    display: grid;
    gap: 0.4rem;
    color: #34445b;
    font-weight: 650;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid #e1e8f1;
    border-radius: 0.85rem;
}

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

th,
td {
    padding: 0.8rem 0.9rem;
    border-bottom: 1px solid #e8edf4;
    text-align: left;
    vertical-align: top;
}

th {
    background: #f6f8fb;
    color: #52637a;
    font-size: 0.82rem;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

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

.status {
    display: inline-flex;
    padding: 0.25rem 0.55rem;
    border-radius: 999px;
    background: #edf2f7;
    color: #42546d;
    font-size: 0.82rem;
    font-weight: 750;
    white-space: nowrap;
}

.status-in_use {
    background: #edf5fc;
    color: #1769aa;
}

.status-in_stock {
    background: #fff5dd;
    color: #815d00;
}

.status-retired {
    background: #f0f1f3;
    color: #606b7a;
}

.status-active {
    background: #e8f7ef;
    color: #23643f;
}

.status-inactive {
    background: #f0f1f3;
    color: #606b7a;
}

.status-draft {
    background: #f0f1f3;
    color: #606b7a;
}

.status-pending_approval,
.status-returned {
    background: #fff5dd;
    color: #815d00;
}

.status-in_progress {
    background: #edf5fc;
    color: #1769aa;
}

.status-pending_confirmation {
    background: #f1ebff;
    color: #6841a5;
}

.status-closed {
    background: #e8f7ef;
    color: #23643f;
}

.priority-urgent {
    color: #a12828;
    font-weight: 800;
}

.role-list,
.role-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.role-checkboxes {
    margin: 0.5rem 0 1rem;
}

.role-checkboxes .check-label {
    min-width: 10rem;
    padding: 0.75rem;
    border: 1px solid #dce4ef;
    border-radius: 0.7rem;
    background: #f8fafc;
}

.admin-source-note {
    margin: 1rem 0 1.5rem;
    padding: 0.9rem 1rem;
    border-left: 0.3rem solid #d19a21;
    border-radius: 0.25rem 0.7rem 0.7rem 0.25rem;
    background: #fff9e9;
    color: #6d5313;
}

.impersonation-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(20rem, 0.65fr);
    gap: 1.5rem;
    margin: 1rem 0 1.5rem;
    padding: 1.1rem;
    border: 1px solid #e2b85c;
    border-radius: 0.65rem;
    background: #fff8e7;
    color: #604511;
}

.impersonation-panel h2 {
    margin: 0 0 0.4rem;
    color: #6b4300;
    font-size: 1.05rem;
}

.impersonation-panel p {
    margin: 0;
}

.impersonation-panel form {
    display: grid;
    gap: 0.65rem;
}

.impersonation-panel label {
    display: grid;
    gap: 0.35rem;
    font-weight: 700;
}

.impersonation-panel .warning-button {
    background: #a84f13;
}

.impersonation-panel .warning-button:hover {
    background: #873b0a;
}

.filter-form.admin-filter {
    grid-template-columns:
        minmax(16rem, 1fr)
        minmax(8rem, 0.3fr)
        minmax(14rem, 0.65fr)
        auto
        auto;
}

.filter-form.audit-filter {
    grid-template-columns:
        minmax(18rem, 1fr)
        minmax(9rem, 0.35fr)
        auto
        auto;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1rem;
    color: #52637a;
}

.pagination .secondary-link {
    min-height: auto;
}

.empty-state {
    padding: 3rem 1rem;
    border: 1px dashed #bcc9da;
    border-radius: 0.9rem;
    text-align: center;
}

.empty-state h2 {
    margin-top: 0;
}

.asset-form {
    display: grid;
    gap: 1.25rem;
}

.asset-form fieldset {
    margin: 0;
    padding: 1.25rem;
    border: 1px solid #dce4ef;
    border-radius: 0.9rem;
}

.form-section {
    margin: 0 0 1rem;
    padding: 1.25rem;
    border: 1px solid #dce4ef;
    border-radius: 0.9rem;
}

.form-section h2 {
    margin-top: 0;
}

.wide-field {
    grid-column: 1 / -1;
}

.asset-form legend {
    padding: 0 0.45rem;
    color: #172033;
    font-size: 1.05rem;
    font-weight: 800;
}

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

.span-2 {
    grid-column: span 2;
}

.check-label {
    display: flex !important;
    grid-template-columns: auto 1fr;
    align-items: center;
}

.check-label input {
    width: 1.1rem;
    min-height: 1.1rem;
}

.spec-editor input {
    min-width: 7rem;
}

.spec-editor td:nth-child(3) input {
    min-width: 5rem;
}

.detail-card {
    margin-top: 1.25rem;
    padding: 1.25rem;
    border: 1px solid #dce4ef;
    border-radius: 0.9rem;
}

.detail-card h2 {
    margin-top: 0;
}

.detail-card-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 1rem;
}

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

.action-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.action-grid form {
    padding: 1rem;
    border: 1px solid #e1e8f1;
    border-radius: 0.8rem;
}

.action-grid h3 {
    margin-top: 0;
}

.long-text {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e1e8f1;
}

.long-text h3 {
    margin: 0 0 0.45rem;
}

.long-text p {
    margin: 0;
}

.message-list {
    display: grid;
    gap: 0.75rem;
}

.message-item {
    padding: 0.9rem 1rem;
    border: 1px solid #e1e8f1;
    border-radius: 0.75rem;
    background: #fbfcfe;
}

.message-item header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem;
    color: #718198;
    font-size: 0.88rem;
}

.message-item p {
    margin: 0.65rem 0 0;
}

.internal-label {
    padding: 0.1rem 0.4rem;
    border-radius: 999px;
    background: #f1ebff;
    color: #6841a5;
    font-weight: 750;
}

.message-form {
    display: grid;
    gap: 0.8rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e1e8f1;
}

button.danger {
    border-color: #ad2e2e;
    background: #ad2e2e;
}

button.danger:hover {
    background: #8e2020;
}

.timeline {
    display: grid;
    gap: 0;
    margin: 0;
    padding: 0;
    list-style: none;
}

.timeline li {
    position: relative;
    display: grid;
    grid-template-columns: minmax(8rem, 0.35fr) minmax(8rem, 0.25fr) 1fr;
    gap: 1rem;
    padding: 0.85rem 0;
    border-bottom: 1px solid #e8edf4;
}

.timeline li:last-child {
    border-bottom: 0;
}

.timeline span {
    color: #718198;
    font-size: 0.9rem;
}

.timeline p {
    margin: 0;
}

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

@media (max-width: 820px) {
    .site-header {
        grid-template-columns: 1fr auto;
        gap: 0.75rem;
    }

    .site-header nav {
        grid-column: 1 / -1;
        grid-row: 2;
        order: 3;
    }

    .account-menu span {
        display: none;
    }

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

    .filter-form.admin-filter {
        grid-template-columns: 1fr 1fr;
    }

    .filter-form.audit-filter {
        grid-template-columns: 1fr 1fr;
    }

    .filter-form label:first-child {
        grid-column: 1 / -1;
    }

    .page-heading {
        display: grid;
    }
}

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

    .app-body {
        padding: 0;
    }

    .app-main {
        width: calc(100% - 1rem);
        margin-top: 0.5rem;
        padding: 1rem;
        border-radius: 0.9rem;
    }

    .form-grid,
    .detail-grid,
    .action-grid,
    .filter-form,
    .filter-form.admin-filter,
    .filter-form.audit-filter {
        grid-template-columns: 1fr;
    }

    .span-2,
    .filter-form label:first-child {
        grid-column: auto;
    }

    .detail-grid div {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }

    .timeline li {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }
}

/* ERP workspace shell */
.app-body {
    min-height: 100vh;
    background: #edf1f5;
}

.site-header {
    position: sticky;
    z-index: 30;
    top: 0;
    display: block;
    min-height: 0;
    padding: 0;
    border: 0;
    background: #fff;
    box-shadow: 0 0.15rem 0.8rem rgba(24, 48, 72, 0.16);
}

.impersonation-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 3.5rem;
    padding: 0.65rem 1.25rem;
    border-bottom: 1px solid #da9f2a;
    background: #fff0c7;
    color: #5e3c00;
    font-size: 0.9rem;
}

.impersonation-banner strong {
    margin-right: 0.55rem;
    color: #8c2f0b;
}

.impersonation-banner form {
    flex: 0 0 auto;
}

.impersonation-banner button {
    min-height: 2.25rem;
    padding: 0.45rem 0.8rem;
    background: #8c2f0b;
    white-space: nowrap;
}

.impersonation-banner button:hover {
    background: #6e2106;
}

.app-body.is-impersonating-write .impersonation-banner {
    border-bottom-color: #bd544b;
    background: #ffe1de;
    color: #702720;
}

.app-body.is-impersonating-write .impersonation-banner strong {
    color: #922f27;
}

.erp-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    min-height: 3.75rem;
    padding: 0.55rem 1.25rem;
    background: #173b57;
}

.site-header .brand {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    color: #fff;
}

.site-header .brand:hover,
.site-header .brand:focus-visible {
    color: #fff;
}

.brand-mark {
    display: inline-grid;
    min-width: 2.8rem;
    min-height: 2rem;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.38);
    border-radius: 0.3rem;
    background: rgba(255, 255, 255, 0.1);
    font-size: 0.9rem;
    letter-spacing: 0.08em;
}

.brand-name {
    font-size: 1rem;
    letter-spacing: 0.02em;
}

.site-header .account-menu {
    color: #eaf3f8;
}

.site-header .account-menu a {
    color: #fff;
}

.notification-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.notification-badge {
    display: inline-grid;
    min-width: 1.25rem;
    min-height: 1.25rem;
    padding: 0 0.25rem;
    place-items: center;
    border-radius: 999px;
    background: #e64141;
    color: #fff;
    font-size: 0.68rem;
    font-weight: 800;
}

.notification-list {
    display: grid;
    border: 1px solid #cfd8e2;
    border-radius: 0.3rem;
}

.notification-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1rem;
    border-bottom: 1px solid #dce3ea;
    background: #fff;
}

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

.notification-item.is-unread {
    background: #edf6fb;
}

.notification-copy {
    min-width: 0;
}

.notification-copy header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.55rem;
}

.notification-copy time {
    color: #718198;
    font-size: 0.8rem;
}

.notification-copy p {
    margin: 0.35rem 0 0;
}

.unread-dot {
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 999px;
    background: #1683bd;
}

.account-identity {
    display: grid;
    gap: 0.05rem;
    text-align: right;
}

.account-identity small {
    color: #bfd2df;
    font-size: 0.73rem;
}

.site-header button.text-button {
    color: #fff;
}

.site-header button.text-button:hover {
    background: rgba(255, 255, 255, 0.12);
}

.site-header .module-tabs {
    display: flex;
    flex-wrap: nowrap;
    gap: 0;
    min-height: 3rem;
    padding: 0 1.25rem;
    overflow-x: auto;
    border-bottom: 1px solid #cfd8e2;
    background: #fff;
}

.site-header .module-tab {
    position: relative;
    display: inline-flex;
    align-items: center;
    min-width: 7.5rem;
    padding: 0.75rem 1.2rem;
    color: #526477;
    font-size: 0.92rem;
    font-weight: 700;
    justify-content: center;
    text-decoration: none;
    white-space: nowrap;
}

.site-header .module-tab:hover,
.site-header .module-tab:focus-visible {
    background: #f2f6f9;
    color: #125f91;
}

.site-header .module-tab.is-active {
    background: #eef5fa;
    color: #125f91;
}

.site-header .module-tab.is-active::after {
    position: absolute;
    right: 0.75rem;
    bottom: 0;
    left: 0.75rem;
    height: 0.2rem;
    background: #1683bd;
    content: "";
}

.site-header .module-tab.is-disabled,
.site-header .module-tab.is-disabled:hover {
    cursor: default;
    background: #f4f6f8;
    color: #9aa6b1;
}

.site-header .module-tab.is-disabled::after {
    content: none;
}

.app-shell {
    display: grid;
    grid-template-columns: 14rem minmax(0, 1fr);
    width: 100%;
    min-height: calc(100vh - 6.75rem);
    margin: 0;
    justify-items: stretch;
}

.app-sidebar {
    position: sticky;
    top: 6.75rem;
    align-self: start;
    height: calc(100vh - 6.75rem);
    width: 100%;
    padding: 1.25rem 0.9rem;
    overflow-y: auto;
    justify-self: start;
    border-right: 1px solid #cfd8e2;
    background: #f7f9fb;
    text-align: left;
}

.app-body.is-impersonating .app-sidebar {
    top: 10.25rem;
    height: calc(100vh - 10.25rem);
}

.app-body.is-impersonating-read-only .app-main form[method="post"] {
    opacity: 0.65;
}

.app-body.is-impersonating-read-only .app-main form[method="post"] :is(
    input,
    select,
    textarea,
    button
) {
    cursor: not-allowed;
    pointer-events: none;
}

.sidebar-heading {
    display: grid;
    gap: 0.25rem;
    padding: 0 0.65rem 0.85rem;
    border-bottom: 1px solid #dce3ea;
    text-align: left;
}

.sidebar-heading span {
    color: #7a8998;
    font-size: 0.72rem;
    font-weight: 750;
    letter-spacing: 0.1em;
}

.sidebar-heading strong {
    color: #24394c;
    font-size: 1rem;
}

.operation-menu {
    display: grid;
    gap: 0.25rem;
    margin-top: 0.75rem;
    justify-items: stretch;
    text-align: left;
}

.operation-link {
    display: grid;
    grid-template-columns: 0.35rem 1fr;
    align-items: center;
    gap: 0.65rem;
    min-height: 2.65rem;
    padding: 0.55rem 0.75rem;
    border-radius: 0.3rem;
    color: #3f5366;
    font-size: 0.9rem;
    font-weight: 680;
    text-align: left;
    text-decoration: none;
}

.operation-link > span {
    width: 0.32rem;
    height: 0.32rem;
    border-radius: 50%;
    background: #9aabba;
}

.operation-link:hover,
.operation-link:focus-visible {
    background: #e9f0f5;
    color: #125f91;
}

.operation-link.is-active {
    background: #dcecf6;
    color: #0e5f91;
}

.operation-link.is-active > span {
    background: #1683bd;
}

.operation-link.is-disabled,
.operation-link.is-disabled:hover {
    cursor: default;
    background: transparent;
    color: #9aa6b1;
}

.operation-link.is-disabled > span {
    background: #c3cbd2;
}

.app-main {
    width: 100%;
    min-width: 0;
    min-height: calc(100vh - 6.75rem);
    margin: 0;
    padding: 1.5rem 1.75rem 3rem;
    border: 0;
    border-radius: 0;
    background: #fff;
    box-shadow: none;
    justify-self: stretch;
    text-align: left;
}

.app-main h1 {
    font-size: 1.25rem;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.app-main .page-heading {
    align-items: center;
    margin-bottom: 0.8rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #dce3ea;
}

.app-main .page-heading p:not(.eyebrow) {
    margin-top: 0.45rem;
}

.app-main .eyebrow {
    display: none;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    min-height: 2rem;
    margin: -0.35rem 0 0.45rem;
    color: #6d7f8f;
    font-size: 0.78rem;
}

.breadcrumb a {
    color: #315f7d;
    font-weight: 700;
    text-decoration: none;
}

.breadcrumb a:hover,
.breadcrumb a:focus-visible {
    text-decoration: underline;
}

.breadcrumb [aria-current="page"] {
    color: #344b5e;
    font-weight: 700;
}

.breadcrumb-separator {
    color: #9aa8b4;
}

.app-main .filter-form {
    margin: 0 0 1rem;
    padding: 0.8rem;
    border: 1px solid #d9e1e8;
    border-radius: 0.35rem;
    background: #f7f9fb;
}

.app-main input,
.app-main select,
.app-main button,
.app-main .button-link {
    border-radius: 0.35rem;
}

.app-main .table-wrap {
    width: 100%;
    margin-right: 0;
    margin-left: 0;
    text-align: left;
}

.app-main .table-wrap table {
    width: 100%;
    margin: 0;
}

.data-grid {
    position: relative;
    max-height: calc(100vh - 20.5rem);
    overflow: auto;
    border-color: #cfd8e2;
    border-radius: 0.15rem;
    background: #fff;
    box-shadow: 0 0.2rem 0.7rem rgba(32, 53, 84, 0.06);
}

.data-grid.data-grid-tall {
    max-height: calc(100vh - 14.5rem);
}

.data-grid th,
.data-grid td {
    padding: 0.45rem 0.6rem;
    font-size: 0.86rem;
}

.data-grid thead th {
    position: sticky;
    z-index: 4;
    top: 0;
    border-bottom: 1px solid #bfcbd6;
    background: #eaf0f5;
    box-shadow: 0 1px 0 #bfcbd6;
    color: #344b5e;
}

.data-grid tbody tr:nth-child(even) td {
    background: #fafbfd;
}

.data-grid tbody tr:hover td {
    background: #edf6fb;
}

.cell-number,
.cell-date {
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.status-returned {
    background: #ffe1de;
    color: #922f27;
}

.erp-toolbar {
    display: flex;
    align-items: flex-end;
    gap: 0.7rem;
    width: 100%;
    margin: 0 0 1rem;
    padding: 0.55rem;
    border: 1px solid #cfd8e2;
    border-radius: 0.25rem;
    background: #f7f9fb;
}

.erp-toolbar .toolbar-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 0.45rem;
}

.erp-toolbar .button-link {
    min-height: 2.45rem;
    padding: 0.5rem 0.8rem;
    border-radius: 0.25rem;
}

.erp-toolbar .filter-form {
    flex: 1 1 auto;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
}

.erp-toolbar-filter-only .filter-form {
    width: 100%;
}

@media (max-width: 980px) {
    .erp-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .erp-toolbar .toolbar-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 980px) {
    .impersonation-panel {
        grid-template-columns: 1fr;
    }

    .app-shell {
        display: block;
    }

    .app-sidebar {
        position: static;
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        align-items: center;
        gap: 1rem;
        height: auto;
        padding: 0.6rem 1rem;
        overflow: visible;
        border-right: 0;
        border-bottom: 1px solid #cfd8e2;
    }

    .app-body.is-impersonating .app-sidebar {
        height: auto;
    }

    .sidebar-heading {
        padding: 0 1rem 0 0;
        border-right: 1px solid #dce3ea;
        border-bottom: 0;
    }

    .sidebar-heading span {
        display: none;
    }

    .operation-menu {
        display: flex;
        gap: 0.35rem;
        margin: 0;
        overflow-x: auto;
    }

    .operation-link {
        display: inline-flex;
        min-width: max-content;
    }

    .data-grid {
        max-height: calc(100vh - 24rem);
    }
}

@media (max-width: 600px) {
    .impersonation-banner {
        align-items: stretch;
        flex-direction: column;
        padding: 0.65rem 0.75rem;
    }

    .impersonation-banner button {
        width: 100%;
    }

    .erp-header-row {
        padding: 0.5rem 0.75rem;
    }

    .brand-name,
    .account-identity small {
        display: none;
    }

    .site-header .module-tabs {
        padding: 0;
    }

    .site-header .module-tab {
        min-width: 6.5rem;
        padding-right: 0.85rem;
        padding-left: 0.85rem;
    }

    .app-sidebar {
        grid-template-columns: 1fr;
        gap: 0.45rem;
        padding: 0.55rem;
    }

    .sidebar-heading {
        display: none;
    }

    .app-main {
        width: 100%;
        min-height: 0;
        margin: 0;
        padding: 1rem;
        border-radius: 0;
    }

    .data-grid,
    .data-grid.data-grid-tall {
        max-height: 65vh;
    }
}

.site-header .account-identity {
    display: grid;
}

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

.module-card {
    display: grid;
    align-content: start;
    min-height: 12rem;
    padding: 1.15rem;
    border: 1px solid #cfdae3;
    border-radius: 0.45rem;
    background: #fff;
    color: #24394c;
    box-shadow: 0 0.25rem 0.9rem rgba(32, 53, 84, 0.07);
    text-decoration: none;
    transition: border-color 120ms ease, box-shadow 120ms ease,
        transform 120ms ease;
}

.module-card:hover,
.module-card:focus-visible {
    border-color: #5b9fc5;
    box-shadow: 0 0.45rem 1.2rem rgba(32, 83, 116, 0.14);
    transform: translateY(-1px);
}

.module-card-code {
    margin-bottom: 1.1rem;
    color: #4d7893;
    font-family: "Cascadia Code", Consolas, monospace;
    font-size: 0.72rem;
    font-weight: 750;
    letter-spacing: 0.09em;
}

.module-card strong {
    font-size: 1.12rem;
}

.module-card p {
    margin: 0.6rem 0 1rem;
    font-size: 0.9rem;
    line-height: 1.55;
}

.module-card-action {
    align-self: end;
    margin-top: auto;
    color: #126b9f;
    font-size: 0.86rem;
    font-weight: 750;
}

.module-card-disabled,
.module-card-disabled:hover {
    cursor: default;
    border-color: #d8dfe5;
    background: #f6f8fa;
    box-shadow: none;
    transform: none;
}

.module-card-disabled .module-card-action {
    color: #8996a2;
}

.workspace-summary {
    width: 100%;
    max-width: none;
    margin-right: 0;
    margin-left: 0;
}

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

.status-bar { display:flex; gap:1.25rem; justify-content:space-between; padding:.3rem 1rem; border-top:1px solid #cbd5e1; background:#eef2f6; color:#425569; font-size:.75rem; flex-wrap:wrap; }
.detail-card > label { display:block; margin:.6rem 0; }
.detail-card > label > input:not([type=checkbox]), .detail-card > label > select, .detail-card > label > textarea { display:block; width:min(100%,40rem); }
.detail-card small, .hint { color:#526478; font-size:.82rem; }
.inline-form { display:flex; gap:.5rem; align-items:center; flex-wrap:wrap; }
.profile-reminder { margin:.5rem 0; }

@media (max-width: 700px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .module-card {
        min-height: 10rem;
    }
}
