:root {
  color-scheme: light dark;
  font: 16px/1.45 system-ui, sans-serif;
  --canvas: #fff;
  --paper: #fff;
  --ink: #191a1c;
  --muted: #5f6268;
  --line: #dedfe2;
  --accent: #25262a;
  --selected: #f1f1f3;
  background: var(--canvas);
  color: var(--ink);
}

@media (prefers-color-scheme: dark) {
  :root {
    --canvas: #17181a;
    --paper: #202124;
    --ink: #f0f0f2;
    --muted: #bcbec4;
    --line: #424449;
    --accent: #42444c;
    --selected: #303136;
  }
}

* { box-sizing: border-box; }
body { margin: 0; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.app { max-width: 760px; margin: auto; padding: 24px clamp(16px, 4vw, 36px) calc(105px + env(safe-area-inset-bottom)); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
h1 { margin: 0 0 14px; font-size: clamp(29px, 6vw, 42px); letter-spacing: -.035em; }
.icon-button { border: 0; background: transparent; padding: 10px 0 10px 12px; }

.workspace-nav {
  position: fixed;
  z-index: 1;
  bottom: max(12px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: min(320px, calc(100% - 32px));
  padding: 5px;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
}

.workspace-nav button {
  min-height: 46px;
  padding: 8px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
}

.workspace-nav button[aria-pressed="true"] { background: var(--accent); color: #fff; font-weight: 650; }
.search { display: block; }

.search input, #operationText {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
}

.search input::placeholder { color: var(--muted); }
.categories { display: flex; gap: 8px; overflow-x: auto; padding: 12px 4px; }
.chip { min-height: 40px; white-space: nowrap; border: 1px solid var(--line); padding: 5px 12px; border-radius: 999px; background: var(--selected); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.results-meta { color: var(--muted); font-size: .875rem; padding: 4px 0 8px; }
.items { display: grid; border-top: 1px solid var(--line); }
.item-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 12px;
  padding: 16px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
}

.item-card:hover, #operationsView button:hover { background: var(--selected); }
.sku { font-size: 1.075rem; font-weight: 700; overflow-wrap: anywhere; }
.item-category { grid-column: 1; grid-row: 2; color: var(--muted); font-size: .85rem; }
.item-bottom { grid-column: 2; grid-row: 1 / span 2; display: grid; justify-items: end; gap: 4px; font-variant-numeric: tabular-nums; }
.stock-num { font-size: 1.075rem; font-weight: 700; }
.total { font-size: .85rem; color: var(--muted); }
.detail-card { border: 1px solid var(--line); border-radius: 16px; padding: 16px; background: var(--paper); }
.detail-sku { font-size: 24px; font-weight: 750; overflow-wrap: anywhere; }
.detail-category, .metric-label { color: var(--muted); }
.detail-grid { display: grid; gap: 12px; margin-top: 18px; }
.metric { border-top: 1px solid var(--line); padding-top: 8px; }
.metric-label { font-size: .85rem; }
.metric-value { font-weight: 700; font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.notice { padding: 14px 0; }
.skeleton { height: 66px; border-bottom: 1px solid var(--line); background: var(--paper); }

#operationsView button {
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  text-align: left;
  overflow-wrap: anywhere;
}

#operationHome { margin-bottom: 12px; }
.operation-copy { white-space: pre-wrap; overflow-wrap: anywhere; margin-block: 10px 14px; }
.operation-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.operation-row button { flex: 1 1 135px; }
#operationForm { display: grid; gap: 8px; margin-top: 20px; }
#operationForm button { justify-self: start; color: white; background: var(--accent); }
#operationForm button:hover { color: var(--ink); }
#operationNotice:empty { display: none; }
#operationNotice { color: var(--muted); }

#operationPages .operation-row button:not(:hover), #operationForm {
  background: var(--selected);
}
#operationPages .operation-row button {
  min-height: 52px;
  padding-inline: 14px;
}
#operationForm {
  padding: 16px;
  border-radius: 12px;
}
