/* DataHunter (PHP) — стили в духе дизайна v2: тёплая «бумага», чернильный
   «ink», узкий иконочный рейл, большая белая плашка контента, пастельные
   акценты (лаванда, крем, мята), pill-кнопки. Без Tailwind — один файл. */

:root {
  --paper: #F6F5F1;
  --ink: #17171C;
  --ink-soft: #4B4B54;
  --lav-50: #F0EEFD;
  --lav-100: #E7E3FC;
  --lav-200: #D6CFF8;
  --lav-400: #9C8FF4;
  --lav-500: #7B6CF0;
  --lav-600: #6453E4;
  --cream: #FBF0CE;
  --peach: #FFE4BD;
  --mint: #DCF2E4;
  --lime: #E6F5C5;
  --rose: #FCE4E4;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --red-500: #ef4444;
  --emerald-600: #059669;
  --amber-800: #92400e;
  --violet-700: #6d28d9;
  --orange-800: #9a3412;
  --card-radius: 28px;
  --shadow-card: 0 1px 2px rgba(23,23,28,.05), 0 8px 24px -12px rgba(23,23,28,.08);
  --font: 'Montserrat', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--paper);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
table { border-collapse: collapse; width: 100%; }

/* ---------- Каркас: рейл + контент ---------- */
.shell { display: flex; min-height: 100vh; }
.rail {
  position: sticky; top: 0; height: 100vh; width: 80px; flex-shrink: 0;
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 20px 0;
}
.rail-logo {
  width: 44px; height: 44px; margin-bottom: 24px; display: flex; align-items: center; justify-content: center;
  background: var(--ink); color: #fff; font-size: 20px; border-radius: 16px;
}
.rail a.item {
  width: 44px; height: 44px; margin-bottom: 4px; display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: var(--slate-400); border-radius: 16px; transition: all .15s;
}
.rail a.item:hover { background: #fff; color: var(--ink); box-shadow: var(--shadow-card); }
.rail a.item.active { background: var(--ink); color: #fff; box-shadow: var(--shadow-card); }
.rail .spacer { flex: 1; }

.content-wrap { flex: 1; min-width: 0; padding: 12px 12px 12px 0; display: flex; flex-direction: column; }
@media (min-width: 640px) { .content-wrap { padding: 20px 20px 20px 0; } }

.topbar { height: 56px; display: flex; align-items: center; gap: 12px; padding: 0 8px; }
.search-form { position: relative; width: 100%; max-width: 340px; }
.search-form .glass { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--slate-400); }
.search-form input {
  width: 100%; height: 44px; border-radius: 999px; border: 1px solid rgba(0,0,0,.06);
  background: #fff; padding: 0 16px 0 40px; font: inherit; box-shadow: var(--shadow-card); outline: none;
}
.topbar .right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.status-pill {
  display: none; align-items: center; gap: 8px; background: #fff; padding: 8px 16px;
  border-radius: 999px; font-size: 12px; font-weight: 600; box-shadow: var(--shadow-card);
}
@media (min-width: 768px) { .status-pill { display: inline-flex; } }
.status-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: #34d399; }
.user-pill {
  display: flex; align-items: center; gap: 10px; background: #fff; padding: 6px 16px 6px 6px;
  border-radius: 999px; box-shadow: var(--shadow-card);
}
.user-pill .avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--ink); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700;
}
.user-pill .email { display: none; font-size: 12px; font-weight: 600; }
@media (min-width: 640px) { .user-pill .email { display: block; } }

.plate {
  flex: 1; margin-top: 0; background: #fff; border: 1px solid rgba(23,23,28,.03);
  border-radius: var(--card-radius); padding: 20px; box-shadow: var(--shadow-card);
}
@media (min-width: 640px) { .plate { padding: 28px; } }

/* ---------- Кнопки / поля / бейджи ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: 999px; padding: 10px 20px; font: inherit; font-size: 14px;
  font-weight: 600; cursor: pointer; transition: all .15s; white-space: nowrap;
}
.btn:disabled { opacity: .45; pointer-events: none; }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: #000; }
.btn-secondary { background: #fff; color: var(--ink); border: 1px solid rgba(0,0,0,.08); }
.btn-secondary:hover { box-shadow: var(--shadow-card); }
.btn-danger { background: var(--rose); color: var(--red-500); }
.btn-danger:hover { background: #fdd; }
.btn-ghost { background: transparent; color: var(--slate-500); font-weight: 500; padding: 8px 12px; }
.btn-ghost:hover { background: rgba(0,0,0,.04); color: var(--ink); }
.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-amber { background: var(--cream); color: var(--amber-800); }
.btn-amber:hover { background: #f7e3ae; }

.input, select.input, textarea.input {
  width: 100%; border: 1px solid rgba(0,0,0,.08); background: #fff; border-radius: 16px;
  padding: 10px 16px; font: inherit; font-size: 14px; outline: none; transition: box-shadow .15s, border-color .15s;
}
.input:focus { border-color: rgba(23,23,28,.3); box-shadow: 0 0 0 4px var(--lav-100); }
textarea.input { min-height: 96px; resize: vertical; }
.label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 6px; }
.hint { font-size: 12px; color: var(--slate-400); margin-top: 6px; }

.badge {
  display: inline-flex; align-items: center; gap: 6px; border-radius: 999px;
  padding: 4px 12px; font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; }
.badge-queued, .badge-pending { background: var(--cream); color: var(--amber-800); } .badge-queued .dot, .badge-pending .dot { background: #f59e0b; }
.badge-running { background: var(--lav-100); color: var(--violet-700); } .badge-running .dot { background: var(--lav-500); animation: pulse 1.5s infinite; }
.badge-completed, .badge-sent, .badge-active { background: var(--mint); color: var(--emerald-600); } .badge-completed .dot, .badge-sent .dot, .badge-active .dot { background: #10b981; }
.badge-error, .badge-failed { background: var(--rose); color: var(--red-500); } .badge-error .dot, .badge-failed .dot { background: var(--red-500); }
.badge-paused { background: rgba(0,0,0,.06); color: var(--ink-soft); } .badge-paused .dot { background: var(--slate-400); }
.badge-temporarily_unavailable { background: var(--peach); color: var(--orange-800); } .badge-temporarily_unavailable .dot { background: #f97316; }
@keyframes pulse { 50% { opacity: .35; } }

.chip-lav { background: var(--lav-100); }
.chip-cream { background: var(--cream); }
.chip-mint { background: var(--mint); }
.chip { width: 40px; height: 40px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; font-size: 17px; }

/* ---------- Секции и таблицы ---------- */
.page-title { font-size: 28px; font-weight: 700; letter-spacing: -.02em; margin: 0; }
.page-sub { margin-top: 4px; font-size: 14px; font-weight: 500; color: var(--slate-400); max-width: 720px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 28px; }

.card { background: var(--paper); border-radius: 24px; }
.card-title { font-size: 17px; font-weight: 700; margin: 0; }
.card-sub { font-size: 12px; font-weight: 500; color: var(--slate-400); margin: 2px 0 0; }
.section { border-radius: 24px; padding: 24px; margin-bottom: 20px; }
.section-lime { background: var(--lime); }
.section-cream { background: var(--cream); }
.section-lav { background: var(--lav-100); }
.section-white { background: #fff; }

.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1100px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 720px) { .grid-3, .grid-4, .grid-2 { grid-template-columns: 1fr; } }

.source-tile {
  background: #fff; border-radius: 16px; padding: 20px; box-shadow: 0 1px 2px rgba(0,0,0,.04);
  transition: transform .15s, box-shadow .15s; display: block;
}
.source-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-card); }
.source-tile .num { font-size: 24px; font-weight: 700; margin-top: 4px; letter-spacing: -.02em; }

.task-row {
  display: flex; align-items: center; gap: 12px; background: #fff; padding: 14px;
  border-radius: 16px; box-shadow: 0 1px 2px rgba(0,0,0,.04); margin-bottom: 8px;
  transition: transform .15s, box-shadow .15s;
}
.task-row:hover { transform: translateY(-2px); box-shadow: var(--shadow-card); }
.task-row .tname { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-row .tsub { font-size: 12px; font-weight: 500; color: var(--slate-400); }

.table-wrap { overflow-x: auto; }
table.data { min-width: 900px; }
table.data th {
  text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--slate-400); padding: 14px 20px; border-bottom: 1px solid rgba(0,0,0,.05);
}
table.data td { padding: 16px 20px; font-size: 14px; border-bottom: 1px solid rgba(0,0,0,.04); }
table.data tbody tr { transition: background .1s; }
table.data tbody tr:hover { background: rgba(246,245,241,.7); }
table.data tbody tr:last-child td { border-bottom: none; }
.td-strong { font-weight: 600; }
.td-dim { color: var(--ink-soft); }
.td-mono { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 12px; }
.truncate { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nowrap { white-space: nowrap; }
a.link:hover { color: var(--lav-600); text-decoration: underline; }

.empty { padding: 56px 0; text-align: center; }
.empty .emoji { font-size: 28px; }
.empty p { color: var(--slate-400); font-size: 14px; }

/* pill-табы */
.pill-tabs { display: inline-flex; background: rgba(0,0,0,.05); border-radius: 999px; padding: 4px; gap: 2px; flex-wrap: wrap; }
.pill-tab {
  border: none; background: transparent; font: inherit; font-size: 14px; font-weight: 500;
  color: var(--slate-500); padding: 6px 16px; border-radius: 999px; cursor: pointer; transition: all .15s;
}
.pill-tab.active { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* фильтры-строка */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 18px; background: var(--paper); border-radius: 24px; margin-bottom: 20px; }
.filters .input { width: auto; min-width: 200px; }
.filters .input.q { max-width: 260px; }

/* шаги визарда */
.steps { display: flex; align-items: center; gap: 8px; max-width: 640px; margin-bottom: 28px; }
.steps .st { display: flex; align-items: center; gap: 8px; flex: 1; }
.steps .num {
  width: 36px; height: 36px; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; font-size: 13px; font-weight: 700; background: rgba(0,0,0,.06); color: var(--slate-400);
}
.steps .num.active { background: var(--ink); color: #fff; }
.steps .num.done { background: var(--mint); color: var(--emerald-600); }
.steps .lbl { display: none; font-size: 14px; }
@media (min-width: 640px) { .steps .lbl { display: block; } }
.steps .bar { flex: 1; height: 1px; background: rgba(0,0,0,.08); }

/* карточки выбора источника */
.src-card {
  border: 2px solid rgba(0,0,0,.06); background: #fff; border-radius: 24px; padding: 22px;
  text-align: left; font: inherit; cursor: pointer; transition: all .15s;
}
.src-card:hover { border-color: rgba(0,0,0,.2); }
.src-card.selected { border-color: var(--ink); background: var(--lav-50); }
.src-card .t { font-weight: 700; margin-top: 12px; font-size: 15px; }
.src-card .d { font-size: 13px; color: var(--slate-400); margin-top: 2px; }

/* плитки параметров задачи */
.param-tiles { display: grid; gap: 14px; grid-template-columns: repeat(2, 1fr); margin-bottom: 26px; }
@media (min-width: 1100px) { .param-tiles { grid-template-columns: repeat(4, 1fr); } }
.param-tile { border-radius: 24px; padding: 18px; }
.param-tile .lbl { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: rgba(23,23,28,.4); }
.param-tile .val { font-size: 14px; font-weight: 600; margin-top: 6px; line-height: 1.4; overflow-wrap: anywhere; }

/* логи */
.log-view { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 12px; }
.log-view .row { display: flex; gap: 16px; padding: 10px 20px; border-bottom: 1px solid rgba(0,0,0,.04); }
.log-view .ts { flex-shrink: 0; color: var(--slate-300); }
.log-view .lv { width: 64px; flex-shrink: 0; font-weight: 700; }
.log-view .lv.INFO { color: var(--slate-400); }
.log-view .lv.WARNING { color: #f59e0b; }
.log-view .lv.ERROR { color: var(--red-500); }
.log-view .msg { color: var(--ink-soft); white-space: pre-wrap; overflow-wrap: anywhere; }

/* сообщения (алерты) */
.alert { border-radius: 24px; padding: 18px 20px; margin-bottom: 18px; font-size: 14px; font-weight: 500; }
.alert-error { background: var(--rose); color: var(--red-500); }
.alert-ok { background: var(--mint); color: var(--emerald-600); }

/* форма входа/регистрации */
.auth-bg { position: relative; min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; overflow: hidden; }
.auth-bg .blob { position: absolute; border-radius: 50%; filter: blur(70px); pointer-events: none; }
.auth-bg .b1 { left: -140px; top: -140px; width: 380px; height: 380px; background: var(--lav-100); }
.auth-bg .b2 { right: -140px; bottom: -140px; width: 380px; height: 380px; background: var(--cream); }
.auth-bg .b3 { left: -80px; bottom: 60px; width: 260px; height: 260px; background: var(--mint); }
.auth-card { position: relative; width: 100%; max-width: 420px; background: var(--paper); border-radius: 28px; padding: 36px; }
.auth-logo {
  width: 56px; height: 56px; margin: 0 auto 16px; display: flex; align-items: center; justify-content: center;
  background: var(--ink); color: #fff; font-size: 24px; border-radius: 20px;
}
.auth-title { text-align: center; font-size: 22px; font-weight: 700; margin: 0; }
.auth-sub { text-align: center; font-size: 14px; color: var(--slate-400); margin: 4px 0 0; }
.field { margin-bottom: 16px; }

/* дашборд: сводка справа */
.summary dl { margin: 16px 0 0; font-size: 14px; }
.summary .row { display: flex; justify-content: space-between; padding: 9px 14px; border-radius: 14px; background: rgba(255,255,255,.55); margin-bottom: 8px; }
.summary dt { color: var(--slate-400); }
.summary dd { font-weight: 700; margin: 0; }

.next-run-box { background: rgba(255,255,255,.7); border-radius: 16px; padding: 16px; margin-top: 18px; }
.next-run-box .lbl { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: rgba(23,23,28,.4); }
.next-run-box .val { font-size: 14px; font-weight: 700; margin-top: 4px; }
.dark-promo { background: var(--ink); color: #fff; border-radius: 24px; padding: 24px; }
.dark-promo p { color: rgba(255,255,255,.6); font-size: 14px; }
.dark-promo .go {
  margin-top: 18px; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.15); border-radius: 50%; transition: background .15s;
}
.dark-promo .go:hover { background: rgba(255,255,255,.28); }

/* график */
.chart-legend { display: flex; gap: 18px; margin-top: 12px; font-size: 12px; font-weight: 500; color: var(--ink-soft); align-items: center; }
.chart-legend .sw { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 6px; vertical-align: -1px; }

/* настройки */
.kv { display: flex; justify-content: space-between; align-items: center; background: var(--paper); padding: 12px 16px; border-radius: 14px; margin-bottom: 10px; font-size: 14px; }
.kv .k { color: var(--slate-400); }
.kv .v { font-weight: 600; }
code.inline { background: var(--paper); padding: 2px 7px; border-radius: 6px; font-family: ui-monospace, Consolas, monospace; font-size: 12px; }

/* устаноdщик */
.install-box { max-width: 640px; margin: 40px auto; background: #fff; border-radius: 28px; padding: 36px; box-shadow: var(--shadow-card); }
.install-box h1 { margin-top: 0; }
.check-ok { color: var(--emerald-600); }
.check-fail { color: var(--red-500); }
pre.config { background: var(--paper); padding: 16px; border-radius: 14px; overflow-x: auto; font-size: 12px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.muted { color: var(--slate-400); }
.small { font-size: 12px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.mt-1 { margin-top: 6px; }
.mt-4 { margin-top: 24px; }
.mb-4 { margin-bottom: 24px; }

/* чек-лист установщика */
.install-box .check-ok, .install-box .check-fail { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; font-weight: 600; padding: 6px 0; }
.install-box .check-ok .note, .install-box .check-fail .note { color: var(--slate-400); font-weight: 500; text-align: right; }
