:root {
  --bg: #0a0f1e;
  --panel: #0f1a33;
  --text: #d6e1ff;
  --muted: #7b8fb2;
  --neon: #00e5ff;
  --accent: #7a5cff;
  --good: #3ddc97;
  --bad: #ff5c93
}

* {
  box-sizing: border-box
}

html {
  min-height: 100%
}

body {
  min-height: 100vh;
  margin: 0;
  font: 16px/1.6 Inter, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: radial-gradient(60% 120% at 80% 0%, #0d1330 0%, #070a16 60%, #05070f 100%), var(--bg);
  background-attachment: fixed
}

/* Navigation Bar */
.main-nav {
  background: rgba(10, 15, 30, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(122, 92, 255, 0.2);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-group {
  display: flex;
  gap: 20px;
  align-items: center;
}

.nav-link {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
  padding: 8px 16px;
  border-radius: 8px;
  transition: all 0.2s;
  position: relative;
}

.btn-login {
  background: linear-gradient(135deg, #5865F2 0%, var(--accent) 100%);
  color: #fff !important;
  border-radius: 20px;
  padding: 8px 20px 8px 14px;
  box-shadow: 0 4px 15px rgba(88, 101, 242, 0.35);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  transition: all 0.3s ease;
  border: 1px solid transparent;
}

.btn-login svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  flex-shrink: 0;
}

.btn-login:hover {
  background: linear-gradient(135deg, #6875f5 0%, #8b6cff 100%);
  color: #fff !important;
  box-shadow: 0 0px 20px rgba(88, 101, 242, 0.5);
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-profile {
  border: 1px solid var(--muted);
  border-radius: 20px;
  padding: 6px 18px;
}

.btn-profile:hover {
  border-color: var(--neon);
  color: var(--neon) !important;
  background: rgba(0, 229, 255, 0.05);
}

.nav-link:hover {
  color: var(--text);
  background: rgba(122, 92, 255, 0.1);
}

.nav-link.active {
  color: var(--neon);
  background: rgba(0, 229, 255, 0.1);
  text-shadow: 0 0 10px rgba(0, 229, 255, 0.5);
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -13px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 2px;
  background: linear-gradient(90deg, var(--neon), var(--accent));
  border-radius: 2px;
}

.container {
  max-width: 980px;
  margin: 0 auto;
  padding: 24px
}

header h1 {
  font-weight: 800;
  letter-spacing: .5px;
  margin: .2rem 0
}

.subtitle {
  color: var(--muted);
  margin-top: 0
}

.neon {
  color: var(--neon);
  text-shadow: 0 0 10px rgba(0, 229, 255, .7), 0 0 20px rgba(0, 229, 255, .4)
}

.card {
  background: linear-gradient(145deg, rgba(16, 28, 56, .7), rgba(12, 22, 44, .7));
  backdrop-filter: blur(6px);
  border: 1px solid rgba(122, 92, 255, .25);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35)
}

.input-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap
}

label {
  display: block;
  font-weight: 600;
  color: var(--muted)
}

input {
  flex: 1;
  min-width: 260px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(122, 92, 255, .35);
  background: #0d1730;
  color: var(--text);
  outline: none
}

input:focus {
  border-color: var(--neon);
  box-shadow: 0 0 0 3px rgba(0, 229, 255, .1)
}

.btn-primary {
  background: linear-gradient(90deg, var(--accent), var(--neon));
  border: none;
  color: #001018;
  padding: 12px 18px;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0, 229, 255, .2)
}

.btn-primary:hover {
  filter: brightness(1.05)
}

.status {
  min-height: 24px;
  margin-top: 12px;
  color: var(--muted)
}

.results {
  padding: 18px;
  border-top: 1px dashed rgba(122, 92, 255, .35)
}

.results h2 {
  margin: 0 0 12px 0
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px
}

.stat {
  background: #0d1730;
  border: 1px solid rgba(122, 92, 255, .25);
  border-radius: 12px;
  padding: 14px
}

.stat span {
  color: var(--muted);
  font-size: .85rem
}

.stat strong {
  font-size: 1.4rem;
  display: block;
  margin-top: .25rem
}

.footer {
  color: var(--muted);
  text-align: center
}

.hidden {
  display: none
}

/* Futuristic grid background */
.grid-bg {
  position: fixed;
  inset: 0;
  background-image: linear-gradient(rgba(0, 229, 255, .12) 1px, transparent 1px), linear-gradient(90deg, rgba(122, 92, 255, .12) 1px, transparent 1px);
  background-size: 36px 36px, 36px 36px;
  mask-image: radial-gradient(circle at 70% -10%, black, transparent 60%);
  pointer-events: none
}

/* Account name styling */
.account {
  text-align: center;
  margin-bottom: 20px;
}

.account h2 {
  font-size: 1.5rem;
  color: var(--neon);
  margin: 0;
}

.account p {
  font-size: 1.2rem;
  color: var(--text);
  margin: 5px 0 0;
}

/* History Section */
.history-container {
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid rgba(122, 92, 255, 0.2);
}

.history-container h3 {
  font-size: 1rem;
  color: var(--muted);
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.history-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.history-item {
  background: rgba(122, 92, 255, 0.1);
  border: 1px solid rgba(122, 92, 255, 0.3);
  padding: 6px 12px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.history-item:hover {
  background: rgba(122, 92, 255, 0.25);
  border-color: var(--neon);
}

.btn-delete-item {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.btn-delete-item:hover {
  color: var(--bad);
  opacity: 1;
}

.btn-small {
  padding: 4px 8px;
  font-size: 0.8rem;
  border-radius: 4px;
  border: none;
  cursor: pointer;
}

.btn-danger {
  background: rgba(255, 92, 147, 0.2);
  color: var(--bad);
  border: 1px solid var(--bad);
}

.btn-danger:hover {
  background: var(--bad);
  color: #fff;
}

/* Progression Section */
.progression-section {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px dashed rgba(122, 92, 255, 0.35);
}

.chart-container {
  position: relative;
  height: 300px;
  width: 100%;
  margin-bottom: 20px;
}

.summary-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 15px;
  margin-top: 20px;
}

.stat-card {
  background: rgba(13, 23, 48, 0.6);
  border: 1px solid rgba(122, 92, 255, 0.2);
  border-radius: 10px;
  padding: 15px;
  text-align: center;
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 5px;
}

.stat-card strong {
  font-size: 1.2rem;
  color: var(--text);
}

.gain-text {
  color: var(--good) !important;
}

.btn-secondary {
  background: rgba(122, 92, 255, 0.2);
  border: 1px solid var(--accent);
  color: var(--text);
  padding: 12px 18px;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: var(--accent);
  color: #fff;
}

/* Chart Controls */
.chart-header {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 15px;
  background: rgba(13, 23, 48, 0.4);
  padding: 10px;
  border-radius: 12px;
  border: 1px solid rgba(122, 92, 255, 0.1);
  position: relative;
}

.chart-header h2 {
  margin: 0;
  flex: 1;
  text-align: center;
}

.chart-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.chart-select {
  background: #0d1730;
  border: 1px solid rgba(122, 92, 255, 0.3);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 8px;
  outline: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  transition: all 0.2s;
  appearance: none;
  /* Remove default arrow */
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%237b8fb2%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat;
  background-position: right 10px top 50%;
  background-size: 10px auto;
  padding-right: 30px;
}

.chart-select:hover {
  border-color: var(--accent);
  background-color: #131f3d;
}

.chart-select:focus {
  border-color: var(--neon);
  box-shadow: 0 0 0 2px rgba(0, 229, 255, 0.1);
}

.chart-hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: -5px;
  margin-bottom: 10px;
  font-style: italic;
}

/* Range Popup */
.range-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(15, 26, 51, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid var(--neon);
  border-radius: 16px;
  padding: 20px;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 0 30px rgba(0, 229, 255, 0.2);
  z-index: 1000;
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: translate(-50%, -40%);
  }

  to {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

.range-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  border-bottom: 1px solid rgba(122, 92, 255, 0.2);
  padding-bottom: 10px;
}

.range-header h3 {
  margin: 0;
  color: var(--neon);
  font-size: 1.2rem;
}

.btn-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.btn-close:hover {
  color: var(--text);
}

.range-dates {
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 20px;
}

.range-dates .arrow {
  color: var(--accent);
  margin: 0 5px;
}

.range-duration {
  font-size: 0.8rem;
  color: var(--text);
  margin-top: 4px;
  opacity: 0.8;
}

.range-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
  padding: 10px;
  border-radius: 8px;
  margin-bottom: 8px;
  border-left: 3px solid transparent;
}

.range-row.primary {
  border-left-color: var(--neon);
}

.range-row.secondary {
  border-left-color: #ff5c93;
}

.range-acc-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.range-val {
  text-align: right;
}

.range-diff {
  display: block;
  font-weight: bold;
  font-size: 1.1rem;
}

.range-diff.pos {
  color: var(--good);
}

.range-diff.neg {
  color: var(--bad);
}

.range-total {
  font-size: 0.8rem;
  color: var(--muted);
}

/* Chart Date Range Slider */
.chart-date-range {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding: 12px 16px;
  background: rgba(13, 23, 48, 0.5);
  border: 1px solid rgba(122, 92, 255, 0.15);
  border-radius: 10px;
}

.range-date {
  color: var(--neon);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: monospace;
  min-width: 70px;
  text-align: center;
}

.range-slider-container {
  flex: 1;
  position: relative;
  height: 24px;
  display: flex;
  align-items: center;
}

.range-track {
  position: absolute;
  left: 10px;
  right: 10px;
  height: 6px;
  background: rgba(122, 92, 255, 0.2);
  border-radius: 3px;
  pointer-events: none;
}

.range-selected {
  position: absolute;
  height: 6px;
  background: linear-gradient(90deg, var(--neon), var(--accent));
  border-radius: 3px;
  pointer-events: none;
  box-shadow: 0 0 8px rgba(0, 229, 255, 0.4);
  left: 0;
  width: 100%;
}

.range-handle {
  position: absolute;
  width: 100%;
  height: 24px;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  pointer-events: none;
  z-index: 2;
  margin: 0;
  padding: 0;
  border: none;
}

.range-handle::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  background: linear-gradient(135deg, var(--neon), var(--accent));
  border-radius: 50%;
  cursor: grab;
  pointer-events: auto;
  box-shadow: 0 2px 6px rgba(0, 229, 255, 0.5);
  transition: transform 0.15s, box-shadow 0.15s;
  border: 2px solid #fff;
}

.range-handle::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 3px 10px rgba(0, 229, 255, 0.7);
}

.range-handle::-webkit-slider-thumb:active {
  cursor: grabbing;
}

.range-handle::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: linear-gradient(135deg, var(--neon), var(--accent));
  border-radius: 50%;
  cursor: grab;
  pointer-events: auto;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0, 229, 255, 0.5);
}

.btn-range-reset {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(122, 92, 255, 0.15);
  border: 1px solid rgba(122, 92, 255, 0.3);
  color: var(--text);
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.1rem;
  transition: all 0.2s;
  flex-shrink: 0;
}

.btn-range-reset:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 0 12px rgba(122, 92, 255, 0.4);
}