:root {
  color-scheme: light;
  --bg: #f5f5f7;
  --panel: #fff;
  --ink: #1d1d1f;
  --muted: #65656c;
  --line: #d9d9df;
  --blue: #0066cc;
  --soft: #e9f1fc;
  --danger: #a92323;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111114;
  --panel: #1d1d22;
  --ink: #f5f5f7;
  --muted: #b5b5bf;
  --line: #404049;
  --blue: #72b3ff;
  --soft: #223047;
  --danger: #ffb1ab;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.55;
}
header,
footer,
main {
  max-width: 1140px;
  margin: auto;
  padding: 24px;
}
header,
footer {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
header {
  border-bottom: 1px solid var(--line);
}
footer {
  color: var(--muted);
  font-size: 14px;
  justify-content: space-between;
}
.brand {
  font-weight: 750;
  letter-spacing: 0.03em;
  margin-right: auto;
  color: var(--ink);
  text-decoration: none;
}
.brand span {
  font-weight: 400;
  color: var(--muted);
  display: block;
  font-size: 13px;
}
h1,
h2,
h3,
p {
  margin: 0 0 16px;
}
h1 {
  font-size: clamp(28px, 5vw, 42px);
  letter-spacing: -0.04em;
  line-height: 1.15;
}
h2 {
  font-size: 23px;
  letter-spacing: -0.02em;
}
h3 {
  font-size: 18px;
}
a {
  color: var(--blue);
}
button,
input,
select,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--ink);
  font-weight: 600;
}
button.primary {
  background: var(--blue);
  border-color: var(--blue);
  color: var(--panel);
}
html[data-theme="dark"] button.primary {
  color: #081523;
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}
input,
select,
textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--ink);
  min-height: 46px;
}
label {
  display: grid;
  gap: 7px;
  margin-bottom: 16px;
  font-weight: 550;
}
label small,
small,
.muted {
  color: var(--muted);
  font-weight: 400;
}
label.check {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
label.check input {
  width: 22px;
  min-height: 22px;
  margin-top: 4px;
}
.panel,
.tile {
  background: var(--panel);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 20px;
}
.entry {
  max-width: 520px;
  margin: 40px auto;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
}
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 350px;
  gap: 28px;
  align-items: start;
}
.tile img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  border-radius: 12px;
  background: #fff;
}
.tile .image {
  border: 0;
  padding: 0;
  width: 100%;
  display: block;
  margin-bottom: 16px;
}
.tile .placeholder {
  height: 130px;
  display: grid;
  place-items: center;
  background: var(--soft);
  border-radius: 12px;
  color: var(--blue);
  margin-bottom: 16px;
}
.tile button {
  width: 100%;
  margin-top: 8px;
}
.tile label {
  font-size: 14px;
}
.price {
  font-weight: 700;
  font-size: 21px;
}
.bag {
  position: sticky;
  top: 20px;
  display: grid;
  gap: 18px;
}
.line {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 12px;
  justify-content: space-between;
}
.line p {
  margin: 0;
}
.stack {
  display: grid;
  gap: 16px;
}
.notice {
  padding: 16px;
  border-radius: 12px;
  background: var(--soft);
  margin: 16px 0;
}
.error {
  color: var(--danger);
}
.error:empty {
  display: none;
}
.split {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
}
.total {
  font-size: 22px;
  font-weight: 750;
}
dialog {
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 24px;
  width: min(680px, 94vw);
  max-height: 90vh;
  padding: 28px;
}
dialog::backdrop {
  background: #0008;
}
dialog img {
  max-height: 300px;
  max-width: 100%;
  object-fit: contain;
  border-radius: 12px;
  background: white;
}
.gallery {
  display: flex;
  overflow: auto;
  gap: 12px;
  margin: 20px 0;
}
.secret {
  overflow-wrap: anywhere;
  font: 600 16px/1.8 monospace;
}
.receipt {
  max-width: 680px;
  margin: 32px auto;
}
.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
[hidden] {
  display: none !important;
}
@media (max-width: 820px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .bag {
    position: static;
  }
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  main,
  header,
  footer {
    padding: 20px 16px;
  }
  .tile {
    padding: 16px;
  }
  .tile h3 {
    font-size: 16px;
  }
}
@media (max-width: 400px) {
  .grid {
    grid-template-columns: 1fr;
  }
}
.history-panel {
  margin-top: 24px;
}
.brand img {
  float: left;
  margin-right: 12px;
  object-fit: contain;
  border-radius: 8px;
}
