:root {
  --bg-base: #080c14;
  --bg-card: rgba(15, 23, 42, 0.78);
  --bg-card-hover: rgba(30, 41, 59, 0.9);
  --border-subtle: rgba(56, 189, 248, 0.22);
  --border-active: #38bdf8;
  --border-glass: rgba(56, 189, 248, 0.16);

  --accent-azure: #38bdf8;
  --accent-cyan: #06b6d4;
  --accent-gold: #f59e0b;
  --accent-amber: #d97706;
  --accent-orange: #f97316;
  --accent-emerald: #10b981;
  --accent-rose: #f43f5e;
  --accent-violet: #a855f7;

  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;

  --font-main: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

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

body {
  background-color: var(--bg-base);
  background-image: 
    radial-gradient(at 0% 0%, rgba(6, 182, 212, 0.12) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(245, 158, 11, 0.12) 0px, transparent 50%),
    radial-gradient(at 50% 100%, rgba(168, 85, 247, 0.1) 0px, transparent 50%);
  color: var(--text-primary);
  font-family: var(--font-main);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  line-height: 1.5;
}

/* Ambient Glow Orbs */
.glow-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(140px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.28;
}
.orb-primary {
  width: 550px;
  height: 550px;
  background: radial-gradient(circle, var(--accent-azure), transparent 70%);
  top: -150px;
  right: -100px;
}
.orb-secondary {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, var(--accent-gold), transparent 70%);
  bottom: -150px;
  left: -100px;
}

.hub-wrapper {
  position: relative;
  z-index: 1;
  max-width: 1360px;
  margin: 0 auto;
  padding: 20px 24px 60px;
}

/* Header */
.hub-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-top: 1.5px solid rgba(56, 189, 248, 0.35);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  gap: 12px;
  flex-wrap: wrap;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand-badge {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #0284c7, #06b6d4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.4);
}

.brand-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #ffffff;
}

.node-pill {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.18);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.brand-subtitle {
  font-size: 0.76rem;
  color: var(--text-secondary);
}

/* Nav tabs */
.hub-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(15, 23, 42, 0.6);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
  flex-wrap: wrap;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-main);
  font-size: 0.76rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.nav-btn:hover {
  color: #ffffff;
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.25);
}

.nav-btn.active {
  color: #ffffff;
  background: linear-gradient(135deg, #0284c7, #0369a1);
  border-color: #38bdf8;
  box-shadow: 0 3px 12px rgba(2, 132, 199, 0.4);
}

.nav-btn.btn-settings-trigger {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
}

.nav-btn.btn-settings-trigger:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: #38bdf8;
  color: #ffffff;
}

/* Tab Content Visibility */
.tab-content {
  display: none;
  animation: fadeIn 0.25s ease forwards;
}

.tab-content.active {
  display: block;
}

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

/* Hero card */
.hero-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.92), rgba(30, 41, 59, 0.85));
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-top: 1.5px solid rgba(56, 189, 248, 0.3);
  border-radius: var(--radius-lg);
  margin-bottom: 18px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  gap: 16px;
  flex-wrap: wrap;
}

.hero-info h2 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 4px;
  color: #ffffff;
  letter-spacing: -0.01em;
}

.hero-info p {
  font-size: 0.78rem;
  color: var(--text-secondary);
  max-width: 580px;
  line-height: 1.4;
}

.quick-stats-strip {
  display: flex;
  gap: 10px;
}

.stat-box {
  background: rgba(8, 12, 20, 0.75);
  padding: 14px 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
  text-align: center;
  min-width: 110px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.stat-num {
  font-size: 1.5rem;
  font-weight: 800;
  display: block;
  font-family: var(--font-mono);
  color: #38bdf8;
}

.stat-num.text-gold {
  color: #fbbf24;
}

.stat-label {
  font-size: 0.74rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: 0.04em;
}

/* Filter Strip */
.filter-strip {
  display: flex;
  gap: 10px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.filter-chip {
  padding: 7px 16px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-glass);
  border-radius: 999px;
  color: var(--text-secondary);
  font-family: var(--font-main);
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-chip:hover {
  color: #ffffff;
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.3);
}

.filter-chip.active {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #ffffff;
  border-color: #fbbf24;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4);
}

/* Apps Grid */
.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 22px;
}

.app-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-top: 2px solid rgba(56, 189, 248, 0.4);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.app-card:hover {
  background: var(--bg-card-hover);
  border-color: #38bdf8;
  border-top-color: #38bdf8;
  transform: translateY(-4px);
  box-shadow: 0 14px 32px rgba(2, 132, 199, 0.25);
}

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

.app-icon-wrap {
  width: 50px;
  height: 50px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.category-tag {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.app-card h3 {
  font-size: 1.2rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 6px;
}

.app-desc {
  font-size: 0.86rem;
  color: var(--text-secondary);
  line-height: 1.48;
  margin-bottom: 18px;
}

.card-footer {
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  gap: 10px;
}

.btn-launch {
  flex: 1;
  padding: 11px 16px;
  background: linear-gradient(135deg, #0284c7, #0369a1);
  border: 1px solid #38bdf8;
  border-radius: var(--radius-sm);
  color: #ffffff;
  font-family: var(--font-main);
  font-size: 0.88rem;
  font-weight: 800;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35);
}

.btn-launch:hover {
  background: linear-gradient(135deg, #0369a1, #075985);
  border-color: #7dd3fc;
  box-shadow: 0 6px 18px rgba(2, 132, 199, 0.5);
}

.btn-qr {
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-qr:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

/* File Explorer */
.explorer-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.explorer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.root-selector {
  display: flex;
  gap: 8px;
}

.root-chip {
  padding: 6px 12px;
  background: rgba(12, 14, 18, 0.6);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.root-chip.active {
  background: rgba(217, 119, 6, 0.2);
  border-color: var(--accent-amber);
  color: #fff;
}

.breadcrumb-bar {
  background: rgba(10, 12, 16, 0.8);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--accent-gold);
  border: 1px solid var(--border-glass);
  margin-bottom: 16px;
  overflow-x: auto;
  white-space: nowrap;
}

.file-view-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  min-height: 480px;
}

.file-list-pane {
  background: rgba(10, 12, 16, 0.5);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
  overflow-y: auto;
  max-height: 540px;
}

.file-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.file-table th {
  text-align: left;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border-glass);
}

.file-table td {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.file-row {
  cursor: pointer;
  transition: background 0.15s ease;
}

.file-row:hover {
  background: rgba(255, 255, 255, 0.05);
}

.file-name-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-weight: 500;
}

.file-preview-pane {
  background: rgba(10, 12, 16, 0.85);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
  padding: 18px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  overflow-y: auto;
  max-height: 540px;
  color: #e5e7eb;
}

.preview-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  text-align: center;
}

.empty-icon {
  font-size: 2.5rem;
  margin-bottom: 10px;
}

/* Gateway & Keys */
.gateway-card, .devices-card, .tester-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.gateway-header, .devices-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.gateway-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(217, 119, 6, 0.1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 22px;
}

.banner-icon {
  font-size: 1.8rem;
}

.banner-subtext {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 3px;
}

.action-btn {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border-glass);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  transition: all 0.2s ease;
}

.action-btn.primary-btn {
  background: var(--accent-amber);
  border-color: var(--accent-amber);
}

.action-btn:hover {
  filter: brightness(1.15);
}

.keys-table-wrapper {
  overflow-x: auto;
}

.keys-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.keys-table th {
  text-align: left;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-glass);
}

.keys-table td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.key-code {
  font-family: var(--font-mono);
  background: rgba(0, 0, 0, 0.4);
  padding: 3px 8px;
  border-radius: 4px;
  color: var(--accent-gold);
}

.status-badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
}
.status-badge.active {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
}
.status-badge.revoked {
  background: rgba(244, 63, 94, 0.15);
  color: var(--accent-rose);
}

/* Devices Grid */
.devices-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.device-card {
  background: rgba(12, 14, 18, 0.6);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

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

/* AI Tester Form */
.tester-form {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 650px;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-row label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.hub-select, .hub-textarea {
  background: rgba(10, 12, 16, 0.8);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: #fff;
  font-family: var(--font-main);
  font-size: 0.85rem;
}

.hub-textarea {
  font-family: var(--font-mono);
  resize: vertical;
}

.tester-output-box {
  margin-top: 20px;
  background: rgba(6, 8, 11, 0.9);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 16px;
  max-height: 350px;
  overflow-y: auto;
}

.tester-output-box pre {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent-cyan);
  white-space: pre-wrap;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: #181a20;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 24px;
  max-width: 380px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

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

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
}

.qr-code-box {
  background: #fff;
  padding: 14px;
  border-radius: var(--radius-md);
  display: inline-block;
  margin-bottom: 14px;
}

.modal-link-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent-gold);
  word-break: break-all;
  margin-bottom: 6px;
}

.modal-note {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 900px) {
  .hub-header {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }
  .hub-nav {
    overflow-x: auto;
  }
  .hero-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  .file-view-container {
    grid-template-columns: 1fr;
  }
}

/* ==================== MASTER SECURITY PIN GATE (4201) ==================== */
.pin-lock-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 11, 14, 0.95);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.pin-lock-card {
  background: linear-gradient(135deg, rgba(22, 24, 29, 0.98), rgba(12, 13, 16, 0.98));
  border: 1px solid rgba(217, 119, 6, 0.4);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 35px rgba(217, 119, 6, 0.2);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  max-width: 360px;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.1rem;
}

.pin-lock-icon {
  font-size: 2.8rem;
  background: rgba(217, 119, 6, 0.15);
  border: 1px solid rgba(217, 119, 6, 0.35);
  width: 68px;
  height: 68px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 25px rgba(217, 119, 6, 0.3);
}

.pin-lock-title {
  font-size: 1.4rem;
  font-weight: 800;
  background: linear-gradient(135deg, #fff, var(--accent-gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 0;
}

.pin-lock-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.4;
}

.pin-lock-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 0.5rem;
}

.pin-lock-input {
  width: 100%;
  padding: 0.9rem 1rem;
  font-size: 1.6rem;
  letter-spacing: 0.4em;
  text-align: center;
  background: rgba(12, 13, 16, 0.9);
  border: 1px solid rgba(217, 119, 6, 0.45);
  border-radius: var(--radius-md);
  color: #fff;
  font-family: var(--font-mono);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.5);
  transition: all 0.2s ease;
}

.pin-lock-input:focus {
  outline: none;
  border-color: var(--accent-gold);
  box-shadow: 0 0 15px rgba(217, 119, 6, 0.4), inset 0 2px 6px rgba(0, 0, 0, 0.5);
}

.pin-lock-btn {
  width: 100%;
  padding: 0.9rem;
  font-size: 1rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-amber), var(--accent-orange));
  border: none;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(217, 119, 6, 0.35);
  transition: all 0.2s ease;
}

.pin-lock-btn:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.pin-lock-error {
  font-size: 0.82rem;
  color: #f87171;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  width: 100%;
}

/* Modal Overlays for Mobile QR & Media Add */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 11, 14, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: #16181d;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 24px;
  width: 100%;
  max-width: 500px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 30px rgba(245, 158, 11, 0.15);
  position: relative;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 12px;
}

.modal-header h3 {
  font-size: 1.1rem;
  color: #f8fafc;
}

.modal-close {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}
.modal-close:hover {
  color: #fff;
}

/* ==================================================== */
/* MEDIA & STREAMING LAUNCHPAD REDESIGN                */
/* ==================================================== */

.media-hero-card {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.8), rgba(15, 23, 42, 0.9));
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 20px;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.4), 0 0 25px rgba(245, 158, 11, 0.08);
}

.media-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.media-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.media-count-badge {
  font-size: 0.7rem;
  font-weight: 700;
  font-family: var(--font-mono);
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 16px;
}

.media-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  overflow: hidden;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.media-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: transparent;
  transition: background 0.25s ease;
}

.media-card[data-cat="servers"]::before { background: var(--accent-amber); }
.media-card[data-cat="streaming"]::before { background: var(--accent-rose); }
.media-card[data-cat="iptv"]::before { background: var(--accent-emerald); }
.media-card[data-cat="bookmarks"]::before { background: var(--accent-cyan); }

.media-card:hover {
  transform: translateY(-3px);
  border-color: rgba(245, 158, 11, 0.4);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(245, 158, 11, 0.15);
  background: rgba(28, 31, 38, 0.95);
}

.media-icon-frame {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  flex-shrink: 0;
  overflow: hidden;
  transition: transform 0.25s ease;
}

.media-card:hover .media-icon-frame {
  transform: scale(1.05);
}

.media-favicon-img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  border-radius: 4px;
}

.media-body {
  flex: 1;
  min-width: 0;
}

.media-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.media-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}

.media-card-desc {
  font-size: 0.78rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 3px;
}

.media-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}

.media-badge {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge-web {
  background: rgba(148, 163, 184, 0.15);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.badge-vlc {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.badge-hls {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.media-actions-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0.6;
  transition: opacity 0.2s ease;
}

.media-card:hover .media-actions-toolbar {
  opacity: 1;
}

.media-action-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.75rem;
  transition: all 0.18s ease;
}

.media-action-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
}

.media-action-btn.btn-delete:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.4);
}

.media-action-btn.btn-launch:hover {
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.4);
}

/* Quick Add Presets Bar in Modal */
.presets-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 12px;
  scrollbar-width: thin;
}

.preset-chip {
  flex-shrink: 0;
  padding: 5px 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  font-size: 0.75rem;
  color: #e2e8f0;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s ease;
}

.preset-chip:hover {
  background: rgba(245, 158, 11, 0.2);
  border-color: var(--accent-gold);
  color: #fff;
  transform: translateY(-1px);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--accent-gold);
  color: #fff;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5), 0 0 15px rgba(245, 158, 11, 0.2);
  transform: translateY(20px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* Interactive Stream Player & Channel Guide EPG Drawer */
.player-main-layout {
  display: flex;
  flex-direction: row;
  height: 480px;
  background: #000;
  position: relative;
  overflow: hidden;
}

.player-video-viewport {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  background: #000;
  min-width: 0;
}

.player-video-frame {
  flex: 1;
  position: relative;
  background: #000;
}

.player-video-frame video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.player-custom-controls {
  height: 44px;
  background: #0f172a;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  gap: 8px;
  z-index: 5;
}

.controls-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.player-ctrl-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.18s ease;
}

.player-ctrl-btn:hover {
  background: rgba(245, 158, 11, 0.25);
  border-color: #f59e0b;
  color: #fff;
}

.player-ctrl-btn.active {
  background: #f59e0b;
  color: #000;
  border-color: #f59e0b;
}

.player-select-dropdown {
  background: #1e293b;
  border: 1px solid #334155;
  color: #fff;
  padding: 4px 6px;
  border-radius: 6px;
  font-size: 0.75rem;
  max-width: 170px;
}

.volume-container {
  display: flex;
  align-items: center;
  gap: 6px;
}

.volume-slider {
  width: 75px;
  accent-color: #f59e0b;
  cursor: pointer;
}

/* EPG Channel Guide Side Drawer */
/* EPG Channel Guide Side Drawer */
.epg-guide-drawer {
  width: 320px;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(16px);
  border-left: 1px solid rgba(56, 189, 248, 0.25);
  display: flex;
  flex-direction: column;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 10;
}

.epg-guide-drawer.collapsed {
  width: 0;
  min-width: 0;
  overflow: hidden;
  border-left: none;
}

.epg-header {
  padding: 12px 14px;
  background: rgba(30, 41, 59, 0.85);
  border-bottom: 1px solid rgba(56, 189, 248, 0.2);
}

.epg-search-input {
  width: 100%;
  padding: 7px 10px;
  background: #0f172a;
  border: 1px solid #334155;
  color: #fff;
  border-radius: 6px;
  font-size: 0.76rem;
  margin-bottom: 6px;
  outline: none;
  transition: border-color 0.15s ease;
}

.epg-search-input:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.3);
}

.epg-chips-row {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.epg-chips-row::-webkit-scrollbar {
  height: 3px;
}

.epg-chips-row::-webkit-scrollbar-thumb {
  background: rgba(56, 189, 248, 0.4);
  border-radius: 3px;
}

.epg-chip {
  padding: 3px 8px;
  font-size: 0.68rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  color: #cbd5e1;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.epg-chip:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.4);
}

.epg-chip.active {
  background: #38bdf8;
  color: #000;
  font-weight: 700;
  border-color: #38bdf8;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
}

.epg-list-container {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.epg-list-container::-webkit-scrollbar {
  width: 6px;
}

.epg-list-container::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.6);
}

.epg-list-container::-webkit-scrollbar-thumb {
  background: rgba(56, 189, 248, 0.3);
  border-radius: 4px;
}

.epg-list-container::-webkit-scrollbar-thumb:hover {
  background: #38bdf8;
}

.epg-channel-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.epg-channel-item:hover {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.4);
  transform: translateX(2px);
}

.epg-channel-item.active {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.25), rgba(245, 158, 11, 0.2));
  border-color: #38bdf8;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.3);
}

.epg-channel-icon {
  font-size: 1.1rem;
  width: 24px;
  text-align: center;
}

.epg-channel-info {
  flex: 1;
  overflow: hidden;
}

.epg-channel-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.epg-channel-cat {
  font-size: 0.68rem;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 768px) {
  .player-main-layout {
    flex-direction: column;
    height: auto;
  }
  .epg-guide-drawer {
    width: 100%;
    height: 220px;
  }
}

/* Closed Captions Cue Styling */
video::cue {
  background: rgba(0, 0, 0, 0.75);
  color: #ffffff;
  font-family: inherit;
  font-size: 0.85rem;
  border-radius: 4px;
  padding: 2px 6px;
  line-height: 1.3;
}

/* Universal Modal Backdrop */
.modal-backdrop {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 99999 !important;
  background: rgba(0, 0, 0, 0.78) !important;
  backdrop-filter: blur(10px) !important;
  -webkit-backdrop-filter: blur(10px) !important;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

/* System Controls & Settings Modal Styling */
.settings-modal-card {
  max-width: 620px;
  width: 100%;
  border: 1px solid rgba(245, 158, 11, 0.4);
  background: #0b0f19;
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.9), 0 0 30px rgba(245, 158, 11, 0.15);
  position: relative;
}

.settings-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 12px;
}

.settings-header-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.settings-actions-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

@media (max-width: 580px) {
  .settings-actions-grid {
    grid-template-columns: 1fr;
  }
}

.settings-action-card {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.settings-action-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4);
}

.settings-action-card.card-amber:hover { border-color: rgba(245, 158, 11, 0.6); background: rgba(245, 158, 11, 0.08); }
.settings-action-card.card-azure:hover { border-color: rgba(56, 189, 248, 0.6); background: rgba(56, 189, 248, 0.08); }
.settings-action-card.card-purple:hover { border-color: rgba(168, 85, 247, 0.6); background: rgba(168, 85, 247, 0.08); }
.settings-action-card.card-red:hover { border-color: rgba(239, 68, 68, 0.6); background: rgba(239, 68, 68, 0.08); }

.action-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.action-icon {
  font-size: 1.4rem;
}

.action-tag {
  font-size: 0.6rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 6px;
  letter-spacing: 0.05em;
}

.tag-amber { background: rgba(245, 158, 11, 0.2); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.4); }
.tag-azure { background: rgba(56, 189, 248, 0.2); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.4); }
.tag-purple { background: rgba(168, 85, 247, 0.2); color: #c084fc; border: 1px solid rgba(168, 85, 247, 0.4); }
.tag-red { background: rgba(239, 68, 68, 0.2); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.4); }

.action-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}

.action-desc {
  font-size: 0.74rem;
  color: #94a3b8;
  line-height: 1.35;
  margin-bottom: 12px;
  flex: 1;
}

.action-card-btn {
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: background 0.2s ease;
}

.btn-amber { background: linear-gradient(135deg, #f59e0b, #d97706); color: #fff; }
.btn-azure { background: linear-gradient(135deg, #0284c7, #0369a1); color: #fff; }
.btn-purple { background: linear-gradient(135deg, #a855f7, #7c3aed); color: #fff; }
.btn-red { background: linear-gradient(135deg, #ef4444, #b91c1c); color: #fff; }

.settings-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 12px;
}




