:root {
  --bg: #0f1115;
  --surface: #161922;
  --surface-2: #1d212c;
  --border: #2a2f3a;
  --text: #e8eaed;
  --text-muted: #8b92a3;
  --accent: #4d9fff;
  --accent-dim: #2d5a96;
  --success: #3ecf8e;
  --success-bg: rgba(62, 207, 142, 0.12);
  --danger: #ff6b6b;
  --danger-bg: rgba(255, 107, 107, 0.12);
  --warning: #ffb454;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(15, 17, 21, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-icon { font-size: 28px; }
.brand h1 { font-size: 17px; font-weight: 600; margin: 0; }
.subtitle { font-size: 12.5px; color: var(--text-muted); margin: 2px 0 0; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 100px;
  border: none;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { opacity: 0.9; }
.btn-primary.subscribed { background: var(--success-bg); color: var(--success); border: 1px solid var(--success); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 10px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 14px;
}
.btn-ghost:hover { color: var(--text); border-color: var(--accent-dim); }

.container { max-width: 760px; margin: 0 auto; padding: 20px; }

.status-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 16px;
  font-size: 13px;
}
.status-item { display: flex; align-items: center; gap: 6px; }
.status-item.muted { color: var(--text-muted); margin-left: auto; }

.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}
.status-dot.ok { background: var(--success); box-shadow: 0 0 0 3px var(--success-bg); }
.status-dot.error { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-bg); }
.status-dot.loading { background: var(--warning); animation: pulse 1.2s infinite; }

@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

.error-banner {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
}

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}
.empty-state p { margin: 4px 0; }
.empty-state p:first-child { color: var(--text); font-size: 15px; }

.store-list { display: flex; flex-direction: column; gap: 10px; }

.store-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  animation: fadeIn .3s ease;
}

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

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

.store-name { font-size: 15px; font-weight: 600; margin: 0 0 2px; }
.store-tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  margin-right: 6px;
}
.store-address { font-size: 12.5px; color: var(--text-muted); margin: 0; }

.store-distance { text-align: right; flex-shrink: 0; margin-left: 14px; }
.distance-val { font-size: 14px; font-weight: 600; }
.distance-bar {
  width: 60px; height: 3px; border-radius: 2px;
  background: var(--surface-2); margin-top: 5px; overflow: hidden;
}
.distance-fill { height: 100%; background: var(--accent); border-radius: 2px; }

.article-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  border-top: 1px solid var(--border);
  font-size: 13.5px;
}
.article-name { color: var(--text); }
.article-price { color: var(--text-muted); font-size: 12px; margin-left: 8px; }
.stock-badge {
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 100px;
  background: var(--success-bg);
  color: var(--success);
}

.article-link {
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  margin-left: 10px;
}
.article-link:hover { text-decoration: underline; }

.footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  padding: 30px 20px 50px;
}

@media (max-width: 480px) {
  .topbar-inner { flex-direction: column; align-items: stretch; }
  .btn { justify-content: center; }
}
