/* Styles for the app pages (open / join / tab). Builds on tokens in styles.css. */

.app-body {
  min-height: 100vh;
  background:
    radial-gradient(ellipse 50% 35% at 85% 0%, rgba(247, 168, 27, 0.16), transparent 70%),
    var(--bg);
}

.app-nav { display: flex; align-items: center; justify-content: space-between; padding-top: 20px; padding-bottom: 20px; }
.app-nav .logo { font-size: 28px; }
.back-link { color: var(--muted); font-size: 14px; font-weight: 500; }
.back-link:hover { color: var(--text); }

.app-main { max-width: 480px; margin: 0 auto; padding: 8px 16px 140px; }

/* ---------- Cards & forms ---------- */
.card {
  background: var(--surface);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 28px 24px;
}
.card h1 { font-size: 34px; letter-spacing: -1px; }
.card .sub { color: var(--muted); margin-top: 8px; line-height: 1.5; }

.field { display: block; margin-top: 20px; }
.field > span { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.input, select.input {
  width: 100%;
  font: inherit;
  font-size: 16px;
  color: var(--text);
  background: var(--bg);
  border: 1.5px solid rgba(16, 28, 52, 0.15);
  border-radius: 12px;
  padding: 14px 16px;
  outline: none;
  transition: border-color 0.15s;
}
.input:focus { border-color: var(--gold); }
.input::placeholder { color: #9aa0ab; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #5d6474 50%), linear-gradient(135deg, #5d6474 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.code-input { text-transform: uppercase; letter-spacing: 0.3em; font-weight: 700; font-size: 22px; text-align: center; }

.btn-block { width: 100%; margin-top: 26px; padding: 17px; font-size: 16px; border: none; cursor: pointer; font-family: inherit; }
button.btn { cursor: pointer; font-family: inherit; border: none; }
button.btn-outline { background: var(--surface); border: 1.5px solid var(--text); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.error { color: #d0412f; font-size: 14px; margin-top: 12px; min-height: 1em; }
.alt { text-align: center; margin-top: 20px; color: var(--muted); font-size: 14px; }
.alt a, .alt button { color: var(--gold); font-weight: 600; background: none; border: none; font: inherit; cursor: pointer; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 9px 14px; border-radius: 999px; font-size: 14px; font-weight: 500;
  background: var(--bg); border: 1px solid rgba(16, 28, 52, 0.14); color: var(--text); cursor: pointer; font-family: inherit;
}
.chip.on { background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: var(--text); border-color: var(--gold); font-weight: 600; }

/* ---------- Tab screen ---------- */
.tab-card { padding: 22px 22px 18px; }
.tab-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.tab-top h1 { font-size: 26px; letter-spacing: -0.5px; }
.tab-top .muted { font-size: 13px; margin-top: 4px; }
.pill.closed { background: rgba(208, 65, 47, 0.12); color: #c0392b; }
.big-total { font-size: 48px; font-weight: 800; letter-spacing: -1.5px; margin-top: 14px; }
.total-break { color: var(--muted); font-size: 13px; margin-top: 2px; }
.tab-people { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.avatars.md .av { width: 32px; height: 32px; font-size: 12px; margin-left: -8px; border-color: var(--surface); }
.avatars.md .av:first-child { margin-left: 0; }
.code-chip { font-size: 13px; color: var(--muted); background: var(--bg); border: 1px solid var(--line); padding: 6px 10px; border-radius: 8px; cursor: pointer; font-family: inherit; }
.code-chip b { color: var(--text); letter-spacing: 0.12em; }

.seg { display: flex; margin-top: 22px; border-bottom: 1px solid var(--line); }
.seg button { flex: 1; background: none; border: none; color: var(--muted); font: inherit; font-size: 15px; padding: 12px 0; cursor: pointer; border-bottom: 2px solid transparent; }
.seg button.on { color: var(--text); font-weight: 600; border-bottom-color: var(--gold); }

.add-drink {
  width: 100%; margin-top: 16px; padding: 14px; border-radius: 14px; font: inherit; font-weight: 600; font-size: 15px;
  background: #fff8ea; color: var(--gold-ink); border: 1.5px dashed rgba(247, 168, 27, 0.7); cursor: pointer;
}
.add-drink:hover { background: var(--peach); }

.list { list-style: none; margin-top: 8px; }
.list li { display: flex; align-items: center; gap: 12px; padding: 14px 2px; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: none; }
.list .av { width: 34px; height: 34px; font-size: 13px; margin: 0; border: none; }
.list .grow { flex: 1; min-width: 0; }
.list b { font-weight: 600; display: block; }
.list small { color: var(--muted); font-size: 12px; }
.list .amt { font-weight: 600; font-variant-numeric: tabular-nums; }
.x-btn { background: none; border: none; color: #9aa0ab; font-size: 20px; cursor: pointer; padding: 0 4px; line-height: 1; }
.x-btn:hover { color: #d0412f; }
.tag { font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--gold-ink); background: var(--peach); padding: 2px 6px; border-radius: 4px; margin-left: 6px; vertical-align: 2px; }
.tag.green { color: #1e8a57; background: rgba(56,180,120,.14); }
.you { color: var(--muted); font-weight: 400; }

.empty { text-align: center; color: var(--muted); padding: 36px 12px; line-height: 1.6; }

/* sticky bottom actions */
.action-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(252,248,242,0), var(--bg) 35%);
}
.action-bar .inner { max-width: 448px; margin: 0 auto; display: flex; gap: 12px; }
.action-bar .btn { flex: 1; padding: 16px; font-size: 15px; }

/* ---------- Modal / sheet ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 20; background: rgba(16, 28, 52, 0.45); backdrop-filter: blur(4px);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  width: 100%; max-width: 480px; max-height: 88vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 22px 22px 0 0; color: var(--text);
  padding: 22px 20px calc(24px + env(safe-area-inset-bottom));
  animation: up 0.2s ease-out;
}
@media (min-width: 560px) {
  .sheet-backdrop { align-items: center; }
  .sheet { border-radius: 22px; }
}
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.sheet-head h2 { font-size: 22px; }
.sheet h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 20px 0 10px; font-weight: 600; }

.menu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.menu-item {
  text-align: left; padding: 12px; border-radius: 12px; cursor: pointer; font: inherit; color: var(--text);
  background: var(--bg); border: 1.5px solid var(--line);
}
.menu-item span { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.menu-item.on { border-color: var(--gold); background: #fff8ea; }

.row { display: flex; gap: 10px; align-items: center; }
.stepper { display: flex; align-items: center; gap: 14px; }
.stepper button { width: 38px; height: 38px; border-radius: 50%; border: 1.5px solid rgba(16,28,52,.2); background: var(--surface); color: var(--text); font-size: 20px; cursor: pointer; }
.stepper b { font-size: 20px; min-width: 24px; text-align: center; }

.invite-code { font-size: 38px; font-weight: 800; letter-spacing: 0.2em; text-align: center; color: var(--gold-ink); margin: 6px 0; }
.qr { display: grid; place-items: center; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 16px; width: 212px; margin: 16px auto; }
.link-row { display: flex; gap: 8px; margin-top: 8px; }
.link-row .input { font-size: 13px; padding: 12px; }
.link-row .btn { padding: 0 18px; flex-shrink: 0; }

.summary { margin-top: 8px; }
.summary div { display: flex; justify-content: space-between; padding: 6px 0; color: var(--muted); font-variant-numeric: tabular-nums; }
.summary .grand { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 12px; color: var(--text); font-weight: 700; font-size: 18px; }

.note { font-size: 12px; color: #8a909c; text-align: center; margin-top: 14px; line-height: 1.5; }

.settled { text-align: center; padding: 18px; margin-top: 16px; border-radius: 14px; background: rgba(56,180,120,.12); color: #1e8a57; font-weight: 600; }

.toast {
  position: fixed; left: 50%; bottom: 110px; transform: translateX(-50%); z-index: 30;
  background: var(--ink-800); color: #fff; padding: 10px 18px; border-radius: 999px; font-weight: 600; font-size: 14px;
  box-shadow: 0 10px 30px rgba(16,28,52,.3); animation: up .2s ease-out;
}

/* Invite / join screen */
.invite-hero { text-align: center; }
.invite-hero svg { width: 72px; height: 86px; color: var(--text); margin: 4px auto 10px; display: block; }
.invite-hero h1 { font-size: 32px; }
