:root {
  --bg: #f4efe7;
  --panel: rgba(255, 251, 245, 0.92);
  --panel-strong: #fff8ef;
  --panel-solid: #fffaf3;
  --line: rgba(67, 44, 17, 0.15);
  --text: #2c2117;
  --muted: #786657;
  --accent: #cf5f2c;
  --accent-deep: #7e3414;
  --accent-soft: rgba(207, 95, 44, 0.14);
  --good: #1f7a4d;
  --bad: #b03d2e;
  --shadow: 0 24px 60px rgba(69, 47, 23, 0.12);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 177, 106, 0.38), transparent 25%),
    radial-gradient(circle at right, rgba(181, 110, 53, 0.16), transparent 20%),
    linear-gradient(180deg, #fcf4ea 0%, var(--bg) 100%);
}

body.auth-open {
  overflow: hidden;
}

body.sheet-open {
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  min-height: 44px;
  cursor: pointer;
  border: 0;
  border-radius: 16px;
  transition: transform 0.18s ease, opacity 0.18s ease, background 0.18s ease;
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

input,
select,
textarea {
  width: 100%;
  padding: 0.92rem 1rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(207, 95, 44, 0.3);
  border-color: rgba(207, 95, 44, 0.55);
}

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

.shell {
  width: min(1380px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.4rem 0 calc(5.5rem + env(safe-area-inset-bottom, 0px));
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 1rem;
  background:
    radial-gradient(circle at top, rgba(255, 196, 140, 0.3), transparent 25%),
    rgba(28, 18, 10, 0.58);
  backdrop-filter: blur(14px);
}

.auth-card {
  width: min(520px, 100%);
  padding: 1.5rem;
  border-radius: 30px;
  background:
    linear-gradient(145deg, rgba(255, 250, 244, 0.98), rgba(255, 239, 220, 0.96));
  border: 1px solid rgba(126, 52, 20, 0.14);
  box-shadow: 0 24px 80px rgba(30, 18, 10, 0.28);
}

.auth-card h1 {
  margin: 0;
  font-size: clamp(1.9rem, 5vw, 2.5rem);
}

.auth-copy {
  margin: 0.9rem 0 1.1rem;
  color: var(--muted);
}

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

.auth-form label {
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
}

.auth-hint-card {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(67, 44, 17, 0.1);
}

.auth-hint-card p,
.auth-hint-card small {
  margin: 0.3rem 0 0;
  color: var(--muted);
}

.form-error {
  margin-top: 0.9rem;
  padding: 0.85rem 1rem;
  border-radius: 16px;
  color: var(--bad);
  background: rgba(176, 61, 46, 0.1);
  border: 1px solid rgba(176, 61, 46, 0.16);
}

.hero {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 1.4rem;
  align-items: end;
  padding: 1.8rem;
  border-radius: 30px;
  background:
    linear-gradient(135deg, rgba(255, 248, 239, 0.9), rgba(255, 237, 219, 0.94)),
    linear-gradient(120deg, rgba(207, 95, 44, 0.12), rgba(255, 187, 121, 0.12));
  border: 1px solid rgba(126, 52, 20, 0.14);
  box-shadow: var(--shadow);
}

.eyebrow,
.sheet-eyebrow {
  margin: 0 0 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.78rem;
  color: var(--accent-deep);
}

.hero h1 {
  margin: 0;
  font-size: clamp(2rem, 3vw, 3.2rem);
  line-height: 1.05;
}

.hero-text {
  max-width: 60ch;
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 1rem;
}

.hero-status {
  display: grid;
  gap: 0.8rem;
}

.app-tabs-shell {
  position: sticky;
  top: 0.8rem;
  z-index: 25;
  margin-top: 1rem;
}

.app-tabs {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.65rem;
  padding: 0.7rem;
  border-radius: 24px;
  background: rgba(255, 250, 244, 0.94);
  border: 1px solid rgba(126, 52, 20, 0.1);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.app-tab-button {
  min-height: 76px;
  padding: 0.85rem 0.95rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  text-align: left;
  display: grid;
  gap: 0.28rem;
  align-content: start;
  border: 1px solid transparent;
}

.app-tab-label {
  font-weight: 700;
  color: inherit;
}

.app-tab-meta {
  font-size: 0.8rem;
  color: inherit;
  opacity: 0.82;
}

.app-tab-button.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: white;
  border-color: rgba(126, 52, 20, 0.12);
  box-shadow: 0 10px 24px rgba(126, 52, 20, 0.2);
}

.status-card,
.meta-card {
  padding: 1rem 1.15rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
}

.status-card span,
.meta-card span {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
}

.status-card strong,
.meta-card strong {
  display: block;
  margin-top: 0.25rem;
  font-size: 1.05rem;
}

.status-note {
  display: block;
  margin-top: 0.35rem;
  color: var(--muted);
}

.small-button {
  min-height: 38px;
  margin-top: 0.8rem;
  padding: 0.62rem 0.9rem;
}

.layout {
  display: grid;
  gap: 1.25rem;
  margin-top: 1.25rem;
  align-content: start;
  min-height: min(78vh, 980px);
}

.panel,
.subpanel,
.sheet-panel {
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid rgba(126, 52, 20, 0.1);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.panel {
  padding: 1.25rem;
  scroll-margin-top: 1rem;
}

.panel.panel-active {
  animation: panel-enter 0.24s ease;
}

.subpanel {
  padding: 1rem;
  background: var(--panel-strong);
}

.subtle-block {
  display: block;
}

.panel-head,
.subpanel-head,
.cart-head,
.table-toolbar,
.sheet-head,
.sheet-inline-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.panel-head p,
.subpanel-head p,
.sheet-head p {
  margin: 0.22rem 0 0;
  color: var(--muted);
}

.panel-head h2,
.subpanel-head h3,
.cart-head h3,
.sheet-head h3 {
  margin: 0;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.95rem;
  margin: 1rem 0 1.15rem;
}

.metric-card {
  padding: 1rem;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 244, 231, 0.95));
  border: 1px solid var(--line);
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
}

.metric-card strong {
  display: block;
  margin-top: 0.55rem;
  font-size: 1.8rem;
}

.sales-stats-layout,
.sales-stats-periods,
.sales-trend-list {
  display: grid;
  gap: 0.9rem;
}

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

.sales-period-card {
  display: grid;
  gap: 0.8rem;
}

.sales-period-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem;
}

.sales-period-head strong {
  margin: 0;
  font-size: 1.05rem;
}

.sales-period-head span {
  color: var(--muted);
  font-size: 0.82rem;
}

.sales-period-values {
  display: grid;
  gap: 0.5rem;
}

.sales-period-values div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.85rem;
}

.sales-period-values span {
  color: var(--muted);
  font-size: 0.85rem;
}

.sales-period-values strong {
  margin: 0;
  font-size: 1rem;
}

.sales-stats-block {
  display: grid;
  gap: 0.75rem;
  padding: 1rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(67, 44, 17, 0.08);
}

.sales-stats-block-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem;
}

.sales-stats-block-header h4 {
  margin: 0;
}

.sales-stats-block-header p {
  margin: 0.2rem 0 0;
  color: var(--muted);
}

.sales-payment-row,
.sales-product-row,
.sales-trend-row {
  display: grid;
  gap: 0.65rem;
  padding: 0.85rem 0.95rem;
  border-radius: 16px;
  background: rgba(255, 248, 239, 0.86);
  border: 1px solid rgba(126, 52, 20, 0.08);
}

.sales-payment-row,
.sales-product-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.sales-payment-row p,
.sales-product-row p,
.sales-trend-row p {
  margin: 0;
}

.sales-payment-meta,
.sales-product-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.45rem;
}

.sales-trend-row {
  grid-template-columns: 76px minmax(0, 1fr) auto;
  align-items: center;
}

.sales-trend-label {
  font-weight: 700;
}

.sales-trend-bar {
  position: relative;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(126, 52, 20, 0.1);
}

.sales-trend-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--trend-width, 0%);
  border-radius: inherit;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
}

.sales-trend-meta {
  text-align: right;
}

.sales-trend-meta strong {
  display: block;
}

.sales-trend-meta span {
  color: var(--muted);
  font-size: 0.8rem;
}

.dashboard-inventory-panel {
  margin-top: 1rem;
}

.inventory-task-layout {
  display: grid;
  gap: 1rem;
}

.inventory-task-card {
  display: grid;
  gap: 1rem;
  padding: 1rem;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 242, 228, 0.95));
  border: 1px solid rgba(126, 52, 20, 0.1);
}

.inventory-task-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.9rem;
}

.inventory-task-head h4 {
  margin: 0;
}

.inventory-task-head p {
  margin: 0.3rem 0 0;
}

.inventory-task-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.8rem;
}

.inventory-task-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.inventory-task-history-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.85rem 0.95rem;
  border-radius: 16px;
  background: rgba(255, 248, 239, 0.86);
  border: 1px solid rgba(126, 52, 20, 0.08);
}

.inventory-task-history-row p {
  margin: 0.22rem 0 0;
}

.split-grid,
.pos-grid,
.catalog-grid,
.history-columns,
.inventory-grid {
  display: grid;
  gap: 1rem;
}

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

.sales-overview-grid {
  margin-top: 1rem;
}

.pos-grid {
  grid-template-columns: 1.05fr 0.95fr;
  margin-top: 1rem;
}

.catalog-grid {
  grid-template-columns: 1fr 1.2fr;
  margin-top: 1rem;
}

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

.inventory-grid {
  grid-template-columns: 0.96fr 1.04fr;
  margin-top: 1rem;
}

.empty-state {
  padding: 1rem;
  border-radius: 16px;
  background: rgba(255, 247, 238, 0.8);
  border: 1px dashed rgba(126, 52, 20, 0.18);
  color: var(--muted);
}

.ghost-button {
  padding: 0.8rem 1rem;
  background: rgba(255, 244, 230, 0.95);
  color: var(--accent-deep);
  border: 1px solid rgba(126, 52, 20, 0.12);
}

.primary-button,
.scanner-row button,
#complete-sale,
.wide-button {
  padding: 0.95rem 1.1rem;
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  box-shadow: 0 10px 24px rgba(126, 52, 20, 0.22);
}

.wide-button {
  width: 100%;
}

.scanner-form,
.product-form,
.form-grid,
.bulk-import,
.checkout,
.catalog-side,
.history-layout,
.history-section,
.sheet-content {
  display: grid;
  gap: 0.85rem;
}

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

.payment-breakdown {
  padding: 0.95rem;
  border-radius: 18px;
  background: rgba(255, 247, 238, 0.84);
  border: 1px solid rgba(126, 52, 20, 0.1);
}

.form-error-inline {
  color: #b03d2e;
}

.scanner-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
}

.barcode-field-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  align-items: start;
}

.scanner-mobile-actions {
  margin-top: 1rem;
  display: grid;
  gap: 0.75rem;
}

.camera-hint,
.hint,
.muted {
  color: var(--muted);
}

.product-barcode-field small {
  display: block;
}

.camera-hint,
.hint {
  margin: 0;
  font-size: 0.93rem;
}

.manual-search {
  margin-top: 1rem;
}

.catalog-side {
  gap: 1rem;
}

.section-divider {
  height: 1px;
  background: rgba(67, 44, 17, 0.1);
}

.search-results,
.cart-list,
.sales-list,
.history-list,
.low-stock-table,
.sale-editor-list,
.inventory-list {
  display: grid;
  gap: 0.7rem;
}

.search-results {
  margin-top: 0.8rem;
  max-height: 280px;
  overflow: auto;
}

.search-result,
.cart-item,
.sale-card,
.low-stock-item,
.history-card,
.sale-editor-item,
.inventory-item-card {
  padding: 0.95rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(67, 44, 17, 0.08);
}

.search-result,
.cart-item-top,
.sale-head,
.low-stock-item,
.history-card-top,
.sale-editor-item-top,
.inventory-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.inventory-current-task {
  display: grid;
  gap: 0.85rem;
  padding: 1rem;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(255, 242, 228, 0.94));
  border: 1px solid rgba(126, 52, 20, 0.1);
}

.inventory-current-task h3 {
  margin: 0;
}

.inventory-current-task-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.inventory-summary-cards {
  margin-block: 1rem;
}

.inventory-item-card {
  display: grid;
  gap: 0.85rem;
}

.inventory-item-card.is-removed {
  opacity: 0.76;
  border-style: dashed;
  background: rgba(249, 241, 234, 0.9);
}

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

.inventory-item-controls {
  display: grid;
  grid-template-columns: auto auto minmax(112px, 1fr) auto auto;
  gap: 0.65rem;
  align-items: end;
}

.inventory-actual-field {
  display: grid;
  gap: 0.35rem;
}

.inventory-actual-field span {
  font-size: 0.82rem;
  color: var(--muted);
}

.inventory-actual-field input {
  text-align: center;
}

.search-result p,
.sale-card p,
.history-card p,
.sale-editor-item p,
.bulk-result p {
  margin: 0;
}

.search-result small,
.sale-card small,
.history-card small {
  color: var(--muted);
}

.checkout {
  margin-top: 1rem;
}

.checkout-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  border-radius: 16px;
  background: rgba(255, 246, 238, 0.95);
  border: 1px solid var(--line);
}

.checkout-total strong {
  font-size: 1.55rem;
}

.cart-panel .checkout {
  position: sticky;
  bottom: 0;
}

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

.form-grid label,
.sheet-content label {
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.94rem;
}

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

.form-actions,
.inline-actions,
.history-badges,
.history-meta,
.sale-card-actions,
.camera-tools,
.mobile-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.audit-toolbar {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.table-toolbar-wrap {
  flex-wrap: wrap;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--muted);
}

.toggle input {
  width: 20px;
  height: 20px;
  margin: 0;
  padding: 0;
}

.table-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0.9rem 0;
  flex-wrap: wrap;
}

.table-wrap {
  overflow: auto;
}

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

th,
td {
  padding: 0.9rem 0.8rem;
  border-bottom: 1px solid rgba(67, 44, 17, 0.08);
  text-align: left;
  vertical-align: top;
}

th {
  font-size: 0.86rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.checkbox-cell {
  width: 48px;
}

.checkbox-cell input {
  width: 20px;
  height: 20px;
  padding: 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  background: var(--accent-soft);
  color: var(--accent-deep);
}

.pill.bad {
  background: rgba(176, 61, 46, 0.12);
  color: var(--bad);
}

.pill.good {
  background: rgba(31, 122, 77, 0.12);
  color: var(--good);
}

.pill.neutral {
  background: rgba(67, 44, 17, 0.09);
  color: var(--muted);
}

.row-actions,
.sale-card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.row-archived {
  opacity: 0.82;
}

.table-button {
  padding: 0.7rem 0.9rem;
}

.destructive-button {
  color: var(--bad);
  background: rgba(176, 61, 46, 0.08);
}

.qty-button {
  width: 42px;
  height: 42px;
  background: rgba(255, 243, 228, 0.95);
  color: var(--accent-deep);
}

.cart-item-controls {
  display: flex;
  gap: 0.45rem;
  margin-top: 0.8rem;
  flex-wrap: wrap;
}

.remove-button {
  margin-left: auto;
  padding: 0 1rem;
  background: rgba(176, 61, 46, 0.1);
  color: var(--bad);
}

.sale-head-meta {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.sale-card-compact .sale-card-actions {
  margin-top: 0.8rem;
}

.account-card-disabled {
  opacity: 0.8;
}

.audit-detail-list {
  margin-top: 0.7rem;
}

.mono {
  font-family: Consolas, "Courier New", monospace;
}

.bulk-result {
  display: grid;
  gap: 0.35rem;
}

.bulk-result-errors {
  display: grid;
  gap: 0.35rem;
  max-height: 180px;
  overflow: auto;
  padding-top: 0.4rem;
  color: var(--bad);
}

.history-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.sheet {
  position: fixed;
  inset: 0;
  z-index: 50;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(31, 18, 10, 0.55);
  backdrop-filter: blur(4px);
}

.sheet-panel {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(760px, calc(100% - 1rem));
  max-height: min(92vh, 980px);
  transform: translate(-50%, -50%);
  display: grid;
  gap: 1rem;
  padding: 1rem;
  background: var(--panel-solid);
  overflow: auto;
}

.sheet-content {
  min-height: 0;
}

.sheet-footer {
  display: grid;
  gap: 0.85rem;
}

.camera-panel {
  width: min(760px, calc(100% - 1rem));
}

.camera-stage {
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  background: #100b07;
  min-height: 320px;
}

.camera-fallback {
  width: 100%;
  min-height: 320px;
  background: #120d08;
}

.camera-fallback video,
.camera-fallback canvas {
  display: block;
  width: 100%;
}

.camera-fallback > div {
  border: 0;
}

#camera-preview {
  display: block;
  width: 100%;
  min-height: 320px;
  object-fit: cover;
  background: #120d08;
}

.camera-frame {
  position: absolute;
  inset: 14% 12%;
  border: 3px solid rgba(255, 255, 255, 0.86);
  border-radius: 22px;
  box-shadow: 0 0 0 9999px rgba(12, 7, 4, 0.36);
}

.camera-frame-label {
  position: absolute;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--accent-deep);
  font-size: 0.88rem;
}

.camera-sheet-status {
  margin: 0;
  color: var(--muted);
}

.sale-editor-panel {
  width: min(820px, calc(100% - 1rem));
}

.sale-editor-items {
  display: grid;
  gap: 0.8rem;
}

.sale-editor-search-block {
  margin-top: 0;
}

.mobile-nav {
  position: fixed;
  left: 50%;
  bottom: max(0.75rem, env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  width: min(760px, calc(100% - 1rem));
  display: none;
  grid-auto-flow: column;
  grid-auto-columns: minmax(82px, 1fr);
  gap: 0.45rem;
  padding: 0.55rem;
  z-index: 40;
  border-radius: 22px;
  background: rgba(255, 250, 244, 0.94);
  border: 1px solid rgba(126, 52, 20, 0.1);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}

.mobile-nav::-webkit-scrollbar,
.app-tabs::-webkit-scrollbar {
  display: none;
}

.mobile-nav-button {
  min-height: 48px;
  min-width: 82px;
  padding: 0.65rem 0.55rem;
  border-radius: 16px;
  background: transparent;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 600;
  scroll-snap-align: center;
}

.mobile-nav-button.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: white;
  box-shadow: 0 8px 18px rgba(126, 52, 20, 0.18);
}

@keyframes panel-enter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.toast {
  position: fixed;
  right: 1rem;
  bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  z-index: 70;
  max-width: 420px;
  padding: 1rem 1.1rem;
  border-radius: 18px;
  color: white;
  background: rgba(44, 33, 23, 0.96);
  box-shadow: var(--shadow);
}

.toast.error {
  background: rgba(176, 61, 46, 0.96);
}

@media (max-width: 1080px) {
  .hero,
  .split-grid,
  .pos-grid,
  .catalog-grid,
  .history-columns,
  .inventory-grid {
    grid-template-columns: 1fr;
  }

  .sales-stats-periods {
    grid-template-columns: 1fr;
  }

  .app-tabs {
    grid-auto-flow: column;
    grid-auto-columns: minmax(180px, 1fr);
    grid-template-columns: none;
    overflow-x: auto;
    overscroll-behavior-x: contain;
  }
}

@media (max-width: 900px) {
  .shell {
    width: min(100% - 1rem, 100%);
  }

  .hero {
    grid-template-columns: 1fr;
  }

  .app-tabs-shell {
    display: none;
  }

  .mobile-nav {
    display: grid;
  }
}

@media (max-width: 720px) {
  .shell {
    padding-top: 0.65rem;
  }

  .hero,
  .panel,
  .subpanel,
  .sheet-panel {
    padding: 1rem;
  }

  .hero {
    border-radius: 24px;
  }

  .form-grid,
  .scanner-row,
  .barcode-field-actions,
  .compact-form-grid,
  .inventory-item-stats,
  .inventory-item-controls {
    grid-template-columns: 1fr;
  }

  .panel-head,
  .subpanel-head,
  .cart-head,
  .table-actions,
  .table-toolbar,
  .sheet-head,
  .sheet-inline-actions,
  .audit-toolbar,
  .search-result,
  .cart-item-top,
  .sale-head,
  .sale-head-meta,
  .low-stock-item,
  .history-card-top,
  .sale-editor-item-top,
  .inventory-item-top,
  .sales-period-head,
  .sales-stats-block-header,
  .sales-payment-row,
  .sales-product-row,
  .sales-trend-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .sales-payment-meta,
  .sales-product-meta,
  .sales-trend-meta {
    justify-content: flex-start;
    text-align: left;
  }

  .form-actions,
  .mobile-actions {
    flex-direction: column;
  }

  .sales-payment-row,
  .sales-product-row,
  .sales-trend-row,
  .sales-period-values div {
    grid-template-columns: 1fr;
  }

  .row-actions,
  .sale-card-actions {
    justify-content: flex-start;
  }

  .table-wrap {
    overflow: visible;
  }

  table,
  tbody,
  tr,
  td {
    display: block;
    width: 100%;
  }

  thead {
    display: none;
  }

  tr {
    padding: 0.95rem;
    margin-bottom: 0.75rem;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(67, 44, 17, 0.08);
  }

  td {
    padding: 0.3rem 0;
    border: 0;
  }

  td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 0.18rem;
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--muted);
  }

  .checkbox-cell {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    width: 100%;
  }

  .checkbox-cell input {
    width: 24px;
    height: 24px;
  }

  .remove-button {
    margin-left: 0;
  }

  .sheet-panel {
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    transform: none;
    width: 100%;
    max-height: min(92dvh, 92vh);
    border-radius: 24px 24px 0 0;
  }

  .camera-panel {
    min-height: 78dvh;
  }

  .camera-stage,
  .camera-fallback,
  #camera-preview {
    min-height: 52dvh;
  }

  .camera-frame {
    inset: 18% 8%;
  }

  .mobile-nav {
    width: calc(100% - 1rem);
    padding-inline: 0.45rem;
  }

  .mobile-nav-button {
    font-size: 0.7rem;
    padding: 0.55rem 0.25rem;
    min-width: 76px;
  }

  .toast {
    left: 0.5rem;
    right: 0.5rem;
    bottom: calc(5rem + env(safe-area-inset-bottom, 0px));
    max-width: none;
  }
}
