:root {
  --blue: #1e5aa8;
  --blue-dark: #174785;
  --bg: #f4f6f9;
  --card: #ffffff;
  --text: #1a1d21;
  --muted: #5b6672;
  --border: #e1e6ec;
  --danger: #c0392b;
  --ok: #1e7a46;
  --warn: #9a6a00;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --blue: #7fa9e6; --blue-dark: #6f99d6; --bg: #121417; --card: #1b1f24;
    --text: #e8ebee; --muted: #9aa4af; --border: #2a2f36; --danger: #e57366;
    --ok: #5fcf8e; --warn: #e0b24d;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
#app { max-width: 640px; margin: 0 auto; min-height: 100%; }
.page { padding-bottom: 96px; }

.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 8px;
  background: var(--blue); color: #fff; padding: 14px 16px;
}
.topbar h1 { font-size: 1.15rem; margin: 0; flex: 1; }
.icon-btn {
  background: transparent; border: 0; color: inherit; font-size: 1.3rem;
  cursor: pointer; padding: 4px 8px; border-radius: 8px;
}
.topbar .icon-btn:hover { background: rgba(255,255,255,.15); }

.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; margin: 16px; display: flex; flex-direction: column; gap: 12px;
}
.card.center { align-items: center; text-align: center; }
.center { text-align: center; }
h2 { margin: 0; font-size: 1.3rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.accent { color: var(--blue); font-weight: 600; }
.ok { color: var(--ok); margin: 4px 0; }
.error { color: var(--danger); margin: 4px 0; }
.warn { color: var(--warn); font-weight: 600; margin: 4px 0 0; }
.big-emoji { font-size: 3rem; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span, .field-label { font-size: .85rem; color: var(--muted); font-weight: 600; }
input {
  width: 100%; font-size: 1rem; padding: 12px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
}
input:focus { outline: 2px solid var(--blue); border-color: var(--blue); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 1rem; padding: 12px 16px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--border); background: var(--card); color: var(--text);
  text-decoration: none; width: 100%;
}
.btn:hover { border-color: var(--blue); }
.btn:disabled { opacity: .6; cursor: default; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-dark); }
.btn.text { background: transparent; border: 0; color: var(--blue); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); }
.btn-row { display: flex; gap: 8px; }
.btn-row .btn { width: auto; flex: 1; }

.toolbar { padding: 12px 16px 4px; display: flex; flex-direction: column; gap: 10px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--border); background: var(--card); color: var(--text);
  padding: 7px 14px; border-radius: 999px; cursor: pointer; font-size: .9rem;
}
.chip.active { background: var(--blue); border-color: var(--blue); color: #fff; }

.list { display: flex; flex-direction: column; }
.count { color: var(--muted); font-size: .8rem; padding: 4px 16px; margin: 0; }
.row {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  border-bottom: 1px solid var(--border); cursor: pointer;
}
.row:hover { background: rgba(30,90,168,.05); }
.row-main { flex: 1; min-width: 0; }
.name { font-weight: 600; }
.type { color: var(--muted); font-size: .82rem; }
.value {
  font-weight: 600; white-space: nowrap; border: 0; background: transparent;
  color: var(--blue); font-size: 1rem; cursor: pointer; padding: 6px 8px; border-radius: 8px;
  text-decoration: none;
}
.value.call { background: rgba(30,90,168,.1); }

.fab {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--blue); color: #fff; border: 0; border-radius: 999px;
  padding: 14px 24px; font-size: 1rem; font-weight: 600; cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,.25);
}
.fab:hover { background: var(--blue-dark); }

.detail-name { font-size: 1.4rem; font-weight: 700; }
.detail-value { font-size: 2rem; font-weight: 700; letter-spacing: .5px; }
hr { border: 0; border-top: 1px solid var(--border); width: 100%; margin: 4px 0; }
.dupes { display: flex; flex-direction: column; gap: 2px; }
.dup { margin: 0; font-size: .9rem; }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; }
.switch-row input { width: auto; transform: scale(1.4); }

.toast {
  position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%) translateY(10px);
  background: #222; color: #fff; padding: 10px 18px; border-radius: 999px;
  opacity: 0; transition: all .25s; z-index: 20; font-size: .9rem; max-width: 90%;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.install-hint {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  background: var(--blue-dark); color: #fff; padding: 10px 16px;
  display: flex; align-items: center; justify-content: center; gap: 10px; font-size: .9rem;
}
