/* WG3 Premium UI — vanilla, Telegram-theme friendly */

:root{
  --bg0:#070A12;
  --bg1:#0B1224;
  --card:rgba(255,255,255,.06);
  --card2:rgba(255,255,255,.08);
  --stroke:rgba(255,255,255,.12);
  --text:#EAF0FF;
  --muted:rgba(234,240,255,.72);
  --muted2:rgba(234,240,255,.55);
  --brand:#6CE5FF;
  --brand2:#8A5BFF;
  --danger:#FF4D6D;
  --ok:#43F5B7;
  --warn:#FFC857;

  --radius:18px;
  --shadow: 0 10px 35px rgba(0,0,0,.35);
  --shadow2: 0 18px 60px rgba(0,0,0,.45);
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

/* Telegram theme hook (if available) */
:root.tg{
  --text: var(--tg-theme-text-color, var(--text));
  --muted: color-mix(in oklab, var(--text) 72%, transparent);
  --muted2: color-mix(in oklab, var(--text) 55%, transparent);
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family:var(--sans);
  color:var(--text);
  background: radial-gradient(1200px 800px at 20% 10%, rgba(108,229,255,.20), transparent 55%),
              radial-gradient(900px 700px at 85% 25%, rgba(138,91,255,.22), transparent 55%),
              linear-gradient(180deg, var(--bg0), var(--bg1));
}

.bg{
  position:fixed; inset:0; pointer-events:none;
  background-image:
    radial-gradient(500px 300px at 20% 90%, rgba(67,245,183,.10), transparent 60%),
    radial-gradient(700px 400px at 90% 95%, rgba(255,77,109,.08), transparent 60%);
  filter: blur(.0px);
}

.topbar{
  position:sticky; top:0; z-index:10;
  display:flex; align-items:center; justify-content:space-between;
  padding:18px 18px;
  background: color-mix(in oklab, rgba(7,10,18,.55) 85%, transparent);
  backdrop-filter: blur(12px);
  border-bottom:1px solid rgba(255,255,255,.10);
}

.brand{ display:flex; gap:12px; align-items:center; }
.logo{ width:40px; height:40px; border-radius:14px; position:relative; overflow:hidden;
  background: linear-gradient(135deg, rgba(108,229,255,.24), rgba(138,91,255,.22));
  border:1px solid rgba(255,255,255,.12);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), var(--shadow);
}
.logo .dot{ position:absolute; width:10px; height:10px; border-radius:50%; left:10px; top:10px;
  background: var(--brand);
  box-shadow: 0 0 22px rgba(108,229,255,.55);
}
.logo .ring{ position:absolute; inset:-16px; border-radius:40px;
  border:1px solid rgba(255,255,255,.14);
  transform: rotate(18deg);
}

.title{ font-weight:700; letter-spacing:.2px; line-height:1.05; }
.subtitle{ font-size:12px; color:var(--muted2); margin-top:2px; }

.top-actions{ display:flex; gap:10px; }

.container{ max-width:1100px; margin:0 auto; padding:18px; }

.panel{
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.04));
  border:1px solid rgba(255,255,255,.10);
  box-shadow: var(--shadow);
  padding:18px;
}

.panel-head{ display:flex; align-items:flex-start; justify-content:space-between; gap:12px; }
.panel-head h2{ margin:0; font-size:18px; }
.muted{ color:var(--muted); font-size:13px; }

.head-left{ display:flex; flex-direction:column; gap:10px; }

.chips{ display:flex; gap:8px; flex-wrap:wrap; }
.chip{
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
  color:var(--muted);
  padding:8px 10px;
  border-radius: 999px;
  cursor:pointer;
  font-size:12px;
}
.chip.active{
  color: var(--text);
  border-color: rgba(108,229,255,.35);
  background: linear-gradient(135deg, rgba(108,229,255,.16), rgba(138,91,255,.12));
}

.grid{
  margin-top:16px;
  display:grid;
  grid-template-columns: repeat(12, 1fr);
  gap:12px;
}

.card{
  grid-column: span 6;
  border-radius: var(--radius);
  background: rgba(255,255,255,.05);
  border:1px solid rgba(255,255,255,.10);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
  padding:14px;
  display:flex;
  flex-direction:column;
  gap:12px;
}
.card.mini{ grid-column: auto; }

.card-head{ display:flex; align-items:flex-start; justify-content:space-between; gap:10px; }
.card-title{ font-weight:650; letter-spacing:.15px; }
.card-sub{ color:var(--muted2); font-size:12px; margin-top:4px; }

.badges{ display:flex; gap:6px; flex-wrap:wrap; justify-content:flex-end; }
.badge{
  font-size:11px;
  border-radius:999px;
  padding:6px 8px;
  border:1px solid rgba(255,255,255,.10);
  color: var(--muted);
  background: rgba(255,255,255,.03);
}
.badge.ok{ border-color: rgba(67,245,183,.35); color: color-mix(in oklab, var(--ok) 90%, var(--text)); }
.badge.bad{ border-color: rgba(255,77,109,.35); color: color-mix(in oklab, var(--danger) 90%, var(--text)); }
.badge.warn{ border-color: rgba(255,200,87,.35); color: color-mix(in oklab, var(--warn) 92%, var(--text)); }

.card-actions{ display:flex; gap:10px; flex-wrap:wrap; }

.btn{
  border:1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.05);
  color: var(--text);
  padding:10px 12px;
  border-radius: 12px;
  cursor:pointer;
  font-weight:600;
  font-size:13px;
  display:inline-flex;
  align-items:center;
  gap:8px;
}
.btn:hover{ background: rgba(255,255,255,.08); }
.btn:active{ transform: translateY(1px); }
.btn.primary{
  border-color: rgba(108,229,255,.28);
  background: linear-gradient(135deg, rgba(108,229,255,.18), rgba(138,91,255,.15));
}
.btn.ghost{
  background: transparent;
  border-color: rgba(255,255,255,.10);
}

.icon-btn{
  width:38px; height:38px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
  color: var(--text);
  cursor:pointer;
}

.form{ margin-top:14px; }
.row{ display:flex; gap:12px; flex-wrap:wrap; align-items:flex-end; }
.field{ display:flex; flex-direction:column; gap:8px; flex:1; min-width:220px; }
.label{ font-size:12px; color: var(--muted2); }
.input{
  width:100%;
  padding:11px 12px;
  border-radius: 12px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.20);
  color: var(--text);
  outline: none;
}
.input:focus{ border-color: rgba(108,229,255,.35); box-shadow: 0 0 0 4px rgba(108,229,255,.08); }
.input.mono{ font-family: var(--mono); font-size:12.5px; }

.hint{ margin-top:10px; color: var(--muted2); font-size:12px; }

.empty{ margin-top:16px; }
.empty-card{
  border-radius: var(--radius);
  padding:18px;
  border:1px dashed rgba(255,255,255,.16);
  background: rgba(255,255,255,.03);
}
.empty-title{ font-weight:700; margin-bottom:6px; }

.modal::backdrop{ background: rgba(0,0,0,.55); backdrop-filter: blur(8px); }
.modal{ border:none; padding:0; background:transparent; }
.modal-card{
  width:min(560px, calc(100vw - 28px));
  margin: 14px auto;
  border-radius: 22px;
  border:1px solid rgba(255,255,255,.12);
  background: linear-gradient(180deg, rgba(15,22,40,.92), rgba(9,12,24,.92));
  box-shadow: var(--shadow2);
  overflow:hidden;
}
.modal-card.wide{ width:min(880px, calc(100vw - 28px)); }

.modal-head{
  padding:16px;
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  border-bottom:1px solid rgba(255,255,255,.10);
}
.modal-title{ font-weight:750; letter-spacing:.2px; }
.modal-body{ padding:16px; display:flex; flex-direction:column; gap:12px; }
.modal-body.split{ flex-direction:row; gap:14px; }
.modal-actions{
  padding:16px;
  border-top:1px solid rgba(255,255,255,.10);
  display:flex;
  justify-content:flex-end;
  gap:10px;
}

.col{ flex:1; min-width: 260px; display:flex; flex-direction:column; gap:12px; }

.note{
  padding:12px;
  border-radius: 14px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.03);
}
.note-title{ font-weight:650; margin-bottom:4px; }
.note-text{ color:var(--muted); font-size:12.5px; line-height:1.35; }

.kv{ display:grid; grid-template-columns: 1fr 1fr; gap:8px 12px; }
.k{ color: var(--muted2); font-size:12px; }
.v{ font-weight:650; }

.actions{ display:flex; gap:10px; flex-wrap:wrap; }

.linkbox{ display:flex; gap:10px; align-items:center; }

.qr{
  border-radius: 16px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.03);
  padding:12px;
  min-height: 240px;
  display:flex;
  align-items:center;
  justify-content:center;
}
.qr canvas, .qr img{ max-width:100%; height:auto; border-radius: 12px; }
.qr-placeholder{ color: var(--muted2); font-size:12.5px; }

.toasts{
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  display:flex;
  flex-direction:column;
  gap:10px;
  z-index: 50;
  width: min(520px, calc(100vw - 24px));
}
.toast{
  border-radius: 16px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(12,16,30,.92);
  box-shadow: var(--shadow);
  padding:12px 14px;
  display:flex;
  justify-content:space-between;
  gap:12px;
}
.toast .msg{ color: var(--text); font-size:13px; }
.toast .x{ background:transparent; border:none; color:var(--muted2); cursor:pointer; }

@media (max-width: 880px){
  .card{ grid-column: span 12; }
  .modal-body.split{ flex-direction:column; }
}
