:root {
  --bg-deep: #060d18;
  --bg-panel: rgba(12, 22, 40, 0.72);
  --border: rgba(255, 255, 255, 0.08);
  --text: #e8eef7;
  --muted: #8fa3bd;
  --accent: #3ee0b3;
  --accent-dim: rgba(62, 224, 179, 0.15);
  --warm: #ffb347;
  --danger: #ff6b6b;
  --radius: 18px;
  --font-display: "Roboto", system-ui, sans-serif;
  --font-body: "Manrope", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg-deep);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black, transparent);
  pointer-events: none;
  z-index: 0;
}

.glow {
  position: fixed;
  width: min(90vw, 520px);
  height: min(90vw, 520px);
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.35;
  pointer-events: none;
  z-index: 0;
}

.glow-a {
  top: -120px;
  right: -80px;
  background: #1a4d6e;
}

.glow-b {
  bottom: -100px;
  left: -60px;
  background: #0d5c4a;
}

.site-header,
.layout,
.results-wrap,
.site-footer {
  position: relative;
  z-index: 1;
}

.site-header {
  padding: clamp(1.25rem, 4vw, 2.5rem) clamp(1rem, 4vw, 2rem) 0;
  max-width: 1120px;
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.brand-mark {
  font-size: 2.25rem;
  line-height: 1;
  filter: drop-shadow(0 0 12px rgba(62, 224, 179, 0.5));
}

.brand-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.75rem, 4vw, 2.35rem);
  letter-spacing: -0.02em;
  margin: 0 0 0.25rem;
  background: linear-gradient(120deg, #fff 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand-tagline {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 28rem;
}

.layout {
  display: grid;
  gap: 1.25rem;
  max-width: 1120px;
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 1.75rem);
  grid-template-columns: 1fr;
}

@media (min-width: 900px) {
  .layout {
    grid-template-columns: 1fr 300px;
    align-items: start;
  }
}

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(1.25rem, 3vw, 1.75rem);
  backdrop-filter: blur(12px);
}

.panel-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
}

.panel-lead {
  margin: 0 0 1.25rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.dropzone {
  border: 2px dashed rgba(62, 224, 179, 0.45);
  border-radius: calc(var(--radius) - 4px);
  padding: clamp(1.5rem, 5vw, 2.25rem);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
  background: var(--accent-dim);
  outline: none;
}

.dropzone:hover,
.dropzone:focus-visible {
  border-color: var(--accent);
  background: rgba(62, 224, 179, 0.22);
}

.dropzone:focus-visible {
  box-shadow: 0 0 0 3px rgba(62, 224, 179, 0.35);
}

.dropzone.is-dragover {
  border-style: solid;
  transform: scale(1.01);
}

.dropzone-inner {
  pointer-events: none;
}

.dropzone-icon {
  color: var(--accent);
  margin-bottom: 0.75rem;
  display: flex;
  justify-content: center;
}

.dropzone-text {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
}

.dropzone-hint {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.selected-file {
  margin: 1rem 0 0;
  font-size: 0.88rem;
  color: var(--accent);
  word-break: break-all;
}

.panel-history {
  min-height: 200px;
}

.history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.btn-text {
  font-family: inherit;
  font-size: 0.75rem;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  padding: 0.25rem;
}

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

.history-empty {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.history-item {
  width: 100%;
  text-align: left;
  font-family: inherit;
  font-size: 0.85rem;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.history-item:hover {
  border-color: rgba(62, 224, 179, 0.4);
  background: rgba(62, 224, 179, 0.08);
}

.history-item.is-active {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.history-item-name {
  display: block;
  font-weight: 600;
  word-break: break-word;
}

.history-item-meta {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(6, 13, 24, 0.82);
  backdrop-filter: blur(8px);
}

.loading-overlay.is-active {
  display: flex;
}

.history-list[hidden] {
  display: none !important;
}

.loading-card {
  max-width: 360px;
  text-align: center;
  padding: 2rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-panel);
}

.spinner {
  width: 52px;
  height: 52px;
  margin: 0 auto 1.25rem;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--accent);
  animation: spin 0.85s linear infinite;
}

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

.loading-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
  margin: 0 0 0.5rem;
}

.loading-sub {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.results-wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 clamp(1rem, 4vw, 2rem) clamp(2rem, 5vw, 3.5rem);
}

.results-header {
  margin-bottom: 1.5rem;
}

.results-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  margin: 0 0 0.35rem;
}

.results-meta {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.bill-section {
  display: grid;
  gap: 1rem;
  margin-bottom: 2rem;
}

@media (min-width: 700px) {
  .bill-section {
    grid-template-columns: repeat(2, 1fr);
  }
}

.bill-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  backdrop-filter: blur(8px);
}

.bill-card h4 {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin: 0 0 0.75rem;
}

.bill-rows {
  display: grid;
  gap: 0.45rem;
}

.bill-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.5rem 1rem;
  font-size: 0.86rem;
  align-items: baseline;
}

.bill-row .bill-k {
  margin: 0;
  color: var(--muted);
  font-weight: 500;
}

.bill-row .bill-v {
  margin: 0;
  text-align: right;
  font-weight: 600;
}

.subsection-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 1rem;
}

.comparison-grid {
  display: grid;
  gap: 1rem;
}

@media (min-width: 720px) {
  .comparison-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.plan-card {
  position: relative;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  overflow: hidden;
  backdrop-filter: blur(8px);
}

.plan-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--warm));
  opacity: 0.9;
}

.plan-rank {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--warm);
  margin-bottom: 0.35rem;
}

.plan-provider {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  margin: 0 0 0.15rem;
}

.plan-name {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.plan-highlight {
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--accent);
  margin: 0 0 0.75rem;
  font-variant-numeric: tabular-nums;
}

.plan-details {
  display: grid;
  gap: 0.4rem;
  font-size: 0.82rem;
}

.plan-details div {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 0.35rem;
}

.plan-details div:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.plan-details span:first-child {
  color: var(--muted);
}

.site-footer {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 clamp(1rem, 4vw, 2rem) 2rem;
}

.site-footer p {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
  max-width: 42rem;
}

.error-banner {
  width: min(1120px, 100% - 2 * clamp(1rem, 4vw, 2rem));
  margin: 1rem auto 0;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 107, 107, 0.4);
  background: rgba(255, 107, 107, 0.1);
  color: #ffc9c9;
  font-size: 0.88rem;
  line-height: 1.45;
  box-sizing: border-box;
}

.charge-group {
  margin-top: 1rem;
}

.charge-group:first-of-type {
  margin-top: 0.5rem;
}

.charge-group-title {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
  color: var(--text);
}
