:root {
  --bg: #eef1f4;
  --card: #ffffff;
  --text: #1d232b;
  --muted: #5d6875;
  --line: #d8dee5;
  --head: #2b3440;
  --accent: #c0392b;
  --accent-dark: #a02f23;
  --ok: #2e7d32;
  --err: #c62828;
  --chip: #e6ebf0;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14181d;
    --card: #1e242b;
    --text: #e7ebef;
    --muted: #98a3ae;
    --line: #333c46;
    --head: #0f1317;
    --chip: #2a323b;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 17px;
  -webkit-text-size-adjust: 100%;
}
header {
  background: var(--head);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  position: sticky; top: 0; z-index: 5;
}
header h1 { font-size: 20px; margin: 0; }
.header-buttons { display: flex; gap: 8px; }
header .ghost { color: #fff; border-color: rgba(255,255,255,.35); }

main { max-width: 640px; margin: 0 auto; padding: 12px 12px 40px; }
.card {
  background: var(--card);
  border-radius: 14px;
  padding: 14px 16px 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
}
.card h2 { font-size: 17px; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.step {
  display: inline-grid; place-items: center;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 14px;
}

input[type=text], input[type=password], input[type=url] {
  width: 100%;
  font-size: 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
}
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

button, .big-btn {
  font: inherit;
  cursor: pointer;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--chip);
  color: var(--text);
  padding: 8px 12px;
}
.big-btn {
  display: block; width: 100%;
  text-align: center;
  font-size: 19px; font-weight: 600;
  padding: 16px;
  border: none;
  background: var(--chip);
}
.primary { background: var(--accent); color: #fff; border: none; }
.primary:hover:not(:disabled) { background: var(--accent-dark); }
button:disabled { opacity: .45; cursor: default; }
.ghost { background: transparent; }
.wide { width: 100%; margin-top: 10px; padding: 12px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip {
  background: var(--chip); border: none; border-radius: 999px;
  padding: 8px 14px; font-size: 15px;
}
.chip.active { background: var(--accent); color: #fff; }

.hint { color: var(--muted); font-size: 14px; margin: 8px 0 0; }
.desktop-only { display: none; }
@media (hover: hover) and (pointer: fine) { .desktop-only { display: block; } }
body.dragover main { outline: 3px dashed var(--accent); outline-offset: -6px; }

.list { list-style: none; padding: 0; margin: 10px 0 0; }
.list li {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 0; border-top: 1px solid var(--line);
}
.list li:first-child { border-top: none; }
.list img, .list .ph {
  width: 52px; height: 52px; object-fit: cover; border-radius: 8px;
  background: var(--chip); flex: none;
}
.list .info { flex: 1; min-width: 0; }
.list .name { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .state { font-size: 13px; color: var(--muted); }
.list .state.ok { color: var(--ok); }
.list .state.err { color: var(--err); }
.list .remove { border: none; background: none; font-size: 20px; color: var(--muted); padding: 4px 8px; }

.progress { height: 10px; background: var(--chip); border-radius: 5px; overflow: hidden; margin-top: 12px; }
#bar { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.status { margin: 10px 0 0; font-size: 15px; }
.status.ok { color: var(--ok); }
.status.err { color: var(--err); }

dialog {
  border: none; border-radius: 14px; padding: 18px;
  width: min(92vw, 460px);
  background: var(--card); color: var(--text);
}
dialog::backdrop { background: rgba(0,0,0,.45); }
dialog h2 { margin: 0 0 12px; font-size: 19px; }
dialog label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 12px; }
dialog label input { margin-top: 4px; }
.row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }
.row button { padding: 10px 14px; }
