/* IdaHome Eats — shared portal styling.
   Palette from IdaHome_Eats_Branding_Style_Guide.md.
   Mobile-first; the vendor credit screen is used one-handed at the window. */

:root {
  /* --- IdaHome Eats brand palette --- */
  --pine:     #1F5E3B;   /* navigation, primary buttons, headers */
  --pine-700: #17492E;   /* pressed/hover pine */
  --gold:     #E8A317;   /* CTA buttons, icons, premium highlights */
  --gold-700: #C0870F;   /* pressed/hover gold */
  --red:      #C94A2F;   /* Open Now, specials, promotions, errors */
  --blue:     #4DA8DA;   /* maps, GPS markers, link accents */
  --blue-700: #2C7EB0;   /* link TEXT (darkened for AA contrast on white) */
  --paper:    #F8F6F2;   /* main background (Warm Off White) */
  --card:     #FFFFFF;
  --ink:      #2E2E2E;   /* primary text (Charcoal) */
  --muted:    #6F6D68;   /* muted charcoal */
  --line:     #E7E3DB;   /* hairline on the warm background */
  --ok:       #1F5E3B;   /* success = pine */
  --err:      #C94A2F;   /* error = rustic red */
  --radius:   14px;

  /* Back-compat aliases: existing var(--spruce/--amber) refs keep working. */
  --spruce:     var(--pine);
  --spruce-700: var(--pine-700);
  --amber:      var(--gold);
  --amber-700:  var(--gold-700);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* --- chrome --------------------------------------------------------------- */
.topbar {
  background: var(--spruce);
  padding: 14px 18px;
}
.brand {
  color: var(--paper);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: .2px;
}
.brand span { color: var(--amber); font-weight: 600; }

.shell { max-width: 560px; margin: 0 auto; padding: 18px 16px 40px; }
.shell.wide { max-width: 1040px; }

.foot {
  max-width: 560px;
  margin: 0 auto;
  padding: 24px 16px 40px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

/* --- centered auth cards (login / register) ------------------------------- */
.wrap {
  min-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 22px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.card h1 { margin: 0 0 4px; font-size: 22px; }

/* --- panels (dashboard / rewards / credit) -------------------------------- */
.page { display: grid; gap: 16px; }
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 18px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.panel h2 { margin: 0 0 10px; font-size: 17px; }

.sub { color: var(--muted); margin: 0 0 16px; font-size: 14px; }
.alt { margin-top: 16px; font-size: 14px; color: var(--muted); }
.alt a, .card a, .linkrow a.link { color: var(--blue-700); }

.pending {
  background: #fbf1dd;
  border: 1px solid #eddcb4;
  color: #7a5715;
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 14px;
}

/* rows */
.balance-row, .fav-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.balance-row:first-of-type, .fav-row:first-of-type { border-top: 0; }
.name { font-weight: 600; }
.pts { font-weight: 700; color: var(--spruce); }
.pts small { color: var(--muted); font-weight: 500; }
.empty { color: var(--muted); font-size: 14px; margin: 4px 0; }

.linkrow { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.linkrow a {
  display: inline-block;
  padding: 10px 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 600;
  font-size: 14px;
}

/* --- forms ---------------------------------------------------------------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 12px 12px;
  font-size: 16px;              /* 16px keeps iOS from zooming on focus */
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-family: inherit;
}
.field textarea { resize: vertical; line-height: 1.5; }
.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(232,163,23,.20);
}
.field input.code {
  letter-spacing: .4em;
  text-align: center;
  font-size: 22px;
}

.btn {
  width: 100%;
  padding: 13px 16px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  background: var(--spruce);
  border: 0;
  border-radius: 10px;
  cursor: pointer;
}
.btn:hover { background: var(--spruce-700); }
.btn:disabled { opacity: .6; cursor: default; }
.btn.secondary {
  background: transparent;
  color: var(--pine);
  border: 1px solid var(--line);
}
/* Highest-intent CTA (sign up, subscribe to Premium): Sunset Gold. Charcoal
   text on gold reads better than white and meets AA. */
.btn.cta { background: var(--gold); color: var(--ink); }
.btn.cta:hover { background: var(--gold-700); color: #fff; }

/* Status badges from the brand guide. */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.6;
}
.badge-open    { background: var(--red);  color: #fff; }   /* Open Now */
.badge-special { background: var(--gold); color: var(--ink); } /* Specials/Promos */
.badge-premium { background: var(--pine); color: #fff; }   /* Premium highlight */

/* --- notes / flashes / results ------------------------------------------- */
.note, .flash {
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  margin-bottom: 14px;
}
.note { background: #fbe9e6; border: 1px solid #f0ccc6; color: var(--err); }
.flash { background: #e8f2ea; border: 1px solid #cfe4d4; color: var(--ok); }

.result {
  margin-top: 14px;
  border-radius: 10px;
  padding: 12px 14px;
  font-weight: 600;
  font-size: 15px;
}
.result.ok  { background: #e8f2ea; border: 1px solid #cfe4d4; color: var(--ok); }
.result.err { background: #fbe9e6; border: 1px solid #f0ccc6; color: var(--err); }

/* --- rewards editor ------------------------------------------------------- */
.help { color: var(--muted); font-size: 13px; margin: 4px 0 0; }

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 0 16px;
}
.switch-row label { font-weight: 600; }
.switch-row input[type="checkbox"] {
  width: 22px; height: 22px;
  accent-color: var(--pine);
  cursor: pointer;
}

/* smaller, auto-width buttons for row actions */
.btn.sm { width: auto; padding: 8px 12px; font-size: 13px; }
.btn.danger { background: transparent; color: var(--red); border: 1px solid #e6c9c2; }
.btn.danger:hover { background: var(--red); color: #fff; }

.reward-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.reward-item:first-of-type { border-top: 0; }
.reward-item .r-title { font-weight: 600; }
.reward-item .r-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.reward-item .r-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.muted-row { opacity: .6; }
.badge-off {
  display: inline-block; margin-left: 6px; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 700; background: var(--line); color: var(--muted);
  vertical-align: middle;
}

/* two-up field row that stacks on narrow screens */
.inline { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.inline .field { margin-bottom: 14px; }

/* --- admin dashboard ------------------------------------------------------ */
.admin-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.admin-head h1 { margin: 0; font-size: 24px; }
.admin-who { color: var(--muted); font-size: 14px; }
.admin-who a { color: var(--blue-700); font-weight: 600; }

.admin-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.stat-tile { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; box-shadow: var(--shadow-sm, 0 1px 2px rgba(0,0,0,.04)); }
.stat-tile strong { display: block; font-size: 26px; font-weight: 800; line-height: 1; }
.stat-tile span { color: var(--muted); font-size: 13px; }
.stat-tile.hot { border-color: var(--gold); background: #fdf6e9; }
@media (max-width: 600px) { .admin-stats { grid-template-columns: 1fr 1fr; } }

.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.tab { padding: 8px 14px; border-radius: 9px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font-weight: 600; font-size: 14px; text-decoration: none; }
.tab:hover { border-color: var(--line-2, #ded9cd); }
.tab.active { background: var(--pine); color: #fff; border-color: var(--pine); }
.tab-badge { display: inline-block; background: var(--gold); color: var(--ink); border-radius: 999px; padding: 0 7px; font-size: 12px; font-weight: 800; margin-left: 4px; }

.table-scroll { overflow-x: auto; }
.vtable { width: 100%; border-collapse: collapse; font-size: 14px; }
.vtable th { text-align: left; padding: 10px 12px; border-bottom: 2px solid var(--line); color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; }
.vtable td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.vtable tr:last-child td { border-bottom: 0; }
.vtable .slug { color: var(--muted); font-size: 12px; }
.vtable .muted { color: var(--muted); }
.wrap-cell { word-break: break-word; max-width: 220px; }
.row-actions { display: flex; gap: 6px; }

/* Admin: inline state dropdown + editable contact panel */
.state-sel { padding: 5px 8px; font-size: 13px; border: 1px solid var(--line); border-radius: 8px; background: var(--card, #fff); }
.edit-contact { margin-top: 8px; }
.edit-contact > summary { cursor: pointer; color: var(--muted); font-size: 12px; list-style: none; user-select: none; }
.edit-contact > summary::-webkit-details-marker { display: none; }
.edit-contact > summary::before { content: "✎ "; }
.edit-contact[open] > summary { color: var(--ink, inherit); font-weight: 600; }
.contact-edit { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; min-width: 200px; }
.contact-edit label { display: flex; flex-direction: column; gap: 2px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.contact-edit input { padding: 7px 9px; font-size: 16px; border: 1px solid var(--line); border-radius: 8px; text-transform: none; letter-spacing: normal; }
.contact-edit .btn.sm { align-self: flex-start; margin-top: 2px; }
.flash-err { background: #fbe9e7; border: 1px solid #f3c0bb; color: #a12318; }

.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.pill-pending   { background: #fbf1dd; color: #7a5715; }
.pill-active    { background: #e2f0e6; color: var(--ok); }
.pill-suspended { background: #fbe9e6; color: var(--err); }
.pill-closed    { background: var(--line); color: var(--muted); }
.pill-premium   { background: #fdf2d6; color: #8a6100; box-shadow: inset 0 0 0 1px #eccf83; }

.btn.ok { background: var(--pine); color: #fff; }
.btn.ok:hover { background: var(--pine-700); }
.btn.gold { background: var(--gold, #e8a417); color: #3a2a00; }
.btn.gold:hover { filter: brightness(0.95); }

/* --- "how points work" explainer (customer sign-in) ----------------------- */
.explainer {
  max-width: 400px; margin: 18px auto 0;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 22px; box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.explainer h2 { margin: 0 0 14px; font-size: 17px; }
.hp-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.hp-steps li { display: flex; gap: 12px; align-items: flex-start; }
.hp-num {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  background: var(--pine); color: #fff; font-weight: 800; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
.hp-steps strong { display: block; font-size: 14px; }
.hp-steps p { margin: 2px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }

/* --- listing editor ------------------------------------------------------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
@media (max-width: 480px) { .grid-2 { grid-template-columns: 1fr; } }

/* weekly hours */
.hours { display: grid; gap: 8px; }
.hours-row {
  display: grid;
  grid-template-columns: 92px auto 1fr auto 1fr;
  align-items: center;
  gap: 8px;
}
.hours-row .day { font-weight: 600; font-size: 14px; }
.hours-row .to { color: var(--muted); text-align: center; }
.hours-row .closed-lbl { font-size: 13px; color: var(--muted); white-space: nowrap; display: flex; align-items: center; gap: 5px; }
.hours-row input[type="time"] {
  width: 100%; padding: 8px 10px; font-size: 15px; font-family: inherit;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink);
}
.hours-row input[type="checkbox"] { accent-color: var(--pine); width: 16px; height: 16px; }
@media (max-width: 480px) {
  .hours-row { grid-template-columns: 76px auto 1fr auto 1fr; gap: 6px; }
  .hours-row .closed-lbl { grid-column: 1 / -1; }
}

/* cuisine chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-check { position: relative; }
.chip-check input { position: absolute; opacity: 0; pointer-events: none; }
.chip-check span {
  display: inline-block; padding: 7px 13px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--paper); color: var(--ink);
  font-size: 13px; font-weight: 600; cursor: pointer; user-select: none;
}
.chip-check input:checked + span { background: var(--pine); color: #fff; border-color: var(--pine); }
.chip-check input:focus-visible + span { box-shadow: 0 0 0 3px rgba(232,163,23,.30); }

/* media thumbnails */
.media-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px; margin-bottom: 14px;
}
.media-item {
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff;
  display: flex; flex-direction: column;
}
.media-item img { width: 100%; height: 110px; object-fit: cover; display: block; }
.media-item .pdf-tile {
  height: 110px; display: flex; align-items: center; justify-content: center;
  background: var(--paper); color: var(--blue-700); font-weight: 700; text-decoration: none; font-size: 14px;
}
.media-actions { display: flex; gap: 4px; padding: 6px; flex-wrap: wrap; }
.media-item form { margin: 0; }
.media-item .btn.sm { padding: 5px 9px; font-size: 12px; }

.upload-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.upload-form input[type="file"] { font-size: 13px; flex: 1 1 180px; }

/* --- Review form: star rating widget ------------------------------------- */
.stars-input { border:0; padding:0; margin:2px 0 16px; }
.stars-input legend { font-size:13px; color:var(--muted); margin-bottom:6px; padding:0; }
.stars-row { display:inline-flex; flex-direction:row-reverse; gap:4px; }
.stars-row input { position:absolute; width:1px; height:1px; opacity:0; }
.stars-row label { font-size:34px; line-height:1; color:#d9d4c8; cursor:pointer; transition:color .12s; }
.stars-row label:hover,
.stars-row label:hover ~ label,
.stars-row input:checked ~ label { color:var(--gold); }
.stars-row input:focus-visible + label { outline:2px solid var(--gold); outline-offset:2px; border-radius:4px; }
.field label .opt { color:var(--muted); font-weight:400; }

/* --- Admin review moderation --------------------------------------------- */
.stars { color:var(--gold); letter-spacing:1px; white-space:nowrap; }
.nowrap { white-space:nowrap; }
.vtable tr.rev-hidden { opacity:.55; }
.vtable td.rev-body { max-width:320px; }

/* --- Pricing / plans ----------------------------------------------------- */
.plan-toggle { display:inline-flex; gap:4px; background:#efeadf; border-radius:999px; padding:4px; margin:0 0 20px; }
.pt-btn { border:0; background:transparent; color:var(--muted); font:inherit; font-weight:700; padding:8px 16px; border-radius:999px; cursor:pointer; }
.pt-btn.is-active { background:var(--card); color:var(--ink); box-shadow:0 1px 3px rgba(0,0,0,.12); }
.pt-save { color:var(--pine); font-size:12px; font-weight:800; }

.plan-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(260px,1fr)); gap:18px; max-width:760px; }
.plan-card { position:relative; background:var(--card); border:1px solid var(--line); border-radius:var(--radius); padding:22px; display:flex; flex-direction:column; }
.plan-card.is-premium { border-color:var(--gold); box-shadow:0 8px 30px rgba(232,163,23,.14); }
.plan-card.is-current { outline:2px solid var(--pine); outline-offset:-2px; }
.plan-badge { position:absolute; top:-11px; left:22px; background:var(--pine); color:#fff; font-size:12px; font-weight:800; padding:3px 10px; border-radius:999px; }
.plan-card h2 { margin:0; font-size:22px; }
.plan-tagline { color:var(--muted); margin:2px 0 14px; }
.plan-price { margin:0 0 16px; }
.pp-amount { font-size:34px; font-weight:800; color:var(--ink); }
.pp-per { font-size:15px; font-weight:600; color:var(--muted); }
.plan-feats { list-style:none; margin:0 0 20px; padding:0; display:flex; flex-direction:column; gap:9px; flex:1; }
.plan-feats li { position:relative; padding-left:26px; color:var(--ink); }
.plan-feats li::before { content:"✓"; position:absolute; left:0; color:var(--pine); font-weight:800; }
.plan-feats li.feat-head { padding-left:0; font-weight:700; color:var(--muted); }
.plan-feats li.feat-head::before { content:""; }
.plan-card .btn { width:100%; }
.plan-fine { color:var(--muted); font-size:13px; margin:18px 0 0; }

/* Signup page: form on top (narrow, centered), pricing full-width below it */
.signup { max-width:720px; margin:0 auto; display:flex; flex-direction:column; gap:22px; }
.signup > .card { width:100%; max-width:440px; align-self:center; }

/* Pricing preview on the signup page */
.price-preview { margin:0; }
.price-preview > h2 { font-size:22px; margin:0 0 4px; text-align:center; }
.price-preview > .sub { text-align:center; max-width:520px; margin:0 auto 4px; }
.price-mini-grid { display:grid; grid-template-columns:1fr 1fr; gap:16px; margin-top:18px; }
.price-mini { position:relative; background:var(--card); border:1px solid var(--line); border-radius:12px; padding:16px; }
.price-mini.is-premium { border-color:var(--gold); }
.price-mini h3 { margin:0 0 6px; }
.pm-tag { position:absolute; top:-10px; right:14px; background:var(--gold); color:var(--ink); font-size:11px; font-weight:800; padding:2px 9px; border-radius:999px; }
.pm-price { font-size:26px; font-weight:800; }
.pm-price span { font-size:14px; font-weight:600; color:var(--muted); }
.pm-sub { color:var(--pine); font-size:13px; font-weight:700; margin:2px 0 8px; }
.price-mini ul { list-style:none; margin:10px 0 0; padding:0; display:flex; flex-direction:column; gap:6px; font-size:14px; }
.price-mini li { position:relative; padding-left:20px; }
.price-mini li::before { content:"✓"; position:absolute; left:0; color:var(--pine); font-weight:800; }
.price-mini li.pm-head { padding-left:0; font-weight:700; color:var(--muted); }
.price-mini li.pm-head::before { content:""; }
@media (max-width:520px){ .price-mini-grid { grid-template-columns:1fr; } }

/* --- Premium gate --------------------------------------------------------- */
.gate-badge { display:inline-block; background:var(--gold); color:var(--ink); font-size:11px; font-weight:800; padding:2px 9px; border-radius:999px; vertical-align:middle; margin-left:6px; text-transform:uppercase; letter-spacing:.03em; }
.panel.gate { text-align:center; padding:30px 22px; }
.panel.gate .gate-badge { margin:0 0 8px; }
.panel.gate h2 { margin:6px 0; }
.panel.gate .btn { margin-top:16px; display:inline-block; width:auto; }

/* --- Customer redeemable rewards ----------------------------------------- */
.redeemable { display:flex; justify-content:space-between; align-items:baseline; gap:10px; padding:6px 0 6px 12px; font-size:14px; color:var(--muted); }
.redeemable.can { color:var(--ink); }
.redeemable .rd-state { font-weight:700; white-space:nowrap; }
.redeemable.can .rd-state { color:var(--ok); }
