:root {
  --ink: #1d1a16;
  --muted: #5a544c;
  --bg: #fffdf8;
  --card: #ffffff;
  --line: #d9d2c5;
  --accent: #9a3b1c;
  --accent-dark: #7a2d13;
  --ok-bg: #e8f5e9;
  --ok-ink: #1b5e20;
  --err-bg: #fdecea;
  --err-ink: #8e1a10;
}

* { box-sizing: border-box; }

html { font-size: 18px; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
}

.site-header {
  background: var(--accent);
  color: #fff;
  padding: 1rem;
}
.site-header h1 { margin: 0; font-size: 1.4rem; text-align: center; }
.site-header a { color: inherit; text-decoration: none; }

.container {
  max-width: 760px;
  margin: 0 auto;
  padding: 1rem 1rem 8rem;
}

.intro { font-size: 1.1rem; }

h2 {
  font-size: 1.5rem;
  margin: 2rem 0 0.75rem;
  padding-bottom: 0.25rem;
  border-bottom: 3px solid var(--accent);
}
h3 { font-size: 1.25rem; margin-top: 2rem; }

.field { margin: 1rem 0; }
.field label { display: block; font-weight: 700; margin-bottom: 0.35rem; }
.field input, .field textarea {
  width: 100%;
  font: inherit;
  padding: 0.7rem 0.8rem;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}
.field input:focus, .field textarea:focus, .qty-input:focus, button:focus-visible, a:focus-visible {
  outline: 3px solid #1a5fb4;
  outline-offset: 2px;
}

.products { list-style: none; margin: 0; padding: 0; }
.product {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line);
}
.thumb {
  width: 72px; height: 72px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
  background: #eee;
}
.thumb-empty { display: inline-block; }
.product-info { flex: 1; min-width: 0; }
.product-title { display: block; font-weight: 600; }
.product-price { display: block; color: var(--accent-dark); font-weight: 700; font-size: 1.1rem; }

.qty { display: flex; align-items: center; gap: 0.25rem; flex-shrink: 0; }
.qty-btn {
  width: 48px; height: 48px;
  font-size: 1.5rem;
  line-height: 1;
  border: 2px solid var(--accent);
  background: #fff;
  color: var(--accent);
  border-radius: 8px;
  cursor: pointer;
}
.qty-btn:hover { background: var(--accent); color: #fff; }
.qty-input {
  width: 64px; height: 48px;
  font: inherit;
  font-size: 1.2rem;
  text-align: center;
  border: 2px solid var(--line);
  border-radius: 8px;
  -moz-appearance: textfield;
}
.qty-input::-webkit-outer-spin-button, .qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.summary-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: var(--card);
  border-top: 2px solid var(--line);
  box-shadow: 0 -4px 16px rgba(0,0,0,0.08);
  padding: 0.75rem 1rem;
}
.summary-inner { max-width: 760px; margin: 0 auto; }

.review { max-width: 760px; margin: 0 auto 0.5rem; border-bottom: 1px solid var(--line); }
.review summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 48px;
  padding: 0.4rem 0;
  cursor: pointer;
  font-weight: 700;
  list-style: none;
}
.review summary::-webkit-details-marker { display: none; }
.review summary::before { content: "▸"; margin-right: 0.5rem; color: var(--accent); }
.review[open] summary::before { content: "▾"; }
.review summary > span:first-of-type { flex: 1; }
.review-count { color: var(--muted); font-weight: 400; }
.review-list { list-style: none; margin: 0; padding: 0 0 0.5rem; max-height: 40vh; overflow-y: auto; }
.review-list li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.35rem 0; border-top: 1px solid #eee; }
.review-empty { margin: 0 0 0.5rem; color: var(--muted); }
.summary-text { display: flex; justify-content: space-between; font-size: 1.1rem; margin-bottom: 0.5rem; }

.btn-primary, .btn-secondary {
  display: block;
  width: 100%;
  min-height: 56px;
  font: inherit;
  font-size: 1.2rem;
  font-weight: 700;
  border-radius: 10px;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  padding: 0.75rem 1rem;
}
.btn-primary { background: var(--accent); color: #fff; border: 0; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-secondary { background: #fff; color: var(--accent); border: 2px solid var(--accent); }
.btn-link { display: inline-block; margin-top: 0.75rem; color: var(--accent-dark); font-weight: 600; }
.actions { margin-top: 1.5rem; text-align: center; }

.notice, .error {
  padding: 1rem;
  border-radius: 10px;
  margin: 1rem 0;
  font-size: 1.05rem;
}
.notice { background: #fff6e5; border: 2px solid #e8c88a; }
.notice p { margin: 0.25rem 0; }
.notice.success { background: var(--ok-bg); border-color: #9ccc9f; color: var(--ok-ink); }
.error { background: var(--err-bg); border: 2px solid #f1a9a0; color: var(--err-ink); font-weight: 600; }

.recap { width: 100%; border-collapse: collapse; margin: 1rem 0; }
.recap th, .recap td { padding: 0.6rem 0.5rem; border-bottom: 1px solid var(--line); text-align: left; }
.recap th.num, .recap td.num { text-align: right; white-space: nowrap; }
.recap tfoot th { font-size: 1.15rem; }

.order-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  margin: 1rem 0;
}
.order-card h4 { margin: 0 0 0.5rem; font-size: 1.1rem; }
.order-card h4 small { color: var(--muted); font-weight: 400; margin-left: 0.5rem; }
.order-card ul { margin: 0.25rem 0; padding-left: 1.25rem; }

@media (min-width: 600px) {
  .summary-inner { display: flex; align-items: center; gap: 1rem; }
  .summary-text { margin: 0; flex: 1; gap: 1.5rem; justify-content: flex-start; }
  .btn-primary { width: auto; min-width: 240px; }
  .btn-secondary { display: inline-block; width: auto; }
}

@media print {
  .site-header, .actions, .summary-bar { display: none; }
  body { background: #fff; }
}
