:root {
  --bg: #08080a;
  --bg2: #0d0d10;
  --surface: #121216;
  --surface2: #18181d;
  --line: #2a2a32;
  --line2: #3a3a44;
  --ink: #f4f1ea;
  --muted: #8f8a96;
  --accent: #c9a87c;
  --accent-soft: rgba(201, 168, 124, .14);
  --accent-strong: #e4c9a0;
  --danger: #e8717a;
  --ok: #8fbf9f;
  --radius: 20px;
  --shadow: 0 24px 60px rgba(0,0,0,.45);
  --font: "Manrope", system-ui, sans-serif;
  --display: "Syne", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box }
html { scroll-behavior: smooth }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(900px 500px at 8% -10%, rgba(201,168,124,.12), transparent 55%),
    radial-gradient(700px 420px at 100% 0%, rgba(120,100,80,.08), transparent 50%),
    linear-gradient(180deg, #0b0b0e, var(--bg));
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 0;
}

a { color: var(--accent-strong); text-decoration: none }
.wrap { position: relative; z-index: 1; max-width: 1220px; margin: 0 auto; padding: 28px 20px 90px }

header {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 16px; flex-wrap: wrap; margin-bottom: 26px;
  animation: rise .7s ease both;
}
.brand {
  font-family: var(--display);
  font-size: 12px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--accent); font-weight: 700;
}
h1 {
  margin: 8px 0 0; font-family: var(--display);
  font-size: clamp(30px, 4.5vw, 46px); letter-spacing: -.04em; font-weight: 700;
  background: linear-gradient(120deg, #fff 20%, var(--accent-strong) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.sub { color: var(--muted); margin-top: 8px; font-size: 14px; max-width: 520px; line-height: 1.5 }

.actions { display: flex; gap: 10px; flex-wrap: wrap }
button, .btn {
  appearance: none; border: 0; cursor: pointer; font: inherit; font-weight: 600;
  border-radius: 14px; padding: 12px 16px; transition: transform .2s ease, background .2s, border-color .2s, box-shadow .2s;
}
.btn:hover { transform: translateY(-1px) }
.btn:active { transform: translateY(0) }
.btn-primary {
  background: linear-gradient(135deg, var(--accent-strong), var(--accent));
  color: #1a140c; box-shadow: 0 10px 30px rgba(201,168,124,.22);
}
.btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--ink) }
.btn-ghost:hover { border-color: var(--line2); background: rgba(255,255,255,.02) }
.btn-danger { background: rgba(232,113,122,.1); color: var(--danger); border: 1px solid rgba(232,113,122,.28) }
.btn-sm { padding: 8px 12px; font-size: 12px; border-radius: 10px }
.btn:disabled { opacity: .5; cursor: wait }

.tabs { display: flex; gap: 8px; margin: 8px 0 18px; flex-wrap: wrap; animation: rise .8s ease both }
.tab {
  padding: 10px 16px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--muted); cursor: pointer; font-weight: 650; font-size: 13px;
  transition: .25s ease;
}
.tab.on { color: #1a140c; background: var(--accent); border-color: var(--accent); box-shadow: 0 8px 24px rgba(201,168,124,.2) }
.view { display: none; animation: rise .45s ease both }
.view.on { display: block }

.stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px;
  animation: rise .75s ease both;
}
@media (max-width: 800px) { .stats { grid-template-columns: repeat(2, 1fr) } }
.stat {
  background: linear-gradient(180deg, var(--surface2), var(--surface));
  border: 1px solid var(--line); border-radius: 18px; padding: 16px;
  transition: border-color .25s, transform .25s;
}
.stat:hover { border-color: var(--line2); transform: translateY(-2px) }
.stat span { font-size: 11px; color: var(--muted); letter-spacing: .06em; text-transform: uppercase }
.stat b { display: block; font-size: 20px; margin-top: 6px; font-variant-numeric: tabular-nums }

.panel {
  background: linear-gradient(180deg, rgba(24,24,29,.95), rgba(18,18,22,.98));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 22px;
  margin-bottom: 16px; box-shadow: var(--shadow);
  animation: rise .55s ease both;
}
.panel h2 { margin: 0 0 4px; font-family: var(--display); font-size: 20px; letter-spacing: -.02em }
.panel .hint { color: var(--muted); font-size: 13px; margin: 0 0 16px; line-height: 1.5 }
label.field { display: block; font-size: 12px; color: var(--muted); margin-bottom: 8px }
input[type=text], input[type=password], input[type=tel], select {
  width: 100%; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line);
  background: #0c0c0f; color: var(--ink); font: inherit; outline: none; margin-bottom: 12px;
  transition: border-color .2s, box-shadow .2s;
}
input:focus, select:focus {
  border-color: rgba(201,168,124,.55);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.mono { font-family: var(--mono) }

.grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 16px }
@media (max-width: 980px) { .grid { grid-template-columns: 1fr } }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px }
.search { flex: 1; min-width: 160px; margin: 0 !important }
.chip { font-size: 12px; color: var(--muted) }

.gifts {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 10px; max-height: 520px; overflow: auto; padding-right: 4px;
}
.gift {
  position: relative; background: #0c0c0f; border: 1px solid var(--line); border-radius: 18px;
  padding: 12px 10px 14px; cursor: pointer; text-align: center; user-select: none;
  transition: transform .22s ease, border-color .22s, box-shadow .22s, background .22s;
}
.gift:hover { transform: translateY(-3px); border-color: var(--line2) }
.gift.on {
  border-color: var(--accent);
  background: linear-gradient(180deg, rgba(201,168,124,.12), #0c0c0f);
  box-shadow: 0 0 0 1px rgba(201,168,124,.25), 0 12px 28px rgba(201,168,124,.08);
}
.gift img {
  width: 68px; height: 68px; object-fit: contain; display: block; margin: 0 auto 10px;
  filter: drop-shadow(0 8px 14px rgba(0,0,0,.35));
  transition: transform .25s ease;
}
.gift:hover img { transform: scale(1.05) }
.gift .name { font-size: 11px; line-height: 1.25; min-height: 2.5em }
.gift .check {
  position: absolute; top: 8px; right: 8px; width: 18px; height: 18px; border-radius: 50%;
  border: 1px solid var(--line); background: #0c0c0f; transition: .2s;
}
.gift.on .check {
  background: var(--accent); border-color: var(--accent);
  box-shadow: inset 0 0 0 4px #0c0c0f;
}

.list { display: flex; flex-direction: column; gap: 8px; max-height: 280px; overflow: auto }
.row {
  display: flex; justify-content: space-between; gap: 12px; align-items: center;
  padding: 12px 14px; border-radius: 14px; background: #0c0c0f; border: 1px solid var(--line); font-size: 13px;
  animation: rise .4s ease both;
}
.muted { color: var(--muted) }

.live {
  position: relative; overflow: hidden;
  border: 1px solid rgba(201,168,124,.28);
  background:
    radial-gradient(600px 200px at 10% 0%, rgba(201,168,124,.12), transparent 60%),
    linear-gradient(145deg, #161412, #101014 60%, #0d0d10);
}
.live-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 12px }
.live-phase {
  display: inline-flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; color: var(--accent);
}
.live-phase .pulse {
  width: 9px; height: 9px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 0 rgba(201,168,124,.55); animation: pulse 1.5s infinite;
}
.live.err .live-phase { color: var(--danger) }
.live.err .live-phase .pulse { background: var(--danger); animation: none }
.live-msg { font-family: var(--display); font-size: 20px; font-weight: 650; margin: 0 0 6px; letter-spacing: -.02em }
.live-sub { color: var(--muted); font-size: 13px; margin: 0 0 16px; line-height: 1.5 }
.live-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px }
@media (max-width: 800px) { .live-grid { grid-template-columns: repeat(2, 1fr) } }
.live-metric {
  background: rgba(12,12,15,.8); border: 1px solid var(--line); border-radius: 16px; padding: 14px;
  transition: transform .25s;
}
.live-metric:hover { transform: translateY(-2px) }
.live-metric span { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em }
.live-metric b { display: block; margin-top: 6px; font-size: 22px; font-variant-numeric: tabular-nums }

.bar { height: 7px; border-radius: 99px; background: #1b1b22; overflow: hidden; margin-top: 14px }
.bar > i {
  display: block; height: 100%; width: 0; border-radius: 99px;
  background: linear-gradient(90deg, #8a6d45, var(--accent), var(--accent-strong));
  transition: width .4s ease;
}

.targets { display: flex; flex-direction: column; gap: 12px }
.target-card {
  border: 1px solid var(--line); border-radius: 18px; padding: 16px; background: #0c0c0f;
  transition: border-color .25s, transform .25s, box-shadow .25s;
  animation: rise .45s ease both;
}
.target-card:hover { border-color: var(--line2); transform: translateY(-2px) }
.target-card.active {
  border-color: rgba(201,168,124,.45);
  box-shadow: 0 0 0 1px rgba(201,168,124,.12), 0 16px 40px rgba(0,0,0,.25);
}
.target-top { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: flex-start }
.target-title { font-weight: 700; font-size: 16px }
.badge {
  font-size: 11px; padding: 4px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted);
}
.badge.ok { color: #142018; background: var(--ok); border-color: var(--ok) }
.badge.warn { color: var(--accent-strong); border-color: rgba(201,168,124,.4); background: var(--accent-soft) }
.badge.err { color: var(--danger); border-color: rgba(232,113,122,.4) }
.target-meta {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px; margin-top: 12px; font-size: 12px;
}
.target-meta div {
  background: #121216; border-radius: 12px; padding: 10px; border: 1px solid var(--line);
}
.target-meta span {
  display: block; color: var(--muted); margin-bottom: 4px; font-size: 10px;
  text-transform: uppercase; letter-spacing: .06em;
}
.target-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px }

.sess { border: 1px solid var(--line); border-radius: 18px; padding: 16px; background: #0c0c0f; margin-bottom: 10px }
.sess.primary { border-color: rgba(201,168,124,.4) }
.sess-meta {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px; margin-top: 12px; font-size: 12px;
}
.sess-meta div { background: #121216; border-radius: 12px; padding: 10px; border: 1px solid var(--line) }
.sess-meta span { display: block; color: var(--muted); margin-bottom: 4px; font-size: 10px; text-transform: uppercase; letter-spacing: .06em }
.sess-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px }
.wizard { display: grid; gap: 12px }
.steps { display: flex; gap: 8px; margin-bottom: 8px }
.step { flex: 1; height: 4px; border-radius: 99px; background: #24242c }
.step.on { background: linear-gradient(90deg, var(--accent), var(--accent-strong)) }
.devices { margin-top: 12px; display: none }
.devices.on { display: block }
.device { padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); margin-top: 8px; font-size: 12px; background: #121216 }

.toast {
  position: fixed; right: 18px; bottom: 18px; z-index: 50;
  background: #1a1712; border: 1px solid rgba(201,168,124,.35); color: var(--ink);
  padding: 14px 18px; border-radius: 16px; max-width: min(420px, 90vw);
  transform: translateY(120%); opacity: 0; transition: .28s ease;
  box-shadow: var(--shadow);
}
.toast.show { transform: none; opacity: 1 }
.toast.bad { background: #201214; border-color: rgba(232,113,122,.4) }

.seg {
  display: inline-flex; gap: 4px; padding: 4px; border-radius: 14px;
  background: #0c0c0f; border: 1px solid var(--line);
}
.seg-btn {
  border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 650;
  font-size: 13px; padding: 10px 14px; border-radius: 10px; cursor: pointer; transition: .2s;
}
.seg-btn.on {
  background: linear-gradient(135deg, var(--accent-strong), var(--accent));
  color: #1a140c; box-shadow: 0 6px 18px rgba(201,168,124,.2);
}

.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px; position: relative; z-index: 1;
}
.login-card {
  width: min(420px, 100%);
  background: linear-gradient(180deg, #17171c, #111114);
  border: 1px solid var(--line); border-radius: 28px; padding: 36px 32px;
  box-shadow: var(--shadow); animation: rise .6s ease both;
}
.login-card h1 { font-size: 30px; margin: 0 0 8px; color: var(--ink); background: none; -webkit-text-fill-color: initial }
.login-card p { color: var(--muted); line-height: 1.5; font-size: 14px; margin: 0 0 24px }
.err { color: var(--danger); font-size: 13px; margin: 0 0 12px }

@keyframes rise {
  from { opacity: 0; transform: translateY(12px) }
  to { opacity: 1; transform: none }
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(201,168,124,.5) }
  70% { box-shadow: 0 0 0 12px rgba(201,168,124,0) }
  100% { box-shadow: 0 0 0 0 rgba(201,168,124,0) }
}

::-webkit-scrollbar { width: 8px }
::-webkit-scrollbar-thumb { background: #2e2e36; border-radius: 99px }
