:root {
  --bg: #181a26; --card: #232637; --card2: #2c3045; --line: #363a52; --text: #eef0f7; --muted: #9aa0b8;
  --accent: #e53935; --ok: #43a047; --warn: #f9a825; --bad: #e53935; --link: #82b1ff;
  color-scheme: dark;
}
* { box-sizing: border-box; }
/* iOS home-screen apps (status bar style black-translucent) shrink the page by the status bar height while
   the content is shorter than the screen, so bars fixed to the bottom end up too high or cut off.
   A page at least one status bar taller than the screen keeps the full height. */
html { min-height: calc(100% + env(safe-area-inset-top)); }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; -webkit-text-size-adjust: 100%; }
a { color: var(--link); }
button, input, select { font: inherit; color: inherit; }
button { background: var(--card2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; cursor: pointer; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button:disabled { opacity: .5; }
input, select { background: var(--card2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; min-width: 0; }
code { background: var(--card2); padding: 1px 5px; border-radius: 5px; font-size: 13px; word-break: break-all; }
[hidden] { display: none !important; }

.login { max-width: 360px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 48px) 16px 24px; text-align: center; }
.login form { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.login .hint { color: var(--muted); font-size: 13px; margin-top: 24px; }
.err { color: #ff8a80; min-height: 1.2em; margin: 0; }

header { display: flex; align-items: center; gap: 8px; padding: calc(env(safe-area-inset-top) + 18px) 16px 10px; background: var(--bg); border-bottom: 1px solid var(--line); }
header h1 { font-size: 20px; margin: 0; flex: 1; }
.pill { font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--card2); color: var(--muted); }
main { padding: 12px 16px calc(env(safe-area-inset-bottom) + 112px); max-width: 760px; margin: 0 auto; }

.banner { margin: 10px 16px 0; padding: 12px; border-radius: 12px; background: #3a2f12; border: 1px solid #6b5418; font-size: 14px; }
.banner button { margin-top: 8px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin-bottom: 10px; }
.card h3 { margin: 0 0 6px; font-size: 15px; }
.row { display: flex; gap: 10px; align-items: flex-start; }
.row img.thumb { width: 64px; height: 64px; object-fit: contain; background: #fff; border-radius: 8px; flex: none; }
.grow { flex: 1; min-width: 0; }
.meta { color: var(--muted); font-size: 13px; }
.title { font-weight: 600; overflow-wrap: anywhere; }
.msg { white-space: pre-wrap; overflow-wrap: anywhere; }
.btns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.btns a, .btns button { display: inline-block; text-decoration: none; color: var(--text); background: var(--card2); border: 1px solid var(--line); border-radius: 9px; padding: 6px 10px; font-size: 14px; }
.btns a.buy { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.card.urgent { border-color: var(--accent); }
.card.flash { animation: flash 1.6s; }
@keyframes flash { from { background: #3b2a35; } }
.badge { display: inline-block; font-size: 12px; padding: 1px 7px; border-radius: 99px; background: var(--card2); margin-right: 4px; }
.badge.ok { background: #1f3d24; color: #a5d6a7; } .badge.bad { background: #4a1f1f; color: #ef9a9a; } .badge.warn { background: #4a3c12; color: #ffe082; }

.filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.filters input[type=search] { flex: 1 1 100%; }
.filters select { flex: 1 1 30%; }
.list-more { width: 100%; margin: 6px 0 14px; }

.section { margin: 18px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.toggles { display: flex; flex-wrap: wrap; gap: 6px; }
.toggles button { padding: 6px 10px; font-size: 14px; }
.toggles button.on { background: #1f3d24; border-color: #2e7d32; }
.form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.form input { flex: 1 1 140px; }
.empty { color: var(--muted); text-align: center; padding: 30px 0; }
.toast { position: fixed; left: 16px; right: 16px; bottom: calc(env(safe-area-inset-bottom) + 88px); z-index: 10; background: #303550; border: 1px solid var(--line); border-radius: 12px; padding: 12px; box-shadow: 0 6px 24px rgba(0,0,0,.4); max-width: 560px; margin: 0 auto; }
.mt8 { margin-top: 8px; } .form input.qty { flex: 0 0 70px; }

/* ---------- glass tab bar with a sliding lens (iOS style) ---------- */
.tabbar {
  --pad: 4px; --tab-ink: #e6e8f2; --tab-on: #ff6b66; --spring: cubic-bezier(.3, 1.45, .45, 1);
  position: fixed; z-index: 6; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 10px); transform: translateX(-50%);
  width: min(calc(100vw - 16px), 480px); height: 64px; padding: var(--pad);
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  border-radius: 999px; background: rgba(44, 48, 69, .5); border: 1px solid rgba(255, 255, 255, .14);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .08);
  -webkit-backdrop-filter: blur(22px) saturate(190%); backdrop-filter: blur(22px) saturate(190%);
  touch-action: none; user-select: none; -webkit-user-select: none;
}
.tabbar .tab {
  position: relative; z-index: 2; min-width: 0; padding: 0; border: 0; border-radius: 999px; background: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 10px; font-weight: 600; letter-spacing: -.01em; line-height: 1.1; color: var(--tab-ink);
  transition: color .2s ease, transform .35s var(--spring);
}
.tabbar .tab svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: fill .2s ease; }
.tabbar .tab span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabbar .tab.on, .tabbar .tab.hot { color: var(--tab-on); }
.tabbar .tab.on svg, .tabbar .tab.hot svg { fill: rgba(255, 107, 102, .3); }
.tabbar.lensing .tab.on:not(.hot) { color: var(--tab-ink); }
.tabbar.lensing .tab.on:not(.hot) svg { fill: none; }
.tabbar.lensing .tab.hot { transform: scale(1.1); }
.tabbar .tab:focus-visible { outline: 2px solid var(--tab-on); outline-offset: -3px; }
.lens {
  position: absolute; z-index: 1; left: 0; top: var(--pad); height: calc(100% - 2 * var(--pad)); width: var(--w, 20%);
  border-radius: 999px; pointer-events: none; translate: var(--x, 0px) 0; scale: 1; background: rgba(255, 255, 255, .12);
  transition: translate .5s var(--spring), scale .35s var(--spring), background .25s ease, box-shadow .25s ease;
}
/* rainbow rim, like light breaking in the edge of a glass drop */
.lens::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1.5px; opacity: 0;
  background: conic-gradient(from 200deg, #ff6b6b, #ffd36b, #8bff9a, #6bd5ff, #b48bff, #ff6bd0, #ff6b6b);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  transition: opacity .25s ease;
}
.lens::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; opacity: 0;
  background: radial-gradient(120% 70% at 50% 0%, rgba(255, 255, 255, .45), transparent 60%); transition: opacity .25s ease;
}
/* finger down or travelling: the lens swells past the bar and turns into clear glass */
.lens.live {
  scale: 1.16 1.32; background: rgba(255, 255, 255, .06);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .35), inset 0 -6px 14px rgba(255, 255, 255, .08), 0 8px 24px rgba(0, 0, 0, .3);
  -webkit-backdrop-filter: brightness(1.12) saturate(1.5); backdrop-filter: brightness(1.12) saturate(1.5);
}
.lens.live::before { opacity: .75; }
.lens.live::after { opacity: .5; }
.lens.drag { transition: translate 0s, scale .35s var(--spring), background .25s ease, box-shadow .25s ease; }
@media (prefers-reduced-motion: reduce) { .lens, .lens.drag, .tabbar .tab { transition: none; } .lens.live { scale: 1; } }

/* ---------- accounts ---------- */
.login .hint a { color: var(--link); text-decoration: none; }
.card .banner { margin: 8px 0 0; }
.urow { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.urow:first-of-type { border-top: 0; }
.urow .btns { margin-top: 0; }
button.link { background: none; border: 0; padding: 0 4px; color: var(--muted); text-decoration: underline; font-size: inherit; }
