:root {
  --vh-bg: #0c0b12;
  --vh-bg-soft: #14121f;
  --vh-card: rgba(255, 255, 255, 0.04);
  --vh-border: rgba(255, 255, 255, 0.08);
  --vh-primary: #6d4aff;
  --vh-accent: #ff5aa5;
  --vh-gold: #d4af37;
  --vh-text: #f5f3ff;
  --vh-muted: #9b96b8;
  --vh-success: #34d399;
  --vh-radius: 18px;
  --vh-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }
body.vh-portal {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: radial-gradient(circle at top right, rgba(109, 74, 255, 0.18), transparent 40%),
    radial-gradient(circle at bottom left, rgba(255, 90, 165, 0.12), transparent 35%),
    var(--vh-bg);
  color: var(--vh-text);
  min-height: 100vh;
  overflow-x: hidden;
}

.vh-auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.vh-auth-card {
  width: min(420px, 100%);
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
  border: 1px solid var(--vh-border);
  border-radius: calc(var(--vh-radius) + 4px);
  padding: 36px 32px;
  box-shadow: var(--vh-shadow);
  backdrop-filter: blur(12px);
}
.vh-brand {
  text-align: center;
  margin-bottom: 4px;
}
.vh-logo-img {
  display: block;
  height: auto;
  max-width: 100%;
  margin: 0 auto;
  background: transparent;
}
.vh-logo-img-sidebar {
  margin: 0;
  max-width: 112px;
}
.vh-tagline { color: var(--vh-muted); margin: 10px 0 28px; font-size: 0.95rem; }

.vh-form label { display: block; font-size: 0.8rem; color: var(--vh-muted); margin: 14px 0 6px; }
.vh-form input, .vh-form textarea {
  width: 100%;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--vh-border);
  border-radius: 12px;
  color: var(--vh-text);
  padding: 12px 14px;
  font: inherit;
}
.vh-form input:focus, .vh-form textarea:focus {
  outline: none;
  border-color: rgba(109, 74, 255, 0.6);
  box-shadow: 0 0 0 3px rgba(109, 74, 255, 0.15);
}

.vh-btn {
  border: none;
  border-radius: 12px;
  padding: 12px 18px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.vh-btn:active { transform: scale(0.98); }
.vh-btn-primary {
  width: 100%;
  margin-top: 20px;
  background: linear-gradient(135deg, var(--vh-primary), #8b5cf6);
  color: #fff;
}
.vh-btn-ghost { background: transparent; color: var(--vh-muted); width: 100%; margin-top: 12px; }
.vh-error { color: #fca5a5; font-size: 0.85rem; margin-top: 12px; }
.vh-success { color: var(--vh-success); font-size: 0.85rem; margin-top: 12px; }
.vh-auth-card-wide { width: min(480px, 100%); }
.vh-auth-card textarea {
  width: 100%;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--vh-border);
  border-radius: 12px;
  color: var(--vh-text);
  padding: 12px 14px;
  font: inherit;
  margin-bottom: 4px;
  resize: vertical;
}
.vh-link { color: #c4b5fd; text-decoration: none; }
.vh-link:hover { text-decoration: underline; }
.vh-pending-copy { color: var(--vh-muted); font-size: 0.92rem; line-height: 1.6; margin-bottom: 20px; }
.vh-pending-copy p { margin-bottom: 12px; }

.vh-app { display: flex; min-height: 100vh; }
.vh-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--vh-bg-soft);
  border-right: 1px solid var(--vh-border);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
}
.vh-brand-compact {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  margin-bottom: 28px;
  padding: 0 8px;
}
.vh-brand-sub {
  color: var(--vh-muted);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.3;
}
.vh-sidebar nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.vh-sidebar nav a {
  color: var(--vh-muted);
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.92rem;
}
.vh-sidebar nav a.active, .vh-sidebar nav a:hover {
  background: rgba(109, 74, 255, 0.15);
  color: #fff;
}

.vh-main { flex: 1; padding: 24px; min-width: 0; max-width: 100%; overflow-x: hidden; }
.vh-topbar {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 24px;
  min-width: 0;
}
.vh-topbar > div { min-width: 0; flex: 1; }
.vh-topbar h1 { margin: 0; font-size: 1.5rem; min-width: 0; overflow-wrap: anywhere; }
.vh-topbar p { margin: 4px 0 0; color: var(--vh-muted); font-size: 0.9rem; overflow-wrap: anywhere; }
.vh-menu-toggle {
  display: none;
  background: var(--vh-card);
  border: 1px solid var(--vh-border);
  color: var(--vh-text);
  border-radius: 10px;
  padding: 8px 12px;
}

.vh-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.vh-stat-card {
  background: var(--vh-card);
  border: 1px solid var(--vh-border);
  border-radius: var(--vh-radius);
  padding: 18px;
}
.vh-stat-card small { color: var(--vh-muted); display: block; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; }
.vh-stat-card strong {
  display: block;
  font-size: clamp(1.25rem, 5vw, 1.6rem);
  margin-top: 8px;
  overflow-wrap: anywhere;
}
.vh-stat-card em { font-style: normal; color: var(--vh-gold); font-size: 0.85rem; }

.vh-panel {
  background: var(--vh-card);
  border: 1px solid var(--vh-border);
  border-radius: var(--vh-radius);
  padding: 22px;
  min-width: 0;
  overflow: hidden;
}
.vh-panel h2 { margin: 0 0 16px; font-size: 1.05rem; overflow-wrap: anywhere; }
.vh-panel-note { color: var(--vh-muted); font-size: 0.85rem; margin: -8px 0 16px; line-height: 1.5; overflow-wrap: anywhere; }
.vh-copy-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; min-width: 0; }
.vh-copy-row > div { min-width: 0; }
.vh-copy-row label {
  display: block;
  font-size: 0.8rem;
  color: var(--vh-muted);
  margin-bottom: 6px;
}
.vh-copy-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--vh-border);
  border-radius: 12px;
  padding: 10px 12px;
  margin-top: 6px;
}
.vh-copy-field code {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.82rem;
  color: #ddd6fe;
  word-break: normal;
}
.vh-copy-btn {
  flex-shrink: 0;
  background: rgba(109, 74, 255, 0.25);
  border: none;
  color: #fff;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.75rem;
  cursor: pointer;
  white-space: nowrap;
}

.vh-qr-block {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 20px;
  align-items: center;
  margin-bottom: 22px;
  padding: 18px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid var(--vh-border);
  border-radius: var(--vh-radius);
  min-width: 0;
}
.vh-qr-preview-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 148px;
  min-height: 148px;
  background: #fff;
  border-radius: 14px;
  padding: 10px;
}
.vh-qr-preview {
  display: block;
  width: 128px;
  height: 128px;
  object-fit: contain;
}
.vh-qr-actions {
  min-width: 0;
}
.vh-qr-hint {
  color: var(--vh-muted);
  font-size: 0.85rem;
  line-height: 1.5;
  margin: 0 0 14px;
}
#vh-download-qr {
  width: auto;
  margin-top: 0;
  min-width: 180px;
}

.vh-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--vh-border);
  border-radius: var(--vh-radius);
}
.vh-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.vh-table th, .vh-table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--vh-border); }
.vh-table th { color: var(--vh-muted); font-weight: 500; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; }
.vh-muted { color: var(--vh-muted); text-align: center; }
.vh-form-wide { max-width: 640px; }
.vh-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.vh-loading { color: var(--vh-muted); }

@media (max-width: 860px) {
  .vh-app { flex-direction: column; }
  .vh-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.35);
  }
  .vh-sidebar.open { transform: translateX(0); }
  .vh-menu-toggle { display: inline-block; flex-shrink: 0; }
  .vh-copy-row, .vh-form-grid { grid-template-columns: 1fr; }
  .vh-qr-block { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .vh-qr-actions { width: 100%; }
  #vh-download-qr { width: 100%; }
  .vh-main { padding: 16px; }
  .vh-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 480px) {
  .vh-auth-wrap { padding: 16px; }
  .vh-auth-card { padding: 28px 20px; }

  .vh-main { padding: 14px; }
  .vh-topbar { margin-bottom: 18px; }
  .vh-topbar h1 { font-size: 1.25rem; }

  .vh-stats { grid-template-columns: 1fr; gap: 10px; }
  .vh-stat-card { padding: 14px; }

  .vh-panel { padding: 16px; }

  .vh-copy-field {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px;
  }
  .vh-copy-field code {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    word-break: break-all;
    overflow-wrap: anywhere;
    line-height: 1.45;
  }
  .vh-copy-btn {
    width: 100%;
    padding: 10px 12px;
    font-size: 0.85rem;
  }

  .vh-table { min-width: 520px; }
  .vh-table th, .vh-table td { padding: 10px; font-size: 0.82rem; }

  .vh-form-wide { max-width: 100%; }
}
