:root {
  --bg: #0b0c12;
  --card: #15161f;
  --card-2: #1c1d29;
  --line: rgb(255 255 255 / 0.08);
  --text: rgb(255 255 255 / 0.92);
  --muted: rgb(235 235 245 / 0.55);
  --accent: #0a84ff;
  --accent-2: #409cff;
  --danger: #ff453a;
  --ok: #30d158;
  --radius: 16px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  color: var(--text);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(900px 600px at 0% -10%, rgb(94 92 230 / 0.28), transparent 60%),
    radial-gradient(800px 600px at 110% 10%, rgb(10 132 255 / 0.2), transparent 60%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

h1, h2, h3 { margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 18px; margin-bottom: 14px; }
h3 { font-size: 16px; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.block { display: block; margin-top: 2px; }
.error { color: var(--danger); margin: 8px 0 0; font-size: 14px; }

.card {
  background: rgb(21 22 31 / 0.85);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.05), 0 18px 50px -20px rgb(0 0 0 / 0.7);
  backdrop-filter: blur(30px);
}

/* ---------- кнопки и поля ---------- */

.btn {
  font: inherit;
  border: 0;
  border-radius: 10px;
  padding: 9px 14px;
  cursor: pointer;
  color: var(--text);
  background: rgb(255 255 255 / 0.09);
  transition: background 0.15s, transform 0.1s, opacity 0.15s;
}
.btn:hover:not(:disabled) { background: rgb(255 255 255 / 0.15); }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.primary { background: var(--accent); color: white; font-weight: 600; }
.btn.primary:hover:not(:disabled) { background: var(--accent-2); }
.btn.danger { color: #ff8a80; }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); }
.btn.wide { width: 100%; padding: 12px; margin-top: 16px; }

input[type="text"], input[type="password"] {
  font: inherit;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  color: var(--text);
  background: rgb(255 255 255 / 0.06);
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
}
input:focus { border-color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- вход ---------- */

.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: 100%; max-width: 380px; text-align: center; }
.login-card h1 { margin: 14px 0 6px; font-size: 22px; }
.login-card p { margin: 0 0 16px; }

.logo {
  display: inline-grid;
  place-items: center;
  width: 60px;
  height: 60px;
  border-radius: 16px;
  font-size: 28px;
  color: white;
  background: linear-gradient(160deg, #5ac8fa, var(--accent) 45%, #5e5ce6);
  box-shadow: 0 12px 28px -10px rgb(10 132 255 / 0.7);
}
.logo.small { width: 30px; height: 30px; border-radius: 9px; font-size: 15px; box-shadow: none; }

/* ---------- основной экран ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; }

.layout {
  display: grid;
  grid-template-columns: minmax(300px, 380px) 1fr;
  gap: 20px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
  align-items: start;
}
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; padding: 16px; }
}

.new-job { position: sticky; top: 20px; }

.drop {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 26px 16px;
  text-align: center;
  border: 1.5px dashed rgb(255 255 255 / 0.2);
  border-radius: 14px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.drop:hover, .drop.over { border-color: var(--accent); background: rgb(10 132 255 / 0.08); }
.drop.has-file { border-style: solid; border-color: rgb(48 209 88 / 0.6); }
.drop-icon { font-size: 22px; color: var(--accent-2); }

.switch {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
  margin-top: 16px;
  cursor: pointer;
}
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.slider {
  position: relative;
  width: 40px;
  height: 24px;
  margin-top: 1px;
  border-radius: 12px;
  background: rgb(255 255 255 / 0.16);
  transition: background 0.2s;
}
.slider::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: white;
  transition: transform 0.2s;
}
.switch input:checked + .slider { background: var(--ok); }
.switch input:checked + .slider::after { transform: translateX(16px); }
.switch input:focus-visible + .slider { outline: 2px solid var(--accent); outline-offset: 2px; }

.advanced { margin-top: 16px; }
.advanced summary { cursor: pointer; color: var(--muted); font-size: 14px; }
.field { display: block; margin-top: 12px; font-size: 13px; color: var(--muted); }

/* ---------- задачи ---------- */

.empty { padding: 30px 0; }

.job { margin-bottom: 14px; }
.job-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.job-title { min-width: 0; }
.job-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.badge {
  flex-shrink: 0;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: rgb(255 255 255 / 0.1);
}
.badge.running { background: rgb(10 132 255 / 0.2); color: #64b5ff; }
.badge.queued, .badge.stopping { background: rgb(255 214 10 / 0.15); color: #ffd60a; }
.badge.done { background: rgb(48 209 88 / 0.18); color: var(--ok); }
.badge.failed { background: rgb(255 69 58 / 0.18); color: #ff8a80; }

.progress { height: 8px; margin: 16px 0 8px; border-radius: 4px; background: rgb(255 255 255 / 0.08); overflow: hidden; }
.bar { height: 100%; width: 0; border-radius: 4px; background: linear-gradient(90deg, var(--accent), #5ac8fa); transition: width 0.6s ease; }
.job.done .bar { background: var(--ok); }
.job.failed .bar { background: var(--danger); }

.job-message { margin: 8px 0 0; color: #ffd60a; }
.job-message:empty { display: none; }
.job.failed .job-message { color: #ff8a80; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border-radius: 9px;
  font-size: 13px;
  background: rgb(255 255 255 / 0.06);
  cursor: help;
}
.chip .dot { width: 8px; height: 8px; border-radius: 50%; }
.chip b { font-variant-numeric: tabular-nums; }

.notes { margin-top: 12px; color: var(--muted); }
.notes summary { cursor: pointer; }
.notes ul { margin: 8px 0 0; padding-left: 18px; font-size: 12px; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.actions:empty { display: none; }
