:root {
    --mat-blue: #143f73;
    --mat-blue-dark: #0b2d55;
    --mat-green: #12806f;
    --mat-bg: #edf4fb;
    --mat-card: #ffffff;
    --mat-border: #cfe0f2;
    --mat-text: #05254a;
    --mat-muted: #64748b;
    --mat-warn: #b45309;
    --mat-danger: #b91c1c;
    --shadow: 0 12px 30px rgba(15, 45, 85, .12);
}

.order-signature-confirm {
    margin-top: 14px;
    border-left: 4px solid var(--mat-green);
}

.order-signature-confirm h2,
.order-signature-admin h2 {
    margin-bottom: 6px;
}

.check-line {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-height: 46px;
    padding: 12px;
    border: 1px solid #cfe0f4;
    border-radius: 12px;
    background: #f8fbff;
    color: var(--mat-blue-dark);
    font-weight: 800;
    line-height: 1.35;
}

.check-line input {
    width: auto;
    min-width: 18px;
    margin-top: 2px;
}

.hash-line {
    max-width: 100%;
    font-family: Consolas, "Courier New", monospace;
    font-size: 12px;
    word-break: break-all;
    color: #334155;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: var(--mat-bg);
    color: var(--mat-text);
    font-size: 14px;
    touch-action: manipulation;
    -webkit-text-size-adjust: 100%;
}

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

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: linear-gradient(135deg, #092f5e, #edf4fb);
}

.login-card {
    width: min(520px, 100%);
    background: rgba(255,255,255,.96);
    border: 1px solid var(--mat-border);
    border-radius: 18px;
    padding: 34px 34px 30px;
    box-shadow: var(--shadow);
}

.login-brand {
    display: grid;
    place-items: center;
    gap: 8px;
    margin-bottom: 24px;
}

.login-step-box {
    display: grid;
    gap: 4px;
    margin: 8px 0 18px;
    padding: 14px 16px;
    border: 1px solid var(--mat-border);
    border-radius: 14px;
    background: #f7fbff;
    color: var(--mat-text);
}

.login-step-box span {
    color: var(--mat-muted);
    font-weight: 700;
}

.brand-mark {
    width: 72px;
    height: 72px;
    border-radius: 22px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--mat-blue), var(--mat-green));
    color: #fff;
    font-size: 34px;
    font-weight: 800;
}

.app-logo {
    display: block;
    object-fit: contain;
    background: transparent;
    overflow: hidden;
    box-shadow: none;
}

.login-logo {
    width: min(340px, 86vw);
    height: min(340px, 86vw);
    border-radius: 999px;
    padding: 0;
}

.sidebar-logo {
    width: 190px;
    height: 190px;
    border-radius: 999px;
    padding: 0;
    flex: 0 0 auto;
}

.header-logo {
    width: 136px;
    height: 136px;
    border-radius: 999px;
    padding: 0;
    flex: 0 0 auto;
}

.config-logo {
    width: 210px;
    height: 210px;
    border: 0;
    border-radius: 999px;
    padding: 0;
    background: transparent;
    justify-self: center;
}

.brand-config {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 18px;
}

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

.brand-config-card {
    display: grid;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--mat-border);
    border-radius: 14px;
    background: #f8fbff;
}

.brand-config-card form {
    display: grid;
    gap: 8px;
}

.app-shell {
    display: grid;
    grid-template-columns: 270px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: var(--mat-blue-dark);
    color: #fff;
    padding: 22px 16px;
}

.sidebar .brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 0 4px 24px;
    border-bottom: 1px solid rgba(255,255,255,.15);
    margin-bottom: 18px;
}

.sidebar .brand-mark {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    font-size: 22px;
}

.nav-section {
    margin: 20px 8px 8px;
    color: rgba(255,255,255,.65);
    font-size: 11px;
    letter-spacing: .08em;
    font-weight: 800;
    text-transform: uppercase;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 12px;
    color: rgba(255,255,255,.94);
    font-weight: 700;
    margin-bottom: 5px;
}

.nav-link.active,
.nav-link:hover {
    background: rgba(255,255,255,.12);
}

.main {
    padding: 22px;
    overflow-x: hidden;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    margin-bottom: 18px;
}

.page-title h1 {
    margin: 0;
    font-size: 28px;
}

.page-title p {
    margin: 7px 0 0;
    color: var(--mat-muted);
}

.card {
    background: var(--mat-card);
    border: 1px solid var(--mat-border);
    border-radius: 14px;
    padding: 18px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}

.grid {
    display: grid;
    gap: 16px;
}

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

.kpi strong {
    display: block;
    font-size: 30px;
    margin-bottom: 4px;
}

.kpi span { color: var(--mat-muted); font-weight: 700; }

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

label {
    display: block;
    font-weight: 800;
    font-size: 12px;
    margin-bottom: 6px;
}

input, select, textarea {
    width: 100%;
    border: 1px solid #b9d1ea;
    border-radius: 10px;
    padding: 11px 12px;
    color: var(--mat-text);
    font-weight: 700;
    background: #fff;
}

textarea { min-height: 84px; resize: vertical; }

.btn {
    border: 0;
    border-radius: 10px;
    padding: 11px 16px;
    color: #fff;
    background: linear-gradient(135deg, var(--mat-blue), var(--mat-green));
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn.secondary { background: #475569; }
.btn.danger { background: var(--mat-danger); }
.btn.warn { background: var(--mat-warn); }

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

.topbar-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
}

.topbar-actions form {
    margin: 0;
}

.topbar-actions-standalone {
    margin: -6px 0 16px;
}

.top-icon-btn {
    border: 1px solid var(--mat-border);
    border-radius: 999px;
    padding: 10px 14px;
    background: #fff;
    color: var(--mat-blue-dark);
    font-weight: 900;
    cursor: pointer;
    box-shadow: var(--shadow);
}

.notice-count {
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 5px;
    background: #dc2626;
    color: #fff;
    font-size: 12px;
    font-weight: 900;
}

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

.quick-action-card {
    min-height: 132px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    padding: 18px;
    border: 1px solid var(--mat-border);
    border-radius: 18px;
    background: #fff;
    box-shadow: var(--shadow);
}

.quick-action-card.primary {
    background: linear-gradient(135deg, var(--mat-blue), var(--mat-green));
    color: #fff;
}

.quick-action-card strong {
    font-size: 20px;
}

.quick-action-card span {
    color: var(--mat-muted);
    font-weight: 700;
}

.quick-action-card.primary span {
    color: rgba(255,255,255,.86);
}

.order-card-list {
    display: grid;
    gap: 14px;
}

.order-card > div:first-child {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

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

.collab-shell {
    min-height: 100vh;
    background: linear-gradient(180deg, #edf7ff 0%, #f8fbff 45%, #edf4fb 100%);
}

.collab-header {
    position: sticky;
    top: 0;
    z-index: 40;
    display: grid;
    grid-template-columns: minmax(120px, auto) minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    padding: 12px 22px;
    background: linear-gradient(135deg, #0b3b6d 0%, #0f766e 100%);
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,.22);
    box-shadow: 0 12px 30px rgba(15,45,85,.22);
}

.collab-brand,
.collab-user,
.collab-top-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.collab-brand .brand-mark {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    font-size: 22px;
    background: rgba(255,255,255,.16);
    border-color: rgba(255,255,255,.35);
    color: #fff;
}

.collab-brand small,
.collab-user small,
.collab-user span {
    display: block;
    color: rgba(255,255,255,.82);
    font-weight: 700;
}

.collab-brand,
.collab-brand strong,
.collab-user strong {
    color: #fff;
}

.collab-top-actions .top-icon-btn {
    border-color: rgba(255,255,255,.38);
    background: rgba(255,255,255,.96);
    color: var(--mat-blue-dark);
}

.collab-user {
    justify-content: center;
    text-align: center;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.collab-user strong,
.collab-user span,
.collab-user small {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.collab-top-actions form {
    margin: 0;
}

.collab-main {
    max-width: 1120px;
    margin: 0 auto;
    padding: 18px;
}

.collab-home-simple .collab-hero {
    display: none;
}

.collab-back {
    margin-bottom: 14px;
}

.home-btn {
    width: 68px;
    height: 68px;
    border: 0;
    border-radius: 22px;
    display: grid;
    place-items: center;
    gap: 2px;
    color: #fff;
    background: linear-gradient(135deg, var(--mat-blue), var(--mat-green));
    box-shadow: var(--shadow);
    font-weight: 900;
}

.home-btn .home-icon {
    line-height: 1;
    font-size: 32px;
}

.home-btn small {
    margin-top: -6px;
    font-size: 11px;
    text-transform: lowercase;
}

.collab-hero {
    margin-bottom: 18px;
    padding: 22px;
    border: 1px solid var(--mat-border);
    border-radius: 22px;
    background: #fff;
    box-shadow: var(--shadow);
}

.collab-hero.compact {
    padding: 18px 20px;
}

.collab-title-row {
    display: grid;
    grid-template-columns: 68px minmax(0, 1fr) 68px;
    align-items: center;
    justify-items: center;
    gap: 14px;
}

.collab-title-row .home-btn {
    grid-column: 1;
    justify-self: start;
}

.collab-title-row > div {
    grid-column: 2;
    text-align: center;
    min-width: 0;
}

.collab-title-row h2 {
    margin-bottom: 0;
}

.collab-hero h2 {
    margin: 0 0 8px;
    font-size: 26px;
}

.collab-hero p {
    margin: 0;
    color: var(--mat-muted);
    font-weight: 700;
}

.collab-simple-page > .collab-hero p {
    display: none;
}

.collab-simple-page > .collab-hero {
    margin-bottom: 12px;
    padding: 14px 16px;
}

.collab-menu-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.collab-menu-card,
.category-card,
.available-card {
    border: 1px solid var(--mat-border);
    border-radius: 24px;
    background: #fff;
    box-shadow: var(--shadow);
}

.collab-menu-card {
    min-height: 150px;
    display: grid;
    place-items: center;
    text-align: center;
    gap: 8px;
    padding: 18px;
}

.collab-menu-card.primary {
    background: linear-gradient(135deg, var(--mat-blue), var(--mat-green));
    color: #fff;
}

.big-icon {
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    border-radius: 18px;
    background: #edf7ff;
    font-size: 27px;
    font-weight: 900;
}

.collab-menu-card.primary .big-icon {
    background: rgba(255,255,255,.18);
}

.collab-menu-card strong,
.category-card strong {
    font-size: 21px;
}

.collab-menu-card small,
.category-card small,
.available-card small {
    color: var(--mat-muted);
    font-weight: 800;
}

.collab-home-simple .collab-menu-card small {
    display: none;
}

.collab-menu-card.primary small {
    color: rgba(255,255,255,.88);
}

.available-card-grid,
.category-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.available-card {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 14px;
    align-items: center;
    padding: 18px;
}

.available-card .large {
    width: 72px;
    height: 72px;
    border-radius: 22px;
    font-size: 24px;
}

.available-card p {
    grid-column: 1 / -1;
    margin: 8px 0 0;
    color: var(--mat-muted);
    font-weight: 800;
}

.available-card b {
    grid-column: 1 / -1;
    font-size: 34px;
}

.panel-mini-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.panel-mini-card {
    min-height: 150px;
    grid-template-columns: 1fr;
    justify-items: center;
    align-items: center;
    text-align: center;
    gap: 6px;
    padding: 14px 10px;
}

.panel-mini-card .large {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    font-size: 18px;
}

.panel-mini-card strong {
    font-size: 14px;
    line-height: 1.15;
}

.panel-mini-card small {
    font-size: 11px;
}

.panel-mini-card b {
    grid-column: auto;
    font-size: 25px;
}

.center-actions {
    justify-content: center;
    margin-top: 18px;
}

.category-card {
    min-height: 190px;
    display: grid;
    place-items: center;
    text-align: center;
    gap: 8px;
    padding: 20px;
}

.category-back {
    margin: 0 0 14px;
}

.period-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 0 0 14px;
}

.period-tabs a {
    padding: 10px 14px;
    border: 1px solid var(--mat-border);
    border-radius: 999px;
    background: #fff;
    color: var(--mat-blue-dark);
    font-weight: 900;
}

.period-tabs a.active {
    background: var(--mat-blue);
    color: #fff;
}

.mini-order-card {
    display: grid;
    gap: 6px;
    padding: 12px;
    border: 1px solid var(--mat-border);
    border-radius: 14px;
    background: #f8fbff;
}

.changed-field {
    border-color: #ef4444 !important;
    background: #fff1f2 !important;
    color: #991b1b !important;
    font-weight: 900;
}

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

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 780px;
}

th {
    text-align: left;
    background: #edf5ff;
    color: #07315f;
    font-size: 12px;
}

th, td {
    padding: 12px;
    border-bottom: 1px solid #dce8f6;
    vertical-align: top;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 9px;
    border-radius: 999px;
    background: #dbeafe;
    color: #1e40af;
    font-weight: 800;
    font-size: 12px;
}

.badge.ok { background: #dcfce7; color: #166534; }
.badge.warn { background: #fef3c7; color: #92400e; }
.badge.danger { background: #fee2e2; color: #991b1b; }

.flash {
    padding: 14px 16px;
    border-radius: 12px;
    margin-bottom: 16px;
    font-weight: 800;
    border: 1px solid #bbf7d0;
    background: #f0fdf4;
    color: #166534;
}

.flash.error {
    border-color: #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

.alert-panel {
    display: grid;
    gap: 12px;
    margin-bottom: 16px;
}

.alert-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    color: #1e3a8a;
    font-weight: 800;
}

.alert-card span {
    flex: 1;
    color: #334155;
    font-weight: 700;
}

.alert-card.warn {
    border-color: #fde68a;
    background: #fffbeb;
    color: #92400e;
}

.orders-filter {
    align-items: end;
}

.orders-filter-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.orders-title-line {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 12px;
}

.orders-title-line h2 {
    margin-bottom: 4px;
}

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

.order-spreadsheet-report {
    page: order-report-landscape;
    overflow-x: auto;
    margin-top: 12px;
}

.sheet {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 12px;
    background: #fff;
    color: #0f2748;
    font-size: 12px;
}

.sheet th,
.sheet td {
    border: 1px solid #8ea3bd;
    padding: 7px 8px;
    text-align: left;
    vertical-align: top;
}

.sheet th {
    background: #dbe8f7;
    color: #06234a;
    font-weight: 900;
}

.sheet-title {
    background: #173f73 !important;
    color: #fff !important;
    font-size: 17px;
    text-align: center !important;
    letter-spacing: 0;
}

.sheet .num {
    text-align: right;
    font-weight: 900;
}

.sheet-items tr:nth-child(even) td {
    background: #f8fbff;
}

.timeline-step {
    border: 1px solid #cbd5e1;
    border-radius: 14px;
    background: #f8fafc;
    padding: 12px;
}

.timeline-step strong {
    display: block;
    color: #0f2748;
    font-size: 13px;
    margin-bottom: 4px;
}

.timeline-step span {
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
}

.timeline-step.done {
    border-color: #86efac;
    background: #f0fdf4;
}

.order-receipt-form {
    margin-top: 16px;
    box-shadow: none;
}

.receipt-check-list {
    display: grid;
    gap: 10px;
    margin: 12px 0;
}

.receipt-check-list label {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid #bfdbfe;
    border-radius: 12px;
    background: #f8fbff;
    color: #0f2748;
    font-weight: 800;
    padding: 10px 12px;
}

.low-stock-admin {
    margin-top: 0;
}

.low-stock-row {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 10px 0;
    border-top: 1px solid #dce8f6;
}

.readonly-field {
    padding: 12px;
    border: 1px solid var(--mat-border);
    border-radius: 12px;
    background: #f8fbff;
}

.readonly-field strong {
    display: block;
    font-size: 15px;
}

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

.inline-form input {
    width: 90px;
    padding: 8px;
}

.inline-form .btn {
    padding: 8px 10px;
}

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

.print-note {
    display: none;
}

.delivery-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.cart-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 130px;
    padding: 10px 14px;
    border-radius: 999px;
    background: #edf5ff;
    border: 1px solid var(--mat-border);
    font-weight: 800;
}

.compact-form {
    align-items: end;
}

.cart-clear-form {
    margin-top: 12px;
}

.delivery-tabs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.delivery-tabs a,
.delivery-view-toggle a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 10px 14px;
    border: 1px solid var(--mat-border);
    border-radius: 999px;
    background: #fff;
    color: var(--mat-blue-dark);
    font-weight: 900;
}

.delivery-tabs a.active,
.delivery-view-toggle a.active {
    background: linear-gradient(135deg, var(--mat-blue), var(--mat-green));
    color: #fff;
    border-color: transparent;
    box-shadow: var(--shadow);
}

.delivery-view-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.delivery-view-toggle span {
    color: var(--mat-muted);
    font-weight: 800;
}

.stock-card {
    display: grid;
    gap: 7px;
    min-height: 138px;
    padding: 16px;
    background: #fff;
    border: 1px solid var(--mat-border);
    border-radius: 14px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform .12s ease, border-color .12s ease, background .12s ease;
}

.stock-card:hover {
    transform: translateY(-1px);
    border-color: #7db4ee;
    background: #f8fbff;
}

.stock-card.disabled {
    opacity: .55;
    cursor: not-allowed;
}

.stock-card-title {
    font-size: 17px;
    font-weight: 900;
}

.mobile-stock-context {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 12px;
    border: 1px solid var(--mat-border);
    border-radius: 12px;
    background: #f8fbff;
}

.mobile-stock-context span {
    color: var(--mat-muted);
    font-weight: 700;
}

.stock-list {
    display: grid;
    gap: 14px;
}

.stock-view-icons {
    gap: 18px;
}

.stock-view-icons .stock-category {
    overflow: hidden;
}

.stock-view-icons .stock-category h3 {
    padding-left: 2px;
}

.stock-view-icons .stock-category {
    display: block;
    white-space: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-padding-left: 0;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 10px;
    touch-action: pan-x pan-y;
}

.stock-view-icons .stock-category > form {
    margin-right: 14px;
    white-space: normal;
}

.stock-view-icons .stock-category h3 {
    white-space: normal;
    position: sticky;
    left: 0;
    z-index: 1;
    background: linear-gradient(90deg, #eaf3fb 0%, rgba(234, 243, 251, 0) 100%);
}

.stock-view-icons .stock-category::-webkit-scrollbar {
    height: 8px;
}

.stock-view-icons .stock-category::-webkit-scrollbar-thumb {
    background: #bfd3e8;
    border-radius: 999px;
}

.stock-category {
    display: grid;
    gap: 8px;
}

.stock-category h3 {
    margin: 6px 0 2px;
    color: #0b2d55;
    font-size: 15px;
    text-transform: uppercase;
}

.mobile-stock-card {
    grid-template-columns: 58px minmax(140px, 1fr) auto auto;
    align-items: center;
    min-height: 84px;
    padding: 12px;
    cursor: default;
}

.stock-icon-card {
    grid-template-columns: 1fr;
    grid-template-areas:
        "icon"
        "summary"
        "qty"
        "action"
        "badge";
    justify-items: center;
    text-align: center;
    gap: 10px;
    min-height: 250px;
    width: min(78vw, 270px);
    display: inline-grid;
    vertical-align: top;
    border-radius: 20px;
    padding: 18px 16px;
    scroll-snap-align: start;
}

.stock-icon-card .item-icon { grid-area: icon; }
.stock-icon-card .item-summary { grid-area: summary; }
.stock-icon-card .inline-qty { grid-area: qty; }
.stock-icon-card .compact-add { grid-area: action; width: max-content; }
.stock-icon-card .cart-badge { grid-area: badge; grid-column: auto; }

.stock-icon-card .item-icon {
    width: 104px;
    height: 104px;
    border-radius: 22px;
    font-size: 28px;
}

.stock-icon-card .item-summary strong {
    font-size: 18px;
    line-height: 1.15;
}

.stock-icon-card .item-summary small {
    font-size: 13px;
}

.stock-icon-card .inline-qty {
    justify-content: center;
}

.stock-icon-card .compact-add {
    min-width: 112px;
}

.mobile-stock-card:hover {
    transform: none;
}

.item-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #e0f2fe, #dcfce7);
    border: 1px solid #b9d1ea;
    color: var(--mat-blue);
    font-weight: 900;
}

.item-summary {
    display: grid;
    gap: 2px;
}

.item-summary strong {
    font-size: 15px;
}

.item-summary span,
.item-summary small {
    color: var(--mat-muted);
    font-weight: 700;
}

.inline-qty {
    display: grid;
    grid-template-columns: 42px 54px 42px;
    align-items: center;
    gap: 4px;
}

.inline-qty input {
    height: 40px;
    padding: 6px;
    text-align: center;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 900;
}

.mini-qty {
    width: 42px;
    height: 40px;
    border: 0;
    border-radius: 10px;
    background: #edf5ff;
    color: var(--mat-blue-dark);
    font-size: 22px;
    font-weight: 900;
    cursor: pointer;
}

.mini-qty:hover {
    background: #dbeafe;
}

.compact-add {
    min-width: 108px;
    padding: 10px 12px;
}

.auto-cart-submit {
    display: none;
}

.request-list {
    display: grid;
    gap: 10px;
    padding-bottom: 92px;
}

.request-item-row {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--mat-border);
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 8px 22px rgba(15,45,85,.08);
}

.request-item-row.selected {
    border-color: #0f766e;
    background: #f0fdfa;
}

.request-item-row.disabled {
    opacity: .54;
}

.request-item-info {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.request-item-info strong,
.request-item-info span,
.request-item-info small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.request-item-info strong {
    color: var(--mat-blue-dark);
    font-size: 15px;
}

.request-item-info span,
.request-item-info small {
    color: var(--mat-muted);
    font-weight: 800;
    font-size: 12px;
}

.request-qty {
    grid-template-columns: 38px 54px 38px;
    gap: 4px;
}

.request-qty input {
    height: 38px;
    font-size: 17px;
}

.request-qty .mini-qty {
    width: 38px;
    height: 38px;
}

.order-preview-a4 {
    width: min(100%, 794px);
    min-height: 1040px;
    margin: 0 auto 18px;
    padding: 28px;
    border: 1px solid #b8c6d8;
    background: #fff;
    box-shadow: 0 16px 40px rgba(15,45,85,.16);
    color: #0b2d55;
}

.order-preview-header {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    padding-bottom: 14px;
    border-bottom: 3px solid #0b3b6d;
}

.order-preview-header strong {
    display: block;
    font-size: 22px;
}

.order-preview-header span,
.order-preview-header small {
    display: block;
    color: var(--mat-muted);
    font-weight: 800;
}

.order-preview-meta {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 10px;
    margin: 18px 0;
}

.order-preview-meta > div {
    padding: 10px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #f8fafc;
}

.order-preview-meta small {
    display: block;
    color: var(--mat-muted);
    font-weight: 800;
}

.order-preview-table table {
    min-width: 0;
    font-size: 12px;
}

.order-preview-table th {
    background: #e8f0fa;
    color: #0b2d55;
    text-transform: uppercase;
    font-size: 11px;
}

.order-preview-table td,
.order-preview-table th {
    border: 1px solid #d7e1ee;
}

.order-preview-footer {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 16px;
    padding: 12px;
    border-radius: 12px;
    background: #eef6ff;
    border: 1px solid #bfdbfe;
    font-weight: 900;
}

.order-preview-note {
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px solid #d7e1ee;
    color: var(--mat-muted);
    font-size: 12px;
    font-weight: 700;
}

.order-preview-actions {
    justify-content: center;
}

.cart-badge {
    grid-column: 2 / -1;
    width: max-content;
}

.cart-review-footer {
    position: fixed;
    left: 50%;
    bottom: 16px;
    transform: translateX(-50%);
    width: min(720px, calc(100% - 24px));
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--mat-border);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 18px 42px rgba(15, 45, 85, 0.22);
    z-index: 50;
}

.cart-review-footer strong,
.cart-review-footer span {
    display: block;
}

.cart-review-footer span {
    color: var(--mat-muted);
    font-size: 13px;
    font-weight: 700;
}

.item-detail {
    max-width: 760px;
}

.qty-picker {
    display: grid;
    grid-template-columns: 74px minmax(110px, 180px) 74px;
    gap: 12px;
    align-items: center;
    margin: 18px 0;
}

.qty-picker input {
    height: 64px;
    text-align: center;
    font-size: 26px;
    font-weight: 900;
}

.qty-btn {
    height: 64px;
    border: 0;
    border-radius: 14px;
    background: var(--mat-blue);
    color: #fff;
    font-size: 30px;
    font-weight: 900;
    cursor: pointer;
}

.qty-btn:hover {
    background: var(--mat-green);
}

.diff-line {
    display: grid;
    gap: 4px;
    padding: 6px 8px;
    margin-bottom: 6px;
    border-radius: 8px;
    background: #fff7ed;
    color: #7c2d12;
    font-weight: 700;
}

.stacked-actions {
    display: grid;
    gap: 8px;
    min-width: 220px;
}

.order-row-actions {
    align-items: center;
    display: flex;
    flex-wrap: nowrap;
    gap: 5px;
    min-width: max-content;
    white-space: nowrap;
}

.order-row-actions .btn {
    border-radius: 9px;
    font-size: 11px;
    line-height: 1;
    min-height: 0;
    padding: 8px 9px;
}

.order-row-actions form {
    display: inline-flex;
    margin: 0;
}

@media (max-width: 980px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { position: static; }
    .grid.cols-4, .grid.cols-3, .grid.cols-2, .form-grid, .quick-actions-grid, .readonly-grid { grid-template-columns: 1fr; }
    .topbar { align-items: flex-start; flex-direction: column; }
    .topbar-actions {
        width: 100%;
        justify-content: stretch;
    }
    .topbar-actions .top-icon-btn,
    .topbar-actions form {
        flex: 1;
    }
    .topbar-actions form button {
        width: 100%;
    }
    .quick-action-card {
        min-height: 104px;
    }
    .collab-header {
        position: static;
        grid-template-columns: 112px minmax(0, 1fr);
        grid-template-areas:
            "brand user"
            "actions actions";
        align-items: center;
        text-align: left;
        justify-items: stretch;
        gap: 8px 10px;
        padding: 10px 12px;
    }
    .collab-brand {
        grid-area: brand;
        justify-content: flex-start;
        width: auto;
    }
    .collab-brand > span:not(.brand-mark) {
        display: none;
    }
    .collab-brand .brand-mark {
        width: 52px;
        height: 52px;
        border-radius: 18px;
        font-size: 24px;
    }
    .header-logo {
        width: 96px;
        height: 96px;
        border-radius: 999px;
        padding: 10px;
    }
    .brand-config {
        grid-template-columns: 1fr;
    }
    .brand-config-grid {
        grid-template-columns: 1fr;
    }
    .config-logo {
        width: 100%;
        max-width: 420px;
    }
    .collab-user {
        grid-area: user;
        align-items: flex-start;
        justify-content: center;
        text-align: left;
        gap: 1px;
    }
    .collab-user strong {
        font-size: 13px;
    }
    .collab-user span,
    .collab-user small {
        font-size: 12px;
        line-height: 1.2;
    }
    .collab-top-actions {
        grid-area: actions;
        justify-content: center;
        width: 100%;
    }
    .collab-top-actions .top-icon-btn,
    .collab-top-actions form {
        flex: 1;
    }
    .collab-top-actions form button {
        width: 100%;
    }
    .collab-main {
        padding: 10px;
    }
    .collab-menu-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }
    .collab-menu-card {
        min-height: 118px;
        padding: 12px 8px;
        border-radius: 18px;
    }
    .big-icon {
        width: 46px;
        height: 46px;
        border-radius: 14px;
        font-size: 21px;
    }
    .collab-menu-card strong,
    .category-card strong {
        font-size: 16px;
        line-height: 1.15;
    }
    .available-card-grid,
    .category-card-grid {
        grid-template-columns: 1fr;
    }
    .panel-mini-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
    }
    .panel-mini-card {
        min-height: 122px;
        padding: 10px 6px;
        border-radius: 16px;
    }
    .panel-mini-card .large {
        width: 40px;
        height: 40px;
        border-radius: 13px;
        font-size: 15px;
    }
    .panel-mini-card strong {
        font-size: 12px;
    }
    .panel-mini-card small {
        font-size: 9px;
    }
    .panel-mini-card b {
        font-size: 20px;
    }
    .home-btn {
        width: 56px;
        height: 56px;
        border-radius: 18px;
    }
    .home-btn .home-icon {
        font-size: 27px;
    }
    .collab-title-row {
        grid-template-columns: 56px minmax(0, 1fr) 56px;
        gap: 10px;
        padding: 12px;
    }
    .collab-title-row h2 {
        font-size: 24px;
    }
    .delivery-head { flex-direction: column; }
    .qty-picker { grid-template-columns: 64px 1fr 64px; }
    .mobile-stock-card {
        grid-template-columns: 52px minmax(0, 1fr);
    }
    .inline-qty,
    .compact-add,
    .cart-badge {
        grid-column: 2;
    }
    .inline-qty {
        width: 160px;
        margin-top: 6px;
    }
    .compact-add {
        width: 160px;
        margin-top: 4px;
    }
    .auto-cart-submit {
        display: none;
    }
    .cart-review-footer {
        bottom: 10px;
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    .cart-review-footer .btn {
        width: 100%;
    }
    .stock-icon-card {
        grid-template-columns: 1fr;
        grid-template-areas:
            "icon"
            "summary"
            "qty"
            "action"
            "badge";
        width: min(78vw, 260px);
        min-height: 238px;
        justify-items: center;
        text-align: center;
    }
    .stock-icon-card .item-icon {
        width: 96px;
        height: 96px;
        border-radius: 22px;
    }
    .stock-icon-card .inline-qty,
    .stock-icon-card .compact-add,
    .stock-icon-card .cart-badge {
        grid-column: auto;
        justify-self: center;
    }
    .stock-icon-card .inline-qty,
    .stock-icon-card .compact-add {
        width: auto;
        margin-top: 0;
    }
    .request-item-row {
        grid-template-columns: 48px minmax(0, 1fr) auto;
        padding: 10px;
    }
    .request-qty {
        grid-template-columns: 34px 46px 34px;
    }
    .request-qty .mini-qty,
    .request-qty input {
        height: 34px;
    }
    .request-qty .mini-qty {
        width: 34px;
        font-size: 19px;
    }
    .request-qty input {
        font-size: 16px;
    }
    .order-preview-a4 {
        min-height: auto;
        padding: 18px;
    }
    .order-preview-header,
    .order-preview-footer {
        flex-direction: column;
    }
    .order-preview-meta {
        grid-template-columns: 1fr;
    }
    .alert-card {
        align-items: flex-start;
        flex-direction: column;
    }

    .order-timeline {
        grid-template-columns: 1fr;
    }
    .order-detail-card {
        padding: 10px;
    }
    .order-spreadsheet-report {
        margin-top: 8px;
        overflow: visible;
    }
    .order-spreadsheet-report .sheet {
        font-size: 11px;
    }
    .order-spreadsheet-report .sheet-header,
    .order-spreadsheet-report .sheet-header tbody,
    .order-spreadsheet-report .sheet-header tr,
    .order-spreadsheet-report .sheet-header th,
    .order-spreadsheet-report .sheet-header td {
        display: block;
        width: 100%;
    }
    .order-spreadsheet-report .sheet-header colgroup {
        display: none;
    }
    .order-spreadsheet-report .sheet-header th,
    .order-spreadsheet-report .sheet-header td {
        border-bottom: 0;
        padding: 6px 8px;
    }
    .order-spreadsheet-report .sheet-header tr {
        border: 1px solid #8ea3bd;
        border-bottom: 0;
    }
    .order-spreadsheet-report .sheet-header tr:last-child {
        border-bottom: 1px solid #8ea3bd;
    }
    .order-spreadsheet-report .sheet-title {
        border-bottom: 1px solid #8ea3bd !important;
        font-size: 14px;
    }
    .order-spreadsheet-report .sheet-items,
    .order-spreadsheet-report .sheet-items tbody,
    .order-spreadsheet-report .sheet-items tr,
    .order-spreadsheet-report .sheet-items td {
        display: block;
        width: 100%;
    }
    .order-spreadsheet-report .sheet-items colgroup,
    .order-spreadsheet-report .sheet-items tr:first-child {
        display: none;
    }
    .order-spreadsheet-report .sheet-items tr {
        background: #fff;
        border: 1px solid #bfd2ea;
        border-radius: 14px;
        margin: 8px 0;
        overflow: hidden;
    }
    .order-spreadsheet-report .sheet-items td {
        align-items: flex-start;
        border: 0;
        border-bottom: 1px solid #e3edf8;
        display: flex;
        gap: 10px;
        justify-content: space-between;
        padding: 8px 10px;
        text-align: right;
    }
    .order-spreadsheet-report .sheet-items td:last-child {
        border-bottom: 0;
    }
    .order-spreadsheet-report .sheet-items td::before {
        color: #53647d;
        content: attr(data-label);
        flex: 0 0 44%;
        font-weight: 900;
        text-align: left;
    }
    .order-spreadsheet-report .sheet-items .num {
        text-align: right;
    }
    .low-stock-row {
        grid-template-columns: 1fr;
    }
    .inline-form {
        align-items: stretch;
        flex-direction: column;
    }
    .inline-form input {
        width: 100%;
    }
}

@media print {
    @page {
        size: A4 landscape;
        margin: 4mm;
    }

    @page order-report-landscape {
        size: A4 landscape;
        margin: 4mm;
    }

    body {
        background: #fff;
        color: #0f2748;
        font-size: 12px;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .sidebar,
    .topbar,
    .no-print,
    .btn,
    form {
        display: none !important;
    }

    .app-shell {
        display: block;
    }

    .main {
        padding: 0;
    }

    body:has(.order-detail-card) {
        background: #fff !important;
    }

    body:has(.order-detail-card) .app-shell,
    body:has(.order-detail-card) .main {
        display: block !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }

    body:has(.order-detail-card) .main > :not(.order-detail-card) {
        display: none !important;
    }

    .card {
        box-shadow: none;
        border: 0;
        border-radius: 0;
        break-inside: auto;
        page-break-inside: auto;
    }

    .order-detail-card {
        border: 0;
        margin: 0 !important;
        padding: 0;
        width: 100%;
        break-inside: auto;
        page-break-inside: auto;
    }

    .order-view-heading {
        display: flex !important;
        align-items: flex-start;
        justify-content: space-between;
        margin-bottom: 4px;
    }

    .order-view-heading h2 {
        color: #06234a;
        font-size: 14px;
        margin: 0 0 2px;
    }

    .order-view-heading .muted {
        color: #3f5f86;
        font-size: 8.5px;
        margin: 0;
    }

    .print-note {
        display: block;
        margin-bottom: 12px;
        font-weight: 700;
    }

    table {
        min-width: 0;
        font-size: 7.8px;
        page-break-inside: auto;
    }

    th, td {
        padding: 2.5px 3px;
    }

    .order-spreadsheet-report {
        overflow: visible;
        margin: 0;
        page: order-report-landscape;
        width: 100%;
    }

    .order-spreadsheet-report .sheet {
        background: #fff;
        color: #0f2748;
        font-size: 7.8px;
        margin-bottom: 3px;
        table-layout: fixed;
        width: 100%;
    }

    .order-spreadsheet-report .sheet-header,
    .order-spreadsheet-report .sheet-items,
    .order-spreadsheet-report .sheet-footer {
        display: table;
    }

    .order-spreadsheet-report .sheet-header colgroup,
    .order-spreadsheet-report .sheet-items colgroup {
        display: table-column-group;
    }

    .order-spreadsheet-report .sheet-header tbody,
    .order-spreadsheet-report .sheet-items tbody,
    .order-spreadsheet-report .sheet-footer tbody {
        display: table-row-group;
    }

    .order-spreadsheet-report .sheet-header tr,
    .order-spreadsheet-report .sheet-items tr,
    .order-spreadsheet-report .sheet-footer tr {
        display: table-row;
    }

    .order-spreadsheet-report .sheet th,
    .order-spreadsheet-report .sheet td {
        border: 1px solid #8ea3bd;
        display: table-cell;
        overflow-wrap: anywhere;
        padding: 2.5px 3px;
        text-align: left;
        vertical-align: top;
        width: auto;
        word-break: normal;
        line-height: 1.16;
    }

    .order-spreadsheet-report .sheet tr {
        break-inside: auto;
        page-break-inside: auto;
    }

    .order-spreadsheet-report .sheet th {
        background: #dbe8f7 !important;
        color: #06234a !important;
        font-weight: 900;
    }

    .order-spreadsheet-report .sheet td {
        background: #fff !important;
        color: #0f2748 !important;
    }

    .order-spreadsheet-report .sheet-items tr:nth-child(even) td {
        background: #f8fbff !important;
    }

    .order-spreadsheet-report .sheet-items td::before {
        content: none;
        display: none;
    }

    .order-spreadsheet-report .sheet-items .num {
        text-align: right;
    }

    .order-spreadsheet-report .sheet-title {
        background: #173f73 !important;
        color: #fff !important;
        font-size: 11px;
        letter-spacing: 0;
        text-align: center !important;
    }

    .order-timeline {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr);
        gap: 5px;
        margin-top: 4px;
        break-inside: auto;
        page-break-inside: auto;
    }

    .timeline-step {
        background: #f8fafc !important;
        border: 1px solid #cbd5e1;
        border-radius: 7px;
        padding: 4px 5px;
    }

    .timeline-step strong {
        color: #0f2748 !important;
        display: block;
        font-size: 8.5px;
        margin-bottom: 1px;
    }

    .timeline-step span {
        color: #64748b !important;
        font-size: 7.8px;
        font-weight: 700;
    }

    .timeline-step.done {
        border-color: #86efac;
        background: #f0fdf4 !important;
    }

    .alert-card.warn.no-print,
    .order-receipt-form {
        display: none !important;
    }

    .order-preview-a4 {
        width: 100%;
        min-height: auto;
        margin: 0;
        padding: 0;
        border: 0;
        box-shadow: none;
        page-break-inside: avoid;
    }

    .order-preview-header {
        border-bottom-color: #333;
    }

    .order-preview-table th {
        background: #e6e6e6 !important;
        color: #000;
    }

    .order-preview-footer {
        background: #f2f2f2 !important;
        border-color: #999;
    }
}
