/* ndze.fun — общий дизайн-кит. Спокойная тёмная тема: ровные поверхности, тонкие рамки, один приглушённый акцент. */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap");

:root {
  --bg: #0e0e0f;
  --bg-2: #121213;
  --side: #0b0b0c;
  --surface: #161617;
  --surface-2: #1c1c1e;
  --surface-3: #242426;
  --line: #232325;
  --line-2: #2e2e31;
  --text: #f2f2f3;
  --muted: #a1a1a6;
  --dim: #6e6e74;
  --accent-rgb: 77, 139, 255;           /* спокойный синий: ссылки, фокус, активные элементы */
  --accent: rgb(var(--accent-rgb));
  --accent-soft: rgba(var(--accent-rgb), .12);
  --blue: #4d8bff;
  --green: #3fbf7f;
  --amber: #d6a645;
  --red: #e5636f;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: dark;
}
body[data-accent="admin"] { --accent-rgb: 150, 130, 255; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 15px/1.55 var(--font); -webkit-font-smoothing: antialiased; min-height: 100vh; overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg { display: block; }
::selection { background: rgba(var(--accent-rgb), .3); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #26262c; border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }
.mono { font-family: var(--mono); font-size: .92em; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.link { color: var(--accent); }
.link:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid rgba(var(--accent-rgb), .6); outline-offset: 2px; }

/* ---------- фон (едва заметные звёзды) ---------- */
.space { position: fixed; inset: 0; z-index: -1; pointer-events: none; background: var(--bg); }
.space canvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .55; }

/* ---------- поверхности ---------- */
.glass { position: relative; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.card { padding: 20px; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 10px 12px; flex-wrap: wrap; margin: 0 0 16px; font-size: 15px; font-weight: 600; }
.card-title .sub { font-weight: 400; color: var(--muted); font-size: 13px; }

/* ---------- кнопки ---------- */
.btn {
  --h: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: var(--h); padding: 0 16px;
  border-radius: 999px; border: 1px solid var(--line-2); cursor: pointer; white-space: nowrap; font-weight: 500; font-size: 13.5px;
  background: var(--surface-2); color: var(--text); transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--surface-3); border-color: #393941; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn svg { width: 17px; height: 17px; }
.btn.sm { --h: 32px; padding: 0 12px; font-size: 13px; gap: 6px; }
.btn.sm svg { width: 15px; height: 15px; }
.btn.lg { --h: 48px; padding: 0 22px; font-size: 15px; }
.btn.block { width: 100%; }
.btn.icon { width: var(--h); padding: 0; }
.btn.primary { background: #f2f2f3; color: #0e0e0f; border-color: #f2f2f3; font-weight: 600; }
.btn.primary:hover { background: #fff; border-color: #fff; }
.btn.accent { background: var(--accent); color: #fff; border-color: transparent; font-weight: 600; }
.btn.accent:hover { filter: brightness(1.08); }
.btn.white { background: #f2f2f3; color: #0e0e0f; border-color: #f2f2f3; font-weight: 600; }
.btn.white:hover { background: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { color: #f3a3aa; border-color: rgba(229, 99, 111, .3); background: rgba(229, 99, 111, .07); }
.btn.danger:hover { border-color: rgba(229, 99, 111, .55); background: rgba(229, 99, 111, .12); }
.btn .spin { width: 16px; height: 16px; }

/* ---------- формы ---------- */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > label, .label { font-size: 13px; color: var(--muted); font-weight: 500; }
.hint { font-size: 12.5px; color: var(--dim); }
.input, select.input, textarea.input {
  width: 100%; height: 42px; padding: 0 13px; border-radius: var(--radius-sm); border: 1px solid var(--line-2);
  background: var(--bg-2); outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea.input { height: auto; min-height: 110px; padding: 11px 13px; resize: vertical; line-height: 1.5; }
textarea.input.code { font-family: var(--mono); font-size: 12.5px; min-height: 360px; white-space: pre; tab-size: 2; }
.input::placeholder { color: var(--dim); }
.input:hover { border-color: #3a3a42; }
.input:focus { border-color: rgba(var(--accent-rgb), .7); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .15); }
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%239a9aa5' stroke-width='1.6' stroke-linecap='round' viewBox='0 0 12 12'%3E%3Cpath d='m3 4.5 3 3 3-3'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 13px center; padding-right: 34px; }
select.input option { background: #17171b; }
input[type=range] { width: 100%; accent-color: var(--accent); }
.input-wrap { position: relative; }
.input-wrap .input { padding-right: 44px; }
.input-wrap .addon { position: absolute; right: 5px; top: 50%; transform: translateY(-50%); }
.row { display: flex; gap: 12px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.check { display: flex; gap: 12px; align-items: flex-start; padding: 11px 13px; border-radius: var(--radius-sm); background: var(--bg-2); border: 1px solid var(--line-2); cursor: pointer; transition: border-color .15s; }
.check:hover { border-color: #3a3a42; }
.check input { display: none; }
.check .box { flex: none; width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid #45454e; display: grid; place-items: center; margin-top: 2px; transition: .15s; }
.check .box svg { width: 12px; height: 12px; opacity: 0; color: #fff; }
.check input:checked ~ .box { background: var(--accent); border-color: var(--accent); }
.check input:checked ~ .box svg { opacity: 1; }
.check:has(input:checked) { border-color: rgba(var(--accent-rgb), .45); }
.check b { display: block; font-weight: 500; font-size: 14px; }
.check small { color: var(--muted); font-size: 12.5px; }

.seg { display: inline-flex; padding: 3px; border-radius: var(--radius-sm); background: var(--bg-2); border: 1px solid var(--line-2); gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; height: 32px; padding: 0 14px; border-radius: 7px; cursor: pointer; color: var(--muted); font-weight: 500; font-size: 13.5px; transition: .15s; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.seg button svg { width: 15px; height: 15px; }
.seg button:hover { color: var(--text); }
.seg button.on { color: var(--text); background: var(--surface-3); }

/* ---------- бейджи / статусы ---------- */
.tag { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 500; background: var(--surface-2); border: 1px solid var(--line-2); color: var(--muted); white-space: nowrap; }
.tag.accent { color: #a9c6ff; background: rgba(var(--accent-rgb), .1); border-color: rgba(var(--accent-rgb), .28); }
.tag.green { color: #8fdcb2; background: rgba(79, 201, 138, .08); border-color: rgba(79, 201, 138, .25); }
.tag.amber { color: #e8c886; background: rgba(217, 170, 74, .08); border-color: rgba(217, 170, 74, .25); }
.tag.red { color: #f0a3aa; background: rgba(229, 99, 111, .08); border-color: rgba(229, 99, 111, .25); }
.tag.blue { color: #b3c6fa; background: rgba(124, 156, 245, .1); border-color: rgba(124, 156, 245, .28); }
.cc { display: inline-grid; place-items: center; min-width: 26px; height: 18px; padding: 0 5px; border-radius: 5px; background: var(--surface-3); border: 1px solid var(--line-2); font: 600 10.5px var(--mono); color: var(--muted); vertical-align: 1px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--dim); flex: none; }
.dot.green { background: var(--green); }
.dot.amber { background: var(--amber); }
.dot.red { background: var(--red); }
.dot.pulse { animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.count { min-width: 22px; height: 20px; padding: 0 7px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface-3); font-size: 11.5px; display: inline-grid; place-items: center; color: var(--muted); font-weight: 600; }
.count.hot { background: var(--text); color: var(--bg); border-color: var(--text); }

/* ---------- логотип / аватар ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: -.01em; font-size: 17px; }
.brand img { width: 30px; height: 30px; border-radius: 50%; }
.brand span b { color: var(--dim); font-weight: 500; }
.avatar { width: 34px; height: 34px; border-radius: 50%; flex: none; overflow: hidden; background: var(--surface-3); display: inline-block; }
.avatar svg, .avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatars { display: flex; }
.avatars .avatar { width: 30px; height: 30px; margin-left: -8px; box-shadow: 0 0 0 2px var(--bg); }
.avatars .avatar:first-child { margin-left: 0; }

/* ---------- таблицы ---------- */
.table-wrap { overflow-x: auto; margin: 0 -20px -20px; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 500; color: var(--dim); font-size: 12.5px; padding: 9px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th:first-child, .table td:first-child { padding-left: 20px; }
.table th:last-child, .table td:last-child { padding-right: 20px; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr.click { cursor: pointer; }
.table tbody tr:hover { background: rgba(255, 255, 255, .015); }
.cell-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cell-main b { font-weight: 500; display: block; }
.cell-main small { color: var(--dim); font-size: 12.5px; }

/* ---------- модалки и тосты ---------- */
.modal-bg { position: fixed; inset: 0; z-index: 100; background: rgba(6, 6, 8, .72); display: grid; place-items: center; padding: 20px; animation: fade .15s ease; overflow-y: auto; }
.modal { width: min(540px, 100%); max-height: calc(100vh - 40px); overflow-y: auto; padding: 24px; animation: rise .18s ease; background: #151518; border-color: var(--line-2); box-shadow: 0 24px 60px rgba(0, 0, 0, .5); }
.modal.wide { width: min(760px, 100%); }
.modal h3 { margin: 0 0 4px; font-size: 18px; font-weight: 600; }
.modal .lead { color: var(--muted); margin: 0 0 18px; font-size: 14px; }
.modal .foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.toasts { position: fixed; z-index: 200; right: 20px; bottom: 20px; display: grid; gap: 8px; max-width: min(380px, calc(100vw - 40px)); }
.toast { padding: 12px 14px; display: flex; gap: 10px; align-items: flex-start; font-size: 14px; animation: rise .18s ease; background: #1a1a1e; border-color: var(--line-2); box-shadow: 0 10px 30px rgba(0, 0, 0, .4); }
.toast svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.toast.ok svg { color: var(--green); }
.toast.err svg { color: var(--red); }

.spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .15); border-top-color: currentColor; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .empty-ico { width: 48px; height: 48px; border-radius: 12px; margin: 0 auto 12px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line-2); }
.empty .empty-ico svg { width: 22px; height: 22px; color: var(--text); }
.empty h4 { margin: 0 0 6px; color: var(--text); font-size: 15px; font-weight: 600; }
.empty p { margin: 0 auto 16px; max-width: 440px; font-size: 14px; }
.skeleton { background: linear-gradient(90deg, #151518, #1b1b1f, #151518); background-size: 200% 100%; animation: sk 1.3s infinite; border-radius: var(--radius); }
@keyframes sk { to { background-position: -200% 0; } }
hr.sep { border: 0; height: 1px; background: var(--line); margin: 14px 0; }

/* ---------- лог / терминал ---------- */
.log {
  font-family: var(--mono); font-size: 12.5px; line-height: 1.6; color: #c9c9d2; white-space: pre-wrap; word-break: break-word;
  background: #09090b; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; max-height: 420px; overflow-y: auto; margin: 0;
}
.log .ok { color: var(--green); }
.log .err { color: var(--red); }
.log .warn { color: var(--amber); }
.log .hd { color: #8fb3ff; }

.stepper { display: grid; gap: 2px; align-content: start; }
.step { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 8px; color: var(--dim); font-size: 14px; }
.step .si { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--line-2); flex: none; }
.step .si svg { width: 13px; height: 13px; }
.step.running { color: var(--text); background: var(--surface-2); }
.step.running .si { border-color: transparent; }
.step.done { color: var(--text); }
.step.done .si { border-color: rgba(79, 201, 138, .5); color: var(--green); }
.step.error .si { border-color: rgba(229, 99, 111, .5); color: var(--red); }
.step.error { color: #f0a3aa; }
.step.skipped { opacity: .5; }

.meter { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width .5s ease; }
.meter.warn > i { background: var(--amber); }
.meter.bad > i { background: var(--red); }

@media (max-width: 900px) { .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) {
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .card { padding: 16px; }
  .table-wrap { margin: 0 -16px -16px; }
  .modal { padding: 18px; }
}
