/* ─── Reset & Variables ─────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --color-primary:   #2563eb;
    --color-primary-h: #1d4ed8;
    --color-danger:    #dc2626;
    --color-success:   #16a34a;
    --color-secondary: #6b7280;
    --color-bg:        #f3f4f6;
    --color-surface:   #ffffff;
    --color-border:    #e5e7eb;
    --color-text:      #111827;
    --color-muted:     #6b7280;
    --radius:          8px;
    --shadow:          0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
    --shadow-lg:       0 10px 25px rgba(0,0,0,.12);

    /* Stage colours */
    --stage-analytics:   #7c3aed;
    --stage-assortment:  #ea580c;
    --stage-development: #16a34a;
    --stage-planning:    #2563eb;
    --stage-production:  #ca8a04;
    --stage-presales:    #dc2626;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    background: var(--color-bg);
    color: var(--color-text);
    min-height: 100vh;
}

/* ─── Buttons ───────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, box-shadow .15s;
    white-space: nowrap;
}
.btn-primary   { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-h); }
.btn-secondary { background: #e0e7ff; color: var(--color-primary); }
.btn-secondary:hover { background: #c7d2fe; }
.btn-danger    { background: var(--color-danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-ghost     { background: transparent; color: var(--color-secondary); border: 1px solid var(--color-border); }
.btn-ghost:hover { background: var(--color-border); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { padding: 6px; border-radius: 6px; }

/* ─── Forms ─────────────────────────────────────────────── */
.form-section { margin-bottom: 24px; }
.form-section__title {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--color-border);
}
.form-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}
.form-group { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.form-group--full { flex: 0 0 100%; }
.form-label { font-size: 12px; font-weight: 500; color: var(--color-secondary); }
.form-label--required::after { content: ' *'; color: var(--color-danger); }
.form-label-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sort-actions { display: inline-flex; align-items: center; gap: 4px; }
.sort-add-btn,
.sort-del-btn {
    width: 22px;
    height: 22px;
    border: 1px solid var(--color-border);
    border-radius: 50%;
    background: #fff;
    color: var(--color-primary);
    font-size: 16px;
    line-height: 18px;
    font-weight: 600;
    cursor: pointer;
}
.sort-add-btn:hover { background: #eff6ff; border-color: var(--color-primary); }
.sort-del-btn { color: var(--color-danger); }
.sort-del-btn:hover { background: #fef2f2; border-color: var(--color-danger); }
.form-input, .form-select, .form-textarea {
    padding: 8px 10px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-size: 13px;
    color: var(--color-text);
    background: var(--color-surface);
    outline: none;
    transition: border-color .15s;
    width: 100%;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(37,99,235,.15);
}
.form-textarea { resize: vertical; font-family: inherit; }
.form-input--error { border-color: var(--color-danger) !important; box-shadow: 0 0 0 2px rgba(220,38,38,.15) !important; }
.form-field-error { display: block; margin-top: 4px; font-size: 12px; color: var(--color-danger); }

/* Stage selector */
.stage-selector { display: flex; flex-wrap: wrap; gap: 6px; }
.stage-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all .15s;
    color: #fff;
    opacity: .7;
}
.stage-chip input { display: none; }
.stage-chip:has(input:checked) { opacity: 1; border-color: rgba(0,0,0,.2); }
.stage-chip--analytics   { background: var(--stage-analytics); }
.stage-chip--assortment  { background: var(--stage-assortment); }
.stage-chip--development { background: var(--stage-development); }
.stage-chip--planning    { background: var(--stage-planning); }
.stage-chip--production  { background: var(--stage-production); }
.stage-chip--presales    { background: var(--stage-presales); }

/* ─── Modal ─────────────────────────────────────────────── */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 100;
}
.modal {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 640px;
    max-width: 95vw;
    max-height: 90vh;
    background: var(--color-surface);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    z-index: 101;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.modal--sm { width: 400px; }
.modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}
.modal__title { font-size: 16px; font-weight: 600; }
.modal__close {
    background: none; border: none; cursor: pointer;
    font-size: 20px; color: var(--color-muted);
    padding: 2px 6px; border-radius: 4px;
    line-height: 1;
}
.modal__close:hover { background: var(--color-border); }
.modal__body { padding: 20px; overflow-y: auto; flex: 1; }
.modal__footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid var(--color-border);
    flex-shrink: 0;
}
.hidden { display: none !important; }

/* ─── Page header ───────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow);
}
.page-header__back {
    display: flex; align-items: center;
    gap: 4px; color: var(--color-secondary);
    text-decoration: none; font-size: 13px;
}
.page-header__back:hover { color: var(--color-primary); }
.page-header__title { font-size: 16px; font-weight: 600; flex: 1; }
.page-header__actions { display: flex; gap: 8px; }

/* ─── Main screen ───────────────────────────────────────── */
.page-main {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.page-main .page-header { background: var(--color-primary); border-bottom: none; }
.page-main .page-header__title { color: #fff; font-size: 18px; }
.main-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
}
.nav-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    width: 100%;
    max-width: 900px;
}
.nav-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 32px 20px;
    background: var(--color-surface);
    border-radius: 12px;
    border: 2px solid var(--color-border);
    text-decoration: none;
    color: var(--color-text);
    transition: border-color .2s, box-shadow .2s, transform .15s;
    cursor: pointer;
    text-align: center;
}
.nav-card:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}
.nav-card__icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px;
}
.nav-card__title { font-size: 14px; font-weight: 600; }
.nav-card__desc { font-size: 12px; color: var(--color-muted); }

/* ─── Canvas page ───────────────────────────────────────── */
.canvas-page {
    display: flex;
    height: 100vh;
    overflow: hidden;
}
.canvas-sidebar {
    width: 260px;
    flex-shrink: 0;
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.sidebar-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}
.sidebar-header h3 { font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.sidebar-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}
.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--color-border);
    flex-shrink: 0;
}
.sidebar-section-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
    margin: 8px 0 6px;
}

/* Draggable task items in sidebar */
.task-template-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px dashed var(--color-border);
    margin-bottom: 6px;
    cursor: grab;
    background: var(--color-surface);
    transition: border-color .15s, background .15s;
    user-select: none;
}
.task-template-item:hover {
    border-color: var(--color-primary);
    background: #eff6ff;
}
.task-template-item:active { cursor: grabbing; }
.task-template-item__stage {
    width: 4px;
    align-self: stretch;
    border-radius: 2px;
    flex-shrink: 0;
}
.task-template-item__body { flex: 1; min-width: 0; }
.task-template-item__name { font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-template-item__meta { font-size: 11px; color: var(--color-muted); margin-top: 2px; }

/* Canvas wrapper */
.canvas-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}
.canvas-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow);
    z-index: 10;
    flex-shrink: 0;
}
.canvas-toolbar__title {
    flex: 1;
    font-size: 15px;
    font-weight: 600;
}
.canvas-toolbar__actions { display: flex; gap: 8px; }

#drawflow {
    flex: 1;
    width: 100%;
    position: relative;
    overflow: hidden;
}

/* Override Drawflow defaults */
.drawflow .drawflow-node {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    box-shadow: var(--shadow);
    padding: 0;
    min-width: 200px;
    width: auto;
}
.drawflow .drawflow-node.is-start-node {
    border-color: var(--color-success);
    box-shadow: 0 0 0 2px rgba(22,163,74,.15), var(--shadow);
}
.drawflow .drawflow-node.is-start-node::before {
    content: '▶ СТАРТ';
    position: absolute;
    top: -20px;
    left: 0;
    background: var(--color-success);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .07em;
    padding: 2px 7px;
    border-radius: 4px 4px 0 0;
    white-space: nowrap;
    pointer-events: none;
}
.drawflow .drawflow-node.has-cycle {
    border-color: var(--color-danger);
    box-shadow: 0 0 0 2px rgba(220,38,38,.2), var(--shadow);
    animation: pulse-cycle 1.4s ease-in-out infinite;
}
.drawflow .drawflow-node.has-cycle::after {
    content: '⚠ Цикл';
    position: absolute;
    top: -20px;
    right: 0;
    background: var(--color-danger);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px 4px 0 0;
    pointer-events: none;
}
@keyframes pulse-cycle {
    0%, 100% { box-shadow: 0 0 0 2px rgba(220,38,38,.2), var(--shadow); }
    50%       { box-shadow: 0 0 0 5px rgba(220,38,38,.35), var(--shadow); }
}
.drawflow .drawflow-node.selected {
    background: var(--color-surface);   /* перебиваем дефолтный red от Drawflow */
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(37,99,235,.25), var(--shadow-lg);
}

/* Нативная кнопка Drawflow — скрываем навсегда */
.drawflow .drawflow-node .drawflow-delete { display: none !important; }

/* Наша кнопка удаления — появляется при наведении на ноду */
.task-node__del-btn {
    display: none;
    position: absolute;
    top: -10px;
    right: -10px;
    z-index: 20;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--color-danger);
    color: #fff;
    font-size: 11px;
    line-height: 20px;
    text-align: center;
    cursor: pointer;
    border: none;
    box-shadow: 0 1px 4px rgba(0,0,0,.3);
    transition: transform .1s, background .1s;
    padding: 0;
}
.task-node__del-btn:hover { transform: scale(1.2); background: #b91c1c; }
.drawflow-node:hover .task-node__del-btn { display: block; }

/* Кнопка удаления связи */
.conn-del-btn {
    position: absolute;
    z-index: 30;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--color-danger);
    color: #fff;
    font-size: 11px;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    box-shadow: 0 1px 4px rgba(0,0,0,.35);
    transition: transform .1s, background .1s;
    padding: 0;
    pointer-events: all;
    line-height: 1;
}
.conn-del-btn:hover { transform: scale(1.2); background: #b91c1c; }
.drawflow .drawflow-node .input,
.drawflow .drawflow-node .output {
    background: var(--color-surface);
    border: 2px solid var(--color-border);
    width: 12px;
    height: 12px;
    border-radius: 50%;
}
.drawflow .drawflow-node .input:hover,
.drawflow .drawflow-node .output:hover {
    background: var(--color-primary);
    border-color: var(--color-primary);
}
.drawflow .connection .main-path {
    stroke: var(--color-primary);
    stroke-width: 2;
}
.drawflow .connection .main-path:hover,
.drawflow .connection .main-path.selected {
    stroke: var(--color-primary-h);
    stroke-width: 3;
}
.drawflow > .drawflow {
    background-color: #f8fafc;
    background-image: radial-gradient(circle, #cbd5e1 1px, transparent 1px);
    background-size: 24px 24px;
}

/* Zoom controls */
.canvas-zoom {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 10;
}
.canvas-zoom .btn {
    width: 32px;
    height: 32px;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow);
}

/* ─── Task node (Drawflow content) ─────────────────────── */
.task-node {
    min-width: 200px;
    max-width: 240px;
    cursor: pointer;
    overflow: hidden;
    border-radius: 9px;
}
.task-node__stage {
    padding: 5px 12px;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    letter-spacing: .03em;
}
.task-node__stage--analytics   { background: var(--stage-analytics); }
.task-node__stage--assortment  { background: var(--stage-assortment); }
.task-node__stage--development { background: var(--stage-development); }
.task-node__stage--planning    { background: var(--stage-planning); }
.task-node__stage--production  { background: var(--stage-production); }
.task-node__stage--presales    { background: var(--stage-presales); }
.task-node__stage--none        { background: #94a3b8; color: rgba(255,255,255,.7); }
.task-node__body { padding: 10px 12px; }
.task-node__name {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 6px;
    color: var(--color-text);
}
.task-node__meta {
    display: flex;
    gap: 10px;
    font-size: 11px;
    color: var(--color-muted);
}
.task-node__meta span { display: flex; align-items: center; gap: 3px; }

/* ─── Simple list pages ─────────────────────────────────── */
.page-content { padding: 24px; max-width: 1000px; margin: 0 auto; }
.page-list { background: var(--color-surface); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
.page-list__toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--color-border);
    flex-wrap: wrap;
}
.page-list__toolbar .form-input { max-width: 220px; }
.list-table { width: 100%; border-collapse: collapse; }
.list-table th, .list-table td {
    padding: 11px 14px;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
    font-size: 13px;
}
.list-table th { font-weight: 600; color: var(--color-muted); font-size: 12px; background: #f9fafb; }
.list-table tr:last-child td { border-bottom: none; }
.list-table tr:hover td { background: #f9fafb; }
.list-table td:last-child { width: 1%; white-space: nowrap; }
.table-actions { display: flex; gap: 6px; }

/* Tags */
.tag {
    display: inline-block;
    padding: 2px 8px;
    background: #e0e7ff;
    color: #4338ca;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 500;
}

/* Stage badge */
.stage-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
}
.stage-badge--analytics   { background: var(--stage-analytics); }
.stage-badge--assortment  { background: var(--stage-assortment); }
.stage-badge--development { background: var(--stage-development); }
.stage-badge--planning    { background: var(--stage-planning); }
.stage-badge--production  { background: var(--stage-production); }
.stage-badge--presales    { background: var(--stage-presales); }

/* ─── Access settings page ──────────────────────────────── */
.access-layout {
    padding: 20px 32px;
    max-width: 860px;
    margin: 0 auto;
}
.access-topbar {
    display: flex;
    margin-bottom: 20px;
}
.access-filter {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.access-filter .form-input  { max-width: 200px; }
.access-filter .form-select { max-width: 240px; }
.access-table-wrap {
    background: var(--color-surface);
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
}
.access-table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-top: 1px solid var(--color-border);
}

.level-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 600;
    background: #f0fdf4;
    color: var(--color-success);
    transition: background .15s;
}
.level-badge:hover {
    background: #dcfce7;
}

/* ─── Pagination ─────────────────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
}
.pagination__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border-radius: 6px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 13px;
    text-decoration: none;
    transition: background .15s, border-color .15s;
    cursor: pointer;
}
.pagination__btn:hover:not(.pagination__btn--disabled):not(.pagination__btn--active) {
    background: var(--color-border);
}
.pagination__btn--active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
    font-weight: 600;
}
.pagination__btn--disabled {
    opacity: .4;
    cursor: default;
}
.pagination__info {
    font-size: 12px;
    color: var(--color-muted);
    margin-left: 8px;
}

/* ─── History page ──────────────────────────────────────── */
.op-type {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 500;
    background: #f3f4f6;
    color: var(--color-secondary);
}

/* ─── No access page ────────────────────────────────────── */
.no-access-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 16px;
    text-align: center;
    color: var(--color-muted);
    padding: 40px;
}
.no-access-page__icon { font-size: 64px; opacity: .4; }
.no-access-page__title { font-size: 18px; font-weight: 600; color: var(--color-text); }
.no-access-page__text { font-size: 14px; max-width: 360px; }

/* ─── Filter bar ────────────────────────────────────────── */
.filter-bar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.filter-bar .form-input,
.filter-bar .form-select { max-width: 180px; }

/* ─── Empty state ───────────────────────────────────────── */
.empty-state {
    padding: 48px 24px;
    text-align: center;
    color: var(--color-muted);
}
.empty-state__icon { font-size: 40px; margin-bottom: 12px; opacity: .4; }
.empty-state__title { font-size: 15px; font-weight: 600; color: var(--color-text); margin-bottom: 4px; }
.empty-state__text { font-size: 13px; }

/* ─── Project settings page ─────────────────────────────── */
.ps-layout {
    padding: 24px 32px;
    max-width: 720px;
    margin: 0 auto;
}
.ps-topbar {
    margin-bottom: 16px;
}
.ps-card {
    background: var(--color-surface);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 28px 32px;
}
.ps-card__title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--color-text);
}
.ps-card__footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 20px;
    margin-top: 8px;
    border-top: 1px solid var(--color-border);
}

/* ─── Template Select (4.6) ─────────────────────────────── */
.tpl-select-section {
    margin-top: 28px;
}
.tpl-select-section__title {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.tpl-select-section__count {
    background: var(--color-border);
    color: var(--color-muted);
    border-radius: 10px;
    padding: 1px 7px;
    font-size: 11px;
    font-weight: 500;
}
.tpl-select-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 14px 18px;
    margin-bottom: 8px;
    transition: border-color .15s, box-shadow .15s;
}
.tpl-select-card:hover {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.08);
}
.tpl-select-card--blank {
    cursor: pointer;
    border-style: dashed;
    border-color: #d1d5db;
    margin-bottom: 0;
}
.tpl-select-card--blank:hover {
    border-color: var(--color-primary);
    background: #f0f5ff;
}
.tpl-select-card__icon {
    font-size: 24px;
    color: var(--color-muted);
    width: 36px;
    text-align: center;
    flex-shrink: 0;
}
.tpl-select-card__body {
    flex: 1;
    min-width: 0;
}
.tpl-select-card__name {
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tpl-select-card__meta {
    font-size: 12px;
    color: var(--color-muted);
}
.tpl-select-card__actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* ─── Select2 overrides ─────────────────────────────────── */
.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
    border: 1px solid var(--color-border);
    border-radius: 6px;
    min-height: 36px;
    font-size: 13px;
    font-family: inherit;
    background: var(--color-surface);
    transition: border-color .15s;
}
.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--focus .select2-selection--multiple,
.select2-container--default.select2-container--open  .select2-selection--single,
.select2-container--default.select2-container--open  .select2-selection--multiple {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(37,99,235,.15);
    outline: none;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 34px;
    padding-left: 10px;
    color: var(--color-text);
    font-size: 13px;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 34px;
}
.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: #9ca3af;
}
.select2-container--default .select2-selection--multiple .select2-selection__rendered {
    padding: 3px 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice {
    display: inline-flex !important;
    align-items: center;
    background: #e0e7ff;
    border: none;
    color: #3730a3;
    border-radius: 4px;
    padding: 2px 6px !important;  /* перебиваем padding-left:20px из Select2 */
    font-size: 12px;
    font-weight: 500;
    margin: 0;
    gap: 4px;
    position: relative;  /* нужно чтобы static на кнопке работал корректно */
    overflow: visible;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice__display {
    padding-left: 0;
    padding-right: 0;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    /* Select2 по умолчанию: position:absolute; left:0 — сбрасываем */
    position: static !important;
    order: 2;
    appearance: none;
    background: transparent !important;
    border: none !important;   /* убирает серую полоску (border-right из Select2) */
    padding: 0 2px;
    line-height: 1;
    cursor: pointer;
    color: #6366f1;
    font-size: 14px;
    display: flex;
    align-items: center;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
    color: var(--color-danger);
    background: transparent !important;
}
.select2-dropdown {
    border: 1px solid var(--color-border);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    font-size: 13px;
}
.select2-container--default .select2-search--dropdown .select2-search__field {
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
}
.select2-container--default .select2-search--dropdown .select2-search__field:focus {
    border-color: var(--color-primary);
}
.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
    background: var(--color-primary);
}
.select2-container--default .select2-results__option--selected {
    background: #e0e7ff;
    color: #3730a3;
}
.select2-results__option {
    padding: 7px 12px;
}
.select2-container--default .select2-selection--multiple .select2-selection__placeholder {
    color: #9ca3af;
    margin-left: 4px;
}

/* ─── Toast ──────────────────────────────────────────────── */
.app-toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(6px);
    background: #1e293b;
    color: #fff;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 4px 16px rgba(0,0,0,.25);
    opacity: 0;
    transition: opacity .2s, transform .2s;
    pointer-events: none;
    z-index: 9999;
    white-space: nowrap;
}
.app-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ─── Scrollbar ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
