:root {
  --bg: #f6f7f9; --card: #ffffff; --text: #16181d; --muted: #6a7280;
  --accent: #2563eb; --accent-text: #ffffff; --border: #d9dde4; --error: #b42318; --ok: #067647;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115; --card: #181b21; --text: #eceef2; --muted: #98a1b0;
    --accent: #5b8def; --accent-text: #0b0d11; --border: #2b303a; --error: #ff8a80; --ok: #6ee7b7;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  display: flex; justify-content: center; padding: 48px 16px;
}
main { width: 100%; max-width: 560px; }
h1 { font-size: 1.6rem; margin: 0 0 24px; }
section { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 20px; }
form { display: flex; gap: 8px; flex-wrap: wrap; }
input[type=url], input[type=password] {
  flex: 1 1 220px; min-width: 0; padding: 12px 14px; font: inherit; color: inherit;
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
}
input:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button, .button {
  padding: 12px 18px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  color: var(--accent-text); background: var(--accent); border: 0; border-radius: 8px; display: inline-block;
}
button:disabled { opacity: .55; cursor: default; }
button.link { background: none; color: var(--muted); padding: 8px 0; font-weight: 400; text-decoration: underline; margin-top: 16px; }
.notice { margin-top: 16px; padding: 14px; border: 1px solid var(--border); border-radius: 8px; }
.notice p { margin: 0 0 8px; }
.notice label { display: block; margin-bottom: 10px; }
#status { margin-top: 20px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
#status p { margin: 0; }
#status.error p { color: var(--error); }
#status.done p { color: var(--ok); }
.spinner {
  width: 22px; height: 22px; border: 3px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }
.hint { color: var(--muted); margin: 0 0 12px; }
.hint.small { font-size: .85rem; margin-top: 20px; }
.history { margin-top: 24px; padding: 0; background: none; border: 0; }
.history h2 { font-size: 1rem; margin: 0 0 8px; color: var(--muted); font-weight: 600; }
.history ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.history li {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center;
  padding: 10px 12px; background: var(--card); border: 1px solid var(--border); border-radius: 8px;
}
.history .site { font-weight: 600; }
.history .meta { grid-column: 1; color: var(--muted); font-size: .85rem; overflow-wrap: anywhere; }
.history .actions { grid-column: 2; grid-row: 1 / span 2; display: flex; gap: 6px; }
.history .actions a, .history .actions button {
  padding: 6px 10px; font-size: .85rem; border-radius: 6px; font-weight: 600; cursor: pointer; text-decoration: none;
  color: var(--accent); background: transparent; border: 1px solid var(--accent);
}
.history .actions a.primary { color: var(--accent-text); background: var(--accent); }
.history .bad { color: var(--error); }
[hidden] { display: none !important; }
