/* ═══════════════ Единый стиль «История задач» ═══════════════ */
.hist-layout { padding: 1.5rem 2rem; max-width: 1280px; margin: 0 auto; }
.hist-hero { display:flex; justify-content:space-between; align-items:flex-start; gap:1rem; flex-wrap:wrap; margin-bottom:1.3rem; }
.hist-h1 { font-size:1.5rem; font-weight:700; margin:0; display:flex; align-items:center; gap:.5rem; }
.hist-h1 i { color: var(--neon-primary, #7dd3fc); }
.hist-sub { color: var(--text-muted, #8aa); margin:.3rem 0 0; }

.hist-toolbar { display:flex; flex-wrap:wrap; gap:.6rem; align-items:center; margin-bottom:1rem; }
.hist-toolbar .hist-search {
    flex: 1 1 200px; max-width: 320px;
    background: var(--bg-card, #151c2c); border: 1px solid var(--border-color, #263049);
    border-radius: .5rem; color: var(--text-main, #e8ecf7); padding: .4rem .7rem;
}
.hist-toolbar .hist-search:focus { outline:none; border-color: var(--neon-primary, #7dd3fc); }

.hist-view-switch { display:inline-flex; background: var(--bg-card, #151c2c); border:1px solid var(--border-color, #263049); border-radius:.5rem; padding:.2rem; }
.hist-view-switch button { background:transparent; border:0; color: var(--text-muted, #8aa); padding:.35rem .7rem; border-radius:.35rem; cursor:pointer; }
.hist-view-switch button.is-active { background: var(--bg-main, #0b1020); color: var(--neon-primary, #7dd3fc); }

.hist-filters { display:flex; flex-wrap:wrap; gap:.4rem; margin-bottom:1rem; }
.hist-filter {
    padding: .35rem .75rem; border-radius:1rem; border: 1px solid var(--border-color, #263049);
    background: var(--bg-card, #151c2c); color: var(--text-muted, #8aa); cursor:pointer;
    font-size:.85rem; text-decoration:none; display:inline-flex; align-items:center; gap:.35rem;
    transition: border-color .1s, color .1s;
}
.hist-filter:hover { color: var(--text-main, #e8ecf7); border-color: var(--neon-primary, #7dd3fc); }
.hist-filter.is-active { background: rgba(125,211,252,.12); color: var(--neon-primary, #7dd3fc); border-color: var(--neon-primary, #7dd3fc); }
.hist-filter-count { opacity:.6; font-size:.78rem; }

/* Массовые действия */
.hist-bulk { display:none; position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); align-items:center; gap:.8rem; padding:.7rem 1.1rem; background: var(--bg-card, #151c2c); border:1px solid var(--border-color, #263049); border-radius:.7rem; box-shadow: 0 10px 30px rgba(0,0,0,.35); z-index: 200; }
.hist-bulk { animation: histBulkIn .18s ease-out; }
@keyframes histBulkIn { from { transform: translate(-50%, 20px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
[data-theme="light"] .hist-bulk { box-shadow: 0 10px 30px rgba(15,23,42,.12); }
.hist-bulk.is-visible { display:flex; }
.hist-bulk-count { font-weight:500; }
.hist-bulk-del { background:rgba(248,113,113,.15); color:#f87171; border:1px solid rgba(248,113,113,.35); padding:.4rem .8rem; border-radius:.4rem; cursor:pointer; }
.hist-bulk-del:hover { background:rgba(248,113,113,.25); }

/* Таблица */
.hist-table-wrap { overflow-x:auto; background: var(--bg-card, #151c2c); border:1px solid var(--border-color, #263049); border-radius:.7rem; }
.hist-table { width:100%; border-collapse:collapse; }
.hist-table th, .hist-table td { padding:.7rem .9rem; text-align:left; border-bottom: 1px solid var(--border-color, #263049); vertical-align:middle; }
.hist-table thead th { font-size:.75rem; text-transform:uppercase; letter-spacing:.04em; color: var(--text-muted, #8aa); background:rgba(0,0,0,.12); font-weight:600; }
.hist-table tbody tr:hover { background: rgba(125,211,252,.04); }
.hist-table tbody tr:last-child td { border-bottom:0; }
.hist-col-check { width:36px; }
.hist-col-preview { width:72px; }
.hist-col-type, .hist-col-status, .hist-col-date { white-space:nowrap; }
.hist-col-action { width:48px; text-align:right; }
.hist-title-link { color: var(--text-main, #e8ecf7); text-decoration:none; font-weight:500; }
.hist-title-link:hover { color: var(--neon-primary, #7dd3fc); }
.hist-date { color: var(--text-muted, #8aa); font-size:.85rem; }

/* Превью */
.hist-thumb-link { display:block; width:56px; height:56px; border-radius:.4rem; overflow:hidden; }
.hist-thumb { width:56px; height:56px; border-radius:.4rem; background:#222 center/cover no-repeat; display:flex; align-items:center; justify-content:center; }
.hist-thumb-big { width:100%; height:140px; border-radius:.5rem .5rem 0 0; }
.hist-thumb-empty { font-size:1.4rem; color: var(--neon-primary, #7dd3fc); background: linear-gradient(135deg, rgba(125,211,252,.08), rgba(167,139,250,.08)); }
.hist-thumb-big.hist-thumb-empty { font-size:2.4rem; }

/* Тип-бейдж */
.hist-type-badge { display:inline-flex; align-items:center; gap:.35rem; padding:.15rem .55rem; border-radius:.4rem; font-size:.78rem; font-weight:500; background:rgba(125,211,252,.12); color: var(--neon-primary, #7dd3fc); white-space:nowrap; }
.hist-k-assistant { background:rgba(167,139,250,.14); color:#c4b5fd; }
.hist-k-enhance   { background:rgba(52,211,153,.14); color:#34d399; }
.hist-k-video     { background:rgba(244,114,182,.14); color:#f472b6; }
.hist-k-voice     { background:rgba(251,191,36,.14); color:#fbbf24; }
.hist-k-designer  { background:rgba(125,211,252,.14); color:#7dd3fc; }
.hist-k-protocol  { background:rgba(148,163,184,.18); color:#cbd5e1; }
.hist-k-image, .hist-k-chat { background:rgba(125,211,252,.1); color:#7dd3fc; }

/* Статус */
.hist-status { display:inline-flex; align-items:center; gap:.3rem; font-size:.78rem; font-weight:500; padding:.15rem .5rem; border-radius:1rem; white-space:nowrap; }
.hist-s-queued  { background:rgba(148,163,184,.15); color:#cbd5e1; }
.hist-s-running { background:rgba(251,191,36,.15); color:#fbbf24; }
.hist-s-done    { background:rgba(52,211,153,.15); color:#34d399; }
.hist-s-error   { background:rgba(248,113,113,.15); color:#f87171; }

/* Кнопка удаления */
.hist-del-btn { background:transparent; border:0; color: var(--text-muted, #8aa); padding:.3rem .5rem; border-radius:.35rem; cursor:pointer; }
.hist-del-btn:hover { color:#f87171; background:rgba(248,113,113,.1); }

/* Пустой список */
.hist-empty { text-align:center; padding:3rem 1rem; color: var(--text-muted, #8aa); }
.hist-empty i { font-size:2rem; display:block; margin-bottom:.6rem; color: var(--neon-primary, #7dd3fc); }

/* Плитки */
.hist-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(240px, 1fr)); gap:.9rem; }
.hist-card { position:relative; background: var(--bg-card, #151c2c); border:1px solid var(--border-color, #263049); border-radius:.7rem; overflow:hidden; transition: border-color .1s, transform .1s; }
.hist-card:hover { border-color: var(--neon-primary, #7dd3fc); transform: translateY(-2px); }
.hist-card-link { display:block; text-decoration:none; color: inherit; }
.hist-card-body { padding:.7rem .85rem; }
.hist-card-title { font-weight:600; color: var(--text-main, #e8ecf7); line-height:1.3; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; margin-bottom:.4rem; }
.hist-card-meta { display:flex; gap:.3rem; flex-wrap:wrap; margin-bottom:.35rem; }
.hist-card-date { font-size:.78rem; color: var(--text-muted, #8aa); display:flex; align-items:center; gap:.3rem; }
.hist-card-check { position:absolute; top:.5rem; left:.5rem; z-index:2; background:rgba(11,16,32,.7); padding:.25rem; border-radius:.3rem; margin:0; }
.hist-card-del { position:absolute; top:.5rem; right:.5rem; z-index:2; background:rgba(11,16,32,.7); }

/* Пагинация */
.hist-pagination { display:flex; gap:.3rem; justify-content:center; margin-top:1.3rem; }
.hist-pagination a, .hist-pagination span {
    padding:.4rem .75rem; border-radius:.4rem; text-decoration:none;
    background: var(--bg-card, #151c2c); color: var(--text-main, #e8ecf7);
    border: 1px solid var(--border-color, #263049); min-width:38px; text-align:center;
}
.hist-pagination a:hover { border-color: var(--neon-primary, #7dd3fc); color: var(--neon-primary, #7dd3fc); }
.hist-pagination .is-active { background: var(--neon-primary, #7dd3fc); color:#0b1020; border-color: var(--neon-primary, #7dd3fc); }

/* Home mini */
.hist-home-head { display:flex; align-items:center; justify-content:space-between; margin-bottom:.8rem; }
.hist-home-head h2 { font-size:1.1rem; margin:0; }
.hist-home-all { color: var(--neon-primary, #7dd3fc); text-decoration:none; font-size:.88rem; display:inline-flex; align-items:center; gap:.3rem; }
.hist-home-all:hover { text-decoration:underline; }

/* ===== Светлая тема ===== */
[data-theme="light"] .hist-search,
[data-theme="light"] .hist-filter,
[data-theme="light"] .hist-view-switch,
[data-theme="light"] .hist-bulk,
[data-theme="light"] .hist-table-wrap,
[data-theme="light"] .hist-card,
[data-theme="light"] .hist-pagination a, [data-theme="light"] .hist-pagination span { background:#ffffff; border-color:#d1d5db; }
[data-theme="light"] .hist-view-switch button.is-active { background:#f9fafb; color:#0ea5e9; }
[data-theme="light"] .hist-filter:hover, [data-theme="light"] .hist-filter.is-active { border-color:#0ea5e9; color:#0ea5e9; background:rgba(14,165,233,.08); }
[data-theme="light"] .hist-table thead th { background:#f9fafb; color:#64748b; }
[data-theme="light"] .hist-table tbody tr:hover { background: rgba(14,165,233,.05); }
[data-theme="light"] .hist-title-link { color:#0f172a; }
[data-theme="light"] .hist-card-title { color:#0f172a; }
[data-theme="light"] .hist-date, [data-theme="light"] .hist-card-date { color:#64748b; }
[data-theme="light"] .hist-card-check, [data-theme="light"] .hist-card-del { background:rgba(255,255,255,.85); }

@media (max-width: 720px) {
    .hist-layout { padding:1rem; }
    .hist-col-preview, .hist-col-type { display:none; }
    .hist-grid { grid-template-columns:repeat(auto-fill, minmax(180px, 1fr)); }
}

/* ===== Модульные табы (Создать/История) внутри модуля ===== */
.mod-tabs { display:inline-flex; background: var(--bg-card, #151c2c); border:1px solid var(--border-color, #263049); border-radius:.6rem; padding:.25rem; margin-bottom:1.4rem; gap:.25rem; }
.mod-tab-btn { background:transparent; border:0; color: var(--text-muted, #8aa); font-weight:500; padding:.5rem 1.1rem; border-radius:.4rem; cursor:pointer; display:inline-flex; align-items:center; gap:.45rem; font-size:.95rem; }
.mod-tab-btn:hover { color: var(--text-main, #e8ecf7); }
.mod-tab-btn.is-active { background: var(--bg-main, #0b1020); color: var(--neon-primary, #7dd3fc); }
.mod-tab-btn .mod-tab-cnt { opacity:.65; font-size:.78rem; margin-left:.25rem; }
.mod-tab-panel { display:none; }
.mod-tab-panel.is-active { display:block; }

[data-theme="light"] .mod-tabs { background:#ffffff; border-color:#d1d5db; }
[data-theme="light"] .mod-tab-btn.is-active { background:#f1f5f9; color:#0ea5e9; }
