:root {
    color-scheme: light;
    --bg: #eef3f8;
    --bg-2: #f3f6fa;
    --bg-3: #dfe8f2;
    --text: #17202a;
    --muted: #667085;
    --line: #cfd8e3;
    --line-soft: rgba(23, 32, 42, .10);
    --panel: #ffffff;
    --panel-muted: #f7f9fc;
    --accent: #2563eb;
    --accent-2: #1d4ed8;
    --green: var(--accent);
    --green-2: var(--accent-2);
    --blue: var(--accent);
    --status-success: #168456;
    --status-success-rgb: 22, 132, 86;
    --status-success-bg: #e6f4ee;
    --status-warning: #b7791f;
    --status-warning-rgb: 183, 121, 31;
    --status-warning-bg: #fff4df;
    --status-danger: #c2354d;
    --status-danger-rgb: 194, 53, 77;
    --status-danger-bg: #fdecef;
    --status-info: #2563eb;
    --status-info-rgb: 37, 99, 235;
    --status-info-bg: #eaf1ff;
    --status-neutral: #64748b;
    --status-neutral-rgb: 100, 116, 139;
    --status-neutral-bg: #eef2f7;
    --success: var(--status-success);
    --amber: var(--status-warning);
    --red: var(--status-danger);
    --info: var(--status-info);
    --neutral: var(--status-neutral);
    --sidebar: #0f172a;
    --sidebar-2: #111827;
    --sidebar-text: #e5edf7;
    --sidebar-muted: #9aa7b8;
    --sidebar-line: rgba(255, 255, 255, .10);
    --sidebar-hover: rgba(255, 255, 255, .08);
    --sidebar-active: rgba(37, 99, 235, .18);
    --radius-sm: 6px;
    --radius: 16px;
    --radius-md: 14px;
    --shadow: 0 14px 36px rgba(15, 23, 42, .10);
    --soft-shadow: 0 7px 20px rgba(15, 23, 42, .07);
    --focus-ring: 0 0 0 3px rgba(37, 99, 235, .18);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    overflow-x: hidden;
    background: linear-gradient(180deg, var(--bg), var(--bg-2) 46%, var(--bg-3));
    font-size: 15px;
    line-height: 1.45;
}

a { color: inherit; }

.app-layout {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 224px minmax(0, 1fr);
    transition: grid-template-columns .18s ease;
}

.sidebar-collapsed .app-layout {
    grid-template-columns: 72px minmax(0, 1fr);
}

.topbar {
    position: sticky;
    top: 0;
    align-self: start;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 1.15rem;
    height: 100vh;
    padding: 1rem .85rem;
    overflow-y: auto;
    background:
        linear-gradient(180deg, rgba(37, 99, 235, .10), transparent 24rem),
        linear-gradient(180deg, var(--sidebar), var(--sidebar-2));
    color: var(--sidebar-text);
    border-right: 1px solid var(--sidebar-line);
    box-shadow: 16px 0 42px rgba(15, 23, 42, .18);
}

.sidebar-toggle {
    position: fixed;
    left: calc(224px - 1rem);
    bottom: 3.05rem;
    z-index: 30;
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    margin: 0;
    padding: 0;
    border: 1px solid var(--sidebar-line);
    border-radius: 999px;
    background: #172033;
    color: var(--sidebar-text);
    box-shadow: 0 12px 28px rgba(15, 23, 42, .28);
    cursor: pointer;
    backdrop-filter: blur(14px);
}

.sidebar-toggle:hover {
    background: var(--accent);
    color: #fff;
    transform: translateX(-1px);
}

.sidebar-toggle-icon {
    display: block;
    font-size: 1.35rem;
    line-height: 1;
    transition: transform .18s ease;
}

.sidebar-collapsed .sidebar-toggle-icon {
    transform: rotate(180deg);
}

.sidebar-collapsed .sidebar-toggle {
    left: calc(72px - 1rem);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: .75rem;
    padding: .25rem .2rem .75rem;
    text-decoration: none;
    color: #ffffff;
    border-bottom: 1px solid var(--sidebar-line);
}

.brand > span:last-child {
    min-width: 0;
    white-space: nowrap;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 2.2rem;
    height: 2.2rem;
    border-radius: var(--radius-md);
    background: var(--accent);
    color: white;
    font-weight: 800;
    box-shadow: 0 8px 18px rgba(37, 99, 235, .22);
}

.brand small {
    display: block;
    color: var(--sidebar-muted);
    font-size: .75rem;
}

.data-health-strip {
    display: grid;
    grid-template-columns: 1fr;
    gap: .3rem;
    margin-top: -.4rem;
    padding: .55rem;
    border: 1px solid var(--sidebar-line);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, .055);
}

.data-health-item {
    display: flex;
    align-items: center;
    gap: .45rem;
    min-width: 0;
    min-height: 1.45rem;
    color: var(--sidebar-muted);
    font-size: .78rem;
    font-weight: 800;
    line-height: 1;
    outline: none;
}

.data-health-item.is-green {
    color: #dfffee;
}

.data-health-item.is-yellow {
    color: #fff1c2;
}

.data-health-item.is-red {
    color: #ffe0e5;
}

.data-health-item:focus-visible {
    border-radius: var(--radius-sm);
    box-shadow: var(--focus-ring);
}

.data-health-dot {
    width: .78rem;
    height: .78rem;
    min-width: .78rem;
    border-radius: 999px;
    background: #94a3b8;
    box-shadow:
        0 0 0 4px rgba(148, 163, 184, .16),
        0 0 14px rgba(148, 163, 184, .18);
}

.data-health-item.is-green .data-health-dot {
    background: #22d37b;
    box-shadow:
        0 0 0 4px rgba(34, 211, 123, .18),
        0 0 18px rgba(34, 211, 123, .54);
}

.data-health-item.is-yellow .data-health-dot {
    background: #f6b93b;
    box-shadow:
        0 0 0 4px rgba(246, 185, 59, .18),
        0 0 18px rgba(246, 185, 59, .46);
}

.data-health-item.is-red .data-health-dot {
    background: #ef4b63;
    box-shadow:
        0 0 0 4px rgba(239, 75, 99, .18),
        0 0 18px rgba(239, 75, 99, .48);
}

.data-health-item.is-gray .data-health-dot {
    background: #94a3b8;
    box-shadow:
        0 0 0 4px rgba(148, 163, 184, .16),
        0 0 14px rgba(148, 163, 184, .18);
}

.data-health-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.main-nav {
    display: flex;
    flex: 1;
    flex-direction: column;
    flex-wrap: nowrap;
    gap: .35rem;
    align-items: stretch;
}

.nav-icon {
    display: inline-grid;
    place-items: center;
    width: 1.25rem;
    min-width: 1.25rem;
    margin-right: .45rem;
    color: inherit;
    font-weight: 900;
    opacity: .82;
}

.nav-label {
    min-width: 0;
}

.main-nav a, .nav-menu summary, .primary-action, .secondary-action, .ghost-action, .danger-action, .warn-action, button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    min-height: 2.35rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: .72rem 1rem;
    background: var(--panel);
    text-decoration: none;
    font-weight: 700;
    line-height: 1.1;
}

.main-nav > a,
.nav-menu summary {
    display: flex;
    width: 100%;
    justify-content: flex-start;
    border-color: transparent;
    border-radius: var(--radius-md);
    padding: .64rem .7rem;
    background: transparent;
    color: var(--sidebar-muted);
    text-align: left;
}

.main-nav > a:hover,
.main-nav > a.is-active,
.nav-menu[open] > summary,
.nav-menu summary:hover {
    background: var(--sidebar-hover);
    color: #ffffff;
}

.main-nav > a.is-active,
.nav-menu[open] > summary {
    background: var(--sidebar-active);
    box-shadow: inset 3px 0 0 #60a5fa;
}

.nav-menu {
    position: relative;
}

.nav-menu summary {
    list-style: none;
    cursor: pointer;
}

.nav-menu summary::-webkit-details-marker {
    display: none;
}

.nav-menu summary::after {
    content: "⌄";
    float: right;
    margin-left: auto;
    color: var(--sidebar-muted);
}

.sidebar-collapsed .topbar {
    gap: .82rem;
    padding: .9rem .4rem;
    overflow: visible;
    align-items: center;
}

.sidebar-collapsed .brand {
    justify-content: center;
    gap: 0;
    padding: .25rem 0 .55rem;
}

.sidebar-collapsed .brand {
    border-bottom: 0;
}

.sidebar-collapsed .brand > span:last-child,
.sidebar-collapsed .data-health-label,
.sidebar-collapsed .nav-label,
.sidebar-collapsed .nav-dropdown,
.sidebar-collapsed .nav-user,
.sidebar-collapsed .nav-menu summary::after {
    display: none;
}

.sidebar-collapsed .data-health-strip {
    display: grid;
    grid-template-columns: repeat(2, .72rem);
    grid-auto-rows: .72rem;
    justify-content: center;
    align-content: center;
    align-self: center;
    width: auto;
    justify-items: center;
    gap: .54rem;
    padding: .62rem;
    border-radius: 1rem;
    background: rgba(255, 255, 255, .06);
}

.sidebar-collapsed .data-health-item {
    justify-content: center;
    width: .72rem;
    min-height: .72rem;
}

.sidebar-collapsed .main-nav {
    width: 100%;
    gap: .34rem;
    align-items: center;
    transform: translateX(.32rem);
}

.sidebar-collapsed .main-nav > a,
.sidebar-collapsed .nav-menu {
    width: 2.75rem;
}

.sidebar-collapsed .nav-menu {
    display: grid;
    place-items: center;
}

.sidebar-collapsed .nav-menu summary {
    width: 2.35rem;
}

.sidebar-collapsed .main-nav > a,
.sidebar-collapsed .nav-menu summary {
    width: 2.35rem;
    display: grid;
    place-items: center;
    height: 2.35rem;
    min-height: 2.35rem;
    padding: 0;
    border: 0;
    border-radius: .82rem;
    background: transparent;
    box-shadow: none;
    box-sizing: border-box;
    color: rgba(226, 237, 250, .66);
}

.sidebar-collapsed .main-nav > a {
    position: relative;
    isolation: isolate;
}

.sidebar-collapsed .main-nav > a::before {
    content: "";
    position: absolute;
    left: calc(50% - .62rem);
    top: 50%;
    z-index: 0;
    width: 2.35rem;
    height: 2.35rem;
    border-radius: .82rem;
    transform: translate(-50%, -50%);
    background: transparent;
    box-shadow: none;
}

.sidebar-collapsed .nav-icon {
    position: relative;
    z-index: 1;
    width: 1.2rem;
    min-width: 1.2rem;
    margin-right: 0;
    font-size: 1.02rem;
    line-height: 1;
    opacity: .82;
}

.sidebar-collapsed .data-health-dot {
    width: .72rem;
    height: .72rem;
    min-width: .72rem;
    box-shadow:
        0 0 0 3px rgba(148, 163, 184, .14),
        0 0 12px rgba(148, 163, 184, .16);
}

.sidebar-collapsed .data-health-item.is-green .data-health-dot {
    box-shadow:
        0 0 0 3px rgba(34, 211, 123, .20),
        0 0 16px rgba(34, 211, 123, .56);
}

.sidebar-collapsed .data-health-item.is-yellow .data-health-dot {
    box-shadow:
        0 0 0 3px rgba(246, 185, 59, .20),
        0 0 16px rgba(246, 185, 59, .46);
}

.sidebar-collapsed .data-health-item.is-red .data-health-dot {
    box-shadow:
        0 0 0 3px rgba(239, 75, 99, .20),
        0 0 16px rgba(239, 75, 99, .48);
}

.sidebar-collapsed .nav-menu summary:hover {
    background: rgba(255, 255, 255, .07);
    color: #ffffff;
}

.sidebar-collapsed .main-nav > a:hover {
    background: transparent;
    color: #ffffff;
}

.sidebar-collapsed .main-nav > a:hover::before {
    background: rgba(255, 255, 255, .07);
}

.sidebar-collapsed .nav-menu[open] > summary {
    background: linear-gradient(180deg, #2f6ff3, #1d4ed8);
    color: #ffffff;
    box-shadow:
        0 10px 22px rgba(37, 99, 235, .28),
        inset 0 1px 0 rgba(255, 255, 255, .22);
}

.sidebar-collapsed .main-nav > a.is-active {
    background: transparent;
    color: #ffffff;
    box-shadow: none;
}

.sidebar-collapsed .main-nav > a.is-active::before {
    background: linear-gradient(180deg, #2f6ff3, #1d4ed8);
    box-shadow:
        0 10px 22px rgba(37, 99, 235, .28),
        inset 0 1px 0 rgba(255, 255, 255, .22);
}

.sidebar-collapsed .main-nav > a.is-active .nav-icon,
.sidebar-collapsed .nav-menu[open] > summary .nav-icon {
    opacity: 1;
}

.sidebar-collapsed .nav-menu .nav-dropdown {
    position: absolute;
    left: calc(100% + .75rem);
    top: 0;
    z-index: 50;
    display: none;
    min-width: 15rem;
    margin: 0;
    padding: .55rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255,255,255,.98);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.sidebar-collapsed .nav-menu:hover .nav-dropdown,
.sidebar-collapsed .nav-menu:focus-within .nav-dropdown {
    display: grid;
}

.sidebar-collapsed .nav-menu .nav-dropdown a {
    color: var(--text);
    padding: .58rem .72rem;
}

.sidebar-collapsed .nav-menu .nav-dropdown a:hover {
    background: #eef4ff;
    color: var(--accent);
}

.sidebar-collapsed .nav-spacer {
    min-height: 1rem;
}

.nav-dropdown {
    position: static;
    display: grid;
    gap: .15rem;
    width: auto;
    margin-top: .25rem;
    padding: .2rem 0 .25rem .72rem;
    border: 0;
    border-left: 1px solid var(--sidebar-line);
    border-radius: 0;
    background: transparent;
    backdrop-filter: none;
    box-shadow: none;
}

.nav-dropdown a {
    justify-content: flex-start;
    min-height: 2rem;
    border: 0;
    background: transparent;
    color: var(--sidebar-muted);
    padding: .44rem .65rem;
    border-radius: var(--radius-sm);
    font-size: .93rem;
    font-weight: 750;
}

.nav-dropdown a:hover,
.nav-dropdown a.is-active {
    background: rgba(37, 99, 235, .16);
    color: #dbeafe;
}

.nav-spacer {
    flex: 1;
}

.nav-user {
    color: var(--sidebar-muted);
    font-size: .9rem;
    font-weight: 800;
    padding: .72rem .8rem .2rem;
}

.primary-action,
button {
    background: var(--accent);
    color: white;
    border-color: transparent;
}

.primary-action:hover,
button:not(.secondary-action):not(.danger-action):not(.warn-action):not(.ghost-action):not(:disabled):hover {
    background: var(--accent-2);
}

.secondary-action {
    background: var(--panel);
    color: #344054;
    border-color: var(--line);
}

.secondary-action:hover,
.ghost-action:hover {
    border-color: rgba(37, 99, 235, .25);
    background: #eef4ff;
    color: var(--accent);
}

.ghost-action {
    background: transparent;
    color: var(--muted);
    border-color: transparent;
}

.danger-action {
    background: var(--red);
    color: white;
    border-color: transparent;
}

.danger-action:hover,
button.danger-action:not(:disabled):hover {
    background: #a92f44;
}

.warn-action {
    background: rgba(183, 121, 31, .12);
    color: #7a4f0c;
    border-color: rgba(183, 121, 31, .28);
}

.warn-action:hover,
button.warn-action:not(:disabled):hover {
    background: rgba(183, 121, 31, .2);
    color: #6d4200;
}

.auth-page {
    display: grid;
    place-items: center;
    padding: 2rem;
}

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

.auth-card {
    padding: 2rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: var(--shadow);
}

.auth-brand {
    margin-bottom: 1.25rem;
}

.auth-card h1 {
    margin: 0 0 1.25rem;
    font-size: 2.2rem;
}

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

.auth-form label {
    display: grid;
    gap: .35rem;
    font-weight: 800;
}

.auth-form label span {
    color: var(--muted);
    font-size: .9rem;
}

.auth-error,
.auth-message {
    padding: .75rem .9rem;
    border-radius: var(--radius);
    font-weight: 800;
}

.auth-error {
    color: #7b2632;
    background: rgba(199,54,77,.1);
    border: 1px solid rgba(199,54,77,.22);
}

.auth-message {
    color: #0f6849;
    background: rgba(22,129,92,.1);
    border: 1px solid rgba(22,129,92,.22);
}

.auth-link {
    display: block;
    margin-top: 1rem;
    color: var(--green);
    font-weight: 800;
    text-align: center;
    text-decoration: none;
}

button:disabled {
    opacity: .45;
    cursor: not-allowed;
}

.page {
    width: min(1320px, calc(100% - 2.5rem));
    margin: 0 auto;
    padding: 1.35rem 0 3.5rem;
    min-width: 0;
}

.global-search {
    position: relative;
    z-index: 5;
    width: min(780px, 100%);
    margin: 0 0 .65rem;
}

.global-search-form {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: .55rem;
    min-height: 2.35rem;
    padding: .38rem .5rem .38rem .78rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, .82);
    box-shadow: var(--soft-shadow);
}

.global-search-form:focus-within {
    border-color: rgba(37, 99, 235, .45);
    box-shadow: var(--focus-ring), var(--soft-shadow);
}

.global-search-icon {
    color: var(--muted);
    font-size: 1rem;
    line-height: 1;
}

.global-search-form input {
    min-width: 0;
    width: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-weight: 750;
}

.global-search-form input::placeholder {
    color: #718096;
    font-weight: 700;
}

.global-search-clear {
    display: grid;
    place-items: center;
    width: 1.55rem;
    height: 1.55rem;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: #eef3f8;
    color: var(--muted);
    font-size: 1rem;
    line-height: 1;
}

.global-search-clear:hover {
    background: #dbe8f6;
    color: var(--accent);
}

.global-search-panel {
    position: absolute;
    top: calc(100% + .35rem);
    left: 0;
    right: 0;
    z-index: 40;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--panel);
    box-shadow: 0 18px 38px rgba(15, 23, 42, .16);
}

.global-search-status {
    padding: .65rem .85rem .45rem;
    color: var(--muted);
    font-size: .78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.global-search-results {
    display: grid;
    max-height: min(26rem, 70vh);
    overflow-y: auto;
    padding: .25rem;
}

.global-search-result {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: .65rem;
    padding: .58rem .65rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
}

.global-search-result:hover,
.global-search-result.is-active {
    background: #eef4ff;
}

.global-search-kind {
    min-width: 5.7rem;
    padding: .18rem .42rem;
    border-radius: 999px;
    background: var(--status-neutral-bg);
    color: var(--status-neutral);
    font-size: .72rem;
    font-weight: 850;
    text-align: center;
}

.global-search-kind.kind-product,
.global-search-kind.kind-document,
.global-search-kind.kind-order {
    background: var(--status-info-bg);
    color: #1e3a8a;
}

.global-search-kind.kind-supplier,
.global-search-kind.kind-client {
    background: var(--status-success-bg);
    color: var(--status-success);
}

.global-search-body {
    display: grid;
    min-width: 0;
    gap: .08rem;
}

.global-search-body strong,
.global-search-body small,
.global-search-meta {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.global-search-body strong {
    color: var(--text);
    font-size: .9rem;
    font-weight: 850;
}

.global-search-body small,
.global-search-meta {
    color: var(--muted);
    font-size: .78rem;
    font-weight: 700;
}

.page:has(.table-card),
.page:has(.dashboard-grid),
.page:has(.filters),
.page:has(.receipt-card-list) {
    width: min(1760px, calc(100% - 2.5rem));
}

.hero, .panel, .card, .table-card, .filters {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card-accent--info,
.document-title,
.table-card,
.receipt-card,
.kpi-card--info {
    --card-accent: var(--status-info);
    --card-accent-rgb: var(--status-info-rgb);
}

.card-accent--success,
.card-accent--ok,
.receipt-card--ok,
.kpi-card--ok {
    --card-accent: var(--status-success);
    --card-accent-rgb: var(--status-success-rgb);
}

.card-accent--warning,
.card-accent--warn,
.receipt-card--warn,
.kpi-card--warn {
    --card-accent: var(--status-warning);
    --card-accent-rgb: var(--status-warning-rgb);
}

.card-accent--danger,
.receipt-card--danger,
.kpi-card--danger {
    --card-accent: var(--status-danger);
    --card-accent-rgb: var(--status-danger-rgb);
}

.card-accent--neutral,
.receipt-card--neutral,
.kpi-card--neutral {
    --card-accent: var(--status-neutral);
    --card-accent-rgb: var(--status-neutral-rgb);
}

.panel, .card, .table-card, .filters, .kpi-card, .dashboard-widget, .receipt-card {
    border-color: #cbd5e1;
}

.hero {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    padding: 2rem;
}

.page-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: .55rem;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.page-title h1 {
    margin: 0;
    font-size: clamp(1.35rem, 1.7vw, 1.75rem);
    line-height: 1.08;
}

.page-title > div > p:not(.eyebrow) {
    display: none;
}

.page-title .eyebrow {
    margin-bottom: .15rem;
    font-size: .68rem;
}

.page-title .actions {
    align-self: center;
}

.page-title:not(.document-title) {
    justify-content: flex-end;
}

.page-title:not(.document-title) > div:first-child {
    display: none;
}

.page-title:not(.document-title):not(:has(> a)):not(:has(> .actions)):not(:has(> form)):not(:has(> button)) {
    display: none;
}

.document-title {
    position: relative;
    margin-bottom: 1rem;
    padding: 1.15rem;
    align-items: flex-start;
    overflow: hidden;
    background:
        linear-gradient(90deg, rgba(var(--card-accent-rgb), .09), transparent 36rem),
        #ffffff;
    border: 1px solid #cbd5e1;
    border-left: .28rem solid var(--card-accent);
    border-radius: var(--radius);
    box-shadow: var(--soft-shadow);
}

.document-title h1 {
    margin-bottom: .35rem;
    font-size: clamp(1.65rem, 2.2vw, 2.3rem);
}

.document-title > div > p:not(.eyebrow) {
    display: block;
}

.document-title .eyebrow {
    margin-bottom: .35rem;
    font-size: .78rem;
}

.document-facts {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: .9rem;
    color: var(--muted);
    font-weight: 700;
}

.document-facts .badge {
    align-self: center;
}

.document-facts strong {
    color: var(--text);
}

.document-facts > span {
    display: inline-flex;
    align-items: center;
    min-height: 1.8rem;
    padding: .28rem .58rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--panel-muted);
}

.document-facts > .badge {
    border-color: transparent;
}

.process-hero {
    align-items: stretch;
}

.hero-copy {
    max-width: 48rem;
}

.hero-actions {
    display: grid;
    gap: .65rem;
    align-content: center;
    min-width: 18rem;
}

.process-steps {
    counter-reset: step;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: .75rem;
    margin: 1rem 0;
}

.compact-process {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.process-step {
    position: relative;
    min-height: 10.5rem;
    padding: 1rem;
    overflow: hidden;
}

.process-step::before {
    counter-increment: step;
    content: counter(step);
    position: absolute;
    right: .85rem;
    top: .65rem;
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    background: rgba(22, 129, 92, .12);
    color: var(--green);
    font-weight: 900;
}

.process-step h2 {
    padding-right: 2.5rem;
    font-size: 1.1rem;
}

.store-card {
    display: grid;
    gap: .6rem;
}

.store-choice-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.store-card--choice {
    min-height: 5.8rem;
    align-content: center;
    border-color: #cbd5e1;
    background: var(--panel);
}

.store-card-main {
    display: flex;
    align-items: center;
    gap: .9rem;
}

.store-icon {
    display: grid;
    place-items: center;
    flex: 0 0 2.45rem;
    width: 2.45rem;
    height: 2.45rem;
    border-radius: var(--radius-md);
    background: #eef4ff;
    border: 1px solid rgba(37, 99, 235, .16);
    font-size: 1.25rem;
}

.store-card-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
}

.store-link-arrow {
    color: var(--green);
    font-weight: 900;
    white-space: nowrap;
}

.store-card h2,
.supplier-card h2 {
    margin-bottom: 0;
}

.store-meta,
.supplier-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
}

.supplier-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(15.5rem, 1fr));
    gap: .75rem;
    margin-top: 1rem;
}

.supplier-card {
    display: grid;
    gap: .85rem;
    align-content: space-between;
    min-height: 7.2rem;
    color: inherit;
    text-decoration: none;
    border-color: #cbd5e1;
    background: var(--panel);
}

.supplier-card h2 {
    font-size: 1.25rem;
    line-height: 1.1;
}

.supplier-card .muted {
    margin: .45rem 0 0;
    font-size: .9rem;
}

.supplier-card-footer {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: .75rem;
    min-height: 1.7rem;
    color: inherit;
    text-decoration: none;
}

.supplier-card:hover h2,
.store-card:hover h2 {
    color: var(--blue);
}

.supplier-amount {
    margin-left: auto;
    font-size: 1.05rem;
    font-weight: 900;
    white-space: nowrap;
}

.purchase-feedback {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    border-color: rgba(22, 129, 92, .22);
    background: #eaf1ff;
}

.is-hidden {
    display: none !important;
}

.eyebrow {
    margin: 0 0 .35rem;
    color: var(--accent);
    font-weight: 800;
    text-transform: uppercase;
    font-size: .78rem;
    letter-spacing: 0;
}

h1, h2, p { margin-top: 0; }
h1 { font-size: clamp(1.7rem, 2.2vw, 2.45rem); margin-bottom: .5rem; line-height: 1.08; }
h2 { margin-bottom: .8rem; }

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

.grid.store-choice-grid {
    grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
    gap: .75rem;
}

.grid.store-choice-grid .card {
    padding: .9rem;
}

.grid > .card:only-child {
    grid-column: 1 / -1;
}

.panel {
    padding: 1rem;
}

.card {
    padding: 1rem;
    min-width: 0;
}

.card-link {
    color: inherit;
    text-decoration: none;
}

.card-link:hover h2,
.doc-link:hover strong {
    color: var(--blue);
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    justify-content: flex-end;
}

.left-actions {
    justify-content: flex-start;
}

.compact-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    padding: .45rem .7rem;
    border-radius: var(--radius-sm);
    font-size: .9rem;
    white-space: nowrap;
}

.section-gap {
    margin-top: 1rem;
}

.block-muted {
    margin-top: 1rem;
}

.manual-review-alert {
    margin: 1rem 0 0;
    padding: .9rem 1rem;
    border: 1px solid rgba(199, 54, 77, .22);
    border-radius: var(--radius);
    background: rgba(199, 54, 77, .08);
    color: #7b2632;
    font-weight: 700;
}

.purchase-data-health {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin: 1rem 0;
    padding: .8rem 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--panel);
}

.purchase-data-health strong,
.purchase-data-health span {
    display: block;
}

.purchase-data-health span {
    color: var(--muted);
    font-size: .9rem;
}

.purchase-data-health-blocked {
    border-color: rgba(199, 54, 77, .28);
    background: rgba(199, 54, 77, .08);
    color: #7b2632;
}

.purchase-data-health-warning {
    border-color: rgba(181, 128, 18, .28);
    background: rgba(181, 128, 18, .10);
}

.purchase-data-health-ok {
    border-color: rgba(22, 132, 86, .24);
    background: var(--status-success-bg);
}

.table-wrap {
    overflow: auto;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: .75rem;
}

.page-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    gap: .75rem;
    margin: .95rem 0;
}

.page-kpis--compact {
    grid-template-columns: repeat(auto-fit, minmax(11rem, 15rem));
    justify-content: flex-start;
}

.dashboard-kpis {
    margin-top: 0;
}

.kpi-card {
    display: grid;
    align-content: space-between;
    min-height: 6.2rem;
    padding: .9rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: var(--soft-shadow);
    color: inherit;
    text-decoration: none;
}

.kpi-card:hover {
    border-color: rgba(37, 99, 235, .28);
    box-shadow: 0 16px 40px rgba(15, 23, 42, .12);
}

.kpi-label,
.kpi-card small {
    color: var(--muted);
    font-weight: 800;
}

.kpi-label {
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: 0;
}

.kpi-card strong {
    display: block;
    margin: .25rem 0 .15rem;
    font-size: 1.9rem;
    line-height: 1;
}

.kpi-card small {
    font-size: .85rem;
}

.kpi-card--info {
    border-left: .24rem solid var(--card-accent);
}

.kpi-card--ok {
    border-left: .24rem solid var(--card-accent);
}

.kpi-card--warn {
    border-left: .24rem solid var(--card-accent);
}

.kpi-card--danger {
    border-left: .24rem solid var(--card-accent);
}

.kpi-card--neutral {
    border-left: .24rem solid var(--card-accent);
}

.metric {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: .85rem;
    background: var(--panel);
}

.metric span, .metric small, .muted {
    display: block;
    color: var(--muted);
}

.metric strong {
    display: block;
    font-size: 1.75rem;
    line-height: 1.1;
    margin: .25rem 0;
}

.filters {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: .75rem;
    padding: .85rem;
    margin: 1rem 0;
    background: rgba(255, 255, 255, .82);
}

.filters-inline {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(18rem, 2fr) repeat(3, minmax(8rem, 1fr)) minmax(12rem, 1fr) auto;
    gap: .8rem;
    align-items: end;
}

.checkbox-field {
    display: flex;
    align-items: center;
    gap: .55rem;
    min-height: 3.1rem;
}

.checkbox-field input {
    width: auto;
}

.transfer-store-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.transfer-store-card {
    border-color: rgba(37, 99, 235, .16);
    background: var(--panel);
}

.transfer-store-card h2 {
    margin-bottom: .35rem;
}

.transfer-store-card p {
    margin-bottom: .25rem;
}

.transfer-qty {
    color: var(--green);
    font-weight: 900;
}

label {
    display: grid;
    gap: .35rem;
    font-weight: 700;
    color: var(--muted);
    font-size: .88rem;
}

input, select, textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: .64rem .72rem;
    background: var(--panel);
    font: inherit;
    color: var(--text);
    min-height: 2.35rem;
}

input:focus, select:focus, textarea:focus {
    border-color: rgba(37, 99, 235, .5);
    box-shadow: var(--focus-ring);
    outline: none;
}

.table-card {
    overflow: auto;
    background: var(--panel);
}

.table-card::before {
    content: "";
    display: block;
    height: 3px;
    background: linear-gradient(90deg, var(--card-accent), rgba(var(--card-accent-rgb), .08));
}

.table-card--dense th,
.table-card--dense td {
    padding-top: .58rem;
    padding-bottom: .58rem;
}

.table-toolbar {
    position: sticky;
    left: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    min-width: max-content;
    padding: .78rem .9rem;
    border-bottom: 1px solid var(--line);
    background: #fbfdff;
}

.table-toolbar > div {
    display: grid;
    gap: .12rem;
}

.table-toolbar strong {
    font-size: 1rem;
}

.table-toolbar span {
    color: var(--muted);
    font-size: .88rem;
    font-weight: 750;
}

.document-lines-card {
    margin-top: 1rem;
}

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

.detail-list {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: .55rem 1rem;
    margin: 0;
}

.detail-list dt {
    color: var(--muted);
    font-weight: 700;
}

.detail-list dd {
    margin: 0;
    font-weight: 800;
}

.document-lines-card th {
    position: static;
}

.document-lines-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: .95rem 1rem .75rem;
    border-bottom: 1px solid var(--line);
}

.document-lines-head h2 {
    margin: 0;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: .92rem;
}

th, td {
    padding: .66rem .75rem;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    position: sticky;
    top: 0;
    background: #eaf0f6;
    z-index: 2;
    color: #475467;
    font-size: .78rem;
    font-weight: 850;
    text-transform: uppercase;
    letter-spacing: 0;
}

tbody tr:hover {
    background: #f4f8fc;
}

td {
    overflow-wrap: anywhere;
}

.doc-link {
    display: grid;
    gap: .25rem;
    text-decoration: none;
}

.doc-link small {
    color: var(--muted);
}

.money {
    text-align: right;
    white-space: nowrap;
    font-weight: 800;
}

.num {
    text-align: right;
    white-space: nowrap;
}

.pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: .22rem .58rem;
    background: #eef4ff;
    color: var(--accent);
    font-weight: 800;
}

.status {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: .22rem .58rem;
    font-weight: 800;
    background: var(--status-neutral-bg);
    color: var(--muted);
}

.status-ok {
    color: var(--status-success);
    background: var(--status-success-bg);
}

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

.status-running {
    color: var(--status-info);
    background: var(--status-info-bg);
}

.status-warning,
.status-pending,
.status-formed,
.status-created,
.status-new {
    color: #7a4f0c;
    background: var(--status-warning-bg);
}

.status-draft,
.status-neutral,
.status-inactive,
.status-cancelled {
    color: var(--neutral);
    background: var(--status-neutral-bg);
}

.status-active,
.status-success,
.status-done,
.status-completed,
.status-received,
.status-ok {
    color: var(--status-success);
    background: var(--status-success-bg);
}

.status-blocked,
.status-danger,
.status-overdue,
.status-critical {
    color: var(--status-danger);
    background: var(--status-danger-bg);
}

.danger {
    color: var(--red);
    font-weight: 700;
}

.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: .26rem .58rem;
    font-weight: 800;
    font-size: .78rem;
    line-height: 1.05;
}

.badge.ok { color: var(--status-success); background: var(--status-success-bg); }
.badge.warn { color: #7a4f0c; background: var(--status-warning-bg); }
.badge.danger { color: var(--status-danger); background: var(--status-danger-bg); }
.badge.info { color: var(--status-info); background: var(--status-info-bg); }
.badge.neutral { color: var(--status-neutral); background: var(--status-neutral-bg); }

.cart-existing-note {
    display: block;
    margin-top: .25rem;
    color: #0f6849;
    font-size: .78rem;
    font-weight: 800;
}

.info-dot {
    position: relative;
    display: inline-grid;
    place-items: center;
    width: 1.25rem;
    height: 1.25rem;
    margin-left: .35rem;
    border-radius: 999px;
    border: 1px solid rgba(37, 99, 235, .28);
    background: rgba(37, 99, 235, .1);
    color: var(--blue);
    font-size: .78rem;
    font-weight: 900;
    cursor: help;
}

.info-popover {
    position: absolute;
    right: 0;
    top: 1.65rem;
    display: none;
    min-width: 16rem;
    padding: .8rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255,255,255,.98);
    color: var(--text);
    box-shadow: var(--shadow);
    font-size: .86rem;
    line-height: 1.45;
    z-index: 5;
}

.info-popover hr {
    border: 0;
    border-top: 1px solid var(--line);
    margin: .55rem 0;
}

.purchase-items-table-card {
    overflow: visible;
}

.purchase-calc-info {
    vertical-align: .08rem;
}

.purchase-calc-popover {
    right: auto;
    left: 0;
    min-width: 23rem;
    max-width: min(30rem, calc(100vw - 4rem));
    white-space: normal;
}

.info-dot:hover .info-popover,
.info-dot:focus .info-popover {
    display: block;
}

.details {
    display: grid;
    grid-template-columns: 10rem 1fr;
    gap: .5rem 1rem;
    margin: 0;
}

.details dt { color: var(--muted); }
.details dd { margin: 0; font-weight: 700; }
.empty {
    text-align: center;
    color: var(--muted);
    padding: 2rem;
    font-weight: 700;
}

.empty::before {
    content: "";
    display: block;
    width: 2.2rem;
    height: .22rem;
    margin: 0 auto .75rem;
    border-radius: 999px;
    background: var(--line);
}

.loading-state,
.error-state,
.empty-state {
    padding: 1.1rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    color: var(--muted);
    font-weight: 700;
}

.error-state {
    border-color: rgba(199, 54, 77, .24);
    background: rgba(199, 54, 77, .07);
    color: #7b2632;
}

.inline-form {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .5rem;
}

.inline-form .qty-input {
    width: 7rem;
}

.purchase-actions-row td {
    padding-top: .35rem;
    padding-bottom: .55rem;
    background: rgba(236, 247, 242, .34);
}

.purchase-inline-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: .45rem;
}

.purchase-inline-actions.compact-stack {
    justify-content: flex-start;
    min-width: 16rem;
}

.purchase-action-form,
.purchase-multiplicity-form {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    margin: 0;
}

.purchase-multiplicity-form span {
    color: var(--muted);
    font-size: .88rem;
    font-weight: 800;
}

.purchase-multiplicity-form input {
    width: 6rem;
    padding: .45rem .55rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--panel);
    font-weight: 800;
}

.breadcrumbs {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .32rem;
    margin: 0 0 .6rem;
    padding: .26rem .42rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, .76);
    box-shadow: none;
    font-size: .82rem;
    font-weight: 800;
}

.breadcrumbs a {
    color: #475569;
    text-decoration: none;
}

.breadcrumbs a:hover {
    color: var(--blue);
}

.breadcrumbs span {
    color: var(--muted);
}

.breadcrumbs strong {
    padding: .16rem .38rem;
    border-radius: 999px;
    background: #e8f0ff;
    color: #1e3a8a;
}

.compact-page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: .55rem;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.compact-page-head h1 {
    margin: 0;
    font-size: clamp(1.35rem, 1.7vw, 1.75rem);
    line-height: 1.08;
}

.compact-page-head .muted {
    display: none;
}

.compact-page-head .eyebrow {
    margin-bottom: .15rem;
    font-size: .68rem;
}

.compact-page-head {
    justify-content: flex-end;
}

.compact-page-head > div:first-child {
    display: none;
}

.compact-page-head:not(:has(> a)):not(:has(> .actions)):not(:has(> form)):not(:has(> button)) {
    display: none;
}

.supplier-compact-head {
    align-items: center;
    margin-bottom: .65rem;
}

.supplier-compact-head h1 {
    font-size: clamp(1.85rem, 2.4vw, 2.6rem);
}

.supplier-compact-head p:last-child {
    margin-bottom: 0;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: clamp(15.5rem, calc((100vh - 11rem) / 2), 20rem);
    gap: .85rem;
    align-items: stretch;
    width: 100%;
}

.sidebar-collapsed .dashboard-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dashboard-widget {
    min-width: 0;
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.dashboard-widget--orders {
    border-top: .24rem solid rgba(183, 121, 31, .86);
}

.dashboard-widget--receipts {
    border-top: .24rem solid rgba(22, 132, 86, .86);
}

.dashboard-widget--crm {
    border-top: .24rem solid rgba(37, 99, 235, .86);
}

.widget-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .85rem .95rem .75rem;
    border-bottom: 1px solid var(--line);
    background: var(--panel-muted);
}

.widget-head > div {
    min-width: 0;
}

.widget-head h1 {
    margin: 0;
    font-size: clamp(1.05rem, 1.15vw, 1.35rem);
    line-height: 1.08;
    overflow-wrap: anywhere;
}

.widget-head .eyebrow {
    margin-bottom: .25rem;
    font-size: .68rem;
}

.widget-head .secondary-action {
    flex: 0 0 auto;
    padding: .5rem .65rem;
    border-radius: var(--radius-sm);
    font-size: .82rem;
    white-space: nowrap;
}

.widget-list {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: .45rem;
    padding: .65rem;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
}

.widget-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: .65rem;
    padding: .62rem .7rem;
    border: 1px solid var(--line);
    border-left: .18rem solid rgba(37, 99, 235, .45);
    border-radius: var(--radius);
    background: var(--panel);
    color: inherit;
    text-decoration: none;
    min-width: 0;
}

.widget-item span {
    min-width: 0;
}

.widget-item strong {
    display: -webkit-box;
    font-size: .95rem;
    line-height: 1.15;
    overflow: hidden;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.widget-item:hover strong {
    color: var(--blue);
}

.widget-item small {
    display: -webkit-box;
    margin-top: .15rem;
    color: var(--muted);
    font-weight: 700;
    font-size: .78rem;
    line-height: 1.25;
    overflow: hidden;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.widget-item b {
    align-self: flex-start;
    justify-self: end;
    border-radius: var(--radius-sm);
    padding: .42rem .58rem;
    background: var(--accent);
    color: white;
    font-size: .82rem;
    white-space: nowrap;
}

.widget-empty {
    margin: 0;
    padding: .75rem;
    font-size: .9rem;
}

.crm-task-create {
    margin-bottom: .9rem;
}

.crm-task-create form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: .75rem;
    align-items: stretch;
}

.crm-task-create textarea {
    min-height: 4.5rem;
    resize: vertical;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: .75rem .85rem;
    font: inherit;
    font-weight: 700;
    background: var(--panel);
}

.crm-task-create button {
    min-width: 11rem;
}

.crm-task-list {
    display: grid;
    gap: .7rem;
    margin-top: .9rem;
}

.crm-task-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: center;
    padding: 1rem;
}

.crm-task-card.is-done {
    opacity: .68;
}

.crm-task-card p {
    margin: .45rem 0 .35rem;
    white-space: pre-wrap;
}

.crm-task-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .45rem;
}

.crm-task-title strong {
    font-size: 1rem;
}

.receipt-status-tabs,
.store-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: .55rem;
    margin: 1rem 0;
}

.receipt-status-tabs a,
.store-tabs a {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: .55rem .85rem;
    background: var(--panel);
    color: inherit;
    text-decoration: none;
    font-weight: 850;
}

.receipt-status-tabs a.is-active,
.store-tabs a.is-active {
    background: var(--accent);
    color: white;
    border-color: transparent;
}

.receipt-status-tabs span {
    display: inline-grid;
    min-width: 1.45rem;
    height: 1.45rem;
    place-items: center;
    border-radius: 999px;
    background: rgba(255,255,255,.62);
    color: var(--text);
    font-size: .82rem;
}

.compact-store-tabs {
    margin-top: .25rem;
}

.compact-filters {
    grid-template-columns: minmax(160px, 1fr) minmax(220px, 1.2fr) minmax(110px, .6fr) auto;
}

.receipt-card-list {
    display: grid;
    gap: .75rem;
}

.receipt-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: .85rem 1rem;
    align-items: center;
    padding: 1rem;
    border: 1px solid var(--line);
    border-left: .24rem solid var(--card-accent);
    border-radius: var(--radius);
    background:
        linear-gradient(90deg, rgba(var(--card-accent-rgb), .055), transparent 28rem),
        var(--panel);
    box-shadow: var(--soft-shadow);
}

.receipt-card--ok {
    opacity: .78;
}

.receipt-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: center;
    min-width: 0;
}

.receipt-title-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .55rem;
}

.receipt-title-line h2 {
    margin: 0;
    font-size: 1.25rem;
}

.receipt-number {
    color: var(--blue);
    font-weight: 900;
}

.receipt-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem .8rem;
    margin-top: .3rem;
    color: var(--muted);
    font-weight: 750;
}

.receipt-file {
    margin-top: .45rem;
    color: #2f423b;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.receipt-amount {
    text-align: right;
    white-space: nowrap;
}

.receipt-amount strong,
.receipt-amount small {
    display: block;
}

.receipt-amount strong {
    font-size: 1.15rem;
}

.receipt-amount small {
    color: var(--muted);
    font-weight: 750;
}

.receipt-progress {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
}

.receipt-progress span {
    border-radius: 999px;
    padding: .28rem .6rem;
    background: rgba(101, 115, 109, .1);
    color: var(--muted);
    font-size: .83rem;
    font-weight: 850;
}

.receipt-progress span.is-ok {
    background: rgba(22, 129, 92, .12);
    color: #0f6849;
}

.receipt-progress span.is-danger {
    background: rgba(199, 54, 77, .12);
    color: var(--red);
}

.receipt-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
    justify-content: flex-end;
}

.highlight-row {
    background: rgba(31, 102, 229, .08);
}

.clickable-row {
    cursor: pointer;
}

.invoice-table-card {
    overflow: visible;
}

.invoice-table-wrap {
    overflow-x: auto;
}

.invoice-table th,
.invoice-table td {
    vertical-align: middle;
}

.invoice-check-col {
    width: 5.5rem;
    text-align: center;
}

.invoice-match-light {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border-radius: 999px;
    box-shadow: 0 0 0 4px rgba(255,255,255,.7), 0 8px 22px rgba(48, 73, 65, .16);
}

.invoice-match-light--green {
    background: #16a064;
}

.invoice-match-light--yellow {
    background: #e7a92c;
}

.invoice-match-light--red {
    background: #d93a4e;
}

.invoice-product-cell {
    min-width: 22rem;
}

.invoice-price-group-cell {
    min-width: 12rem;
}

.invoice-price-group-picker input {
    width: 100%;
    min-width: 11rem;
    padding: .52rem .65rem;
    border-radius: var(--radius-sm);
    font-size: .9rem;
    font-weight: 800;
}

.price-group-pill {
    display: inline-flex;
    align-items: center;
    min-height: 2rem;
    border-radius: 999px;
    padding: .28rem .7rem;
    background: rgba(22, 129, 92, .12);
    color: #0f6849;
    font-weight: 900;
    white-space: nowrap;
}

.price-group-pill.is-empty {
    background: rgba(101, 115, 109, .1);
    color: var(--muted);
}

.price-group-hint {
    display: block;
    margin-top: .35rem;
    font-size: .78rem;
}

.invoice-product-cell strong,
.invoice-table td strong {
    display: block;
    line-height: 1.3;
}

.invoice-product-picker {
    position: relative;
}

.invoice-product-picker input {
    width: min(100%, 22rem);
}

.invoice-product-results {
    position: fixed;
    z-index: 60;
    display: grid;
    gap: .35rem;
    overflow-y: auto;
    padding: .45rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255,255,255,.98);
    box-shadow: var(--shadow);
    backdrop-filter: blur(20px);
}

.invoice-product-results[hidden] {
    display: none;
}

.invoice-product-result {
    display: block;
    width: 100%;
    padding: .65rem .75rem;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text);
    text-align: left;
}

.invoice-product-result:hover {
    background: #eef4ff;
}

.invoice-product-result small,
.invoice-product-empty {
    display: block;
    color: var(--muted);
    font-size: .85rem;
    font-weight: 750;
}

.invoice-product-empty {
    padding: .75rem;
}

.invoice-order-qty {
    border-radius: var(--radius);
    font-weight: 900;
}

.invoice-order-qty--zero {
    background: rgba(199,54,77,.13);
}

.invoice-order-qty--ok {
    background: rgba(22,129,92,.13);
}

.invoice-order-qty--diff {
    background: rgba(183,121,31,.16);
}

.invoice-copy-card {
    padding: 0;
    overflow: hidden;
}

.copy-head {
    padding-bottom: 1rem;
}

.invoice-copy-table {
    display: block;
    width: calc(100% - 2rem);
    min-height: 12rem;
    margin: 1rem;
    resize: vertical;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: .9rem;
    background: var(--panel);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: .9rem;
    line-height: 1.45;
    white-space: pre;
}

.clickable-row:hover {
    background: #f8fbff;
}

@media (max-width: 1200px) {
    .store-choice-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

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

    .sidebar-collapsed .dashboard-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

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

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

@media (max-width: 900px) {
    .app-layout { display: block; }
    .sidebar-collapsed .app-layout { display: block; }
    .topbar {
        position: sticky;
        top: 0;
        height: auto;
        max-height: 65vh;
        flex-direction: row;
        align-items: flex-start;
        gap: 1rem;
        padding: .8rem;
        overflow: auto;
        border-right: 0;
        border-bottom: 1px solid var(--line);
        box-shadow: var(--soft-shadow);
    }
    .sidebar-collapsed .topbar {
        gap: 1rem;
        padding: .8rem;
        overflow: auto;
    }
    .brand { flex: 0 0 auto; padding-bottom: .25rem; }
    .data-health-strip {
        flex: 0 0 auto;
        grid-template-columns: repeat(4, auto);
        align-items: center;
        gap: .5rem;
        margin-top: 0;
        padding: .55rem .65rem;
    }
    .sidebar-collapsed .brand {
        justify-content: flex-start;
        gap: .75rem;
        padding-bottom: .25rem;
    }
    .sidebar-collapsed .brand > span:last-child,
    .sidebar-collapsed .data-health-label,
    .sidebar-collapsed .nav-label,
    .sidebar-collapsed .nav-dropdown,
    .sidebar-collapsed .nav-user,
    .sidebar-collapsed .nav-menu summary::after {
        display: initial;
    }
    .main-nav {
        flex: 1;
        min-width: 22rem;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: flex-start;
    }
    .main-nav > a,
    .nav-menu {
        width: auto;
    }
    .main-nav > a,
    .nav-menu summary {
        width: auto;
    }
    .sidebar-collapsed .main-nav {
        align-items: flex-start;
    }
    .sidebar-collapsed .main-nav > a,
    .sidebar-collapsed .nav-menu,
    .sidebar-collapsed .nav-menu summary {
        width: auto;
    }
    .sidebar-collapsed .main-nav > a,
    .sidebar-collapsed .nav-menu summary {
        display: inline-flex;
        place-items: initial;
        padding: .72rem .8rem;
    }
    .sidebar-collapsed .nav-icon {
        margin-right: .45rem;
    }
    .sidebar-toggle {
        position: static;
        margin: 0;
        background: var(--panel);
        color: var(--muted);
        border-color: var(--line);
        box-shadow: none;
    }
    .sidebar-toggle:hover {
        background: var(--accent);
        color: #fff;
    }
    .sidebar-collapsed .nav-menu .nav-dropdown {
        position: static;
        display: grid;
        min-width: 13rem;
        margin-top: .25rem;
        padding: .2rem 0 .25rem .72rem;
        border: 0;
        border-left: 1px solid var(--line);
        border-radius: 0;
        background: transparent;
        box-shadow: none;
        backdrop-filter: none;
    }
    .nav-dropdown {
        min-width: 13rem;
        padding-left: .35rem;
    }
    .nav-spacer { display: none; }
    .hero, .page-title, .compact-page-head, .widget-head { align-items: flex-start; flex-direction: column; }
    .grid, .filters, .process-steps, .dashboard-grid, .compact-filters, .receipt-card, .receipt-main { grid-template-columns: 1fr; }
    .supplier-card { grid-template-columns: 1fr; }
    .page { width: min(100% - 1rem, 1500px); }
    .global-search {
        width: 100%;
    }
    .global-search-form {
        border-radius: var(--radius);
    }
    .global-search-result {
        grid-template-columns: 1fr;
        align-items: start;
        gap: .35rem;
    }
    .global-search-kind {
        min-width: 0;
        width: fit-content;
    }
    .global-search-meta {
        white-space: normal;
    }
    .receipt-amount { text-align: left; }
    .receipt-actions { justify-content: flex-start; }
}
