:root {
  --bg: #0b0f17;
  --bg2: #111827;
  --card: #131a26;
  --card2: #0f1622;
  --line: #1f2937;
  --text: #e5e7eb;
  --muted: #8b98ab;
  --accent: #4f8cff;
  --accent2: #6ee7b7;
  --danger: #f87171;
  --warn: #fbbf24;
  --ok: #34d399;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: radial-gradient(1200px 600px at 20% -10%, #16233a 0%, var(--bg) 55%) fixed;
  color: var(--text);
  font: 15px/1.5 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
h1, h2, h3 { margin: 0 0 8px; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
p { margin: 0 0 10px; }
small, .small { font-size: 12.5px; }
.muted { color: var(--muted); }
.right { text-align: right; }
.end { justify-content: flex-end; }
.empty { padding: 14px 2px; }

/* ---------- login ---------- */
.login {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card { width: min(420px, 100%); padding: 28px; }
.login-card h1 { margin-top: 14px; }

/* ---------- cards / layout ---------- */
.card {
  background: linear-gradient(180deg, var(--card) 0%, var(--card2) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .2px; }
.brand .dot {
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--accent2);
  box-shadow: 0 0 0 4px rgba(110,231,183,.14);
}
.host { color: var(--muted); font-weight: 500; font-size: 12.5px; }

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 18px;
  padding: 12px 20px;
  background: rgba(11,15,23,.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.tabs { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.tab {
  background: transparent; border: 1px solid transparent; color: var(--muted);
  padding: 8px 12px; border-radius: 10px; cursor: pointer; font: inherit; font-size: 14px;
}
.tab:hover { color: var(--text); background: rgba(255,255,255,.04); }
.tab.active { color: var(--text); background: rgba(79,140,255,.14); border-color: rgba(79,140,255,.4); }
.topbar-right { display: flex; align-items: center; gap: 8px; }

.content { padding: 22px 20px 60px; max-width: 1240px; margin: 0 auto; }
.panel { display: none; }
.panel.active { display: block; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ---------- controls ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span { color: var(--muted); font-size: 13px; }
input, select, textarea {
  width: 100%;
  background: #0d1420;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  border-color: rgba(79,140,255,.7);
  box-shadow: 0 0 0 3px rgba(79,140,255,.16);
}
.select { max-width: 240px; }
textarea { min-height: 320px; resize: vertical; font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.check-line { display: flex; align-items: center; gap: 9px; color: var(--muted); margin: 6px 0 12px; }
.check-line input { width: 16px; height: 16px; accent-color: var(--accent); }

.btn {
  background: #16202f; color: var(--text); border: 1px solid var(--line);
  padding: 9px 14px; border-radius: 10px; cursor: pointer; font: inherit;
  transition: transform .05s, background .15s, border-color .15s;
}
.btn:hover { background: #1b2739; border-color: #2b3a4f; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: linear-gradient(180deg, #4f8cff, #3b74e0); border-color: #4f8cff; color: #fff; }
.btn.primary:hover { background: linear-gradient(180deg, #5c95ff, #4a80ea); }
.btn.danger { border-color: rgba(248,113,113,.45); color: #ffb4b4; }
.btn.danger:hover { background: rgba(248,113,113,.12); }
.btn.ghost { background: transparent; }
.btn.wide { width: 100%; }
.btn.sm { padding: 6px 10px; font-size: 13px; }

/* ---------- chips / stats ---------- */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.chip {
  background: rgba(79,140,255,.12); border: 1px solid rgba(79,140,255,.3);
  padding: 5px 10px; border-radius: 999px; font-size: 12.5px; color: #cfe0ff;
}
.chip.ok { background: rgba(52,211,153,.12); border-color: rgba(52,211,153,.35); color: #b9f5dd; }
.chip.warn { background: rgba(251,191,36,.12); border-color: rgba(251,191,36,.35); color: #ffe7b0; }
.chip.err { background: rgba(248,113,113,.12); border-color: rgba(248,113,113,.35); color: #ffc9c9; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 12px; }
.stat {
  background: #0e1522; border: 1px solid var(--line); border-radius: 12px;
  padding: 12px; text-align: center;
}
.stat span { display: block; font-size: 22px; font-weight: 700; }
.stat small { color: var(--muted); font-size: 12px; }
.stat.ok span { color: var(--ok); }
.stat.err span { color: var(--danger); }

/* ---------- tables ---------- */
.table-wrap { border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--line); }
.table th { background: #0f1725; color: var(--muted); font-weight: 600; font-size: 12.5px;
            text-transform: uppercase; letter-spacing: .04em; position: sticky; top: 0; }
.table tbody tr:hover { background: rgba(79,140,255,.06); }
.table td.mono, .mono { font-family: ui-monospace, Consolas, monospace; }
.table .check { width: 42px; }
.table input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); }
.pill { padding: 3px 9px; border-radius: 999px; font-size: 12px; border: 1px solid var(--line); }
.pill.ok { color: #b9f5dd; border-color: rgba(52,211,153,.4); background: rgba(52,211,153,.1); }
.pill.no { color: var(--muted); }
.pill.target { color: #cfe0ff; border-color: rgba(79,140,255,.4); background: rgba(79,140,255,.12); }

/* ---------- roll / targets ---------- */
.roll-grid { display: grid; grid-template-columns: 380px 1fr; gap: 16px; align-items: start; }
.form .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.log {
  margin: 0; padding: 12px; height: 320px; overflow: auto;
  background: #080d15; border: 1px solid var(--line); border-radius: 12px;
  font: 12.5px/1.55 ui-monospace, Consolas, monospace; color: #a9b6c9; white-space: pre-wrap;
}
.targets-grid { display: grid; grid-template-columns: 1fr 380px; gap: 16px; align-items: start; }
.list { list-style: none; margin: 8px 0 0; padding: 0; max-height: 300px; overflow: auto; }
.list li { padding: 6px 0; border-bottom: 1px solid var(--line); font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }

.msg { min-height: 18px; font-size: 13px; margin-top: 8px; }
.msg.error { color: var(--danger); }
.msg.ok { color: var(--ok); }

/* ---------- modal / toast ---------- */
.modal { position: fixed; inset: 0; background: rgba(3,6,12,.72); display: grid; place-items: center; padding: 20px; z-index: 50; }
.modal-card { width: min(460px, 100%); }
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #16202f; border: 1px solid var(--line); color: var(--text);
  padding: 11px 16px; border-radius: 12px; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; z-index: 60; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.ok { border-color: rgba(52,211,153,.45); }
.toast.err { border-color: rgba(248,113,113,.45); }

@media (max-width: 900px) {
  .roll-grid, .targets-grid { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- окно редактирования аккаунта ---------- */
.editor-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
  margin-top: 16px;
  align-items: start;
}
.editor-grid h3 { margin-bottom: 4px; }
.editor-grid ol, .editor-grid ul { margin: 6px 0 0; }
.editor-grid li { margin-bottom: 6px; }
@media (max-width: 900px) {
  .editor-grid { grid-template-columns: 1fr; }
}

/* ---------- парные поля «от–до» ---------- */
.pair { display: flex; align-items: center; gap: 8px; }
.pair input { width: 100%; }
.pair span { opacity: .6; }

/* ---------- индикатор паузы ---------- */
.pause {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; margin-bottom: 12px;
  background: rgba(251,191,36,.10);
  border: 1px solid rgba(251,191,36,.35);
  border-radius: var(--radius);
}
.pause-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--warn); animation: pulse 1.2s infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .25; } }
.pause-text b { font-variant-numeric: tabular-nums; }
