:root {
  color-scheme: light dark;
  --bg: #fff;
  --fg: #182325;
  --muted: #526568;
  --panel: #eef4f3;
  --accent: #126757;
  --on-accent: #fff;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #151c1e; --fg: #eef5f5; --muted: #b4c4c4; --panel: #253134; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.4 system-ui,sans-serif; }
.shell {
  display: flex;
  flex-direction: column;
  max-width: 660px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: auto;
  padding: max(12px,env(safe-area-inset-top)) 14px 0;
}
.brand { display: inline-flex; padding: 8px 0; }
.brand img { display: block; width: min(200px, 56vw); height: auto; }
@media (prefers-color-scheme: light) {
  .brand img { filter: drop-shadow(0 0 0.65px #15283b) drop-shadow(0 0.5px 0.7px #15283b); }
}
h1 { font-size: 1.65rem; margin: .32em 0 .25em; }
.item {
  display: grid;
  grid-template-columns: clamp(48px,15vw,76px) minmax(0,1fr) auto;
  gap: 9px;
  align-items: start;
  padding: 12px 0;
  border-bottom: 1px solid var(--panel);
}
.photo {
  width: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 10px;
  background: var(--panel); display: grid; place-items: center; color: var(--muted);
}
h2, .sku, .unit, .line-total, .details, #status { overflow-wrap: anywhere; }
h2 { font-size: .96rem; margin: 0; }
.sku, .unit { font-size: .8rem; color: var(--muted); margin: 2px 0; }
.controls { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-top: 8px; }
.line-total { font-weight: 650; font-size: .9rem; margin-top: 4px; }
button, input { font: inherit; color: inherit; }
button {
  min-width: 0;
  min-height: 44px;
  padding: 6px 9px;
  border: 0;
  border-radius: 8px;
  background: var(--panel);
  cursor: pointer;
}
button:disabled { opacity: .52; cursor: default; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.primary { width: 100%; font-weight: 700; background: var(--accent); color: var(--on-accent); }
.quantity { min-width: 46px; }
.controls button, .item > button { min-width: 44px; }
input { width: 73px; border: 1px solid var(--muted); border-radius: 6px; background: var(--bg); padding: 5px; }
.details { margin: .35rem 0; }
.details summary { cursor: pointer; }
.details p { margin: .3em 0; }
footer {
  position: sticky;
  z-index: 1;
  bottom: 0;
  margin-top: auto;
  padding: 9px 0 max(12px,env(safe-area-inset-bottom));
  background: var(--bg);
  box-shadow: 0 -1px var(--panel);
}
footer p { margin: 0 0 7px; white-space: pre-line; font-size: .9rem; }
.links { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,137px),1fr)); gap: 7px; }
.links { margin-top: 7px; }
.links button, .landing button { overflow-wrap: anywhere; }
.links button { font-size: .86rem; }
.landing { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; padding: 14px 0 18px; }
.tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; min-height: 76px; padding: 10px; text-align: center; }
.tile span { font-size: 1.15rem; }
.tile-wide { grid-column: 1/-1; min-height: 82px; flex-direction: row; gap: 9px; background: var(--accent); color: var(--on-accent); font-weight: 700; }
.tile-note { grid-column: 1/-1; margin: 0; text-align: center; color: var(--muted); font-size: .85rem; }
#status:empty { display: none; }
#status { font-size: .9rem; color: var(--muted); margin: .4em 0; }
dialog {
  width: min(360px,calc(100% - 32px)); max-height: calc(100% - 24px); overflow: auto;
  background: var(--bg); color: var(--fg); border: 1px solid var(--panel); border-radius: 12px; padding: 16px;
}
dialog::backdrop { background: #101b20a6; }
dialog p { margin-top: 0; overflow-wrap: anywhere; }
@media (max-height: 520px) { footer { position: static; } }
@media (max-width: 330px) { .shell { padding-right: 10px; padding-left: 10px; } }
