:root {
  --bg0: #07111f;
  --bg1: #0b1a2e;
  --card: rgba(10, 22, 38, 0.92);
  --line: #243447;
  --text: #e8eef6;
  --muted: #93a4b8;
  --accent: #1f8fff;
  --danger: #e11d48;
  --warn: #f5b942;
  --ok: #34d399;
  --radius: 14px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  font-family: "SF Pro Text", "Segoe UI", "Helvetica Neue", sans-serif;
  color: var(--text);
  background: var(--bg0);
  font-synthesis: none;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
  background:
    radial-gradient(120% 80% at 50% -10%, #16365a 0%, transparent 55%),
    linear-gradient(180deg, var(--bg1), var(--bg0) 40rem);
}

button, input, select { font: inherit; }

button {
  min-height: 48px;
  border: 0;
  border-radius: 12px;
  padding: 0.85rem 1.1rem;
  cursor: pointer;
  background: var(--accent);
  color: white;
  font-weight: 700;
  touch-action: manipulation;
}

button:hover { filter: brightness(1.06); }
button:disabled { opacity: 0.5; cursor: wait; }
button.secondary { background: #334155; }
button.danger { background: var(--danger); }

.shell {
  width: min(760px, calc(100% - 1.5rem));
  margin: 0 auto;
  padding: 1.5rem 0 2.5rem;
}

.hero { margin-bottom: 1.25rem; }
.brand {
  margin: 0 0 0.55rem;
  color: #7dd3fc;
  font-size: clamp(1.15rem, 4.5vw, 1.55rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}
h1 {
  margin: 0;
  font-size: clamp(1.55rem, 6vw, 2.45rem);
  line-height: 1.12;
  letter-spacing: -0.03em;
}
h2 { margin: 0 0 0.55rem; font-size: 1.2rem; }
h3 { margin: 0 0 0.4rem; }
.subtitle, .muted { color: var(--muted); line-height: 1.55; }

.steps {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.step-dot {
  font-size: 0.78rem;
  font-weight: 700;
  color: #64748b;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.65rem;
}
.step-dot.active {
  color: #e0f2fe;
  border-color: #0284c7;
  background: rgba(2, 132, 199, 0.25);
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem;
  margin-bottom: 1rem;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}

.stack { display: grid; gap: 0.95rem; margin-top: 1.1rem; }
label { display: grid; gap: 0.4rem; color: #cbd5e1; font-weight: 650; }
input, select {
  width: 100%;
  min-height: 48px;
  padding: 0.8rem 0.85rem;
  border-radius: 12px;
  border: 1px solid #334155;
  background: #07111f;
  color: var(--text);
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  font-weight: 500;
}
.checkbox-row input {
  width: 1.2rem;
  height: 1.2rem;
  min-height: 1.2rem;
  margin-top: 0.15rem;
  flex: 0 0 auto;
}

.account-row,
.toolbar,
.delete-bar,
.button-row,
.selection-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.toolbar { margin: 1.1rem 0; align-items: end; }
.toolbar label { max-width: 280px; width: 100%; }
.selection-toolbar { margin: 0.85rem 0; }

.status { min-height: 1.45rem; margin: 0.75rem 0; color: #93c5fd; }
.status.error { color: #fca5a5; }

.results {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  max-height: min(55vh, 28rem);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.results.empty { padding: 1rem; color: #64748b; }
.result-row {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.result-row:last-child { border-bottom: 0; }
.result-row input {
  width: 1.25rem;
  height: 1.25rem;
  min-height: 1.25rem;
  margin-top: 0.2rem;
}
.result-text { display: grid; gap: 0.15rem; min-width: 0; }
.result-name { font-weight: 700; word-break: break-word; }
.result-meta { color: #64748b; font-size: 0.85rem; }

.delete-bar {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid #7f1d1d;
  border-radius: 12px;
  background: rgba(127, 29, 29, 0.14);
}

progress {
  width: 100%;
  height: 0.85rem;
  margin: 0.75rem 0;
}

.complete-summary { font-size: 1.05rem; line-height: 1.5; }
.failure-list {
  margin: 0.75rem 0 1rem;
  padding-left: 1.15rem;
  color: #fecaca;
}
.privacy-list {
  margin: 0.5rem 0 1rem;
  padding-left: 1.15rem;
  color: var(--muted);
  line-height: 1.55;
}
.privacy-list li { margin-bottom: 0.45rem; }

.hidden { display: none !important; }
.warning { color: var(--warn); }
details { margin-top: 1rem; color: #cbd5e1; }
summary { cursor: pointer; font-weight: 700; min-height: 44px; display: flex; align-items: center; }
code { color: #bfdbfe; }
a { color: #7dd3fc; }
.footnote { margin-top: 1rem; font-size: 0.9rem; }

footer {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  color: #64748b;
  font-size: 0.9rem;
  padding: 1rem 0 0.5rem;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.72);
  display: grid;
  place-items: end center;
  padding: 1rem;
  padding-bottom: calc(1rem + var(--safe-bottom));
  z-index: 40;
}
.modal-card {
  width: min(520px, 100%);
  background: #0f172a;
  border: 1px solid var(--line);
  border-radius: 16px 16px 12px 12px;
  padding: 1.1rem;
  display: grid;
  gap: 0.85rem;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.45);
}

@media (min-width: 720px) {
  .modal-overlay { place-items: center; }
  .modal-card { border-radius: 16px; }
}

@media (max-width: 700px) {
  .account-row, .toolbar, .delete-bar { align-items: stretch; flex-direction: column; }
  .toolbar label { max-width: none; }
  .button-row, .selection-toolbar { flex-direction: column; align-items: stretch; }
  .shell { padding-top: 1rem; }
}
