/* Панель платформы Click4you — без внешних зависимостей и CDN (ТЗ п.1.1). */

:root {
    --bg: #f1f5f9;
    --panel: #ffffff;
    --ink: #0f172a;
    --ink-soft: #64748b;
    --line: #e2e8f0;
    --brand: #0f4c81;
    --brand-ink: #ffffff;
    --danger: #b91c1c;
    --ok-bg: #ecfdf5;
    --ok-ink: #065f46;
    --err-bg: #fef2f2;
    --err-ink: #991b1b;
    --side-bg: #101827;
    --side-ink: #cbd5e1;
    --side-active: #1d4ed8;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font: 14px/1.5 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
    color: var(--ink);
    background: var(--bg);
}

.shell { display: flex; min-height: 100vh; }

/* --- Сайдбар --- */
.sidebar {
    width: 232px;
    flex: 0 0 232px;
    background: var(--side-bg);
    color: var(--side-ink);
    padding: 18px 0;
}

.brand {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 0 16px 16px;
    border-bottom: 1px solid #1f2937;
}

.brand-mark {
    background: var(--brand);
    color: var(--brand-ink);
    font-weight: 700;
    border-radius: 8px;
    padding: 6px 8px;
    font-size: 13px;
    letter-spacing: .5px;
}

.brand-name { font-size: 13px; line-height: 1.3; color: #e2e8f0; }

.nav { padding: 10px 8px; }

.nav-group {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: #6b7280;
    padding: 14px 8px 4px;
}

.nav a {
    display: block;
    color: var(--side-ink);
    text-decoration: none;
    padding: 7px 10px;
    border-radius: 6px;
    font-size: 13px;
}

.nav a:hover { background: #1f2937; color: #f8fafc; }
.nav a.active { background: var(--side-active); color: #fff; }

/* --- Основная область --- */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    padding: 12px 24px;
}

.topbar-title { font-size: 17px; font-weight: 600; }

.topbar-user { display: flex; align-items: center; gap: 12px; }
.user-name { font-weight: 600; }
.user-role { color: var(--ink-soft); font-size: 12px; }

.content { padding: 24px; max-width: 1200px; width: 100%; }

/* --- Карточки-счётчики --- */
.cards { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 22px; }

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 14px 18px;
    min-width: 150px;
}

.card-label { color: var(--ink-soft); font-size: 12px; }
.card-value { font-size: 26px; font-weight: 700; margin-top: 2px; }
.card-sub { color: var(--ink-soft); font-size: 12px; }

/* --- Панели/таблицы --- */
.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 18px 20px;
    margin-bottom: 20px;
}

.panel.narrow { max-width: 520px; }

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.panel-head h2 { margin: 0; font-size: 16px; }

.table { width: 100%; border-collapse: collapse; }
.table th {
    text-align: left;
    font-size: 12px;
    color: var(--ink-soft);
    font-weight: 600;
    border-bottom: 1px solid var(--line);
    padding: 8px 10px;
}
.table td { border-bottom: 1px solid var(--line); padding: 9px 10px; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .empty { color: var(--ink-soft); text-align: center; padding: 22px; }

.row-actions { display: flex; gap: 12px; align-items: center; justify-content: flex-end; white-space: nowrap; }
.row-actions a { color: var(--brand); }
.link-danger {
    background: none;
    border: 0;
    padding: 0;
    color: var(--danger);
    cursor: pointer;
    font: inherit;
}

/* --- Формы --- */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 12px; color: var(--ink-soft); margin-bottom: 5px; }

input[type="text"], input[type="email"], input[type="password"], select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 8px 10px;
    font: inherit;
    background: #fff;
    color: var(--ink);
}

input:focus, select:focus { outline: 2px solid #bfdbfe; border-color: var(--brand); }

.check { display: flex; gap: 8px; align-items: center; margin: 4px 0 16px; }

.form-actions { display: flex; gap: 10px; margin-top: 18px; }

.btn {
    display: inline-block;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    border-radius: 7px;
    padding: 8px 14px;
    font: inherit;
    cursor: pointer;
    text-decoration: none;
}

.btn:hover { background: #f8fafc; }

.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: #0d3f6b; }

.btn-ghost { border-color: transparent; color: var(--ink-soft); padding: 4px 10px; }
.btn-ghost:hover { color: var(--danger); background: var(--err-bg); }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; }

.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-input { width: auto; min-width: 160px; }

/* --- Уведомления --- */
.alert { border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; font-size: 13px; }
.alert-success { background: var(--ok-bg); color: var(--ok-ink); }
.alert-error { background: var(--err-bg); color: var(--err-ink); }

/* --- Этапы воронки (мини-канбан на дашборде) --- */
.stages { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }

.stage {
    min-width: 130px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    background: #f8fafc;
}

.stage-won { background: var(--ok-bg); border-color: #a7f3d0; }
.stage-lost { background: var(--err-bg); border-color: #fecaca; }
.stage-name { font-size: 12px; color: var(--ink-soft); }
.stage-count { font-size: 22px; font-weight: 700; }

/* --- Стаб раздела --- */
.stub { text-align: center; padding: 60px 20px; }
.stub h1 { margin: 12px 0 8px; }
.stub p { color: #334155; max-width: 560px; margin: 0 auto 6px; }
.stub-phase {
    display: inline-block;
    background: #e0e7ff;
    color: #3730a3;
    border-radius: 999px;
    font-size: 12px;
    padding: 3px 12px;
}

.hint { color: var(--ink-soft); font-size: 12px; }
code {
    background: #eef2f7;
    border-radius: 4px;
    padding: 1px 5px;
    font-size: 12px;
}

.todo { margin: 0; padding-left: 18px; }
.todo li { margin-bottom: 6px; }

/* --- Пагинация --- */
.pagination { display: flex; gap: 14px; align-items: center; margin-top: 14px; color: var(--ink-soft); }
.pagination a { color: var(--brand); text-decoration: none; font-weight: 600; }
.pagination .disabled { color: #cbd5e1; }

/* --- Логин --- */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--side-bg);
}

/* --- Периоды (вкладки) --- */
.page-head { margin-bottom: 18px; }

.tabs { display: inline-flex; background: #e2e8f0; border-radius: 8px; padding: 3px; }
.tabs a {
    padding: 6px 14px;
    border-radius: 6px;
    color: var(--ink-soft);
    text-decoration: none;
    font-size: 13px;
}
.tabs a.active { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgb(15 23 42 / .1); }

/* --- Дашборд: колонки, бары --- */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 1100px) { .two-col { grid-template-columns: 1fr; } }

.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.bar-label { width: 80px; color: var(--ink-soft); font-size: 12px; }
.bar { flex: 1; background: #eef2f7; border-radius: 999px; height: 10px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
.bar-value { width: 40px; text-align: right; font-weight: 600; font-size: 12px; }

.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.badge { border-radius: 6px; padding: 2px 8px; font-size: 12px; font-weight: 600; }
.badge-err { background: var(--err-bg); color: var(--err-ink); }
.src { font-size: 12px; color: var(--ink-soft); overflow-wrap: anywhere; }
.src .cnt { color: var(--err-ink); font-weight: 600; }

.login-card {
    width: 360px;
    background: #fff;
    border-radius: 12px;
    padding: 30px 28px;
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    margin-bottom: 20px;
}
