:root {
  --bg: #f7f3ed;
  --surface: #fffefa;
  --surface-soft: #f4f0ea;
  --surface-strong: #2f2b27;
  --line: #e4ddd3;
  --line-strong: #d7cfc4;
  --yellow: #ffc800;
  --yellow-deep: #d9a900;
  --green: #159d73;
  --green-soft: #e8f6f1;
  --red: #e72d3f;
  --red-soft: #fdebed;
  --orange: #e89e00;
  --orange-soft: #fff5d9;
  --blue: #3977d9;
  --text: #211f1c;
  --muted: #77716a;
  --shadow: 0 1px 2px rgba(31, 27, 22, .035);
  --radius: 14px;
  --radius-sm: 10px;
  --font: Inter, "Noto Sans Arabic", "Segoe UI", Arial, Tahoma, sans-serif;
  color-scheme: light;
  font-family: var(--font);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); scroll-behavior: smooth; }
body { margin: 0; min-height: 100%; overflow-x: hidden; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; }
button, input, select, textarea { font: inherit; }
button { appearance: none; border: 0; border-radius: var(--radius-sm); min-height: 40px; padding: 9px 14px; background: var(--yellow); color: #17140f; font-weight: 800; cursor: pointer; transition: transform .12s ease, filter .12s ease, background .12s ease; }
button:active { transform: scale(.98); }
button:disabled { cursor: not-allowed; opacity: .48; transform: none; }
button.secondary { background: var(--surface); color: var(--text); border: 1px solid var(--line); }
button.ok { background: var(--green); color: #fff; }
button.danger { background: var(--red); color: #fff; }
button:hover { filter: brightness(.98); }
input, select, textarea { width: 100%; min-width: 0; min-height: 40px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; outline: none; background: var(--surface-soft); color: var(--text); transition: border-color .14s ease, box-shadow .14s ease; }
input:focus, select:focus, textarea:focus { border-color: var(--yellow-deep); box-shadow: 0 0 0 3px rgba(255, 200, 0, .16); }
textarea { min-height: 96px; resize: vertical; line-height: 1.55; }
label { display: grid; gap: 6px; min-width: 0; color: var(--muted); font-size: 11px; font-weight: 600; }
h1, h2, h3, p { overflow-wrap: anywhere; }
.hidden, [hidden] { display: none !important; }
body.logged-out #app, body.logged-out .mobile-bottom-nav, body.logged-out .drawer-backdrop { display: none !important; }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 22px; background: var(--bg); }
.login-box { width: min(390px, 100%); display: grid; gap: 12px; padding: 24px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: 0 12px 36px rgba(42, 36, 30, .08); }
.login-box img { width: 210px; max-width: 100%; margin: 0 auto 10px; display: block; }
.login-box h1 { margin: 0 0 4px; text-align: center; font-size: 21px; }

.shell { width: min(1180px, 100%); min-height: 100vh; margin: 0 auto; padding-bottom: 100px; }
.main { min-width: 0; padding: 0 16px 24px; }
.section { display: none; }
.section.active { display: grid; gap: 12px; animation: reveal .18s ease-out; }
@keyframes reveal { from { opacity: .35; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.topbar { position: relative; z-index: 24; min-height: 78px; margin: 0 -16px 16px; padding: max(14px, env(safe-area-inset-top)) 16px 12px; display: flex; align-items: center; justify-content: center; background: rgba(247, 243, 237, .96); border-bottom: 1px solid var(--line); }
.topbar-title { width: 100%; display: flex; align-items: center; justify-content: center; text-align: center; }
.topbar-heading { min-width: 0; }
.topbar h1 { margin: 0; color: var(--text); font-size: clamp(19px, 3vw, 23px); line-height: 1.08; font-weight: 900; text-align: center; }
.overview-topbar-logo { width: min(210px, 52vw); max-height: 48px; display: block; object-fit: contain; }
.topbar-notification-button { position: absolute; inset-inline-start: 16px; bottom: 12px; width: 38px; min-width: 38px; height: 38px; min-height: 38px; padding: 0; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--text); box-shadow: none; }
.topbar-notification-button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.topbar-notification-button span { position: absolute; inset-inline-end: -3px; top: -4px; min-width: 18px; height: 18px; padding: 0 4px; display: grid; place-items: center; border: 2px solid var(--bg); border-radius: 999px; background: var(--red); color: #fff; font-size: 8px; font-weight: 900; line-height: 1; }
.admin-notification-panel { position: absolute; z-index: 70; inset-inline-start: 16px; top: calc(100% - 4px); width: min(360px, calc(100vw - 24px)); max-height: min(520px, calc(100dvh - 108px)); overflow: auto; padding: 9px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); box-shadow: 0 20px 54px rgba(31, 27, 23, .2); }
.admin-notification-panel[hidden] { display: none; }
.admin-notification-head { padding: 2px 3px 8px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.admin-notification-head b { font-size: 13px; }
.admin-notification-head button { width: 26px; min-width: 26px; height: 26px; min-height: 26px; padding: 0; border-radius: 50%; background: var(--surface-soft); color: var(--text); font-size: 18px; }
.admin-notification-list { display: grid; gap: 7px; }
.admin-notification-item { width: 100%; min-height: 0; padding: 9px 10px; display: grid; grid-template-columns: 28px minmax(0, 1fr); align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); color: var(--text); text-align: start; touch-action: pan-y; user-select: none; will-change: transform, opacity; }
.admin-notification-item.swiping { transition: none; }
.admin-notification-item.danger { border-color: rgba(231,45,63,.2); background: rgba(231,45,63,.075); }
.admin-notification-item.danger .admin-notification-copy b { color: #4a3d3f; }
.admin-notification-item.danger .admin-notification-copy small { color: #6d5b5e; }
.admin-notification-item .notification-icon { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; background: #fff; color: var(--yellow-deep); font-size: 15px; box-shadow: inset 0 0 0 1px rgba(217,169,0,.16); }
.admin-notification-item.danger .notification-icon { background: rgba(255,255,255,.88); color: var(--red); box-shadow: inset 0 0 0 1px rgba(231,45,63,.14); }
.admin-notification-item.warning .notification-icon { background: #fff; color: var(--yellow-deep); }
.admin-notification-copy { min-width: 0; display: grid; gap: 2px; }
.admin-notification-copy b { font-size: 11px; line-height: 1.35; }
.admin-notification-copy small { overflow: hidden; color: var(--muted); font-size: 9px; line-height: 1.45; white-space: nowrap; text-overflow: ellipsis; }
.admin-notification-empty { padding: 18px 10px; color: var(--muted); text-align: center; font-size: 10px; }

.card { min-width: 0; padding: 13px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.card h2, .card h3 { margin: 0 0 10px; color: var(--text); font-size: 14px; font-weight: 900; }
.grid { display: grid; gap: 10px; }
.cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.metric { min-height: 88px; display: grid; align-content: center; gap: 5px; text-align: end; }
.metric span { color: var(--muted); font-size: 11px; }
.metric b { color: var(--text); font-size: clamp(21px, 4vw, 28px); line-height: 1; font-weight: 900; direction: ltr; }
.metric:nth-child(7) b { color: var(--red); }
.metric-link { width: 100%; color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); text-align: end; }
.metric-link:hover { border-color: var(--yellow-deep); background: #fffdf5; }
.two-charts, .mini-grid, .performance-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.performance-grid { display: grid; gap: 12px; margin-top: 12px; }
.toolbar { display: flex; align-items: end; gap: 8px; flex-wrap: wrap; margin: 0 0 10px; }
.toolbar > * { flex: 1 1 150px; min-width: 0; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.message-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.section-note, .pill { margin: 0; padding: 8px 10px; border-radius: 9px; background: var(--surface-soft); color: var(--muted); font-size: 11px; line-height: 1.45; }
.pill { display: inline-flex; align-items: center; width: fit-content; }
.money { color: var(--text); font-weight: 900; direction: ltr; }
span.money, b.money { display: inline-block; }
td.money { display: table-cell; }
.muted { color: var(--muted); }
.msg { min-height: 0; color: var(--green); font-size: 12px; font-weight: 800; }

.table-wrap { width: 100%; overflow: auto; border: 0; border-radius: 0; overscroll-behavior-inline: contain; scrollbar-width: thin; }
table { width: max-content; min-width: 100%; border-collapse: collapse; table-layout: auto; background: transparent; }
th, td { height: 38px; padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: start; vertical-align: middle; font-size: 11px; white-space: nowrap; }
th { color: var(--muted); font-weight: 700; }
td { color: var(--text); }
tr:last-child td { border-bottom: 0; }
td input, td select { min-width: 86px; min-height: 34px; padding: 6px 8px; }
td textarea { min-width: 170px; }
.table-wrap button, td button { min-height: 32px; padding: 5px 8px; font-size: 10px; }
.row-actions, .order-buttons { display: flex; gap: 5px; align-items: center; flex-wrap: nowrap; }
.status-pill { display: inline-flex; align-items: center; justify-content: center; min-width: 56px; padding: 4px 8px; border-radius: 7px; color: var(--green); background: var(--green-soft); font-size: 10px; font-weight: 800; }
.status-pill.danger, .status-pill.failed { color: var(--red); background: var(--red-soft); }
.orders-quick-filter { padding: 9px 11px; display: flex; align-items: center; justify-content: space-between; gap: 8px; border: 1px solid #eed17a; border-radius: 11px; background: #fff7d9; color: #6d5200; font-size: 11px; font-weight: 800; }
.orders-quick-filter button { min-height: 30px; padding: 4px 9px; background: var(--surface); border: 1px solid #eed17a; font-size: 10px; }

.side { position: fixed; z-index: 60; top: 0; right: 0; width: min(86vw, 330px); height: 100dvh; padding: max(18px, env(safe-area-inset-top)) 16px 24px; overflow-y: auto; display: grid; grid-template-rows: auto auto 1fr auto auto; gap: 14px; background: var(--surface-strong); color: #fff; transform: translateX(105%); transition: transform .22s ease; box-shadow: -12px 0 36px rgba(0, 0, 0, .2); }
[dir="ltr"] .side { right: auto; left: 0; transform: translateX(-105%); box-shadow: 12px 0 36px rgba(0, 0, 0, .2); }
.side.open, [dir="ltr"] .side.open { transform: translateX(0); }
.drawer-backdrop { display: none; position: fixed; z-index: 55; inset: 0; background: rgba(20, 17, 14, .42); backdrop-filter: blur(2px); }
.drawer-backdrop.open { display: block; }
body.drawer-open { overflow: hidden; }
.drawer-close-button { justify-self: start; width: 38px; min-width: 38px; height: 38px; min-height: 38px; padding: 0; border-radius: 50% !important; background: rgba(255,255,255,.08) !important; border-color: rgba(255,255,255,.14) !important; color: #fff !important; font-size: 22px; }
.brand { display: grid; justify-items: center; gap: 7px; padding: 6px 0 14px; border-bottom: 1px solid rgba(255,255,255,.11); }
.brand img { width: 155px; max-width: 70%; filter: brightness(0) invert(1); }
.brand strong { font-size: 13px; color: #fff; }
.nav { display: grid; align-content: start; gap: 5px; }
.nav button { min-height: 42px; width: 100%; display: flex; align-items: center; text-align: start; padding: 9px 11px; border: 1px solid transparent; background: transparent; color: #e3dfda; font-size: 13px; }
.nav button.active { background: var(--yellow); color: #17140f; }
.side-actions { display: grid; gap: 7px; align-content: end; }
.side-actions button { width: 100%; min-height: 40px; white-space: nowrap; }
.side-actions .secondary { background: rgba(255,255,255,.06); color: #fff; border-color: rgba(255,255,255,.14); }
.side .msg { color: #fff; }

.mobile-bottom-nav { position: fixed; z-index: 42; left: 50%; bottom: max(8px, env(safe-area-inset-bottom)); width: min(calc(100% - 28px), 540px); height: 68px; padding: 7px 9px; display: grid; grid-template-columns: repeat(5, 1fr); gap: 3px; transform: translateX(-50%); border-radius: 22px; background: #36322e; box-shadow: 0 12px 32px rgba(25, 22, 19, .2); }
.mobile-bottom-nav button { min-width: 0; min-height: 54px; padding: 5px 2px; display: grid; place-items: center; align-content: center; gap: 2px; border-radius: 12px; background: transparent; color: #99938c; }
.mobile-bottom-nav button.active { color: var(--yellow); }
.mobile-bottom-nav svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.mobile-bottom-nav span { max-width: 100%; font-size: 9px; line-height: 1.05; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.branch-status-grid, .publish-grid, .insight-grid, .performance-risk-grid { display: grid; gap: 8px; }
.branch-status-card, .publish-card, .insight-card, .performance-risk { padding: 10px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); }
.insight-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.insight-card { min-width: 0; display: grid; align-content: start; gap: 5px; }
.insight-card-wide { grid-column: 1 / -1; }
.insight-label { color: var(--muted); font-size: 9px; font-weight: 700; }
.insight-card > b { font-size: 15px; line-height: 1.25; direction: ltr; text-align: start; }
.insight-card > b.insight-name { direction: inherit; font-size: 12px; overflow-wrap: anywhere; }
.insight-card > small { color: var(--muted); font-size: 9px; line-height: 1.55; }
.insight-ranking { display: grid; }
.insight-ranking > span { min-width: 0; padding: 6px 0; display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; align-items: center; gap: 7px; border-bottom: 1px solid var(--line); font-size: 10px; }
.insight-ranking > span:last-child { border-bottom: 0; }
.insight-ranking em { width: 19px; height: 19px; display: grid; place-items: center; border-radius: 50%; background: var(--yellow); color: #27231e; font-style: normal; font-weight: 900; }
.insight-ranking span > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.insight-ranking b { direction: ltr; }
.insight-ranking .empty { display: block; color: var(--muted); }
.branch-status-card { display: flex; align-items: center; justify-content: space-between; gap: 9px; }
.connected, .profit { color: var(--green); font-weight: 800; }
.daily-cost { color: var(--green); font-weight: 800; direction: ltr; }
.analytics-card, .performance-card { display: grid; gap: 10px; }
.analytics-head { display: grid; grid-template-columns: minmax(0, 1.06fr) minmax(0, 1.1fr) minmax(0, .84fr); align-items: end; gap: 8px; }
.performance-head { display: flex; align-items: start; justify-content: space-between; gap: 10px; }
.analytics-title h2, .performance-head h2 { margin-bottom: 2px; }
.analytics-title p, .performance-head p { margin: 0; color: var(--muted); font-size: 11px; }
.custom-range { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.custom-range[hidden] { display: none; }
.analytics-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.analytics-summary > div { padding: 9px; display: grid; gap: 3px; border-radius: 9px; background: var(--surface-soft); }
.analytics-summary span { color: var(--muted); font-size: 9px; }
.analytics-summary b { font-size: 12px; direction: ltr; }
.performance-card { padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); }
.performance-card.good { border-color: rgba(21,157,115,.23); }
.performance-card.warn { border-color: rgba(232,158,0,.24); }
.performance-card.bad { border-color: rgba(231,45,63,.22); background: rgba(231,45,63,.045); }
.performance-branch-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.performance-branch-head h3 { margin: 0; font-size: 14px; }
.performance-score { padding: 4px 7px; border-radius: 7px; background: var(--surface); font-size: 10px; }
.performance-stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.performance-stat-grid > div { min-width: 0; padding: 8px; display: grid; gap: 3px; border-radius: 8px; background: var(--surface); }
.performance-stat-grid small { color: var(--muted); font-size: 9px; }
.performance-stat-grid b { font-size: 11px; overflow-wrap: anywhere; }
.performance-progress-row { display: grid; gap: 5px; }
.performance-progress-row > div { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 9px; }
.performance-note { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.sales-chart-horizontal, .bar-list { display: grid; gap: 10px; }
.sales-bar-row, .bar-row { display: grid; grid-template-columns: minmax(70px, auto) 1fr auto; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; }
.sales-bar-track, .bar-track { height: 11px; overflow: hidden; border-radius: 999px; background: var(--surface-soft); }
.sales-bar-fill, .bar-fill { height: 100%; min-width: 4px; background: var(--yellow); }
.sales-bar-row:nth-child(even) .sales-bar-fill { background: var(--yellow); }
.sales-bar-value { color: var(--text); font-weight: 800; direction: ltr; }

.menu-section-list, .inventory-category-list, .cost-accordion { display: grid; gap: 12px; }
.performance-grid + .performance-risk-grid { margin-top: 12px; }
.menu-category-card, .inventory-category-card, .cost-group { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.menu-category-header, .inventory-category-head, .cost-group-head { min-height: 44px; padding: 9px 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--surface-soft); color: var(--text); }
.menu-category-header { background: var(--yellow); }
.menu-category-header h3, .inventory-category-head h3 { margin: 0; font-size: 14px; }
.menu-category-table, .inventory-count-table, .cost-table, .purchase-batch-table, .barcode-product-admin-table { width: max-content; min-width: 100%; }
.inventory-material-button, .barcode-material-button, .customer-name-button { min-height: 0; padding: 0; background: transparent; color: var(--green); text-align: start; }

.inventory-materials-shell { padding: 0; overflow: hidden; }
.compact-page-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; }
.compact-page-head > div { flex: 1; min-width: 0; }
.compact-page-head h2 { margin: 0 0 4px; font-size: 15px; }
.compact-page-head p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.compact-page-head > label { flex: 0 1 170px; }
.inventory-materials-head { display: flex; align-items: end; gap: 9px; padding: 12px; border-bottom: 1px solid var(--line); }
.inventory-materials-head > * { flex: 1; min-width: 0; }
.inventory-tool-list { display: grid; gap: 8px; }
.inventory-tool-details { overflow: hidden; padding: 0; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); }
.inventory-tool-summary, .inventory-tool-launch { width: 100%; min-height: 48px; padding: 8px 10px; display: grid; grid-template-columns: 25px minmax(0, 1fr) 18px; align-items: center; gap: 9px; color: var(--text); background: var(--surface); font-weight: 800; text-align: start; }
.inventory-count-launch { width: calc(100% - 24px); margin-inline: 12px; padding-inline-start: 9px; grid-template-columns: 25px minmax(0, 1fr) 18px; gap: 9px; border: 1px solid var(--line); }
.inventory-count-launch .inventory-tool-copy { transform: translateX(-6px); }
.inventory-tool-summary { list-style: none; cursor: pointer; }
.inventory-tool-summary::-webkit-details-marker { display: none; }
.inventory-tool-copy { min-width: 0; display: grid; gap: 1px; }
.inventory-tool-summary b, .inventory-tool-launch b { display: block; font-size: 12px; line-height: 1.25; }
.inventory-tool-summary small, .inventory-tool-launch small { display: block; overflow: hidden; color: var(--muted); font-size: 9px; font-weight: 500; line-height: 1.35; white-space: nowrap; text-overflow: ellipsis; }
.inventory-tool-icon { width: 25px; min-width: 25px; height: 25px; display: grid; place-items: center; color: var(--yellow-deep); }
.cost-icon { width: 29px; min-width: 29px; height: 29px; display: grid; place-items: center; border-radius: 8px; background: var(--surface-soft); color: var(--yellow-deep); }
.inventory-tool-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.85; stroke-linecap: round; stroke-linejoin: round; }
.cost-icon svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.section-chevron { width: 18px; height: 18px; display: grid; place-items: center; color: var(--muted); transition: transform .16s ease; }
.inventory-tool-icon, .section-chevron { justify-self: center; align-self: center; }
.section-chevron svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.inventory-tool-details[open] > .inventory-tool-summary .section-chevron { transform: rotate(180deg); }
.inventory-tool-body, .cost-group-body { padding: 12px; border-top: 1px solid var(--line); }
.inventory-transfer-grid, .inventory-create-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }

.barcode-launch-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 9px 12px; }
.barcode-launch-card > div:first-child { min-width: 0; }
.barcode-launch-card p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.barcode-draft-summary { grid-column: 1 / -1; min-width: 0; padding: 7px 9px; border-radius: 8px; background: var(--green-soft); color: var(--green); font-size: 10px; line-height: 1.45; white-space: normal; overflow-wrap: break-word; }
.barcode-launch-button, button.ok.barcode-launch-button { flex: 0 0 auto; min-width: 128px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; background: var(--yellow); color: var(--text); }
.barcode-launch-button svg { width: 19px; min-width: 19px; height: 19px; fill: currentColor; }
.purchase-batch-save { width: 100%; }
.barcode-products-note { color: var(--muted); font-size: 11px; }
.barcode-product-admin-toggle { width: 100%; display: flex; align-items: center; justify-content: space-between; }
.barcode-product-admin-card { display: grid; gap: 10px; }
.barcode-product-admin-groups { display: grid; gap: 10px; }
.barcode-admin-category { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.barcode-admin-category > h3 { margin: 0; padding: 10px 12px; background: var(--yellow); font-size: 13px; }
.barcode-admin-material-list { display: grid; gap: 0; }
.barcode-admin-material { border-top: 1px solid var(--line); }
.barcode-admin-material:first-child { border-top: 0; }
.barcode-admin-material > summary { min-height: 42px; padding: 8px 11px; display: flex; align-items: center; justify-content: space-between; gap: 9px; list-style: none; cursor: pointer; font-weight: 800; }
.barcode-admin-material > summary::-webkit-details-marker { display: none; }
.barcode-admin-material > summary small { color: var(--muted); font-size: 9px; }
.barcode-admin-material[open] > summary { background: var(--surface-soft); }
.barcode-admin-product-list { padding: 8px; display: grid; gap: 8px; border-top: 1px solid var(--line); }
.barcode-admin-product { padding: 10px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-soft); }
.barcode-admin-field { min-width: 0; display: grid; gap: 4px; }
.barcode-admin-inline { min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.barcode-admin-inline b { overflow-wrap: anywhere; }
.barcode-admin-field > small { color: var(--muted); font-size: 9px; font-weight: 700; }
.barcode-admin-field > b, .barcode-admin-field > span { min-width: 0; font-size: 11px; overflow-wrap: anywhere; }
.barcode-admin-field.barcode-admin-material-field, .barcode-admin-field.barcode-admin-actions { grid-column: 1 / -1; }
.barcode-admin-field input, .barcode-admin-field select { min-height: 38px; }
.barcode-admin-actions .row-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.barcode-admin-actions .row-actions > :only-child { grid-column: 1 / -1; }

.purchase-review-card h2, .recent-purchases-card h2 { font-size: 14px; }
.barcode-products-note { display: block; margin-top: 3px; }

.menu-figma-toolbar { display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 7px; direction: ltr; }
.menu-figma-toolbar button { direction: rtl; }
.menu-save-button, .menu-toolbar-button { min-height: 31px; padding: 5px 14px; border-radius: 9px; background: var(--yellow); color: var(--text); font-size: 10px; }
.menu-toolbar-button.secondary { background: var(--surface); color: var(--text); border: 1px solid var(--line); }
.menu-section-editor { display: grid; gap: 9px; }
.menu-section-editor[hidden] { display: none; }
.menu-section-editor-head, .menu-section-editor-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.menu-section-editor-head h2 { margin: 0; font-size: 13px; }
.menu-section-editor-rows { display: grid; gap: 7px; }
.menu-section-editor-row { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.menu-section-editor-row input { min-width: 0; }
.menu-category-header { min-height: 43px; }
.menu-category-meta { display: flex; align-items: center; gap: 7px; color: var(--text); font-size: 10px; font-weight: 800; }
.menu-category-meta button { width: 25px; min-width: 25px; height: 25px; min-height: 25px; padding: 0; border: 1px solid rgba(33,31,28,.14); border-radius: 7px; background: rgba(255,255,255,.55); font-size: 17px; }
.menu-category-table { width: 100%; min-width: 0; table-layout: fixed; }
.menu-figma-item td { height: 43px; padding: 6px 7px; }
.menu-figma-item.is-hidden { opacity: .58; }
.menu-figma-name { width: auto; }
.menu-figma-name input:not([type="hidden"]), .menu-figma-price input { min-width: 0; min-height: 28px; padding: 2px 4px; border: 0; border-radius: 5px; background: transparent; box-shadow: none; font-size: 11px; font-weight: 700; }
.menu-figma-name input:not([type="hidden"]):focus, .menu-figma-price input:focus { background: var(--surface-soft); }
.menu-figma-price { width: 70px; }
.menu-price-inner { display: flex; align-items: center; gap: 2px; direction: ltr; }
.menu-figma-price input { width: 42px; text-align: end; }
.menu-figma-price span { font-size: 9px; font-weight: 800; }
.menu-figma-color { width: 27px; }
.menu-color-inner { display: flex; align-items: center; justify-content: center; }
.menu-figma-color input[type="color"] { width: 15px !important; min-width: 15px !important; height: 15px; min-height: 15px; padding: 0; overflow: hidden; border: 0; border-radius: 50%; background: transparent; }
.menu-figma-color input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.menu-figma-color input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 50%; }
.menu-figma-controls { width: 91px; }
.menu-controls-inner { display: flex; align-items: center; justify-content: flex-end; gap: 4px; direction: ltr; }
.menu-figma-controls button { width: 25px; min-width: 25px; height: 25px; min-height: 25px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-soft); color: var(--muted); }
.menu-figma-controls button:disabled { opacity: .35; }
.menu-eye-button.active { background: var(--yellow); color: var(--text); border-color: var(--yellow); }
.menu-eye-button svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.menu-order-button svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.customer-figma-actions { display: grid; grid-template-columns: auto auto minmax(0, 1fr); gap: 7px; align-items: center; }
.customer-figma-actions button { min-height: 36px; padding: 7px 10px; font-size: 10px; }
.customer-selection-toolbar { display: flex; justify-content: center; flex-wrap: wrap; gap: 7px; }
.customer-selection-toolbar[hidden] { display: none; }
.customer-selection-toolbar button { min-width: 132px; min-height: 34px; }
.customer-search-field input { min-height: 36px; padding-inline-start: 34px; background: var(--surface); }
.customer-search-field { position: relative; }
.customer-search-field::before { content: "⌕"; position: absolute; z-index: 2; inset-inline-start: 11px; bottom: 7px; color: var(--muted); font-size: 20px; line-height: 1; }
.customer-filter-card { padding: 8px; }
.figma-customer-filter-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.figma-customer-filter-grid label { display: block; font-size: 0; }
.figma-customer-filter-grid select { min-height: 34px; padding: 6px 9px; background: var(--surface-soft); font-size: 10px; }
.customer-figma-list { display: grid; gap: 10px; }
.customer-figma-card { position: relative; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); cursor: pointer; }
.customer-figma-card.selected { border-color: var(--yellow-deep); box-shadow: 0 0 0 2px rgba(255,200,0,.14); }
.customer-figma-head, .customer-figma-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.customer-name-with-selector { min-width: 0; display: flex; align-items: center; gap: 8px; }
.customer-selection-circle { width: 20px; min-width: 20px; height: 20px; min-height: 20px; padding: 0; border: 2px solid #b9b3aa; border-radius: 50%; background: transparent; box-shadow: none; }
.customer-selection-circle.selected { border-color: var(--yellow-deep); background: var(--yellow); box-shadow: inset 0 0 0 4px var(--surface); }
.customer-figma-head > span { color: var(--muted); font-size: 10px; }
.customer-name-button { color: var(--text); font-size: 13px; font-weight: 900; }
.customer-figma-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin: 10px 0 8px; }
.customer-figma-stats > div { padding: 7px 5px; border-radius: 8px; background: var(--surface-soft); text-align: center; }
.customer-figma-stats small { display: block; color: var(--muted); font-size: 8px; }
.customer-figma-stats b { display: block; margin-top: 2px; font-size: 11px; direction: ltr; }
.customer-figma-stats .has-debt { background: var(--red-soft); }
.customer-figma-stats .has-debt b { color: var(--red); }
.customer-figma-foot { color: var(--muted); font-size: 9px; }
.customer-card-selector { position: absolute; top: 9px; inset-inline-end: 9px; width: 18px; min-width: 18px; height: 18px; min-height: 18px; opacity: 0; pointer-events: none; }
.customer-detail-heading { min-width: 0; display: grid; gap: 2px; }
.customer-detail-heading strong { font-size: 15px; overflow-wrap: anywhere; }
.customer-detail-heading small { color: var(--muted); font-size: 10px; direction: ltr; }
.customer-detail-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.customer-detail-summary > div { min-width: 0; padding: 10px 8px; display: grid; gap: 4px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); }
.customer-detail-summary > div:nth-child(2n) { background: var(--surface-soft); }
.customer-detail-summary span { color: var(--muted); font-size: 9px; }
.customer-detail-summary b { font-size: 12px; overflow-wrap: anywhere; }
.customer-detail-summary .has-debt { background: var(--red-soft); }
.customer-detail-summary .has-debt b { color: var(--red); }
.customer-orders-history > h3 { margin: 0 0 9px; font-size: 14px; }
.customer-summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.customer-summary-card { min-width: 0; padding: 10px 8px; display: grid; gap: 4px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); }
.customer-summary-card:nth-child(2n) { background: var(--surface-soft); }
.customer-summary-card span { color: var(--muted); font-size: 9px; }
.customer-summary-card b { font-size: 12px; overflow-wrap: anywhere; }
.customer-receipt-list { display: grid; gap: 10px; }
.customer-receipt { padding: 12px; display: grid; gap: 9px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: #111; }
.customer-receipt-head, .customer-receipt-meta, .customer-receipt-line, .customer-receipt-total-row { display: flex; align-items: start; justify-content: space-between; gap: 10px; }
.customer-receipt-head { padding-bottom: 8px; border-bottom: 1px dashed #cfcac3; }
.customer-receipt-meta { flex-wrap: wrap; color: #625d57; font-size: 9px; }
.customer-receipt-lines { display: grid; gap: 7px; }
.customer-receipt-line { font-size: 11px; }
.customer-receipt-line > div { min-width: 0; display: grid; gap: 2px; }
.customer-receipt-line small { color: #6f6962; font-size: 9px; }
.customer-receipt-line > b { flex: 0 0 auto; direction: ltr; }
.customer-receipt-totals { padding-top: 8px; display: grid; gap: 5px; border-top: 1px dashed #cfcac3; }
.customer-receipt-total-row { font-size: 10px; }
.customer-receipt-total-row.grand { font-size: 12px; font-weight: 900; }

.complaints-figma-list { display: grid; gap: 10px; }
.complaint-figma-card { padding: 13px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.complaint-figma-head, .complaint-figma-meta, .complaint-figma-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.complaint-figma-head h3 { margin: 0; font-size: 13px; }
.complaint-status { min-height: 23px; padding: 3px 9px; border-radius: 7px; font-size: 9px; }
.complaint-status.processing { color: #6e4b00; background: var(--yellow); }
.complaint-status.reviewed { color: var(--green); background: var(--green-soft); }
.complaint-figma-meta { justify-content: flex-start; margin-top: 7px; color: var(--muted); font-size: 9px; }
.complaint-figma-meta b { font-weight: 500; }
.complaint-figma-card p { margin: 8px 0; font-size: 11px; line-height: 1.55; }
.complaint-figma-foot { color: var(--muted); font-size: 9px; }

#settings.section.active { gap: 12px; }
.settings-figma-card h2 { text-align: end; }
.settings-hours-grid { grid-template-columns: 1fr 1fr; }
.settings-delivery-grid { grid-template-columns: 1fr 1fr; }
.settings-radius-field { grid-column: 1 / -1; }
.settings-message-grid { grid-template-columns: 1fr; }
.settings-message-grid textarea { min-height: 58px; }
.settings-save-button { width: 100%; background: var(--yellow); color: var(--text); }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }

.cost-group-head { width: 100%; border: 0; border-radius: 0; text-align: start; }
.costs-intro { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--surface-strong); color: #fff; }
.costs-intro h2 { color: #fff; }
.costs-intro p { margin: 0; color: #aaa39b; font-size: 10px; line-height: 1.45; }
.costs-intro > div:last-child { flex: 0 0 auto; text-align: end; }
.costs-intro > div:last-child small { display: block; color: #aaa39b; font-size: 9px; }
.costs-intro > div:last-child b { display: block; margin-top: 3px; color: var(--yellow); font-size: 24px; direction: ltr; }
.cost-group-title { flex: 1; display: grid; gap: 2px; }
.cost-group-title b { font-size: 14px; }
.cost-group-title small { color: var(--muted); font-size: 10px; font-weight: 500; }
.cost-chevron { flex: 0 0 18px; }
.cost-group:not(.open) .cost-group-body { display: none; }
.cost-group.open .cost-chevron { transform: rotate(180deg); }
.cost-section-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 9px; }
.cost-section-toolbar p { margin: 0; color: var(--muted); font-size: 10px; }
.cost-empty { padding: 15px; color: var(--muted); text-align: center; }

.detail-modal, .recipe-modal, .inventory-count-modal, .barcode-missing-modal, .material-price-modal { position: fixed; z-index: 80; inset: 0; display: none; align-items: center; justify-content: center; padding: 14px; background: rgba(26, 22, 18, .52); backdrop-filter: blur(3px); }
.barcode-scanner-modal { position: fixed; z-index: 100; inset: 0; display: none; padding: 0; background: #0b0b0b; }
.detail-modal.open, .recipe-modal.open, .inventory-count-modal.open, .barcode-scanner-modal.open, .barcode-missing-modal.open, .material-price-modal.open { display: flex; }
.detail-panel, .recipe-panel, .inventory-count-panel, .barcode-missing-panel, .material-price-panel { width: min(920px, 100%); max-height: calc(100dvh - 28px); overflow: auto; border: 1px solid var(--line); border-radius: 18px; background: var(--bg); box-shadow: 0 28px 80px rgba(0,0,0,.24); }
.barcode-scanner-panel { width: 100%; height: 100dvh; max-height: none; overflow: hidden; border: 0; border-radius: 0; background: var(--bg); box-shadow: none; }
.detail-header, .recipe-header, .inventory-count-header, .barcode-scanner-header { position: sticky; z-index: 4; top: 0; padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--line); background: rgba(247, 243, 237, .97); }
.detail-header h2, .recipe-header h2, .inventory-count-header h2, .barcode-scanner-header h2 { margin: 0; font-size: 17px; }
.detail-header p, .inventory-count-header p, .barcode-scanner-header small { margin: 3px 0 0; color: var(--muted); font-size: 10px; }
.detail-body, .recipe-body, .inventory-count-body, .material-price-content { padding: 14px; }
.notification-detail-panel { display: flex; flex-direction: column; }
.notification-detail-body { display: grid; gap: 9px; overflow: auto; }
.notification-detail-card { padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.notification-detail-card h3 { margin: 0 0 8px; font-size: 13px; }
.notification-detail-card > div { padding: 7px 0; display: flex; align-items: start; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); }
.notification-detail-card span { color: var(--muted); font-size: 10px; }
.notification-detail-card b { max-width: 64%; font-size: 11px; text-align: end; overflow-wrap: anywhere; }
.notification-detail-footer { padding: 10px 14px max(10px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--surface); }
.notification-detail-footer button { width: 100%; }
.complaint-message-full { white-space: pre-wrap; line-height: 1.7; }
.complaint-message-preview { display: inline; }
.complaint-show-button { min-height: 0; padding: 0 4px; background: transparent; color: var(--yellow-deep); }
.recipe-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; padding-top: 13px; }
.recipe-card { min-width: 0; padding: 13px; display: grid; gap: 7px; border: 1px solid var(--line); border-radius: 16px; background: #fbfaf7; color: var(--text); text-align: start; }
.recipe-card:hover { border-color: var(--yellow-deep); background: #fffcf1; }
.recipe-card b { overflow: hidden; font-size: 12px; white-space: nowrap; text-overflow: ellipsis; }
.recipe-card small { color: var(--muted); font-size: 10px; }
.recipe-card small b { color: var(--ink); font-size: inherit; }
.recipe-card .recipe-cost { color: var(--green); font-weight: 900; }
.recipe-card .recipe-profit { display: flex; align-items: center; justify-content: flex-start; gap: 5px; color: var(--muted); font-size: 10px; }
.recipe-card .recipe-profit b { color: var(--muted); font-size: inherit; }
.recipe-panel { width: min(900px, 100%); }
.recipe-header { padding: 16px 18px; background: rgba(255,255,255,.95); backdrop-filter: blur(12px); }
.recipe-header h2 { font-size: 20px; }
.recipe-body { padding: 16px 18px; }
.recipe-profile-tabs { display: flex; gap: 7px; overflow: auto; padding-bottom: 10px; }
.recipe-profile-tabs button { flex: 0 0 auto; background: #f2efe9; color: var(--muted); }
.recipe-profile-tabs button.active { background: var(--yellow); color: #111; }
.recipe-row { display: grid; grid-template-columns: 36px minmax(220px, 1fr) 130px 110px 54px; gap: 8px; align-items: end; padding: 10px 0; border-bottom: 1px solid #f0ede7; }
.recipe-row-number { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 10px; background: #fff4bd; font-weight: 900; }
.recipe-row label { gap: 4px; }
.recipe-row label > span:first-child { font-size: 9px; }
.recipe-inherited-section { display: grid; gap: 7px; margin-bottom: 12px; padding: 10px; border: 1px solid #e9dfb8; border-radius: 14px; background: #fffcf2; }
.recipe-inherited-title { display: grid; gap: 3px; margin-bottom: 2px; }
.recipe-inherited-title small { color: var(--muted); font-size: 10px; }
.recipe-row-inherited { grid-template-columns: 36px minmax(220px, 1fr) 130px 110px 70px; padding: 8px 0; }
.recipe-row-inherited > div { display: grid; gap: 4px; min-width: 0; }
.recipe-row-inherited > div > span { color: var(--muted); font-size: 9px; }
.recipe-row-inherited > div > b { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.recipe-inherited-badge { align-self: center; justify-self: end; padding: 5px 8px; border-radius: 999px; background: #fff0a3; color: #514400; font-size: 10px; font-weight: 900; }
.recipe-addon-title { margin: 4px 0 8px; color: var(--ink); font-size: 12px; font-weight: 900; }
.recipe-delete-button { align-self: end; min-height: 40px; }
.recipe-total { margin-top: 14px; padding: 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border-radius: 16px; background: #f6f4ef; color: var(--text); }
.recipe-total b { color: var(--green); font-size: 20px; }

.inventory-count-modal { z-index: 105; padding: 0; background: var(--bg); backdrop-filter: none; }
.inventory-count-panel { width: 100%; height: 100dvh; max-height: none; display: flex; flex-direction: column; overflow: hidden; border: 0; border-radius: 0; box-shadow: none; }
.inventory-count-screen { min-height: 0; flex: 1; display: flex; flex-direction: column; }
.inventory-count-screen[hidden] { display: none; }
.barcode-scanner-panel { display: flex; flex-direction: column; }
.inventory-count-body { flex: 1; overflow: auto; }
.inventory-count-hub-body { display: grid; align-content: start; gap: 13px; }
.inventory-count-start-button { width: 100%; min-height: 48px; }
.inventory-count-history { display: grid; gap: 8px; }
.inventory-count-entry-location { padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-soft); color: var(--muted); font-size: 11px; }
.inventory-count-footer { padding: 11px 14px max(11px, env(safe-area-inset-bottom)); display: flex; align-items: end; justify-content: space-between; gap: 10px; border-top: 1px solid var(--line); background: var(--surface); }
.inventory-count-footer label { flex: 1; }
.readonly-value, .inventory-count-current { min-height: 36px; padding: 8px 10px; border-radius: 8px; background: var(--surface-soft); color: var(--text); }
.inventory-count-current { display: grid; gap: 2px; }
.inventory-count-current small { color: var(--muted); font-size: 9px; }
.inventory-count-category { margin-bottom: 10px; }
.inventory-count-batch-input { width: 92px; }
.inventory-count-physical-inputs { display: grid; grid-template-columns: repeat(2, minmax(86px, 1fr)); gap: 6px; }
.inventory-count-physical-inputs label { min-width: 0; }
.inventory-count-physical-inputs label > span { display: block; min-height: 22px; font-size: 9px; line-height: 1.3; }
.inventory-count-physical-inputs input { width: 100%; }
.inventory-count-detail-button { min-height: 30px; padding: 5px 9px; font-size: 9px; }
.inventory-count-variance-positive { color: var(--green); }
.inventory-count-variance-negative { color: var(--red); }
.inventory-category-head h2 { margin: 0; font-size: 13px; white-space: nowrap; }
.inventory-category-head small { flex: 1; color: var(--muted); font-size: 9px; text-align: start; }

.barcode-scanner-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 1fr; }
.barcode-camera-pane { position: relative; min-height: 260px; overflow: hidden; background: #0b0b0b; }
.barcode-camera-pane video { width: 100%; height: 100%; display: block; object-fit: cover; }
.barcode-camera-guide { position: absolute; inset: 22% 12%; border: 2px solid rgba(255, 200, 0, .9); border-radius: 16px; box-shadow: 0 0 0 999px rgba(0,0,0,.14); }
.barcode-camera-guide span { position: absolute; left: 8%; right: 8%; top: 50%; height: 2px; background: var(--red); box-shadow: 0 0 8px var(--red); }
.barcode-torch-button { position: absolute; right: 14px; bottom: 14px; width: 46px; min-width: 46px; height: 46px; min-height: 46px; padding: 0; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.45); border-radius: 50%; background: rgba(30,30,30,.45); color: #fff; backdrop-filter: blur(8px); }
[dir="ltr"] .barcode-torch-button { right: auto; left: 14px; }
.barcode-torch-button.active { background: var(--yellow); color: #111; }
.barcode-torch-button svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.barcode-camera-status { position: absolute; left: 12px; right: 12px; top: 12px; padding: 7px 9px; border-radius: 8px; background: rgba(0,0,0,.55); color: #fff; text-align: center; font-size: 10px; }
.barcode-data-pane { min-height: 0; overflow: auto; padding: 12px; background: var(--bg); }
.barcode-location-row { display: grid; grid-template-columns: 1fr 1.2fr; gap: 8px; }
.barcode-detected-name { grid-column: 1 / -1; padding: 9px 10px; border-radius: 9px; background: var(--surface); font-weight: 900; }
.barcode-product-form { display: grid; gap: 10px; margin-top: 10px; }
.barcode-known-summary { padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.barcode-known-summary small { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.55; }
.barcode-new-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 11px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.field-wide { grid-column: 1 / -1; }
.barcode-purchase-unit-field input[readonly] { background: var(--surface-soft); color: var(--ink); font-weight: 800; opacity: 1; }
.inventory-category-actions { min-width: max-content; flex-wrap: nowrap; }
.barcode-new-fields.weighted-outer #barcodePieceWeightField { grid-column: 1 / -1; }
.barcode-new-fields.weighted-outer #barcodePiecesPerInnerPackField { grid-column: 1 / -1; }
.barcode-carton-weight { align-self: end; min-height: 40px; padding: 10px; border-radius: 9px; background: var(--surface-soft); font-size: 11px; }
.barcode-profile-hint { grid-column: 1 / -1; padding: 9px 10px; border: 1px solid rgba(214, 170, 0, .28); border-radius: 10px; background: rgba(255, 200, 0, .1); color: var(--muted); font-size: 11px; line-height: 1.65; }
.barcode-quantity-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.barcode-counter { display: grid; gap: 6px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.barcode-counter > span { color: var(--muted); font-size: 11px; font-weight: 700; }
.barcode-counter-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.barcode-counter-actions button { min-height: 34px; padding: 3px; font-size: 19px; }
.barcode-price-field, .barcode-direct-counter { grid-column: 1 / -1; }
.barcode-missing-note { color: var(--orange); font-size: 10px; }
.barcode-missing-link { min-height: 0; padding: 0; background: transparent; color: var(--green); }
.barcode-form-error { min-height: 18px; color: var(--red); font-size: 11px; }
.barcode-form-actions, .barcode-missing-actions { display: grid; grid-template-columns: 1fr 1.5fr; gap: 8px; }
.barcode-missing-panel { width: min(420px, 100%); padding: 17px; }
.barcode-missing-panel h2 { margin: 0 0 8px; }
.barcode-missing-panel p { color: var(--muted); }

.price-chart { min-height: 200px; display: flex; align-items: end; gap: 8px; padding: 14px 8px 0; }
.chart-col { flex: 1; min-width: 34px; display: grid; align-content: end; gap: 5px; text-align: center; }
.chart-rail { height: 150px; display: flex; align-items: end; justify-content: center; border-radius: 7px; background: var(--surface-soft); }
.chart-bar { width: min(28px, 70%); min-height: 4px; border-radius: 7px 7px 2px 2px; background: var(--yellow); }
.chart-value, .chart-axis, .price-chart-label { color: var(--muted); font-size: 9px; }
.price-stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.price-stat { padding: 9px; border-radius: 9px; background: var(--surface); text-align: center; }
.supplier-average-list { display: grid; gap: 7px; }
.supplier-average-row { display: flex; justify-content: space-between; padding: 8px 9px; border-radius: 8px; background: var(--surface); }

.toast-stack { position: fixed; z-index: 120; left: 50%; bottom: 92px; width: min(92vw, 520px); display: grid; gap: 7px; transform: translateX(-50%); pointer-events: none; }
.toast-stack > * { padding: 11px 13px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-strong); color: #fff; box-shadow: 0 12px 28px rgba(0,0,0,.2); font-weight: 700; text-align: center; }

@media (max-width: 820px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid, .message-grid, .inventory-transfer-grid, .inventory-create-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .barcode-scanner-layout { grid-template-columns: 1fr; grid-template-rows: minmax(220px, 34vh) 1fr; }
  .barcode-camera-pane { min-height: 0; }
}

@media (max-width: 560px) {
  body { font-size: 13px; }
  .shell { padding-bottom: 92px; }
  .main { padding: 0 10px 18px; }
  .topbar { min-height: 78px; margin-inline: -10px; margin-bottom: 12px; padding-inline: 14px; }
  .topbar h1 { font-size: 18px; }
  .topbar-notification-button { inset-inline-start: 13px; }
  .admin-notification-panel { inset-inline-start: 12px; }
  .card { padding: 11px; }
  .cards { gap: 9px; }
  .metric { min-height: 82px; padding: 10px; }
  .metric b { font-size: 20px; }
  .form-grid, .message-grid, .inventory-transfer-grid, .inventory-create-row, .two-charts, .mini-grid, .performance-grid { grid-template-columns: 1fr; }
  .analytics-head { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.12fr) minmax(0, .83fr); gap: 5px; }
  .analytics-head label { gap: 4px; font-size: 9px; }
  .analytics-head select { min-height: 36px; padding-inline: 7px; font-size: 10px; }
  .custom-range { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .analytics-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .performance-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .customer-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .customer-detail-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings-hours-grid, .settings-delivery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings-radius-field { grid-column: 1 / -1; }
  .barcode-location-row { grid-template-columns: 1fr 1fr; }
  .barcode-new-fields { grid-template-columns: 1fr 1fr; }
  .barcode-launch-card { grid-template-columns: 1fr; }
  .barcode-launch-card > div:first-child, .barcode-launch-button, button.ok.barcode-launch-button, .barcode-draft-summary { width: 100%; grid-column: 1; }
  .barcode-launch-card h2, .barcode-launch-card p { word-break: normal; overflow-wrap: break-word; }
  .recipe-grid { grid-template-columns: 1fr 1fr; }
  .recipe-modal, .notification-detail-modal, .customer-detail-modal { padding: 0; align-items: stretch; }
  .recipe-panel, .notification-detail-panel, .customer-detail-modal .detail-panel { width: 100%; height: 100dvh; max-height: none; border: 0; border-radius: 0; display: flex; flex-direction: column; }
  .recipe-body, .customer-detail-modal .detail-body { flex: 1; min-height: 0; overflow-x: hidden; overflow-y: auto; padding: 11px; }
  .recipe-row { min-width: 0; grid-template-columns: 34px minmax(0, 1fr) 90px 42px; grid-template-areas: "number ingredient ingredient delete" ". quantity unit ."; align-items: end; gap: 7px; padding: 10px; margin-bottom: 9px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
  .recipe-row-number { grid-area: number; align-self: start; }
  .recipe-ingredient-field { grid-area: ingredient; }
  .recipe-quantity-field { grid-area: quantity; }
  .recipe-unit-field { grid-area: unit; }
  .recipe-delete-button { grid-area: delete; align-self: end; width: 42px; min-width: 42px; padding: 0; }
  .recipe-row select, .recipe-row input, .recipe-row .readonly-value { min-height: 38px; }
  .recipe-row .readonly-value { display: grid; place-items: center; padding-inline: 5px; text-align: center; }
  .recipe-row-inherited { grid-template-columns: 34px minmax(0, 1fr) 68px 62px; grid-template-areas: "number ingredient quantity unit" "badge badge badge badge"; align-items: end; }
  .recipe-row-inherited .recipe-row-number { grid-area: number; }
  .recipe-inherited-material { grid-area: ingredient; }
  .recipe-inherited-quantity { grid-area: quantity; }
  .recipe-inherited-unit { grid-area: unit; }
  .recipe-inherited-badge { grid-area: badge; justify-self: start; }
  .recipe-total { margin-top: 10px; padding: 11px; }
  .recipe-total b { font-size: 17px; }
  .barcode-admin-product { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .menu-figma-item td { padding-inline: 4px; }
  .menu-figma-price { width: 62px; }
  .menu-figma-price input { width: 34px; }
  .menu-figma-controls { width: 87px; }
  .menu-section-editor-row { grid-template-columns: 1fr; }
  .inventory-count-footer { align-items: stretch; flex-direction: column; }
  .inventory-count-footer button { width: 100%; }
  .mobile-bottom-nav { width: calc(100% - 20px); }
  th, td { height: 35px; padding: 6px; font-size: 10px; }
}

@media (min-width: 900px) {
  .topbar { border: 1px solid var(--line); border-top: 0; border-radius: 0 0 18px 18px; }
  .section.active { grid-template-columns: repeat(12, minmax(0, 1fr)); align-items: start; }
  .section.active > * { grid-column: 1 / -1; }
  #overview .cards { grid-column: 1 / -1; }
  #overview > .card:not(.performance-card):not(.analytics-card) { grid-column: span 6; }
  #overview .performance-card, #overview .analytics-card { grid-column: 1 / -1; }
  .mobile-bottom-nav { width: min(620px, calc(100% - 32px)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
