/* Менеджер сайтов — строгая тёмная тема в стиле дашборда zv-ai */
:root {
  --bg: #0e1116;
  --panel: #141a22;
  --panel-2: #171e28;
  --border: #232c38;
  --border-2: #2c3746;
  --text: #e6eaf0;
  --muted: #8b98a9;
  --dim: #5b6675;
  --accent: #5e81ac;
  --accent-h: #7397bd;
  --accent-dim: rgba(94, 129, 172, 0.14);
  --ok: #77a06b;
  --err: #c26d6d;
  --warn: #c2a26d;
  --radius: 10px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.mono { font-family: ui-monospace, "SF Mono", Consolas, monospace; }

/* ---------- логотип ---------- */
.logo {
  width: 52px; height: 52px; border: 4px solid var(--accent); border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 22px; color: var(--text); letter-spacing: 0.5px;
}
.logo.small { width: 34px; height: 34px; border-width: 3px; border-radius: 10px; font-size: 15px; }

/* ---------- вход ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card {
  width: 360px; max-width: 100%; background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 36px 32px; text-align: center;
}
.login-card .logo { margin: 0 auto 20px; }
.login-card h1 { font-size: 18px; font-weight: 600; margin-bottom: 6px; }
.login-card .sub { color: var(--muted); font-size: 12.5px; margin-bottom: 24px; }
.login-card .input { margin-bottom: 12px; }
.login-card .btn { padding: 10px; }

/* ---------- шапка ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 28px; background: var(--panel); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-title { font-size: 15px; font-weight: 600; }
.brand-sub { font-size: 12px; color: var(--muted); }
.top-actions { display: flex; gap: 10px; }

.container { max-width: 1080px; margin: 0 auto; padding: 28px 28px 48px; }

/* ---------- панель и таблица ---------- */
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.panel-head h2 { font-size: 15px; font-weight: 600; }
.input {
  background: var(--panel-2); border: 1px solid var(--border-2); border-radius: 7px;
  color: var(--text); padding: 8px 12px; font-size: 13.5px; outline: none; width: 100%;
}
.input:focus { border-color: var(--accent); }
.input.search { width: 220px; }
.table-wrap { overflow-x: auto; }
table.sites { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.sites th {
  text-align: left; color: var(--muted); font-weight: 500; font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.4px;
  padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.sites th.num, table.sites td.num { text-align: left; }
table.sites td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.sites tbody tr:last-child td { border-bottom: none; }
table.sites tbody tr:hover { background: var(--accent-dim); }
.site-name { font-weight: 600; }
.site-domain { color: var(--muted); font-size: 12.5px; }
.site-domain a { color: var(--muted); text-decoration: none; }
.site-domain a:hover { color: var(--accent-h); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; background: var(--dim); }
.dot.ok { background: var(--ok); }
.dot.err { background: var(--err); }
.dot.warn { background: var(--warn); }
.http-code { font-weight: 600; }
.http-code.ok { color: var(--ok); }
.http-code.err { color: var(--err); }
td.th-actions, .th-actions { text-align: right; white-space: nowrap; }
.row-actions { display: flex; gap: 8px; justify-content: flex-end; }
.empty { padding: 36px 20px; text-align: center; color: var(--muted); }
.empty span { font-size: 12.5px; color: var(--dim); }
.hint { color: var(--dim); font-size: 12.5px; margin-top: 14px; text-align: center; }

/* ---------- кнопки ---------- */
.btn {
  border: 1px solid var(--border-2); background: var(--panel-2); color: var(--text);
  border-radius: 7px; padding: 8px 14px; font-size: 13.5px; cursor: pointer;
  font-family: inherit; transition: background 0.15s, border-color 0.15s;
}
.btn:hover { border-color: var(--accent); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.accent:hover { background: var(--accent-h); border-color: var(--accent-h); }
.btn.ghost { background: transparent; }
.btn.danger { background: transparent; border-color: var(--err); color: var(--err); font-weight: 600; }
.btn.danger:hover { background: rgba(194, 109, 109, 0.12); }
.btn.wide { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.linklike { background: none; border: none; color: var(--accent-h); cursor: pointer; font: inherit; text-decoration: underline; }
.row-actions .btn { padding: 5px 10px; font-size: 12.5px; }

/* ---------- диалоги ---------- */
.dlg {
  background: var(--panel); color: var(--text); border: 1px solid var(--border-2);
  border-radius: 12px; padding: 26px 28px; width: 560px; max-width: calc(100vw - 32px);
}
.dlg::backdrop { background: rgba(4, 6, 10, 0.72); }
.dlg h3 { font-size: 16px; font-weight: 600; margin-bottom: 18px; }
.dlg .field { margin-bottom: 16px; }
.dlg label { display: block; color: var(--muted); font-size: 12.5px; margin-bottom: 7px; }
.domain-preview {
  display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 13px;
  background: var(--panel-2); border: 1px solid var(--border-2); border-radius: 7px; padding: 8px 12px;
}
.pv-name { font-family: ui-monospace, "SF Mono", Consolas, monospace; color: var(--text); }
.pv-suffix { color: var(--dim); font-family: ui-monospace, "SF Mono", Consolas, monospace; }
.pv-state { margin-left: auto; font-size: 12.5px; }
.pv-state.ok { color: var(--ok); }
.pv-state.err { color: var(--err); }
.error { color: var(--err); font-size: 12.5px; margin-top: 8px; }

.mode-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mode-card {
  display: flex; flex-direction: column; gap: 3px; cursor: pointer;
  border: 1px solid var(--border-2); border-radius: 8px; padding: 12px;
  background: var(--panel-2); transition: border-color 0.15s, background 0.15s;
}
.mode-card input { position: absolute; opacity: 0; pointer-events: none; }
.mode-card:has(input:checked) { border-color: var(--accent); background: var(--accent-dim); }
.mode-title { font-size: 13.5px; font-weight: 600; color: var(--text); }
.mode-desc { font-size: 11.5px; color: var(--muted); line-height: 1.4; }

.dropzone {
  border: 1px dashed var(--border-2); border-radius: 8px; padding: 22px;
  text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 16px;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone.drag { border-color: var(--accent); background: var(--accent-dim); }
.dropzone .dz-icon {
  width: 34px; height: 34px; margin: 0 auto 10px; border-radius: 8px;
  background: var(--accent-dim); position: relative;
}
.dropzone .dz-icon::before {
  content: ""; position: absolute; left: 50%; top: 50%; width: 14px; height: 14px;
  transform: translate(-50%, -50%) rotate(45deg);
  border-right: 2px solid var(--accent-h); border-bottom: 2px solid var(--accent-h);
}
.dz-info { margin-top: 10px; font-size: 12.5px; color: var(--text); }

.check { display: flex !important; align-items: center; gap: 9px; color: var(--text) !important; font-size: 13.5px !important; margin: 4px 0 14px !important; cursor: pointer; }
.check input { width: 15px; height: 15px; accent-color: var(--accent); }
.steps-hint {
  font-size: 12px; color: var(--dim); background: var(--panel-2);
  border: 1px solid var(--border); border-radius: 7px; padding: 10px 12px; line-height: 1.5;
}

/* ---------- прогресс ---------- */
.progress { display: flex; flex-direction: column; gap: 2px; margin: 6px 0 14px; }
.stage { display: flex; align-items: center; gap: 10px; padding: 7px 4px; font-size: 13.5px; }
.st-ico { width: 18px; height: 18px; flex: none; border-radius: 50%; position: relative; }
.stage.st-pending { color: var(--dim); }
.stage.st-pending .st-ico { border: 2px solid var(--border-2); }
.stage.st-running { color: var(--text); }
.stage.st-running .st-ico {
  border: 2px solid var(--border-2); border-top-color: var(--accent); animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.stage.st-done { color: var(--text); }
.stage.st-done .st-ico { background: var(--ok); }
.stage.st-done .st-ico::after {
  content: ""; position: absolute; left: 5px; top: 2px; width: 4px; height: 8px;
  border-right: 2px solid #0e1116; border-bottom: 2px solid #0e1116; transform: rotate(45deg);
}
.stage.st-error { color: var(--err); }
.stage.st-error .st-ico { background: var(--err); }
.stage.st-error .st-ico::after {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 9px; height: 2px; background: #0e1116; transform: translate(-50%, -50%) rotate(45deg);
}
.stage.st-skipped { color: var(--dim); }
.stage.st-skipped .st-ico { border: 2px solid var(--border-2); }
.stage.st-skipped .st-ico::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 8px; height: 2px;
  background: var(--dim); transform: translate(-50%, -50%);
}
.st-title { flex: none; width: 218px; }
.st-msg { color: var(--muted); font-size: 12.5px; }
.stage.st-error .st-msg, .stage.st-error .st-title { color: var(--err); }

.upl { margin-bottom: 14px; }
.upl-label { color: var(--muted); font-size: 12.5px; margin-bottom: 6px; }
.upl-bar { height: 6px; background: var(--panel-2); border-radius: 4px; overflow: hidden; border: 1px solid var(--border-2); }
.upl-fill { height: 100%; width: 0; background: var(--accent); transition: width 0.2s; }

.result { margin-top: 8px; }
.result .ok-box {
  border: 1px solid var(--ok); background: rgba(119, 160, 107, 0.1);
  border-radius: 8px; padding: 14px 16px; font-size: 13.5px; line-height: 1.6;
}
.result .err-box {
  border: 1px solid var(--err); background: rgba(194, 109, 109, 0.1);
  border-radius: 8px; padding: 14px 16px; font-size: 13.5px; line-height: 1.6;
}
.result a { color: var(--accent-h); font-weight: 600; text-decoration: none; }
.result a:hover { text-decoration: underline; }

.dlg-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.del-desc { color: var(--muted); font-size: 13px; margin-bottom: 14px; line-height: 1.55; }

/* ---------- тост ---------- */
.toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 50;
  background: var(--panel-2); border: 1px solid var(--border-2); border-left: 3px solid var(--accent);
  border-radius: 8px; padding: 12px 16px; max-width: 360px; font-size: 13px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}
.toast.error { border-left-color: var(--err); }
.toast.ok { border-left-color: var(--ok); }

/* ---------- мобильная версия ---------- */
@media (max-width: 720px) {
  .topbar { padding: 12px 16px; }
  .container { padding: 18px 12px 32px; }
  .panel-head { flex-direction: column; align-items: stretch; gap: 10px; }
  .input.search { width: 100%; }
  .mode-cards { grid-template-columns: 1fr; }
  .st-title { width: 150px; }
  .top-actions .btn { padding: 7px 10px; font-size: 12.5px; }
  table.sites th:nth-child(2), table.sites td:nth-child(2),
  table.sites th:nth-child(4), table.sites td:nth-child(4),
  table.sites th:nth-child(5), table.sites td:nth-child(5) { display: none; }
}

/* Центрирование <dialog> (глобальный сброс margin убивает дефолт) */
dialog.dlg { margin: auto; margin-top: 6vh; margin-bottom: 6vh; }
/* Карточки режимов: строго колонка, поверх .dlg label */
label.mode-card { display: flex !important; flex-direction: column; }

/* Мобильная компоновка таблицы: компактнее, действия помещаются */
@media (max-width: 720px) {
  table.sites td, table.sites th { padding: 10px 8px; }
  .row-actions .btn { padding: 5px 7px; font-size: 11.5px; }
}

/* Мобильная компоновка таблицы: компактнее, действия помещаются */
@media (max-width: 720px) {
  table.sites td, table.sites th { padding: 10px 8px; }
  .row-actions .btn { padding: 5px 7px; font-size: 11.5px; }
}
