:root {
    --bg: #f6f3ef;
    --panel: #ffffff;
    --ink: #231f20;
    --muted: #6e6761;
    --line: #e5ded5;
    --accent: #0d6b57;
    --accent-dark: #084d3f;
    --warn: #a34824;
    --shadow: 0 18px 50px rgba(35, 31, 32, 0.08);
}

/* Finance register */
.finance-page {
    display: grid;
    gap: 22px;
    max-width: 1280px;
}

.finance-section-heading,
.finance-actions,
.finance-metric-heading,
.finance-row-actions,
.pagination {
    display: flex;
    align-items: center;
}

.finance-intro,
.finance-section-heading,
.pagination {
    justify-content: space-between;
    gap: 16px;
}

.finance-intro {
    display: block;
}

.finance-intro h2,
.finance-section-heading h2 {
    margin: 0;
}

.finance-intro .muted {
    max-width: 620px;
    margin: 7px 0 0;
}

.finance-intro > div:first-child {
    min-width: 0;
    flex: 1 1 420px;
}

.finance-actions {
    max-width: none;
    margin-top: 14px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.finance-actions form,
.finance-row-actions form {
    margin: 0;
}

.finance-actions > * {
    width: 100%;
    min-width: 0;
}

.finance-actions form button {
    width: 100%;
}

.finance-actions .button,
.finance-actions button {
    min-height: 38px;
}

.finance-metrics {
    display: grid;
    grid-template-columns: minmax(180px, .8fr) minmax(310px, 1.4fr) minmax(180px, .8fr) minmax(180px, .8fr);
    gap: 14px;
}

.finance-metric {
    display: flex;
    align-items: flex-start;
    gap: 13px;
    min-height: 122px;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 7px 18px rgba(42, 35, 24, .05);
}

.finance-metric-icon {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border-radius: 6px;
    background: #f4efe7;
    color: var(--accent);
    font-size: 15px;
    font-weight: 800;
}

.finance-metric small {
    display: block;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.finance-metric > div { min-width: 0; width: 100%; }
.finance-metric > div > strong { display: block; margin-top: 8px; font-size: 28px; line-height: 1; }
.finance-metric-amount { min-height: 122px; }
.finance-metric-heading { justify-content: space-between; gap: 10px; }
.finance-metric-heading form { margin: 0; }
.finance-metric-heading select { min-height: 31px; padding: 4px 28px 4px 9px; font-size: 12px; }
.finance-currency-totals { display: grid; gap: 4px; margin-top: 9px; }
.finance-currency-totals strong { font-size: 14px; }

.finance-monthly,
.finance-filter-panel,
.finance-register { padding: 24px; }
.finance-month-picker { display: grid; grid-template-columns: minmax(220px, 340px) max-content; gap: 10px; align-items: end; margin-top: 18px; }
.finance-month-picker select { margin: 0; }
.finance-empty { margin: 18px 0 0; padding: 26px 0 4px; color: var(--muted); text-align: center; }
.finance-summary-table { margin-top: 18px; }
.finance-filter-panel { background: #fff; }
.finance-filters { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 14px; align-items: end; margin-top: 18px; }
.finance-filters label { margin: 0; }
.finance-filters .finance-search { grid-column: span 2; }
.finance-filters select,
.finance-filters input { margin-top: 6px; }
.finance-filters button { min-height: 42px; }
.finance-register .table-wrap { margin-top: 18px; }
.finance-row-actions { gap: 7px; white-space: nowrap; }
.finance-row-actions .button { min-height: 32px; padding: 6px 10px; font-size: 12px; }
.finance-invoice-amount small { display: none; }
.finance-payment { display: inline-flex; padding: 4px 8px; border-radius: 999px; background: #edf1ed; color: #4b5d50; font-size: 12px; font-weight: 800; white-space: nowrap; }
.finance-payment-paid, .finance-payment-paid-cash { background: #e1f1ea; color: #0d654f; }
.finance-payment-not-paid { background: #fff1e9; color: #a65735; }
.text-link { color: var(--accent); font-weight: 750; }

@media (max-width: 1100px) {
    .finance-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .finance-metric-amount { grid-column: span 1; }
    .finance-filters { grid-template-columns: repeat(3, minmax(150px, 1fr)); }
}

@media (max-width: 900px) {
    .finance-page { gap: 16px; }
    .finance-intro .muted { margin-bottom: 16px; }
    .finance-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 12px; }
    .finance-actions > *, .finance-actions .button, .finance-actions button { width: 100%; }
    .finance-actions form { display: flex; }
    .finance-actions form button { width: 100%; }
    .finance-metrics { gap: 12px; }
    .finance-metric { min-height: 104px; padding: 15px; gap: 10px; }
    .finance-metric-icon { width: 29px; height: 29px; flex-basis: 29px; font-size: 13px; }
    .finance-metric > div > strong { font-size: 25px; }
    .finance-metric-amount { grid-column: 1 / -1; min-height: 126px; }
    .finance-monthly, .finance-filter-panel, .finance-register { padding: 18px; }
    .finance-section-heading { align-items: flex-start; }
    .finance-section-heading h2 { font-size: 21px; }
    .finance-month-picker { grid-template-columns: 1fr; }
    .finance-month-picker button { width: 100%; }
    .finance-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .finance-filters .finance-search, .finance-filters button { grid-column: 1 / -1; }
    .finance-register .table-wrap { margin-left: -18px; margin-right: -18px; padding: 0 18px; overflow: visible; }
    .finance-register table,
    .finance-register tbody { display: block; min-width: 0; }
    .finance-register thead { display: none; }
    .finance-register tr {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas:
            "date invoice"
            "supplier supplier"
            "amount payment"
            "place place"
            "document uploader"
            "file actions";
        gap: 7px 14px;
        padding: 16px 0;
        border-bottom: 1px solid var(--line);
    }
    .finance-register td { min-width: 0; padding: 0; border: 0; white-space: normal; }
    .finance-register td:nth-child(1) { grid-area: date; align-self: end; color: var(--muted); font-size: 13px; font-weight: 700; }
    .finance-register td:nth-child(2) { grid-area: invoice; text-align: right; font-weight: 800; overflow-wrap: anywhere; }
    .finance-register td:nth-child(2)::before { content: "Invoice "; color: var(--muted); font-size: 11px; font-weight: 700; }
    .finance-register td:nth-child(3) { grid-area: amount; }
    .finance-invoice-amount strong { display: block; font-size: 21px; line-height: 1.08; }
    .finance-invoice-amount small { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; font-weight: 800; }
    .finance-register td:nth-child(4) { display: none; }
    .finance-register td:nth-child(5) { grid-area: payment; align-self: center; text-align: right; }
    .finance-register td:nth-child(6) { grid-area: supplier; font-size: 15px; font-weight: 800; }
    .finance-register td:nth-child(7) { grid-area: document; color: var(--muted); font-size: 12px; }
    .finance-register td:nth-child(7)::before { content: "Type: "; }
    .finance-register td:nth-child(8) { grid-area: place; color: var(--muted); font-size: 12px; }
    .finance-register td:nth-child(8)::before { content: "Location: "; }
    .finance-register td:nth-child(9) { display: none; }
    .finance-register td:nth-child(10) { grid-area: uploader; color: var(--muted); font-size: 12px; text-align: right; }
    .finance-register td:nth-child(10)::before { content: "By "; }
    .finance-register td:nth-child(11) { grid-area: file; align-self: center; }
    .finance-register td:nth-child(12) { grid-area: actions; justify-self: end; }
    .finance-row-actions { gap: 5px; }
    .finance-row-actions .button { min-height: 30px; padding: 5px 8px; }
    .pagination { align-items: flex-start; flex-direction: column; }
}

* {
    box-sizing: border-box;
}

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

#start-received-correction,
#save-received-correction {
    display: none !important;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 250px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 22px 18px;
    background: #fffdf9;
    border-right: 1px solid var(--line);
    color: var(--ink);
    overflow: hidden;
}

.mobile-menu-button,
.mobile-menu-close,
.mobile-menu-backdrop {
    display: none;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    font-weight: 800;
}

.brand small,
.muted,
.eyebrow,
label {
    color: var(--muted);
}

.brand small {
    display: block;
    color: var(--muted);
    margin-top: 2px;
}

nav {
    display: grid;
    gap: 10px;
    overflow-y: auto;
    padding: 0 2px 190px 0;
}

nav a,
.nav-toggle,
.logout {
    padding: 11px 12px;
    border-radius: 8px;
    color: #5d5046;
}

.sidebar nav a.active,
.sidebar nav a:hover,
.sidebar .nav-toggle.active,
.sidebar .nav-toggle:hover,
.sidebar .logout:hover {
    background: #edf6ed;
    color: var(--accent-dark);
}

.nav-group {
    display: grid;
    gap: 4px;
}

.nav-group > a,
.nav-toggle {
    display: flex;
    width: 100%;
    min-height: 0;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    border: 0;
    background: transparent;
    font: inherit;
    font-weight: 400;
    text-align: left;
    appearance: none;
}

.nav-label {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
}

.nav-icon {
    display: inline-grid;
    place-items: center;
    width: 19px;
    height: 19px;
    flex: 0 0 19px;
    color: #8a7b6d;
    line-height: 1;
}

.nav-icon svg { display: block; width: 19px; height: 19px; }
.sidebar nav a.active .nav-icon, .sidebar nav a:hover .nav-icon, .sidebar .nav-toggle.active .nav-icon, .sidebar .nav-toggle:hover .nav-icon { color: var(--accent); }

.nav-toggle-meta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.nav-group small,
.nav-toggle small {
    color: var(--muted);
    font-size: 10px;
    font-weight: 750;
    text-transform: uppercase;
}

.nav-chevron {
    width: 7px;
    height: 7px;
    border-right: 1.5px solid #cbbfb2;
    border-bottom: 1.5px solid #cbbfb2;
    transform: rotate(45deg);
    transition: transform 160ms ease;
}

.nav-group.is-open .nav-chevron {
    transform: rotate(225deg);
}

.nav-children {
    display: none;
    gap: 2px;
    padding-left: 12px;
}

.nav-group.is-open .nav-children {
    display: grid;
}

.nav-children a {
    min-height: 32px;
    padding: 7px 10px;
    color: #75685d;
    font-size: 13px;
}

.nav-children a { display: flex; align-items: center; gap: 10px; }
.nav-children .nav-icon { width: 14px; height: 14px; flex-basis: 14px; }
.nav-children .nav-icon svg { width: 14px; height: 14px; }

.sidebar-bottom {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 10;
    min-height: 176px;
    border-top: 1px solid rgba(229, 222, 213, 0.86);
    background: #fffdfa;
    overflow: hidden;
}

.sign-out {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 58px;
    padding-inline: 15px;
    color: #5d5046;
}

.coffee-art {
    position: absolute;
    right: -38px;
    bottom: -8px;
    width: 255px;
    max-width: none;
    opacity: 0.92;
    pointer-events: none;
}

.coffee-art.coffee-cup-art {
    width: 96px;
    height: 80px;
    right: 20px;
    bottom: 16px;
    opacity: 1;
}

.app-shell {
    margin-left: 250px;
    min-width: 0;
    padding: 30px 36px 42px;
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.topbar,
.section-header,
.form-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 25;
    margin: -30px -36px 28px;
    padding: 17px 36px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 253, 249, 0.92);
    backdrop-filter: blur(16px);
}

.page-header {
    min-height: 78px;
}

.page-section-title {
    color: var(--ink);
    font-size: 22px;
    font-weight: 750;
    line-height: 1.2;
}

.page-header-spacer {
    flex: 1;
}

.topbar-title {
    min-width: 180px;
}

.topbar-title h1 {
    margin: 2px 0 0;
    font-size: 22px;
    line-height: 1.2;
}

.global-search {
    width: min(460px, 42vw);
    height: 42px;
    margin: 0 auto;
    padding: 0 11px 0 14px;
    display: flex;
    align-items: center;
    gap: 11px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.95);
    color: #79572f;
    box-shadow: 0 1px 3px rgba(67, 46, 27, 0.02);
}

.global-search input {
    min-width: 0;
    flex: 1;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--ink);
}

.global-search input::placeholder {
    color: #8e8174;
    opacity: 1;
}

.global-search kbd {
    min-width: 36px;
    height: 24px;
    padding: 0 6px;
    display: inline-grid;
    place-items: center;
    border: 1px solid #e5ddd3;
    border-radius: 6px;
    background: #faf8f4;
    color: #82786d;
    font: 700 11px/1 ui-sans-serif, system-ui, sans-serif;
}

.profile-button {
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 3px 4px 3px 8px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--ink);
}

.avatar {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: linear-gradient(145deg, #1e7738, #2b8d49);
    font-weight: 800;
}

.profile-copy {
    display: grid;
    text-align: left;
    line-height: 1.25;
}

.profile-copy strong {
    font-size: 13px;
}

.profile-copy small {
    color: var(--muted);
    font-size: 11px;
}

.inline-form {
    display: flex;
    align-items: center;
    gap: 8px;
}

.line-grid {
    display: grid;
    gap: 12px;
}

.line-row {
    display: grid;
    grid-template-columns: minmax(220px, 2fr) minmax(150px, 1.2fr) minmax(120px, 1fr) minmax(100px, 0.8fr) minmax(120px, 0.9fr) minmax(180px, 1.4fr);
    gap: 10px;
}

.line-row label {
    margin-top: 0;
}

.receipt-ingredient-field {
    display: grid;
    gap: 6px;
    align-content: start;
}

.receipt-ingredient-field label { margin: 0; }
.receipt-ingredient-field button { justify-self: start; }

.section-title {
    margin: 2px 0;
}

.topbar {
    margin-bottom: 24px;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 0;
    font-size: 32px;
}

h2 {
    font-size: 18px;
}

.eyebrow {
    margin-bottom: 6px;
    text-transform: uppercase;
    font-size: 12px;
    font-weight: 700;
}

.panel,
.login-panel,
.metric-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.panel {
    padding: 22px;
}

.module-hero,
.module-grid,
.dashboard-layout,
.dashboard-hero,
.module-board {
    margin-bottom: 20px;
}

.module-hero {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
}

.module-hero h2 {
    margin-bottom: 8px;
    font-size: 28px;
}

.dashboard-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 24px;
    padding: 26px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fffdf9;
    box-shadow: var(--shadow);
}

.dashboard-hero h2 {
    max-width: 760px;
    margin-bottom: 10px;
    font-size: 34px;
}

.dashboard-hero p {
    max-width: 780px;
    margin-bottom: 0;
    line-height: 1.55;
}

.dashboard-hero-actions,
.quick-links,
.module-card-topline {
    display: flex;
    align-items: center;
    gap: 10px;
}

.dashboard-hero-actions,
.quick-links {
    flex-wrap: wrap;
}

.dashboard-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.7fr);
    gap: 20px;
    align-items: start;
}

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

.timeline-list li {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    gap: 12px;
}

.timeline-list li::before {
    width: 10px;
    height: 10px;
    margin-top: 6px;
    border-radius: 50%;
    background: var(--accent);
    content: '';
}

.timeline-list strong,
.timeline-list span {
    grid-column: 2;
}

.timeline-list span {
    color: var(--muted);
    line-height: 1.45;
}

.quick-links {
    margin-top: 18px;
}

.quick-links a {
    min-height: 34px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbf8f4;
    color: var(--ink);
    font-size: 13px;
    font-weight: 700;
}

.module-board .section-header {
    margin-bottom: 14px;
}

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

.module-card {
    display: flex;
    min-height: 210px;
    flex-direction: column;
    justify-content: space-between;
    gap: 18px;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.module-card h2 {
    margin: 10px 0 8px;
}

.module-card-topline {
    justify-content: space-between;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.module-child-list {
    display: grid;
    gap: 8px;
}

.module-child-list a {
    display: flex;
    min-height: 34px;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbf8f4;
    font-size: 13px;
}

.module-child-list small {
    color: var(--muted);
    font-weight: 750;
    text-transform: uppercase;
}

.module-child-list small.active {
    color: var(--accent-dark);
}

.erp-embedded-module {
    display: grid;
    gap: 16px;
}

.erp-module-frame {
    width: 100%;
    min-height: calc(100vh - 190px);
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: var(--shadow);
}

.login-panel {
    width: min(440px, 100%);
    padding: 32px;
}

.stack {
    display: grid;
    gap: 14px;
}

label {
    display: grid;
    gap: 7px;
    font-size: 13px;
    font-weight: 650;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 11px 12px;
    color: var(--ink);
    background: white;
    font: inherit;
}

button,
.button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-height: 42px;
    border: 0;
    border-radius: 8px;
    padding: 0 16px;
    background: var(--accent);
    color: white;
    font-weight: 750;
    cursor: pointer;
}

button:hover,
.button:hover {
    background: var(--accent-dark);
}

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

[hidden] {
    display: none !important;
}

.button.secondary,
button.secondary {
    background: #efe8df;
    color: var(--ink);
}

.button.danger,
button.danger {
    background: #f7e6e1;
    color: #9f2f22;
}

.button.danger:hover,
button.danger:hover {
    background: #f1d1ca;
}

.shift-shell {
    display: grid;
    gap: 18px;
    min-width: 0;
}

.shift-command {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
    padding: 18px;
}

.shift-filter-form,
.shift-actions,
.shift-toolbar,
.shift-modal-grid {
    display: flex;
    align-items: end;
    gap: 12px;
}

.shift-filter-form {
    flex: 1;
    flex-wrap: wrap;
}

.shift-filter-form label {
    min-width: 220px;
}

.shift-filter-form input[type="month"] {
    -webkit-appearance: none;
    appearance: none;
    min-width: 0;
    max-width: 100%;
    min-height: 44px;
    text-align: left;
}

/* Keep Safari's native month value within the same edges as the location field. */
.shift-filter-form input[type="month"]::-webkit-date-and-time-value {
    min-width: 0;
    text-align: left;
}

.shift-status-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.rota-planner-panel {
    min-width: 0;
    padding: 0;
    overflow: visible;
}

.rota-planner-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding: 20px 22px 14px;
    border-bottom: 1px solid var(--line);
    background: #fffdf9;
}

.rota-planner-header h2 {
    margin: 0 0 8px;
    font-size: 18px;
}

.inline-chip {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 2px 9px;
    border-radius: 999px;
    background: #edf3ff;
    color: #2d57b8;
    font-size: 12px;
    font-weight: 800;
}

.rota-planner-actions {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
}

.workflow-modal-dialog {
    width: min(540px, calc(100vw - 32px));
    max-height: min(720px, calc(100dvh - 32px));
    overflow: visible;
    padding: 0;
    border: 0;
    border-radius: 20px;
    background: transparent;
    color: var(--ink);
}

.workflow-modal-dialog:not([open]) {
    display: none;
}

.workflow-modal-dialog::backdrop {
    background: rgba(38, 45, 60, .48);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.workflow-modal-card {
    position: relative;
    width: 100%;
    max-height: min(720px, calc(100dvh - 32px));
    display: grid;
    gap: 16px;
    overflow-y: auto;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: white;
    box-shadow: 0 24px 80px rgba(17, 24, 39, .24);
}

.workflow-modal-card .modal-heading {
    align-items: flex-start;
    padding: 22px 22px 0;
}

.workflow-modal-card h3 { margin: 0; font-size: 1.1rem; }
.workflow-modal-card .modal-heading p { margin: 6px 0 0; }
.workflow-modal-body {
    display: grid;
    gap: 12px;
    padding: 0 22px 2px;
}
.workflow-modal-footer {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 16px 22px 22px;
    border-top: 1px solid var(--line);
    background: #f8fafc;
    border-radius: 0 0 20px 20px;
}
.member-hours-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: end; }
.member-hours-summary > div { min-height: 48px; display: flex; flex-direction: column; justify-content: center; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; }
.member-hours-summary strong { font-size: 1.25rem; }
.checkbox-row { display: flex; align-items: center; gap: 8px; margin-top: 14px; }

.workflow-modal-card form {
    display: grid;
    gap: 10px;
}

.publish-recipient-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.publish-recipient-toolbar > div {
    display: flex;
    gap: 8px;
}

.small-button {
    min-height: 34px;
    padding: 7px 10px;
    font-size: .82rem;
}

.publish-recipient-list {
    display: grid;
    gap: 8px;
    max-height: 260px;
    overflow-y: auto;
}

.publish-recipient-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
}

.publish-recipient-item strong,
.publish-recipient-item small {
    display: block;
}

.publish-recipient-item small {
    margin-top: 2px;
    color: var(--muted);
}

.publish-recipient-item.is-disabled {
    color: var(--muted);
    background: #f7f4ef;
}

.draft-setup-panel {
    display: grid;
    gap: 20px;
}

.draft-setup-heading,
.draft-setup-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.draft-setup-heading h2 {
    margin-bottom: 8px;
}

.draft-setup-count {
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
}

.draft-team-form {
    display: grid;
    gap: 18px;
}

.draft-team-options {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    max-height: 360px;
    overflow-y: auto;
    padding: 2px;
}

.draft-team-option {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    margin: 0;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fffdf9;
    color: var(--ink);
    cursor: pointer;
}

.draft-team-option:has(input:checked) {
    border-color: #9bd5c1;
    background: #effaf5;
}

.draft-team-option input {
    flex: 0 0 auto;
    margin: 0;
}

.draft-team-option span {
    display: grid;
    min-width: 0;
    gap: 2px;
}

.draft-team-option strong,
.draft-team-option small {
    overflow-wrap: anywhere;
}

.draft-team-option small {
    color: var(--muted);
}

.draft-setup-footer {
    padding-top: 2px;
}

.shift-toolbar {
    justify-content: space-between;
    align-items: center;
    padding: 12px 22px;
    border-bottom: 1px solid var(--line);
    background: #fbf8f4;
}

.rota-status-strip {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 12px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 650;
}

.shift-grid-panel {
    min-width: 0;
    padding: 0;
    overflow: hidden;
}

.rota-grid-scroll {
    min-width: 0;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: auto;
    max-height: calc(100vh - 310px);
    min-height: 540px;
    background: #f7f4ef;
    overscroll-behavior: contain;
}

.native-rota-table {
    width: max-content;
    min-width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.native-rota-table th,
.native-rota-table td {
    width: 104px;
    min-width: 104px;
    padding: 7px;
    border-right: 1px solid #d8d1c9;
    border-bottom: 1px solid #d8d1c9;
    vertical-align: top;
}

.native-rota-table thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    height: 58px;
    background: #f4f1ec;
    color: var(--muted);
    font-size: 12px;
    text-align: center;
    box-shadow: inset 0 -1px 0 #d8d1c9;
}

.native-rota-table thead span,
.native-rota-table thead small {
    display: block;
}

.native-rota-table thead small {
    margin-top: 3px;
    font-size: 10px;
    letter-spacing: 0;
}

.native-rota-table .employee-column {
    position: sticky;
    left: 0;
    z-index: 2;
    width: 168px;
    min-width: 168px;
    background: #f4f1ec;
    box-shadow: 1px 0 0 #d8d1c9;
}

.native-rota-table thead .employee-column {
    z-index: 4;
    text-align: left;
}

.native-rota-table th.weekend,
.native-rota-table td.today {
    background: #e7edf1;
}

.employee-rota-cell,
.native-shift-card {
    display: grid;
    width: 100%;
    min-height: 70px;
    justify-items: start;
    gap: 4px;
    border: 1px solid #dfe2e6;
    border-radius: 8px;
    padding: 10px;
    background: #ffffff;
    color: var(--ink);
    text-align: left;
    box-shadow: 0 1px 2px rgba(35, 31, 32, 0.04);
}

.employee-rota-cell:hover {
    background: #f9fbff;
    border-color: #b8c9f8;
}

.employee-rota-cell strong,
.native-shift-card strong {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
    font-size: 13px;
}

.employee-rota-cell span,
.native-shift-card span {
    display: block;
    color: var(--muted);
    font-size: 11px;
}

.native-shift-card {
    place-content: center;
    justify-items: center;
    min-height: 76px;
    border-color: #dfe2e6;
    background: #edf0f4;
    color: #6b7280;
    text-align: center;
}

.native-shift-card:hover {
    border-color: #6d8ee8;
    background: #f8fbff;
}

.native-shift-card.work {
    border-color: #96d8bf;
    background: #e7f7ef;
    color: #064e3b;
}

.native-shift-card.holiday {
    border-color: #c4b5fd;
    background: #f2efff;
    color: #4c1d95;
}

.native-shift-card.sick {
    border-color: #f0b4a9;
    background: #fff0ed;
    color: #9f2f22;
}

.native-shift-card.training {
    border-color: #f6c36d;
    background: #fff6dd;
    color: #7a4b00;
}

.shift-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(35, 31, 32, 0.42);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.shift-editor-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: 60;
    width: min(560px, calc(100vw - 28px));
    max-height: calc(100dvh - 28px);
    display: grid;
    gap: 18px;
    transform: translate(-50%, -50%);
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--panel);
    box-shadow: var(--shadow);
    overflow: auto;
}

.shift-modal-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: start;
}

.shift-modal-grid .wide {
    grid-column: 1 / -1;
}

.modal {
    width: min(560px, calc(100vw - 32px));
    max-width: calc(100vw - 24px);
    max-height: calc(100dvh - 24px);
    box-sizing: border-box;
    margin: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 24px;
    color: var(--ink);
    background: var(--panel);
    box-shadow: var(--shadow);
    overflow: auto;
    overflow-x: clip;
    overscroll-behavior: contain;
    overscroll-behavior-x: none;
}

.modal * {
    min-width: 0;
    box-sizing: border-box;
}

.modal > form,
.modal > div,
.modal .stack {
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

.modal input,
.modal select,
.modal textarea,
.modal button {
    max-width: 100%;
}

.modal::backdrop {
    background: rgba(35, 31, 32, 0.45);
}

.modal-close-form {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 12px;
}

.fruitsys-catalog-header,
.catalog-toolbar,
.modal-heading,
.modal-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.fruitsys-catalog-header { margin-bottom: 20px; }
.catalog-toolbar { margin-bottom: 16px; }
.catalog-search { width: min(440px, 100%); }
.table-detail { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; font-weight: 500; white-space: normal; }
.status { display: inline-flex; align-items: center; min-height: 26px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.status.active { color: var(--accent-dark); background: #e1f2eb; }
.status.inactive { color: var(--muted); background: #eee9e3; }
.status.planned { color: #66531d; background: #fff5d5; }
.panel-subtle { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fbfaf8; }
.panel-subtle .field-help { flex-basis: 100%; margin: 0; }
.product-setup-modal,
.product-edit-modal { width: min(840px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto; }
.modal-route-backdrop {
    display: flex;
    justify-content: flex-end;
    min-height: calc(100vh - 180px);
    padding: 24px;
}
.modal-heading h2, .modal-heading p { margin-bottom: 0; }
.icon-button { min-width: 38px; width: 38px; height: 38px; min-height: 38px; padding: 0; border: 1px solid var(--line); background: white; color: var(--ink); font-size: 24px; line-height: 1; }
.icon-button:hover { background: #f4eee7; }
.inline-check {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
}
.inline-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
}
.field-help { margin: -6px 0 0; color: var(--muted); font-size: 13px; }
.recipe-editor { display: grid; gap: 12px; padding-top: 4px; }
.recipe-editor h3 { margin: 0 0 4px; font-size: 16px; }
.recipe-editor p { margin-bottom: 0; }
.ingredient-lines { display: grid; gap: 10px; }
.ingredient-row { display: grid; grid-template-columns: minmax(200px, 2fr) minmax(150px, 1.2fr) minmax(120px, .8fr) 38px; align-items: end; gap: 10px; }
.mapped-ingredient-field {
    display: grid;
    gap: 6px;
}

.table-actions {
    white-space: nowrap;
}

.table-actions .compact-button {
    margin: 2px 0 2px 4px;
}

.edit-grinder-delete-form {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
}

.modal .edit-grinder-delete-form .danger-button {
    flex: 0 0 auto;
    min-height: 38px;
    padding: 0 14px;
    color: #a33a2b !important;
    background: #fff4f1 !important;
    border: 1px solid #e3b8ae;
}

.modal .edit-grinder-delete-form .danger-button:hover {
    background: #fbe4df !important;
}

/* Keep destructive grinder actions visually separate from save. */
.ingredient-option-search {
    min-height: 38px;
}
.modal-actions { justify-content: flex-end; padding-top: 6px; }
.modal-actions button { flex: 0 0 auto; }
.recipe-toggle { display: flex; align-items: center; justify-content: flex-start; gap: 10px; color: var(--ink); }
.recipe-toggle input { width: auto; margin: 0; }
.setup-note { margin: 0; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: #fbf8f4; color: var(--muted); }

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.metric-card {
    padding: 20px;
}

.metric-card span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 8px;
}

.metric-card strong {
    font-size: 34px;
}

.split-grid {
    display: grid;
    grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.resource-tabs {
    display: flex;
    align-items: center;
    gap: 4px;
    width: fit-content;
    margin-bottom: 20px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.resource-tabs a {
    padding: 9px 16px;
    border-radius: 6px;
    color: var(--muted);
    font-weight: 700;
    text-decoration: none;
}

.resource-tabs a.active {
    background: var(--accent);
    color: #fff;
}

.warehouse-connections {
    margin-top: 20px;
}

.warehouse-connections td:first-child strong,
.warehouse-connections td:first-child small {
    display: block;
}

.warehouse-connections select {
    width: 100%;
    min-width: 280px;
}

.mapping-location-note {
    justify-content: space-between;
    margin-bottom: 20px;
}

.warehouse-management > *,
.warehouse-connections {
    min-width: 0;
}

.receiving-start,
.scan-result {
    margin-bottom: 20px;
}

.receiving-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.invoice-scan-modal {
    width: min(620px, calc(100vw - 32px));
}

.receipt-form-modal {
    width: min(1180px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    overflow: auto;
}

.quick-ingredient-modal { width: min(560px, calc(100vw - 32px)); }

.action-result-modal {
    width: min(440px, calc(100vw - 32px));
    max-width: calc(100vw - 32px);
}

.action-result-content {
    display: grid;
    justify-items: center;
    gap: 8px;
    padding: 28px;
    text-align: center;
}

.action-result-content h2,
.action-result-content p {
    margin: 0;
}

.action-result-content > p:not(.eyebrow) {
    max-width: 34ch;
    color: var(--muted);
    line-height: 1.5;
}

.action-result-icon {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #dff4e9;
    color: var(--accent-dark);
    font-size: 26px;
    font-weight: 800;
}

.action-result-modal.error .action-result-icon {
    background: #fff0e9;
    color: #a75235;
}

.action-result-modal.error .action-result-content > p:not(.eyebrow) {
    color: #8a4933;
}

.compact-button {
    min-height: 34px;
    padding: 0 11px;
    font-size: 12px;
}

.receiving-history {
    margin-top: 20px;
}

.invoice-review-workspace {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.draft-overview {
    padding: 24px 22px 20px;
    border-bottom: 1px solid var(--line);
    background: #fff;
}

.draft-overview-heading,
.draft-page-title,
.draft-overview-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.draft-overview-heading { align-items: flex-start; }
.draft-overview-heading .eyebrow { margin-bottom: 5px; }
.draft-page-title { justify-content: flex-start; }
.draft-page-title h2 { margin: 0; font-size: 27px; letter-spacing: 0; }
.draft-overview-actions { flex-wrap: wrap; justify-content: flex-end; }

.draft-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-top: 22px;
}

.draft-summary-card {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    min-width: 0;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.draft-summary-icon {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border-radius: 50%;
    background: #e6f2e8;
    color: var(--accent-dark);
    font-size: 18px;
    font-weight: 800;
}

.draft-summary-icon.invoice { background: #e8f1e5; }
.draft-summary-icon.warning { background: #fff1cc; color: #9b6900; }
.draft-summary-icon.match { background: #e5f2fb; color: #1f6997; }
.draft-summary-card > div { display: grid; gap: 3px; min-width: 0; }
.draft-summary-card small { color: var(--muted); font-size: 11px; }
.draft-summary-card strong { overflow-wrap: anywhere; font-size: 15px; }
.draft-summary-card div span { color: var(--muted); font-size: 11px; }

.draft-workflow {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 18px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fcfbf9;
}

.draft-workflow-step { display: flex; align-items: center; gap: 8px; min-width: 0; }
.draft-workflow-step > span { display: grid; place-items: center; width: 28px; height: 28px; flex: 0 0 28px; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); font-size: 12px; font-weight: 800; }
.draft-workflow-step div { display: grid; gap: 2px; white-space: nowrap; }
.draft-workflow-step small { color: var(--muted); font-size: 10px; }
.draft-workflow-step.complete > span, .draft-workflow-step.current > span { border-color: var(--accent); background: var(--accent); color: #fff; }
.draft-workflow-step.current strong { color: var(--accent-dark); }
.draft-workflow-line { height: 2px; min-width: 20px; flex: 1; background: var(--line); }
.draft-workflow-line.complete { background: var(--accent); }

.invoice-review-header,
.invoice-review-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 20px 22px;
}

.invoice-review-header {
    border-bottom: 1px solid var(--line);
}

.invoice-review-header h2,
.invoice-review-header p {
    margin-bottom: 0;
}

.invoice-review-status {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 8px !important;
    min-width: 260px;
}

.invoice-review-action-buttons {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.footer-warehouse-field {
    width: min(360px, 100%);
    gap: 5px;
}

.footer-warehouse-field select {
    min-height: 40px;
    padding: 9px 12px;
}

.invoice-title-line {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 5px;
}

.invoice-title-line h2 {
    overflow-wrap: anywhere;
}

.status.needs_review,
.status.failed,
.status.mismatch {
    color: #8c371c;
    background: #fff0e9;
}

.status.ready,
.status.posted,
.status.matched {
    color: var(--accent-dark);
    background: #e1f2eb;
}

.status.extracting,
.status.posting,
.status.pending {
    color: #66531d;
    background: #fff5d5;
}

.invoice-header-fields {
    display: grid;
    grid-template-columns: minmax(220px, 320px) minmax(260px, 360px) repeat(2, minmax(150px, 220px));
    gap: 14px;
    padding: 20px 22px;
    border-bottom: 1px solid var(--line);
    background: #fbfaf8;
}

.failed-draft-actions {
    display: flex;
    justify-content: flex-end;
    padding: 0 22px 22px;
}

.draft-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.draft-retry-form {
    margin: 0;
}

.supplier-field {
    display: grid;
    align-content: start;
    gap: 7px;
}

.supplier-field .compact-button {
    justify-self: start;
}

.reconciliation-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin: 18px 22px;
    padding: 13px 14px;
    border: 1px solid #e5d29b;
    border-radius: 8px;
    background: #fff9e8;
}

.reconciliation-bar > div {
    display: grid;
    gap: 3px;
}

.reconciliation-bar span {
    color: var(--muted);
    font-size: 13px;
}

.reconciliation-bar.matched {
    border-color: #bde4d5;
    background: #ecf8f3;
}

.reconciliation-bar.mismatch {
    border-color: #f4c3ae;
    background: #fff1ec;
}

.invoice-lines-toolbar {
    padding: 0 22px 14px;
    border-bottom: 1px solid var(--line);
}

.line-filters {
    display: inline-flex;
    gap: 2px;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f4f0eb;
}

.filter-button {
    min-height: 34px;
    padding: 0 11px;
    background: transparent;
    color: var(--muted);
    font-size: 12px;
}

.filter-button:hover,
.filter-button.active {
    background: white;
    color: var(--ink);
    box-shadow: 0 1px 4px rgba(35, 31, 32, 0.1);
}

.filter-button span {
    margin-left: 4px;
}

.invoice-lines-list {
    display: grid;
}

.invoice-line-card {
    display: grid;
    gap: 15px;
    padding: 18px 22px;
    border-bottom: 1px solid var(--line);
}

.invoice-line-card.needs-attention {
    box-shadow: inset 3px 0 #c86d45;
}

.invoice-line-source {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
}

.invoice-line-overview {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(180px, 260px);
    gap: 10px;
}

.invoice-line-editor {
    border-top: 1px solid var(--line);
}

.invoice-line-editor > summary {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) 12px;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    cursor: pointer;
    list-style: none;
}

.invoice-line-editor > summary::-webkit-details-marker {
    display: none;
}

.invoice-line-editor > summary::after {
    width: 7px;
    height: 7px;
    border-right: 2px solid var(--muted);
    border-bottom: 2px solid var(--muted);
    content: '';
    transform: rotate(45deg);
    transition: transform 150ms ease;
}

.invoice-line-editor[open] > summary::after {
    transform: rotate(225deg);
}

.invoice-line-edit-summary {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    overflow: hidden;
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
}

.invoice-line-edit-summary span {
    overflow: hidden;
    text-overflow: ellipsis;
}

.invoice-line-editor-body {
    display: grid;
    gap: 15px;
    padding-top: 12px;
}

.invoice-line-editor-body > .line-type-field {
    max-width: 260px;
}

.invoice-line-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    grid-column: 1 / -1;
    max-width: 520px;
    width: 100%;
}

.invoice-line-actions .exclude-inventory-field {
    margin: 0;
    padding: 8px;
    min-height: 40px;
    align-items: center;
    background: transparent;
    border: 0;
    font-size: 12px;
    gap: 6px;
    min-width: 0;
    width: 100%;
}

.invoice-line-actions .exclude-inventory-field input {
    flex: 0 0 18px;
}

.invoice-line-actions .duplicate-line-button {
    min-height: 40px;
    width: auto;
    padding: 8px 10px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.exclude-inventory-field {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    max-width: 520px;
    margin: -3px 0 2px;
    padding: 11px 13px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #faf8f5;
}

.exclude-inventory-field input {
    width: 18px;
    height: 18px;
    margin: 1px 0 0;
    accent-color: var(--accent);
}

.exclude-inventory-field span {
    display: grid;
    gap: 3px;
}

.exclude-inventory-field small {
    color: var(--muted);
    font-size: 12px;
}

.line-number {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 2px solid #0b735c;
    border-radius: 50%;
    background: #0f7b62;
    color: #fff;
    font-size: 14px;
    font-weight: 850;
    box-shadow: 0 0 0 4px rgba(15, 123, 98, 0.11);
}

.invoice-line-card.needs-attention .line-number {
    border-color: #b95634;
    background: #c86d45;
    box-shadow: 0 0 0 4px rgba(200, 109, 69, 0.14);
}

.source-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 5px 12px;
    margin-top: 6px;
    color: var(--muted);
    font-size: 12px;
}

.line-type-field {
    margin: 0;
}

.invoice-line-body {
    display: grid;
    grid-template-columns: minmax(230px, 0.8fr) minmax(0, 2fr);
    gap: 16px;
}

.ingredient-choice {
    display: grid;
    align-content: start;
    gap: 7px;
}

.ingredient-choice .compact-button {
    justify-self: start;
}

.ingredient-create-action {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 12px;
}

.ingredient-create-button {
    min-height: 40px;
    padding-inline: 14px;
    background: #765541;
}

.ingredient-create-button:hover {
    background: #5c4031;
}

.ingredient-create-button.created,
.ingredient-create-button.created:hover {
    background: #d4cec7;
    color: #6e6761;
    opacity: 1;
    cursor: default;
}

.ingredient-create-suggestion {
    min-width: 0;
    color: var(--ink);
    font-size: 13px;
    line-height: 1.35;
}

.ingredient-select-label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.ingredient-select-field {
    display: grid;
    gap: 7px;
}

.ingredient-option-search {
    width: 100%;
}

.receiving-ingredient-suggestions {
    display: grid;
    gap: 6px;
}

.receiving-ingredient-suggestions[hidden] {
    display: none;
}

.receiving-ingredient-option {
    display: grid;
    gap: 2px;
    min-height: 48px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbf8f4;
    color: var(--ink);
    text-align: left;
}

.receiving-ingredient-option:hover,
.receiving-ingredient-option:focus {
    border-color: var(--accent);
    background: #ecf8f3;
}

.receiving-ingredient-option small {
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
}

.ingredient-required-warning {
    display: inline-grid;
    place-items: end center;
    width: 17px;
    height: 16px;
    padding-bottom: 2px;
    flex: 0 0 17px;
    clip-path: polygon(50% 0, 100% 100%, 0 100%);
    background: #c86d45;
    color: white;
    font-size: 10px;
    font-weight: 850;
    line-height: 1;
}

.canonical-ingredient-name,
.supplier-item-reference {
    display: grid;
    gap: 3px;
    padding: 10px 12px;
    border-left: 3px solid var(--accent);
    background: #ecf8f3;
}

.canonical-ingredient-name span,
.supplier-item-reference span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 750;
    text-transform: uppercase;
}

.canonical-ingredient-name.unresolved {
    border-left-color: #c86d45;
    background: #fff8f4;
}

.supplier-item-reference {
    overflow-wrap: anywhere;
    border-left-color: var(--line);
    background: #fbf8f4;
}

.quick-name-warning {
    margin: -2px 0 0;
    background: #fff8f4;
    color: var(--warn);
    border-color: #f4c3ae;
}

.field-caption {
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
}

.ingredient-suggestions {
    display: grid;
    gap: 7px;
}

.ingredient-suggestion-list {
    display: grid;
    gap: 6px;
}

.ingredient-suggestion {
    display: flex;
    min-height: 52px;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbf8f4;
    color: var(--ink);
    text-align: left;
}

.ingredient-suggestion:hover,
.ingredient-suggestion.selected {
    border-color: var(--accent);
    background: #ecf8f3;
    color: var(--ink);
}

.ingredient-suggestion > span {
    display: grid;
    gap: 2px;
}

.ingredient-suggestion small,
.ingredient-match-state p {
    color: var(--muted);
    font-size: 11px;
    font-weight: 500;
}

.suggestion-confidence {
    flex: 0 0 112px;
    display: grid;
    justify-items: end;
    color: var(--accent-dark);
    font-weight: 800;
    text-align: right;
}

.suggestion-confidence small {
    max-width: 100%;
    color: var(--muted);
    text-align: right;
    white-space: normal;
}

.ingredient-match-state p {
    margin: 0;
}

.ingredient-match-state {
    display: grid;
    gap: 2px;
    padding-left: 10px;
    border-left: 3px solid var(--line);
}

.ingredient-match-state.confirmed,
.ingredient-match-state.exact {
    border-left-color: var(--accent);
}

.ingredient-match-state.no-match {
    border-left-color: #c86d45;
}

.package-equation {
    display: grid;
    grid-template-columns: minmax(90px, 1fr) 16px minmax(90px, 1fr) 16px minmax(90px, 1fr) minmax(130px, 1fr);
    align-items: end;
    gap: 8px;
}

.package-equation > span {
    padding-bottom: 12px;
    color: var(--muted);
    text-align: center;
}

.stock-result {
    display: grid;
    align-content: center;
    min-height: 64px;
    padding: 8px 11px;
    border: 1px solid #bde4d5;
    border-radius: 8px;
    background: #ecf8f3;
}

.stock-result span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.stock-result strong {
    margin-top: 3px;
    color: var(--accent-dark);
}

.stock-result small {
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 650;
}

.stock-result .stock-unit-price {
    padding-top: 4px;
    border-top: 1px solid rgba(15, 123, 98, 0.14);
}

.stock-result .stock-unit-price b {
    color: var(--ink);
    font-weight: 800;
}

.invoice-line-money {
    display: grid;
    grid-template-columns: repeat(4, minmax(110px, 160px));
    justify-content: end;
    gap: 10px;
}

.invoice-notes-field {
    padding: 18px 22px;
    border-bottom: 1px solid var(--line);
}

.invoice-review-actions {
    position: sticky;
    bottom: 0;
    background: white;
    box-shadow: 0 -8px 20px rgba(35, 31, 32, 0.05);
}

.invoice-review-actions > div {
    display: flex;
    align-items: center;
    gap: 10px;
}

.invoice-action-result {
    font-size: 13px;
    font-weight: 700;
}

.invoice-action-result.success {
    color: var(--accent-dark);
}

.invoice-action-result.error {
    color: var(--warn);
}

.manual-receipt-header {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.manual-line-row {
    display: grid;
    grid-template-columns: minmax(220px, 2fr) minmax(140px, 1fr) minmax(110px, 0.8fr) minmax(130px, 1fr);
    gap: 10px;
}

.scan-form {
    display: grid;
    gap: 14px;
}

.scan-result-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.scan-result-actions p { margin: 0; }

.draft-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 12px;
}

.draft-grid div {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    background: #fbf8f4;
}

.draft-grid span {
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

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

.ingredients-toolbar {
    display: flex;
    align-items: end;
    gap: 12px;
    margin: 20px 0 12px;
}

.ingredients-search {
    flex: 1 1 360px;
    margin: 0;
}

.ingredients-category {
    flex: 0 1 240px;
    margin: 0;
}

.ingredients-result-count {
    flex: 0 0 auto;
    padding-bottom: 12px;
    white-space: nowrap;
}

.inventory-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0 8px;
}

.inventory-search {
    flex: 1 1 320px;
    margin: 0;
}

.inventory-search input {
    min-height: 46px;
}

.warehouse-picker {
    position: relative;
    flex: 0 0 min(380px, 42%);
}

.warehouse-picker summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    min-height: 46px;
    padding: 9px 13px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: white;
    cursor: pointer;
    list-style: none;
}

.warehouse-picker summary::-webkit-details-marker {
    display: none;
}

.warehouse-picker summary::after {
    content: "\25BE";
    color: var(--muted);
}

.warehouse-picker[open] summary {
    border-color: var(--accent);
}

.warehouse-picker summary span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.warehouse-picker summary strong {
    min-width: 0;
    margin-left: auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.warehouse-picker-menu {
    position: absolute;
    z-index: 20;
    top: calc(100% + 6px);
    left: 0;
    width: 100%;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: white;
    box-shadow: var(--shadow);
}

.warehouse-picker-actions {
    display: flex;
    gap: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
}

.warehouse-options {
    display: grid;
    max-height: 280px;
    overflow-y: auto;
    padding-top: 6px;
}

.warehouse-option {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 8px;
    border-radius: 6px;
    color: var(--ink);
    cursor: pointer;
}

.warehouse-option:hover {
    background: #f7f3ee;
}

.warehouse-option input {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    margin: 0;
}

.warehouse-option span {
    min-width: 0;
}

.warehouse-option strong,
.warehouse-option small {
    display: block;
}

.warehouse-option small {
    margin-top: 2px;
    color: var(--muted);
}

.inventory-product strong,
.inventory-warehouse strong,
.inventory-quantity strong {
    font-size: 14px;
}

.inventory-actions {
    width: 1%;
    text-align: right;
    white-space: nowrap;
}

.inventory-transfer-modal {
    width: min(560px, calc(100vw - 32px));
}

.transfer-availability {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    padding: 12px 14px;
    border: 1px solid #bde4d5;
    border-radius: 8px;
    background: #ecf8f3;
}

.transfer-availability span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.transfer-availability strong {
    color: var(--accent-dark);
}

.transfer-availability small {
    flex: 0 0 100%;
    color: var(--accent-dark);
    font-weight: 700;
}

.inventory-filter-empty {
    margin: 20px 0 0;
}

.scan-lines-table {
    margin: 14px 0;
}

.scan-lines-table td:first-child {
    min-width: 260px;
    white-space: normal;
}

.invoice-item-field input[readonly] {
    background: #fbf8f4;
    color: var(--ink);
}

.receiving-exact-ui {
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.receiving-exact-ui .receiving-page-title,
.receiving-exact-ui .draft-overview,
.receiving-exact-ui .draft-workflow,
.receiving-supplier-card,
.receiving-exact-ui .invoice-header-fields,
.receiving-exact-ui .reconciliation-bar,
.receiving-line-item,
.receiving-totals-card {
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.72);
    box-shadow: 0 1px 2px rgba(75, 54, 33, 0.04), 0 6px 18px rgba(75, 54, 33, 0.045);
}

.receiving-page-title {
    min-height: 76px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 12px;
    padding: 18px 20px;
    border-radius: 12px;
}

.receiving-title-line {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
}

.receiving-title-line h2 {
    margin: 0;
    font-size: 25px;
    line-height: 1.25;
    font-weight: 725;
}

.receiving-page-title p {
    margin: 7px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.receiving-page-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.receiving-page-actions button,
.receiving-page-actions .button {
    min-height: 46px;
    padding-inline: 18px;
}

.receiving-exact-ui .draft-overview {
    margin-bottom: 12px;
    padding: 0;
    border-radius: 12px;
    border-bottom: 1px solid var(--line);
}

.receiving-exact-ui .draft-overview-heading {
    display: none;
}

.receiving-exact-ui .draft-summary-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
    margin: 0;
}

.receiving-exact-ui .draft-summary-card {
    min-height: 108px;
    padding: 20px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.receiving-exact-ui .draft-summary-card + .draft-summary-card {
    border-left: 1px solid var(--line);
}

.receiving-exact-ui .draft-summary-icon {
    width: 49px;
    height: 49px;
    flex-basis: 49px;
    border-radius: 50%;
}

.receiving-exact-ui .draft-summary-card small {
    font-size: 11px;
}

.receiving-exact-ui .draft-summary-card strong {
    display: block;
    overflow: hidden;
    color: var(--ink);
    font-size: 17px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.receiving-exact-ui .draft-workflow {
    min-height: 73px;
    margin: 12px 0 0;
    padding: 14px 38px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.66);
}

.receiving-exact-ui .draft-workflow-step > span {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
}

.receiving-exact-ui .draft-workflow-line {
    height: 3px;
    margin-inline: 8px;
    border-radius: 999px;
}

.receiving-exact-ui .invoice-review-header {
    display: none;
}

.receiving-supplier-card {
    min-height: 108px;
    margin: 13px 0;
    padding: 14px 17px 14px 18px;
    display: grid;
    grid-template-columns: minmax(260px, 1.3fr) 1px minmax(320px, 1.3fr) minmax(190px, 220px);
    align-items: center;
    gap: 24px;
    border-radius: 12px;
}

.receiving-supplier-identity {
    display: flex;
    align-items: center;
    gap: 15px;
    min-width: 0;
}

.receiving-supplier-avatar {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    flex: 0 0 52px;
    border-radius: 50%;
    background: #f6efe7;
    color: #7f5a35;
    font-size: 18px;
    font-weight: 720;
}

.receiving-supplier-identity h2 {
    margin: 0 0 4px;
    overflow-wrap: anywhere;
    font-size: 17px;
    line-height: 1.2;
}

.receiving-supplier-identity p {
    margin: 2px 0;
    color: var(--muted);
    font-size: 12px;
}

.receiving-supplier-divider {
    width: 1px;
    height: 63px;
    background: var(--line);
}

.receiving-supplier-meta {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin: 0;
}

.receiving-supplier-meta dt {
    color: var(--muted);
    font-size: 11px;
}

.receiving-supplier-meta dd {
    margin: 7px 0 0;
    font-size: 13px;
    font-weight: 650;
}

.receiving-invoice-total-box {
    min-height: 79px;
    padding: 12px 15px;
    display: grid;
    align-content: center;
    border: 1px solid #e0d2c3;
    border-radius: 9px;
    background: #fbf7f1;
}

.receiving-invoice-total-box small,
.receiving-invoice-total-box span {
    color: var(--muted);
    font-size: 11px;
}

.receiving-invoice-total-box strong {
    margin-top: 2px;
    font-size: 20px;
    line-height: 1.2;
}

.receiving-exact-ui .invoice-header-fields {
    margin-bottom: 13px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.66);
}

.receiving-exact-ui .reconciliation-bar {
    margin: 13px 0;
    border-radius: 12px;
}

.receiving-section-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 0 10px;
    border: 0;
    background: transparent;
}

.receiving-section-toolbar h2 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
}

.receiving-section-toolbar h2 span {
    color: var(--muted);
    font-weight: 500;
}

.receiving-line-tools {
    display: flex;
    align-items: center;
    gap: 8px;
}

.receiving-view-toggle.active {
    background: #f4ede4;
    color: var(--ink);
}

.receiving-exact-ui .invoice-lines-list {
    gap: 12px;
}

.receiving-line-item {
    position: relative;
    overflow: hidden;
    border-color: #ddcfbf;
    border-radius: 9px;
}

.receiving-line-accent {
    position: absolute;
    z-index: 1;
    inset: 0 auto 0 0;
    width: 4px;
    background: var(--accent);
}

.receiving-line-item.needs-attention .receiving-line-accent {
    background: #c86d45;
}

.receiving-exact-ui .invoice-line-source {
    min-height: 76px;
    grid-template-columns: 42px minmax(0, 1fr);
    align-items: center;
    padding: 14px 22px 12px 16px;
    border-bottom: 1px solid var(--line);
}

.receiving-exact-ui .line-number {
    width: 34px;
    height: 34px;
    border: 2px solid #0b735c;
    background: #0f7b62;
    color: #fff;
    box-shadow: 0 0 0 4px rgba(15, 123, 98, 0.11);
}

.receiving-line-item.needs-attention .line-number,
.receiving-exact-ui .invoice-line-card.needs-attention .line-number {
    border-color: #b95634;
    background: #c86d45;
    box-shadow: 0 0 0 4px rgba(200, 109, 69, 0.14);
}

.receiving-exact-ui .invoice-line-overview {
    grid-template-columns: minmax(0, 1fr) minmax(210px, 260px);
    padding: 0 22px 14px 58px;
}

.receiving-exact-ui .invoice-line-editor {
    margin: 0 22px;
}

.receiving-exact-ui .invoice-line-editor-body {
    padding: 14px 0 18px;
}

.receiving-exact-ui .stock-line-fields {
    grid-template-columns: minmax(280px, 430px) minmax(0, 1fr);
    align-items: end;
    column-gap: 16px;
    row-gap: 14px;
}

.receiving-exact-ui .stock-line-fields .ingredient-choice {
    grid-column: 1;
}

.receiving-exact-ui .stock-line-fields .package-equation {
    grid-column: 2;
}

.receiving-exact-ui .stock-line-fields + .line-type-field,
.receiving-exact-ui .invoice-line-editor-body > .line-type-field,
.receiving-exact-ui .exclude-inventory-field {
    grid-column: 1;
}

.receiving-exact-ui .invoice-line-money {
    grid-column: 2;
    align-self: end;
}

.receiving-exact-ui .package-equation {
    grid-template-columns: minmax(90px, 1fr) 18px minmax(120px, 1fr) 18px minmax(120px, 1fr) minmax(190px, 250px);
    align-items: end;
}

.receiving-exact-ui .package-equation label:has(.stock-unit-select) .field-help,
.receiving-exact-ui .package-equation label:has(.stock-unit-select) small {
    display: none !important;
}

#start-received-correction,
#save-received-correction {
    display: none !important;
}

.receiving-exact-ui .invoice-line-money {
    grid-template-columns: repeat(4, minmax(110px, 1fr));
    padding-top: 4px;
}

.receiving-totals-card {
    min-height: 91px;
    margin-top: 13px;
    display: grid;
    grid-template-columns: 0.8fr 0.8fr 1fr 1fr 1.25fr;
    border-radius: 10px;
    overflow: hidden;
}

.receiving-totals-card > div {
    min-width: 0;
    padding: 15px 22px;
    display: grid;
    align-content: center;
    position: relative;
}

.receiving-totals-card > div + div::before {
    content: "";
    position: absolute;
    top: 15px;
    bottom: 15px;
    left: 0;
    width: 1px;
    background: var(--line);
}

.receiving-totals-card small {
    color: var(--muted);
    font-size: 10.5px;
    text-transform: uppercase;
}

.receiving-totals-card strong {
    margin-top: 5px;
    font-size: 16px;
    line-height: 1.2;
    white-space: nowrap;
}

.receiving-totals-card span {
    margin-top: 3px;
    color: var(--accent-dark);
    font-size: 10.5px;
}

.receiving-totals-card .receiving-total-gross {
    margin: 7px;
    padding: 10px 18px;
    border: 1px solid #bdd6b8;
    border-radius: 8px;
    background: #f1f7ed;
}

.receiving-totals-card .receiving-total-gross::before {
    display: none;
}

.receiving-totals-card .receiving-total-gross strong {
    font-size: 23px;
}

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

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

th,
td {
    padding: 13px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    white-space: nowrap;
}

th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

.numeric {
    text-align: right;
}

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

.alert {
    margin-bottom: 18px;
    padding: 12px 14px;
    border-radius: 8px;
    background: #ecf8f3;
    color: var(--accent-dark);
    border: 1px solid #bde4d5;
}

.alert.error {
    background: #fff1ec;
    color: var(--warn);
    border-color: #f4c3ae;
}

.user-chip {
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: white;
    color: var(--muted);
}

.location-list {
    display: grid;
    gap: 12px;
}

.location-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.location-row span,
.location-row small {
    color: var(--muted);
}

.warehouse-create-form {
    display: grid;
    grid-template-columns: minmax(150px, 1fr) minmax(120px, 180px) auto;
    align-items: end;
    gap: 10px;
    width: min(560px, 100%);
}

.stocktake-mobile-list { display: none; }

@media (max-width: 900px) {
    #stocktake-form .table-wrap { display: none; }

    .stocktake-mobile-list {
        display: grid;
        gap: 8px;
    }

    .stocktake-mobile-item {
        border: 1px solid var(--line);
        border-radius: 6px;
        background: #fff;
    }

    .stocktake-mobile-item summary {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        min-height: 58px;
        padding: 10px 14px;
        cursor: pointer;
        list-style: none;
    }

    .stocktake-mobile-item summary::-webkit-details-marker { display: none; }

    .stocktake-mobile-item summary > span:first-child {
        display: grid;
        gap: 2px;
        min-width: 0;
    }

    .stocktake-mobile-item summary small,
    .stocktake-mobile-details small {
        color: var(--muted);
        font-size: 11px;
        font-weight: 700;
    }

    .stocktake-mobile-item summary > span:last-child {
        flex: 0 0 auto;
        color: var(--muted);
        font-size: 13px;
        font-weight: 700;
    }

    .stocktake-mobile-details {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(126px, 1.15fr) minmax(0, 0.9fr);
        gap: 8px;
        align-items: start;
        padding: 12px 14px 14px;
        border-top: 1px solid var(--line);
    }

    .stocktake-mobile-details > span,
    .stocktake-mobile-details label {
        display: grid;
        gap: 5px;
        min-width: 0;
    }

    .stocktake-mobile-details input { min-width: 0; }

    .stocktake-mobile-details strong {
        min-height: 48px;
        display: flex;
        align-items: center;
    }
    #mobile-account-controls {
        padding: 10px 0 16px;
        border-bottom: 1px solid var(--line);
        margin-bottom: 12px;
    }

    #mobile-account-controls .topbar-actions {
        display: inline-flex !important;
        width: max-content !important;
        justify-content: flex-start;
        align-items: center;
        gap: 12px;
    }

    #mobile-account-controls .language-switch {
        display: inline-flex !important;
        width: auto !important;
        align-items: center;
        gap: 3px !important;
        padding: 3px !important;
    }

    #mobile-account-controls .language-switch a {
        min-width: 38px !important;
        padding: 8px 9px !important;
    }

    #mobile-account-controls .profile-button { padding: 0; }
    body.nav-open {
        overflow: hidden;
    }

    input,
    select,
    textarea {
        font-size: 16px;
    }

    .topbar {
        position: sticky;
        top: 0;
        margin: 0 -16px 12px;
        padding: 8px 16px;
    }
    .page-header { min-height: 56px; align-items: center; flex-wrap: nowrap; gap: 10px; }
    .page-header .mobile-menu-button {
        position: static;
        z-index: auto;
        display: grid;
        flex: 0 0 auto;
        width: 40px;
        min-width: 40px;
        height: 40px;
        min-height: 40px;
        margin: 0;
        box-shadow: none;
    }
    .page-header .page-section-title {
        min-width: 0;
        flex: 1;
        overflow: hidden;
        font-size: clamp(16px, 5vw, 20px);
        line-height: 1.1;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .page-header-spacer { display: none; }
    .topbar-title {
        width: 100%;
    }
    .global-search {
        order: 3;
        width: 100%;
        margin: 0;
    }
    .global-search kbd,
    .profile-copy {
        display: none;
    }
    .draft-overview-heading,
    .draft-overview-actions { align-items: stretch; flex-direction: column; }
    .draft-overview-actions > * { width: 100%; }
    .draft-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .draft-workflow { align-items: stretch; flex-direction: column; }
    .draft-workflow-line { width: 2px; min-height: 14px; min-width: 2px; margin-left: 13px; flex: 0 0 14px; }

    .mobile-menu-button {
        position: static;
        z-index: auto;
        display: grid;
        width: 44px;
        min-width: 44px;
        height: 44px;
        min-height: 44px;
        place-content: center;
        gap: 5px;
        border: 1px solid var(--line);
        border-radius: 999px;
        padding: 0;
        background: rgba(255, 255, 255, 0.94);
        color: var(--ink);
        box-shadow: 0 10px 30px rgba(35, 31, 32, 0.16);
        appearance: none;
    }

    .mobile-menu-button span:not(.sr-only) {
        display: block;
        width: 18px;
        height: 2px;
        border-radius: 999px;
        background: var(--ink);
    }

    .mobile-menu-close {
        position: absolute;
        top: 18px;
        right: 16px;
        display: grid;
        width: 38px;
        min-width: 38px;
        height: 38px;
        min-height: 38px;
        place-items: center;
        border: 1px solid rgba(255, 255, 255, 0.14);
        border-radius: 999px;
        padding: 0;
        background: rgba(255, 255, 255, 0.08);
        color: #fffaf3;
        box-shadow: none;
        appearance: none;
    }

    .mobile-menu-button:hover,
    .mobile-menu-close:hover {
        background: rgba(255, 255, 255, 0.14);
    }

    .mobile-menu-button:hover {
        background: rgba(255, 255, 255, 0.94);
    }

    .mobile-menu-close span {
        position: absolute;
        width: 16px;
        height: 2px;
        border-radius: 999px;
        background: #fffaf3;
    }

    .mobile-menu-close span:first-child {
        transform: rotate(45deg);
    }

    .mobile-menu-close span:last-child {
        transform: rotate(-45deg);
    }

    .mobile-menu-backdrop {
        position: fixed;
        inset: 0;
        z-index: 70;
        background: transparent;
        opacity: 0;
        pointer-events: none;
        transition: opacity 180ms ease;
    }

    body.nav-open .mobile-menu-backdrop {
        display: block;
        opacity: 1;
        pointer-events: auto;
    }

    .sidebar {
        z-index: 80;
        width: min(86vw, 330px);
        height: 100dvh;
        padding: max(22px, env(safe-area-inset-top)) 18px max(22px, env(safe-area-inset-bottom));
        transform: translateX(-105%);
        transition: transform 220ms ease;
        box-shadow: 22px 0 60px rgba(12, 10, 9, 0.28);
    }

    body.nav-open .sidebar {
        transform: translateX(0);
    }

    .sidebar nav {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        padding-bottom: 12px;
    }

    .sidebar-bottom {
        position: relative;
        flex: 0 0 92px;
        min-height: 92px;
        margin: 0 -18px calc(-1 * max(22px, env(safe-area-inset-bottom)));
        background: #fffdfa;
    }

    .sidebar-bottom .sign-out {
        position: absolute;
        bottom: 12px;
        left: 10px;
        min-height: 44px;
        padding-inline: 14px;
    }

    .sidebar-bottom .coffee-art.coffee-cup-art {
        width: 68px;
        height: 58px;
        right: 14px;
        bottom: 8px;
    }

    .app-shell {
        margin-left: 0;
        padding: 0 16px 20px;
    }

    .metric-grid,
    .split-grid,
    .dashboard-layout,
    .dashboard-hero,
    .module-grid,
    .shift-status-grid,
    .shift-workspace {
        grid-template-columns: 1fr;
    }

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

    .dashboard-hero-actions > * {
        width: 100%;
    }

    .scan-form,
    .draft-grid {
        grid-template-columns: 1fr;
    }

    .topbar:not(.page-header),
    .section-header,
    .form-row,
    .location-row,
    .shift-command,
    .shift-toolbar,
    .shift-filter-form,
    .shift-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .shift-filter-form label {
        min-width: 0;
    }

    .warehouse-connections select {
        width: 100%;
        min-width: 0;
    }

    .warehouse-connections .section-header button {
        width: 100%;
    }

    .draft-team-options {
        grid-template-columns: 1fr;
        max-height: 300px;
    }

    .draft-setup-heading,
    .draft-setup-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .shift-command form,
    .shift-command button,
    .shift-actions form,
    .shift-actions button {
        width: 100%;
    }

    .rota-grid-scroll {
        max-height: calc(100dvh - 280px);
        min-height: 360px;
    }

    .native-rota-table .employee-column {
        width: 146px;
        min-width: 146px;
    }

    .native-rota-table th,
    .native-rota-table td {
        width: 86px;
        min-width: 86px;
        padding: 6px;
    }

    .employee-rota-cell,
    .native-shift-card {
        min-height: 54px;
        padding: 8px;
    }

    .shift-modal-grid {
        grid-template-columns: 1fr;
    }

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

    .invoice-review-header,
    .invoice-review-actions,
    .reconciliation-bar,
    .receiving-page-title,
    .receiving-page-actions,
    .receiving-section-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .invoice-review-header {
        gap: 12px;
        padding: 16px;
    }

    .invoice-title-line {
        display: grid;
        gap: 8px;
        margin-bottom: 6px;
    }

    .invoice-title-line h2 {
        font-size: 18px;
        line-height: 1.18;
    }

    .invoice-title-line .status {
        width: fit-content;
    }

    .invoice-review-header .draft-actions {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        width: 100%;
        gap: 8px;
    }

    .invoice-review-header .draft-actions button,
    .invoice-review-header .draft-actions .button {
        min-height: 40px;
        padding: 0 8px;
        font-size: 13px;
        line-height: 1.15;
        white-space: normal;
    }

    .invoice-header-fields,
    .manual-receipt-header,
    .manual-line-row,
    .invoice-line-source,
    .invoice-line-body,
    .warehouse-create-form,
    .receiving-supplier-card,
    .receiving-totals-card,
    .receiving-grid-view {
        grid-template-columns: 1fr;
    }

    .invoice-header-fields {
        gap: 12px;
        padding: 14px 16px;
    }

    .receiving-exact-ui .invoice-header-fields,
    .invoice-review-workspace .invoice-header-fields {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
        padding: 14px 16px;
        overflow: hidden;
    }

    .receiving-exact-ui .invoice-header-fields .supplier-field,
    .invoice-review-workspace .invoice-header-fields .supplier-field,
    .receiving-exact-ui .invoice-header-fields > label:nth-of-type(1),
    .invoice-review-workspace .invoice-header-fields > label:nth-of-type(1),
    .receiving-exact-ui .invoice-header-fields > label:nth-of-type(2),
    .invoice-review-workspace .invoice-header-fields > label:nth-of-type(2),
    .receiving-exact-ui .invoice-header-fields > label:nth-of-type(3),
    .invoice-review-workspace .invoice-header-fields > label:nth-of-type(3) {
        grid-column: 1 / -1;
    }

    .invoice-header-fields label,
    .invoice-field {
        min-width: 0;
    }

    .invoice-header-fields input,
    .invoice-header-fields select {
        min-width: 0;
        padding-inline: 10px;
    }

    .invoice-line-source,
    .receiving-exact-ui .invoice-line-source {
        grid-template-columns: 40px minmax(0, 1fr);
        align-items: center;
        gap: 10px;
        padding-top: 14px;
    }

    .supplier-field .compact-button {
        width: 100%;
        min-height: 40px;
        font-size: 13px;
        line-height: 1.15;
    }

    .reconciliation-bar {
        margin: 12px 16px;
        padding: 12px;
    }

    .receiving-exact-ui .draft-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .receiving-exact-ui .draft-summary-card + .draft-summary-card {
        border-left: 0;
    }

    .receiving-exact-ui .draft-summary-card:nth-child(even) {
        border-left: 1px solid var(--line);
    }

    .receiving-exact-ui .draft-summary-card:nth-child(n + 3) {
        border-top: 1px solid var(--line);
    }

    .receiving-supplier-divider {
        display: none;
    }

    .receiving-supplier-meta {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        padding-top: 14px;
        border-top: 1px solid var(--line);
    }

    .receiving-exact-ui .invoice-line-overview {
        padding-left: 22px;
    }

    .receiving-totals-card > div + div::before {
        top: 0;
        right: 18px;
        bottom: auto;
        left: 18px;
        width: auto;
        height: 1px;
    }

    .invoice-line-money {
        display: none;
    }

    .invoice-line-overview {
        grid-template-columns: 1fr;
    }

    .receiving-exact-ui .stock-line-fields {
        grid-template-columns: 1fr;
    }

    .receiving-exact-ui .stock-line-fields .ingredient-choice,
    .receiving-exact-ui .stock-line-fields .package-equation,
    .receiving-exact-ui .invoice-line-editor-body > .line-type-field,
    .receiving-exact-ui .exclude-inventory-field,
    .receiving-exact-ui .invoice-line-money {
        grid-column: auto;
    }

    .invoice-line-editor > summary {
        grid-template-columns: auto minmax(0, 1fr) 12px;
    }

    .invoice-line-edit-summary {
        justify-content: flex-start;
    }

    .package-equation {
        grid-template-columns: 1fr 16px 1fr 16px 1fr;
    }

    .package-equation label:nth-of-type(4) {
        grid-column: 1 / -1;
    }

    .invoice-review-actions > div,
    .line-filters {
        width: 100%;
        align-items: stretch;
        flex-direction: column;
    }

    .invoice-review-action-buttons {
        display: grid;
        gap: 8px;
    }

    .invoice-review-status {
        min-width: 0;
        align-items: stretch !important;
    }

    .footer-warehouse-field {
        width: 100%;
    }

    .invoice-review-actions button,
    .invoice-review-actions .button,
    .filter-button {
        width: 100%;
    }

    .line-filters {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 4px;
    }

    .filter-button {
        min-height: 38px;
    }

    .fruitsys-catalog-header,
    .catalog-toolbar,
    .modal-actions,
    .receiving-actions,
    .scan-result-actions { align-items: stretch; flex-direction: column; }

    .modal-heading {
        align-items: flex-start;
        flex-direction: row;
    }

    .modal-heading .icon-button {
        flex: 0 0 40px;
        margin-left: auto;
    }

    .modal-actions > *,
    .receiving-actions > *,
    .scan-result-actions > * { width: 100%; }
    .ingredient-row { grid-template-columns: 1fr; }
    .ingredient-row .icon-button { width: 100%; }
    .ingredient-suggestion { align-items: flex-start; }

    .inventory-toolbar {
        align-items: stretch;
        flex-direction: column;
        margin-top: 18px;
    }

    .ingredients-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .ingredients-search,
    .ingredients-category {
        flex-basis: auto;
        width: 100%;
    }

    .ingredients-result-count {
        padding: 0 2px;
    }

    .warehouse-picker {
        width: 100%;
        flex-basis: auto;
    }

    .inventory-search {
        flex-basis: auto;
        width: 100%;
    }

    .inventory-result-count {
        padding-left: 2px;
    }

    .inventory-table-wrap {
        overflow: visible;
    }

    .inventory-table,
    .inventory-table tbody {
        display: block;
    }

    .inventory-table thead {
        display: none;
    }

    .inventory-table .inventory-balance-row {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas:
            "product quantity"
            "warehouse quantity"
            "action action";
        gap: 5px 16px;
        padding: 15px 0;
        border-bottom: 1px solid var(--line);
    }

    .inventory-table .inventory-balance-row td {
        min-width: 0;
        padding: 0;
        border: 0;
        white-space: normal;
    }

    .inventory-product {
        grid-area: product;
    }

    .inventory-warehouse {
        grid-area: warehouse;
    }

    .inventory-quantity {
        grid-area: quantity;
        align-self: center;
        text-align: right;
        white-space: nowrap !important;
    }

    .inventory-actions {
        grid-area: action;
        width: auto;
        padding-top: 7px !important;
        text-align: left;
    }

    .inventory-actions .transfer-stock-button {
        width: 100%;
    }

    .inventory-warehouse strong,
    .inventory-warehouse .table-detail {
        display: inline;
        color: var(--muted);
        font-size: 12px;
        font-weight: 600;
    }

    .inventory-warehouse .table-detail::before {
        content: " / ";
    }
}
