:root {
  /* Базовые цвета — истинный OLED Black */
  --bg-base: #000000;
  --bg-card: #0d0d0d;
  --bg-card-subtle: #0a0a0a;
  --bg-card-hover: #141414;
  --bg-modal: #0a0a0a;
  --bg-pill-active: #161616;

  /* Границы — сверхтонкие, едва заметные */
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-dashed: rgba(255, 255, 255, 0.14);
  --border-hover: rgba(255, 255, 255, 0.20);
  --border-active: #ffffff;

  /* Текст — строгая иерархия */
  --text-main: #ffffff;
  --text-muted: rgba(255, 255, 255, 0.60);
  --text-dim: rgba(255, 255, 255, 0.35);

  /* Главный сигнальный акцент (Acid Lime) */
  --accent-primary: #ccff00;
  --accent-primary-hover: #b8e600;
  --accent-glow: rgba(204, 255, 0, 0.04);

  /* Вспомогательные индикаторы */
  --dot-online: #ccff00;
  --dot-error: #ff4444;

  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.12);

  --radius-xl: 20px;
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 6px;

  --font-main: 'Plus Jakarta Sans', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-base);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Navbar */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
}

.brand-link {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: inherit;
}

.brand-group {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.brand-title {
  font-size: 1.35rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  color: #ffffff;
}

.brand-tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 4px;
  background: #181818;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.nav-user-pill:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
  transform: scale(1.02);
}

.user-mini-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
}

/* Main Content */
.main-content {
  flex: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 24px 60px;
  position: relative;
}

.hidden {
  display: none !important;
}

/* Card Styles */
.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 32px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.8);
  position: relative;
}

.card-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 24px 0;
}

/* OAuth Consent Card */
.consent-card {
  max-width: 480px;
  margin: 20px auto;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: var(--bg-modal);
}

.app-request-header {
  display: flex;
  align-items: center;
  gap: 16px;
}

.app-avatar {
  width: 54px;
  height: 54px;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: #ffffff;
}

.app-request-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 800;
  color: var(--accent-primary);
  background: rgba(204, 255, 0, 0.08);
  border: 1px solid rgba(204, 255, 0, 0.16);
  padding: 2px 7px;
  border-radius: 4px;
  margin-bottom: 6px;
}

.app-name {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.app-domain {
  font-size: 0.82rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.consent-user-preview {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #000000;
  border: 1px solid var(--border-subtle);
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
}

.user-avatar-wrap {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  flex-shrink: 0;
  background: #141414;
}

.user-info-text {
  flex: 1;
  min-width: 0;
}

.user-display-name {
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-username {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.user-status-pill {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  background: #111111;
  border: 1px solid var(--border-subtle);
  padding: 4px 9px;
  border-radius: 999px;
}

.dot-online {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--dot-online);
  box-shadow: 0 0 6px rgba(204, 255, 0, 0.4);
}

.scope-box {
  background: #000000;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 24px;
}

.scope-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.scope-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.scope-list li {
  font-size: 0.84rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 10px;
}

.scope-list li i {
  color: var(--accent-primary);
  font-size: 0.8rem;
}

.consent-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.consent-auth-intro {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  text-align: center;
}

/* Tabs */
.auth-tabs {
  display: flex;
  gap: 6px;
  background: #000000;
  padding: 4px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  border: 1px solid var(--border-subtle);
}

.auth-tab-btn {
  flex: 1;
  padding: 8px 12px;
  font-size: 0.84rem;
  font-weight: 700;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.auth-tab-btn:hover {
  color: #ffffff;
}

.auth-tab-btn.active {
  background: var(--bg-pill-active);
  color: #ffffff;
  border: 1px solid #ffffff;
}

/* Forms */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-label span.req {
  color: var(--accent-primary);
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 14px;
  color: var(--text-dim);
  font-size: 0.88rem;
  pointer-events: none;
}

.form-input {
  width: 100%;
  padding: 12px 14px 12px 38px;
  background: #000000;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: #ffffff;
  font-size: 0.92rem;
  font-family: inherit;
  transition: var(--transition);
  outline: none;
}

.form-input:focus {
  border-color: #ffffff;
  box-shadow: 0 0 0 1px #ffffff;
}

.form-input::placeholder {
  color: rgba(255, 255, 255, 0.25);
}

/* Avatar Selector */
.avatar-selector {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.avatar-option {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: #000000;
  cursor: pointer;
  font-size: 1.3rem;
  color: #ffffff;
  transition: var(--transition);
}

.avatar-option:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  transform: scale(1.04);
}

.avatar-option.selected {
  border-color: var(--accent-primary);
  background: #141414;
}

.avatar-option.selected i {
  color: var(--accent-primary);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.92rem;
  font-weight: 800;
  padding: 12px 20px;
  border-radius: 12px;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  font-family: var(--font-main);
  text-decoration: none;
}

.btn-primary {
  background: #ffffff;
  color: #000000;
}

.btn-primary:hover {
  background: #e6e6e6;
  transform: scale(1.02);
}

.btn-primary:active {
  transform: scale(0.96);
}

.btn-accent {
  background: var(--accent-primary);
  color: #000000;
}

.btn-accent:hover {
  background: var(--accent-primary-hover);
  transform: scale(1.03);
}

.btn-accent:active {
  transform: scale(0.96);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

.btn-ghost:hover {
  background: var(--bg-card);
  color: #ffffff;
  border-color: var(--border-hover);
  transform: scale(1.02);
}

.btn-ghost:active {
  transform: scale(0.96);
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
  transform: scale(1.02);
}

.btn-danger:active {
  transform: scale(0.96);
}

.btn-block {
  width: 100%;
}

.btn-lg {
  padding: 14px 24px;
  font-size: 0.96rem;
}

/* Portal Grid Layout */
.portal-grid {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 28px;
  align-items: start;
}

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

.section-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 28px;
  margin-bottom: 24px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.section-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-title-wrap h2 {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.section-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 22px;
  line-height: 1.5;
}

.badge-count {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  background: #181818;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  color: var(--text-dim);
}

/* Ecosystem Apps Grid */
.apps-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

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

.app-card {
  background: #000000;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: var(--transition);
  position: relative;
}

.app-card:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
  transform: scale(1.02);
}

.app-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}

.app-card-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: #0d0d0d;
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: #ffffff;
}

.app-status-badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 4px;
}

.app-status-badge.connected {
  background: rgba(204, 255, 0, 0.1);
  color: var(--accent-primary);
  border: 1px solid rgba(204, 255, 0, 0.25);
}

.app-status-badge.available {
  background: #141414;
  color: var(--text-dim);
  border: 1px solid var(--border-subtle);
}

.app-card-title {
  font-size: 1.02rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.app-card-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 16px;
  flex: 1;
}

.app-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.app-card-domain {
  font-size: 0.74rem;
  font-family: var(--font-mono);
  color: var(--text-dim);
}

.app-card-link {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
}

.app-card-link:hover {
  color: var(--accent-primary);
}

/* User Profile Card */
.profile-card {
  text-align: center;
}

.profile-avatar-large {
  width: 86px;
  height: 86px;
  border-radius: 50%;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.3rem;
  background: #141414;
  border: 2px solid var(--border-hover);
  color: #ffffff;
}

.profile-name {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 4px;
}

.profile-username {
  font-size: 0.88rem;
  font-family: var(--font-mono);
  color: var(--accent-primary);
  margin-bottom: 16px;
}

.profile-meta {
  background: #000000;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 20px;
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: left;
}

.profile-meta-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
}

.profile-meta-row:not(:last-child) {
  border-bottom: 1px solid var(--border-subtle);
}

/* Info card */
.info-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
}

.info-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  color: #ffffff;
}

.info-card h3 {
  font-size: 0.96rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.info-card p {
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--text-muted);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #141414;
  border: 1px solid var(--border-subtle);
  color: #ffffff;
  padding: 10px 22px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  font-family: var(--font-main);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.9);
  z-index: 9999;
  transition: var(--transition);
}

.toast.error {
  border-color: rgba(239, 68, 68, 0.4);
  color: #ff6666;
}

.toast.success {
  border-color: rgba(204, 255, 0, 0.4);
  color: var(--accent-primary);
}
