:root {
  --bg: #0f1115;
  --panel: #161a21;
  --panel-2: #1c212a;
  --line: #262c37;
  --txt: #e6e9ef;
  --dim: #7d8698;
  --acc: #5b8cff;
  --ok: #3fb950;
  --warn: #d29922;
  --bad: #f85149;
  --radius: 10px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--txt);
  font: 14px/1.5 "Segoe UI", system-ui, -apple-system, sans-serif;
  display: flex;
  min-height: 100vh;
}
a { color: var(--acc); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 18px; font-weight: 600; }
h2 { font-size: 14px; margin: 0 0 12px; font-weight: 600; text-transform: uppercase;
     letter-spacing: .06em; color: var(--dim); }
.dim { color: var(--dim); }
.count { color: var(--dim); font-weight: 400; font-size: 13px; }

/* ---------- каркас ---------- */
.side {
  width: 210px; flex: 0 0 210px; background: var(--panel);
  border-right: 1px solid var(--line); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.brand { padding: 18px 18px 14px; font-weight: 700; letter-spacing: .04em; }
.side nav { display: flex; flex-direction: column; padding: 6px; gap: 2px; }
.side nav a {
  color: var(--txt); padding: 8px 12px; border-radius: 8px;
  display: flex; align-items: center; gap: 10px;
}
.side nav a:hover { background: var(--panel-2); text-decoration: none; }
.side nav a.on { background: var(--panel-2); color: var(--acc); }
.side nav i { font-style: normal; width: 16px; text-align: center; color: var(--dim); }
.side nav a.on i { color: var(--acc); }
.side-foot { margin-top: auto; padding: 14px 18px; border-top: 1px solid var(--line); font-size: 13px; }
.who { color: var(--dim); margin-bottom: 6px; }
.lock { color: var(--dim); }

main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top {
  display: flex; gap: 12px; align-items: center; padding: 12px 24px;
  border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 5;
}
.searchbox { flex: 1; }
.searchbox input { width: 100%; max-width: 520px; }
.top-actions { display: flex; gap: 8px; }
.content { padding: 24px; max-width: 1400px; width: 100%; }

/* ---------- элементы ---------- */
input, select, textarea {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--txt);
  padding: 8px 10px; border-radius: 8px; font: inherit; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--acc); }
textarea { resize: vertical; width: 100%; }

.btn {
  background: var(--acc); color: #fff; border: 1px solid transparent; padding: 8px 14px;
  border-radius: 8px; cursor: pointer; font: inherit; display: inline-block;
}
.btn:hover { filter: brightness(1.1); text-decoration: none; }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--txt); }
.btn.danger { background: transparent; border-color: var(--bad); color: var(--bad); margin-left: auto; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.wide { width: 100%; margin-top: 8px; }

.mini {
  background: transparent; border: 1px solid var(--line); color: var(--dim);
  padding: 2px 8px; border-radius: 6px; cursor: pointer; font: inherit; font-size: 12px;
}
.mini:hover { color: var(--txt); border-color: var(--dim); text-decoration: none; }
.mini.done { color: var(--ok); border-color: var(--ok); }
.mini.fail { color: var(--bad); border-color: var(--bad); }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; margin-bottom: 18px;
}
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 18px; }
.cols .card { margin: 0; }

.badge { padding: 2px 8px; border-radius: 20px; font-size: 12px; background: var(--panel-2);
         border: 1px solid var(--line); color: var(--dim); white-space: nowrap; }
.badge.s-активен { color: var(--ok); border-color: rgba(63,185,80,.4); }
.badge.s-прогрев { color: var(--warn); border-color: rgba(210,153,34,.4); }
.badge.s-забанен, .badge.s-мёртвый, .badge.s-заблокирован { color: var(--bad); border-color: rgba(248,81,73,.4); }
.badge.s-истёк, .badge.s-ограничен { color: var(--warn); border-color: rgba(210,153,34,.4); }

.chip { display: inline-block; background: var(--panel-2); border: 1px solid var(--line);
        border-radius: 6px; padding: 1px 7px; font-size: 12px; margin-right: 4px; color: var(--dim); }

/* ---------- таблица ---------- */
.filters { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.filters input { min-width: 260px; }
.grid { width: 100%; border-collapse: collapse; background: var(--panel);
        border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.grid th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em;
           color: var(--dim); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.grid td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.grid tr:last-child td { border-bottom: none; }
.grid tbody tr:hover { background: var(--panel-2); }
.grid .right { text-align: right; }
.strong { font-weight: 600; color: var(--txt); }
.strong:hover { color: var(--acc); }
.empty { padding: 40px; text-align: center; color: var(--dim); background: var(--panel);
         border: 1px dashed var(--line); border-radius: var(--radius); }

/* ---------- формы ---------- */
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field.wide { grid-column: 1 / -1; }
.field .lbl { font-size: 12px; color: var(--dim); }
.field .hint { font-size: 12px; color: var(--dim); }
.inline-check { font-size: 12px; color: var(--dim); display: flex; gap: 6px; align-items: center; }
.inline-check input { width: auto; }
.form-foot { display: flex; gap: 10px; align-items: center; margin-top: 18px;
             padding-top: 16px; border-top: 1px solid var(--line); }

/* ---------- дашборд ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
         gap: 12px; margin-bottom: 20px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
        padding: 14px; display: flex; flex-direction: column; gap: 2px; color: var(--dim); }
.tile:hover { border-color: var(--acc); text-decoration: none; }
.tile b { font-size: 26px; color: var(--txt); font-weight: 600; }
.tile-ico { color: var(--dim); }

.alerts, .plain, .events, .bars { list-style: none; margin: 0; padding: 0; }
.alerts li { display: flex; gap: 10px; align-items: baseline; padding: 6px 0;
             border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.alerts li:last-child { border-bottom: none; }
.alerts li b { color: var(--warn); font-weight: 500; }
.alerts li.soon b { color: var(--warn); }
.alerts li.over b { color: var(--bad); }
.plain li { padding: 5px 0; border-bottom: 1px solid var(--line); display: flex; gap: 8px; align-items: center; }
.plain li:last-child { border-bottom: none; }
.events li { padding: 5px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.events li:last-child { border-bottom: none; }
.kind { color: var(--dim); font-size: 12px; border: 1px solid var(--line);
        border-radius: 5px; padding: 0 5px; margin: 0 4px; }
.bars li { display: grid; grid-template-columns: 120px 1fr 40px; gap: 10px;
           align-items: center; padding: 4px 0; }
.bar { background: var(--panel-2); border-radius: 4px; height: 8px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--acc); }
.bars b { text-align: right; font-weight: 500; }

/* ---------- карточка аккаунта ---------- */
.acc-title { display: flex; align-items: center; gap: 12px; }
.tagrow { margin: -8px 0 18px; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 12px; align-items: baseline; }
.kv span { color: var(--dim); font-size: 13px; }
.kv b { font-weight: 500; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.masked { letter-spacing: 2px; color: var(--dim); }
.revealed { font-family: Consolas, monospace; color: var(--warn); word-break: break-all; }

.links { display: flex; flex-direction: column; gap: 12px; }
.link { border-left: 2px solid var(--acc); padding-left: 12px; }
.link.off { border-left-color: var(--line); }
.link .lk { display: block; font-size: 12px; color: var(--dim); }
.link em { font-style: normal; color: var(--dim); font-size: 13px; margin-left: 8px; }
.link-actions { display: flex; gap: 6px; align-items: center; margin-top: 5px; flex-wrap: wrap; }
.notes { white-space: pre-wrap; margin: 0; }
.noteform { display: flex; gap: 8px; margin-bottom: 14px; }
.noteform input { flex: 1; }

.totp-card { display: flex; flex-direction: column; }
.totp-box { display: flex; flex-direction: column; gap: 10px; }
.totp-code { font: 600 40px/1 Consolas, monospace; letter-spacing: 4px; color: var(--ok); }
.totp-bar { height: 5px; background: var(--panel-2); border-radius: 3px; overflow: hidden; }
.totp-bar span { display: block; height: 100%; background: var(--ok); width: 100%;
                 transition: width 1s linear; }
.totp-foot { display: flex; justify-content: space-between; align-items: center; }

/* ---------- вход ---------- */
body.gate { display: flex; align-items: center; justify-content: center; }
.gatebox { background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
           padding: 30px; width: 380px; display: flex; flex-direction: column; gap: 12px; }
.gatebox h1 { margin: 0; }
.gatebox label { display: flex; flex-direction: column; gap: 5px; }
.gatebox label span { font-size: 12px; color: var(--dim); }
.gatebox p { margin: 0; font-size: 13px; }
.err { background: rgba(248,81,73,.12); border: 1px solid rgba(248,81,73,.4);
       color: #ff9d97; padding: 8px 10px; border-radius: 8px; font-size: 13px; }

/* ---------- уведомление ---------- */
#toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px);
         background: var(--panel-2); border: 1px solid var(--line); color: var(--txt);
         padding: 10px 18px; border-radius: 10px; opacity: 0; pointer-events: none;
         transition: all .18s ease; z-index: 50; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.bad { border-color: var(--bad); color: #ff9d97; }

.ok-note { background: rgba(63,185,80,.1); border: 1px solid rgba(63,185,80,.35);
           color: #7ee094; padding: 8px 12px; border-radius: 8px; margin-bottom: 14px; font-size: 13px; }
.mini.go { color: var(--acc); border-color: rgba(91,140,255,.4); }
.mini.go:hover { background: rgba(91,140,255,.12); color: var(--acc); }
code { background: var(--panel-2); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; }
textarea[hidden] { display: none; }

.inline-edit { padding: 3px 8px; font-size: 13px; min-width: 190px; margin-right: 6px; }
.mini.ed { padding: 2px 6px; }
.grid td .mini + .mini { margin-left: 4px; }

.steps { margin: 0; padding-left: 20px; }
.steps li { margin-bottom: 6px; }
.src-head { font-size: 11px; color: var(--dim); margin-bottom: 4px;
            text-transform: none; letter-spacing: 0; max-width: 160px;
            overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grid th select { max-width: 170px; }
input[type=file] { padding: 6px; }

.nav-extra { display: block; color: var(--txt); padding: 6px 0; }
.nav-extra.on { color: var(--acc); }
.side-foot .lock { display: block; padding-top: 6px; }
.utable td, .utable th { padding: 8px 10px; }
.utable form { display: inline; }

.localbar {
  background: rgba(210,153,34,.14); border-bottom: 1px solid rgba(210,153,34,.45);
  color: var(--warn); padding: 7px 24px; font-size: 13px; font-weight: 600;
  letter-spacing: .04em; text-align: center;
}
body.gate .localbar { position: fixed; top: 0; left: 0; right: 0; }

/* ---------- этапы ---------- */
.plan-group { margin-bottom: 14px; }
.plan-group:last-child { margin-bottom: 0; }
.plan-head { font-size: 13px; color: var(--txt); font-weight: 600; margin-bottom: 4px; }
.plan .plain li { flex-wrap: wrap; }

.timeline { list-style: none; margin: 0; padding: 0 0 0 6px; }
.timeline li {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 0 8px 18px; border-left: 2px solid var(--line); position: relative;
}
.timeline li:last-child { border-left-color: transparent; }
.tl-dot {
  position: absolute; left: -6px; top: 14px; width: 10px; height: 10px;
  border-radius: 50%; background: var(--panel-2); border: 2px solid var(--line);
}
.timeline li.done { border-left-color: var(--ok); }
.timeline li.done .tl-dot { background: var(--ok); border-color: var(--ok); }
.timeline li.done .tl-name { color: var(--dim); text-decoration: line-through; }
.timeline li.now .tl-dot { background: var(--warn); border-color: var(--warn); }
.timeline li.late .tl-dot { background: var(--bad); border-color: var(--bad); }
.timeline li.late .tl-date { color: var(--bad); }
.tl-name { min-width: 190px; }
.tl-date { font-size: 13px; }
.tl-when { padding: 2px 6px; font-size: 12px; }

.remember { color: var(--dim); font-size: 13px; margin-top: 4px; }
.plain li form { display: inline; }
