:root {
  color-scheme: dark;
  --bg: #090b10;
  --panel: #121722;
  --panel-soft: #171d2a;
  --line: #293142;
  --text: #eef3f8;
  --muted: #9aa7b7;
  --accent: #42d392;
  --blue: #62a8ff;
  --yellow: #ffd166;
  --orange: #ff9f43;
  --red: #ff5c75;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(66, 211, 146, 0.12), transparent 34rem),
    linear-gradient(135deg, #090b10 0%, #111724 55%, #090b10 100%);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
}

button,
.open-link,
.ghost-link {
  min-height: 42px;
  border: 1px solid rgba(98, 168, 255, 0.34);
  border-radius: 8px;
  background: linear-gradient(180deg, #2563eb, #1d4ed8);
  color: white;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: inherit;
  font-weight: 700;
  padding: 0 16px;
  text-decoration: none;
  transition:
    transform 0.16s ease,
    border-color 0.16s ease,
    background 0.16s ease;
  white-space: nowrap;
}

button:hover,
.open-link:hover,
.ghost-link:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.45);
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

button.secondary,
.ghost-link {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--line);
}

button.compact {
  min-height: 36px;
}

.shell {
  width: calc(100% - 24px);
  margin: 0 auto;
  padding: 20px 0 40px;
}

.topbar {
  align-items: flex-start;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.eyebrow {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 8px;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: clamp(1.9rem, 3vw, 3rem);
  line-height: 1;
  margin-bottom: 8px;
}

h2 {
  font-size: 1.25rem;
  margin-bottom: 6px;
}

h3 {
  font-size: 1.1rem;
  margin-bottom: 8px;
}

.subtitle,
.section-head p,
.panel-copy {
  color: var(--muted);
  margin-bottom: 0;
}

.topbar-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
}

.topbar-actions strong {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #d7e3ef;
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  padding: 0 14px;
}

.main-nav {
  align-items: center;
  background: rgba(18, 23, 34, 0.78);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
  padding: 8px;
}

.main-nav a {
  border-radius: 8px;
  color: var(--muted);
  font-weight: 800;
  min-height: 34px;
  padding: 7px 12px;
  text-decoration: none;
}

.main-nav a.active,
.main-nav a:hover {
  background: rgba(98, 168, 255, 0.12);
  color: var(--text);
}

.live-badge {
  align-items: center;
  background: rgba(66, 211, 146, 0.1);
  border: 1px solid rgba(66, 211, 146, 0.35);
  border-radius: 999px;
  color: #9bf5c8;
  display: inline-flex;
  font-weight: 800;
  gap: 8px;
  min-height: 36px;
  padding: 0 14px;
}

.live-badge span {
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 18px var(--accent);
  height: 8px;
  width: 8px;
}

.notice {
  background: rgba(255, 159, 67, 0.1);
  border: 1px solid rgba(255, 159, 67, 0.34);
  border-radius: 8px;
  color: #ffd9aa;
  margin-bottom: 18px;
  padding: 14px 16px;
}

.hidden {
  display: none;
}

.toolbar {
  align-items: center;
  background: rgba(18, 23, 34, 0.82);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 14px;
  padding: 14px;
}

.filter-panel {
  align-items: end;
  background: rgba(18, 23, 34, 0.82);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  margin-bottom: 14px;
  padding: 14px 16px;
}

.filter-panel label {
  display: grid;
  gap: 6px;
}

.filter-panel span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.filter-panel select,
.filter-panel input {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  min-height: 40px;
  outline: none;
  padding: 0 10px;
}

.filter-panel select:focus {
  border-color: rgba(98, 168, 255, 0.72);
}

.filter-panel input:focus {
  border-color: rgba(98, 168, 255, 0.72);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chips span,
.badge {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #d7e3ef;
  display: inline-flex;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 7px 10px;
}

.toolbar-controls {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
}

.toggle {
  align-items: center;
  color: var(--muted);
  display: inline-flex;
  gap: 8px;
  white-space: nowrap;
}

.toggle input {
  accent-color: var(--accent);
  height: 18px;
  width: 18px;
}

.token-field {
  align-items: flex-start;
  display: inline-flex;
  flex-direction: column;
  gap: 6px;
  min-width: 170px;
}

.token-field span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.token-field input {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  min-height: 42px;
  outline: none;
  padding: 0 12px;
  width: 100%;
}

.token-field input:focus {
  border-color: rgba(98, 168, 255, 0.72);
}

.token-field.wide {
  min-width: min(440px, 100%);
}

.stats-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 26px;
}

.stats-grid article,
.install-panel,
.danger-zone {
  background: rgba(18, 23, 34, 0.88);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.stats-grid article {
  padding: 18px;
}

.stats-grid span {
  color: var(--muted);
  display: block;
  font-size: 0.9rem;
  margin-bottom: 10px;
}

.stats-grid strong {
  font-size: 2.1rem;
}

.section-head {
  align-items: end;
  display: flex;
  justify-content: space-between;
  margin-bottom: 14px;
}

.offers {
  display: grid;
  gap: 14px;
}

.offer-card {
  background: rgba(18, 23, 34, 0.92);
  border: 1px solid var(--line);
  border-left: 4px solid transparent;
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 18px;
  grid-template-columns: 190px minmax(0, 1fr) 220px;
  min-height: 188px;
  overflow: hidden;
  padding: 14px;
}

.offer-card.berlin {
  border-left-color: var(--blue);
  box-shadow: 0 18px 60px rgba(98, 168, 255, 0.12);
}

.offer-card.marked-interesting {
  border-color: rgba(66, 211, 146, 0.45);
}

.offer-image {
  background:
    linear-gradient(135deg, rgba(98, 168, 255, 0.18), rgba(66, 211, 146, 0.15)),
    #0d111a;
  background-position: center;
  background-size: cover;
  border-radius: 8px;
  min-height: 160px;
}

.offer-title-row {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.badge-berlin {
  background: rgba(98, 168, 255, 0.14);
  border-color: rgba(98, 168, 255, 0.55);
  color: #b9d9ff;
}

.badge-interesting {
  background: rgba(66, 211, 146, 0.14);
  border-color: rgba(66, 211, 146, 0.55);
  color: #adffd4;
}

.description {
  color: #c5cfdb;
  line-height: 1.5;
  margin-bottom: 12px;
}

.description.collapsed {
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  display: -webkit-box;
  overflow: hidden;
}

.description-toggle {
  justify-self: start;
  margin: -2px 0 12px;
  min-height: 32px;
  padding: 0 10px;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.meta span {
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.86rem;
  padding: 7px 10px;
}

.meta .meta-time {
  border-color: rgba(98, 168, 255, 0.34);
  color: #b9d9ff;
}

.scale {
  padding-right: 8px;
}

.scale-track {
  background: linear-gradient(90deg, var(--accent), var(--yellow), var(--orange), var(--red));
  border-radius: 999px;
  height: 8px;
  position: relative;
}

.scale-limit,
.scale-price {
  background: white;
  border: 3px solid var(--bg);
  border-radius: 50%;
  height: 18px;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 18px;
}

.scale-limit {
  box-shadow: 0 0 0 4px rgba(255, 209, 102, 0.18);
}

.scale-price {
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(66, 211, 146, 0.18);
}

.scale-price.over-limit {
  background: var(--red);
  box-shadow: 0 0 0 4px rgba(255, 92, 117, 0.18);
}

.scale-labels {
  color: var(--muted);
  display: grid;
  font-size: 0.78rem;
  gap: 8px;
  grid-template-columns: repeat(4, 1fr);
  margin-top: 12px;
}

.scale-labels span:nth-child(2),
.scale-labels span:nth-child(3),
.scale-labels span:nth-child(4) {
  text-align: center;
}

.scale-labels span:last-child {
  text-align: right;
}

.offer-side {
  align-items: stretch;
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 10px;
  justify-content: center;
  padding-left: 18px;
}

.price {
  font-size: 2.2rem;
  line-height: 1;
}

.rating {
  border-radius: 8px;
  color: #091015;
  display: inline-flex;
  font-weight: 900;
  justify-content: center;
  padding: 9px 10px;
}

.rating-good {
  background: var(--accent);
}

.rating-limit {
  background: var(--yellow);
}

.rating-warn {
  background: var(--orange);
}

.rating-bad {
  background: var(--red);
  color: white;
}

.rating-unknown {
  background: #d4d9e2;
}

.actions {
  display: grid;
  gap: 8px;
}

.interesting {
  background: linear-gradient(180deg, #16a34a, #15803d);
  border-color: rgba(66, 211, 146, 0.45);
}

.ignore {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--line);
  color: #d7e3ef;
}

.empty-state {
  background: rgba(18, 23, 34, 0.92);
  border: 1px dashed #3a465a;
  border-radius: 8px;
  color: var(--muted);
  padding: 42px;
  text-align: center;
}

.empty-state h3 {
  color: var(--text);
}

.pagination {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  margin-top: 18px;
}

.pagination > span {
  color: var(--muted);
  font-weight: 800;
}

.pagination > div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.pagination button.active {
  background: rgba(66, 211, 146, 0.18);
  border-color: rgba(66, 211, 146, 0.48);
  color: #adffd4;
}

.install-shell {
  max-width: 1120px;
}

.install-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 16px;
}

.auth-panel {
  align-items: end;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin-bottom: 16px;
}

.install-panel {
  padding: 20px;
}

.panel-head {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 12px;
}

.status-pill {
  background: rgba(255, 209, 102, 0.13);
  border: 1px solid rgba(255, 209, 102, 0.38);
  border-radius: 999px;
  color: #ffe29a;
  font-weight: 800;
  padding: 7px 10px;
  white-space: nowrap;
}

.status-pill.ok {
  background: rgba(66, 211, 146, 0.12);
  border-color: rgba(66, 211, 146, 0.38);
  color: #9bf5c8;
}

.status-pill.warn {
  background: rgba(255, 159, 67, 0.12);
  border-color: rgba(255, 159, 67, 0.38);
  color: #ffd9aa;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.status-panel {
  margin-bottom: 16px;
}

.checks {
  display: grid;
  gap: 10px;
}

.check-row,
.config-list div,
.log-entry {
  align-items: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-columns: 190px 90px minmax(0, 1fr);
  padding: 12px;
}

.check-row strong {
  color: var(--orange);
}

.check-row.ok strong {
  color: var(--accent);
}

.check-row small {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.config-list {
  display: grid;
  gap: 10px;
}

.settings-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(180px, 260px) minmax(0, 1fr);
}

.settings-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.settings-status {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 800;
}

.settings-status.ok {
  color: var(--accent);
}

.settings-status.error {
  color: var(--red);
}

.settings-grid label {
  display: grid;
  gap: 7px;
}

.settings-grid span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.settings-grid input,
.settings-grid textarea {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  outline: none;
  padding: 10px 12px;
  width: 100%;
}

.settings-grid input {
  min-height: 42px;
}

.settings-grid textarea {
  min-height: 132px;
  resize: vertical;
}

.settings-grid small {
  color: var(--muted);
}

.config-list div {
  grid-template-columns: 190px minmax(0, 1fr);
}

.config-list span,
.log-entry span {
  color: var(--muted);
}

.config-list strong {
  overflow-wrap: anywhere;
}

.install-log {
  display: grid;
  gap: 10px;
  max-height: 360px;
  overflow: auto;
}

.log-entry {
  align-items: start;
  grid-template-columns: 180px 80px minmax(0, 1fr);
}

.log-entry p {
  color: #d7e3ef;
  margin: 0;
}

.log-entry.warn strong {
  color: var(--orange);
}

.log-entry.error strong {
  color: var(--red);
}

.danger-zone {
  align-items: center;
  border-color: rgba(255, 92, 117, 0.32);
  display: flex;
  gap: 20px;
  justify-content: space-between;
  padding: 20px;
}

.danger-zone p {
  color: var(--muted);
  margin-bottom: 0;
}

button.danger {
  background: linear-gradient(180deg, #e11d48, #be123c);
  border-color: rgba(255, 92, 117, 0.55);
}

.analytics-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.analytics-panel {
  background: rgba(18, 23, 34, 0.88);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.analytics-panel.wide {
  grid-column: 1 / -1;
}

.bar-list {
  display: grid;
  gap: 10px;
}

.bar-row {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: 130px minmax(0, 1fr) 48px;
}

.compact-bars .bar-row {
  grid-template-columns: 70px minmax(0, 1fr) 48px;
}

.bar-row span {
  color: #d7e3ef;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-row strong {
  text-align: right;
}

.bar-track {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  height: 12px;
  overflow: hidden;
}

.bar-track i {
  background: linear-gradient(90deg, var(--accent), var(--blue));
  border-radius: inherit;
  display: block;
  height: 100%;
}

.bar-row.zero .bar-track i {
  background: rgba(154, 167, 183, 0.5);
}

.map-panel .panel-head {
  margin-bottom: 10px;
}

.leaflet-map {
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  height: min(68vh, 620px);
  min-height: 520px;
  overflow: hidden;
}

.leaflet-container {
  background: #0d111a;
  color: #111827;
  font: inherit;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: #f8fbff;
  color: #111827;
}

.leaflet-popup-content {
  line-height: 1.45;
  margin: 10px 12px;
}

.muted {
  color: var(--muted);
}

@media (max-width: 920px) {
  .topbar,
  .toolbar,
  .auth-panel,
  .danger-zone {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions,
  .toolbar-controls {
    justify-content: flex-start;
  }

  .stats-grid,
  .filter-panel,
  .analytics-grid,
  .settings-grid,
  .install-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .offer-card {
    grid-template-columns: 150px minmax(0, 1fr);
  }

  .offer-side {
    border-left: 0;
    border-top: 1px solid var(--line);
    grid-column: 1 / -1;
    padding: 16px 0 0;
  }

  .actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .shell {
    width: calc(100% - 16px);
    padding-top: 14px;
  }

  h1 {
    font-size: 1.85rem;
  }

  .stats-grid,
  .filter-panel,
  .analytics-grid,
  .settings-grid,
  .install-grid {
    grid-template-columns: 1fr;
  }

  .analytics-panel.wide {
    grid-column: auto;
  }

  .bar-row,
  .compact-bars .bar-row {
    grid-template-columns: 1fr;
  }

  .leaflet-map {
    height: 420px;
    min-height: 380px;
  }

  .offer-card {
    grid-template-columns: 1fr;
  }

  .offer-title-row,
  .panel-head {
    flex-direction: column;
  }

  .offer-image {
    aspect-ratio: 16 / 10;
  }

  .actions {
    grid-template-columns: 1fr;
  }

  .check-row,
  .config-list div,
  .log-entry {
    grid-template-columns: 1fr;
  }
}
