:root {
  --bg-dark: #090d16;
  --card-bg: rgba(18, 25, 43, 0.75);
  --card-border: rgba(99, 102, 241, 0.18);
  --text-main: #e2e8f0;
  --text-muted: #94a3b8;
  --accent-gold: #f59e0b;
  --accent-gold-glow: rgba(245, 158, 11, 0.25);
  --accent-cyan: #38bdf8;
  --accent-purple: #a855f7;
  --accent-rose: #f43f5e;
  --accent-emerald: #10b981;

  --font-serif: 'Cinzel', serif;
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  line-height: 1.6;
}

.stars-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 50% 10%, #1e1b4b 0%, #090d16 80%);
  z-index: -1;
}

/* NAVBAR */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--card-border);
  position: sticky;
  top: 0;
  z-index: 100;
  flex-wrap: wrap;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-icon {
  font-size: 2rem;
  filter: drop-shadow(0 0 10px rgba(245, 158, 11, 0.5));
}

.brand-text h1 {
  font-family: var(--font-serif);
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: 1px;
  background: linear-gradient(135deg, #fff 0%, #fcd34d 50%, #f59e0b 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-text p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.btn-nav {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid var(--card-border);
  color: var(--text-main);
  padding: 0.45rem 0.9rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.btn-nav:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: #6366f1;
}

.badge-counter {
  background: #f59e0b;
  color: #090d16;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 9999px;
}

.btn-gold-outline {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #fcd34d;
  padding: 0.45rem 0.9rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

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

.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.85rem;
}

.user-avatar {
  font-size: 1rem;
}

.user-email-text {
  color: #fcd34d;
  font-weight: 500;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-logout-icon {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0 0.2rem;
  transition: color 0.2s ease;
}

.btn-logout-icon:hover {
  color: #f43f5e;
}

.lang-selector {
  display: flex;
  gap: 0.3rem;
  background: rgba(30, 41, 59, 0.6);
  padding: 0.25rem;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.lang-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.35rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.lang-btn:hover {
  color: #fff;
}

.lang-btn.active {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: #fff;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.4);
}

/* LANDING PAGE */
.landing-section {
  max-width: 1100px;
  margin: 2.5rem auto;
  padding: 0 1.5rem 4rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 3.5rem;
  align-items: center;
}

.landing-hero {
  text-align: center;
  max-width: 800px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.35);
  color: #c7d2fe;
  padding: 0.4rem 1rem;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 0 16px rgba(99, 102, 241, 0.2);
}

.hero-title {
  font-family: var(--font-serif);
  font-size: 2.75rem;
  line-height: 1.2;
  font-weight: 700;
  background: linear-gradient(135deg, #ffffff 0%, #fde68a 50%, #f59e0b 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 0.5px;
}

@media (max-width: 768px) {
  .hero-title {
    font-size: 2rem;
  }
}

.hero-subtitle {
  font-size: 1.15rem;
  color: #cbd5e1;
  max-width: 680px;
  line-height: 1.6;
}

.landing-auth-card {
  width: 100%;
  max-width: 500px;
  background: rgba(18, 25, 43, 0.9);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), 0 0 20px rgba(245, 158, 11, 0.1);
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  text-align: center;
}

.landing-auth-card h3 {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  color: #fcd34d;
}

.landing-auth-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.landing-auth-step {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  text-align: left;
}

.auth-input-large {
  padding: 0.85rem 1rem !important;
  font-size: 1.05rem !important;
  border-radius: 10px !important;
}

.auth-code-input {
  letter-spacing: 6px;
  text-align: center;
  font-weight: 700;
  font-size: 1.3rem !important;
}

.btn-lg {
  padding: 0.85rem 1.5rem;
  font-size: 1rem;
  border-radius: 10px;
}

.input-error-msg {
  color: #f87171;
  font-size: 0.8rem;
  margin-top: 0.3rem;
}

.input-invalid {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.25) !important;
}

.landing-features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  width: 100%;
}

.feature-card {
  background: rgba(18, 25, 43, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  transition: all 0.25s ease;
}

.feature-card:hover {
  transform: translateY(-4px);
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.feature-icon {
  font-size: 2rem;
}

.feature-card h4 {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  color: #fff;
}

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

/* CONTAINER & CARDS */
.container {
  max-width: 1320px;
  margin: 1.5rem auto;
  padding: 0 1.25rem 3rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.card {
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.37);
}

.card-header {
  width: 100%;
  margin-bottom: 1.25rem;
}

.card-header h2 {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  font-weight: 600;
  color: #f1f5f9;
  letter-spacing: 0.5px;
  margin: 0;
  line-height: 1.25;
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
}

.badge-subtle {
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #a5b4fc;
  font-size: 0.8rem;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
}

/* FORM GRID */
.chart-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

/* WORKSPACE TOP BAR & ACTIVE CHART OVERVIEW */
.workspace-top-bar {
  margin-bottom: 1.5rem;
  padding: 1.25rem 1.5rem;
}

.top-bar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.workspace-top-bar:not(.empty-workspace) .top-bar-header {
  padding-bottom: 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.workspace-top-bar.empty-workspace .top-bar-header {
  padding-bottom: 0;
  border-bottom: none;
}

.active-chart-overview {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.chart-badge-title-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.active-chart-icon {
  font-size: 1.4rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.active-chart-name {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
  margin: 0;
  padding: 0;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
}

#current-chart-status-badge {
  margin-left: 0.35rem;
  font-size: 0.78rem;
  padding: 0.28rem 0.75rem;
  line-height: 1.1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  border-radius: 9999px;
  white-space: nowrap;
}

.active-chart-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.badge-editable {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #6ee7b7;
}

.badge-locked {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

.chart-action-buttons {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* WORKSPACE AI ANALYSES (2 PER ROW) */
.workspace-analyses-wrapper {
  margin-top: 1rem;
}

.workspace-analyses-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.85rem;
}

.analysis-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1.15rem;
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: left;
  line-height: 1.3;
}

.analysis-btn:hover {
  transform: translateY(-2px);
}

.analysis-btn-saved {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(245, 158, 11, 0.45);
  color: #fff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.analysis-btn-saved:hover {
  background: rgba(245, 158, 11, 0.15);
  border-color: #f59e0b;
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.25);
}

.analysis-btn-pending {
  background: rgba(30, 41, 59, 0.4);
  border: 1px dashed rgba(255, 255, 255, 0.2);
  color: #cbd5e1;
}

.analysis-btn-pending:hover {
  background: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.6);
  border-style: solid;
  color: #fff;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.15);
}

.analysis-btn-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.analysis-btn-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: 9999px;
  line-height: 1;
  white-space: nowrap;
  flex-shrink: 0;
}

.analysis-btn-badge.badge-saved {
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid rgba(16, 185, 129, 0.5);
  color: #6ee7b7;
}

.analysis-btn-badge.badge-pending {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #fcd34d;
}

.workspace-top-bar-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 1.15rem 0 0.9rem 0;
  width: 100%;
}

@media (max-width: 680px) {
  .workspace-analyses-grid {
    grid-template-columns: 1fr;
  }
}

/* SAVED CHARTS CAROUSEL / CHIPS */
.saved-charts-carousel-wrapper {
  margin-top: 0.2rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.saved-charts-carousel-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.saved-charts-chips-list {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: nowrap;
}

.saved-chart-chip {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 9999px;
  padding: 0.35rem 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  white-space: nowrap;
  font-size: 0.82rem;
  color: var(--text-main);
  transition: all 0.2s ease;
}

.saved-chart-chip:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: #6366f1;
}

.saved-chart-chip.chip-active {
  background: rgba(245, 158, 11, 0.18);
  border-color: #f59e0b;
  color: #fcd34d;
  font-weight: 600;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.2);
}

.chip-readings-count {
  background: rgba(0, 0, 0, 0.3);
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  border-radius: 9999px;
  opacity: 0.85;
}

.no-charts-chip-hint {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-style: italic;
}

/* POPUP FORM MODAL */
.modal-chart-form {
  max-width: 620px;
}

.chart-popup-form {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.form-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.form-section:last-of-type {
  border-bottom: none;
  padding-bottom: 0;
}

.form-section-title {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent-gold);
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 580px) {
  .form-row-2 {
    grid-template-columns: 1fr;
  }
}

.form-helper-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: -0.25rem;
}

.modal-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  flex-wrap: wrap;
}

.chart-locked-alert {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.locked-alert-icon {
  font-size: 1.4rem;
  line-height: 1;
}

.locked-alert-content h4 {
  color: #fca5a5;
  font-size: 0.95rem;
  margin-bottom: 0.2rem;
}

.locked-alert-content p {
  color: #fed7aa;
  font-size: 0.82rem;
  line-height: 1.4;
}

.chart-editable-notice {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #a7f3d0;
  border-radius: 8px;
  padding: 0.6rem 0.85rem;
  font-size: 0.82rem;
  margin-bottom: 1rem;
}

.chart-popup-form.form-locked input,
.chart-popup-form.form-locked button[type="button"]#btn-open-map,
.chart-popup-form.form-locked select {
  opacity: 0.65;
  cursor: not-allowed;
  background: rgba(15, 23, 42, 0.5);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  position: relative;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

.form-group input,
.form-group select,
.form-group textarea {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  color: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  width: 100%;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.form-group select optgroup {
  background: #0f172a;
  color: #fcd34d;
  font-weight: 700;
  padding: 0.35rem 0.5rem;
}

.form-group select option {
  background: #0f172a;
  color: #e2e8f0;
  font-weight: 400;
  padding: 0.3rem 0.6rem;
}

/* LOCATION AUTOCOMPLETE & MAP BUTTON */
.location-input-wrapper {
  display: flex;
  gap: 0.4rem;
  position: relative;
}

.location-input-wrapper input {
  flex: 1;
}

.btn-outline-gold {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #fcd34d;
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  font-size: 0.8rem;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-outline-gold:hover {
  background: rgba(245, 158, 11, 0.25);
}

.suggestions-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #0f172a;
  border: 1px solid #6366f1;
  border-radius: 8px;
  max-height: 220px;
  overflow-y: auto;
  z-index: 50;
  margin-top: 4px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

.suggestion-item {
  padding: 0.6rem 0.85rem;
  font-size: 0.85rem;
  color: var(--text-main);
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: background 0.15s ease;
}

.suggestion-item:last-child {
  border-bottom: none;
}

.suggestion-item:hover {
  background: rgba(99, 102, 241, 0.25);
  color: #fff;
}

.invisible-label {
  visibility: hidden;
}

/* MANUAL COORDINATES COLLAPSED */
.manual-coords-details {
  border-top: 1px dashed rgba(255, 255, 255, 0.1);
  padding-top: 0.75rem;
  margin-top: 0.25rem;
}

.manual-coords-summary {
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  padding: 0.25rem 0;
  display: inline-block;
  transition: color 0.2s;
}

.manual-coords-summary:hover {
  color: #a5b4fc;
}

.coords-grid {
  margin-top: 0.75rem;
}

/* BUTTONS */
.btn {
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.7rem 1.25rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-primary {
  background: linear-gradient(135deg, #6366f1 0%, #4338ca 100%);
  color: #fff;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
  filter: brightness(1.1);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.btn-gold {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #0f172a;
  box-shadow: 0 4px 14px var(--accent-gold-glow);
  font-weight: 700;
}

.btn-gold:hover {
  filter: brightness(1.1);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.5);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
}

.btn-outline {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text-main);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.08);
}

.btn-link {
  background: transparent;
  border: none;
  color: #a5b4fc;
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

.btn-link:hover {
  color: #c7d2fe;
}

/* CHART LAYOUT */
.chart-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 992px) {
  .chart-layout {
    grid-template-columns: 1fr;
  }
}

/* WHEEL CARD */
.wheel-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.wheel-controls {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.wheel-container {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

#wheel-svg-wrapper {
  width: 100%;
  height: auto;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.astro-wheel-svg {
  width: 100%;
  height: auto;
  max-width: 500px;
  display: block;
  margin: 0 auto;
  filter: drop-shadow(0 0 20px rgba(99, 102, 241, 0.25));
}

.chart-tooltip {
  position: absolute;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--accent-gold);
  color: #fff;
  padding: 0.5rem 0.85rem;
  border-radius: 6px;
  font-size: 0.8rem;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  z-index: 20;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: var(--accent-gold);
  padding: 0.28rem 0.7rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.1;
  white-space: nowrap;
  vertical-align: middle;
}

.badge-cached {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #6ee7b7;
}

/* SUMMARY / ESSENCE CARD */
.big-three-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.essence-box {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.essence-symbol {
  font-size: 1.65rem;
  color: var(--accent-gold);
  width: 38px;
  text-align: center;
}

.text-glyph {
  font-size: 1.1rem;
  font-weight: 700;
  font-family: var(--font-serif);
}

.essence-meta {
  display: flex;
  flex-direction: column;
}

.essence-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.essence-val {
  font-size: 1.05rem;
  color: #fff;
  font-weight: 600;
}

.chart-ruler-banner {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(168, 85, 247, 0.15) 100%);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.ruler-title {
  font-size: 0.85rem;
  color: #c7d2fe;
  font-weight: 500;
}

.ruler-val {
  font-weight: 700;
  color: #fff;
}

/* BALANCE BARS */
.balance-section {
  margin-bottom: 1.25rem;
}

.balance-section h3 {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.5rem;
}

.balance-bars {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.bar-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.bar-label {
  font-size: 0.8rem;
  width: 70px;
  color: var(--text-main);
}

.bar-track {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 9999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 9999px;
  transition: width 0.5s ease;
}

.bar-percent {
  font-size: 0.8rem;
  width: 38px;
  text-align: right;
  color: var(--text-muted);
}

.advice-action-box {
  margin-top: 1.25rem;
}

/* SAVED READINGS SECTION */
.saved-analyses-card {
  margin-top: 0.5rem;
}

.saved-readings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 0.5rem;
}

.saved-reading-item {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.saved-reading-item:hover {
  border-color: #f59e0b;
  transform: translateY(-2px);
  background: rgba(15, 23, 42, 0.85);
}

.saved-reading-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.reading-type-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #fcd34d;
}

.reading-meta-date {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.reading-snippet {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.saved-analyses-empty {
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
  padding: 1.5rem;
}

/* PRO DETAILS / ADVANCED SECTION (COLLAPSIBLE) */
.pro-details-section {
  padding: 0.75rem 1.25rem;
}

.btn-pro-toggle {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s;
}

.btn-pro-toggle:hover {
  color: #c7d2fe;
}

.pro-toggle-arrow {
  font-size: 0.8rem;
  transition: transform 0.3s ease;
}

.pro-details-content {
  overflow: hidden;
  transition: max-height 0.4s ease, opacity 0.3s ease;
  max-height: 2000px;
  opacity: 1;
}

.pro-details-content.collapsed {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
}

.btn-pro-toggle[aria-expanded="false"] .pro-toggle-arrow {
  transform: rotate(-90deg);
}

/* TABS & TABLES */
.tabs-header {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 1.25rem;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.75rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  color: #fff;
}

.tab-btn.active {
  color: #6366f1;
  border-bottom-color: #6366f1;
}

.tab-content {
  display: none;
}

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

.table-responsive {
  overflow-x: auto;
}

.astro-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  text-align: left;
}

.astro-table th {
  color: var(--text-muted);
  font-weight: 500;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.astro-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

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

.tag {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.tag-rx {
  background: rgba(244, 63, 94, 0.2);
  color: #fda4af;
  border: 1px solid rgba(244, 63, 94, 0.4);
}

.tag-domicile {
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.tag-exalt {
  background: rgba(245, 158, 11, 0.2);
  color: #fde68a;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.tag-detriment, .tag-fall {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.nature-flow {
  color: #6ee7b7;
}

.nature-dynamic {
  color: #f87171;
}

.nature-intense {
  color: #fcd34d;
}

/* MODAL BASE */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 1000;
}

.modal-overlay.hidden {
  display: none !important;
}

.modal-card {
  background: #0f172a;
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 16px;
  width: 100%;
  max-width: 820px;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
}

.modal-advice {
  max-width: 1040px;
  width: 95%;
}

.advice-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.advice-submit-group {
  margin-top: 0.75rem;
}

.modal-auth {
  max-width: 440px;
}

.modal-charts-drawer {
  max-width: 680px;
}

.modal-map {
  max-width: 740px;
}

.modal-legal {
  max-width: 680px;
}

.modal-legal-body h3 {
  font-family: var(--font-serif);
  color: #fcd34d;
  font-size: 1.1rem;
  margin-top: 1rem;
  margin-bottom: 0.3rem;
}

.modal-legal-body p, .modal-legal-body li {
  font-size: 0.9rem;
  color: #cbd5e1;
  margin-bottom: 0.6rem;
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  position: sticky;
  top: 0;
  background: #0f172a;
  z-index: 10;
}

.modal-header h2 {
  font-family: var(--font-serif);
  color: #fcd34d;
  font-size: 1.35rem;
}

.modal-header p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.btn-icon:hover {
  color: #fff;
}

.modal-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* AUTH MODAL STYLES */
.auth-step {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.auth-helper-note {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.auth-email-confirm {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(30, 41, 59, 0.6);
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.85rem;
}

.dev-otp-hint {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #6ee7b7;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.85rem;
  text-align: center;
}

.auth-resend-wrapper {
  text-align: center;
  margin-top: 0.5rem;
}

/* SAVED CHARTS DRAWER */
.charts-drawer-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.5rem;
}

.saved-charts-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 55vh;
  overflow-y: auto;
}

.saved-chart-card {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  transition: all 0.2s ease;
}

.saved-chart-card:hover {
  border-color: #6366f1;
  background: rgba(15, 23, 42, 0.9);
}

.saved-chart-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.saved-chart-title {
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
}

.saved-chart-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.saved-chart-badge {
  font-size: 0.75rem;
  color: #a5b4fc;
}

.saved-chart-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* MAP PICKER */
.map-modal-body {
  padding: 1rem 1.5rem 1.5rem 1.5rem;
}

.leaflet-map-container {
  width: 100%;
  height: 380px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  z-index: 1;
}

.map-selected-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  background: rgba(15, 23, 42, 0.8);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-top: 0.5rem;
}

.selected-coords-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.selected-coords-text strong {
  color: #fcd34d;
}

/* AI ADVICE RESULT */
.advice-loading {
  text-align: center;
  padding: 2.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.15rem;
  background: radial-gradient(circle at center, rgba(30, 41, 59, 0.7) 0%, rgba(15, 23, 42, 0.9) 100%);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35), inset 0 0 20px rgba(245, 158, 11, 0.05);
}

.advice-loading-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #f3f4f6;
  margin: 0;
  letter-spacing: 0.02em;
}

.advice-loading-phrase-container {
  min-height: 2.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 520px;
  padding: 0.5rem 1rem;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 9999px;
  border: 1px solid rgba(245, 158, 11, 0.15);
}

.advice-loading-phrase {
  font-size: 0.92rem;
  color: #fde68a;
  font-style: italic;
  margin: 0;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.35s ease, transform 0.35s ease;
  line-height: 1.4;
}

.advice-loading-phrase.fade-out {
  opacity: 0;
  transform: translateY(6px);
}

.spinner {
  width: 46px;
  height: 46px;
  border: 3.5px solid rgba(245, 158, 11, 0.2);
  border-top-color: #f59e0b;
  border-right-color: #fbbf24;
  border-radius: 50%;
  animation: spin 0.9s cubic-bezier(0.5, 0.1, 0.5, 0.9) infinite;
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.25);
}

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

.advice-result-box {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 1.25rem;
}

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

.markdown-body {
  color: #e2e8f0;
  font-size: 0.95rem;
  line-height: 1.75;
}

.markdown-body h1 {
  font-family: var(--font-serif);
  color: #fcd34d;
  font-size: 1.5rem;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid rgba(245, 158, 11, 0.25);
}

.markdown-body h2 {
  font-family: var(--font-serif);
  color: #fcd34d;
  font-size: 1.3rem;
  margin-top: 1.35rem;
  margin-bottom: 0.6rem;
}

.markdown-body h3 {
  font-family: var(--font-serif);
  color: #fde68a;
  font-size: 1.15rem;
  margin-top: 1.2rem;
  margin-bottom: 0.5rem;
}

.markdown-body h4 {
  font-family: var(--font-serif);
  color: #c7d2fe;
  font-size: 1.05rem;
  margin-top: 1rem;
  margin-bottom: 0.4rem;
}

.markdown-body h5, .markdown-body h6 {
  font-size: 0.9rem;
  font-weight: 700;
  color: #a5b4fc;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 0.85rem;
  margin-bottom: 0.35rem;
}

.markdown-body p {
  margin-bottom: 0.9rem;
}

.markdown-body hr, .markdown-body .markdown-hr {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(245, 158, 11, 0.4), rgba(99, 102, 241, 0.4), transparent);
  margin: 1.5rem 0;
}

.markdown-body ul, .markdown-body ol {
  padding-left: 1.6rem;
  margin-bottom: 1rem;
}

.markdown-body li {
  margin-bottom: 0.4rem;
}

.markdown-body strong {
  color: #ffffff;
  font-weight: 700;
}

.markdown-body em {
  color: #fef08a;
  font-style: italic;
}

.markdown-body blockquote {
  border-left: 3px solid #6366f1;
  background: rgba(99, 102, 241, 0.08);
  padding: 0.6rem 1rem;
  border-radius: 0 8px 8px 0;
  margin: 1.25rem 0;
  color: #c7d2fe;
}

.markdown-body pre {
  background: #020617;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  white-space: pre;
  max-width: 100%;
  margin: 1.25rem 0;
  font-family: ui-monospace, 'SFMono-Regular', Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
  font-size: 0.88rem;
  line-height: 1.45;
  color: #f8fafc;
}

.markdown-body code {
  background: rgba(99, 102, 241, 0.15);
  color: #fcd34d;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-family: ui-monospace, 'SFMono-Regular', Menlo, Monaco, Consolas, 'Liberation Mono', monospace;
  font-size: 0.88rem;
}

.markdown-body pre code {
  background: transparent;
  padding: 0;
  color: inherit;
  font-size: inherit;
  border-radius: 0;
  white-space: pre;
}

.markdown-body table,
.markdown-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0;
  font-size: 0.9rem;
  background: rgba(15, 23, 42, 0.6);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: table;
}

.markdown-body table th,
.markdown-table th {
  background: rgba(30, 41, 59, 0.9);
  color: #fcd34d;
  font-weight: 600;
  padding: 0.75rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-align: left;
}

.markdown-body table td,
.markdown-table td {
  padding: 0.65rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: #e2e8f0;
}

.markdown-body table tr:nth-child(even),
.markdown-table tr:nth-child(even) {
  background: rgba(30, 41, 59, 0.35);
}

.markdown-body table tr:hover,
.markdown-table tr:hover {
  background: rgba(51, 65, 85, 0.45);
}

.markdown-body table td.table-key-col,
.markdown-table td.table-key-col {
  font-weight: 600;
  color: #fcd34d;
  width: 25%;
  min-width: 140px;
}

.advice-result-box {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 1.5rem;
  overflow-x: hidden;
  max-width: 100%;
}

/* ==========================================================================
   MERMAID ASTROLOGICAL RELATIONSHIP DIAGRAMS
   ========================================================================== */

.mermaid-diagram-card {
  background: rgba(10, 15, 29, 0.85);
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: 12px;
  margin: 1.5rem 0;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(10px);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.mermaid-diagram-card:hover {
  border-color: rgba(252, 211, 77, 0.45);
  box-shadow: 0 10px 36px rgba(99, 102, 241, 0.2);
}

.mermaid-diagram-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: linear-gradient(90deg, rgba(30, 27, 75, 0.9), rgba(15, 23, 42, 0.85));
  border-bottom: 1px solid rgba(99, 102, 241, 0.25);
  padding: 0.7rem 1.1rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: #fcd34d;
  letter-spacing: 0.3px;
}

.mermaid-diagram-icon {
  font-size: 1.1rem;
}

.mermaid-diagram-svg-wrapper {
  padding: 1.5rem;
  display: flex;
  justify-content: center;
  align-items: center;
  background: radial-gradient(circle at center, rgba(15, 23, 42, 0.6) 0%, rgba(2, 6, 23, 0.9) 100%);
  overflow-x: auto;
  min-height: 120px;
}

.mermaid-diagram-svg-wrapper svg {
  max-width: 100% !important;
  height: auto !important;
  display: block;
  margin: 0 auto;
}

/* Typography & Contrast inside Mermaid SVG diagrams */
.mermaid-diagram-svg-wrapper svg .node .label,
.mermaid-diagram-svg-wrapper svg .node .nodeLabel,
.mermaid-diagram-svg-wrapper svg .node foreignObject div {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  line-height: 1.45 !important;
  text-align: center !important;
  word-break: normal !important;
  overflow-wrap: break-word !important;
  white-space: normal !important;
}

/* Prevent SVG foreignObject clipping/truncation of text */
.mermaid-diagram-svg-wrapper svg .node foreignObject,
.mermaid-diagram-svg-wrapper svg .edgeLabel foreignObject {
  overflow: visible !important;
}

.mermaid-diagram-svg-wrapper svg .node rect,
.mermaid-diagram-svg-wrapper svg .node polygon,
.mermaid-diagram-svg-wrapper svg .node circle {
  rx: 8px !important;
  ry: 8px !important;
}

/* Edge relationship labels (text on connecting arrows) */
.mermaid-diagram-svg-wrapper svg .edgeLabel,
.mermaid-diagram-svg-wrapper svg .edgeLabel .label,
.mermaid-diagram-svg-wrapper svg .edgeLabel span,
.mermaid-diagram-svg-wrapper svg .edgeLabel foreignObject div {
  color: #fcd34d !important;
  fill: #fcd34d !important;
  background: rgba(2, 6, 23, 0.92) !important;
  font-size: 0.78rem !important;
  font-weight: 600 !important;
  border-radius: 6px !important;
  padding: 2px 6px !important;
}

.mermaid-diagram-svg-wrapper svg .edgeLabel rect {
  fill: rgba(2, 6, 23, 0.92) !important;
  stroke: rgba(99, 102, 241, 0.45) !important;
  rx: 6px !important;
}

/* CSS fallback: Ensure nodes with light-colored fills always display dark text */
.mermaid-diagram-svg-wrapper svg .node:has(rect[style*="fill: #e"]) .nodeLabel,
.mermaid-diagram-svg-wrapper svg .node:has(rect[style*="fill: #f"]) .nodeLabel,
.mermaid-diagram-svg-wrapper svg .node:has(rect[style*="fill:#e"]) .nodeLabel,
.mermaid-diagram-svg-wrapper svg .node:has(rect[style*="fill:#f"]) .nodeLabel,
.mermaid-diagram-svg-wrapper svg .node:has(rect[style*="fill: #e"]) foreignObject div,
.mermaid-diagram-svg-wrapper svg .node:has(rect[style*="fill: #f"]) foreignObject div,
.mermaid-diagram-svg-wrapper svg .node:has(rect[style*="fill:#e"]) foreignObject div,
.mermaid-diagram-svg-wrapper svg .node:has(rect[style*="fill:#f"]) foreignObject div {
  color: #0f172a !important;
  fill: #0f172a !important;
}

.mermaid-fallback-box {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  margin: 1.25rem 0;
  overflow: hidden;
}

.mermaid-fallback-code {
  margin: 0;
  padding: 1rem 1.25rem;
  font-family: ui-monospace, 'SFMono-Regular', Menlo, Monaco, Consolas, monospace;
  font-size: 0.82rem;
  color: #cbd5e1;
  background: rgba(2, 6, 23, 0.6);
  white-space: pre-wrap;
  word-break: break-word;
}

.offline-tip {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

/* FOOTER */
.footer {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(10, 15, 29, 0.95);
  padding: 1.5rem 2rem;
  text-align: center;
}

.footer-content {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
}

.footer-privacy-note {
  font-size: 0.8rem;
  color: #94a3b8;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.footer-link-btn {
  background: transparent;
  border: none;
  color: #fcd34d;
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: underline;
  transition: color 0.2s;
}

.footer-link-btn:hover {
  color: #fff;
}

.footer-sep {
  color: var(--text-muted);
}

.footer-copy {
  font-size: 0.75rem;
  color: #64748b;
}

/* TOASTS */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 2000;
  pointer-events: none;
}

.toast-message {
  background: #1e1b4b;
  border: 1px solid #6366f1;
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  font-size: 0.9rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.3s ease;
  pointer-events: auto;
}

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

/* ==========================================================================
   REPORT EXPORT MODAL & PRINT STYLING
   ========================================================================== */

.modal-report {
  max-width: 620px;
  width: 92%;
}

.report-default-notice {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background: rgba(30, 27, 75, 0.6);
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  margin-bottom: 1.25rem;
  font-size: 0.85rem;
  color: #cbd5e1;
  line-height: 1.45;
}

.report-notice-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.report-section-group {
  margin-bottom: 1.25rem;
}

.report-section-header {
  margin-bottom: 0.75rem;
}

.report-section-header h3 {
  font-size: 1rem;
  color: #f8fafc;
  margin: 0;
}

.btn-link-action {
  background: none;
  border: none;
  color: var(--accent-gold);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

.btn-link-action:hover {
  color: #fff;
}

.report-analyses-checklist {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.report-checklist-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(51, 65, 85, 0.6);
  transition: all 0.2s ease;
  cursor: pointer;
}

.report-checklist-item:hover {
  background: rgba(30, 41, 59, 0.6);
  border-color: rgba(99, 102, 241, 0.4);
}

.report-checklist-item.item-disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: rgba(15, 23, 42, 0.3);
  border-style: dashed;
}

.report-checklist-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: #e2e8f0;
  cursor: inherit;
}

.report-checklist-checkbox {
  width: 18px;
  height: 18px;
  accent-color: #f59e0b;
  cursor: inherit;
}

.report-action-block {
  margin-top: 1rem;
}

.report-modal-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 1.25rem 0;
  color: #64748b;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 1px;
}

.report-modal-divider::before,
.report-modal-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid rgba(51, 65, 85, 0.7);
}

.report-modal-divider span {
  padding: 0 0.85rem;
}

.report-email-group {
  margin-top: 0.5rem;
}

.report-email-group label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: #cbd5e1;
  margin-bottom: 0.5rem;
}

.report-email-input-row {
  display: flex;
  gap: 0.6rem;
}

.report-email-input-row input {
  flex: 1;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid #334155;
  color: #fff;
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  font-size: 0.9rem;
}

.report-email-input-row input:focus {
  outline: none;
  border-color: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

/* ==========================================================================
   USER CREDITS PILL & HEADER CONTROLS
   ========================================================================== */

.user-credits-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #fcd34d;
}

.credits-icon {
  font-size: 0.95rem;
}

.btn-outline-gold {
  background: transparent;
  border: 1px solid rgba(245, 158, 11, 0.6);
  color: #fcd34d;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-outline-gold:hover {
  background: rgba(245, 158, 11, 0.2);
  border-color: #f59e0b;
  color: #fff;
}

/* ==========================================================================
   CHECKOUT & PRICING MODAL
   ========================================================================== */

.modal-checkout {
  max-width: 680px;
  width: 95%;
}

.checkout-body {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.checkout-packages-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

@media (max-width: 640px) {
  .checkout-packages-grid {
    grid-template-columns: 1fr;
  }
}

.package-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background: #0f172a;
  border: 2px solid #334155;
  border-radius: 12px;
  padding: 1.25rem 1rem;
  cursor: pointer;
  transition: all 0.25s ease;
}

.package-card:hover {
  border-color: #6366f1;
  background: #182234;
}

.package-card.selected {
  border-color: #f59e0b;
  background: #1e1b4b;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.25);
}

.package-badge-discount {
  position: absolute;
  top: -10px;
  right: 12px;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.package-radio input {
  margin-top: 0.2rem;
  accent-color: #f59e0b;
  cursor: pointer;
}

.package-details {
  flex: 1;
}

.package-header-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.package-title {
  font-weight: 700;
  font-size: 0.92rem;
  color: #f8fafc;
}

.package-price {
  font-size: 1.1rem;
  font-weight: 800;
  color: #fcd34d;
  white-space: nowrap;
}

.package-desc {
  font-size: 0.78rem;
  color: #94a3b8;
  line-height: 1.4;
  margin: 0;
}

/* PAYMENT FORM */
.checkout-payment-section {
  background: #0b1120;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
}

.payment-section-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 0.95rem;
  color: #fcd34d;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #1e293b;
}

.payment-security-badge {
  margin-left: auto;
  font-size: 0.72rem;
  font-weight: 600;
  color: #6ee7b7;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}

.checkout-control-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 0.45rem 0.85rem;
  margin-bottom: 1rem;
  font-size: 0.78rem;
}

.control-code-label {
  color: #94a3b8;
  font-weight: 500;
}

.control-code-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 700;
  color: #fcd34d;
  letter-spacing: 0.5px;
  background: rgba(245, 158, 11, 0.12);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.checkout-card-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.checkout-card-form .form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #cbd5e1;
  margin-bottom: 0.35rem;
}

.checkout-card-form input {
  width: 100%;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  color: #f8fafc;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.checkout-card-form input:focus {
  outline: none;
  border-color: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

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

.card-input-wrapper input {
  letter-spacing: 1px;
}

.card-brand-icon {
  position: absolute;
  right: 12px;
  font-size: 1.1rem;
  pointer-events: none;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1.3fr;
  gap: 0.75rem;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

@media (max-width: 540px) {
  .form-grid-3,
  .form-grid-2 {
    grid-template-columns: 1fr;
  }
}

.checkout-error-msg {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
}

/* DEV SIMULATION CONTROLS */
.checkout-dev-box {
  background: #1e1b4b;
  border: 1px dashed #6366f1;
  border-radius: 8px;
  padding: 0.85rem 1rem;
  margin-top: 0.25rem;
}

.dev-box-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: #a5b4fc;
  margin-bottom: 0.6rem;
}

.dev-box-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.btn-dev-approve {
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid rgba(16, 185, 129, 0.5);
  color: #6ee7b7;
  font-weight: 700;
  font-size: 0.78rem;
}

.btn-dev-approve:hover {
  background: #059669;
  color: #fff;
}

.btn-dev-deny {
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.5);
  color: #fca5a5;
  font-weight: 700;
  font-size: 0.78rem;
}

.btn-dev-deny:hover {
  background: #dc2626;
  color: #fff;
}

.checkout-guarantee-text {
  font-size: 0.75rem;
  color: #64748b;
  text-align: center;
  margin-top: 0.75rem;
  line-height: 1.4;
}

.user-credits-pill {
  cursor: pointer;
  transition: all 0.2s ease;
}

.user-credits-pill:hover {
  transform: translateY(-1px);
  filter: brightness(1.15);
  box-shadow: 0 4px 12px rgba(234, 179, 8, 0.25);
}

/* TRANSACTIONS MODAL STYLES */
.modal-transactions {
  max-width: 620px;
  width: 95%;
}

.transactions-body {
  padding: 1.25rem 1.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.transactions-summary-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, rgba(30, 27, 75, 0.8), rgba(15, 23, 42, 0.9));
  border: 1px solid rgba(234, 179, 8, 0.25);
  border-radius: 12px;
  padding: 1rem 1.25rem;
}

.summary-credits-box {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.summary-credits-label {
  font-size: 0.8rem;
  color: #94a3b8;
  font-weight: 500;
}

.summary-credits-value {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 1.4rem;
  color: #fef08a;
}

.summary-credits-value strong {
  font-size: 1.6rem;
  font-weight: 800;
  color: #facc15;
}

.summary-credits-value .credits-unit {
  font-size: 0.85rem;
  color: #cbd5e1;
}

.transactions-list-container {
  min-height: 200px;
  max-height: 380px;
  overflow-y: auto;
}

.transactions-loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 2.5rem 1rem;
  color: #94a3b8;
  font-size: 0.9rem;
}

.transactions-empty-state {
  text-align: center;
  padding: 2.5rem 1.5rem;
  color: #64748b;
  font-size: 0.9rem;
  background: rgba(15, 23, 42, 0.4);
  border-radius: 8px;
  border: 1px dashed rgba(255, 255, 255, 0.08);
}

.transactions-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.tx-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1rem;
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  transition: all 0.15s ease;
}

.tx-item:hover {
  background: rgba(30, 41, 59, 0.8);
  border-color: rgba(255, 255, 255, 0.12);
}

.tx-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.tx-icon-badge {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.tx-icon-purchase {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.tx-icon-usage {
  background: rgba(168, 85, 247, 0.15);
  border: 1px solid rgba(168, 85, 247, 0.4);
}

.tx-meta {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.tx-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: #f1f5f9;
}

.tx-date-details {
  font-size: 0.75rem;
  color: #94a3b8;
}

.tx-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.2rem;
}

.tx-amount {
  font-size: 0.95rem;
  font-weight: 700;
}

.tx-amount-plus {
  color: #4ade80;
}

.tx-amount-minus {
  color: #c084fc;
}

.tx-balance-after {
  font-size: 0.72rem;
  color: #64748b;
}

/* ==========================================================================
   ADMIN AREA CONTROL CENTER STYLES
   ========================================================================== */

.btn-admin-nav {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2) 0%, rgba(168, 85, 247, 0.2) 100%);
  border: 1px solid var(--accent-gold);
  color: #fef08a;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.25);
  font-weight: 600;
  transition: all 0.2s ease;
}

.btn-admin-nav:hover {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.35) 0%, rgba(168, 85, 247, 0.35) 100%);
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.4);
  transform: translateY(-1px);
}

.modal-admin-card {
  max-width: 1360px;
  width: 96vw;
  max-height: 94vh;
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1.8rem;
  background: rgba(13, 19, 33, 0.96);
  border: 1px solid rgba(245, 158, 11, 0.3);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 30px rgba(245, 158, 11, 0.15);
  overflow: hidden;
}

.modal-admin-lg {
  max-width: 960px;
  width: 92vw;
  max-height: 90vh;
}

.modal-admin-md {
  max-width: 760px;
  width: 90vw;
}

.modal-admin-sm {
  max-width: 520px;
  width: 90vw;
}

.admin-modal-header {
  padding-bottom: 1.2rem;
  border-bottom: 1px solid rgba(99, 102, 241, 0.2);
  gap: 1rem;
  flex-wrap: wrap;
}

.admin-header-title-group {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.admin-badge-logo {
  font-family: var(--font-serif);
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 1.5px;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #0f172a;
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.4);
}

.admin-header-title-group h2 {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  color: #f8fafc;
  margin-bottom: 0.15rem;
}

.admin-header-title-group p {
  font-size: 0.82rem;
  color: #94a3b8;
}

.admin-header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.admin-select-sm {
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #f1f5f9;
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  font-size: 0.82rem;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
}

.admin-select-sm:focus {
  border-color: var(--accent-gold);
}

.admin-nav-tabs {
  display: flex;
  gap: 0.5rem;
  padding: 0.8rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  overflow-x: auto;
  flex-shrink: 0;
}

.admin-nav-tab {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 0.88rem;
  font-weight: 500;
  padding: 0.55rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.admin-nav-tab:hover {
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.05);
}

.admin-nav-tab.active {
  color: #fef08a;
  background: rgba(245, 158, 11, 0.16);
  border: 1px solid rgba(245, 158, 11, 0.35);
  font-weight: 600;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.15);
}

.admin-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.2rem 0.2rem;
}

.admin-view-section {
  display: none;
}

.admin-view-section.active {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  animation: fadeIn 0.25s ease forwards;
}

/* KPI GRID */
.admin-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.admin-kpi-card {
  background: rgba(20, 29, 51, 0.7);
  border-radius: 12px;
  padding: 1.1rem 1.3rem;
  border: 1px solid rgba(99, 102, 241, 0.18);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.admin-kpi-card:hover {
  transform: translateY(-2px);
}

.kpi-gold {
  border-color: rgba(245, 158, 11, 0.35);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.08) 0%, rgba(18, 25, 43, 0.7) 100%);
}

.kpi-cyan {
  border-color: rgba(56, 189, 248, 0.35);
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.08) 0%, rgba(18, 25, 43, 0.7) 100%);
}

.kpi-purple {
  border-color: rgba(168, 85, 247, 0.35);
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.08) 0%, rgba(18, 25, 43, 0.7) 100%);
}

.kpi-emerald {
  border-color: rgba(16, 185, 129, 0.35);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(18, 25, 43, 0.7) 100%);
}

.kpi-rose {
  border-color: rgba(244, 63, 94, 0.35);
  background: linear-gradient(135deg, rgba(244, 63, 94, 0.08) 0%, rgba(18, 25, 43, 0.7) 100%);
}

.kpi-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.kpi-icon {
  font-size: 1.25rem;
}

.kpi-label {
  font-size: 0.8rem;
  color: #94a3b8;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.kpi-val {
  font-family: var(--font-serif);
  font-size: 1.65rem;
  font-weight: 700;
  color: #f8fafc;
}

.kpi-gold .kpi-val {
  color: #fcd34d;
}

.kpi-cyan .kpi-val {
  color: #7dd3fc;
}

.kpi-purple .kpi-val {
  color: #d8b4fe;
}

.kpi-emerald .kpi-val {
  color: #6ee7b7;
}

.kpi-rose .kpi-val {
  color: #fda4af;
}

.kpi-sub {
  font-size: 0.76rem;
  color: #64748b;
}

/* CHARTS & HISTOGRAMS */
.admin-charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.2rem;
}

.admin-chart-card {
  background: rgba(18, 25, 43, 0.75);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 12px;
  padding: 1.2rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.admin-chart-card.full-width {
  grid-column: 1 / -1;
}

.chart-card-header h3 {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  color: #f1f5f9;
}

.chart-badge-tag {
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.admin-svg-chart-container {
  min-height: 220px;
  width: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chart-loading-placeholder {
  color: #64748b;
  font-size: 0.85rem;
  padding: 2rem;
  text-align: center;
}

/* HISTOGRAM SVG STYLES */
.histogram-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.hist-bar {
  transition: opacity 0.2s ease, transform 0.2s ease;
  cursor: pointer;
}

.hist-bar:hover {
  opacity: 0.85;
  filter: drop-shadow(0 0 6px rgba(245, 158, 11, 0.5));
}

.hist-grid-line {
  stroke: rgba(255, 255, 255, 0.07);
  stroke-dasharray: 3 3;
}

.hist-axis-text {
  fill: #64748b;
  font-size: 10px;
  font-family: var(--font-sans);
}

/* FINANCIAL BALANCE CARD */
.admin-balance-card {
  background: rgba(18, 25, 43, 0.75);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: 12px;
  padding: 1.2rem 1.4rem;
}

.balance-card-header h3 {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  color: #fef08a;
}

.balance-tag-currency {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  background: rgba(245, 158, 11, 0.2);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.admin-balance-table-wrapper {
  margin-top: 0.8rem;
  overflow-x: auto;
}

.admin-balance-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-balance-table td,
.admin-balance-table th {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.admin-balance-table tr:last-child td {
  border-bottom: none;
}

.balance-row-highlight {
  background: rgba(245, 158, 11, 0.08);
  font-weight: 600;
}

.balance-row-highlight td {
  color: #fef08a;
}

/* FILTER BARS & SEARCH */
.admin-filter-bar {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.4rem 0;
}

.filter-search-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex: 1;
  max-width: 460px;
}

.admin-input-search {
  flex: 1;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(99, 102, 241, 0.25);
  color: #f8fafc;
  padding: 0.48rem 0.85rem;
  border-radius: 8px;
  font-size: 0.85rem;
  outline: none;
}

.admin-input-search:focus {
  border-color: var(--accent-gold);
}

.filter-selects-group {
  display: flex;
  gap: 0.6rem;
}

.filter-chips-group {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.filter-chip {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  font-size: 0.8rem;
  padding: 0.4rem 0.85rem;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-chip:hover {
  color: #f8fafc;
  border-color: rgba(255, 255, 255, 0.25);
}

.filter-chip.active {
  background: rgba(245, 158, 11, 0.2);
  border-color: var(--accent-gold);
  color: #fef08a;
  font-weight: 600;
}

.status-chip-confirmed.active {
  background: rgba(16, 185, 129, 0.2);
  border-color: #10b981;
  color: #6ee7b7;
}

.status-chip-refused.active {
  background: rgba(244, 63, 94, 0.2);
  border-color: #f43f5e;
  color: #fda4af;
}

/* ADMIN TABLES */
.admin-table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid rgba(99, 102, 241, 0.18);
  background: rgba(18, 25, 43, 0.7);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
  text-align: left;
}

.admin-table th {
  background: rgba(15, 23, 42, 0.95);
  color: #a5b4fc;
  font-weight: 600;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(99, 102, 241, 0.25);
  white-space: nowrap;
}

.admin-table td {
  padding: 0.7rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: #e2e8f0;
  vertical-align: middle;
}

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

/* BADGES */
.admin-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.badge-role-admin {
  background: rgba(245, 158, 11, 0.2);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

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

.badge-status-confirmed {
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.badge-status-refused {
  background: rgba(244, 63, 94, 0.2);
  color: #fda4af;
  border: 1px solid rgba(244, 63, 94, 0.4);
}

.badge-lang {
  background: rgba(99, 102, 241, 0.2);
  color: #c7d2fe;
  border: 1px solid rgba(99, 102, 241, 0.4);
}

/* BUTTONS IN ADMIN */
.table-actions-cell {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}

.btn-xs {
  font-size: 0.74rem;
  padding: 0.22rem 0.55rem;
  border-radius: 6px;
  font-weight: 500;
}

.btn-outline-danger {
  background: rgba(244, 63, 94, 0.1);
  border: 1px solid rgba(244, 63, 94, 0.4);
  color: #fda4af;
}

.btn-outline-danger:hover {
  background: rgba(244, 63, 94, 0.25);
  color: #fff;
}

/* PAGINATION */
.admin-pagination-wrapper {
  padding: 0.8rem 0.2rem;
  font-size: 0.82rem;
  color: #94a3b8;
}

.pagination-btn-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* USER DETAILS INSPECTOR */
.modal-admin-user-card {
  max-width: 1040px;
  width: 94vw;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
}

.admin-user-modal-title {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.user-modal-icon {
  font-size: 1.8rem;
}

.user-inspector-top-bar {
  background: rgba(20, 29, 51, 0.7);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 10px;
  padding: 0.85rem 1.2rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.user-stat-pills {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.stat-pill-item {
  font-size: 0.8rem;
  color: #94a3b8;
}

.stat-pill-val {
  font-size: 0.95rem;
  color: #f1f5f9;
  margin-left: 0.25rem;
}

.stat-pill-val.gold {
  color: #fcd34d;
}

.user-inspect-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.user-inspector-tabs {
  display: flex;
  gap: 0.4rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 1rem;
}

.user-inspect-tab,
.user-inspector-tab {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 0.84rem;
  padding: 0.5rem 0.9rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.user-inspect-tab.active,
.user-inspector-tab.active {
  background: rgba(245, 158, 11, 0.15);
  color: #fef08a;
  border: 1px solid rgba(245, 158, 11, 0.3);
  font-weight: 600;
}

.user-subtab-view {
  display: none;
}

.user-subtab-view.active {
  display: block;
}

.admin-input-readonly {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(99, 102, 241, 0.2);
  color: #94a3b8;
  padding: 0.5rem 0.8rem;
  border-radius: 8px;
  width: 100%;
}

.admin-checkbox-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
  font-size: 0.82rem;
  color: #cbd5e1;
}

.admin-regen-loading-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  color: #fef08a;
  font-size: 0.85rem;
  margin: 0.8rem 0;
}

/* SYSTEM HEALTH CARDS */
.admin-system-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.2rem;
}

.system-card {
  background: rgba(18, 25, 43, 0.75);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 12px;
  padding: 1.2rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.system-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 0.6rem;
}

.system-card-header h4 {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  color: #f8fafc;
}

.system-status-pill {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.18rem 0.5rem;
  border-radius: 12px;
}

.status-online {
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.status-offline {
  background: rgba(148, 163, 184, 0.15);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.system-item-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  color: #94a3b8;
}

.system-item-row strong {
  color: #f1f5f9;
}

@media (max-width: 900px) {
  .admin-charts-grid {
    grid-template-columns: 1fr;
  }
}

.hidden {
  display: none !important;
}
