:root {
  color-scheme: dark;
  --bg: #0c0f14;
  --bg-2: #07090c;
  --card: #161b22;
  --card-2: #1d242e;
  --line: rgba(255, 255, 255, 0.08);
  --text: #f3f6f8;
  --muted: #93a0b0;
  --accent: #7ee0b0;
  --accent-ink: #06281a;
  --accent-dim: #13241c;
  --danger: #ff8d8d;
  --danger-dim: #2a1518;
  --warn: #f5c16c;
  --blue: #9ebcff;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-decoration: none; }

.app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  width: min(480px, 100%);
  margin: 0 auto;
}
.main {
  flex: 1 0 auto;
  padding: 16px 16px 24px;
}
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(12px + env(safe-area-inset-top)) 16px 8px;
}
.brand { display: flex; flex-direction: column; gap: 2px; }
.brand strong { font-size: 20px; letter-spacing: -0.03em; }
.brand span, .who { color: var(--muted); font-size: 13px; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.linkish, .ghost {
  background: transparent;
  border: 0;
  color: var(--muted);
  padding: 8px 4px;
  font-size: 14px;
}
h1 {
  font-size: 28px;
  line-height: 1.15;
  letter-spacing: -0.04em;
  margin: 8px 0 14px;
}
.lead { color: var(--muted); margin: -6px 0 16px; line-height: 1.45; }

.stack { display: flex; flex-direction: column; gap: 10px; }
.card, .panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  box-shadow: var(--shadow);
}
.action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
}
.action b { display: block; font-size: 18px; }
.action span { color: var(--muted); font-size: 13px; }
.action.go { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.action.go span { color: #245c45; }

.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.field label, .section-label {
  font-size: 14px;
  font-weight: 650;
}
.req { color: var(--accent); }
.opt { color: var(--muted); font-weight: 500; }
input, select {
  width: 100%;
  background: var(--bg);
  border: 1px solid #2c3542;
  border-radius: 14px;
  padding: 14px 14px;
  font-size: 16px;
  outline: none;
}
input:focus, select:focus { border-color: var(--accent); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.btn {
  width: 100%;
  min-height: 54px;
  border: 0;
  border-radius: 16px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 750;
  font-size: 17px;
}
.btn:disabled { opacity: 0.38; }
.btn.secondary { background: var(--card-2); color: var(--text); border: 1px solid var(--line); }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid #6e3036; }
.btn.slim { min-height: 48px; font-size: 16px; }

.choices { display: flex; flex-direction: column; gap: 8px; max-height: 280px; overflow: auto; margin-bottom: 8px; }
.choice {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--bg);
}
.choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.dot {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  border-radius: 50%;
  border: 2px solid #5c6b7e;
}
.choice:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-dim);
}
.choice:has(input:checked) .dot {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 5px var(--accent);
}
.new-cat { margin-top: 8px; }

.suggest {
  background: var(--card-2);
  border: 1px solid #2c3542;
  border-radius: 14px;
  overflow: hidden;
}
.suggest button {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 12px 14px;
}
.suggest button:last-child { border-bottom: 0; }
.suggest b { display: block; font-weight: 650; }
.suggest small { display: block; color: var(--muted); margin-top: 3px; line-height: 1.35; }
.note {
  margin-top: 8px;
  background: var(--accent-dim);
  color: #d7f6e8;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.4;
}
.fine { color: var(--muted); font-size: 13px; margin: 6px 0 0; }
.auth-links { text-align: center; margin: 16px 0 0; }
.badge {
  display: inline-block;
  margin-left: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.badge.wait { background: #3a2e14; color: var(--warn); }
.badge.off { background: var(--danger-dim); color: var(--danger); }
.badge.on { background: var(--accent-dim); color: var(--accent); }

.flash { border-radius: 14px; padding: 12px 14px; margin-bottom: 14px; line-height: 1.4; }
.flash.ok { background: var(--accent-dim); color: #c8f8e2; }
.flash.err { background: var(--danger-dim); color: #ffd0d0; }

.activity { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); color: inherit; }
.activity:last-child { border-bottom: 0; }
.pill {
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  min-width: 64px;
}
.pill.added { color: var(--accent); }
.pill.removed { color: var(--warn); }
.pill.moved { color: var(--blue); }
.pill.deleted { color: var(--danger); }
.activity p { margin: 2px 0 0; }
.activity .meta { color: var(--muted); font-size: 13px; }

.item-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  margin-bottom: 10px;
  border-radius: 18px;
  background: var(--card);
  border: 1px solid var(--line);
  color: inherit;
}
.item-photo, .photo-preview {
  width: 100%;
  max-height: 280px;
  object-fit: cover;
  border-radius: 16px;
  background: var(--bg);
  margin-top: 8px;
}
.item-photo { margin: 0 0 14px; }
.thumb {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 12px;
  flex: 0 0 64px;
  background: var(--bg);
}
input[type="file"] {
  width: 100%;
  font-size: 16px;
  padding: 12px;
  background: var(--bg);
  border: 1px dashed #3c4a5c;
  border-radius: 14px;
}
.item-row strong { display: block; font-size: 16px; }
.item-row span { display: block; color: var(--muted); font-size: 13px; margin-top: 3px; }
.qty {
  margin-left: auto;
  min-width: 52px;
  text-align: center;
  font-size: 22px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}
.hero-qty {
  font-size: 56px;
  line-height: 1;
  font-weight: 750;
  letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
}
.hero-qty span { display: block; margin-top: 4px; color: var(--muted); font-size: 14px; font-weight: 500; letter-spacing: 0; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 8px 10px; margin: 14px 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

.confirm-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0 12px;
  color: var(--muted);
}
.confirm-line input { width: 22px; height: 22px; accent-color: var(--danger); }

.staff {
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.staff:last-child { border-bottom: 0; margin-bottom: 0; }
details summary { cursor: pointer; color: var(--accent); margin: 8px 0; }
.checkline { display: flex; align-items: center; gap: 10px; margin: 4px 0 12px; }
.checkline input { width: 22px; height: 22px; }

.tabbar {
  margin-top: auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 8px 10px calc(10px + env(safe-area-inset-bottom));
  background: rgba(12, 15, 20, 0.94);
  border-top: 1px solid var(--line);
  position: sticky;
  bottom: 0;
}
.tabbar a {
  text-align: center;
  color: var(--muted);
  padding: 10px 4px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 650;
}
.tabbar a.active { color: var(--accent-ink); background: var(--accent); }

.auth {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  padding: 24px 16px;
}
.auth .panel { width: min(440px, 100%); margin: 0 auto; }
.mark {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 800;
  margin-bottom: 12px;
}

@media (min-width: 760px) {
  body { background: var(--bg-2); }
  .app {
    min-height: calc(100dvh - 48px);
    margin: 24px auto;
    border: 1px solid var(--line);
    border-radius: 28px;
    overflow: hidden;
    background: var(--bg);
  }
}
