/* СВАЙПЕР — личный кабинет */
:root {
  --bg: #050810;
  --surface: #0C1020;
  --surface-2: #101528;
  --border: #1A2040;
  --border-light: #252D50;
  --cyan: #00E5FF;
  --cyan-dim: #00E5FF33;
  --steel: #7A8298;
  --text: #C8CDE0;
  --text-bright: #F0F2F8;
  --success: #00FF94;
  --danger: #FF4060;
  --amber: #FFB84D;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  min-height: 100vh;
  font-family: "IBM Plex Mono", monospace;
  font-weight: 300;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 60px 60px;
  opacity: 0.22;
  pointer-events: none;
  z-index: 0;
}

a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }

h1, h2, h3, .brand {
  font-family: "Unbounded", sans-serif;
  font-weight: 500;
  color: var(--text-bright);
}

.shell { position: relative; z-index: 1; min-height: 100vh; display: flex; flex-direction: column; width: 100%; overflow-x: hidden; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(5, 8, 16, 0.9);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 20;
  width: 100%;
  min-width: 0;
}

.brand { display: inline-flex; align-items: center; gap: 10px; letter-spacing: 0.08em; text-transform: uppercase; font-size: 0.95rem; font-weight: 700; min-width: 0; flex-shrink: 1; }
.brand-icon,
.brand svg {
  width: 28px;
  height: 28px;
  max-width: 28px;
  max-height: 28px;
  flex: 0 0 28px;
  display: block;
  color: var(--cyan);
}

.nav { display: flex; gap: 8px; flex-wrap: wrap; }
.nav a {
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--steel);
  border: 1px solid transparent;
}
.nav a:hover, .nav a.active {
  color: var(--text-bright);
  border-color: var(--border-light);
  background: var(--surface);
}

.topbar-actions { display: flex; align-items: center; gap: 10px; }
.user-chip { color: var(--steel); font-size: 0.8rem; }

.layout {
  width: min(1100px, calc(100% - 32px));
  margin: 28px auto 48px;
}

.auth-wrap {
  width: min(440px, calc(100% - 32px));
  margin: 72px auto;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
}

.card + .card { margin-top: 16px; }

.eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 8px;
}

.muted { color: var(--steel); font-size: 0.9rem; }
.error { color: var(--danger); font-size: 0.85rem; margin-top: 10px; }
.success { color: var(--success); font-size: 0.85rem; margin-top: 10px; }

.grid-2 {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 16px;
  align-items: stretch;
}

.grid-2 > .card {
  height: 100%;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.stat {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}
.stat strong {
  display: block;
  font-family: "Unbounded", sans-serif;
  font-size: 1.35rem;
  color: var(--text-bright);
  margin-top: 6px;
}
.stat .stat-hint {
  display: block;
  margin-top: 8px;
  font-size: 0.78rem;
  color: var(--steel);
  line-height: 1.4;
}

.outcome-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}
.outcome-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  background: var(--surface-2);
}
.outcome-card.pass {
  border-color: rgba(0, 255, 148, 0.28);
  background: linear-gradient(160deg, rgba(0, 255, 148, 0.08), var(--surface-2) 55%);
}
.outcome-card.block {
  border-color: rgba(255, 64, 96, 0.28);
  background: linear-gradient(160deg, rgba(255, 64, 96, 0.08), var(--surface-2) 55%);
}
.outcome-card .outcome-label {
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--steel);
  margin-bottom: 6px;
}
.outcome-card .outcome-value {
  font-family: "Unbounded", sans-serif;
  font-size: 1.7rem;
  color: var(--text-bright);
  line-height: 1.1;
}
.outcome-card.pass .outcome-value { color: var(--success); }
.outcome-card.block .outcome-value { color: var(--danger); }
.outcome-card .outcome-meta {
  margin-top: 8px;
  font-size: 0.82rem;
  color: var(--steel);
  line-height: 1.45;
}

.outcome-split {
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  display: flex;
  background: var(--border);
  margin: 4px 0 10px;
}
.outcome-split .pass-fill {
  background: var(--success);
  min-width: 0;
}
.outcome-split .block-fill {
  background: var(--danger);
  min-width: 0;
}
.outcome-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 0.8rem;
  color: var(--steel);
  margin-bottom: 14px;
}
.outcome-legend span::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.outcome-legend .lg-pass::before { background: var(--success); }
.outcome-legend .lg-block::before { background: var(--danger); }
.outcome-legend .lg-show::before { background: #64748b; }

@media (max-width: 720px) {
  .outcome-grid { grid-template-columns: 1fr; }
}

label {
  display: block;
  font-size: 0.78rem;
  color: var(--steel);
  margin: 14px 0 6px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

input, textarea, select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  color: var(--text-bright);
  padding: 12px 14px;
  outline: none;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px var(--cyan-dim);
}
textarea { min-height: 96px; resize: vertical; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 11px 16px;
  cursor: pointer;
  transition: 0.15s ease;
}
.btn-primary {
  background: linear-gradient(135deg, #00E5FF, #00B8D4);
  color: #031018;
  font-weight: 600;
}
.btn-primary:hover { filter: brightness(1.05); }
.btn-ghost {
  background: transparent;
  border-color: var(--border-light);
  color: var(--text);
}
.btn-ghost:hover { border-color: var(--cyan); color: var(--text-bright); }
.btn-danger {
  background: transparent;
  border-color: #5a2030;
  color: var(--danger);
}
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.btn.block { width: 100%; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.table th, .table td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.table th { color: var(--steel); font-weight: 400; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; }
.table a { color: var(--cyan); }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  border: 1px solid var(--border-light);
  color: var(--steel);
}
.badge.ok { color: var(--success); border-color: #14553a; }
.badge.warn { color: var(--amber); border-color: #5a4520; }

.code-block {
  position: relative;
  background: #070b14;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 14px;
  overflow: auto;
  font-size: 0.78rem;
  color: #b7d7e8;
  white-space: pre;
  line-height: 1.5;
}

.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
}

.steps { list-style: none; counter-reset: step; }
.steps li {
  counter-increment: step;
  position: relative;
  padding: 12px 12px 12px 48px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  margin-bottom: 10px;
}
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 12px;
  top: 12px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--cyan-dim);
  color: var(--cyan);
  font-size: 0.75rem;
}

.key-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.key-row code {
  flex: 1;
  background: #070b14;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  overflow: auto;
  color: var(--amber);
  font-size: 0.82rem;
}

.notice {
  border: 1px solid #3a2a10;
  background: #181208;
  color: var(--amber);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 0.85rem;
  margin-bottom: 16px;
}

.notice a {
  color: var(--cyan);
  text-decoration: underline;
}

.notice-warning {
  border-color: #4a3a12;
  background: #1a1408;
  color: #ffd27a;
}

.notice-critical {
  border-color: #5a2418;
  background: #1a0d0d;
  color: #ff9b8f;
}

.notice-danger {
  border-color: #5a1828;
  background: #180810;
  color: #ff7a96;
}

.quota-meter {
  margin-top: 12px;
}

.quota-bar {
  height: 8px;
  border-radius: 999px;
  background: #101528;
  border: 1px solid var(--border);
  overflow: hidden;
}

.quota-bar-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #00E5FF, #0088AA);
  transition: width 0.35s ease;
}

.quota-bar-fill-warning {
  background: linear-gradient(90deg, #ffb84d, #ff8f2a);
}

.quota-bar-fill-critical,
.quota-bar-fill-danger {
  background: linear-gradient(90deg, #ff4060, #cc2040);
}

.quota-bar-label {
  margin-top: 8px;
  font-size: 0.82rem;
  color: var(--steel);
}

.empty {
  text-align: center;
  padding: 36px 16px;
  color: var(--steel);
}

.metrica-guide {
  display: grid;
  gap: 12px;
}

.metrica-goal {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  padding: 14px;
}

.metrica-goal h3 {
  font-size: 0.95rem;
  margin-bottom: 8px;
}

.metrica-meta {
  display: grid;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--steel);
  margin-bottom: 10px;
}

.metrica-meta strong {
  color: var(--text-bright);
  font-weight: 500;
}

.metrica-setup {
  list-style: decimal;
  padding-left: 20px;
  color: var(--steel);
  font-size: 0.86rem;
  line-height: 1.6;
}

.metrica-setup li + li {
  margin-top: 6px;
}

.color-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.color-grid input[type="color"] {
  height: 42px;
  padding: 4px;
  cursor: pointer;
}

.ticket-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}
.ticket-list-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  color: inherit;
}
.ticket-list-item:hover,
.ticket-list-item.active {
  border-color: var(--cyan-dim);
  background: rgba(0, 212, 255, 0.06);
}
.ticket-chat-panel { min-height: 480px; }
.ticket-chat {
  display: flex;
  flex-direction: column;
  min-height: 420px;
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.ticket-chat-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 24px;
}
.ticket-chat-head {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}
.ticket-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 340px;
}
.ticket-msg { max-width: 88%; }
.ticket-msg-user { align-self: flex-start; }
.ticket-msg-admin { align-self: flex-end; }
.ticket-msg-meta { font-size: 0.72rem; color: var(--steel); margin-bottom: 4px; }
.ticket-msg-body {
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.88rem;
  line-height: 1.5;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
}
.ticket-msg-admin .ticket-msg-body {
  background: rgba(0, 212, 255, 0.1);
  border-color: var(--cyan-dim);
}
.ticket-compose {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--border);
}
.ticket-compose textarea {
  flex: 1;
  min-height: 64px;
  margin: 0;
}

@media (max-width: 860px) {
  .grid-2, .stats { grid-template-columns: 1fr; }
  .layout { width: calc(100% - 24px); margin: 16px auto 32px; min-width: 0; max-width: 100%; }
  .topbar { padding: 12px 16px; gap: 10px; }
  .topbar .nav { display: none; }
  .nav-toggle { display: flex; }
  .user-chip { display: none; }
  .card { padding: 18px 16px; min-width: 0; max-width: 100%; }
  .brand { font-size: 0.9rem; min-width: 0; flex-shrink: 1; }
  .table { display: block; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .key-row { flex-direction: column; align-items: stretch; }
  .btn-row { flex-wrap: wrap; }
  .btn-row .btn { flex: 1 1 auto; min-width: 0; }
  .color-grid { grid-template-columns: 1fr; }
  .ticket-chat-layout { grid-template-columns: 1fr; }
}

/* Mobile nav drawer (cabinet + admin) */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text-bright);
  transition: transform 0.2s, opacity 0.2s;
}
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.nav-mobile-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 16, 0.72);
  z-index: 90;
}
.nav-mobile-backdrop.open { display: block; }

.nav-mobile-panel {
  display: none;
  position: fixed;
  top: 0;
  right: 0;
  width: min(300px, 88vw);
  height: 100%;
  padding: 72px 20px 24px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 95;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}
.nav-mobile-panel.open { display: flex; }
.nav-mobile-panel a {
  padding: 12px 14px;
  border-radius: 10px;
  color: var(--steel);
  border: 1px solid transparent;
}
.nav-mobile-panel a:hover,
.nav-mobile-panel a.active {
  color: var(--text-bright);
  border-color: var(--border-light);
  background: var(--surface-2);
}

body.nav-open { overflow: hidden; }

/* ── BILLING ── */
.billing-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.billing-period-toggle {
  display: inline-flex;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  gap: 4px;
}

.billing-period-btn {
  border: 0;
  background: transparent;
  color: var(--steel);
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.82rem;
}

.billing-period-btn.active {
  background: var(--surface-2);
  color: var(--text-bright);
  box-shadow: inset 0 0 0 1px var(--border-light);
}

.billing-period-badge {
  font-size: 0.65rem;
  color: var(--success);
}

.billing-plans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.billing-loading {
  grid-column: 1 / -1;
  padding: 12px 0;
}

.billing-plan {
  position: relative;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  min-height: 180px;
}

.billing-plan.is-featured {
  border-color: rgba(0, 229, 255, 0.35);
}

.billing-plan.is-current {
  border-color: rgba(0, 255, 148, 0.4);
  background: rgba(0, 255, 148, 0.04);
}

.billing-plan-tag {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--cyan);
}

.billing-plan h3 {
  font-size: 0.92rem;
  margin-bottom: 6px;
  padding-right: 64px;
}

.billing-plan-meta {
  font-size: 0.76rem;
  color: var(--steel);
  line-height: 1.45;
}

.billing-plan-price {
  margin-top: auto;
  padding-top: 12px;
  font-family: "Unbounded", sans-serif;
  font-size: 1.25rem;
  color: var(--text-bright);
}

.billing-plan-period {
  font-size: 0.72rem;
  color: var(--steel);
  margin-top: 2px;
}

.billing-plan-action {
  margin-top: 12px;
}

.billing-plan-action .btn {
  width: 100%;
  justify-content: center;
}

.billing-plan-current {
  display: block;
  text-align: center;
  font-size: 0.78rem;
  color: var(--success);
  padding: 10px;
  border: 1px solid rgba(0, 255, 148, 0.35);
  border-radius: 8px;
}

.billing-benefits {
  list-style: none;
  margin: 0 0 4px;
  padding: 0;
  display: grid;
  gap: 8px;
}

.billing-benefits li {
  font-size: 0.86rem;
  color: var(--steel);
  padding-left: 16px;
  position: relative;
}

.billing-benefits li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--cyan);
}

@media (max-width: 860px) {
  .billing-toolbar { align-items: flex-start; flex-direction: column; }
  .billing-plans-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 520px) {
  .billing-plans-grid { grid-template-columns: 1fr; }
  .layout { width: calc(100% - 16px); margin: 12px auto 24px; }
  .topbar { padding: 10px 12px; }
  .card { padding: 16px 12px; }
  .stats { gap: 10px; }
  .stat { padding: 14px 12px; }
  h1 { font-size: 1.35rem !important; }
}
