:root {
  --primary: #5d4037;
  --secondary: #f5e6cc;
  --accent: #d4a358;
  --accent-gold: #e9c56a;
  --red: #b5493a;
  --green: #7a9b5b;
  --muted: #a99a84;
  --surface: #efe1c6;
  --line: rgba(93, 64, 55, 0.18);
  --shadow: rgba(93, 64, 55, 0.28);
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  background: transparent;
}

body {
  color: var(--primary);
  font-family: Georgia, "Times New Roman", serif;
  overflow: hidden;
}

/* ---- tablecloth background ---- */
.tablecloth {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(ellipse at 50% 22%, rgba(255, 250, 235, 0.85), transparent 55%),
    linear-gradient(160deg, rgba(255,251,240,0.4), rgba(229,215,180,0.15)),
    var(--secondary);
}

.tablecloth::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(0deg, rgba(245,230,204,0.6) 1px, transparent 1px) 0 0 / 100% 9px,
    linear-gradient(90deg, rgba(245,230,204,0.5) 1px, transparent 1px) 0 0 / 9px 100%,
    radial-gradient(ellipse 40% 26% at 70% 78%, rgba(173,149,120,0.22), transparent);
}

.tablecloth::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(255,255,255,0.14) 1px, transparent 1px) 0 0 / 26px 26px,
    linear-gradient(60deg, rgba(93,64,55,0.06) 1px, transparent 1px) 0 0 / 26px 26px;
}

.warm-glow {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: radial-gradient(circle at 50% 12%, rgba(233,197,106,0.20), transparent 45%);
  pointer-events: none;
}

/* ---- header ---- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: linear-gradient(180deg, rgba(245,230,204,0.92), rgba(239,225,198,0.86));
  border-bottom: 1px solid var(--line);
  padding: 10px 16px calc(10px + env(safe-area-inset-top, 0px));
  text-align: center;
}

.app-header .brand { display: inline-flex; align-items: center; gap: 8px; }

.brand-icon {
  width: 22px; height: 22px;
  background: var(--accent);
  border-radius: 6px 6px 4px 4px;
  box-shadow: 0 1px 0 rgba(93,64,55,0.25);
}

.app-header h1 {
  margin: 0;
  font-family: Georgia, serif;
  font-size: 26px;
  letter-spacing: 0.5px;
}

.subtitle {
  display: block;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-top: 1px;
}

/* ---- stage / views ---- */
.stage { padding: 12px 16px 8px; }

.view { animation: rise 0.28s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.hidden-view { display: none; }

/* ---- Home dashboard ---- */
.section-label {
  display: block;
  margin: 4px 0 14px;
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
}

.shakers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  justify-content: center;
}

.shaker { display: flex; flex-direction: column; align-items: center; }

.shaker-body {
  position: relative;
  width: 74px;
  height: 92px;
  background: linear-gradient(160deg, #e8dcc0, #d8c49c);
  border-radius: 46px 46px 34px 34px;
  border: 1px solid rgba(93,64,55,0.22);
  box-shadow: inset 0 -8px rgba(255,255,255,0.35), 0 6px rgba(93,64,55,0.22);
}

.shaker-body.salt {
  background: linear-gradient(165deg, #f2ead0, #e2d3ad);
  border-radius: 38px 50px 34px 40px;
}
.shaker-body.pepper {
  background: linear-gradient(165deg, #8a8371, #5f5a4b);
  border-radius: 50px 38px 40px 34px;
}

.shaker-cap {
  position: absolute;
  top: -10px; left: 18px;
  width: 38px; height: 16px;
  background: rgba(240,230,205,0.9);
  border-radius: 4px;
}

.shaker-flag {
  position: absolute;
  top: -26px; left: 50%;
  transform: translateX(-50%);
  background: var(--secondary);
  color: var(--primary);
  font-weight: 700;
  font-size: 15px;
  padding: 1px 7px;
  border-radius: 2px;
  box-shadow: 0 1px 0 rgba(93,64,55,0.3);
  white-space: nowrap;
}

.shaker-label {
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.5px;
}

.upcoming-list { list-style: none; margin: 10px 0 0; padding: 0; }
.upcoming-list li { margin-bottom: 10px; }

.section-label.sub { margin-top: 6px; }

/* ---- tent cards ---- */
.tent-card {
  position: relative;
  background: linear-gradient(170deg, #fbf4e0, #efe3c4);
  border: 1px solid var(--line);
  border-radius: 8px 8px 3px 3px;
  box-shadow: 0 4px 0 rgba(255,255,255,0.5), 0 5px rgba(93,64,55,0.2);
  padding: 12px 14px 11px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform 0.15s ease;
  overflow: hidden;
}

.tent-card.faded { opacity: 0.62; }
.tent-card.deleting { transform: translateX(-78%); transition: transform 0.24s ease; }
.tent-card.restoring { opacity: 0.55; transform: translateY(8px); transition: 0.4s ease; }

.ribbon {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 7px;
}
.ribbon.red { background: repeating-linear-gradient(45deg, var(--red), var(--red) 8px, #d0654f 8px, #d0654f 16px); }
.ribbon.gold { background: repeating-linear-gradient(45deg, var(--accent), var(--accent) 8px, var(--accent-gold) 8px, var(--accent-gold) 16px); }
.ribbon.green { background: repeating-linear-gradient(45deg, var(--green), var(--green) 8px, #9db479 8px, #9db479 16px); }

.ribbon-tail { position: absolute; left: -7px; top: -4px; width: 14px; height: 16px; }

.tent-name {
  font-family: "Segoe Print", "Bradley Hand ITC", "Comic Sans MS", cursive;
  font-size: 19px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.1;
}

.tent-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.tent-date {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1.5px solid var(--accent);
  background: rgba(233,197,106,0.16);
  color: var(--primary);
  font-family: Georgia, serif;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.05;
  text-align: center;
}

.headcount {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(93,64,55,0.12);
  color: var(--primary);
  border-radius: 10px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
}
.headcount svg { width: 11px; height: 11px; fill: var(--primary); }

.tent-notes {
  font-size: 12.5px;
  color: #8a6f57;
  font-style: italic;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-actions {
  position: absolute;
  top: 9px; right: 9px;
  display: flex; gap: 8px;
}

.icon-btn {
  width: 26px; height: 26px;
  padding: 0;
  background: rgba(245,230,204,0.85);
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--primary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.icon-btn svg { width: 14px; height: 14px; fill: currentColor; }

.seal {
  position: absolute;
  top: 8px; right: 10px;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: radial-gradient(circle, #c9b6d8, #7c6f8a);
  border: 2px solid rgba(93,64,55,0.4);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.25), 0 1px rgba(93,64,55,0.3);
  display: flex; align-items: center; justify-content: center;
}
.seal::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #4a4250; }

.swipe-hint { position: absolute; left: 6px; bottom: 5px; font-size: 9px; color: var(--muted); }

/* ---- empty state ---- */
.empty {
  text-align: center;
  padding: 34px 18px;
  color: var(--primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.empty .napkin {
  width: 86px; height: 74px;
  background: linear-gradient(160deg, #efe6cb, #e0d0a8);
  border-radius: 8px;
  box-shadow: 0 3px rgba(93,64,55,0.2);
  position: relative;
}
.empty .napkin::before { content: ""; position: absolute; inset: 6px 4px; border: 1px dashed rgba(93,64,55,0.3); }
.empty p { margin: 0; font-size: 15px; font-family: Georgia, serif; font-style: italic; color: #8a6f57; }
.empty small { color: var(--muted); }

/* ---- search bar ---- */
.search-wrap { position: sticky; top: 60px; z-index: 20; margin-bottom: 14px; }

.search {
  width: 100%;
  padding: 10px 14px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: rgba(255,252,240,0.7);
  color: var(--primary);
  font-family: Georgia, serif;
  font-size: 14px;
  box-shadow: 0 1px rgba(93,64,55,0.12);
}
.search::placeholder { color: var(--muted); font-style: italic; }

/* ---- Add form ---- */
.form-card {
  background: linear-gradient(180deg, #fbf4e0, #eee0c0);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 6px rgba(93,64,55,0.2);
  padding: 18px 16px;
}

.form-field { margin-bottom: 14px; }

.form-field label {
  display: block;
  font-size: 12px;
  letter-spacing: 0.5px;
  color: var(--primary);
  margin-bottom: 6px;
  font-weight: 700;
}

.form-field input, .form-field textarea {
  width: 100%;
  padding: 11px 13px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255,252,242,0.75);
  color: var(--primary);
  font-family: Georgia, serif;
  font-size: 15px;
  box-shadow: inset 0 1px rgba(255,255,255,0.5);
}
.form-field textarea { min-height: 78px; resize: vertical; }
.form-field input:focus, .form-field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(212,163,88,0.3); }

.form-error { color: var(--red); font-size: 12px; display: none; margin-top: 3px; }
.form-field.invalid .form-error { display: block; }
.form-field.invalid input, .form-field.invalid textarea { border-color: var(--red); }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.form-actions { display: flex; gap: 12px; margin-top: 8px; }
.btn {
  flex: 1;
  padding: 13px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  font-family: Georgia, serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--secondary);
  background: linear-gradient(180deg, var(--accent), #c3914a);
  box-shadow: 0 3px rgba(93,64,55,0.25);
}
.btn.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
}
.btn.danger { background: linear-gradient(180deg, #b5493a, #93402f); color: var(--secondary); }

.editing-badge {
  display: none;
  margin: 2px 0 12px;
  font-size: 12.5px;
  font-style: italic;
  color: var(--muted);
  text-align: center;
}

/* ---- bottom silverware tray ---- */
.tray {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
  padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
}

.tray-tray {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: calc(58px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, #c3c3c6, #9a9a9e 55%, #b6b6ba);
  border-radius: 10px 10px 0 0;
  box-shadow: inset 0 4px rgba(255,255,255,0.55), inset 0 -4px rgba(93,64,55,0.25), 0 2px rgba(93,64,55,0.3);
}

.utensil {
  position: relative;
  z-index: 2;
  flex: 1;
  height: 52px;
  padding: 0;
  background: transparent;
  border: none;
  color: #5a5a5d;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.utensil svg { width: 22px; height: 22px; fill: currentColor; }
.utensil span { font-size: 10px; color: #6b6b6e; }

.utensil.active {
  color: var(--accent-gold);
  text-shadow: 0 0 6px rgba(233,197,106,0.6);
  transform: translateY(-4px);
}
.utensil.active span { color: var(--accent-gold); font-weight: 700; }

/* ---- modal ---- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(61,42,35,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal[hidden] { display: none; }
.modal-card {
  background: var(--secondary);
  border-radius: 16px;
  border: 1px solid var(--line);
  box-shadow: 0 8px rgba(93,64,55,0.35);
  padding: 20px 18px;
  max-width: 280px;
  text-align: center;
}
.modal-card p { margin: 0 0 14px; color: var(--primary); font-family: Georgia, serif; font-size: 15px; line-height: 1.4; }
.modal-actions { display: flex; gap: 12px; }

/* ---- info row ---- */
.info-row {
  display: flex;
  justify-content: center;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.5px;
  padding: 10px 0 4px;
  margin-top: 18px;
}
.info-row span { display: inline-flex; align-items: center; gap: 4px; }

/* ---- toast ---- */
#toast {
  position: fixed;
  top: calc(16px + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  background: rgba(93,64,55,0.9);
  color: var(--secondary);
  padding: 9px 16px;
  border-radius: 18px;
  font-family: Georgia, serif;
  font-size: 13px;
  z-index: 80;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
#toast.show { opacity: 1; }

/* safe-area base pad so content clears tray */
.stage { padding-bottom: 76px; }