:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #16181d;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #2563eb;
  --accent-text: #ffffff;
  --accent-soft: #e8efff;
  --ok: #16a34a;
  --ok-soft: #e7f6ec;
  --warn: #b45309;
  --warn-soft: #fff4e0;
  --danger: #dc2626;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 2px 8px rgba(0,0,0,.04);
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --card: #181b21;
    --text: #eef0f3;
    --muted: #9aa1ad;
    --line: #2a2f38;
    --accent: #4f8cff;
    --accent-text: #ffffff;
    --accent-soft: #1b2740;
    --ok: #3ccf6e;
    --ok-soft: #13291c;
    --warn: #f0a542;
    --warn-soft: #2e2313;
    --danger: #f26b6b;
    --shadow: none;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Segoe UI", sans-serif;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 { margin: 0; line-height: 1.25; }
h2 { font-size: 15px; font-weight: 700; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--accent); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}
.card + .card { margin-top: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: var(--card);
  border-radius: 10px; padding: 8px 14px; cursor: pointer;
  font-weight: 600; font-size: 14px; text-decoration: none; color: var(--text);
  white-space: nowrap;
}
.btn:hover { border-color: var(--muted); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.big { width: 100%; padding: 16px; font-size: 17px; border-radius: 14px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--bg); }
.btn.danger { color: var(--danger); }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }

.input, textarea.input {
  width: 100%; border: 1px solid var(--line); background: var(--bg);
  border-radius: 10px; padding: 10px 12px; outline: none;
}
.input:focus { border-color: var(--accent); }
textarea.input { resize: vertical; min-height: 70px; }

.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; opacity: .5; }
.dot.on { background: var(--ok); opacity: 1; box-shadow: 0 0 0 3px var(--ok-soft); }

.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 99px; }
.badge.wait { background: var(--warn-soft); color: var(--warn); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.new { background: var(--accent-soft); color: var(--accent); }

.list { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); min-width: 0; }
.row:first-child { border-top: 0; padding-top: 0; }
.row .grow { flex: 1; min-width: 0; }
.row .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .actions { display: flex; gap: 6px; flex: none; }
.empty { color: var(--muted); font-size: 14px; padding: 6px 0; }

.thumb {
  width: 48px; height: 48px; border-radius: 10px; flex: none; object-fit: cover;
  background: var(--bg); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; overflow: hidden;
}
.textbox {
  white-space: pre-wrap; word-break: break-word; background: var(--bg);
  border-radius: 10px; padding: 8px 10px; font-size: 14px; max-height: 160px; overflow: auto;
}

.progress { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; width: 0; background: var(--accent); transition: width .2s; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px;
  font-weight: 600; font-size: 14px; opacity: 0; pointer-events: none; transition: .2s; z-index: 50;
  max-width: calc(100% - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
