* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1b1f24;
  --muted: #5c6570;
  --border: #d9dde2;
  --accent: #1667d6;
  --accent-soft: #e4efff;
  --hit: #fff6d6;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171c;
    --card: #1e232b;
    --text: #e7eaee;
    --muted: #9aa4b0;
    --border: #333b45;
    --accent: #5b9bff;
    --accent-soft: #23324a;
    --hit: #4a4222;
  }
}

body {
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  padding: 1rem;
  max-width: 760px;
  margin: 0 auto;
  -webkit-text-size-adjust: 100%;
}

header { padding: 0.5rem 0 1rem; }
h1 { font-size: 1.4rem; }
.sub { color: var(--muted); font-size: 0.92rem; margin-top: 0.25rem; }

.searchbox { position: relative; margin-bottom: 0.75rem; }

#q {
  width: 100%;
  font-size: 1.15rem;
  padding: 0.85rem 2.6rem 0.85rem 1rem;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  color: var(--text);
}
#q:focus { outline: none; border-color: var(--accent); }

#clear {
  position: absolute;
  right: 0.4rem;
  top: 50%;
  transform: translateY(-50%);
  width: 2rem;
  height: 2rem;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 1.5rem;
  cursor: pointer;
  display: none;
}
#clear.show { display: block; }

.status { color: var(--muted); font-size: 0.9rem; min-height: 1.2rem; margin-bottom: 0.5rem; }

.results { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; }

.entry {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
}
.entry.hit { border-color: var(--accent); }

.entry .addr { font-weight: 600; font-size: 1.05rem; }

.phones { display: flex; flex-direction: column; gap: 0.15rem; margin-top: 0.35rem; }

.phone {
  font-variant-numeric: tabular-nums;
  font-size: 1.1rem;
  letter-spacing: 0.02em;
}
.phone a { color: var(--accent); text-decoration: none; }
.phone mark { background: var(--hit); color: inherit; padding: 0 2px; border-radius: 3px; }

.tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.08rem 0.4rem;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  vertical-align: 0.1em;
  margin-left: 0.35rem;
}
.tag.warn { background: transparent; color: var(--muted); border: 1px solid var(--border); }

.note { color: var(--muted); font-size: 0.85rem; margin-left: 0.35rem; }
.entry .note-line { color: var(--muted); font-size: 0.85rem; margin-top: 0.3rem; }

footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
}
#toggle-all {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
}
#toggle-all:hover { border-color: var(--accent); }

mark.addrhit { background: var(--hit); color: inherit; border-radius: 3px; }
