/* ==========================================================================
   idbg — DESIGN PAGES
   Само специфичното за една страница, в секции с маркер [module:<ключ>]
   (docs/UI_STANDARD.md §11). Всяко правило в секция [module:X] хваща само
   изгледи на X — проверява го `php bin/ui-cssmap.php --section-check`.
   Общото за няколко модула е в design-components.css. Секцията
   [module:home] (началната страница) е замразена (§13).
   ========================================================================== */

/* == [module:invoices] Number picker (locked + dropdown) == */
/* Auth page rules live in the consolidated "Auth pages" block below. */
.number-picker { display: block; }
.number-display {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: 0 6px 0 12px;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    height: 38px;
    min-height: 38px;
    overflow: hidden;
    transition: border-color var(--duration-fast);
    box-sizing: border-box;
}
.number-display:hover { border-color: var(--color-text-muted); }
.number-display .number-edit-btn:hover {
    background: rgba(11, 95, 255, 0.08);
    color: var(--brand-blue);
}
.number-editor {
    display: flex;
    gap: 6px;
    align-items: stretch;
    flex-wrap: nowrap;
}
.number-editor[hidden],
.number-display[hidden],
.number-editor input.number-manual[hidden] {
    display: none !important;
}
/* When manual input is active, editor wraps: select on top (full width), input + check below */
.number-editor:has(.number-manual:not([hidden])) {
    flex-wrap: wrap;
}
.number-editor:has(.number-manual:not([hidden])) > select.number-options {
    flex: 1 1 100%;
    width: 100%;
}
.number-editor .number-lock-btn:hover {
    background: var(--brand-blue-dark, #2450D8);
    box-shadow: 0 2px 6px rgba(11, 95, 255, 0.35);
}
.number-editor .number-lock-btn:active { transform: translateY(1px); }

/* == [module:invoices] Debit / Credit note reference section == */
.invoice-form-v2 .note-ref-row {
    margin-top: var(--space-4);
    padding: var(--space-4);
    background: #FEF9F1;
    border: 1px solid #F5D9A8;
    border-radius: var(--radius);
}
.invoice-form-v2 .note-ref-grid > .form-field--full { grid-column: 1 / -1; }
@media (max-width: 640px) {
    .invoice-form-v2 .note-ref-grid { grid-template-columns: 1fr; }
}

/* == [module:invoices] МОДАЛ ПРИ ИЗДАВАНЕ — имейл или печат == */
/* Издаването е необратимо (заделя номер), затова между клика и действието
   стои изричен избор какво да стане с готовия документ. */
.stock-writeoff-list {
    list-style: none;
    margin: 14px 0 0;
    padding: 0;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    overflow: hidden;
}
.stock-writeoff-list li {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    padding: 9px 12px;
    font-size: 14px;
}
.stock-writeoff-list li + li { border-top: 1px solid var(--color-border); }
.stock-writeoff-name { color: var(--color-text-primary); }
.stock-writeoff-qty { color: var(--color-text-secondary); white-space: nowrap; }
/* Частично изписване — количество на ред. */
.stock-writeoff-list--qty li { align-items: center; }
.stock-writeoff-done {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    color: var(--color-text-secondary);
}
.stock-writeoff-warn {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    color: var(--color-warning, #9a6700);
}
.stock-writeoff-input {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    flex: 0 0 auto;
}
.stock-writeoff-input input {
    width: 84px;
    text-align: right;
    padding: 5px 8px;
    font-variant-numeric: tabular-nums;
}
.stock-writeoff-unit {
    font-size: 13px;
    color: var(--color-text-secondary);
    white-space: nowrap;
    min-width: 28px;
}
.stock-writeoff-modal--bulk .stock-writeoff-list { max-height: 50vh; overflow-y: auto; }
.stock-writeoff-pick {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
}
.stock-writeoff-items {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    text-align: right;
}
.stock-writeoff-items .stock-writeoff-qty { margin-left: 6px; }

/* == [module:invoices] ИНТУИТИВНОСТ — форми без лява колона „Съвети". Каквото тя обясняваше == */
/* (запази клиента, име на правилото…) вече става само, затова формата
   заема цялата ширина с таван, при който полетата още се четат. */
/* „Доставката е на друга дата?" под датата на издаване */
.field-link-btn { align-self: flex-start; background: none; border: 0; padding: 4px 0 0; cursor: pointer; font: inherit; font-size: 12px; font-weight: 600; color: var(--brand-blue, #0b5fff); }
.field-link-btn:hover { text-decoration: underline; }
/* .list-parent-ref („към фактура № …“ под номера) — в design-components.css
   (DataTable): ползват я и списъкът на фактурите, и табовете на клиента. */
/* --- Кредитно известие: „Какво стана?" (invoices/form.phtml) ---------- */
.invoice-form-v2.cw-pending > .form-card:not(.credit-wizard) { display: none; }
.note-invoice-picker { display: block; position: relative; margin-top: 8px; }
.note-invoice-picker input[type="text"] { width: 100%; }
.note-ref-manual { margin-top: 10px; }
.note-ref-manual > summary { cursor: pointer; font-size: 12.5px; color: var(--color-text-secondary); font-weight: 600; margin-bottom: 8px; }

/* == [module:invoices] G4 (интерфейс, телефон/таблет): поправки от системния тест, кръг 1 == */
/* „Документът е на английски, а името на фирмата е на кирилица" — цял ред
   под полетата на документа, не в тясната колона на „Език". */
.invoice-form-v2 .form-card-grid > .locale-en-hint { grid-column: 1 / -1; margin: -6px 0 0; font-size: 12.5px; line-height: 1.45; color: #92400e; text-align: right; }
.invoice-form-v2 .form-card-grid > .locale-en-hint[hidden] { display: none; }
@media (max-width: 760px) {
    .invoice-form-v2 .form-card-grid > .locale-en-hint { text-align: left; }
}

/* == [module:docs] warranties/form.phtml == */
/* Редовете на картата (Артикул · Сериен №) са в pages/docs.css
   (.docs-wr-lines — като редовете на протокола); старите .wr-lines/.wr-line
   вече не се ползват (docs-r2). */

/* Колоната „Ремонти“ на гаранционните карти (.td-events) е в design-components.css
   (DataTable): ползват я списъкът на картите и табът в изгледа на клиента. */

/* == [module:records] DOCUMENTS — folder grid == */
.folder-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: var(--space-3);
    margin-bottom: var(--space-5);
}

/* == [module:records] crm/tasks.phtml == */
.tasks-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-4);
}
@media (max-width: 720px) {
    .tasks-board {
            grid-template-columns: 1fr;
        }
}
.task-col {
    background: var(--color-bg-subtle);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-4);
}
.task-col h3 {
    font-size: var(--text-body);
    font-weight: 700;
    margin-bottom: var(--space-3);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.col-count {
    background: var(--color-bg);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-secondary);
}
.task-card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: var(--space-3);
    margin-bottom: var(--space-2);
}
/* Заглавие вляво, иконките вдясно. Иконките не се свиват, заглавието се пренася. */
.task-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-2);
}
.task-title {
    font-weight: 600;
    font-size: var(--text-small);
    min-width: 0;
    overflow-wrap: anywhere;
}
/* Описанието се пише свободно — празните редове са част от текста, затова
   pre-wrap. На картата се виждат само първите 3 реда; целият текст си остава
   в DOM-а и се чете от бутона „Преглед". */
.task-desc {
    color: var(--color-text-secondary);
    font-size: var(--text-caption);
    margin-top: 4px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    overflow: hidden;
}
/* Разгънато описание — махаме отрязването, текстът се показва цял. */
.task-desc.is-expanded {
    display: block;
    -webkit-line-clamp: none;
    line-clamp: none;
    overflow: visible;
}
/* „Виж повече" стои под описанието и изглежда като линк, не като бутон —
   на карта с два същински бутона трети би се борил за внимание. */
.task-desc-more {
    background: none;
    border: 0;
    padding: 0;
    margin-top: 2px;
    font-size: var(--text-caption);
    font-weight: 600;
    color: var(--brand-blue);
    cursor: pointer;
}
.task-desc-more:hover { text-decoration: underline; }
.task-desc-more[hidden] { display: none; }

/* == [module:records] Модал „Преглед на задача" == */
/* Дългото описание скролва вътре в модала, а не разтяга картата. */
.task-view-desc {
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-border);
    font-size: var(--text-small);
    color: var(--color-text-secondary);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    max-height: 45vh;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.task-view-desc.is-empty { color: var(--color-text-muted); font-style: italic; }
.task-meta {
    display: flex;
    gap: 6px var(--space-3);
    margin-top: var(--space-3);
    flex-wrap: wrap;
    align-items: center;
}
.task-client, .task-due {
    font-size: 11px;
    color: var(--color-text-muted);
}
.col-empty {
    text-align: center;
    color: var(--color-text-muted);
    padding: var(--space-6) 0;
    font-size: 11px;
}
.col-empty[hidden] {
    display: none;
}

/* == [module:records] crm/pipeline.phtml == */
.pipeline-col {
    background: var(--color-bg-subtle);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    min-height: 300px;
}
.pipeline-col.col-won {
    background: var(--color-success-bg);
    border-color: var(--color-success);
}
.pipeline-col.col-lost {
    background: var(--color-danger-bg);
    border-color: var(--color-danger);
}
.col-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    font-size: var(--text-small);
}
/* Скопирано до борда: .col-total се ползва и за колоната „Сума" в редовете на
   фактурата, а тукашният margin-bottom я избутваше 6px нагоре спрямо полетата
   вляво (центрирана клетка с долен margin). */
.pipeline-col > .col-total {
    font-size: var(--text-caption);
    color: var(--color-text-muted);
    margin-bottom: var(--space-3);
}
/* „Спечелен"/„Загубен" нямат ред със сума — запазваме мястото му (4px собствен
   margin + височината на .col-total + неговия margin), за да не тръгват картите
   по-нагоре от съседните колони. */
.pipeline-col.col-won .col-head,
.pipeline-col.col-lost .col-head {
    margin-bottom: calc(4px + var(--text-caption) * 1.6 + var(--space-3));
}
.opp-card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: var(--space-3);
    margin-bottom: var(--space-2);
    cursor: grab;
    transition: all var(--duration-fast) var(--ease-out);
}
.opp-card:hover {
    box-shadow: var(--shadow);
    border-color: var(--brand-blue);
}
.opp-title {
    font-weight: 600;
    font-size: var(--text-small);
    min-width: 0;
    overflow-wrap: break-word;
}
.opp-client {
    font-size: var(--text-caption);
    color: var(--color-text-secondary);
    margin-top: 2px;
}
.opp-date {
    font-size: 11px;
    color: var(--color-text-muted);
    margin-top: 2px;
}

/* == [module:records] Clients list == */
.amount-zero { color: var(--color-text-muted); }

/* == [module:records] Cashbox amount colors (extracted from inline style) == */
/* CRM: convert-to-invoice button */
.opp-convert { margin-top: var(--space-2); }

/* == [module:records] Store stock alerts == */
.stock-out { color: var(--color-danger); font-weight: 700; }

/* == [module:records] CRM pipeline drag-drop == */
.opp-card[draggable="true"] { cursor: grab; user-select: none; }
.opp-card[draggable="true"]:active { cursor: grabbing; }
.opp-card.is-dragging { opacity: 0.4; }
.pipeline-col.is-drop-target {
    outline: 2px dashed var(--brand-blue);
    outline-offset: -2px;
    background: var(--brand-blue-light);
}

/* == [module:records] Data table v2 — polished look: client avatars, status pills, airy rows == */
@media (max-width: 1000px) {
    .data-table--clients tbody .td-client { grid-column: 1 / -1; grid-row: 1; }
    .data-table--clients tbody .td-eik    { grid-column: 1; grid-row: 2; }
    .data-table--clients tbody .td-city   { grid-column: 2; grid-row: 2; text-align: right; }
    .data-table--clients tbody .td-docs   { grid-column: 1; grid-row: 3; text-align: left; }
    .data-table--clients tbody .td-unpaid { grid-column: 2; grid-row: 3; text-align: right; }
    /* Физическо лице без показан ЕГН — празната клетка не носи подпис. */
    .data-table--clients tbody td:empty { display: none; }
    /* „Файлове": без отметка и номер. На auto-placement петте клетки се
           трупаха в мрежата от три колони — тирето на празния „Клиент" минаваше
           през категорията, името на клиента се изписваше върху нея, а „45 B"
           се чупеше на два реда (r1-G1-new2). Цели редове, текст вляво, число
           вдясно; празните клетки на карта не се показват.

               1  име (и бележка)
               2  категория | размер
               3  клиент | документ
               4  действия                                                       */
    .data-table--files tbody tr             { grid-template-columns: minmax(0, 1fr) max-content; }
    .data-table--files tbody .td-file-name  { grid-column: 1 / -1; grid-row: 1; overflow-wrap: anywhere; }
    .data-table--files tbody .td-file-cat   { grid-column: 1; grid-row: 2; }
    .data-table--files tbody .td-file-size  { grid-column: 2; grid-row: 2; text-align: right; white-space: nowrap; }
    .data-table--files tbody .td-file-client { grid-column: 1; grid-row: 3; overflow-wrap: anywhere; }
    .data-table--files tbody .td-file-doc   { grid-column: 2; grid-row: 3; text-align: right; }
    .data-table--files tbody .td-file-client.is-empty + .td-file-doc { grid-column: 1 / -1; }
    .data-table--files tbody .td-file-client.is-empty,
        .data-table--files tbody .td-file-doc.is-empty { display: none; }
    .data-table--files tbody .td-file-cat[data-label]::before,
        .data-table--files tbody .td-file-client[data-label]::before {
            content: attr(data-label) " ";
            font-family: var(--font-ui);
            color: var(--color-text-muted);
            font-size: 11px;
            font-weight: 600;
            letter-spacing: .3px;
            text-transform: uppercase;
        }
}

/* == [module:records] Файлове — лента с филтри (свободно търсене · клиент · вид документ) == */
/* Documents folder grid */
.folder-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: var(--space-3);
    margin: 0 0 var(--space-4);
}
/* Кратко описание под името на файла — свободен текст, затова без
   уговорките на .muted-label (главни букви, разредка). */
.doc-note {
    margin-top: 2px;
    font-size: var(--text-caption);
    line-height: 1.4;
    color: var(--color-text-secondary);
    max-width: 46ch;
}
.folder-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-4) var(--space-3);
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--color-text-primary);
    transition: transform var(--duration-fast), box-shadow var(--duration-fast), border-color var(--duration-fast);
}
.folder-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
    border-color: var(--brand-blue);
    color: var(--brand-blue);
}
.folder-card strong {
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    line-height: 1.3;
    color: inherit;
}
/* ×-ът не е в <a>-то (невалиден HTML), а е негов брат в обвивката. */
.folder-card-wrap {
    position: relative;
}
.crumb-sep {
    margin: 0 4px;
    color: var(--color-text-muted);
}

/* == [module:records] СПРАВКИ В КЛИЕНТСКИЯ ПАСПОРТ — графика на оборота, платежна дисциплина, == */
/* топ артикули. (clients/view → .insight-grid) */
.insight-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 14px;
    margin: 14px 0 18px;
}
@media (max-width: 1380px) {
    .insight-grid { grid-template-columns: 1.6fr 1fr 1fr; }
}
@media (max-width: 1100px) {
    .insight-grid { grid-template-columns: 1fr 1fr; }
    .insight-card--chart { grid-column: 1 / -1; }
}
@media (max-width: 700px) {
    .insight-grid { grid-template-columns: 1fr; }
}
.insight-card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.02);
    padding: 16px 18px;
    min-width: 0;
}
.insight-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
}
.insight-head h3 {
    margin: 0;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--color-text-secondary);
}
.insight-sub { font-size: 11px; color: var(--color-text-muted); white-space: nowrap; }
.insight-empty { font-size: 13px; color: var(--color-text-muted); line-height: 1.55; padding: 8px 0; }
/* Бар графика — чист CSS, 12 колони */
.bar-chart {
    display: flex;
    align-items: stretch;
    gap: 7px;
    height: 150px;
}
.bar-col {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    min-width: 0;
    cursor: default;
}
.bar-track {
    flex: 1;
    display: flex;
    align-items: flex-end;
    border-radius: 5px;
    background: linear-gradient(180deg, transparent calc(100% - 1px), var(--color-border) 100%);
}
.bar-fill {
    width: 100%;
    border-radius: 5px 5px 2px 2px;
    background: linear-gradient(180deg, #6e8bff 0%, var(--brand-blue) 100%);
    transition: filter var(--duration-fast), transform var(--duration-fast);
    min-height: 2px;
}
.bar-col:hover .bar-fill { filter: brightness(1.12); }
.bar-fill--zero { background: var(--color-border); height: 2px !important; border-radius: 2px; }
.bar-label {
    margin-top: 6px;
    font-size: 9.5px;
    text-align: center;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
    overflow: hidden;
}
/* Платежна дисциплина */
.discipline-big { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.discipline-days { font-size: 38px; font-weight: 800; line-height: 1; color: var(--color-text-primary); letter-spacing: -0.02em; }
.discipline-unit { font-size: 11.5px; line-height: 1.35; color: var(--color-text-muted); }
.meter--soft > span { background: rgba(11, 95, 255, 0.35); }
.discipline-rate .insight-sub { display: block; margin-top: 6px; white-space: normal; }
/* Aging лента на отвореното салдо */
.aging-wrap { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--color-border); }
.aging-strip {
    display: flex;
    height: 10px;
    border-radius: 999px;
    overflow: hidden;
    gap: 2px;
}
.aging-strip > span { display: block; height: 100%; }
.seg-green  { background: #2eb872; }
.seg-amber  { background: var(--brand-amber); }
.seg-orange { background: #ff7a3d; }
.seg-red    { background: #e5484d; }
.aging-legend {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px 6px;
    margin-top: 8px;
}
.aging-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.aging-lab { font-size: 10.5px; color: var(--color-text-muted); margin-right: 6px; }
/* Топ артикули */
.top-item { margin-bottom: 10px; }
.top-item:last-child { margin-bottom: 0; }
.top-item-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12.5px;
}

/* == [module:records] G4 (интерфейс, телефон/таблет): поправки от системния тест, кръг 1 == */
@media (max-width: 640px) {
    .pipeline-col { min-height: 0; }
    .pipeline-col:has(> [data-col-empty]:not([hidden])) { padding-top: var(--space-2); padding-bottom: var(--space-2); }
    .pipeline-col:has(> [data-col-empty]:not([hidden])) .col-head { margin-bottom: 0; }
    .pipeline-col:has(> [data-col-empty]:not([hidden])) > .col-total,
        .pipeline-col > [data-col-empty]:not([hidden]) { display: none; }
}

/* == [module:reports] DASHBOARD == */
/* Setup checklist widget */
.setup-checklist {
    position: relative;
    padding: var(--space-5) var(--space-6);
    margin-bottom: var(--space-5);
    background: linear-gradient(135deg, #EEF2FF, #F5F3FF);
    border: 1px solid #C7D2FE;
    border-radius: var(--radius-md);
}
/* Кръгче с точен размер, а не текст с padding: „×" е 18px глиф и с
   вертикален padding ховърът порастваше надолу върху progress bar-а.
   line-height: 1 + flex центриране държат кутията точно 28×28. */
.setup-checklist-close {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
    background: transparent;
    border: none;
    font-size: 18px;
    color: var(--color-text-muted);
    cursor: pointer;
    border-radius: var(--radius-full);
}
.setup-checklist-close:hover { background: rgba(0,0,0,0.05); color: var(--color-text-primary); }
/* Мястото на бутона е запазено, за да не застава лентата под него —
   иначе двете се застъпват в горния десен ъгъл независимо от ховъра. */
.setup-checklist-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
    padding-right: 34px;
}
.setup-checklist-head h2 { margin: 0; color: #3730A3; font-size: var(--text-body-lg); }
.setup-checklist-progress {
    width: 200px;
    height: 8px;
    background: #fff;
    border-radius: var(--radius-full);
    overflow: hidden;
}
.setup-checklist-progress-bar {
    height: 100%;
    background: #4F46E5;
    transition: width var(--duration) var(--ease-out);
}
.setup-checklist-items {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: var(--space-2);
}
.setup-checklist-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: #fff;
    border-radius: var(--radius);
    border: 1px solid #E5E7EB;
    text-decoration: none;
    color: inherit;
    font-size: var(--text-small);
    transition: all var(--duration-fast) var(--ease-out);
}
.setup-checklist-item:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); color: inherit; }
.setup-checklist-item.is-done { border-color: #D1FAE5; }
.setup-checklist-item.is-done .setup-checklist-item-label {
    text-decoration: line-through;
    color: var(--color-text-muted);
}
.setup-checklist-item-ico { font-size: 16px; }
.setup-checklist-item-label { flex: 1; }

/* == [module:reports] DASHBOARD — redesigned PLAN7 == */
.dash-firm-label {
    font-weight: 600;
    color: var(--color-text-primary);
}
/* Main grid — 2-col with main content and side */
.dash-main {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr);
    gap: var(--space-5);
}
.dash-col { display: flex; flex-direction: column; gap: var(--space-4); }
.panel-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    border-radius: var(--radius);
    text-decoration: none;
    color: inherit;
    transition: background var(--duration-fast) var(--ease-out);
}
.panel-row:hover { background: var(--color-bg-subtle); color: inherit; }
.panel-row-main { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.panel-row-main strong { font-size: var(--text-small); font-weight: 700; color: var(--color-text-primary); }
.panel-row-sub { font-size: var(--text-caption); color: var(--color-text-muted); }
/* Chart — bar chart */
.chart-bars {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 140px;
    padding: 0 var(--space-4) var(--space-3);
}
.chart-bar-col {
    flex: 1;
    height: 100%;
    display: flex;
    align-items: flex-end;
    min-width: 4px;
}
.chart-bar {
    width: 100%;
    min-height: 2px;
    background: linear-gradient(180deg, var(--brand-blue), var(--brand-blue-dark));
    border-radius: 2px 2px 0 0;
    transition: opacity var(--duration-fast) var(--ease-out);
}
.chart-bar-col:hover .chart-bar { opacity: 0.85; }
.chart-legend {
    display: flex;
    justify-content: space-between;
    padding: 0 var(--space-4) var(--space-4);
    font-size: 11px;
    color: var(--color-text-muted);
}
@media (max-width: 1100px) {
    .dash-main { grid-template-columns: 1fr; }
}

/* == [module:reports] Файлове — лента с филтри (свободно търсене · клиент · вид документ) == */
/* Таблица за преглед на импорта (dry-run) — как ще изглеждат данните. */
.import-preview {
    table-layout: auto;
    white-space: nowrap;
}
.import-preview th:first-child,
.import-preview td:first-child {
    width: 1%;
    color: var(--color-text-muted);
}
.import-preview th:nth-child(2),
.import-preview td:nth-child(2) { width: 1%; }
.import-preview tbody td {
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.import-preview tbody tr.import-row--skip td { background: var(--color-warning-bg); }
.import-preview tbody tr.import-row--error td { background: var(--color-danger-bg); }
.import-preview .import-cell-empty { color: var(--color-text-muted); }
@media (max-width: 640px) {
    /* Под 640px .data-table става карти — там nowrap и тесните колони
           „Ред"/„Статус" (width: 1%) свиват клетките до няколко пиксела. */
    .import-preview,
        .import-preview tbody td { white-space: normal; max-width: none; }
    .import-preview th:first-child,
        .import-preview td:first-child,
        .import-preview th:nth-child(2),
        .import-preview td:nth-child(2) { width: auto; }
    .import-preview tbody tr.import-row--skip td,
        .import-preview tbody tr.import-row--error td { background: transparent; }
    .import-preview tbody tr.import-row--skip { background: var(--color-warning-bg); }
    .import-preview tbody tr.import-row--error { background: var(--color-danger-bg); }
}
/* Rank cell + percentage bar */
.rank-cell {
    width: 36px;
    text-align: center;
    color: var(--color-text-muted);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.pct-cell {
    min-width: 160px;
}
.pct-value {
    display: inline-block;
    min-width: 44px;
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    margin-right: 8px;
    color: var(--color-text-secondary);
}
.pct-bar {
    display: inline-block;
    width: 100px;
    height: 8px;
    background: var(--color-bg-subtle);
    border-radius: 4px;
    overflow: hidden;
    vertical-align: middle;
}
.pct-bar-fill {
    height: 100%;
    background: var(--brand-blue);
    border-radius: 4px;
    transition: width var(--duration);
}

/* == [module:reports] WELCOME CARD (табло) — поздрав + месечен резултат + илюстрация == */
.welcome-card {
    background: linear-gradient(135deg, #ffffff 0%, #f4f7ff 60%, #eef3ff 100%);
    border: 1px solid var(--color-border);
    border-radius: 18px;
    box-shadow: 0 10px 30px -18px rgba(31, 62, 204, .25);
    margin: 4px 0 20px;
    overflow: hidden;
}
.welcome-firm { display: flex; align-items: center; gap: 9px; margin-bottom: 9px; }
.welcome-title {
    margin: 0 0 4px;
    font-size: 26px;
    letter-spacing: -.015em;
    color: var(--color-text-primary);
}

/* == [module:reports] WELCOME CARD (табло) — поздрав + месечен резултат + илюстрация == */
.welcome-sub { margin: 0 0 8px; color: var(--color-text-secondary); }
.welcome-amount-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.welcome-amount {
    font-size: 32px;
    font-weight: 800;
    color: var(--brand-blue);
    font-variant-numeric: tabular-nums;
    letter-spacing: -.01em;
}
.welcome-actions { display: flex; gap: 10px; flex-wrap: wrap; }
@media (max-width: 900px) {
    .welcome-title { font-size: 22px; }
    .welcome-amount { font-size: 26px; }
}

/* == [module:reports] G4 (интерфейс, телефон/таблет): поправки от системния тест, кръг 1 == */
@media (max-width: 1000px) {
    /* Класациите („Най-добри клиенти", „Какво се продава"): мястото личи от
           реда — картата започва с името, а лентата „Дял" е на цял ред. */
    .data-table-v2.data-table--labeled tbody td.rank-cell { display: none; }
    .data-table-v2.data-table--labeled tbody td.rank-cell + td,
        .data-table-v2.data-table--labeled tbody td.pct-cell { grid-column: 1 / -1; }
    .data-table-v2.data-table--labeled tbody td.rank-cell + td::before { content: none; display: none; }
    /* Клетка, която за този ред няма смисъл (тире, празна сума) — в картата
           не се показва, за да не стоят подписи без стойност (извлечение за
           клиент: при плащане няма статус, при фактура — начин на плащане). */
    .data-table-v2.data-table--labeled tbody td.td-mobile-skip { display: none; }
}
/* Счетоводният термин дребно под обикновената дума в заглавието на колоната
   („Дължи, €" / дебит) — за счетоводителя, без да пречи на останалите. */
.data-table th .th-sub {
    display: block;
    margin-top: 1px;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
    opacity: .75;
}
/* „Кой ми дължи": номерът е без вид на документа (170px за него са излишни),
   а действието е едно (без 100px за заглавието). До 1280px клетките са
   по-гъсто и валутата на „Остават" може да слезе под сумата — девет колони с
   три суми иначе не се побират в картата. Самите суми не се цепят: между
   хилядите е неразделим интервал (reports/aging.phtml). */
.data-table--aging .td-doc { min-width: 0; }
@media (min-width: 1001px) and (max-width: 1280px) {
    .data-table--aging thead th,
        .data-table--aging tbody td { padding-left: var(--space-2); padding-right: var(--space-2); }
}
@media (min-width: 1001px) and (max-width: 1180px) {
    .data-table--aging tbody td.td-amount { white-space: normal; }
}
/* Лента „колко от прага за регистрация по ДДС" (таблото и „ДДС за месеца"). */
.vat-threshold-bar { height: 6px; border-radius: 3px; background: var(--color-border); overflow: hidden; margin: 8px 0 6px; max-width: 420px; }
.vat-threshold-bar > span { display: block; height: 100%; background: var(--brand-blue); border-radius: 3px; }
.vat-threshold-bar.is-near > span, .alert-warning .vat-threshold-bar > span { background: var(--color-warning); }
.vat-threshold-bar.is-over > span, .alert-error .vat-threshold-bar > span { background: var(--color-danger); }

/* == [module:account] billing/index.phtml == */
.sub-meta {
    color: var(--color-text-secondary);
    margin-top: 4px;
    font-size: var(--text-small);
}

/* == [module:account] Файлове — лента с филтри (свободно търсене · клиент · вид документ) == */
/* Narrow container for short-form views (delete account, etc.) */
.container--narrow {
    max-width: 720px;
}

/* == [module:account] СПРАВКИ В КЛИЕНТСКИЯ ПАСПОРТ — графика на оборота, платежна дисциплина, == */
/* топ артикули. (clients/view → .insight-grid) */
.meter--warn > span { background: var(--color-warning, #f59e0b); }
.meter--full > span { background: var(--color-danger, #ef4444); }
.meter--none { opacity: 0.45; }

/* == [module:shell] ONBOARDING / SWITCH == */
.onboarding-section,
.switch-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-8) var(--space-4);
    background: var(--color-bg-subtle);
}
.onboarding-wrap { width: 100%; max-width: 720px; }
.onboarding-logo { display: block; text-align: center; margin-bottom: var(--space-6); }
.onboarding-card,
.switch-card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: var(--space-10);
}
.onboarding-card h1,
.switch-card h1 {
    font-size: var(--text-h2);
    font-weight: 800;
    margin-bottom: var(--space-2);
    text-align: center;
}
.onb-note {
    text-align: center;
    color: var(--color-text-muted);
    font-size: var(--text-small);
    margin-top: var(--space-4);
}
.tenants-grid { display: grid; gap: var(--space-2); }
.tenant-card {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--color-text-primary);
    transition: all var(--duration-fast) var(--ease-out);
}
.tenant-card:hover {
    border-color: var(--brand-blue);
    box-shadow: var(--shadow);
    transform: translateY(-1px);
    color: var(--color-text-primary);
}
.tenant-card.is-current { border-color: var(--brand-blue); background: var(--brand-blue-light); }
.tenant-info { flex: 1; min-width: 0; }
.tenant-name { font-weight: 700; font-size: var(--text-small); margin-bottom: 2px; }
.tenant-meta { font-size: var(--text-caption); color: var(--color-text-muted); }
.tenant-arrow { color: var(--color-text-muted); font-size: 20px; }

/* == [module:shell] Onboarding — centered wider == */
/* Auth form rules live in the consolidated "Auth pages" block below. */
.onboarding-card,
.switch-card {
    max-width: 640px;
}

/* == [module:shell] Phase 1 additions — onboarding, switch, dashboard layouts == */
/* --- Onboarding --- */
.onboarding-section,
.switch-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-8) var(--space-4);
    background: radial-gradient(circle at 20% 20%, rgba(11, 95, 255, .04) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(255, 176, 46, .04) 0%, transparent 50%),
    var(--color-bg-subtle);
}
.onboarding-wrap {
    width: 100%;
    max-width: 720px;
}
.onboarding-logo {
    display: block;
    text-align: center;
    margin-bottom: var(--space-8);
}
.onboarding-card,
.switch-card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: var(--space-10);
}
.onboarding-card h1,
.switch-card h1 {
    font-size: var(--text-h2);
    font-weight: 800;
    margin-bottom: var(--space-2);
    text-align: center;
}
.onb-note {
    text-align: center;
    color: var(--color-text-muted);
    font-size: var(--text-small);
    margin-top: var(--space-4);
}
/* Логото над картата. При първа фирма е <span> (неактивен), иначе <a> към
   началната страница — margin-а е един и същ и в двата случая. */
.onb-logo {
    /* .logo е display:flex → без това <a>-то се разпъва на цялата ширина
       на .onboarding-wrap и кликаема става и празнотата вдясно. */
    width: fit-content;
    margin-bottom: 26px;
}
/* "Назад" и "Създай фирмата" на един ред. Primary-то е flex:1, така че когато
   "Назад" го няма (първа фирма) само́ заема целия ред — без модификатор. */
.onb-actions {
    display: flex;
    align-items: stretch;
    gap: var(--space-3);
}
@media (max-width: 560px) {
    /* Под 560px (същия праг като .form-grid-2) двата .btn-lg не се събират на ред
       — .btn е white-space:nowrap, така че се редят вертикално, с primary отгоре. */
    .onb-actions {
            flex-direction: column-reverse;
        }
}
/* --- Switch (firm picker) --- */
.tenants-grid {
    display: grid;
    gap: var(--space-3);
}
.tenant-card {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4) var(--space-5);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--color-text-primary);
    transition: all var(--duration-fast) var(--ease-out);
}
.tenant-card:hover {
    border-color: var(--brand-blue);
    box-shadow: var(--shadow);
    transform: translateY(-1px);
    color: var(--color-text-primary);
}
.tenant-card.is-current {
    border-color: var(--brand-blue);
    background: var(--brand-blue-light);
}
.tenant-info {
    flex: 1;
    min-width: 0;
}
.tenant-name {
    font-weight: 700;
    font-size: var(--text-body);
    margin-bottom: 2px;
}
.tenant-meta {
    font-size: var(--text-caption);
    color: var(--color-text-muted);
}
.tenant-arrow {
    color: var(--color-text-muted);
    font-size: 24px;
}

/* == [module:shell] AUTH PAGES — deliberate 1:1 port of cgbg's auth styling. == */
/* This is the single source of truth for .auth-* rules; the three earlier
   partial blocks in this file (which fought each other with !important)
   were folded in here. Values are cgbg's literals rather than idbg tokens
   wherever the two differ — the point of this block is that the two apps
   render identically, so a token that is merely "close" (e.g. --color-border
   #E2E8F0 vs cgbg's #e8e8e8) would defeat it. Tokens are used only where
   they are an exact match (--brand-blue, --radius). */
/* cgbg's body is #fafafa; idbg's is white, so the auth page opts in to the
   tint locally — otherwise the white card on white reads as a flat box. */
body.page-auth {
    background: #fafafa;
}
.auth-section {
    padding: 60px 20px;
    display: flex;
    justify-content: center;
}
.auth-card {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 14px;
    padding: 40px;
    max-width: 420px;
    width: 100%;
}
/* Headings are left-aligned in cgbg, not centred. */
.auth-card h1 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: normal;
    text-align: left;
    margin-bottom: 6px;
}
.auth-sub {
    font-size: 16px;
    color: #666;
    text-align: left;
    margin-bottom: 24px;
}
/* verify_sent opts into a centred card; the left-aligned defaults above
   would otherwise strand its heading beside a centred icon. */
.auth-card.text-center h1,
.auth-card.text-center .auth-sub {
    text-align: center;
}
/* „Не получаваш имейл?" след регистрацията (auth/verify_sent.phtml).
   Съдържанието е в .alert-body, така че заглавието стои над списъка.
   Имейлът е една дълга „дума" (systest+…@example.test) — пренася се
   където трябва, вместо да бута страницата встрани. */
.auth-card .verify-help { text-align: left; margin-top: 24px; align-items: flex-start; }
.auth-card .verify-help-list { margin: 8px 0 0 18px; padding: 0; font-size: 13px; }
.auth-card .verify-help-list li + li { margin-top: 4px; }
.auth-card .verify-help-text { margin: 8px 0 0; font-size: 13px; }
.auth-card .verify-help-email { overflow-wrap: anywhere; }
@media (max-width: 480px) {
    .auth-card { padding: 28px 20px; }
}
.auth-card .auth-remember-me input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--brand-blue);
    cursor: pointer;
}
.auth-switch {
    text-align: center;
    margin-top: 16px;
    font-size: 14px;
    color: #666;
}
.auth-card .legal-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 1px;
    accent-color: var(--brand-blue);
    cursor: pointer;
    flex-shrink: 0;
}
.auth-card .legal-check span {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    color: #555;
    line-height: 1.5;
}
.auth-card .legal-check a {
    color: var(--brand-blue);
    text-decoration: underline;
}
/* --- Utility --- */
.text-center {
    text-align: center;
}

/* == [module:shell] ИЗВЕСТИЯ — камбанка в хедъра + страница == */
/* Събитията идват отвън (клиент отваря/приема/отказва проформа), затова им
   трябва място в интерфейса, което преживява презареждане — flash съобщение
   не върши работа. */
.notif-page-list {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    overflow: hidden;
}

/* == [module:shell] SEO: ключовата дума в H1 и страницата за 404 == */
.error-page {
    padding: var(--space-20) 0 var(--space-16);
    text-align: center;
}
.error-page h1 {
    font-size: clamp(26px, 3vw, 36px);
    margin-bottom: var(--space-3);
}

/* == [module:home] BUTTONS — замразените бутони на началната (§13) == */
/* Началната страница не се мени: бутоните в design-base.css станаха 40px
   (32 / 48) с подложка от скалата — тук са досегашните стойности (37px,
   10×18 / 7×12 / 14×28 и 17px за btn-lg), и на докосване. Бяха в
   design-components.css, докато bin/ui-cssmap.php не можеше да стесни
   глобален клас (.btn) до една страница (narrow() — поправено). */
body.page-home .btn { min-height: auto; padding: 10px 18px; }
body.page-home .btn-sm { min-height: auto; padding: 7px 12px; }
body.page-home .btn-lg { min-height: auto; padding: 14px 28px; font-size: var(--text-home-btn-lg); }
body.page-home .btn-primary { border-color: transparent; }
body.page-home .btn:disabled,
body.page-home .btn[disabled] { opacity: .5; }

/* == [module:home] HEADER + NAV — redesigned Apr 2026 (PLAN7) == */
/* Layout: [Logo] [Firm chip]  [Primary nav]  [+New] [Search] [Avatar] */
/* Public header nav (logged out) — distinct from public doc view .public-nav */
.site-header .site-public-nav {
    /* cgbg .main-nav gap is 4px */
    gap: var(--space-1);
    margin-left: var(--space-4);
    justify-content: flex-start !important;
    flex: 0 1 auto !important;
}

/* == [module:home] FOOTER == */
.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: var(--space-6);
}
@media (max-width: 720px) {
    .footer-grid { grid-template-columns: 1fr 1fr; }
    .footer-brand { grid-column: 1 / -1; }
}
.footer-brand img { margin-bottom: var(--space-2); }
.footer-brand p {
    color: var(--color-text-secondary);
    font-size: var(--text-small);
    margin: 0 0 var(--space-1);
}
.footer-col .footer-heading {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--color-text-muted);
    letter-spacing: 0.5px;
    font-weight: 700;
    margin: 0 0 var(--space-2);
}
.footer-col a:hover { color: var(--brand-blue); }

/* == [module:home] PAGE DESCRIPTION — generic subtitle under page head == */
/* Footer compliance disclaimer. Без opacity: #888 върху тъмния футър е
   4.9:1, а с .75 падаше под 4.5:1 (WCAG AA). */
.footer-disclaimer {
    font-size: 11px;
    line-height: 1.45;
    margin-top: var(--space-3);
}

/* == [module:home] IDBG — App styles == */
/* Extends brand-tokens.css */
/* --- Hero --- */
.hero {
    padding: var(--space-24) 0 var(--space-20);
    background: radial-gradient(circle at 20% 10%, rgba(11, 95, 255, .06) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(255, 176, 46, .06) 0%, transparent 50%),
    var(--color-bg);
    position: relative;
    overflow: hidden;
}
.hero-tag {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: 6px 14px;
    background: var(--brand-blue-light);
    color: var(--brand-blue-dark);
    border-radius: var(--radius-full);
    font-size: var(--text-small);
    font-weight: 600;
    margin-bottom: var(--space-6);
}
.hero-title {
    font-size: var(--text-hero);
    font-weight: 800;
    line-height: var(--leading-tight);
    letter-spacing: -0.03em;
    margin-bottom: var(--space-5);
}
.hero-title .hl {
    color: var(--brand-blue);
}
.hero-title .hl-amber {
    color: var(--brand-amber-dark);
}
.hero-lead {
    font-size: var(--text-body-lg);
    color: var(--color-text-secondary);
    margin-bottom: var(--space-8);
    line-height: var(--leading-relaxed);
}
.hero-cta {
    display: flex;
    gap: var(--space-3);
    margin-bottom: var(--space-5);
    flex-wrap: wrap;
}
/* Trust points under the hero CTA — check ticks, mirroring cgbg's
   .hero-bullets. Left-aligned here (idbg's hero is a split layout, not
   cgbg's centred column), so no auto margin or max-width. */
.hero-bullets {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}
.hero-bullets li {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: var(--text-small);
    color: var(--color-text-secondary);
    line-height: var(--leading-relaxed);
}
.hero-bullet-ico {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    border-radius: var(--radius);
    background: rgba(11, 95, 255, 0.08);
    color: var(--brand-blue);
}
.hero-bullet-ico svg {
    width: 16px;
    height: 16px;
}
/* --------------------------------------------------------------------------
   Hero — светъл, две колони: текст вляво, илюстрация вдясно.
   Илюстрацията е unDraw (MIT) — виж App/View/partials/hero-art.phtml.
   -------------------------------------------------------------------------- */
/* --------------------------------------------------------------------------
   Общ поток на началната страница.

   Hero, стъпките, модулите и цените споделят ЕДИН фон, вместо всяка секция
   да си носи свой. Така преходите са преливащи, а не отрязани. Секциите вътре
   са прозрачни; цветът се променя плавно надолу през няколко меки петна.
   -------------------------------------------------------------------------- */
.page-flow {
    position: relative;
    background:
        radial-gradient(52% 26% at 70% 6%, rgba(11, 95, 255, .11), transparent 70%),
        radial-gradient(44% 20% at 10% 20%, rgba(255, 138, 0, .07), transparent 72%),
        radial-gradient(50% 20% at 24% 44%, rgba(11, 95, 255, .07), transparent 72%),
        radial-gradient(46% 18% at 84% 60%, rgba(255, 138, 0, .06), transparent 72%),
        radial-gradient(52% 22% at 30% 82%, rgba(11, 95, 255, .06), transparent 72%),
        linear-gradient(180deg, #ffffff 0%, #fbfcfe 34%, #f6f9fd 62%, #fbfcfe 84%, #ffffff 100%);
}
.page-flow > section {
    position: relative;
    z-index: 1;
    background: transparent;
}
/* Нишката лежи зад съдържанието и се разтяга по цялата височина на потока. */
.flow-thread {
    position: absolute;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}
@media (max-width: 1000px) {
    /* Под 1000px всичко е в една колона и странични полета няма — гутерът е 24px.
       Разтегната по височината на такава страница нишката се изражда във
       вертикална черта през съдържанието, затова там я махаме. */
    .flow-thread { display: none; }
    /* Вместо нишката: къса вертикална връзка с ромбче между всеки две
           секции. Прави се с псевдоелементи върху самата секция, за да няма
           допълнителна разметка само за декорация. */
    .page-flow > section + section::before,
        .page-flow > section + section::after {
            content: '';
            position: absolute;
            left: 50%;
            pointer-events: none;
        }
    .page-flow > section + section::before {
            top: 0;
            width: 1px;
            height: 46px;
            transform: translateX(-50%);
            background: linear-gradient(180deg, transparent, rgba(11, 95, 255, .3));
        }
    .page-flow > section + section::after {
            top: 46px;
            width: 7px;
            height: 7px;
            border-radius: 2px;
            transform: translate(-50%, -50%) rotate(45deg);
            background: var(--brand-blue);
            opacity: .5;
        }
    /* Стъпките стават таймлайн — релса с възли, вместо три еднакви кутии. */
    .how-section .steps {
            position: relative;
            padding-left: 36px;
        }
    .how-section .steps::before {
            content: '';
            position: absolute;
            left: 11px;
            top: 24px;
            bottom: 24px;
            width: 2px;
            border-radius: 1px;
            background: linear-gradient(180deg,
                rgba(11, 95, 255, .38),
                rgba(11, 95, 255, .22) 60%,
                rgba(255, 138, 0, .32));
        }
}
/* --------------------------------------------------------------------------
   Hero — центрирана композиция: заглавие горе, илюстрацията в средата,
   предимствата я обграждат отляво и отдясно, CTA отдолу. Всичко седи върху
   едно общо светлинно поле, за да няма усещане за разделен на две екран.
   Илюстрацията е unDraw (MIT) — виж App/View/partials/hero-art.phtml.
   -------------------------------------------------------------------------- */
.hero--center {
    position: relative;
    overflow: hidden;
    padding: var(--space-10) 0 var(--space-12);
}
/* Собственото сияние на hero-то, но БЕЗ плътен цвят отдолу — иначе би
   закрило общия фон на .page-flow и преходът пак би станал рязък.
   Селекторът е по-специфичен от `.page-flow > section`, за да не се нулира. */
.page-flow > .hero--center {
    background:
        radial-gradient(56% 50% at 52% 44%, rgba(11, 95, 255, .09), transparent 68%),
        radial-gradient(40% 42% at 10% 86%, rgba(255, 138, 0, .06), transparent 70%);
}
.hero-head {
    max-width: 860px;
    margin: 0 auto var(--space-6);
    text-align: center;
}
.hero--center .hero-title {
    font-size: clamp(30px, 3.6vw, 46px);
    line-height: 1.12;
    letter-spacing: -0.025em;
    margin-bottom: var(--space-4);
}
.hero--center .hero-lead {
    font-size: var(--text-body-lg);
    max-width: 46ch;
    margin: 0 auto;
}
.hero--center .hero-tag {
    margin-bottom: var(--space-5);
}
/* Трите колони са нарочно неравни: вляво само имена на модули, вдясно
   по-едри карета с описание, а илюстрацията е изместена вдясно от центъра. */
.hero-stage {
    display: grid;
    grid-template-columns: minmax(170px, 232px) minmax(0, 1fr) minmax(230px, 310px);
    align-items: center;
    gap: var(--space-4);
    max-width: 1180px;
    margin-inline: auto;
}
/* Лявата колона — компактен списък само с имена. */
.hero-names {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    margin: 0;
    padding: 0;
    list-style: none;
}
.hero-name {
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    gap: var(--space-3);
    text-align: right;
    font-size: var(--text-small);
    font-weight: 600;
    color: var(--color-text-primary);
}
.hero-name-ico {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    flex: 0 0 auto;
    border-radius: var(--radius-md);
    background: var(--brand-blue-light);
    color: var(--brand-blue);
}
/* Дясната колона — по-едра типография с описание. */
.hero-feats {
    display: flex;
    flex-direction: column;
    gap: calc(var(--space-6) + var(--space-1));   /* 28px — --space-7 няма в скалата */
    margin: 0;
    padding: 0;
    list-style: none;
}
.hero-feat {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
}
.hero-feat-ico {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    border-radius: var(--radius-md);
    background: var(--brand-blue-light);
    color: var(--brand-blue);
}
.hero-feat-txt {
    font-size: var(--text-body);
    line-height: var(--leading-relaxed);
    color: var(--color-text-secondary);
}
.hero-feat-txt strong {
    display: block;
    font-size: var(--text-h4, 19px);
    font-weight: 700;
    color: var(--color-text-primary);
    margin-bottom: 3px;
}
/* Изричното width:100% е нужно: с margin-inline:auto grid елементът спира да
   се разтяга и inline SVG-то пада до дефолтните 300px за replaced елемент. */
.hero-art {
    position: relative;
    width: 100%;
    max-width: 580px;
    justify-self: end;
    transform: translateX(5%);
}
/* Ореолът зад монитора се разлива под съседните колони и слепва трите. */
.hero-art::before {
    content: '';
    position: absolute;
    inset: -18% -26% -12%;
    z-index: -1;
    background: radial-gradient(closest-side, rgba(11, 95, 255, .16), transparent 72%);
}
.hero-art-svg {
    display: block;
    width: 100%;
    height: auto;
    /* Колоните на графиката и логото са currentColor — оттук идва брандът. */
    color: var(--brand-blue);
}
.hero-foot {
    margin-top: var(--space-6);
    text-align: center;
}
.hero--center .hero-cta {
    justify-content: center;
    margin-bottom: var(--space-4);
}
/* Upstream стилизира .hero-bullets за split hero — вертикално и подравнено
   вляво. Тук hero-то е центрирано, затова ги подреждаме в един центриран ред. */
.hero--center .hero-bullets {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-2) var(--space-6);
}
@media (max-width: 1080px) {
    /* Илюстрацията минава отгоре, предимствата се подреждат в две колони. */
    .hero-stage {
            grid-template-columns: 1fr 1fr;
            gap: var(--space-8) var(--space-10);
        }
    /* order:-1 я изважда преди двата списъка — иначе застава между тях. */
    .hero-art {
            order: -1;
            grid-column: 1 / -1;
            max-width: 520px;
            justify-self: center;
            transform: none;
            margin-bottom: var(--space-4);
        }
    .hero-names {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: var(--space-3) var(--space-6);
        }
    .hero-name {
            flex-direction: row;
            text-align: left;
        }
}
@media (max-width: 600px) {
    .hero--center {
            padding: var(--space-10) 0 var(--space-10);
        }
    .hero-stage {
            grid-template-columns: 1fr;
            gap: var(--space-5);
        }
    .hero-names {
            grid-template-columns: 1fr;
        }
    .hero--center .hero-cta {
            flex-direction: column;
        }
}
/* Същият син акцент като в hero-то, но за заглавията на секциите
   (Trello #87, фиг199-202). */
.section-title .hl { color: var(--brand-blue); }
.section-sub {
    text-align: center;
    color: var(--color-text-secondary);
    font-size: var(--text-body-lg);
    max-width: 640px;
    margin: 0 auto var(--space-12);
}
/* --------------------------------------------------------------------------
   Секциите под hero-то следват същия „разместен" ритъм: заглавието и
   подзаглавието са едно до друго вместо центрирани, стъпките са разместени
   по вертикала, а каретата са bento решетка с различни ширини.
   -------------------------------------------------------------------------- */
.section-head {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    align-items: end;
    gap: var(--space-8);
    margin-bottom: var(--space-12);
}
.section-head .section-title {
    text-align: left;
    margin: 0;
    font-size: clamp(26px, 2.8vw, 36px);
    line-height: 1.18;
    letter-spacing: -0.02em;
}
.section-head .section-sub {
    text-align: left;
    margin: 0 0 var(--space-2);
    max-width: 42ch;
}
/* --- How it works: карти вляво, обяснение вдясно --- */
.how-section {
    padding: var(--space-12) 0 var(--space-16);
}
.how-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: center;
    gap: var(--space-12);
}
/* В кода обяснението е преди картите (H2 преди H3-ите на стъпките), а
   вляво картите ги слага order. */
.how-split > .steps { order: -1; }
.steps {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    margin: 0;
    padding: 0;
    list-style: none;
}
.step-num {
    font-size: 24px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.03em;
    color: var(--brand-blue);
    opacity: .22;
}
.step-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin: 0;
    border-radius: 10px;
    background: linear-gradient(135deg, #f0f5ff 0%, #e0ecff 100%);
    color: var(--brand-blue);
}
.step-icon svg { stroke-width: 1.8; }
.how-text .section-title {
    text-align: left;
    margin: 0 0 var(--space-4);
    font-size: clamp(26px, 2.8vw, 36px);
    line-height: 1.18;
    letter-spacing: -0.02em;
}
.how-text p {
    color: var(--color-text-secondary);
    line-height: var(--leading-relaxed);
    margin-bottom: var(--space-4);
    max-width: 46ch;
}
@media (max-width: 1000px) {
    .section-head {
            grid-template-columns: 1fr;
            gap: var(--space-3);
        }
    .how-split {
            grid-template-columns: 1fr;
            gap: var(--space-8);
        }
    /* Един стълб: обяснението над картите — както е в кода. */
    .how-split > .steps { order: 0; }
}
/* --- Features: каретата стоят подравнени едно до друго --- */
.features-section {
    padding: var(--space-12) 0 var(--space-16);
}
.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-4);
}
@media (max-width: 900px) {
    .features-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
    .features-grid { grid-template-columns: 1fr; }
}
.feature-card {
    /* Полупрозрачни, за да пропускат общия фон — оттам идва „преливането". */
    background: rgba(255, 255, 255, .72);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(226, 232, 240, .85);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    position: relative;
    transition: all var(--duration) var(--ease-out);
}
.feature-card:hover {
    border-color: var(--brand-blue);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}
/* Matches cgbg's .feature-icon exactly: 56px chip, 12px radius, blue gradient. */
.feature-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin-bottom: var(--space-3);
    border-radius: 12px;
    background: linear-gradient(135deg, #f0f5ff 0%, #e0ecff 100%);
    color: var(--brand-blue);
}
.feature-icon svg { stroke-width: 1.8; }
.feature-card h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: var(--space-2);
}
.feature-card p {
    font-size: var(--text-small);
    color: var(--color-text-secondary);
    line-height: var(--leading-relaxed);
}
/* cgbg's Pro badge is a blue gradient pill with an 8px radius, not amber. */
.feature-pro .feature-badge {
    position: absolute;
    top: 14px;
    right: 14px;
    background: linear-gradient(135deg, var(--brand-blue), var(--brand-blue-mid));
    color: #fff;
    padding: 3px 8px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
/* --- Направено за българския бизнес --- */
.local-section {
    padding: var(--space-12) 0 var(--space-16);
}
.local-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-5) var(--space-8);
    margin: 0;
    padding: 0;
    list-style: none;
}
/* След като „Готови за еврото" отпадна, точките са четири — 2×2 стои по-добре
   от 3+1 (Trello #85, фиг174). */
.local-grid--2x2 { grid-template-columns: repeat(2, 1fr); }
/* Заглавието и абзацът отдясно тръгват от един и същи ред. Общото правило
   лепи двете колони за долния ръб (align-items: end) и добавя 8px отдолу на
   абзаца, така че нито горе, нито долу се получаваше линия. */
.local-section .section-head { align-items: start; }
.local-section .section-head .section-sub { margin-bottom: 0; }
.local-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    font-size: var(--text-small);
    color: var(--color-text-secondary);
    line-height: var(--leading-relaxed);
}
.local-item strong {
    display: block;
    font-size: var(--text-body);
    font-weight: 700;
    color: var(--color-text-primary);
    margin-bottom: 2px;
}
.local-ico {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    border-radius: 10px;
    background: var(--brand-blue-light);
    color: var(--brand-blue);
}
/* --- Въпроси --- */
.faq-section {
    padding: var(--space-12) 0 var(--space-16);
}
/* Подзаглавието кани да пишеш — затова до него стои и бутонът, с който да го
   направиш (Trello #85, фиг175). */
/* Заглавието и текстът вдясно тръгват от един ред. `.section-head` е
   `align-items: end`, което работи за две текстови колони, но тук дясната носи
   и бутон — долното подравняване я вдигаше над заглавието (Trello #85,
   коментар по №175). */
.faq-section .section-head { align-items: start; }
.faq-section .section-head .section-sub { margin-bottom: 0; }
.faq-sub {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
}
.faq-sub p { margin: 0; }
.faq-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3) var(--space-6);
    align-content: start;
}
.faq-item {
    background: rgba(255, 255, 255, .72);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(226, 232, 240, .85);
    border-radius: var(--radius-lg);
    padding: var(--space-4) var(--space-5);
    height: fit-content;
}
.faq-item summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    font-size: var(--text-body);
    font-weight: 700;
    color: var(--color-text-primary);
    cursor: pointer;
    list-style: none;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary { text-wrap: pretty; }
/* Иконките са в синьото на марката, като тези на модулите горе (Trello #85,
   коментар по №175) — емотиконките се рисуваха от системния emoji шрифт, тоест
   различно на всяка платформа и в чужди цветове. Фиксираната кутия държи
   въпросите на един вертикал независимо от иконката. */
.faq-icon {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    margin-right: 10px;
    color: var(--brand-blue);
}
/* Емотиконката е самостоятелен flex елемент, а summary е space-between —
   без това въпросът увисва в средата, разкъсан между иконката и „+".
   Знакът се държи вдясно от собствения си margin, не от разпределението. */
.faq-item summary { justify-content: flex-start; }
.faq-item summary::after { margin-left: auto; }
.faq-item summary::after {
    content: '+';
    font-size: 20px;
    font-weight: 400;
    line-height: 1;
    color: var(--brand-blue);
    flex: 0 0 auto;
    transition: transform var(--duration) var(--ease-out);
}
/* Знакът се СМЕНЯ на „−" (виж по-долното правило за content). Останалото от
   по-старата версия въртене на 45° го превръщаше в наклонена чертичка —
   точно това, което се вижда на фиг175. */
.faq-item[open] summary::after {
    transform: none;
}
.faq-item p {
    margin-top: var(--space-3);
    font-size: var(--text-small);
    color: var(--color-text-secondary);
    line-height: var(--leading-relaxed);
}
@media (max-width: 900px) {
    .local-grid { grid-template-columns: repeat(2, 1fr); }
    .faq-list   { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .local-grid,
        .local-grid--2x2 { grid-template-columns: 1fr; }
}
/* --- Цени на началната страница (Trello #196) --- */
.pricing-section {
    padding: var(--space-12) 0 var(--space-20);
}
/* „Цени" е котва към средата на дългата начална страница, а заглавката е
   sticky — без този отстъп секцията спира под нея и заглавието е отрязано. */
.pricing-section[id] {
    scroll-margin-top: 72px;
}
/* --- FAQ --- */
.faq-section {
    padding: var(--space-20) 0;
    background: var(--color-bg-subtle);
}
.faq-item {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-5) var(--space-6);
    transition: all var(--duration-fast) var(--ease-out);
}
.faq-item[open] {
    border-color: var(--brand-blue);
    box-shadow: var(--shadow-sm);
}
.faq-item summary {
    font-weight: 600;
    cursor: pointer;
    font-size: var(--text-body);
}
.faq-item summary::-webkit-details-marker {
    display: none;
}
.faq-item summary::after {
    content: '+';
    float: right;
    color: var(--color-text-muted);
    font-size: 20px;
    font-weight: 300;
}
.faq-item[open] summary::after {
    content: '−';
}
.faq-item p {
    margin-top: var(--space-3);
    color: var(--color-text-secondary);
    font-size: var(--text-small);
    line-height: var(--leading-relaxed);
}

/* == [module:home] AUTH PAGES — deliberate 1:1 port of cgbg's auth styling. == */
/* This is the single source of truth for .auth-* rules; the three earlier
   partial blocks in this file (which fought each other with !important)
   were folded in here. Values are cgbg's literals rather than idbg tokens
   wherever the two differ — the point of this block is that the two apps
   render identically, so a token that is merely "close" (e.g. --color-border
   #E2E8F0 vs cgbg's #e8e8e8) would defeat it. Tokens are used only where
   they are an exact match (--brand-blue, --radius). */
.footer-grid {
    display: grid;
    /* Трите колони с връзки се събират в десния край на футъра. */
    grid-template-columns: 1fr auto auto auto;
    gap: var(--space-10);
    margin-bottom: var(--space-10);
}
.footer-brand {
    max-width: 440px;
}
/* Footer logo: brand-blue mark + white wordmark, like cgbg's blue/white
   footer logo. No invert filter — the mark should keep its brand colour. */
.footer-logo {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: var(--space-3);
}
.footer-brand img {
    margin-bottom: 0;
}
.footer-brand p {
    font-size: 13px;
    color: #888;
    line-height: var(--leading-relaxed);
    margin-bottom: var(--space-2);
}
.footer-col .footer-heading {
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--space-3);
}
.footer-col a {
    display: block;
    padding: 4px 0;
    color: #aaa;
    font-size: 13px;
    transition: color var(--duration-fast) var(--ease-out);
}
.footer-col a:hover {
    color: var(--brand-blue-mid);
}
/* Долната лента: копирайтът стои сам, центриран, отделен с тънка линия —
   както в cgbg. Единственото място, където се изписва годината. */
.footer-bottom {
    border-top: 1px solid #333;
    padding-top: var(--space-5);
    text-align: center;
    font-size: 12px;
    color: #9aa0ae;
}
.footer-bottom p {
    margin: 0;
}
@media (max-width: 960px) {
    .hero-title {
            font-size: 42px;
        }
    .footer-grid {
            grid-template-columns: 1fr 1fr;
            gap: var(--space-6);
        }
}
@media (max-width: 600px) {
    .hero {
            padding: var(--space-12) 0 var(--space-10);
        }
    .hero-title {
            font-size: 36px;
        }
    .hero-cta {
            flex-direction: column;
        }
    .footer-grid {
            grid-template-columns: 1fr;
        }
}

/* == [module:home] SEO: ключовата дума в H1 и страницата за 404 == */
/* Надзаглавието е вътре в H1 на началната страница — изглежда като
   .hero-tag, но стои на собствен ред и не наследява едрия шрифт и сбитата
   разредка на заглавието. */
.hero-title .hero-tag--in-title {
    display: flex;
    width: fit-content;
    margin: 0 auto var(--space-5);
    letter-spacing: normal;
    line-height: 1.4;
}
