:root {
  --bg-app: #090d14;
  --bg-card: #101622;
  --bg-card-hover: #151d2c;
  --bg-elevated: #182233;
  --bg-input: #0c111a;
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-active: rgba(99, 102, 241, 0.45);
  --border-focus: #6366f1;
  
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: rgba(99, 102, 241, 0.15);
  --primary-glow: rgba(99, 102, 241, 0.35);

  --accent-green: #10b981;
  --accent-green-bg: rgba(16, 185, 129, 0.12);
  --accent-purple: #a855f7;
  --accent-purple-bg: rgba(168, 85, 247, 0.14);
  --accent-blue: #38bdf8;
  --accent-blue-bg: rgba(56, 189, 248, 0.12);
  --accent-orange: #f59e0b;
  --accent-orange-bg: rgba(245, 158, 11, 0.12);
  --accent-danger: #ef4444;
  --accent-danger-bg: rgba(239, 68, 68, 0.12);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base Reset & Styles */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  padding-bottom: calc(30px + env(safe-area-inset-bottom));
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

.app-container {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 12px 14px 80px 14px;
  box-sizing: border-box;
  overflow-x: hidden;
  transition: max-width var(--transition-normal);
}

@media (min-width: 640px) {
  .app-container {
    max-width: 780px;
    padding: 24px 24px 90px 24px;
  }
}

@media (max-width: 360px) {
  .app-container {
    padding: 10px 10px 80px 10px;
  }
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0 14px 0;
  margin-bottom: 4px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.brand-area {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #4f46e5 0%, #818cf8 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 4px 14px var(--primary-glow);
  flex-shrink: 0;
}

.brand-info {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.brand-name {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-subtitle {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

#server-location-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
  animation: pulse-dot 2s infinite;
  flex-shrink: 0;
}

.flag-de-svg {
  display: inline-block;
  vertical-align: -1px;
  width: 16px;
  height: 11px;
  border-radius: 2px;
  box-shadow: 0 0 1px rgba(0, 0, 0, 0.5), 0 1px 2px rgba(0, 0, 0, 0.2);
  margin: 0 2px;
  flex-shrink: 0;
}

@keyframes pulse-dot {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.user-area {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  padding: 4px 10px 4px 5px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
  max-width: 135px;
  min-width: 0;
  margin-left: auto;
  box-sizing: border-box;
}

@media (min-width: 520px) {
  .user-area {
    max-width: 190px;
  }
}

.user-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  color: white;
  font-size: 10.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-handle {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1 1 auto;
}

/* Nav Tabs (2 Tabs Only) */
.nav-tabs {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 4px;
  margin-bottom: 16px;
  width: 100%;
}

.nav-tab {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 8px;
  background: transparent;
  border: none;
  border-radius: 10px;
  color: var(--text-muted);
  font-family: var(--font-main);
  cursor: pointer;
  transition: var(--transition-fast);
  overflow: hidden;
}

.nav-tab:hover {
  color: var(--text-secondary);
}

.nav-tab.active {
  background: var(--bg-elevated);
  color: var(--text-primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.nav-tab.active svg {
  color: var(--primary);
}

.nav-tab svg {
  flex-shrink: 0;
}

.tab-label {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.configs-counter-badge {
  background: var(--primary-light);
  color: #818cf8;
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  flex-shrink: 0;
}

/* Tab Contents */
.tab-content {
  display: none;
  width: 100%;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Cards General */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
  position: relative;
  overflow: hidden;
  width: 100%;
}

/* CTA Create Card */
.cta-create-card {
  margin-bottom: 16px;
  background: linear-gradient(135deg, rgba(30, 41, 65, 0.8) 0%, rgba(16, 22, 34, 0.95) 100%);
  border: 1px solid rgba(99, 102, 241, 0.28);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
}

.cta-create-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.cta-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.cta-icon-badge {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(129, 140, 248, 0.15));
  border: 1px solid rgba(99, 102, 241, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #a5b4fc;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.cta-text-wrap {
  min-width: 0;
}

.cta-create-title {
  font-size: 16.5px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.cta-create-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.btn-create-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  color: white;
  font-family: var(--font-main);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-fast);
  white-space: nowrap;
  box-shadow: 0 4px 18px rgba(99, 102, 241, 0.45);
  flex-shrink: 0;
}

.btn-create-primary:hover {
  background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
  box-shadow: 0 6px 22px rgba(99, 102, 241, 0.6);
}

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

/* Configs List Grid */
.configs-list-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

@media (min-width: 640px) {
  .configs-list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
  }
}

.config-item-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
  transition: var(--transition-fast);
  width: 100%;
}

.config-item-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

.config-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 8px;
}

.config-title-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.config-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.config-name {
  font-size: 15px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.btn-rename-trigger {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 3px 4px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease, background 0.15s ease;
  flex-shrink: 0;
}

.btn-rename-trigger:hover {
  color: var(--primary);
  background: rgba(99, 102, 241, 0.18);
}

/* Rename Modal Specific Styles */
.modal-rename-card {
  max-width: 420px;
}

.rename-modal-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.rename-icon-badge {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--primary-light);
  border: 1px solid rgba(99, 102, 241, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.rename-orig-badge {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.rename-orig-badge span {
  color: var(--accent-blue);
  font-family: var(--font-mono);
  font-weight: 600;
}

.rename-input-wrap {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 14px;
}

.rename-field-label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.2px;
}

.rename-input-box {
  position: relative;
  display: flex;
  align-items: center;
  background: #090e17;
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  padding: 2px 8px 2px 14px;
  transition: all 0.2s ease;
}

.rename-input-box:focus-within {
  border-color: var(--primary);
  background: #0b121e;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.22), 0 4px 16px rgba(0, 0, 0, 0.4);
}

.rename-text-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 14.5px;
  font-weight: 600;
  padding: 11px 4px 11px 0;
  min-width: 0;
}

.rename-text-input::placeholder {
  color: var(--text-muted);
  font-weight: 400;
  font-family: var(--font-main);
}

.btn-clear-rename-input {
  background: rgba(255, 255, 255, 0.07);
  border: none;
  color: var(--text-muted);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.btn-clear-rename-input:hover {
  background: rgba(239, 68, 68, 0.2);
  color: var(--accent-danger);
}

.rename-input-hint {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-muted);
  padding: 0 2px;
}

#rename-char-count {
  font-family: var(--font-mono);
  font-size: 10.5px;
}

/* Quick tags */
.rename-quick-tags {
  margin-bottom: 6px;
}

.rename-tags-title {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.quick-tags-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.quick-tag-chip {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.quick-tag-chip:hover {
  background: var(--primary-light);
  border-color: var(--border-active);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.quick-tag-chip:active {
  transform: scale(0.96);
}

.config-location {
  font-size: 11.5px;
  color: var(--text-muted);
}

.config-badges-wrap {
  display: flex;
  gap: 5px;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.proto-badge, .device-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.badge-green {
  background: var(--accent-green-bg);
  color: var(--accent-green);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-purple {
  background: var(--accent-purple-bg);
  color: var(--accent-purple);
  border: 1px solid rgba(168, 85, 247, 0.2);
}

.device-badge {
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.device-badge.dev-ios {
  background: rgba(56, 189, 248, 0.14);
  color: #7dd3fc;
  border-color: rgba(56, 189, 248, 0.25);
}

.device-badge.dev-android {
  background: rgba(16, 185, 129, 0.14);
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.25);
}

.device-badge.dev-windows {
  background: rgba(99, 102, 241, 0.14);
  color: #a5b4fc;
  border-color: rgba(99, 102, 241, 0.25);
}

.device-badge.dev-macos {
  background: rgba(244, 114, 182, 0.14);
  color: #f472b6;
  border-color: rgba(244, 114, 182, 0.25);
}

.device-badge.dev-keenetic {
  background: rgba(245, 158, 11, 0.14);
  color: #fcd34d;
  border-color: rgba(245, 158, 11, 0.25);
}

/* Stats Row */
.config-stats-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  margin-bottom: 12px;
  font-size: 11.5px;
}

.stat-group {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--text-secondary);
}

.stat-val {
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text-primary);
}

/* Action Buttons Layout (Two-tiered: Primary Action + Secondary Action Bar) */
.config-actions-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.card-btn-primary {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  color: white;
  font-family: var(--font-main);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px var(--primary-glow);
  transition: var(--transition-fast);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-btn-primary:hover {
  background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.55);
}

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

.card-secondary-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.action-btn-sm {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-family: var(--font-main);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
  white-space: nowrap;
  overflow: hidden;
}

.action-btn-sm span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.action-btn-sm:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.18);
}

.action-btn-sm.btn-danger-sm {
  flex: 0 0 36px;
  width: 36px;
  color: var(--accent-danger);
  padding: 8px 0;
}

.action-btn-sm.btn-danger-sm:hover {
  background: var(--accent-danger-bg);
  border-color: rgba(239, 68, 68, 0.35);
}

/* App Info Expand Row */
.config-device-info-bar {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.btn-show-inst {
  background: transparent;
  border: none;
  color: #a5b4fc;
  font-family: var(--font-main);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-show-inst:hover {
  text-decoration: underline;
}

/* Wizard Modal (Step-by-step) */
.modal-wizard-card {
  max-height: 85vh;
  overflow-y: auto;
}

.wizard-section {
  margin-bottom: 16px;
}

.wizard-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.wizard-step-badge {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wizard-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

/* Device Selector Grid (Wizard Step 2) */
.device-selector-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}

@media (max-width: 380px) {
  .device-selector-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.device-select-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 6px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-family: var(--font-main);
  cursor: pointer;
  transition: var(--transition-fast);
}

.device-select-btn .dev-btn-icon {
  font-size: 18px;
}

.device-select-btn .dev-btn-name {
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.device-select-btn.active {
  border-color: var(--primary);
  background: var(--bg-elevated);
  color: var(--text-primary);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.25);
}

/* Wizard Recommended App Preview */
.wizard-app-preview-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 8px;
}

.wizard-app-preview-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.wizard-app-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
}

.wizard-app-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.wizard-app-links {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* Region Help */
.region-help-box {
  background: linear-gradient(180deg, rgba(30, 26, 16, 0.8) 0%, rgba(20, 18, 12, 0.9) 100%);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius-sm);
  padding: 10px;
  font-size: 11.5px;
  color: #cbd5e1;
  line-height: 1.45;
  margin-top: 8px;
}

.region-help-box b {
  color: #fde68a;
}

/* Protocol Options */
.protocol-options-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.protocol-radio-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-fast);
}

.protocol-radio-card input {
  margin-top: 3px;
  accent-color: var(--primary);
}

.protocol-radio-card.active {
  border-color: var(--primary);
  background: var(--bg-elevated);
}

.radio-card-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 3px;
}

.recommended-tag {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent-green);
  background: var(--accent-green-bg);
  padding: 1px 6px;
  border-radius: var(--radius-full);
}

.router-tag {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent-purple);
  background: var(--accent-purple-bg);
  padding: 1px 6px;
  border-radius: var(--radius-full);
}

.radio-card-desc {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.4;
}

.text-input {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 13.5px;
  outline: none;
  transition: var(--transition-fast);
}

.text-input:focus {
  border-color: var(--border-focus);
}

.input-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

/* Modals */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 1000;
  align-items: flex-end;
  justify-content: center;
  padding: 10px;
}

.modal-overlay.active {
  display: flex;
  animation: fadeIn 0.2s ease-out;
}

.modal-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@media (min-width: 640px) {
  .modal-overlay {
    align-items: center;
    padding: 24px;
  }
  .modal-card {
    max-width: 500px;
    border-radius: var(--radius-lg);
    animation: desktopModalIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  }
}

@keyframes desktopModalIn {
  from { opacity: 0; transform: scale(0.95) translateY(0); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

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

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
}

.modal-body {
  margin-bottom: 18px;
}

.modal-footer {
  display: flex;
  gap: 8px;
}

.btn-primary, .btn-secondary, .btn-danger {
  flex: 1;
  padding: 11px;
  border-radius: var(--radius-md);
  font-family: var(--font-main);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
  border: none;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.btn-secondary:hover {
  color: var(--text-primary);
}

.btn-danger {
  background: var(--accent-danger);
  color: white;
}

/* App Download Links inside Modal */
.app-download-btn {
  flex: 1 1 auto;
  min-width: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  transition: var(--transition-fast);
  white-space: nowrap;
}

.app-download-btn:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.2);
}

.app-download-btn.btn-primary-link {
  background: var(--primary-light);
  border-color: rgba(99, 102, 241, 0.4);
  color: #c7d2fe;
}

.app-download-btn.btn-primary-link:hover {
  background: var(--primary);
  color: white;
}

/* Steps list */
.steps-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.step-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.step-number {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.step-content {
  flex: 1 1 auto;
  min-width: 0;
}

.step-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
  line-height: 1.3;
}

.step-desc {
  font-size: 11.5px;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* ==========================================================================
   Proxy Tab - Ultra-Polished, Fluid & Responsive (Zero Overflow)
   ========================================================================== */
.proxy-page-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.proxy-hero-card {
  background: linear-gradient(180deg, rgba(14, 25, 45, 0.95) 0%, rgba(10, 16, 28, 0.98) 100%);
  border: 1px solid rgba(56, 189, 248, 0.22);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5);
  padding: 18px 16px;
  border-radius: var(--radius-lg);
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.proxy-hero-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
  width: 100%;
  box-sizing: border-box;
}

.proxy-hero-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #0284c7 0%, #38bdf8 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 4px 16px rgba(56, 189, 248, 0.35);
  flex-shrink: 0;
}

.proxy-hero-info {
  flex: 1 1 auto;
  min-width: 0;
}

.proxy-badge-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.badge-proxy-status {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--accent-green);
  background: var(--accent-green-bg);
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge-proxy-loc {
  font-size: 10.5px;
  font-weight: 600;
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge-proxy-tls {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent-blue);
  background: var(--accent-blue-bg);
  border: 1px solid rgba(56, 189, 248, 0.25);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.proxy-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.25;
  margin: 0;
}

.proxy-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 3px;
  line-height: 1.4;
}

/* Action block */
.proxy-cta-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 18px;
}

.btn-proxy-connect-main {
  width: 100%;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 18px;
  background: linear-gradient(135deg, #0284c7 0%, #0ea5e9 100%);
  color: #ffffff;
  border-radius: var(--radius-md);
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 6px 20px rgba(14, 165, 233, 0.4);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  cursor: pointer;
  text-align: center;
}

.btn-proxy-connect-main:hover {
  background: linear-gradient(135deg, #0369a1 0%, #0284c7 100%);
  box-shadow: 0 8px 24px rgba(14, 165, 233, 0.5);
  transform: translateY(-1px);
}

.btn-proxy-connect-main:active {
  transform: scale(0.98);
}

.proxy-link-copy-box {
  width: 100%;
  box-sizing: border-box;
  background: rgba(8, 12, 20, 0.8);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: var(--radius-md);
  padding: 6px 8px 6px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.proxy-link-copy-box:hover {
  border-color: var(--accent-blue);
  background: rgba(14, 25, 45, 0.7);
}

.p-link-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
}

.p-link-icon {
  font-size: 13px;
  flex-shrink: 0;
}

.p-link-val {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-copy-chip {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 11.5px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
  border: none;
}

.btn-copy-chip:hover {
  background: var(--primary-light);
  color: var(--text-primary);
}

/* Features List */
.proxy-feature-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
}

@media (min-width: 640px) {
  .proxy-feature-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
}

.proxy-feature-row {
  background: rgba(12, 17, 26, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  box-sizing: border-box;
  width: 100%;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.proxy-feature-row:hover {
  border-color: rgba(56, 189, 248, 0.25);
  background: rgba(14, 25, 45, 0.5);
}

.p-feat-badge {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 1px;
}

.p-feat-text {
  flex: 1 1 auto;
  min-width: 0;
}

.p-feat-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
  line-height: 1.3;
}

.p-feat-desc {
  font-size: 11.5px;
  color: var(--text-secondary);
  line-height: 1.45;
}

/* QR Modal Specific */
.qr-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.qr-preview-box {
  width: 220px;
  height: 220px;
  background: #ffffff;
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.qr-preview-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.qr-helper-text {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
  max-width: 280px;
}

/* Delete Confirm Subtext */
.confirm-text {
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.confirm-subtext {
  font-size: 12px;
  color: var(--text-muted);
}

/* Toast */
.toast-notification {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(24, 34, 51, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-active);
  border-radius: var(--radius-full);
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 2000;
  pointer-events: none;
  max-width: 90vw;
  text-align: center;
}

.toast-notification.active {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-green-bg);
  color: var(--accent-green);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
  flex-shrink: 0;
}

/* Access Denied Overlay */
.access-denied-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-app);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.access-denied-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 28px 20px;
  text-align: center;
  max-width: 360px;
}

.denied-icon {
  font-size: 44px;
  margin-bottom: 14px;
}

.denied-title {
  font-size: 19px;
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.denied-desc {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 20px;
}

/* Spinner */
.loading-spinner-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 36px 0;
  color: var(--text-muted);
  font-size: 12.5px;
}

.spinner {
  width: 26px;
  height: 26px;
  border: 3px solid rgba(99, 102, 241, 0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   TELEGRAM MTPROTO PROXY TAB (PREMIUM DESIGN)
   ========================================================================== */

.proxy-page-container {
  width: 100%;
  max-width: 580px;
  margin: 0 auto;
  padding: 4px 4px 32px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-sizing: border-box;
}

/* Hero Card */
.proxy-hero-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, #0e1726 0%, #090e18 100%);
  border: 1px solid rgba(42, 171, 238, 0.22);
  border-radius: var(--radius-lg);
  padding: 22px 18px 18px;
  box-shadow: 0 16px 40px -10px rgba(0, 0, 0, 0.55), 0 0 32px -8px rgba(42, 171, 238, 0.12);
}

.proxy-glow-ambient {
  position: absolute;
  top: -40px;
  left: 50%;
  transform: translateX(-50%);
  width: 240px;
  height: 120px;
  background: radial-gradient(ellipse, rgba(42, 171, 238, 0.25), transparent 70%);
  pointer-events: none;
}

/* Badges Row */
.proxy-badge-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
  position: relative;
  z-index: 2;
}

.badge-proxy-status,
.badge-proxy-loc,
.badge-proxy-speed,
.badge-proxy-tls {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  padding: 3.5px 9px;
  border-radius: var(--radius-full);
  letter-spacing: 0.2px;
}

.badge-proxy-status {
  background: var(--accent-green-bg);
  color: var(--accent-green);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.badge-proxy-status .status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
  animation: pulse-dot 2s infinite ease-in-out;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

.badge-proxy-loc {
  background: rgba(42, 171, 238, 0.1);
  color: #38bdf8;
  border: 1px solid rgba(42, 171, 238, 0.25);
}

.badge-proxy-speed {
  background: rgba(245, 158, 11, 0.1);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.22);
}

.badge-proxy-tls {
  background: rgba(99, 102, 241, 0.12);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.25);
  font-family: var(--font-mono);
  font-size: 10.5px;
}

/* Shield Visual Graphic */
.proxy-shield-visual {
  position: relative;
  width: 82px;
  height: 82px;
  margin: 14px auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.proxy-shield-rings {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.proxy-shield-rings .ring {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 76px;
  height: 76px;
  margin-top: -38px;
  margin-left: -38px;
  border-radius: 50%;
  border: 1.5px solid rgba(42, 171, 238, 0.35);
  animation: proxy-ring-pulse 2.8s cubic-bezier(0.2, 0.8, 0.2, 1) infinite;
}

.proxy-shield-rings .ring-2 {
  animation-delay: 1.4s;
}

@keyframes proxy-ring-pulse {
  0% {
    transform: scale(0.85);
    opacity: 0.8;
  }
  100% {
    transform: scale(1.65);
    opacity: 0;
  }
}

.proxy-shield-core {
  position: relative;
  z-index: 2;
  width: 66px;
  height: 66px;
  border-radius: 50%;
  background: linear-gradient(145deg, #1b3554 0%, #0d1e34 100%);
  border: 2px solid rgba(42, 171, 238, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 24px rgba(42, 171, 238, 0.4), inset 0 0 12px rgba(42, 171, 238, 0.25);
  transition: transform 0.3s ease;
}

.proxy-hero-card:hover .proxy-shield-core {
  transform: scale(1.04);
}

.proxy-plane-svg {
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.4));
  margin-left: -2px;
  margin-top: 1px;
}

/* Titles */
.proxy-hero-text {
  text-align: center;
  position: relative;
  z-index: 2;
  margin-bottom: 16px;
}

.proxy-hero-title {
  font-size: 19px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 6px;
  letter-spacing: -0.3px;
}

.proxy-hero-desc {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.45;
  max-width: 440px;
  margin: 0 auto;
}

/* CTA Wrap */
.proxy-cta-wrap {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

/* Primary Button */
.btn-proxy-connect-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  box-sizing: border-box;
  background: linear-gradient(135deg, #0088cc 0%, #2AABEE 50%, #229ED9 100%);
  color: #ffffff;
  text-decoration: none;
  border-radius: var(--radius-md);
  padding: 12px 16px;
  box-shadow: 0 8px 22px rgba(42, 171, 238, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transition: all 0.2s ease;
  cursor: pointer;
}

.btn-proxy-connect-main:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(42, 171, 238, 0.48), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  color: #ffffff;
}

.btn-proxy-connect-main:active {
  transform: translateY(0);
  filter: brightness(0.94);
}

.btn-proxy-icon-wrap {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.btn-proxy-text-wrap {
  flex: 1;
  min-width: 0;
  text-align: left;
  margin: 0 12px;
}

.btn-proxy-headline {
  display: block;
  font-size: 14.5px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.1px;
}

.btn-proxy-sub {
  display: block;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.85);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-proxy-arrow {
  color: rgba(255, 255, 255, 0.85);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  transition: transform 0.2s ease;
}

.btn-proxy-connect-main:hover .btn-proxy-arrow {
  transform: translateX(2px);
}

/* Copy Link Box */
.proxy-link-copy-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.45);
  border: 1px dashed rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-sm);
  padding: 7px 8px 7px 12px;
  gap: 8px;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.proxy-link-copy-box:hover {
  border-color: rgba(42, 171, 238, 0.45);
  background: rgba(0, 0, 0, 0.6);
}

.p-link-left {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  flex: 1;
}

.p-link-icon {
  font-size: 13px;
  flex-shrink: 0;
}

.p-link-val {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-copy-chip {
  background: rgba(42, 171, 238, 0.12);
  border: 1px solid rgba(42, 171, 238, 0.3);
  color: #38bdf8;
  font-size: 11px;
  font-weight: 600;
  border-radius: 7px;
  padding: 5px 10px;
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-copy-chip:hover {
  background: rgba(42, 171, 238, 0.22);
  color: #ffffff;
}

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

