:root {
  --brand: #E5383B;
  --brand-dark: #B3202A;
  --ink: #1d1b1a;
  --muted: #6f6a66;
  --bg: #fbf7f2;
  --card: #ffffff;
  --line: #ece5dc;
  --good: #1b8a5a;
  --good-bg: #e5f5ec;
  --warn-bg: #fff3d6;
  --radius: 14px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; padding-bottom: 90px; }
a { color: var(--brand-dark); }
img { max-width: 100%; }

.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: var(--bg); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.1rem; color: var(--ink); text-decoration: none; }
.brand img { border-radius: 8px; }
.wordmark, h1 { font-weight: 800; font-family: "Bricolage Grotesque", system-ui, sans-serif; letter-spacing: -0.02em; }
.wordmark { font-weight: 800; font-size: 1.6rem; line-height: 1; }
.logo { width: 72px; height: 72px; border-radius: 16px; }
nav { display: flex; gap: 14px; font-size: 1.3rem; }
nav a { text-decoration: none; position: relative; color: var(--ink); display: inline-flex; padding: 8px; }
#unread { position: absolute; top: 0; right: -2px; background: var(--brand); color: #fff; font-size: .65rem; border-radius: 99px; padding: 1px 5px; font-weight: 700; }

main { max-width: 720px; margin: 0 auto; padding: 16px; }
h1 { font-size: 1.4rem; margin: 4px 0 12px; }
h2 { font-size: 1.1rem; margin: 20px 0 8px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stack > * + * { margin-top: 12px; }

label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], select, textarea {
  width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 1rem; background: #fff; font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.check input { width: 20px; height: 20px; accent-color: var(--brand); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 10px;
  padding: 12px 18px; font-size: 1rem; font-weight: 700; cursor: pointer; background: var(--brand); color: #fff; text-decoration: none; }
.btn:hover { background: var(--brand-dark); }
.btn:disabled { opacity: .6; cursor: wait; }
.btn.ghost { background: transparent; color: var(--brand-dark); border: 1px solid var(--line); }
.btn.block { width: 100%; }
.btn.danger { background: transparent; color: #a01; border: 1px solid #f0c9c9; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }

.filters { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 8px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 6px 12px; font-size: .85rem; white-space: nowrap; cursor: pointer; }
.chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }

.items { display: grid; gap: 12px; }
.item { display: grid; grid-template-columns: 84px 1fr; gap: 12px; text-decoration: none; color: inherit; }
.item img, .thumb { width: 84px; height: 108px; object-fit: cover; border-radius: 10px; background: #f1ebe4; }
.item .title { font-weight: 650; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.store { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; }
.price { font-size: 1.15rem; font-weight: 800; }
.was { text-decoration: line-through; color: var(--muted); font-weight: 500; font-size: .9rem; margin-left: 6px; }
.badge { display: inline-block; font-size: .72rem; font-weight: 800; padding: 3px 8px; border-radius: 99px; margin-right: 4px; }
.badge.sale { background: var(--brand); color: #fff; }
.badge.down { background: var(--good-bg); color: var(--good); }
.badge.out { background: #eee; color: #555; }
.badge.target { background: var(--warn-bg); color: #8a5a00; }

.empty { text-align: center; padding: 40px 16px; }
.empty .big { font-size: 3rem; }

.product-head { display: grid; grid-template-columns: 120px 1fr; gap: 14px; }
.product-head img { width: 120px; height: 155px; object-fit: cover; border-radius: 12px; background: #f1ebe4; }
.sizes { display: flex; flex-wrap: wrap; gap: 8px; }
.size { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; background: #fff; cursor: pointer; font-size: .9rem; }
.size.sel { border-color: var(--brand); outline: 2px solid var(--brand); }
.size.oos { color: #999; text-decoration: line-through; }

.chart { width: 100%; height: 180px; }
.chart .line { fill: none; stroke: var(--brand); stroke-width: 2.5; }
.chart .area { fill: rgba(230, 57, 70, .08); }
.chart text { font-size: 10px; fill: var(--muted); }
.chart .grid { stroke: var(--line); }

.alert-row { display: block; padding: 12px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.alert-row.unread .t { font-weight: 800; }
.alert-row .t::before { content: "• "; color: var(--brand); }

.fab { position: fixed; right: 20px; bottom: calc(20px + env(safe-area-inset-bottom)); width: 58px; height: 58px; border-radius: 50%;
  background: var(--brand); color: #fff; font-size: 2rem; display: flex; align-items: center; justify-content: center;
  text-decoration: none; box-shadow: 0 6px 18px rgba(230,57,70,.35); }
#toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: var(--ink); color: #fff;
  padding: 10px 16px; border-radius: 10px; font-size: .9rem; max-width: 90vw; z-index: 10; }
.hero { text-align: center; padding: 18px 0 8px; }
.hero .big { font-size: 3.2rem; }
.store-list { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 10px; }
.saleNow { background: #FDECEC; color: #7E141B; border-radius: 10px; padding: 10px 12px; font-size: .9rem; line-height: 1.4; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--brand-dark); font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; }
.error { color: #a01; font-size: .9rem; }
.spinner { display: inline-block; width: 18px; height: 18px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -3px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 6-digit sign-in code */
.code-input { font-size: 1.6rem; letter-spacing: .5em; text-align: center; font-variant-numeric: tabular-nums; }
