:root {
  --bg0: #10140e;
  --bg1: #1a2216;
  --panel: rgba(28, 36, 24, 0.88);
  --panel-solid: #1c2418;
  --text: #f2f0e8;
  --muted: #9aa38f;
  --line: rgba(255, 255, 255, 0.08);
  --accent: #c4d66a;
  --accent-ink: #1a2208;
  --united: #7eb6ff;
  --booker: #8fd6ad;
  --danger: #e08a7a;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --nav-h: 64px;
  --radius: 16px;
  --font: "DM Sans", system-ui, sans-serif;
  --display: "Fraunces", Georgia, serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, #2a3820 0%, transparent 55%),
    radial-gradient(900px 500px at 110% 10%, #243028 0%, transparent 50%),
    linear-gradient(165deg, var(--bg0), var(--bg1) 45%, #141a12);
  background-attachment: fixed;
}

body {
  padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + 8px);
}

/* ---- Lock ---- */
.lock-screen {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 18px calc(24px + var(--safe-bottom));
  animation: fadeIn 0.45s ease;
}
.lock-card {
  width: min(100%, 380px);
  padding: 28px 22px 24px;
  border-radius: 22px;
  background: linear-gradient(160deg, rgba(40, 50, 34, 0.95), rgba(22, 28, 18, 0.98));
  border: 1px solid var(--line);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}
.lock-brand {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.lock-card h1 {
  margin: 0 0 8px;
  font-family: var(--display);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.lock-hint {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}
.lock-form {
  display: grid;
  gap: 10px;
}
.lock-form input {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  border-radius: 12px;
  padding: 14px 14px;
  font-size: 16px;
}
.primary-btn {
  border: 0;
  border-radius: 12px;
  padding: 14px 16px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  font-size: 15px;
}
.lock-error {
  margin: 12px 0 0;
  color: var(--danger);
  font-size: 13px;
}

.app-shell[hidden],
.lock-screen[hidden] { display: none !important; }

/* ---- App chrome ---- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 14px 16px 10px;
  background: rgba(16, 20, 14, 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.brand {
  margin: 0 0 2px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.app-header h1 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.toolbar {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toolbar input[type="search"] {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border-radius: 14px;
  padding: 13px 14px;
  font-size: 16px;
}
.icon-btn {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  border-radius: 12px;
  width: 44px;
  height: 44px;
  font-size: 18px;
}
.icon-btn:disabled { opacity: 0.45; }

.seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--line);
}
.seg-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 9px;
  padding: 10px 8px;
  font-size: 13px;
  font-weight: 600;
}
.seg-btn.active {
  background: rgba(196, 214, 106, 0.16);
  color: var(--text);
}

.status {
  margin: 8px 0 0;
  min-height: 1.1em;
  font-size: 12px;
  color: var(--muted);
}
.status.error { color: #f0a8a0; }
.status.ok { color: #b6efcd; }

.view {
  display: none;
  padding: 14px 14px 24px;
  animation: riseIn 0.35s ease;
}
.view.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes riseIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
  backdrop-filter: blur(8px);
}
.card-title {
  margin: 0 0 4px;
  font-size: 1.02rem;
  font-weight: 650;
  line-height: 1.3;
}
.card-meta {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 10px;
}
.grid-prices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  font-size: 13px;
}
.grid-prices .label {
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 2px;
}
.grid-prices .val {
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.2);
}
.chip.united { color: var(--united); border-color: rgba(126, 182, 255, 0.35); }
.chip.booker { color: var(--booker); border-color: rgba(143, 214, 173, 0.35); }
.chip.same { color: #e2c56a; }
.chip.none { color: var(--muted); }
.chip.profit { color: var(--accent); }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 18px 2px 10px;
}
.section-head:first-child { margin-top: 4px; }
.section-head h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.2rem;
  font-weight: 700;
}
.section-head .count {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.section-booker .section-head h2 { color: var(--booker); }
.section-united .section-head h2 { color: var(--united); }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 48px 18px;
  font-size: 14px;
  line-height: 1.5;
}

.shop-row {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  margin-bottom: 10px;
  touch-action: pan-y;
}
.shop-row-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, #3d9a6a);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 18px;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: #04140c;
}
.shop-row-front {
  position: relative;
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  transition: transform 0.15s ease;
  will-change: transform;
}
.shop-row.picked .shop-row-front { opacity: 0.5; }
.shop-row.picked .card-title { text-decoration: line-through; }
.shop-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.shop-actions button {
  flex: 1;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border-radius: 12px;
  padding: 11px;
  font-size: 13px;
  font-weight: 650;
}
.shop-actions .done {
  background: rgba(61, 154, 106, 0.18);
  border-color: rgba(61, 154, 106, 0.4);
  color: #b6efcd;
}

.list-footer {
  margin: 14px 0 4px;
}
.list-footer button {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  border-radius: 12px;
  padding: 13px;
  font-size: 13px;
  font-weight: 600;
}

.trunc {
  margin: 8px 2px 0;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--nav-h) + var(--safe-bottom));
  padding: 8px 12px var(--safe-bottom);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: rgba(14, 18, 12, 0.92);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(14px);
  z-index: 30;
}
.bottom-nav button {
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.bottom-nav button.active {
  background: rgba(196, 214, 106, 0.14);
  color: var(--text);
}
