:root {
  color-scheme: dark;
  --bg: #06131f;
  --panel: #0a1f31;
  --panel-2: #0d263b;
  --line: rgba(120, 180, 210, 0.18);
  --text: #e8f4fb;
  --muted: #8aa8bb;
  --accent: #4fd1c5;
  --danger: #ef6a6a;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(900px 500px at 70% -10%, rgba(50, 160, 150, 0.16), transparent 65%),
    var(--bg);
  color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
}
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.error { min-height: 18px; color: var(--danger); font-size: 13px; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login__card {
  width: min(100%, 380px);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(10, 31, 49, 0.9);
  box-shadow: 0 30px 80px -40px #000;
  display: grid;
  gap: 14px;
}
.login__brand, .top__brand { font-size: 22px; font-weight: 800; letter-spacing: 0.02em; }
.login label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; }
input, select {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(4, 16, 26, 0.7);
  color: var(--text);
  font: inherit;
}
input:focus { outline: 1px solid var(--accent); }

.btn {
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.btn:hover { border-color: var(--accent); }
.btn--primary { background: var(--accent); color: #06232a; border-color: var(--accent); font-weight: 700; }
.btn--ghost { background: rgba(255, 255, 255, 0.02); }
.btn--danger { color: var(--danger); border-color: rgba(239, 106, 106, 0.4); }
.btn:disabled { opacity: 0.5; cursor: default; }

.app { min-height: 100vh; }
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(4, 16, 26, 0.6);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 5;
}
.top__right { display: flex; align-items: center; gap: 14px; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 28px 20px 70px; }
.hero h1 { margin: 0 0 4px; font-size: 30px; }
.hero p { margin: 0 0 18px; }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.stat {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(160deg, var(--panel), var(--panel-2));
}
.stat b { display: block; font-size: 26px; line-height: 1.1; }
.stat span { color: var(--muted); font-size: 12px; }

.card {
  margin-top: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
}
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.card__head h2 { margin: 0; font-size: 18px; }
.actions { display: flex; gap: 8px; align-items: center; }
.actions .input { width: 230px; }
.warnings { display: grid; gap: 6px; margin: 10px 0; color: #ffd28b; font-size: 12px; }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; margin-top: 12px; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; }
tr:last-child td { border-bottom: 0; }
tr.is-archived td { opacity: 0.65; }
.t-name { font-weight: 700; }
.t-code { color: var(--muted); font-size: 11px; }
.badge { display: inline-block; padding: 2px 8px; border: 1px solid var(--line); border-radius: 999px; font-size: 11px; }
.badge--running { color: #ffd28b; border-color: rgba(255, 210, 139, 0.35); }
.badge--deleted { color: var(--danger); border-color: rgba(239, 106, 106, 0.35); }
.badge--finished { color: var(--accent); border-color: rgba(79, 209, 197, 0.35); }

.audit { display: grid; gap: 8px; max-height: 260px; overflow: auto; margin-top: 10px; }
.audit__row { display: grid; grid-template-columns: 150px 1fr; gap: 10px; font-size: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.audit__row time { color: var(--muted); }

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0d2a3d;
  color: var(--text);
  box-shadow: 0 18px 50px -20px #000;
}
.toast--error { color: #ffb4b4; border-color: rgba(239, 106, 106, 0.5); }
.notice {
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 210, 139, 0.35);
  border-radius: 12px;
  background: rgba(255, 210, 139, 0.08);
  color: #ffd28b;
  font-size: 13px;
}
.account-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.account-form label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; }
.account-form .btn { justify-self: start; }
.account-form .error { grid-column: 1 / -1; }
@media (max-width: 700px) {
  .account-form { grid-template-columns: 1fr; }
}
