/* ── Base ─────────────────────────────────────────────────────────────────── */
:root {
  color-scheme: dark;
}
* {
  box-sizing: border-box;
}
body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  margin: 0;
  padding: 0;
  background: #020617;
  color: #e5e7eb;
}
.page {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
  width: 100%;
}
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding: 0.75rem 1rem;
  background: linear-gradient(90deg, rgba(56,189,248,0.08), rgba(34,197,94,0.08));
  border: 1px solid #1f2937;
  border-radius: 0.75rem;
  gap: 0.75rem;
  flex-wrap: wrap;
}
header h1 {
  font-size: 1.15rem;
  margin: 0.1rem 0 0 0;
  color: #dbeafe;
  font-weight: 600;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.brand-name {
  font-size: 1rem;
  font-weight: 700;
  color: #ecfeff;
  letter-spacing: 0.01em;
}
.brand-mark {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  border: 1px solid #1f2937;
  background: rgba(255,255,255,0.03);
  box-shadow: 0 10px 20px rgba(2, 6, 23, 0.35);
  flex: 0 0 auto;
}
nav {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
}
nav a {
  text-decoration: none;
  color: #e5e7eb;
  font-size: 0.95rem;
  cursor: pointer;
  display: inline-block;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(255,255,255,0.04);
  border: 1px solid transparent;
}
nav a:hover {
  color: #38bdf8;
  border-color: #1f2937;
}
.btn-outline {
  border: 1px solid #22d3ee;
  color: #cffafe;
  background: rgba(34, 211, 238, 0.08);
}
.btn-outline:hover {
  color: #ecfeff;
  border-color: #67e8f9;
  background: rgba(103, 232, 249, 0.14);
}
.signed-in {
  font-size: 0.8rem;
  color: #9ca3af;
  margin-top: 0.25rem;
}
main {
  margin-top: 1rem;
}
a {
  color: #38bdf8;
}
.card {
  background: #020617;
  border-radius: 0.75rem;
  border: 1px solid #1f2937;
  padding: 1rem 1.25rem;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.5);
}
.form-card {
  max-width: 760px;
  margin: 0 auto;
}
.form-card form {
  max-width: 720px;
}
label {
  display: block;
  margin-top: 1rem;
  font-size: 0.95rem;
}
input:not([type="checkbox"]):not([type="radio"]), select {
  width: 100%;
  padding: 0.5rem;
  margin-top: 0.25rem;
  border-radius: 0.375rem;
  border: 1px solid #4b5563;
  background: #020617;
  color: #e5e7eb;
}
input[type="checkbox"], input[type="radio"] {
  width: auto;
  margin-top: 0;
  accent-color: #22c55e;
}
button {
  margin-top: 1.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  border: none;
  background: #22c55e;
  color: #022c22;
  font-weight: 600;
  cursor: pointer;
}
button:hover {
  background: #16a34a;
}
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  background: #020617;
  font-size: 0.9rem;
}
th, td {
  border: 1px solid #1f2937;
  padding: 0.4rem 0.6rem;
  vertical-align: top;
}
th {
  background: #111827;
  text-align: left;
}
tr:nth-child(even) td {
  background: #020617;
}
.muted {
  color: #9ca3af;
  font-size: 0.85rem;
}
.stats {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.stat {
  flex: 0 0 140px;
  padding: 0.6rem 0.8rem;
  border-radius: 0.75rem;
  border: 1px solid #1f2937;
  background: #020617;
}
.stat .label {
  font-size: 0.75rem;
  color: #9ca3af;
}
.stat .value {
  font-size: 1.2rem;
  font-weight: 600;
}
footer {
  margin-top: 2.5rem;
  padding: 1.5rem 0;
  border-top: 1px solid #1f2937;
  font-size: 0.95rem;
  color: #e5e7eb;
  background: linear-gradient(90deg, rgba(56,189,248,0.08), rgba(34,197,94,0.08));
  border-radius: 0.75rem;
  width: 100%;
  text-align: center;
}
footer a {
  color: #38bdf8;
  text-decoration: none;
  font-weight: 600;
}
footer a:hover {
  color: #22d3ee;
}
.table-wrap {
  width: 100%;
  overflow-x: auto;
}
@media (max-width: 640px) {
  body {
    font-size: 16px;
  }
  .page {
    max-width: 100%;
    padding: 1rem 0.75rem 2rem;
  }
  header {
    flex-direction: column;
    align-items: flex-start;
  }
  header h1 {
    font-size: 1.02rem;
  }
  .brand-mark {
    width: 48px;
    height: 48px;
  }
  .brand-name {
    font-size: 0.95rem;
  }
  nav a {
    font-size: 0.95rem;
    padding: 6px 10px;
  }
  .stats {
    gap: 0.5rem;
  }
  .stat {
    flex: 1 1 45%;
  }
  label {
    font-size: 1rem;
  }
  input:not([type="checkbox"]):not([type="radio"]), select {
    font-size: 1rem;
    padding: 0.65rem;
  }
  table {
    font-size: 0.9rem;
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
  button {
    width: 100%;
    font-size: 1rem;
    padding: 0.85rem 1rem;
  }
}

/* ── Landing page ─────────────────────────────────────────────────────────── */
.landing-root {
  --accent-a: #22d3ee;
  --accent-b: #34d399;
  --ink: #e6edf8;
  --ink-dim: #9fb0c9;
  --panel: rgba(7, 16, 34, 0.82);
  --stroke: rgba(148, 163, 184, 0.22);
  position: relative;
  overflow: hidden;
  border-radius: 16px;
}
.landing-root::before,
.landing-root::after {
  content: "";
  position: absolute;
  pointer-events: none;
  z-index: 0;
  filter: blur(3px);
}
.landing-root::before {
  width: 380px;
  height: 380px;
  right: -140px;
  top: -120px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.28) 0%, rgba(34, 211, 238, 0) 65%);
}
.landing-root::after {
  width: 320px;
  height: 320px;
  left: -120px;
  bottom: -140px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(52, 211, 153, 0.22) 0%, rgba(52, 211, 153, 0) 68%);
}
.landing-layer {
  position: relative;
  z-index: 1;
}
.reveal {
  opacity: 0;
  transform: translateY(12px);
  animation: fadeUp .65s ease forwards;
}
.d1 { animation-delay: .08s; }
.d2 { animation-delay: .18s; }
.d3 { animation-delay: .28s; }
.d4 { animation-delay: .38s; }
@keyframes fadeUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.hero-shell {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 1rem;
}
.hero-main {
  border: 1px solid var(--stroke);
  border-radius: 16px;
  padding: 1.35rem;
  background:
    linear-gradient(130deg, rgba(34,211,238,0.14), rgba(7,16,34,0.08) 40%),
    linear-gradient(130deg, rgba(52,211,153,0.14), rgba(7,16,34,0.1) 62%),
    var(--panel);
}
.hero-badge {
  display: inline-block;
  border: 1px solid rgba(34,211,238,0.45);
  color: #b5f7ff;
  background: rgba(34,211,238,0.12);
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.hero-main h2 {
  margin: 0.85rem 0 0.75rem 0;
  color: var(--ink);
  font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
  font-size: clamp(1.7rem, 3.5vw, 2.45rem);
  line-height: 1.1;
}
.hero-main p {
  margin: 0;
  color: var(--ink-dim);
  max-width: 58ch;
  font-size: 1.02rem;
}
.hero-actions {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin-top: 1.1rem;
}
.hero-btn {
  text-decoration: none;
  border-radius: 11px;
  padding: 0.68rem 1rem;
  font-weight: 700;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}
.hero-btn:hover {
  transform: translateY(-1px);
}
.hero-btn.primary {
  background: linear-gradient(90deg, #22d3ee, #34d399);
  color: #042f2e;
  box-shadow: 0 10px 25px rgba(20, 184, 166, 0.28);
}
.hero-btn.secondary {
  border: 1px solid rgba(148,163,184,0.34);
  color: #d9e7ff;
  background: rgba(15, 23, 42, 0.54);
}
.stat-strip {
  margin-top: 1.15rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
}
.stat-chip {
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 0.62rem 0.7rem;
  background: rgba(2, 6, 23, 0.5);
}
.stat-chip .v {
  font-size: 1.1rem;
  font-weight: 700;
  color: #def7ff;
}
.stat-chip .k {
  margin-top: 0.12rem;
  font-size: 0.78rem;
  color: #95a7c5;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.hero-side {
  border: 1px solid var(--stroke);
  border-radius: 16px;
  padding: 1rem;
  background: linear-gradient(180deg, rgba(15,23,42,0.92), rgba(2,6,23,0.86));
}
.hero-side h3 {
  margin: 0 0 0.65rem 0;
  color: #d7f6ff;
  font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
}
.pulse {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.45rem;
}
.pulse-row {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 0.55rem;
  align-items: center;
}
.pulse-row .lbl {
  color: #8ba2c8;
  font-size: 0.78rem;
}
.bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(148,163,184,0.18);
  overflow: hidden;
}
.bar > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #22d3ee, #34d399);
}
.feature-grid {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
}
.feature-card {
  border: 1px solid var(--stroke);
  border-radius: 14px;
  padding: 0.9rem;
  background: rgba(6, 14, 30, 0.74);
}
.feature-card h4 {
  margin: 0 0 0.35rem 0;
  color: #e8f3ff;
  font-size: 1.02rem;
}
.feature-card p {
  margin: 0;
  color: #93a7c7;
  font-size: 0.92rem;
}
.promise {
  margin-top: 1rem;
  border: 1px solid rgba(34, 211, 238, 0.28);
  border-radius: 16px;
  padding: 1rem;
  text-align: center;
  background: linear-gradient(90deg, rgba(34,211,238,0.12), rgba(52,211,153,0.11));
}
.promise h3 {
  margin: 0 0 0.35rem 0;
  color: #ebfdff;
  font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
}
.promise p {
  margin: 0;
  color: #b7c8df;
}
.promise .hero-actions {
  justify-content: center;
}
@media (max-width: 860px) {
  .hero-shell {
    grid-template-columns: 1fr;
  }
  .feature-grid {
    grid-template-columns: 1fr;
  }
  .stat-strip {
    grid-template-columns: 1fr;
  }
}

/* ── Location autocomplete ─────────────────────────────────────────────────── */
.ac-wrap { position: relative; width: 100%; }
.ac-wrap input { width: 100%; }
.ac-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 200;
  list-style: none;
  margin: 2px 0 0;
  padding: 0;
  background: #111827;
  border: 1px solid #374151;
  border-radius: 0.375rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
  max-height: 200px;
  overflow-y: auto;
}
.ac-dropdown li {
  padding: 0.42rem 0.6rem;
  font-size: 0.88rem;
  cursor: pointer;
  color: #e5e7eb;
}
.ac-dropdown li:hover,
.ac-dropdown li.ac-active {
  background: #1f2937;
  color: #38bdf8;
}

/* ── Form validation states ───────────────────────────────────────────────── */
.invalid-field { outline: 2px solid #f87171; }
.invalid-msg   { color: #f87171; font-size: 0.85rem; min-height: 0.9rem; }

/* ── Utility: spacing ─────────────────────────────────────────────────────── */
.mt-0    { margin-top: 0; }
.mt-half { margin-top: 0.5rem; }
.mt-075  { margin-top: 0.75rem; }
.mt-1    { margin-top: 1rem; }
.mt-15   { margin-top: 1.5rem; }
.mb-025  { margin-bottom: 0.25rem; }
.mb-half { margin-bottom: 0.5rem; }
.mb-1    { margin-bottom: 1rem; }
.ml-1    { margin-left: 1rem; }

/* ── Utility: text ────────────────────────────────────────────────────────── */
.text-error  { color: #f97373; }
.text-danger { color: #f87171; }

/* ── Utility: layout ──────────────────────────────────────────────────────── */
.btn-row         { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.75rem; }
.flex-row-gap-1  { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.filter-form     { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: end; margin: 0.75rem 0 1rem 0; }
.min-w-220       { min-width: 220px; }
.checkbox-label  { display: flex; align-items: center; gap: 0.4rem; margin-top: 0.5rem; }
.muted-note      { margin-top: 0.85rem; color: #9ab0cf; font-size: 0.92rem; }

/* ── Nav icon alignment ───────────────────────────────────────────────────── */
.nav-icon-alert  { vertical-align: -4px; margin-right: 8px; color: #fbbf24; }
.nav-icon-logout { vertical-align: -3px; margin-right: 8px; color: #38bdf8; }
.nav-icon-login  { vertical-align: -2px; margin-right: 6px; }
.nav-tab-active  { font-weight: 700; }

/* ── Small contextual buttons (inside inline forms) ──────────────────────── */
.btn-sm        { border: none; padding: 0.5rem 0.75rem; border-radius: 6px; cursor: pointer; }
.btn-sm-green  { background: #22c55e; color: #022c22; }
.btn-sm-red    { background: #f87171; color: #111827; }
.btn-sm-yellow { background: #fbbf24; color: #111827; }

/* ── Bar fill values (landing page stat bars) ─────────────────────────────── */
.bar-fill-94 { width: 94%; }
.bar-fill-91 { width: 91%; }
.bar-fill-88 { width: 88%; }

/* ── Utility ──────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Preference rows ──────────────────────────────────────────────────────── */
.pref-row      { display: flex; align-items: center; gap: 0.5em; flex-wrap: wrap; margin-top: 0.25rem; }
.pref-label    { font-size: 0.85rem; color: #9ca3af; min-width: 80px; }
.tag           { display: inline-block; background: rgba(34,211,238,0.12); border: 1px solid rgba(34,211,238,0.3); color: #a5f3fc; border-radius: 6px; padding: 0.1em 0.5em; font-size: 0.85rem; }
.mt-025        { margin-top: 0.25rem; }
.mt-05         { margin-top: 0.5rem; }

/* ── Telegram section ─────────────────────────────────────────────────────── */
.tg-row        { display: flex; align-items: center; gap: 0.6em; flex-wrap: wrap; }
.tg-row form   { margin: 0; }
.tg-row input  { flex: 1; min-width: 160px; }
.tg-hint       { font-size: 0.85em; margin: 0.4em 0 0.6em; }

/* My Alerts page: external CSS (CSP blocks inline <style>) */
.ja-shell {
  background: linear-gradient(180deg, #0b1220, #020617);
  border: 1px solid #1f2937;
  border-radius: 14px;
  padding: 1.1rem 1.25rem 1.25rem;
  box-shadow: 0 12px 36px rgba(2, 6, 23, 0.55);
}
.ja-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
}
.ja-head h2 {
  margin: 0;
  font-size: 1.15rem;
  color: #e6edf8;
}
.ja-count {
  font-size: 0.82rem;
  color: #9ca3af;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.25);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
}
.ja-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 10px;
  border: 1px solid #1f2937;
}
table.ja-table {
  width: 100%;
  margin-top: 0;
  border-collapse: separate;
  border-spacing: 0;
  background: #020617;
  font-size: 0.9rem;
  table-layout: fixed;
}
.ja-table colgroup col.c-id { width: 70px; }
.ja-table colgroup col.c-title { width: 250px; }
.ja-table colgroup col.c-loc { width: 160px; }
.ja-table colgroup col.c-type { width: 100px; }
.ja-table colgroup col.c-dur { width: 110px; }
.ja-table colgroup col.c-seen { width: 150px; }
.ja-table colgroup col.c-link { width: 84px; }
.ja-table thead th {
  background: linear-gradient(180deg, #111827, #0b1220);
  color: #cbd5e1;
  font-weight: 600;
  text-align: left;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid #1f2937;
  border-left: 0;
  border-right: 0;
  border-top: 0;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}
.ja-table tbody td {
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid #111827;
  border-left: 0;
  border-right: 0;
  border-top: 0;
  vertical-align: middle;
  color: #e5e7eb;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ja-table tbody tr:last-child td { border-bottom: 0; }
.ja-table tbody tr:hover td { background: rgba(56, 189, 248, 0.05); }
.ja-id {
  font-family: ui-monospace, monospace;
  font-size: 0.8rem;
  color: #94a3b8;
}
.ja-title a {
  color: #38bdf8;
  text-decoration: none;
  font-weight: 600;
}
.ja-title a:hover {
  color: #7dd3fc;
  text-decoration: underline;
}
.ja-loc, .ja-type, .ja-dur { color: #cbd5e1; }
.ja-seen {
  color: #94a3b8;
  font-size: 0.8rem;
}
.ja-btn {
  display: inline-block;
  background: linear-gradient(90deg, #22d3ee, #34d399);
  color: #042f2e;
  font-weight: 700;
  font-size: 0.78rem;
  padding: 0.32rem 0.7rem;
  border-radius: 6px;
  text-decoration: none;
}
.ja-btn:hover { filter: brightness(1.1); }
@media (max-width: 768px) {
  .ja-shell { padding: 0.85rem; }
  .ja-table { font-size: 0.82rem; }
  .ja-table thead th { padding: 0.5rem 0.55rem; font-size: 0.68rem; }
  .ja-table tbody td { padding: 0.5rem 0.55rem; }
}
@media (max-width: 480px) {
  .ja-shell { padding: 0.7rem; }
  .ja-head h2 { font-size: 1rem; }
  .ja-table { font-size: 0.78rem; }
  .ja-table thead th { padding: 0.4rem 0.45rem; font-size: 0.64rem; }
  .ja-table tbody td { padding: 0.4rem 0.45rem; }
  .ja-btn { padding: 0.28rem 0.55rem; font-size: 0.72rem; }
}
