:root {
  --bg: #070b16;
  --bg2: #0d1528;
  --panel: rgba(16, 24, 43, .78);
  --panel-solid: #121a2e;
  --line: rgba(130, 160, 220, .16);
  --text: #f3f6ff;
  --muted: #8ea0c4;
  --accent: #5ef0c0;
  --accent-2: #7aa2ff;
  --warn: #ffc56d;
  --danger: #ff8b8b;
  --ok: #5ef0c0;
  --shadow: 0 18px 50px rgba(0, 0, 0, .35);
  --radius: 18px;
  --font: "Manrope", Inter, ui-sans-serif, system-ui, sans-serif;
}
* { box-sizing: border-box }
html, body { margin: 0; min-height: 100% }
body {
  color: var(--text);
  font: 15px/1.55 var(--font);
  background:
    radial-gradient(1200px 600px at 90% -10%, rgba(90, 140, 255, .22), transparent 55%),
    radial-gradient(900px 500px at -10% 110%, rgba(70, 230, 180, .12), transparent 50%),
    linear-gradient(180deg, var(--bg2), var(--bg));
  overflow-x: hidden;
}
body::before {
  content: "";
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='.045'/></svg>");
  opacity: .35;
}
.orb {
  position: fixed; z-index: 0; pointer-events: none; filter: blur(40px);
  animation: drift 18s ease-in-out infinite;
}
.orb.a { width: 280px; height: 280px; right: 8%; top: 8%; background: rgba(90,140,255,.18) }
.orb.b { width: 220px; height: 220px; left: 18%; bottom: 6%; background: rgba(94,240,192,.1); animation-delay: -7s }
@keyframes drift {
  0%,100% { transform: translate(0,0) scale(1) }
  50% { transform: translate(18px,-24px) scale(1.08) }
}

.shell { display: grid; grid-template-columns: 250px minmax(0,1fr); min-height: 100vh; position: relative; z-index: 1 }
.side {
  padding: 22px 14px 90px;
  border-right: 1px solid var(--line);
  background: rgba(8,12,24,.72);
  backdrop-filter: blur(18px);
  position: sticky; top: 0; height: 100vh;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-size: 18px; font-weight: 800; letter-spacing: -.4px;
  margin: 4px 10px 22px;
}
.brand-mark {
  width: 34px; height: 34px; border-radius: 12px;
  background: linear-gradient(135deg, #6ee7b7, #79a9ff);
  box-shadow: 0 8px 20px rgba(94,240,192,.25);
  animation: pulse 3.4s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { transform: scale(1) } 50% { transform: scale(1.06) } }
.brand b { color: var(--accent) }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; margin: 3px 0; border-radius: 12px;
  color: var(--muted); text-decoration: none; font-weight: 650;
  transition: background .2s, color .2s, transform .2s;
}
.nav a:hover { background: rgba(122,162,255,.1); color: var(--text); transform: translateX(3px) }
.nav a.active { background: linear-gradient(90deg, rgba(94,240,192,.16), rgba(122,162,255,.08)); color: var(--text) }
.nav .dot { width: 7px; height: 7px; border-radius: 99px; background: currentColor; opacity: .55 }
.foot { position: absolute; bottom: 18px; left: 18px; right: 18px; color: var(--muted); font-size: 12px }
.foot a { color: inherit }

.main { padding: 28px 32px 48px; max-width: 1540px; width: 100%; margin: auto }
.topbar {
  display: flex; justify-content: space-between; gap: 16px; align-items: flex-start;
  margin-bottom: 22px;
}
.top h1, .topbar h1 { font-size: 30px; letter-spacing: -1.2px; margin: 0 }
.top p, .lede { color: var(--muted); margin: 6px 0 0 }
.livebar {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
}
.pill, .chip {
  display: inline-flex; align-items: center; gap: 7px;
  border-radius: 99px; padding: 6px 11px; font-size: 12px; font-weight: 700;
  border: 1px solid var(--line); background: rgba(16,24,43,.7);
}
.pill.live::before, .live-dot {
  content: ""; width: 8px; height: 8px; border-radius: 99px; background: var(--accent);
  box-shadow: 0 0 0 0 rgba(94,240,192,.7);
  animation: ping 1.6s infinite;
}
@keyframes ping {
  0% { box-shadow: 0 0 0 0 rgba(94,240,192,.55) }
  70% { box-shadow: 0 0 0 8px rgba(94,240,192,0) }
  100% { box-shadow: 0 0 0 0 rgba(94,240,192,0) }
}
.pill.warn { color: var(--warn); border-color: rgba(255,197,109,.3) }
.pill.ok { color: var(--accent); border-color: rgba(94,240,192,.3) }

.grid { display: grid; gap: 16px }
.stats { grid-template-columns: repeat(4, minmax(0,1fr)) }
.two { grid-template-columns: 1.1fr .9fr }
.workspace { grid-template-columns: minmax(0, 1fr) 300px; align-items: start }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  animation: rise .55s ease both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(10px) }
  to { opacity: 1; transform: none }
}
.card:nth-child(2) { animation-delay: .05s }
.card:nth-child(3) { animation-delay: .1s }
.card:nth-child(4) { animation-delay: .15s }
.label { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 700 }
.value { font-size: 30px; font-weight: 800; margin-top: 6px; letter-spacing: -1px }
.section { margin-top: 18px }
.section h2, .card h2 { font-size: 16px; margin: 0 0 12px }
.button, button.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 11px; padding: 10px 14px;
  background: linear-gradient(180deg, #8eb6ff, #6b94f0);
  color: #071426; font-weight: 800; text-decoration: none; cursor: pointer;
  transition: transform .15s, filter .15s;
}
.button:hover { transform: translateY(-1px); filter: brightness(1.05) }
.button.ghost { background: rgba(26,41,69,.9); color: var(--text); border: 1px solid var(--line) }
.button.warn { background: linear-gradient(180deg, #ffd48a, #f0b24a) }
.button:disabled { opacity: .45; cursor: not-allowed; transform: none }
input, select, textarea {
  width: 100%; padding: 10px 12px; border-radius: 11px;
  border: 1px solid #334566; background: #0b1427; color: var(--text); font: inherit;
  transition: border-color .2s, box-shadow .2s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: #6b94f0; box-shadow: 0 0 0 3px rgba(122,162,255,.18);
}
label { display: block; color: var(--muted); font-size: 13px; margin-bottom: 12px }
.field { position: relative }
.tip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; margin-left: 6px; border-radius: 99px;
  background: rgba(122,162,255,.2); color: var(--accent-2); font-size: 11px; font-weight: 800;
  cursor: help; vertical-align: middle;
}
.tip:hover + .tipbox, .tip:focus + .tipbox, .field:hover .tipbox.showish { opacity: 1; transform: translateY(0); pointer-events: auto }
.tipbox {
  position: absolute; left: 0; top: calc(100% - 8px); z-index: 5;
  min-width: 240px; max-width: 320px; padding: 10px 12px;
  background: #10192f; border: 1px solid var(--line); border-radius: 12px;
  color: var(--text); font-size: 12px; line-height: 1.4;
  box-shadow: var(--shadow); opacity: 0; transform: translateY(6px);
  pointer-events: none; transition: .18s ease;
}
table { width: 100%; border-collapse: collapse }
th { text-align: left; font-size: 12px; color: var(--muted); padding: 0 8px 10px }
td { padding: 12px 8px; border-top: 1px solid var(--line); vertical-align: top }
tr.flash { animation: flash .9s ease }
@keyframes flash { from { background: rgba(94,240,192,.16) } to { background: transparent } }
.status { font-size: 12px; font-weight: 700 }
.ok { color: var(--ok) }
.warning { color: var(--warn) }
.muted { color: var(--muted) }
.actions { display: flex; gap: 8px; flex-wrap: wrap }
.empty { padding: 36px; color: var(--muted); text-align: center }

.coach {
  position: sticky; top: 18px;
  background: linear-gradient(180deg, rgba(18,32,62,.95), rgba(12,20,40,.92));
  border: 1px solid var(--line); border-radius: 18px; padding: 16px 16px 14px;
}
.coach h3 { margin: 0 0 8px; font-size: 14px }
.coach ol { margin: 0; padding-left: 18px; color: var(--muted) }
.coach li { margin: 6px 0 }
.coach li b { color: var(--text) }
.help-fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 20;
  width: 52px; height: 52px; border-radius: 18px; border: 0;
  background: linear-gradient(135deg, #6ee7b7, #79a9ff); color: #071426;
  font-weight: 900; font-size: 20px; cursor: pointer; box-shadow: var(--shadow);
}
.drawer {
  position: fixed; right: 18px; bottom: 84px; width: min(380px, calc(100vw - 32px));
  background: #10192f; border: 1px solid var(--line); border-radius: 18px;
  padding: 16px; z-index: 21; display: none; box-shadow: var(--shadow);
  animation: rise .35s ease;
}
.drawer.open { display: block }
.feed { max-height: 220px; overflow: auto }
.feed-item { display: flex; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 12px }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: #15203a; border: 1px solid var(--accent); color: var(--text);
  padding: 10px 14px; border-radius: 12px; z-index: 30; opacity: 0; transition: .25s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0) }

.login-wrap { min-height: 100vh; display: grid; place-items: center; position: relative; z-index: 1 }
.login-card { width: min(440px, 92vw); padding: 28px }
.steps { display: grid; gap: 8px; margin-top: 16px }
.step { display: flex; gap: 10px; color: var(--muted); font-size: 13px }
.step span { width: 22px; height: 22px; border-radius: 8px; background: rgba(122,162,255,.16); display: grid; place-items: center; color: var(--text); font-weight: 800 }

.tg-editor { display: grid; gap: 10px; margin-top: 8px }
.tg-toolbar { display: flex; flex-wrap: wrap; gap: 6px }
.tg-btn {
  border: 1px solid var(--line); background: #10192f; color: var(--text);
  border-radius: 9px; padding: 6px 9px; font-weight: 800; font-size: 12px; cursor: pointer;
}
.tg-btn:hover { border-color: #6b94f0 }
.tg-phone {
  background: #0e1621; border-radius: 16px; padding: 12px; border: 1px solid #1c2b3d;
}
.tg-phone-head { font-size: 11px; color: #8aa0b8; margin-bottom: 8px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase }
.tg-bubble {
  max-width: 92%; margin-left: auto; background: #182533; color: #e8f1fa;
  border-radius: 14px 14px 4px 14px; padding: 10px 12px; font-size: 15px; line-height: 1.45;
  white-space: pre-wrap; word-break: break-word;
}
.tg-bubble b, .tg-bubble strong { font-weight: 800 }
.tg-bubble i, .tg-bubble em { font-style: italic }
.tg-bubble u { text-decoration: underline }
.tg-bubble s { text-decoration: line-through; opacity: .85 }
.tg-bubble code, .tg-bubble pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: rgba(0,0,0,.28); border-radius: 6px; padding: 1px 5px;
}
.tg-bubble pre { display: block; padding: 8px; white-space: pre-wrap }
.tg-bubble a { color: #6ab3f3 }
.tg-bubble blockquote {
  margin: 0; padding-left: 10px; border-left: 3px solid #4fae7a; color: #cfe2d6;
}
.tg-spoiler {
  background: #3a4a5c; color: transparent; border-radius: 4px; cursor: pointer;
}
.tg-spoiler:hover, .tg-spoiler.open { color: inherit; background: rgba(58,74,92,.4) }
.tg-mini { max-width: 360px; margin: 0 }

@media (max-width: 1100px) {
  .workspace { grid-template-columns: 1fr }
}
@media (max-width: 980px) {
  .shell { display: block }
  .side { position: static; height: auto; padding-bottom: 16px }
  .nav { display: flex; overflow: auto }
  .nav a { white-space: nowrap }
  .foot { position: static; margin-top: 12px }
  .stats, .two { grid-template-columns: 1fr 1fr }
  .main { padding: 18px }
}
@media (max-width: 560px) {
  .stats, .two { grid-template-columns: 1fr }
  .topbar { display: block }
}
