:root {
  color-scheme: dark;
  --ink: #f6f7f8;
  --muted: #a5adba;
  --line: #2b3038;
  --paper: #111419;
  --panel: #171b21;
  --panel-strong: #0c0e12;
  --brand-red: #ff4b24;
  --brand-wood: #a48765;
  --green: #4ade80;
  --green-soft: rgba(74, 222, 128, 0.15);
  --red: #fb7185;
  --red-soft: rgba(251, 113, 133, 0.15);
  --blue: #38bdf8;
  --amber: #fbbf24;
  --shadow: 0 20px 56px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(8, 10, 13, 0.96), rgba(15, 18, 24, 0.92)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180'%3E%3Crect width='180' height='180' fill='%23090b0f'/%3E%3Cg fill='none' stroke='%23212831' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M26 38h34M26 52h34M36 24v56M120 25v42a18 18 0 0 0 36 0V25M138 25v92M102 112h54M105 128h48M53 116c18-15 43-13 59 2-17 14-42 13-59-2zM68 113c3-18 21-29 39-24-2 19-20 30-39 24z'/%3E%3C/g%3E%3C/svg%3E");
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.topbar,
.section-heading,
.controls,
menu {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.section-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.phone-only {
  display: none;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.brand-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 142px;
  height: 94px;
  flex: 0 0 auto;
  border: 1px solid #343025;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(12, 14, 18, 0.2), rgba(12, 14, 18, 0.86)),
    repeating-linear-gradient(90deg, #80684e 0 18px, #987b5b 18px 36px);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.brand-mark::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(33deg, transparent 0 46%, rgba(5, 7, 10, 0.95) 47% 49%, transparent 50%),
    linear-gradient(147deg, transparent 0 46%, rgba(5, 7, 10, 0.95) 47% 49%, transparent 50%);
  opacity: 0.72;
}

.brand-x {
  position: absolute;
  color: #f7f3e8;
  font-size: 6rem;
  font-weight: 950;
  line-height: 1;
  text-shadow: 0 4px 0 #2b2d27, 0 8px 16px rgba(0, 0, 0, 0.5);
}

.brand-burger {
  position: relative;
  z-index: 1;
  color: var(--brand-red);
  font-size: 1.45rem;
  font-weight: 950;
  letter-spacing: 0;
  text-shadow: 0 3px 0 #22231f, 0 6px 14px rgba(0, 0, 0, 0.58);
}

.brand-name {
  margin: 0 0 8px;
  color: #ffffff;
  font-size: clamp(1.25rem, 2.8vw, 2rem);
  font-weight: 950;
  line-height: 1;
}

.eyebrow,
.metric p,
.section-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2rem, 6vw, 4.5rem);
  line-height: 0.95;
}

h2 {
  font-size: 1.1rem;
}

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

.nav-link {
  display: inline-grid;
  place-items: center;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-strong);
  color: var(--ink);
  padding: 0 14px;
  font-weight: 900;
  text-decoration: none;
}

.language-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
  background: var(--panel-strong);
}

.language-toggle button {
  min-width: 46px;
  height: 42px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
}

.language-toggle .active {
  background: var(--brand-red);
  color: #120501;
}

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

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

.metric {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  background: linear-gradient(180deg, #1b2028, #12161c);
}

.metric-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-weight: 800;
}

.metric.urgent .metric-icon {
  background: var(--red-soft);
  color: var(--red);
}

.metric strong {
  display: block;
  margin-top: 3px;
  font-size: 1.55rem;
}

.controls {
  margin-bottom: 16px;
}

.search {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 220px;
  padding: 0 14px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.search input {
  width: 100%;
  border: 0;
  outline: 0;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  min-width: 316px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel);
}

.segmented button {
  height: 44px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
}

.segmented button:last-child {
  border-right: 0;
}

.segmented .active {
  background: var(--brand-red);
  color: #120501;
  font-weight: 900;
}

.workspace {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 16px;
  align-items: start;
}

.panel,
.inventory-panel,
.menu-panel,
.history-panel {
  padding: 18px;
}

.menu-panel,
.history-panel {
  margin-top: 16px;
}

.form-stack {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

label {
  display: grid;
  gap: 7px;
  color: #d5d9e0;
  font-size: 0.9rem;
  font-weight: 700;
}

input,
select {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-strong);
  color: var(--ink);
  padding: 0 12px;
}

.suggestion-wrap {
  position: relative;
}

.suggestion-list {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #1a1f27;
  box-shadow: var(--shadow);
}

.suggestion-list button {
  display: block;
  width: 100%;
  min-height: 42px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  padding: 10px 12px;
  text-align: left;
  font-weight: 800;
}

.suggestion-list button:hover,
.suggestion-list button:focus {
  background: #252b35;
  outline: 0;
}

.suggestion-list small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-weight: 700;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.primary-btn,
.secondary-btn,
.quiet-btn,
.danger-btn,
.icon-btn {
  border-radius: 7px;
  border: 1px solid transparent;
  min-height: 42px;
  padding: 0 14px;
  font-weight: 800;
}

.primary-btn {
  background: var(--brand-red);
  color: #120501;
}

.secondary-btn {
  background: var(--brand-red);
  color: #120501;
}

.danger-btn {
  background: var(--red);
  color: #170207;
}

.quiet-btn,
.icon-btn {
  background: var(--panel-strong);
  border-color: var(--line);
  color: var(--ink);
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 42px;
  padding: 0;
  font-size: 1.3rem;
}

.inventory-list,
.delivery-list,
.history-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.category-group {
  display: grid;
  gap: 10px;
}

.category-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 2px 2px;
  color: var(--ink);
}

.category-heading h3 {
  margin: 0;
  font-size: 0.95rem;
  letter-spacing: 0;
}

.category-heading span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.item-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 142px 150px 112px;
  gap: 12px;
  align-items: center;
  min-height: 78px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.item-main {
  min-width: 0;
}

.item-detail-btn {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  text-align: left;
}

.item-detail-btn:hover strong,
.item-detail-btn:focus strong {
  color: var(--brand-red);
}

.item-main strong,
.item-main span {
  display: block;
  overflow-wrap: anywhere;
}

.item-main span,
.stock-meta {
  color: var(--muted);
  font-size: 0.84rem;
}

.count-stepper {
  display: grid;
  grid-template-columns: 38px 1fr 38px;
  align-items: center;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
  background: var(--panel-strong);
  color: var(--ink);
}

.count-stepper button {
  height: 100%;
  border: 0;
  background: #181d24;
  color: var(--ink);
  font-size: 1.2rem;
}

.count-stepper button:hover {
  background: #242a33;
}

.count-stepper output {
  text-align: center;
  font-weight: 900;
  color: var(--ink);
}

.status {
  justify-self: start;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 0.8rem;
  font-weight: 900;
  background: var(--green-soft);
  color: var(--green);
  white-space: nowrap;
}

.status.low {
  background: rgba(251, 191, 36, 0.16);
  color: var(--amber);
}

.status.out {
  background: var(--red-soft);
  color: var(--red);
}

.delete-btn {
  justify-self: end;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-strong);
  color: var(--red);
  font-weight: 900;
}

.empty-state {
  padding: 34px 16px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  text-align: center;
  color: var(--muted);
}

dialog {
  width: min(720px, calc(100% - 28px));
  border: 0;
  padding: 0;
  background: transparent;
}

dialog::backdrop {
  background: rgba(31, 41, 51, 0.46);
}

.dialog-card {
  padding: 18px;
}

.confirm-card {
  display: grid;
  gap: 18px;
}

.confirm-card p {
  margin: 8px 0 0;
  color: var(--muted);
}

.detail-card {
  display: grid;
  gap: 18px;
}

.detail-body {
  display: grid;
  gap: 14px;
}

.detail-section {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.detail-section h3,
.detail-section p {
  margin: 0;
}

.detail-section h3 {
  font-size: 0.95rem;
}

.detail-section p {
  color: var(--muted);
}

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

.detail-stats span {
  display: grid;
  gap: 3px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
}

.detail-stats strong {
  color: var(--ink);
}

.delivery-row,
.order-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 130px 130px;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.order-row {
  grid-template-columns: minmax(160px, 1fr) 150px 120px;
}

.product-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

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

.product-card {
  display: grid;
  gap: 10px;
  align-content: start;
  min-height: 148px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.product-card strong {
  overflow-wrap: anywhere;
}

.product-category {
  justify-self: start;
  border-radius: 999px;
  padding: 5px 9px;
  background: rgba(56, 189, 248, 0.14);
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 900;
}

.ingredient-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ingredient-tags span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 8px;
  color: var(--muted);
  font-size: 0.8rem;
}

.history-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.history-type {
  justify-self: start;
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(255, 75, 36, 0.16);
  color: var(--brand-red);
  font-size: 0.8rem;
  font-weight: 900;
}

.history-type.delivery {
  background: var(--green-soft);
  color: var(--green);
}

.history-type.scan {
  background: rgba(56, 189, 248, 0.14);
  color: var(--blue);
}

.scanner-card {
  display: grid;
  gap: 16px;
}

.scanner-view {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 280px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel-strong);
}

.scanner-view video {
  width: 100%;
  min-height: 280px;
  max-height: 58vh;
  object-fit: cover;
}

.scan-frame {
  position: absolute;
  width: min(78%, 360px);
  aspect-ratio: 1.7;
  border: 3px solid var(--brand-red);
  border-radius: 8px;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.36);
}

.scanner-fallback,
.barcode-link-panel {
  display: grid;
  gap: 10px;
}

.barcode-link-panel {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.history-row strong,
.history-row span {
  display: block;
  overflow-wrap: anywhere;
}

.history-row span {
  color: var(--muted);
  font-size: 0.86rem;
}

.compact-history details {
  margin-top: 10px;
}

.compact-history summary {
  color: var(--brand-red);
  cursor: pointer;
  font-weight: 900;
}

.compact-history ul {
  display: grid;
  gap: 5px;
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--muted);
}

menu {
  margin: 18px 0 0;
  padding: 0;
}

@media (max-width: 860px) {
  .topbar,
  .controls {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions {
    justify-content: space-between;
  }

  .brand-block {
    align-items: flex-start;
    flex-direction: column;
  }

  .summary-grid,
  .workspace {
    grid-template-columns: 1fr;
  }

  .segmented {
    min-width: 0;
    width: 100%;
  }

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

  .status,
  .delete-btn {
    justify-self: stretch;
    text-align: center;
  }

  .delivery-row,
  .order-row {
    grid-template-columns: 1fr;
  }

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

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

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

@media (max-width: 860px) and (pointer: coarse) {
  .phone-only {
    display: inline-grid;
    place-items: center;
  }
}

@media (max-width: 520px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding-top: 16px;
  }

  .two-col,
  .summary-grid,
  .product-grid {
    grid-template-columns: 1fr;
  }

  .section-actions {
    justify-content: stretch;
  }

  .section-actions button {
    flex: 1 1 100%;
  }
}
