/* CESP-MARKETING — базовая стилизация. Брендбук 2026-10-17: морская волна #1f6f78, янтарь #f59e0b, Inter. */
@import url('/static/fonts/inter.css');
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: Inter, system-ui, -apple-system, sans-serif;
    margin: 0;
    padding: 0;
    background: #f5f7f7;
    color: #1f2937;
    font-variant-numeric: tabular-nums;
    font-size: 15px;
    line-height: 1.5;
}

/* ── App header ───────────────────────────────────────────────────────── */
.app-header {
    background: #1f6f78;
    color: #fff;
}

/* Top bar: brand · email · logout */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 48px;
    padding: 0 24px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}

.nav-brand-sub { font-weight: 400; color: rgba(255,255,255,0.72); font-size: 0.8rem; margin-left: 0.4rem; }
.nav-brand {
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: -0.01em;
    white-space: nowrap;
    flex-shrink: 0;
}

.topbar-user {
    color: rgba(255,255,255,0.75);
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    text-align: center;
}

/* Logout — overrides the global button[type="submit"] rule */
.app-header .topbar .btn-logout {
    -webkit-appearance: none;
    appearance: none;
    display: inline-block;
    width: auto;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.55);
    border-radius: 6px;
    padding: 4px 12px;
    margin: 0;
    font-size: 0.8rem;
    font-weight: 500;
    color: #fff;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    flex-shrink: 0;
}
.app-header .topbar .btn-logout:hover {
    background: #fff;
    border-color: #fff;
    color: #175860;
}

/* Nav groups: equal cards, icon + title, links stacked as buttons,
   long lists scroll inside their own card */
.nav-groups {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(176px, 1fr));
    gap: 10px;
    padding: 12px 24px 14px;
    align-items: start;
    background: #eef3f3;                 /* брендбук: панель разделов светлая, тёмная только верхняя полоса */
    border-bottom: 1px solid #dde4e5;
}
.nav-group {
    background: #ffffff;
    border: 1px solid #dde4e5;
    border-radius: 8px;
    padding: 8px 8px 8px;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.nav-group-title {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.72rem;
    font-weight: 600;
    color: #175860;
    margin: 0 4px 6px;
    padding-bottom: 6px;
    border-bottom: 1px solid #e3e7e8;
    white-space: nowrap;
}
.nav-ico { width: 16px; height: 16px; flex-shrink: 0; color: #1f6f78; }
.nav-links {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 176px;          /* ~7 rows; longer lists scroll in place */
    padding-right: 2px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #c9d3d4 transparent;
}
.nav-link {
    display: block;
    flex: 0 0 auto;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    line-height: 1.35;
    color: #374151;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background 0.12s, color 0.12s;
}
.nav-link:hover { background: #e3f1f2; color: #175860; }
.nav-link.nav-active { background: #1f6f78; color: #fff; font-weight: 600; }

@media (max-width: 768px) {
    .nav-groups { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; padding: 10px 12px 12px; }
    .topbar { padding: 0 12px; }
}

/* Main content */
main { max-width: 1280px; margin: 2rem auto; padding: 0 1.5rem; }

h1 { font-size: 1.5rem; margin: 0 0 1.25rem; }

/* Login */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f4f5f7;
}
.login-box {
    background: #fff;
    padding: 2.5rem 2rem;
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 360px;
}
.login-box h1 { margin-top: 0; font-size: 1.4rem; text-align: center; }

label { display: block; margin-bottom: 1rem; font-size: 0.875rem; color: #444; }
label input {
    display: block;
    width: 100%;
    margin-top: 0.3rem;
    padding: 0.55rem 0.75rem;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.15s;
}
label input:focus { border-color: #1f6f78; outline: 2px solid rgba(245,158,11,0.45); outline-offset: 1px; }

/* Only style bare submit buttons (not those that carry a .btn class) */
button[type="submit"]:not(.btn) {
    width: 100%;
    padding: 0.65rem;
    background: #1f6f78;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    cursor: pointer;
    margin-top: 0.5rem;
    transition: background 0.15s;
}
button[type="submit"]:not(.btn):hover { background: #175860; }

.error { color: #c00; font-size: 0.875rem; margin-bottom: 1rem; }

/* Dashboard cards */
.info-card { background: #fff; border-radius: 8px; padding: 1.25rem 1.5rem; margin-bottom: 1.5rem; box-shadow: 0 1px 4px rgba(0,0,0,0.07); }
.info-grid { display: grid; grid-template-columns: max-content 1fr; gap: 0.4rem 1.25rem; margin: 0; }
.info-grid dt { font-weight: 600; color: #555; }
.info-grid dd { margin: 0; }
.section-links { display: flex; gap: 1rem; flex-wrap: wrap; }
.section-card { background: #fff; border-radius: 8px; padding: 1rem 1.5rem; text-decoration: none; color: #1f2937; font-weight: 600; box-shadow: 0 1px 4px rgba(0,0,0,0.07); transition: box-shadow 0.15s; }
.section-card:hover { box-shadow: 0 2px 10px rgba(0,0,0,0.13); }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,0.07); }
th { background: #f0f1f5; font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; padding: 0.65rem 1rem; text-align: left; color: #555; }
td { padding: 0.65rem 1rem; border-top: 1px solid #eee; font-size: 0.875rem; vertical-align: middle; }
tr:hover td { background: #fafbff; }

/* Badges */
.badge { display: inline-block; padding: 0.2em 0.6em; border-radius: 20px; font-size: 0.75rem; font-weight: 600; line-height: 1; }
.badge-green { background: #d1fae5; color: #065f46; }
.badge-gray  { background: #e5e7eb; color: #374151; }
.badge-blue  { background: #dbeafe; color: #1e40af; }
.badge-amber { background: #fef3c7; color: #92400e; }
/* Modal (transcript popup on /crm/calls) */
.mayak-modal { border: 0; border-radius: 12px; padding: 0; width: min(900px, 94vw); max-height: 88vh; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.mayak-modal::backdrop { background: rgba(16,24,40,.45); }
.mayak-modal-head { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .75rem 1rem; border-bottom: 1px solid #e4e7ec; background: #f8f9fb; position: sticky; top: 0; }
.mayak-modal-body { padding: 1rem; overflow: auto; max-height: calc(88vh - 3.5rem); background: #f5f6f8; }
.mayak-modal-body .detail-card { box-shadow: none; }

/* Phone kind dots (virtual / real / unknown) — hover for explanation */
.pdot { display: inline-block; width: 0.7em; height: 0.7em; border-radius: 50%; vertical-align: middle; margin-left: 0.25em; cursor: help; box-shadow: 0 0 0 2px #fff; }
.pdot-virtual { background: #2563eb; }
.pdot-real    { background: #d97706; }
.pdot-unknown { background: #9ca3af; }

/* Alerts */
.alert { padding: 0.75rem 1rem; border-radius: 6px; margin-bottom: 1.25rem; font-size: 0.875rem; }
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }

/* Form elements */
.form-card { background: #fff; border-radius: 8px; padding: 1.75rem 2rem; box-shadow: 0 1px 4px rgba(0,0,0,0.07); max-width: 560px; }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.875rem; font-weight: 600; color: #444; margin-bottom: 0.3rem; }
.form-group input,
.form-group select,
.form-group textarea { width: 100%; padding: 0.55rem 0.75rem; border: 1px solid #d0d5dd; border-radius: 6px; font-size: 0.9rem; outline: none; transition: border-color 0.15s; background: #fff; }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: #1f6f78; }
.form-check { display: flex; align-items: center; gap: 0.5rem; }
.form-check input[type="checkbox"] { width: auto; }

/* Buttons */
.btn { display: inline-block; padding: 0.55rem 1.1rem; border-radius: 6px; font-size: 0.875rem; font-weight: 600; text-decoration: none; cursor: pointer; border: none; transition: background 0.15s, color 0.15s; }
.btn-primary { background: #1f6f78; color: #fff; }
.btn-primary:hover { background: #175860; }
.btn-secondary { background: #e5e7eb; color: #374151; }
.btn-secondary:hover { background: #d1d5db; }
.btn-danger { background: #fee2e2; color: #991b1b; }
.btn-danger:hover { background: #fca5a5; }

/* Page header row */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.page-header h1 { margin: 0; }

/* Detail grid */
.detail-card { background: #fff; border-radius: 8px; padding: 1.5rem; box-shadow: 0 1px 4px rgba(0,0,0,0.07); max-width: 640px; margin-bottom: 1.5rem; }
.detail-grid { display: grid; grid-template-columns: max-content 1fr; gap: 0.5rem 1.5rem; }
.detail-grid dt { font-weight: 600; color: #555; font-size: 0.875rem; }
.detail-grid dd { margin: 0; font-size: 0.875rem; }
.action-row { display: flex; gap: 0.75rem; flex-wrap: wrap; }

/* Active nav link — handled by .nav-link.nav-active above */

/* Pagination */
.pagination { display: flex; align-items: center; gap: 0.75rem; margin-top: 1.25rem; }
.pagination-info { font-size: 0.875rem; color: #555; }

/* Empty state */
.empty-state { background: #fff; border-radius: 8px; padding: 2.5rem 2rem; text-align: center; box-shadow: 0 1px 4px rgba(0,0,0,0.07); }
.empty-state p { color: #555; margin: 0 0 1rem; font-size: 0.95rem; }

/* Compact tables */
.table-compact th { padding: 0.45rem 0.75rem; font-size: 0.75rem; }
.table-compact td { padding: 0.45rem 0.75rem; font-size: 0.825rem; }

/* Page tools (limit selector row) */
.page-tools { display: flex; align-items: center; justify-content: flex-end; margin-bottom: 0.6rem; gap: 1rem; }
.page-size-form { display: inline-flex; align-items: center; }
.page-size-form select { padding: 0.25rem 0.4rem; border: 1px solid #d0d5dd; border-radius: 5px; font-size: 0.8rem; background: #fff; cursor: pointer; }

/* Utility classes */
.muted-small { font-size: 0.8rem; color: #888; }
.nowrap { white-space: nowrap; }
.truncate { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Dashboard v0.1.23.1 ──────────────────────────────────────────────── */
.dashboard-page { max-width: 1400px; }

.dashboard-subtitle {
    color: #5b6475;
    font-size: 0.95rem;
    margin-top: -0.75rem;
    margin-bottom: 1.5rem;
}

/* KPI top grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.metric-card {
    display: block;
    background: #fff;
    border-radius: 14px;
    padding: 18px 20px 16px;
    box-shadow: 0 2px 8px rgba(15,23,42,0.08);
    text-decoration: none;
    color: inherit;
    transition: transform 0.15s, box-shadow 0.15s;
}
.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(15,23,42,0.13);
}

.metric-value {
    font-size: 28px;
    line-height: 1.1;
    font-weight: 800;
    color: #0b1028;
}
.metric-value.accent { color: #065f46; }

.metric-label {
    margin-top: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    color: #2f3747;
}

.metric-extra {
    margin-top: 4px;
    font-size: 0.78rem;
    color: #6b7280;
}

/* Detail sections */
.metric-section {
    background: #fff;
    border-radius: 14px;
    padding: 18px 20px 20px;
    box-shadow: 0 2px 8px rgba(15,23,42,0.08);
    margin-bottom: 18px;
}

.metric-section-header {
    margin: 0 0 14px;
    font-size: 1rem;
    font-weight: 700;
    color: #1f2937;
    letter-spacing: -0.01em;
}

.metric-mini-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}

.metric-mini {
    background: #f6f7fb;
    border-radius: 10px;
    padding: 12px 14px;
}
.metric-mini .metric-value { font-size: 1.5rem; }
.metric-mini .metric-label { font-size: 0.78rem; margin-top: 4px; }

/* Quick actions */
.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 4px;
}

.quick-action {
    display: inline-flex;
    align-items: center;
    padding: 9px 16px;
    border-radius: 10px;
    background: #e9ecf3;
    color: #0b1028;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 700;
    transition: background 0.15s, color 0.15s;
}
.quick-action:hover { background: #d4d8e4; }
.quick-action.primary { background: #1f6f78; color: #fff; }
.quick-action.primary:hover { background: #175860; }

@media (max-width: 600px) {
    .dashboard-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
    .metric-value { font-size: 22px; }
    .metric-mini-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
}

/* ── Client Timeline ─────────────────────────────────────────────────────── */
.timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
    overflow: hidden;
}
.timeline-item {
    display: grid;
    grid-template-columns: 110px 120px 1fr auto;
    gap: 0.5rem 1rem;
    align-items: start;
    padding: 0.7rem 1rem;
    border-bottom: 1px solid #f0f1f5;
    font-size: 0.85rem;
}
.timeline-item:last-child { border-bottom: none; }
.timeline-item:hover { background: #fafbff; }
.timeline-date {
    color: #888;
    font-size: 0.78rem;
    white-space: nowrap;
    padding-top: 0.1rem;
}
.timeline-type { padding-top: 0.05rem; }
.timeline-title {
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.15rem;
}
.timeline-description {
    color: #555;
    font-size: 0.8rem;
    line-height: 1.4;
}
.timeline-action { white-space: nowrap; padding-top: 0.05rem; }
@media (max-width: 768px) {
    .timeline-item {
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto auto;
    }
    .timeline-date { grid-column: 1; }
    .timeline-type { grid-column: 2; grid-row: 1; }
    .timeline-title { grid-column: 1 / -1; }
    .timeline-description { grid-column: 1 / -1; }
    .timeline-action { grid-column: 1 / -1; }
}

/* ── Client Quality Dashboard ───────────────────────────────────────────── */
.quality-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px;
    margin: 22px 0 28px;
}
.quality-kpi-card {
    background: #fff;
    border-radius: 14px;
    padding: 16px 18px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
    border-left: 4px solid transparent;
}
.quality-kpi-card.warning {
    border-left-color: #d97706;
}
.quality-kpi-label {
    font-size: 14px;
    color: #5b6475;
    margin-bottom: 8px;
}
.quality-kpi-value {
    font-size: 28px;
    line-height: 1.1;
    font-weight: 800;
    color: #0b1028;
}
.quality-section {
    margin-top: 28px;
}
.quality-section h2 {
    display: flex;
    align-items: baseline;
    gap: 10px;
    font-size: 1.05rem;
    margin-bottom: 0.75rem;
}
.quality-count {
    font-size: 15px;
    color: #5b6475;
    font-weight: 700;
}
.table-note { font-size: 0.8rem; color: #888; margin-top: 0.5rem; }
.section-note { font-size: 0.82rem; color: #666; margin-bottom: 0.75rem; }

/* ── Client Quality Actions ─────────────────────────────────────────────── */
.quality-action-cell { white-space: nowrap; }
.quality-action-form { display: inline-flex; align-items: center; gap: 4px; }
.quality-action-select {
    font-size: 0.78rem;
    padding: 3px 6px;
    border: 1px solid #ccc;
    border-radius: 4px;
    max-width: 180px;
    height: 28px;
}

/* ── SEO Project Workspace — tabs ────────────────────────────────────────── */
.tabs { display: flex; gap: 0; border-bottom: 2px solid #e2e8f0; margin-bottom: 1.25rem; }
.tab-link {
    padding: 0.5rem 1.25rem;
    text-decoration: none;
    color: #5b6475;
    font-size: 0.9rem;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s;
}
.tab-link:hover { color: #2563eb; }
.tab-active { color: #2563eb !important; border-bottom-color: #2563eb !important; font-weight: 600; }

/* ── SEO Project Workspace — KPI cards ───────────────────────────────────── */
/* ── SEO delta colours ───────────────────────────────────────────────────── */
.pos-up   { color: #16a34a; font-weight: 600; }   /* improved rank (number dropped) */
.pos-down { color: #dc2626; font-weight: 600; }   /* worsened rank (number rose)    */

/* ── Action button groups inside table cells ─────────────────────────────── */
.btn-group { display: flex; flex-wrap: wrap; gap: 4px; }

.kpi-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.85rem 1.25rem;
    min-width: 110px;
}
.kpi-label { font-size: 0.75rem; color: #888; margin-bottom: 0.2rem; }
.kpi-value { font-size: 1.6rem; font-weight: 700; color: #1f2937; line-height: 1; }
.kpi-sub { font-size: 0.75rem; color: #5b6475; margin-top: 0.2rem; }

/* ── SEO Visibility Analytics (v0.4.4) ───────────────────────────────────── */
.visibility-good    { color: #16a34a; font-weight: 600; }
.visibility-warning { color: #d97706; font-weight: 600; }
.visibility-bad     { color: #dc2626; font-weight: 600; }
.movement-up        { color: #16a34a; font-weight: 600; }
.movement-down      { color: #dc2626; font-weight: 600; }
.movement-neutral   { color: #6b7280; }

/* Inline mini-bar for TOP10% in timeseries */
.vis-bar      { display: inline-block; height: 12px; background: #dc2626; border-radius: 2px; vertical-align: middle; min-width: 2px; }
.vis-bar-warn { background: #d97706; }
.vis-bar-good { background: #16a34a; }

/* Filter bar (list pages): one row, equal-height controls */
.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-bottom: 1rem; }
.filter-bar .form-control { width: auto; height: 2.4rem; padding: 0 0.6rem; font-size: 0.875rem; }
.filter-bar input.form-control { min-width: 16rem; }
.filter-bar .btn { height: 2.4rem; padding: 0 1rem; line-height: 2.4rem; }
.filter-bar .filter-reset { font-size: 0.85rem; color: #6b7280; margin-left: 0.25rem; }
.filter-bar .filter-spacer { flex: 1; }

/* Site pages (/sites, /sites/{id}). Plain style: no fills, no pills, no uppercase. */
.site-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: 0 0 1.5rem; padding: 0.5rem 0; border-top: 1px solid #e5e7eb; border-bottom: 1px solid #e5e7eb; }
.site-toolbar .spacer { flex: 1; }
.site-toolbar form { margin: 0; display: inline-flex; align-items: center; gap: 0.6rem; }
.seg { display: inline-flex; border: 1px solid #c8ccd4; border-radius: 3px; overflow: hidden; font-weight: 400; }
.seg a { padding: 0.25rem 0.7rem; font-size: 0.8rem; color: #374151; text-decoration: none; background: #fff; border-right: 1px solid #c8ccd4; }
.seg a:last-child { border-right: none; }
.seg a.on { background: #374151; color: #fff; }
.site-section { margin: 0 0 2rem; }
.site-section h2 { font-size: 1.1rem; margin: 0 0 0.35rem; display: flex; align-items: center; gap: 0.75rem; }
.site-section h3 { font-size: 0.95rem; margin: 1rem 0 0.4rem; }
.site-section .section-note { margin: 0 0 0.75rem; }
.day-block { padding: 1rem 1.25rem; border: 1px solid #c8ccd4; background: #fff; }
.period-block { padding-top: 1rem; border-top: 3px double #c8ccd4; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.75rem; margin-bottom: 0.75rem; }
.kpi { background: #fff; border: 1px solid #e5e7eb; border-radius: 3px; padding: 0.6rem 0.9rem; }
.kpi .kpi-label { font-size: 0.8rem; color: #6b7280; }
.kpi .kpi-value { font-size: 1.4rem; font-weight: 600; color: #111827; margin-top: 0.1rem; }
.site-section details summary { cursor: pointer; }

/* Day table */
.day-table { box-shadow: none; border-radius: 0; border: 1px solid #e5e7eb; }
.day-table th { text-transform: none; letter-spacing: 0; font-size: 0.8rem; background: #f7f7f9; }
.day-table th.num, .day-table td.num { text-align: right; }
.day-table td.strong { font-weight: 600; }
.day-table tr:hover td { background: transparent; }

/* Status lights */
.light { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 0.4rem; vertical-align: middle; background: #c8ccd4; }
.light-red { background: #c62828; } .light-yellow { background: #d68f00; } .light-ok { background: #2e7d32; } .light-na { background: #c8ccd4; }
.site-head { align-items: flex-start; }
.site-status { font-size: 0.85rem; color: #374151; margin-top: 0.25rem; }
.delta-red { color: #c62828; } .delta-yellow { color: #b26b00; } .delta-ok { color: #2e7d32; } .delta-na { color: #9ca3af; }
.method { font-size: 0.78rem; color: #6b7280; margin: 0.6rem 0 0; }

/* Anomaly rows: one line each, colour only in the light */
.anomaly-list { list-style: none; padding: 0; margin: 0; border: 1px solid #e5e7eb; background: #fff; }
.anomaly { display: flex; align-items: center; gap: 0.6rem; padding: 0.4rem 0.75rem; border-top: 1px solid #eee; font-size: 0.875rem; }
.anomaly:first-child { border-top: none; }
.anomaly-date { color: #6b7280; min-width: 4.5rem; white-space: nowrap; }
.anomaly-text { flex: 1; }
.anomaly-closed { color: #6b7280; }
.anomaly-closed-note { display: block; font-size: 0.78rem; color: #9ca3af; margin-top: 0.1rem; }
.inline-form { display: inline-flex; gap: 0.35rem; align-items: center; margin: 0; }
.form-control.mini { height: 1.8rem; padding: 0 0.5rem; font-size: 0.8rem; width: 16rem; border: 1px solid #c8ccd4; border-radius: 3px; }
.btn-sm { padding: 0.25rem 0.6rem; font-size: 0.8rem; border-radius: 3px; }

/* Charts */
.chart-box { background: #fff; border: 1px solid #e5e7eb; padding: 0.5rem 0.5rem 0.25rem; }
.chart { display: block; width: 100%; height: auto; }
.chart-box .chart { min-height: 220px; }
.legend { display: flex; flex-wrap: wrap; gap: 0.9rem; font-size: 0.8rem; color: #374151; margin: 0 0 0.4rem; }
.legend-item i { display: inline-block; width: 10px; height: 10px; margin-right: 0.35rem; vertical-align: middle; }

/* Monitor list */
table.monitor td { vertical-align: middle; }
table.monitor .spark { display: block; }
table.monitor th { text-transform: none; letter-spacing: 0; }
.cell-value { font-weight: 600; color: #111827; }
.cell-delta { font-size: 0.78rem; }
.flag-count { font-size: 0.78rem; color: #c62828; margin-left: 0.1rem; }

/* Tabs (site card) */
.tabs { display: flex; gap: 0; border-bottom: 1px solid #c8ccd4; margin: 0.5rem 0 1rem; }
.tabs button { background: none; border: none; border-bottom: 2px solid transparent; padding: 0.45rem 0.8rem; font-size: 0.875rem; color: #6b7280; cursor: pointer; }
.tabs button.on { color: #111827; border-bottom-color: #374151; font-weight: 600; }
.tabs button .cnt { margin-left: 0.3rem; color: #6b7280; font-weight: 400; }
.tabs button .cnt.red { color: #c62828; font-weight: 600; }
.tab-panel[hidden] { display: none; }
.hover-col:hover { fill: rgba(55,65,81,0.06); }

/* external link icon next to a site host */
.ext { display: inline-block; vertical-align: -2px; margin-left: 0.15rem; color: #6b7280; }
.ext svg { width: 13px; height: 13px; }
.ext:hover { color: #111827; }
tr[hidden] { display: none; }

.row-note { font-size: 0.78rem; margin-top: 0.2rem; max-width: 34rem; }
.note-red { color: #c62828; } .note-yellow { color: #b26b00; }

/* Sites list: sticky header row while scrolling (2026-09-09) */
table.monitor { overflow: visible; }
table.monitor thead th { position: sticky; top: 0; z-index: 2; background: #f0f1f5; box-shadow: 0 1px 0 #d0d5dd; }
.table-wrap.sticky { overflow: visible; }

/* marketing report v1 */
.row-cards td:first-child { padding-left: 1.6rem; color: #4b5563; }
.camp-details { margin-top: 0.2rem; }
.camp-details summary { cursor: pointer; }
.camp-details table.inner { box-shadow: none; margin-top: 0.3rem; font-size: 0.8rem; }
.camp-details table.inner td { padding: 0.2rem 0.5rem; border-top: 1px solid #f0f1f5; }
.kpi .kpi-sub { font-size: 0.78rem; color: #6b7280; margin-top: 0.15rem; }

/* Segment tag (geriatrics / narcology) */
.seg-tag { display: inline-block; font-size: 0.7rem; font-weight: 500; line-height: 1.4; padding: 0 0.4rem; border-radius: 3px; border: 1px solid #d1d5db; color: #374151; background: #f3f4f6; vertical-align: middle; }
.seg-tag.seg-geriatrics { border-color: #bfdbfe; background: #eff6ff; color: #1e40af; }
.seg-tag.seg-narcology { border-color: #d9c8f5; background: #f5f0ff; color: #5b21b6; }
h1 .seg-tag { font-size: 0.8rem; }
.alert-info { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; padding: 0.6rem 0.9rem; border-radius: 6px; margin-bottom: 1rem; font-size: 0.9rem; }

/* Linked-resources block: wide card, no wrapping in phone/role cells */
.links-card { max-width: 960px; }
.links-card .table-compact td, .links-card .table-compact th { white-space: nowrap; }
.links-card .table-compact td:nth-child(2) { white-space: normal; min-width: 14rem; }
.links-card .table-compact td:last-child { text-align: right; }
.links-card .filter-bar select.form-control { min-width: 22rem; max-width: 100%; }
.links-card .filter-bar input.form-control { min-width: 20rem; }
.links-card .btn-sm { white-space: nowrap; }

/* ── Определения раздела CRM ─────────────────────────────────────────── */
.crm-defs { margin: 0 0 1rem; padding: .55rem .9rem; border: 1px solid #d0d5dd; border-radius: 8px; background: #f8fafc; font-size: .875rem; }
.crm-defs summary { cursor: pointer; color: #475467; font-weight: 500; }
.crm-defs dl { margin: .6rem 0 0; display: grid; grid-template-columns: 6rem 1fr; gap: .35rem .75rem; }
.crm-defs dt { font-weight: 600; color: #101828; }
.crm-defs dd { margin: 0; color: #344054; }
.crm-defs .phone-key { font-weight: 600; }
.table-compact td.phone-key { font-weight: 600; white-space: nowrap; }

/* ── CRM: плитки статусов лидов ───────────────────────────────────── */
.lead-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 220px)); gap: .75rem; margin: 0 0 1.25rem; }
.lead-tile { display: flex; flex-direction: column; gap: .2rem; padding: .9rem 1rem; background: #fff; border: 1px solid #e4e7ec; border-radius: 10px; text-decoration: none; color: #101828; transition: box-shadow .15s, border-color .15s; }
.lead-tile:hover { border-color: #b2b7c2; box-shadow: 0 2px 8px rgba(16,24,40,.06); text-decoration: none; }
.lead-tile-value { font-size: 1.75rem; font-weight: 600; line-height: 1.1; letter-spacing: -.01em; }
.lead-tile-label { font-size: .8rem; color: #475467; }
.lead-tile-total { background: #1f6f78; border-color: #1f6f78; color: #fff; }
.lead-tile-total .lead-tile-label { color: rgba(255,255,255,0.78); }
/* на заливке волной цветные дельты не читаются — внутри плитки всё белое */
.lead-tile-total .delta-ok, .lead-tile-total .delta-red, .lead-tile-total .delta-na, .lead-tile-total small { color: rgba(255,255,255,0.88) !important; }
.lead-tile-in_work .lead-tile-value { color: #175cd3; }
.lead-tile-client .lead-tile-value { color: #067647; }
.lead-tile-closed .lead-tile-value { color: #667085; }
.period-range { margin: -.5rem 0 .9rem; font-size: .95rem; color: #101828; font-weight: 500; }

/* ── CRM: график в аккордеоне ─────────────────────────────────────── */
.crm-chart { margin: 0 0 1rem; border: 1px solid #e4e7ec; border-radius: 10px; background: #fff; padding: .55rem .9rem; }
.crm-chart summary { cursor: pointer; font-weight: 500; color: #344054; }
.crm-chart-toggles { display: flex; flex-wrap: wrap; gap: .4rem; margin: .7rem 0 .5rem; }
.chart-toggle { display: inline-flex; align-items: center; gap: .4rem; padding: .28rem .7rem; border: 1px solid #d0d5dd; border-radius: 999px; background: #fff; color: #667085; font-size: .8rem; cursor: pointer; }
.chart-toggle i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); opacity: .3; }
.chart-toggle.on { color: #101828; border-color: var(--c); background: #fff; }
.chart-toggle.on i { opacity: 1; }
.crm-chart .chart-box { overflow: hidden; }
.crm-chart svg g[data-series].off { display: none; }
.crm-chart-modes { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; margin: .7rem 0 .2rem; }

/* ── CRM: панель периода и фильтров ─────────────────────────────── */
.crm-toolbar { display: flex; flex-direction: column; gap: .55rem; padding: .75rem .9rem; margin: 0 0 1rem; background: #fff; border: 1px solid #e4e7ec; border-radius: 10px; }
.crm-toolbar-row { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; margin: 0; }
.crm-toolbar-inline { display: flex; align-items: center; gap: .35rem; margin: 0; }
.crm-toolbar-label { min-width: 3.6rem; font-size: .8rem; color: #667085; text-transform: uppercase; letter-spacing: .04em; }
.crm-toolbar-range { margin-left: .4rem; font-weight: 500; color: #101828; }
.crm-input { padding: .32rem .55rem; border: 1px solid #d0d5dd; border-radius: 6px; font-size: .85rem; background: #fff; color: #101828; }
.btn-sm { padding: .3rem .7rem; font-size: .85rem; }
#crm-live.is-loading { opacity: .55; transition: opacity .15s; pointer-events: none; }
main.is-loading { opacity: .6; transition: opacity .15s; pointer-events: none; }

/* ── Уведомления администратора ───────────────────────────────────── */
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-yellow { background: #fef3c7; color: #92400e; }
.topbar-bell { display: inline-flex; align-items: center; gap: .3rem; margin-right: 1rem; color: rgba(255,255,255,0.75); text-decoration: none; }
.topbar-bell svg { width: 18px; height: 18px; }
.topbar-bell.has-errors { color: #fca5a5; }
.topbar-bell-count { background: #dc2626; color: #fff; border-radius: 999px; font-size: .7rem; font-weight: 600; padding: .1rem .45rem; line-height: 1.2; }

/* Page marks: green dot on menu items + toggle button next to the page title */
.mark-dot { display: inline-block; width: 0.55rem; height: 0.55rem; border-radius: 50%; background: #22c55e; margin-left: 0.4rem; vertical-align: middle; box-shadow: 0 0 0 2px rgba(34,197,94,0.25); }
.mark-toggle { display: inline-flex; align-items: center; margin-left: 0.75rem; vertical-align: middle; font-weight: 400; }
.mark-toggle .btn { display: inline-flex; align-items: center; gap: 0.4rem; }
.mark-toggle .btn .mark-dot { margin-left: 0; background: #d1d5db; box-shadow: none; }
.mark-toggle .btn.is-marked .mark-dot { background: #22c55e; box-shadow: 0 0 0 2px rgba(34,197,94,0.25); }
/* Путь клиента (карточка лида, 2026-10-16) */
.journey { border-left: 2px solid #e4e7ec; margin: .2rem 0 0 .4rem; padding-left: .9rem; }
.journey-item { display: flex; gap: .6rem; align-items: baseline; padding: .3rem 0; position: relative; }
.journey-item::before { content: ""; position: absolute; left: -1.3rem; top: .75rem; width: 8px; height: 8px; border-radius: 50%; background: #c7ccd4; }
.journey-good::before { background: #16a34a; } .journey-bad::before { background: #dc2626; } .journey-warn::before { background: #d97706; }
.journey-when { color: #667085; font-size: .82rem; white-space: nowrap; min-width: 6.2em; }
.journey-ico { width: 1.4em; text-align: center; color: #475467; }
.journey-body { line-height: 1.4; }
/* Плеер записи в транскрипте (2026-10-16) */
.call-player { margin: 0 0 .8rem; }
.transcript-lines .js-seek { cursor: pointer; border-radius: 4px; }
.transcript-lines .tl-text:hover { background: #f2f4f7; }
.transcript-lines .tl-now { background: #fef3c7; }
a.js-seek { white-space: nowrap; text-decoration: none; font-size: .82rem; color: #1d4ed8; }

/* Брендбук: ссылки и фокус */
/* только «голые» ссылки в тексте; кнопки, пункты меню и прочие классовые ссылки сами задают цвет */
a:not([class]) { color: #1f6f78; }
a:not([class]):hover { color: #175860; }
:focus-visible { outline: 2px solid #f59e0b; outline-offset: 2px; }
.nav-brand img { width: 22px; height: 22px; vertical-align: -5px; margin-right: 0.45rem; }
.login-brand { display:flex; align-items:center; justify-content:center; gap:.5rem; margin-bottom: 1rem; }
.login-brand .sub { margin-top: -0.1rem; }
.login-brand img { width: 26px; height: 26px; border-radius: 6px; }
.login-brand .name { font-size: 1.35rem; font-weight: 600; letter-spacing: -0.01em; color: #1f2937; }
.login-brand .sub { font-size: .8rem; color: #6b7280; }
