:root {
  --bg: #fff7ec;
  --card: #ffffff;
  --ink: #35281f;
  --muted: #7c6a5c;
  --line: #f0e0cf;
  --accent: #ff6b5e;
  --accent-dark: #e14b3f;
  --accent-soft: #ffece8;
  --mint: #2ec4a6;
  --sun: #ffc94d;
  --sky: #58b6e8;
  --grape: #a78bfa;
  --radius: 20px;
  --shadow: 0 6px 18px rgba(120, 84, 50, .10);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 12% 8%, rgba(255, 201, 77, .38) 0 9%, transparent 9.5%),
    radial-gradient(circle at 88% 6%, rgba(88, 182, 232, .30) 0 7%, transparent 7.5%),
    radial-gradient(circle at 92% 42%, rgba(167, 139, 250, .26) 0 10%, transparent 10.5%),
    radial-gradient(circle at 6% 55%, rgba(46, 196, 166, .22) 0 8%, transparent 8.5%),
    radial-gradient(circle at 72% 92%, rgba(255, 107, 94, .18) 0 12%, transparent 12.5%),
    radial-gradient(circle at 22% 88%, rgba(255, 201, 77, .22) 0 6%, transparent 6.5%);
  background-attachment: fixed;
}

h1, h2, h3, .brand, .event-title, .product-name, .family-name, .button, .add-btn {
  font-family: 'Baloo 2', 'Nunito', system-ui, sans-serif;
}

.topbar {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 18px 18px 8px;
  max-width: 780px;
  margin: 0 auto;
}
.brand {
  color: var(--ink); font-weight: 800; text-decoration: none; font-size: 1.25rem;
  letter-spacing: -.01em;
}
.tagline { color: var(--muted); font-size: .85rem; }

main { max-width: 780px; margin: 0 auto; padding: 0 14px 44px; display: grid; gap: 16px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

h1 { font-size: 1.6rem; margin: 0 0 6px; letter-spacing: -.01em; }
h2 { font-size: 1.2rem; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
h3 { font-size: .85rem; margin: 0 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }

.meta { color: var(--muted); font-size: .9rem; margin: 2px 0; }
.hint { color: var(--muted); font-size: .9rem; margin: 10px 0 14px; }
.empty { color: var(--muted); font-style: italic; }
.crumbs { margin: 0 0 8px; font-size: .9rem; }
.crumbs a { color: var(--muted); text-decoration: none; font-weight: 600; }

.event-grid { display: grid; gap: 12px; }
.event-button {
  display: grid; gap: 2px; text-decoration: none; color: var(--ink);
  border: 2px solid #ffe0cf; border-radius: 16px; padding: 16px 18px;
  background: linear-gradient(135deg, #fff8ef, #fff);
  transition: transform .12s ease, box-shadow .12s ease;
}
.event-button:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(255, 107, 94, .18); border-color: var(--accent); }
.event-title { font-weight: 700; font-size: 1.15rem; }
.event-meta { color: var(--muted); font-size: .85rem; }
.event-cta { color: var(--accent); font-size: .9rem; font-weight: 800; margin-top: 6px; }

.stack { display: grid; gap: 12px; margin-top: 10px; }
label { display: grid; gap: 6px; font-size: .9rem; color: var(--muted); font-weight: 700; }
input, select {
  width: 100%; padding: 11px 13px; font: inherit; color: var(--ink);
  background: #fffdfa; border: 2px solid var(--line); border-radius: 12px;
}
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.button {
  display: inline-block; padding: 12px 18px; border: 0; border-radius: 999px;
  background: linear-gradient(135deg, #ff8a7a, var(--accent)); color: #fff;
  font: inherit; font-weight: 800; font-size: .95rem;
  cursor: pointer; text-decoration: none; text-align: center;
  box-shadow: 0 4px 0 var(--accent-dark);
  transition: transform .08s ease, box-shadow .08s ease;
}
.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--accent-dark); }
.button.small { padding: 9px 14px; font-size: .85rem; box-shadow: 0 3px 0 var(--accent-dark); }
.button.danger { background: linear-gradient(135deg, #f87171, #dc2626); box-shadow: 0 4px 0 #991b1b; }
.button.ghost { background: #fff; color: var(--ink); border: 2px solid var(--line); box-shadow: none; }

.dash { display: flex; gap: 16px; align-items: center; margin-top: 16px; flex-wrap: wrap; }
.donut {
  --pct: 0;
  width: 110px; height: 110px; flex: 0 0 auto; border-radius: 50%;
  background: conic-gradient(var(--mint) calc(var(--pct) * 1%), #ffe9d6 0);
  display: grid; place-items: center;
  box-shadow: inset 0 0 0 4px #fff;
}
.donut-center {
  width: 80px; height: 80px; border-radius: 50%; background: #fff;
  display: grid; place-content: center; text-align: center; line-height: 1.15;
  box-shadow: 0 2px 6px rgba(120, 84, 50, .12);
}
.donut-center strong { font-size: 1.1rem; font-family: 'Baloo 2', sans-serif; }
.donut-center span { font-size: .72rem; color: var(--muted); }
.kpis { display: flex; gap: 10px; flex: 1 1 180px; }
.kpi {
  flex: 1 1 0; min-width: 74px; text-align: center; background: #fff8ef;
  border: 2px solid #ffeedd; border-radius: 14px; padding: 10px 6px;
}
.kpi-label { display: block; font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 800; }
.kpi strong { font-size: 1.25rem; font-family: 'Baloo 2', sans-serif; }

.chart { display: grid; gap: 20px; }
.chart-group { display: grid; gap: 7px; }
.chart-cat {
  font-size: .78rem; font-weight: 800; color: var(--accent);
  text-transform: uppercase; letter-spacing: .08em;
}
.bar-row {
  display: grid; grid-template-columns: minmax(92px, 40%) 1fr 44px;
  align-items: center; gap: 9px; font-size: .88rem;
}
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.bar-track { height: 16px; border-radius: 999px; background: #f7ebdd; overflow: hidden; }
.bar {
  display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, #ffd166, #ff8a5b 55%, #ff6b5e);
}
.chart-group:nth-child(2) .bar { background: linear-gradient(90deg, #7ee0c9, #2ec4a6); }
.chart-group:nth-child(3) .bar { background: linear-gradient(90deg, #b9a7ff, #a78bfa); }
.chart-group:nth-child(4) .bar { background: linear-gradient(90deg, #8fd3ff, #58b6e8); }
.bar-value { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }

.family { border-top: 2px dashed #ffe7d4; padding-top: 14px; margin-top: 14px; }
.family:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }
.family-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.family-name { font-weight: 700; font-size: 1.02rem; }
.family-count { font-size: .78rem; color: var(--muted); font-weight: 700; }

.items { list-style: none; padding: 0; margin: 0; display: grid; gap: 7px; }
.item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border: 2px solid #f6ead9; border-radius: 14px;
  background: #fffdf8;
}
.item-main { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex: 1 1 auto; }
.item-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; text-align: left; }
.item-name { font-weight: 700; font-size: .98rem; letter-spacing: .01em; }
.pill {
  font-size: .82rem; color: #146356; background: #d9f6ee;
  border-radius: 999px; padding: 3px 11px; font-weight: 800; white-space: nowrap;
}
.pill.qty { margin-left: auto; }
.note { color: var(--muted); font-size: .82rem; }
.inline { margin: 0; }

.chk-form { flex: 0 0 auto; }
.chk {
  width: 24px; height: 24px; padding: 0;
  border: 2px solid #ffd9c7; border-radius: 50%; background: #fff;
  color: #fff; font-size: .8rem; line-height: 1; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.chk:hover { border-color: var(--mint); }
.chk.on { background: var(--mint); border-color: var(--mint); }
.fixed-mark { width: 24px; text-align: center; color: #d8c3ac; flex: 0 0 auto; line-height: 24px; font-size: 1.1rem; }
.item.done { background: #f2fdf9; border-color: #c9f0e5; }
.item.done .item-name { text-decoration: line-through; color: var(--muted); }

.link-danger { border: 0; background: none; color: #c9b6a2; font-size: 1rem; cursor: pointer; padding: 4px 7px; border-radius: 8px; }
.link-danger:hover { color: #dc2626; background: #fee2e2; }

.count {
  font-size: .78rem; font-weight: 800; color: var(--accent);
  background: var(--accent-soft); border-radius: 999px; padding: 2px 10px;
}

.who-label { margin-bottom: 4px; }
.who-label select { font-weight: 700; }

.shop { display: grid; gap: 20px; }
.shop-group h3 { margin: 0 0 9px; }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 12px; }
.product {
  display: grid; gap: 7px; justify-items: center; text-align: center;
  border: 2px solid #ffeede; border-radius: 16px; padding: 14px 10px 12px;
  background: #fffdf8;
  transition: transform .1s ease, box-shadow .1s ease;
}
.product:hover { transform: translateY(-2px); box-shadow: 0 6px 14px rgba(120, 84, 50, .12); border-color: #ffd7c0; }
.product-emoji {
  font-size: 1.9rem; line-height: 1; width: 52px; height: 52px; border-radius: 50%;
  display: grid; place-items: center; background: #fff4e6;
}
.shop-group:nth-child(2) .product-emoji { background: #e9fbf6; }
.shop-group:nth-child(3) .product-emoji { background: #fff2d9; }
.shop-group:nth-child(4) .product-emoji { background: #eef4ff; }
.product-name { font-weight: 700; font-size: .92rem; min-height: 2.4em; display: flex; align-items: center; }
.stepper {
  display: inline-flex; align-items: center; gap: 8px;
  border: 2px solid #ffe4d3; border-radius: 999px; background: #fff; padding: 3px;
}
.stepper .step {
  width: 28px; height: 28px; border: 0; border-radius: 50%; background: #fff0e4;
  color: var(--accent); font-size: 1.05rem; line-height: 1; cursor: pointer; font-weight: 800;
}
.stepper .step:hover { background: #ffe1d0; }
.stepper .qnum { min-width: 20px; font-weight: 800; font-size: .95rem; font-family: 'Baloo 2', sans-serif; }
.product-form { width: 100%; }
.add-btn {
  width: 100%; border: 0; border-radius: 12px; padding: 9px 10px;
  background: linear-gradient(135deg, #57d9be, var(--mint)); color: #fff;
  font: inherit; font-weight: 800; font-size: .88rem; cursor: pointer;
  box-shadow: 0 3px 0 #1f977f;
}
.add-btn:hover { filter: brightness(1.05); }
.add-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #1f977f; }

.new-title { margin-top: 24px; }

.people-edit-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 7px; }
.people-edit-row { display: flex; align-items: center; gap: 6px; }
.people-edit { display: grid; grid-template-columns: 1fr auto; gap: 6px; flex: 1 1 auto; }
.people-edit input { padding: 7px 9px; font-size: .9rem; border-width: 1.5px; }
.access-form { display: grid; grid-template-columns: 1fr auto auto; gap: 6px; margin: 10px 0 4px; }
.access-form input { padding: 8px 10px; font-size: .95rem; letter-spacing: .08em; text-transform: uppercase; }
.gate { max-width: 460px; margin: 40px auto; text-align: left; }

.people-add { display: grid; grid-template-columns: 1fr auto; gap: 6px; margin: 10px 0; }
.people-add input { padding: 8px 10px; font-size: .9rem; }

.preset-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.preset-row, .preset-edit-row {
  display: flex; align-items: center; gap: 6px;
  border: 2px solid #f5e8d8; border-radius: 12px; padding: 7px 10px; font-size: .9rem;
  background: #fffdf8;
}
.preset-edit { display: grid; grid-template-columns: 1fr 112px auto; gap: 6px; flex: 1 1 auto; }
.preset-edit input, .preset-edit select { padding: 7px 9px; font-size: .88rem; border-width: 1.5px; }

.admin-items { margin: 14px 0 6px; border: 2px dashed #f3e1cc; border-radius: 12px; padding: 8px 12px; background: #fffaf3; }
.admin-items summary { cursor: pointer; font-weight: 800; font-size: .88rem; color: var(--muted); }
.admin-items[open] summary { margin-bottom: 8px; }

.delete-form { margin-top: 10px; }
.error { color: #b91c1c; font-size: .9rem; margin: 8px 0 0; font-weight: 700; }
code { background: #fff0e2; padding: 1px 6px; border-radius: 6px; font-size: .85em; }
.muted-small { color: var(--muted); font-size: .8rem; }

@media (max-width: 420px) {
  .card { padding: 15px; border-radius: 16px; }
  h1 { font-size: 1.35rem; }
  .two { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: minmax(80px, 40%) 1fr 38px; }
  .shop-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
