/* ============================================================
   PudelVPN Mini App — cherry minimalist theme
   Matches the Android app + landing: ink background, cherry accent,
   restrained colour, generous whitespace.
   ============================================================ */

:root {
  --ink-950: #070506;
  --ink-900: #0a0708;
  --ink-850: #0f0d0e;
  --ink-800: #141113;
  --ink-700: #1c1719;
  --ink-650: #221c1f;

  --line:        rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.12);

  --fog-100: #f0eaeb;
  --fog-200: #c9c0c2;
  --fog-300: #8a7e81;
  --fog-400: #5c5054;

  --cherry:      #8b2c3a;
  --cherry-base: #6e2230;
  --cherry-dim:  #4a1822;
  --cherry-glow: #b23a4b;

  --ok:     #4ade80;
  --warn:   #e5a23a;
  --danger: #e5484d;

  --radius: 16px;
  --radius-sm: 11px;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  background: var(--ink-900);
  color: var(--fog-100);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  overscroll-behavior: none;
}

#bg-canvas {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  z-index: 0; pointer-events: none;
  opacity: 0.7;
}

.shell {
  position: relative;
  z-index: 1;
  max-width: 560px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: calc(var(--safe-top) + 8px) 16px calc(86px + var(--safe-bottom)) 16px;
}

::selection { background: rgba(139, 44, 58, 0.45); color: #fff; }

/* ---------- Topbar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 2px 18px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand__icon {
  width: 34px; height: 34px; border-radius: 9px;
  object-fit: cover; background: #000;
}
.brand__wordmark {
  font-weight: 800; letter-spacing: -0.02em; font-size: 18px;
}
.brand__wordmark span { color: var(--cherry-glow); }

.iconbtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 11px;
  color: var(--fog-200);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  text-decoration: none;
  transition: background .2s, border-color .2s;
}
.iconbtn:active { background: rgba(255, 255, 255, 0.07); }

/* ---------- Tabs ---------- */
.tab { display: none; animation: fade .25s ease; }
.tab--active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.page { margin: 4px 2px 18px; }
.page--admin { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.page__title { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -0.03em; }
.page__sub { margin: 6px 0 0; color: var(--fog-300); font-size: 13.5px; }

.live {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--fog-300);
  padding: 5px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: rgba(255,255,255,0.02);
  white-space: nowrap;
}
.live__dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--ok);
  box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.6);
  animation: pulse 1.8s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(74,222,128,0.5); }
  70% { box-shadow: 0 0 0 7px rgba(74,222,128,0); }
  100% { box-shadow: 0 0 0 0 rgba(74,222,128,0); }
}

/* ---------- My keys ---------- */
.keys { display: flex; flex-direction: column; gap: 12px; }

.keycard {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.keycard__top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.keycard__tariff { font-weight: 700; font-size: 15px; }
.status {
  font-size: 11px; font-weight: 600; padding: 4px 9px; border-radius: 999px;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.status--active { color: var(--ok); background: rgba(74,222,128,0.12); border: 1px solid rgba(74,222,128,0.3); }
.status--expired { color: var(--fog-300); background: rgba(255,255,255,0.04); border: 1px solid var(--line); }

.keycode {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-family: ui-monospace, "SF Mono", "JetBrains Mono", monospace;
  font-size: 15px; letter-spacing: 0.04em;
  background: var(--ink-850); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 12px;
}
.keycode__copy { color: var(--cherry-glow); font-size: 12px; font-family: inherit; white-space: nowrap; }
.keymeta { display: flex; gap: 18px; flex-wrap: wrap; }
.keymeta__item { display: flex; flex-direction: column; gap: 2px; }
.keymeta__k { font-size: 11px; color: var(--fog-400); }
.keymeta__v { font-size: 13.5px; color: var(--fog-200); }

/* Empty state */
.empty {
  text-align: center; padding: 48px 20px;
  border: 1px dashed var(--line); border-radius: var(--radius);
  background: rgba(255,255,255,0.015);
}
.empty__title { font-weight: 700; font-size: 16px; margin-bottom: 6px; }
.empty__text { color: var(--fog-300); font-size: 13.5px; margin-bottom: 18px; }

/* ---------- Tariffs ---------- */
.tariffs { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.tariff { display: block; cursor: pointer; position: relative; }
.tariff input { position: absolute; opacity: 0; pointer-events: none; }
.tariff__body {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.02);
  padding: 14px 16px;
  transition: border-color .2s, background .2s;
}
.tariff input:checked + .tariff__body {
  border-color: var(--cherry-glow);
  background: linear-gradient(180deg, rgba(139,44,58,0.10), transparent 70%);
}
.tariff--popular .tariff__body { box-shadow: inset 0 0 0 1px rgba(178,58,75,0.25); }
.tariff__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.tariff__name { font-weight: 700; font-size: 15px; }
.tariff__badge {
  font-size: 10px; font-weight: 700; letter-spacing: 0.08em;
  padding: 3px 8px; border-radius: 999px;
  color: var(--fog-200); background: rgba(255,255,255,0.05); border: 1px solid var(--line);
}
.tariff__badge--hot { color: #fff; background: var(--cherry); border-color: transparent; }
.tariff__pricerow { display: flex; align-items: baseline; gap: 6px; }
.tariff__price { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }
.tariff__period { color: var(--fog-300); font-size: 13px; }
.tariff__meta { margin-top: 4px; color: var(--fog-400); font-size: 12px; }

/* ---------- Pay panel ---------- */
.paypanel {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: rgba(255,255,255,0.02); padding: 16px; margin-top: 4px;
}
.paypanel__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.paypanel__title { margin: 0; font-size: 16px; font-weight: 700; }
.paypanel__sum { font-size: 20px; font-weight: 800; color: var(--cherry-glow); }

.req {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--ink-850); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 14px; cursor: pointer; text-align: left; color: inherit;
}
.req:active { background: var(--ink-800); }
.req__col { display: flex; flex-direction: column; gap: 3px; }
.req__label { font-size: 11px; color: var(--fog-400); }
.req__val { font-family: ui-monospace, monospace; font-size: 15px; letter-spacing: 0.03em; }
.req__copy { color: var(--cherry-glow); font-size: 12px; white-space: nowrap; }

.upload { margin-top: 14px; }
.upload__label { font-size: 12px; color: var(--fog-300); margin-bottom: 8px; }
.upload__drop {
  display: block; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm);
  background: var(--ink-850); cursor: pointer; overflow: hidden; min-height: 96px;
  position: relative;
}
.upload__placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  min-height: 96px; color: var(--fog-300); font-size: 13px;
}
.upload__preview { display: block; width: 100%; max-height: 240px; object-fit: contain; }

.hint {
  margin-top: 14px; font-size: 12.5px; color: var(--fog-300); line-height: 1.55;
  padding: 12px; border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.025); border: 1px solid var(--line);
}

/* ---------- Admin requests ---------- */
.reqs { display: flex; flex-direction: column; gap: 12px; }
.reqcard {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: rgba(255,255,255,0.025); padding: 16px;
  animation: slidein .35s cubic-bezier(.16,1,.3,1);
}
@keyframes slidein { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.reqcard__top { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.reqcard__avatar {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--cherry), var(--cherry-dim));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; font-size: 16px;
}
.reqcard__who { flex: 1; min-width: 0; }
.reqcard__name { font-weight: 600; font-size: 14.5px; }
.reqcard__handle { font-size: 12px; color: var(--fog-300); }
.reqcard__time { font-size: 11px; color: var(--fog-400); white-space: nowrap; }

.reqcard__deal {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--ink-850); border: 1px solid var(--line); margin-bottom: 12px;
}
.reqcard__plan { font-size: 13.5px; color: var(--fog-200); }
.reqcard__price { font-weight: 800; font-size: 16px; }

.reqcard__shot {
  width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--line);
  margin-bottom: 12px; max-height: 220px; object-fit: cover; display: block;
}
.reqcard__noshot {
  font-size: 12px; color: var(--fog-400); padding: 14px; text-align: center;
  border: 1px dashed var(--line); border-radius: var(--radius-sm); margin-bottom: 12px;
}
.reqcard__actions { display: flex; gap: 10px; }

/* ---------- Buttons ---------- */
.btn {
  flex: 1; border: none; border-radius: var(--radius-sm);
  padding: 12px 14px; font-size: 14px; font-weight: 600; cursor: pointer;
  font-family: inherit; transition: transform .12s, background .2s, opacity .2s;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--cherry); color: #fff; }
.btn--primary:active { background: var(--cherry-glow); }
.btn--ghost { background: rgba(255,255,255,0.05); color: var(--fog-100); border: 1px solid var(--line); }
.btn--danger { background: rgba(229,72,77,0.14); color: var(--danger); border: 1px solid rgba(229,72,77,0.4); }
.btn--block { width: 100%; flex: none; }

/* ---------- Bottom nav ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; justify-content: space-around;
  padding: 8px 8px calc(8px + var(--safe-bottom));
  background: rgba(10, 7, 8, 0.86);
  backdrop-filter: blur(16px) saturate(160%);
  border-top: 1px solid var(--line);
}
.tabbtn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: none; border: none; cursor: pointer; color: var(--fog-400);
  font-family: inherit; padding: 6px 4px; transition: color .2s;
}
.tabbtn__label { font-size: 11px; font-weight: 500; }
.tabbtn--active { color: var(--cherry-glow); }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.modal[hidden] { display: none; }
.modal__scrim { position: absolute; inset: 0; background: rgba(0,0,0,0.6); animation: fade .2s; }
.modal__card {
  position: relative; width: 100%; max-width: 560px;
  background: var(--ink-800); border: 1px solid var(--line);
  border-radius: 20px 20px 0 0; padding: 22px 18px calc(22px + var(--safe-bottom));
  animation: slideup .28s cubic-bezier(.16,1,.3,1);
}
@keyframes slideup { from { transform: translateY(100%); } to { transform: none; } }
.modal__title { margin: 0 0 6px; font-size: 18px; font-weight: 800; }
.modal__sub { margin: 0 0 16px; color: var(--fog-300); font-size: 13px; }
.modal__input {
  width: 100%; background: var(--ink-850); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 13px 14px; color: var(--fog-100);
  font-size: 15px; font-family: ui-monospace, monospace; letter-spacing: 0.04em;
  margin-bottom: 16px; outline: none;
}
.modal__input:focus { border-color: var(--cherry-glow); }
.modal__actions { display: flex; gap: 10px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(96px + var(--safe-bottom));
  transform: translate(-50%, 20px); z-index: 30;
  background: var(--ink-700); color: var(--fog-100);
  border: 1px solid var(--line-strong); border-radius: 12px;
  padding: 10px 16px; font-size: 13.5px; opacity: 0;
  transition: opacity .25s, transform .25s; pointer-events: none;
}
.toast--visible { opacity: 1; transform: translate(-50%, 0); }
