:root {
  color-scheme: dark;
  --bg: #10140f;
  --bg-2: #181d16;
  --card: #1e241c;
  --line: #31392c;
  --text: #f4f6ef;
  --muted: #a7b0a0;
  --accent: #d6f25c;
  --accent-ink: #1b2408;
  --danger: #ff7a68;
  --ok: #8fd9a8;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.28);
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2 { margin: 0; font-weight: 650; letter-spacing: -0.03em; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1rem; }

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(900px 420px at 10% -10%, rgba(214, 242, 92, 0.16), transparent 55%),
    var(--bg);
}
.login-card, .card, dialog {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}
.login-card { width: min(420px, 100%); padding: 28px; display: grid; gap: 14px; }
.lede, .muted, .hint { color: var(--muted); }
.lede { margin: 0; line-height: 1.45; }
.mark {
  width: 52px; height: 52px; margin: 0;
  display: grid; place-items: center;
  border-radius: 16px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 750;
}
.mark.sm { width: 40px; height: 40px; border-radius: 13px; }

label { display: grid; gap: 6px; font-size: 0.86rem; color: var(--muted); }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg-2);
  border-radius: 12px;
  padding: 11px 12px;
  outline: none;
}
textarea { resize: vertical; min-height: 160px; line-height: 1.45; }
input:focus, textarea:focus, select:focus { border-color: #8ea84a; }
select, select option {
  color: var(--text);
  background-color: var(--bg-2);
}
#admin-box { margin-top: 18px; display: grid; gap: 10px; }
#admin-box h2 { font-size: 0.95rem; }

button {
  border: 0;
  border-radius: 12px;
  padding: 11px 14px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 680;
}
button.secondary { background: #e7e2cf; }
button.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}
button.tiny { padding: 7px 10px; border-radius: 10px; font-size: 0.82rem; }
button:disabled { opacity: 0.55; cursor: wait; }

.app {
  display: grid;
  grid-template-columns: 250px minmax(340px, 1.1fr) minmax(300px, 0.9fr);
  gap: 16px;
  width: min(1240px, calc(100% - 28px));
  margin: 0 auto;
  padding: 18px 0 28px;
}
.topbar, .tasks { grid-column: 1 / -1; }
.topbar, .card { padding: 16px; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 4px 2px 0;
}
.topbar > div:first-child { display: flex; gap: 12px; align-items: center; }
.top-actions, .actions, .card-head, .group-tools { display: flex; gap: 8px; align-items: center; }
.card-head, .group-tools { justify-content: space-between; margin-bottom: 12px; }
.group-tools { flex-wrap: wrap; justify-content: flex-start; }
.group-tools input { max-width: 220px; }
.stack { display: grid; gap: 8px; }
.stack.tight { margin-top: 10px; }
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.image-row { display: flex; justify-content: space-between; gap: 12px; margin-top: 12px; }
.image-row img {
  width: 112px; height: 112px; object-fit: cover;
  border-radius: 16px; border: 1px solid var(--line); background: var(--bg);
}
.check { display: flex; gap: 8px; align-items: center; margin: 12px 0; color: var(--text); }
.check input { width: auto; }
.actions { flex-wrap: wrap; }
details { margin-top: 10px; color: var(--muted); }
summary { cursor: pointer; }

.account-list, .group-list, .task-list { list-style: none; margin: 0 0 12px; padding: 0; }
.account-list button, .group-list label, .task-list li {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--bg-2);
  border-radius: 14px;
  padding: 10px 12px;
}
.account-list { display: grid; gap: 8px; }
.account-list li { display: grid; gap: 6px; }
.account-list .active { border-color: var(--accent); }
.account-list small, .task-list small { display: block; color: var(--muted); font-weight: 450; }
.row-actions { display: flex; gap: 6px; margin-top: 8px; }

.group-list { max-height: calc(100vh - 230px); overflow: auto; display: grid; gap: 8px; }
.group-list label { display: flex; gap: 10px; align-items: center; color: var(--text); }
.group-list input { width: auto; }
.group-list .name { flex: 1; }
.badge {
  font-size: 0.72rem;
  border-radius: 999px;
  padding: 3px 8px;
  background: #2a3326;
  color: var(--muted);
}
.badge.bad { color: var(--danger); background: rgba(255, 122, 104, 0.12); }
.group-list .banned { opacity: 0.55; }

.task-list { display: grid; gap: 8px; }
.task-list li { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.logs {
  margin: 12px 0 0;
  max-height: 180px;
  overflow: auto;
  padding: 12px;
  border-radius: 14px;
  background: #12160f;
  color: #c9d2bc;
  font-size: 12px;
  line-height: 1.45;
}

.form-error { color: var(--danger); min-height: 1.2em; margin: 0; }
.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  background: #f4f6ef;
  color: #17200d;
  padding: 12px 16px;
  border-radius: 999px;
  box-shadow: var(--shadow);
}
dialog { width: min(420px, calc(100% - 24px)); padding: 22px; color: var(--text); }
dialog::backdrop { background: rgba(0, 0, 0, 0.55); }

@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; width: min(720px, calc(100% - 20px)); }
  .group-list { max-height: 420px; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}
