:root {
  --blue: #4375ed;
  --mauve: #c485b1;
  --panel: #ffffff;
  --ink: #1b2333;
  --muted: #6b7585;
  --line: #e7eaf0;
  --shadow: 0 6px 24px rgba(20, 30, 60, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  color: var(--ink);
  background: #f1f4f9;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 28px;
  background: linear-gradient(120deg, #1b2440, #2a3a6e);
  color: #fff;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand .logo {
  width: 46px; height: 46px; border-radius: 12px;
  background: linear-gradient(135deg, var(--blue), var(--mauve));
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 18px; color: #fff; letter-spacing: 0.5px;
}
.topbar h1 { margin: 0; font-size: 22px; }
.topbar .sub { margin: 2px 0 0; font-size: 13px; opacity: 0.82; }
.badge {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 5px 12px; border-radius: 999px; font-size: 12px; white-space: nowrap;
}

main { max-width: 1100px; margin: 24px auto; padding: 0 20px 80px; }

.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; padding: 22px; box-shadow: var(--shadow);
}

.row { display: flex; gap: 16px; }
.row > label { flex: 1; }

label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
label.block { display: block; }
input, select, textarea {
  font: inherit; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 10px; color: var(--ink); background: #fff; width: 100%;
}
textarea { resize: vertical; }

.filters { margin: 18px 0; border-top: 1px solid var(--line); padding-top: 14px; }
.filters summary { cursor: pointer; font-weight: 700; color: var(--ink); }
.filter-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px 16px; margin-top: 14px; align-items: start; }
.filter-grid > label { grid-column: span 2; }
.filter-grid > label.wide { grid-column: span 4; }
@media (max-width: 760px) { .filter-grid { grid-template-columns: repeat(2, 1fr); } .filter-grid > label, .filter-grid > label.wide { grid-column: span 2; } }

.range { display: flex; align-items: center; gap: 8px; }
.range input { text-align: center; padding: 10px 8px; }
.range .dash { color: var(--muted); font-weight: 700; }

.stars { display: flex; flex-wrap: wrap; gap: 10px 18px; padding: 11px 2px 2px; }
.stars .cb { flex-direction: row; align-items: center; gap: 6px; font-weight: 600; color: var(--ink); cursor: pointer; font-size: 13px; white-space: nowrap; }
.stars .cb input { width: auto; margin: 0; }

button, .btn {
  cursor: pointer; font: inherit; font-weight: 700; border: none;
  border-radius: 10px; padding: 12px 20px; text-decoration: none; display: inline-block; text-align: center;
}
button.primary, .primary.btn { background: linear-gradient(90deg, var(--blue), var(--mauve)); color: #fff; }
button.primary:hover { filter: brightness(1.05); }
button.ghost, .ghost.btn { background: #fff; border: 1px solid var(--line); color: var(--ink); }
button.gen { background: linear-gradient(90deg, var(--blue), var(--mauve)); color: #fff; width: 100%; margin-top: 12px; }
.wa.btn { background: #25d366; color: #fff; }
.wa.btn:hover { background: #1eb955; }

.settings summary { cursor: pointer; font-weight: 700; color: var(--ink); }
.settings .muted { font-weight: 400; }
.settings-grid { margin-top: 14px; display: flex; flex-direction: column; gap: 14px; }
.settings-grid code { background: #eef1f6; padding: 1px 5px; border-radius: 4px; font-size: 12px; color: var(--blue); }
.cta-row { display: flex; gap: 14px; flex-wrap: wrap; }
.cta-row > label { flex: 1; min-width: 200px; }

.actions-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.results-pick { flex-direction: row; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; color: var(--muted); }
.results-pick select { width: auto; padding: 8px 10px; }
.loginbar { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.loginbar .lock { font-size: 16px; }
.loginbar input { width: 130px; padding: 8px 10px; font-size: 13px; }
.loginbar button { padding: 9px 16px; }
.loginok { margin-left: auto; display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--good, #16a34a); }
.linkbtn { background: none; border: none; color: var(--muted); text-decoration: underline; cursor: pointer; font-weight: 600; padding: 0; }
.login-msg { margin: 10px 4px 0; font-size: 13px; font-weight: 600; }
.login-msg.err { color: #b91c1c; }
.login-msg.ok { color: #047857; }

.summary { margin: 20px 4px 8px; font-weight: 600; color: var(--muted); }
.results { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }

.card {
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  padding: 18px; box-shadow: var(--shadow); display: flex; flex-direction: column;
}
.card h3 { margin: 0 0 4px; font-size: 18px; }
.card .cat { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.card .meta { font-size: 14px; line-height: 1.7; }
.card .meta a { color: var(--blue); text-decoration: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 4px; }
.chip { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.chip.no-site { background: #fef2f2; color: #b91c1c; }
.chip.site { background: #ecfdf5; color: #047857; }
.chip.phone { background: #eef3ff; color: #2a4fbf; }
.chip.email { background: #f6eefb; color: #8b3fa8; }
.chip.rating { background: #fffbeb; color: #b45309; }

.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 14px; }
.hint { color: var(--muted); font-size: 12.5px; margin: 12px 0 0; }

.modal {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.55);
  display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50;
}
.modal-card { background: #fff; border-radius: 16px; padding: 24px; width: 520px; max-width: 100%; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3); }
.modal-card.wide { width: 880px; max-height: 92vh; overflow: auto; }
.modal-card h2 { margin: 0 0 6px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.preview-head { display: flex; align-items: center; justify-content: space-between; }
.preview-body { margin-top: 14px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #0b1322; min-height: 200px; }
.preview-body img { display: block; width: 100%; height: auto; }
.warn { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; padding: 10px 14px; border-radius: 10px; margin-top: 12px; font-size: 14px; }
.links { margin-top: 16px; }
.copyrow { display: flex; gap: 8px; }
.copyrow input { font-size: 13px; }

.spinner {
  width: 22px; height: 22px; border: 3px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff; border-radius: 50%; display: inline-block;
  animation: spin 0.8s linear infinite; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; color: #9fb0c7; padding: 48px 20px; }
