:root {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --ink: #10172a;
  --muted: #6b7590;
  --line: #e3e8f2;
  --brand: #4f8cff;
  --ok: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 ui-sans-serif, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 20px; }

/* ── Header ── */
header {
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
}
.bar {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 62px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 600;
  white-space: nowrap;
}
.brand strong { color: var(--brand); font-weight: 800; }
.mark { font-size: 22px; }

#search { flex: 1; }
#q {
  width: 100%;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  font: inherit;
  color: inherit;
}
#q:focus { outline: 2px solid var(--brand); outline-offset: -1px; background: #fff; }

.who {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}
.who select {
  font: inherit;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

/* ── Sections ── */
main { padding: 28px 0 40px; display: grid; gap: 32px; }
.head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}
h2 { font-size: 17px; margin: 0; }
.muted { color: var(--muted); font-size: 13px; }

.link {
  background: none;
  border: 0;
  color: var(--brand);
  font: inherit;
  cursor: pointer;
  padding: 0;
}
.link:hover { text-decoration: underline; }

/* ── Product grid ── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.card h3 { margin: 0; font-size: 15px; font-weight: 600; }
.price { font-size: 19px; font-weight: 800; }
.card .row { display: flex; align-items: center; gap: 8px; margin-top: auto; }
.card input[type=number] {
  width: 62px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
}

.badge {
  align-self: flex-start;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
}
.badge.in { background: #dcfce7; color: var(--ok); }
.badge.out { background: #fee2e2; color: var(--bad); }

button.buy {
  flex: 1;
  padding: 9px 12px;
  border: 0;
  border-radius: 9px;
  background: var(--brand);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
button.buy:hover { filter: brightness(1.06); }
button.buy:disabled { background: #cbd5e1; cursor: not-allowed; }

/* ── Orders ── */
table { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: var(--radius); overflow: hidden; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); font-size: 14px; }
th { font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); background: #fafbfe; }
tr:last-child td { border-bottom: 0; }
td.actions { text-align: right; white-space: nowrap; }

.pill { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.pill.PLACED { background: #dbeafe; color: #1d4ed8; }
.pill.CANCELLED { background: #f1f5f9; color: var(--muted); }
.pill.REFUNDED { background: #fef3c7; color: var(--warn); }

button.act {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 5px 11px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  margin-left: 6px;
}
button.act:hover { border-color: var(--brand); color: var(--brand); }
button.act.danger:hover { border-color: var(--bad); color: var(--bad); }

.empty {
  background: var(--panel);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
  color: var(--muted);
}

/* ── Toast ── */
#toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: #fff;
  padding: 11px 18px;
  border-radius: 10px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  max-width: 90vw;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.bad { background: var(--bad); }

footer { padding: 0 20px 34px; }

/* ── Multi-screen additions ── */
#nav { display: flex; gap: 4px; }
#nav a {
  padding: 6px 12px; border-radius: 8px; text-decoration: none;
  color: inherit; font-weight: 500; font-size: 14px;
}
#nav a:hover { background: rgb(0 0 0 / .05); }
#nav a.active { background: #0f766e; color: #fff; }

.screen[hidden] { display: none; }
.back { margin-bottom: 12px; }

.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid #d4d4d8; background: #fff; border-radius: 999px;
  padding: 3px 12px; font-size: 13px; cursor: pointer;
}
.chip.on { background: #0f766e; border-color: #0f766e; color: #fff; }

.panel {
  background: #fff; border: 1px solid #e4e4e7; border-radius: 12px;
  padding: 16px; margin-bottom: 16px;
}
.detail { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.detail .rating { margin-top: 8px; color: #b45309; font-size: 15px; }
.price.big { font-size: 24px; margin-bottom: 10px; }
.buybox { min-width: 320px; }
.buybox .row { flex-wrap: wrap; align-items: center; gap: 10px; }
.buybox label { font-size: 13px; color: #52525b; display: flex; gap: 6px; align-items: center; }
.expresslabel { white-space: nowrap; }

.review {
  background: #fff; border: 1px solid #e4e4e7; border-radius: 10px;
  padding: 10px 14px; margin-bottom: 8px;
}
.review .stars { color: #b45309; margin-right: 8px; }
.review p { margin: 6px 0 0; color: #3f3f46; }

#review-form .row { align-items: center; gap: 10px; }
#review-form input[type="text"] {
  flex: 1; border: 1px solid #d4d4d8; border-radius: 8px; padding: 8px 10px;
}
#review-form h3 { margin: 0 0 10px; font-size: 15px; }

.row.spread { justify-content: space-between; align-items: center; }

.timeline { margin-top: 14px; }
.leg { display: flex; align-items: center; gap: 10px; padding: 6px 0; color: #a1a1aa; }
.leg .dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: #e4e4e7; border: 2px solid #d4d4d8; flex: none;
}
.leg.done { color: #18181b; }
.leg.done .dot { background: #0f766e; border-color: #0f766e; }
.leg.cancelled { opacity: .5; }

.notice {
  background: #fff; border: 1px solid #e4e4e7; border-left: 4px solid #0f766e;
  border-radius: 10px; padding: 10px 14px; margin-bottom: 8px;
}
.notice.suppressed { border-left-color: #a1a1aa; opacity: .7; }
.notice p { margin: 6px 0 0; color: #3f3f46; font-size: 14px; }

.pill.CANCELLED { background: #fee2e2; color: #b91c1c; }
