/* Stellar Frontier — Pilot Portal & Web Hangar Styling */
:root {
  color-scheme: dark;
  --bg-deep: #060b13;
  --bg-surface: #0c1421;
  --bg-card: #111c2e;
  --bg-card-hover: #15243b;
  --border-subtle: #1c2c44;
  --border-active: #314d75;
  --cyan: #00f3ff;
  --cyan-glow: rgba(0, 243, 255, 0.25);
  --gold: #ffb800;
  --gold-glow: rgba(255, 184, 0, 0.22);
  --emerald: #00ff9d;
  --emerald-glow: rgba(0, 255, 157, 0.22);
  --crimson: #ff3838;
  --purple: #b05cff;
  --text-main: #f0f4f8;
  --text-muted: #8a9bb0;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

body.portal-body {
  margin: 0;
  background-color: var(--bg-deep);
  color: var(--text-main);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

.portal-grid-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(0, 243, 255, 0.04) 0%, transparent 45%),
    radial-gradient(circle at 85% 75%, rgba(255, 184, 0, 0.03) 0%, transparent 50%),
    linear-gradient(to right, rgba(255,255,255,0.015) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.015) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 48px 48px, 48px 48px;
  z-index: 0;
}

/* Portal Header */
.portal-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(12, 20, 33, 0.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 12px 0;
}

.portal-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.portal-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.portal-brand span {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 3px;
  line-height: 1.1;
}

.portal-brand small {
  display: block;
  font-size: 8px;
  letter-spacing: 5px;
  color: var(--cyan);
}

.portal-wallet {
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(17, 28, 46, 0.85);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 6px 14px;
}

.wallet-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
}

.wallet-item.credits {
  color: var(--gold);
}

.wallet-item.crystals {
  color: var(--cyan);
}

.wallet-icon {
  font-style: normal;
  font-size: 12px;
}

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

.btn-launch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--cyan) 0%, #00b8d4 100%);
  color: #03131e;
  font-weight: 750;
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 8px 18px;
  border-radius: 4px;
  text-decoration: none;
  border: 1px solid transparent;
  box-shadow: 0 0 16px var(--cyan-glow);
  transition: all 0.2s ease;
}

.btn-launch:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 24px rgba(0, 243, 255, 0.45);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 7px 14px;
  font-size: 12px;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-ghost:hover {
  color: var(--text-main);
  border-color: var(--border-active);
  background: rgba(255, 255, 255, 0.03);
}

/* Flash Messages */
.portal-flash {
  padding: 12px 18px;
  border-radius: 6px;
  margin: 20px 0 0;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.portal-flash.success {
  background: rgba(0, 255, 157, 0.12);
  border: 1px solid rgba(0, 255, 157, 0.35);
  color: #a8ffd9;
}

.portal-flash.danger {
  background: rgba(255, 56, 56, 0.12);
  border: 1px solid rgba(255, 56, 56, 0.35);
  color: #ff9b9b;
}

/* Navigation Tabs */
.portal-nav-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border-subtle);
  margin-top: 24px;
  overflow-x: auto;
  scrollbar-width: none;
}

.portal-nav-tabs::-webkit-scrollbar {
  display: none;
}

.tab-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.tab-link:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.02);
}

.tab-link.active {
  color: var(--cyan);
  border-bottom-color: var(--cyan);
  background: rgba(0, 243, 255, 0.04);
}

.tab-link .badge {
  font-size: 10px;
  font-family: var(--mono);
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: 10px;
  color: var(--text-muted);
}

.tab-link.active .badge {
  background: rgba(0, 243, 255, 0.18);
  color: var(--cyan);
}

/* Tab Panels */
.tab-content {
  padding: 28px 0 60px;
}

/* Cards & Layout Grid */
.portal-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

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

.portal-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.portal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 22px;
  position: relative;
  min-width: 0;
  max-width: 100%;
}

.table-responsive {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 12px;
}

.portal-card.highlight {
  border-color: rgba(0, 243, 255, 0.4);
  box-shadow: 0 0 20px rgba(0, 243, 255, 0.06);
}

.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 12px;
}

.card-title-row h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.card-title-row .eyebrow {
  margin: 0;
  font-size: 9px;
  letter-spacing: 1.5px;
  color: var(--cyan);
}

/* Pilot Identity Card */
.pilot-dossier-card {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 20px;
  align-items: center;
}

.pilot-avatar-frame {
  width: 90px;
  height: 90px;
  border-radius: 8px;
  background: linear-gradient(135deg, #1c2b3d 0%, #0d1722 100%);
  border: 2px solid var(--cyan);
  box-shadow: 0 0 16px var(--cyan-glow);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  position: relative;
}

.avatar-symbol {
  font-size: 32px;
  font-weight: 800;
  color: var(--cyan);
}

.avatar-badge {
  font-size: 9px;
  letter-spacing: 1px;
  color: var(--text-muted);
}

.dossier-meta h2 {
  margin: 0 0 4px;
  font-size: 22px;
  letter-spacing: -0.5px;
}

.dossier-tags {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.tag-badge {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

.tag-badge.helios { color: #f6ad55; border-color: rgba(246, 173, 85, 0.35); }
.tag-badge.aegis { color: #48bb78; border-color: rgba(72, 187, 120, 0.35); }
.tag-badge.nyx { color: #9f7aea; border-color: rgba(159, 122, 234, 0.35); }
.tag-badge.tier { color: var(--cyan); border-color: var(--border-active); font-family: var(--mono); }

/* Progress Tracks */
.progress-row {
  margin-top: 10px;
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  margin-bottom: 4px;
  color: var(--text-muted);
}

.progress-track {
  height: 6px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.progress-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}

.progress-bar.xp { background: linear-gradient(90deg, #00b8d4, var(--cyan)); }
.progress-bar.hp { background: linear-gradient(90deg, #e53e3e, #ff6b6b); }
.progress-bar.shield { background: linear-gradient(90deg, #3182ce, #63b3ed); }
.progress-bar.cargo { background: linear-gradient(90deg, #d69e2e, #ecc94b); }

/* Metrics Grid */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 16px;
}

.metric-box {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 12px;
}

.metric-label {
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.metric-value {
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 700;
  margin-top: 4px;
  color: var(--text-main);
}

/* Ship Gallery Cards */
.ship-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  transition: all 0.2s ease;
}

.ship-card:hover {
  border-color: var(--border-active);
  background: var(--bg-card-hover);
}

.ship-card.active-ship {
  border-color: var(--cyan);
  box-shadow: 0 0 20px rgba(0, 243, 255, 0.12);
}

.ship-badge-active {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 9px;
  letter-spacing: 1px;
  font-weight: 700;
  background: rgba(0, 243, 255, 0.15);
  border: 1px solid var(--cyan);
  color: var(--cyan);
  padding: 3px 8px;
  border-radius: 4px;
}

.ship-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.ship-icon-box {
  width: 54px;
  height: 54px;
  border-radius: 6px;
  background: rgba(0, 243, 255, 0.05);
  border: 1px solid var(--border-active);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--cyan);
}

.ship-stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin: 12px 0 16px;
}

.ship-stats-table td {
  padding: 5px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.ship-stats-table td:last-child {
  text-align: right;
  font-family: var(--mono);
  font-weight: 600;
}

/* Equipment Slots */
.modules-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.module-slot-card {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

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

.slot-name {
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.slot-installed-title {
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 4px;
}

.slot-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* Catalog Filter and Cards */
.catalog-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.filter-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  border-radius: 4px;
  padding: 6px 14px;
  font-size: 12px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
}

.filter-btn:hover, .filter-btn.active {
  background: rgba(0, 243, 255, 0.08);
  border-color: var(--cyan);
  color: var(--cyan);
}

.item-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.2s ease;
}

.item-card:hover {
  border-color: var(--border-active);
  background: var(--bg-card-hover);
}

.item-card.is-owned {
  opacity: 0.75;
  border-style: dashed;
}

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

.item-kind-badge {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}

.item-kind-badge.laser { color: #ff5252; background: rgba(255, 82, 82, 0.12); }
.item-kind-badge.shield { color: #448aff; background: rgba(68, 138, 255, 0.12); }
.item-kind-badge.engine { color: #ffd740; background: rgba(255, 215, 64, 0.12); }
.item-kind-badge.hull { color: #ff7043; background: rgba(255, 112, 67, 0.15); }
.item-kind-badge.booster { color: #00e5ff; background: rgba(0, 229, 255, 0.15); }
.item-kind-badge.repair { color: #69f0ae; background: rgba(105, 240, 174, 0.12); }
.item-kind-badge.ammo { color: #ffab40; background: rgba(255, 171, 64, 0.12); }
.item-kind-badge.ship { color: #e040fb; background: rgba(224, 64, 251, 0.12); }
.item-kind-badge.drone { color: #00f3ff; background: rgba(0, 243, 255, 0.16); }

.item-name {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 6px;
}

.item-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 14px;
}

.item-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.item-price {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
}

.item-price.credits { color: var(--gold); }
.item-price.crystals { color: var(--cyan); }

/* Buttons & Form Elements */
.btn-action {
  background: rgba(0, 243, 255, 0.12);
  border: 1px solid var(--cyan);
  color: var(--cyan);
  border-radius: 4px;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-action:hover {
  background: var(--cyan);
  color: #041019;
}

.btn-action.btn-gold {
  background: rgba(255, 184, 0, 0.12);
  border-color: var(--gold);
  color: var(--gold);
}

.btn-action.btn-gold:hover {
  background: var(--gold);
  color: #141004;
}

.btn-action.btn-danger {
  background: rgba(255, 56, 56, 0.12);
  border-color: var(--crimson);
  color: var(--crimson);
}

.btn-action.btn-danger:hover {
  background: var(--crimson);
  color: #fff;
}

.btn-action:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  border-color: var(--border-subtle);
  background: transparent;
  color: var(--text-muted);
}

/* Vault Packages Grid */
.vault-pkg-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: center;
}

.vault-pkg-card.vip {
  border-color: var(--cyan);
  box-shadow: 0 0 24px rgba(0, 243, 255, 0.15);
}

.vault-extra {
  font-family: var(--mono);
  font-size: 28px;
  font-weight: 800;
  color: var(--gold);
  margin: 12px 0 6px;
}

.vault-pkg-card.vip .vault-extra {
  color: var(--cyan);
}

/* Stations Table */
.stations-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 12px;
}

.stations-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
}

.stations-table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.stations-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Responsive */
@media (max-width: 960px) {
  .portal-grid-4, .portal-grid-3, .portal-grid-2 {
    grid-template-columns: 1fr;
  }
  .metrics-row {
    grid-template-columns: 1fr 1fr;
  }
  .modules-grid {
    grid-template-columns: 1fr;
  }
  .pilot-dossier-card {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .pilot-avatar-frame {
    margin: 0 auto;
  }
  .dossier-tags {
    justify-content: center;
  }
}

@media (max-width: 768px) {
  .portal-header-inner {
    flex-wrap: wrap;
    gap: 12px;
  }
  .portal-wallet {
    order: 3;
    width: 100%;
    justify-content: space-around;
  }
  .card-title-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .stations-table {
    min-width: 620px;
  }
}

/* Drone Fleet & Tactical Formations */
.drone-stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 243, 255, 0.08);
  border: 1px solid rgba(0, 243, 255, 0.25);
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 11px;
  font-family: var(--mono);
  color: var(--cyan);
}
.formation-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.formation-picker-card {
  background: rgba(17, 28, 46, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.2s ease;
}
.formation-picker-card:hover {
  border-color: var(--border-active);
  background: rgba(21, 36, 59, 0.7);
}
.formation-picker-card.active {
  border-color: var(--cyan);
  background: rgba(0, 243, 255, 0.08);
  box-shadow: 0 0 12px rgba(0, 243, 255, 0.15);
}
.formation-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 6px;
}
.formation-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 10px;
  flex: 1;
}

/* Provider & Ticket Management UI */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.form-group label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  text-transform: uppercase;
}
.form-control {
  background: rgba(12, 20, 33, 0.9);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 10px 14px;
  color: var(--text-main);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-control:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 8px var(--cyan-glow);
}
.form-help {
  font-size: 11px;
  color: #64748b;
  margin-top: 2px;
}
.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
}
.badge-provider {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--mono);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.badge-provider.smtp {
  background: rgba(0, 243, 255, 0.12);
  color: var(--cyan);
  border: 1px solid rgba(0, 243, 255, 0.3);
}
.badge-provider.imap {
  background: rgba(176, 92, 255, 0.12);
  color: var(--purple);
  border: 1px solid rgba(176, 92, 255, 0.3);
}
.badge-purpose {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 3px;
  font-size: 10px;
  font-family: var(--mono);
  background: rgba(255, 184, 0, 0.1);
  color: var(--gold);
  border: 1px solid rgba(255, 184, 0, 0.25);
}
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.status-dot.active {
  background: var(--emerald);
  box-shadow: 0 0 6px var(--emerald-glow);
}
.status-dot.inactive {
  background: var(--crimson);
}
.ticket-bubble {
  background: rgba(17, 28, 46, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}
.ticket-bubble.staff {
  background: rgba(0, 243, 255, 0.05);
  border-color: rgba(0, 243, 255, 0.35);
}
.ticket-bubble-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding-bottom: 8px;
  margin-bottom: 10px;
  font-size: 12px;
}
.diagnostic-terminal {
  background: #050811;
  border: 1px solid #1e293b;
  border-radius: 6px;
  padding: 14px;
  font-family: var(--mono);
  font-size: 12px;
  color: #a5f3fc;
  max-height: 240px;
  overflow-y: auto;
  white-space: pre-wrap;
  margin-top: 12px;
}

