/* ============================================================
   Дашборд — стили
   Тёмный сайдбар #1E293B · контент #F1F5F9 · акцент #2563EB
   ============================================================ */

:root {
    /* сайдбар */
    --sb-bg: #1E293B;
    --sb-bg-deep: #172033;
    --sb-hover: rgba(148, 163, 184, 0.09);
    --sb-active: #2563EB;
    --sb-text: #94A3B8;
    --sb-text-strong: #E2E8F0;
    --sb-border: rgba(148, 163, 184, 0.14);

    /* контент */
    --bg: #F1F5F9;
    --card: #FFFFFF;
    --text: #0F172A;
    --muted: #64748B;
    --muted-2: #94A3B8;
    --border: #E2E8F0;

    /* акценты */
    --accent: #2563EB;
    --accent-hover: #1D4ED8;
    --accent-soft: #EFF6FF;
    --green: #16A34A;
    --green-bg: #F0FDF4;
    --green-br: #BBF7D0;
    --red: #DC2626;
    --red-hover: #B91C1C;
    --red-bg: #FEF2F2;
    --red-br: #FECACA;
    --amber: #B45309;
    --amber-bg: #FFFBEB;
    --amber-br: #FDE68A;
    --gray-bg: #F8FAFC;
    --gray-br: #E2E8F0;

    --radius: 12px;
    --radius-sm: 9px;
    --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 1px 3px rgba(15, 23, 42, .08);
    --shadow-lg: 0 10px 30px rgba(15, 23, 42, .16);

    --font: 'Inter', -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --mono: 'JetBrains Mono', 'SF Mono', Consolas, 'Liberation Mono', monospace;

    --sb-w: 264px;
    --topbar-h: 64px;
}

* { box-sizing: border-box; }

/* Атрибут hidden сильнее любых display-правил компонентов */
[hidden] { display: none !important; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font);
    font-size: 14.5px;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

.icon { flex: 0 0 auto; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
    font-family: var(--mono);
    font-size: .92em;
    background: var(--accent-soft);
    border: 1px solid #DBEAFE;
    border-radius: 5px;
    padding: 1px 5px;
    color: #1D4ED8;
}

.text-danger { color: var(--red); }
.muted { color: var(--muted-2); font-size: 13px; }

/* ============================================================
   Сайдбар
   ============================================================ */

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sb-w);
    background: linear-gradient(180deg, #1E293B 0%, #1B2537 100%);
    border-right: 1px solid rgba(0, 0, 0, .2);
    display: flex;
    flex-direction: column;
    z-index: 60;
}

.sidebar-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: #334155 transparent;
}

.brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 18px 20px 16px;
    border-bottom: 1px solid var(--sb-border);
}

.brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    background: linear-gradient(135deg, #3B82F6, #2563EB);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 14px rgba(37, 99, 235, .35);
}

.brand-text {
    color: #F8FAFC;
    font-weight: 700;
    font-size: 16px;
    letter-spacing: .2px;
}

.nav {
    flex: 1 1 auto;
    padding: 14px 12px;
}

.nav-section { margin-bottom: 18px; }

/* Секция без лейбла (первый пункт «Обзор») — компактный отступ */
.nav-section-first { margin-bottom: 14px; }
.nav-section-first + .nav-section {
    border-top: 1px solid var(--sb-border);
    padding-top: 14px;
}

.nav-label {
    display: block;
    padding: 0 12px 7px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: #64748B;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9.5px 12px;
    margin: 2px 0;
    border-radius: 9px;
    color: var(--sb-text);
    font-weight: 500;
    font-size: 13.5px;
    text-decoration: none;
    border: 1px solid transparent;
    transition: background .15s, color .15s, border-color .15s;
    position: relative;
}

.nav-item .icon { opacity: .85; }
.nav-item span { flex: 1 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.nav-item:hover {
    background: var(--sb-hover);
    color: var(--sb-text-strong);
    text-decoration: none;
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(37, 99, 235, .22), rgba(37, 99, 235, .10));
    border-color: rgba(59, 130, 246, .35);
    color: #fff;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 7px;
    bottom: 7px;
    width: 3.5px;
    border-radius: 0 4px 4px 0;
    background: var(--sb-active);
}

.nav-item.active .icon { color: #93C5FD; opacity: 1; }

.nav-ext { display: inline-flex; color: #64748B; }

.nav-bottom {
    padding: 12px;
    border-top: 1px solid var(--sb-border);
    background: rgba(0, 0, 0, .12);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .55);
    z-index: 55;
    opacity: 0;
    transition: opacity .2s;
}

/* ============================================================
   Основная область
   ============================================================ */

.main {
    margin-left: var(--sb-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    height: var(--topbar-h);
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 26px;
}

.burger {
    display: none;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    color: var(--text);
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

.topbar-title { min-width: 0; }

.topbar-title h1 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-title p {
    margin: 0;
    font-size: 12.5px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
}

.clock {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 34px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--gray-bg);
    color: var(--muted);
    font-family: var(--mono);
    font-size: 12.5px;
    white-space: nowrap;
}

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 34px;
    padding: 0 13px;
    border-radius: 9px;
    background: var(--accent-soft);
    border: 1px solid #DBEAFE;
    color: #1D4ED8;
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
}

.content {
    flex: 1 1 auto;
    padding: 26px;
    max-width: 1240px;
    width: 100%;
    margin: 0 auto;
}

/* ============================================================
   Тулбар страницы
   ============================================================ */

.page-toolbar {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

/* ============================================================
   Карточки и метрики
   ============================================================ */

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
}

.stat-grid.three {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.stat-card {
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.stat-label {
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--muted-2);
}

.stat-value {
    font-size: 27px;
    font-weight: 800;
    letter-spacing: -.02em;
    line-height: 1.25;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 40px;
}

.stat-value-action .btn { font-size: 14px; }

.stat-note {
    margin: 0;
    font-size: 13px;
    color: var(--muted);
    overflow-wrap: anywhere;
}

.stat-note.text-danger { color: var(--red); font-weight: 500; }

/* Панель (сжатие изображений) */
.panel { padding: 22px 24px; }

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

.panel-head-text h2 {
    margin: 0 0 3px;
    font-size: 16.5px;
    font-weight: 700;
}

.panel-head-text p {
    margin: 0;
    font-size: 13px;
    color: var(--muted);
}

.panel-foot {
    margin: 18px 0 0;
    font-size: 13px;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 7px;
}

.panel-foot.text-danger { color: var(--red); }

/* Панель «Курсы валют» (обзорная страница) */
.panel-head-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.panel-head-text h2 {
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-head-text h2 .icon { color: var(--accent); }

.rates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.rate-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
    background: var(--gray-bg);
    border: 1px solid var(--gray-br);
    border-radius: 10px;
    padding: 14px 16px;
}

.rate-code {
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .07em;
    color: var(--muted-2);
}

.rate-value {
    font-size: 21px;
    font-weight: 800;
    letter-spacing: -.01em;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.rate-note { font-size: 12px; color: var(--muted); }

.panel-foot { gap: 7px; }
.panel-foot b { color: var(--text); font-weight: 600; }
.panel-foot .icon { color: var(--muted-2); }

/* Кнопка в процессе ручного обновления */
[data-rates-update].is-loading { opacity: .65; pointer-events: none; }
[data-rates-update].is-loading .icon { animation: spin 1s linear infinite; }

/* ============================================================
   Бейджи статусов
   ============================================================ */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 13px;
    border-radius: 999px;
    font-size: 13.5px;
    font-weight: 700;
    border: 1px solid;
    white-space: nowrap;
}

.badge .icon { flex: 0 0 auto; }

.badge::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}

.badge-ok      { color: #15803D; background: var(--green-bg); border-color: var(--green-br); }
.badge-error   { color: var(--red); background: var(--red-bg); border-color: var(--red-br); }
.badge-running { color: #1D4ED8; background: var(--accent-soft); border-color: #BFDBFE; }
.badge-unknown { color: #64748B; background: var(--gray-bg); border-color: var(--gray-br); }

.badge .icon.spin { animation: spin 1s linear infinite; }

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================================
   Кнопки
   ============================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 38px;
    padding: 0 16px;
    border-radius: 10px;
    border: 1px solid transparent;
    font-family: var(--font);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}

.btn:hover { text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn-primary {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 10px rgba(37, 99, 235, .28);
}
.btn-primary:hover { background: var(--accent-hover); color: #fff; }

.btn-ghost {
    background: #fff;
    color: var(--text);
    border-color: var(--border);
}
.btn-ghost:hover { background: var(--gray-bg); border-color: #CBD5E1; }

.btn-danger {
    background: var(--red);
    color: #fff;
    box-shadow: 0 4px 10px rgba(220, 38, 38, .25);
}
.btn-danger:hover { background: var(--red-hover); color: #fff; }

.btn-block { width: 100%; }

/* ============================================================
   Страница «Логи»
   ============================================================ */

.logs-toolbar { justify-content: space-between; }

.logs-meta {
    font-size: 13px;
    color: var(--muted);
    overflow-wrap: anywhere;
}

.logs-meta b { color: var(--text); font-weight: 600; }

.dot-sep { margin: 0 7px; color: #CBD5E1; }

.logs-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.terminal {
    background: #0B1220;
    border: 1px solid #1E293B;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.terminal pre {
    margin: 0;
    padding: 18px 20px;
    height: calc(100vh - 300px);
    min-height: 320px;
    overflow: auto;
    font-family: var(--mono);
    font-size: 12.75px;
    line-height: 1.75;
    color: #CBD5E1;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    scrollbar-width: thin;
    scrollbar-color: #334155 transparent;
}

.terminal pre::-webkit-scrollbar { width: 10px; height: 10px; }
.terminal pre::-webkit-scrollbar-thumb { background: #334155; border-radius: 6px; }
.terminal pre::-webkit-scrollbar-track { background: transparent; }

.log-line { display: block; padding: 0 4px; border-radius: 4px; }
.log-line-error   { color: #FCA5A5; background: rgba(220, 38, 38, .12); }
.log-line-warn    { color: #FCD34D; }
.log-line-success { color: #86EFAC; }
.log-line-info    { color: #93C5FD; }
.log-line-debug   { color: #64748B; }

/* Переключатель (автообновление) */
.switch {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
    user-select: none;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--muted);
    height: 38px;
    padding: 0 4px;
}

.switch input { position: absolute; opacity: 0; width: 0; height: 0; }

.switch-track {
    width: 38px;
    height: 21px;
    border-radius: 999px;
    background: #CBD5E1;
    position: relative;
    transition: background .18s;
    flex: 0 0 auto;
}

.switch-track::after {
    content: '';
    position: absolute;
    top: 2.5px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, .3);
    transition: transform .18s;
}

.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ============================================================
   Заглушка чистых страниц
   ============================================================ */
.placeholder {
    border: 2px dashed #CBD5E1;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .55);
    padding: 58px 26px;
    text-align: center;
    color: var(--muted-2);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.placeholder .icon { color: #94A3B8; }

.placeholder h2 {
    margin: 4px 0 0;
    font-size: 16.5px;
    font-weight: 700;
    color: var(--muted);
}

.placeholder p { margin: 0; font-size: 13.5px; line-height: 1.8; }

/* ============================================================
   Уведомления
   ============================================================ */

.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 15px;
    border-radius: 10px;
    font-size: 13.5px;
    margin-bottom: 16px;
}

.alert .icon { margin-top: 1.5px; }

.alert-error {
    background: var(--red-bg);
    border: 1px solid var(--red-br);
    color: #991B1B;
}

.alert-success {
    background: var(--green-bg);
    border: 1px solid var(--green-br);
    color: #166534;
}

#toast-root {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 120;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #0F172A;
    color: #F1F5F9;
    border-radius: 11px;
    padding: 12px 16px;
    font-size: 13.5px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    min-width: 230px;
    max-width: 360px;
    animation: toast-in .22s ease-out;
}

.toast .icon { color: #93C5FD; }
.toast.toast-ok .icon { color: #4ADE80; }
.toast.toast-error .icon { color: #F87171; }

@keyframes toast-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   Модальное окно подтверждения
   ============================================================ */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .55);
    backdrop-filter: blur(2px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fade-in .15s ease-out;
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.modal {
    width: 100%;
    max-width: 400px;
    background: #fff;
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    padding: 22px 24px;
    animation: modal-in .18s ease-out;
}

@keyframes modal-in {
    from { opacity: 0; transform: translateY(12px) scale(.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal h3 {
    margin: 0 0 8px;
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 9px;
}

.modal h3 .icon { color: var(--red); }

.modal p { margin: 0 0 18px; font-size: 13.5px; color: var(--muted); }

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ============================================================
   Страницы входа и восстановления
   ============================================================ */

.auth-body {
    min-height: 100vh;
    background:
        radial-gradient(700px 420px at 12% -6%, rgba(37, 99, 235, .10), transparent 60%),
        radial-gradient(640px 400px at 105% 110%, rgba(30, 41, 59, .12), transparent 55%),
        var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 26px;
    position: relative;
    overflow: hidden;
}

.auth-decor {
    position: absolute;
    border-radius: 50%;
    filter: blur(70px);
    opacity: .5;
    pointer-events: none;
}

.decor-1 { width: 340px; height: 340px; background: rgba(37, 99, 235, .18); top: -120px; right: -80px; }
.decor-2 { width: 300px; height: 300px; background: rgba(30, 41, 59, .16); bottom: -110px; left: -70px; }

.auth-wrap { position: relative; z-index: 2; width: 100%; max-width: 412px; }

.auth-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 18px 44px rgba(15, 23, 42, .12);
    padding: 30px 30px 26px;
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    margin-bottom: 22px;
}

.auth-brand .brand-text { color: var(--text); }

.auth-title {
    margin: 0 0 6px;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -.015em;
}

.auth-sub {
    margin: 0 0 20px;
    font-size: 13px;
    color: var(--muted);
}

.field { margin-bottom: 15px; }

.field label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 6px;
}

.field input {
    width: 100%;
    height: 44px;
    border: 1px solid #CBD5E1;
    border-radius: 10px;
    background: #fff;
    padding: 0 14px;
    font-family: var(--font);
    font-size: 14px;
    color: var(--text);
    transition: border-color .15s, box-shadow .15s;
}

.field input::placeholder { color: #B6C2D2; }

.field input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3.5px rgba(37, 99, 235, .14);
}

.input-group { position: relative; }

.input-group input { padding-right: 46px; }

.eye {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    border-radius: 8px;
    color: var(--muted-2);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.eye:hover { background: var(--gray-bg); color: var(--muted); }
.eye .eye-off { display: none; }
.eye[data-hidden="0"] .eye-on { display: none; }
.eye[data-hidden="0"] .eye-off { display: inline-flex; }

.check {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 4px 0 18px;
    cursor: pointer;
    user-select: none;
}

.check input { position: absolute; opacity: 0; width: 0; height: 0; }

.check-box {
    width: 20px;
    height: 20px;
    border: 1.5px solid #CBD5E1;
    border-radius: 6px;
    background: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    transition: background .15s, border-color .15s;
    flex: 0 0 auto;
}

.check-box .icon { opacity: 0; transform: scale(.6); transition: all .15s; }

.check input:checked + .check-box {
    background: var(--accent);
    border-color: var(--accent);
}

.check input:checked + .check-box .icon { opacity: 1; transform: scale(1); }

.check input:focus-visible + .check-box { outline: 2px solid var(--accent); outline-offset: 2px; }

.check-text { font-size: 13.5px; color: var(--muted); }

.auth-links {
    margin-top: 18px;
    text-align: center;
    font-size: 13.5px;
}

.auth-hint {
    margin-top: 16px;
    padding: 10px 14px;
    border-radius: 10px;
    background: var(--gray-bg);
    border: 1px dashed #CBD5E1;
    font-size: 12.5px;
    color: var(--muted);
    text-align: center;
}

.auth-hint code { font-size: 12px; }

/* ============================================================
   Статус импорта (import_status.json) и блоки обзора
   ============================================================ */

/* Вертикальные отступы между блоками внутри зоны автообновления
   (обзор: сетка карточек + панели импорта/курсов) */
#refresh-target > * + * { margin-top: 20px; }

/* Прогресс-бар */
.progress {
    height: 8px;
    border-radius: 999px;
    background: var(--gray-bg);
    border: 1px solid var(--border);
    overflow: hidden;
}

.progress > i {
    display: block;
    height: 100%;
    background: var(--accent);
    border-radius: inherit;
    transition: width .5s ease;
}

.progress-mini { margin-top: 12px; height: 6px; }

/* Блок «Сейчас обрабатывается» */
.import-current {
    margin-top: 20px;
    padding: 14px 16px;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.import-current-text {
    font-size: 13.5px;
    color: var(--text);
    line-height: 1.5;
}

.import-current-text b { font-weight: 700; }

/* Строка причины/пояснения статуса под заголовком панели */
.panel-reason {
    margin: -6px 0 18px;
    font-size: 13.5px;
    color: var(--muted);
}

.panel-reason.text-danger { color: var(--red); }

/* Мета-строки: последний успех, следующий запуск, время записи файла */
.import-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 24px;
    margin-top: 18px;
    font-size: 13px;
    color: var(--muted);
}

.import-meta span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.import-meta b { color: var(--text); font-weight: 600; }
.import-meta .icon { color: var(--muted-2); flex: none; }
.import-meta .text-danger,
.import-meta .text-danger b { color: var(--red); }

/* Чип автора записи (PHP-парсер / Go-демон) */
.writer-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--muted);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 5px 12px;
    white-space: nowrap;
}

/* Таблица источников */
.table-wrap {
    overflow-x: auto;
    margin-top: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 840px;
}

.data-table th {
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--muted-2);
    background: var(--gray-bg);
    padding: 10px 12px;
    white-space: nowrap;
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: 0; }

.data-table td.num {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.data-table td.src-name { font-weight: 600; }

.data-table tr.row-error td {
    background: var(--red-bg);
    color: var(--red);
    font-size: 12.5px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
}

.data-table tr.row-error:last-child td { border-bottom: 0; }

.data-table .icon { vertical-align: -2px; margin-right: 4px; }

/* ============================================================
   Адаптив
   ============================================================ */

@media (max-width: 1024px) {
    .clock { display: none; }
}

@media (max-width: 920px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform .22s ease;
        box-shadow: none;
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }

    body.sidebar-open .sidebar-overlay { display: block; opacity: 1; }

    .main { margin-left: 0; }
    .burger { display: inline-flex; }
    .content { padding: 18px; }
    .topbar { padding: 0 16px; }

    .stat-value { font-size: 23px; }
    .user-chip span { display: none; }
}

@media (max-width: 560px) {
    .logs-toolbar { flex-direction: column; align-items: stretch; }
    .logs-actions { justify-content: space-between; }
    .terminal pre { height: calc(100vh - 360px); min-height: 260px; }
    .panel { padding: 18px; }
    .stat-card { padding: 17px 18px; }
    .import-meta { flex-direction: column; align-items: flex-start; gap: 8px; }
}

/* ============================================================
   Очистка изображений (tools/clear-images.php)
   ============================================================ */

/* Блоки страницы: внутренние отступы 22/24 — как у .panel («Сжатие изображений»);
   вертикальный ритм: отступ сверху 20px у всех блоков, кроме верхнего */
.ci-card {
    margin: 0;
    padding: 22px 24px;
}

.ci-card + .ci-card,
#refresh-target + .ci-card { margin-top: 20px; }

.ci-card .card-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.ci-card .card-header h2 { margin: 0; }

.ci-card .card-body { margin-top: 14px; }

.ci-status-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.ci-message {
    margin: 0 0 14px;
    font-size: 14px;
    color: var(--text);
    overflow-wrap: anywhere;
}

.ci-error {
    margin: 0 0 14px;
    font-size: 13.5px;
    font-weight: 500;
    overflow-wrap: anywhere;
}

.ci-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.ci-hint {
    margin: 14px 0 0;
    font-size: 12.5px;
    color: var(--muted-2);
}

/* --- Прогрессбар --- */

.ci-progress-row {
    display: flex;
    align-items: center;
    gap: 14px;
}

.progress {
    flex: 1 1 auto;
    height: 13px;
    background: #E2E8F0;
    border-radius: 999px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--accent), #3B82F6);
    border-radius: 999px;
    transition: width .35s ease;
}

.progress.indeterminate .progress-bar {
    width: 35%;
    animation: ci-slide 1.15s ease-in-out infinite;
}

@keyframes ci-slide {
    from { margin-left: -35%; }
    to   { margin-left: 100%; }
}

.ci-pct {
    flex: 0 0 auto;
    min-width: 46px;
    text-align: right;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: -.01em;
}

.ci-stage { margin: 10px 0 0; font-size: 13px; }

/* --- Компактные счётчики --- */

.ci-mini-grid { margin-top: 18px; }

.ci-mini-grid-inner {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.ci-mini { padding: 14px 16px; background: var(--gray-bg); border: 1px solid var(--gray-br); border-radius: var(--radius-sm); }

.ci-mini .stat-value { font-size: 20px; min-height: 30px; }

.ci-mini .stat-label { font-size: 10.5px; }

/* --- Таблица путей --- */

.ci-paths th {
    text-align: left;
    font-weight: 600;
    color: var(--muted);
    vertical-align: top;
    padding: 8px 14px 8px 0;
    border-bottom: 1px solid var(--border);
}

.ci-paths td {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.ci-paths tr:last-child th,
.ci-paths tr:last-child td { border-bottom: none; }

.ci-paths code { word-break: break-all; }

/* --- Журнал --- */

.ci-terminal pre {
    height: 340px;
    min-height: 220px;
}

/* --- Модал подтверждения --- */

.ci-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .55);
    z-index: 120;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.ci-overlay[hidden] { display: none; }

.ci-modal {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    max-width: 470px;
    width: 100%;
    padding: 26px 28px 24px;
}

.ci-modal h3 {
    margin: 0 0 12px;
    font-size: 17px;
    font-weight: 800;
}

.ci-modal-text { margin: 0 0 10px; font-size: 13.5px; }

.ci-modal-actions { justify-content: flex-end; }

@media (max-width: 560px) {
    .ci-progress-row { flex-direction: column; align-items: stretch; }
    .ci-pct { text-align: left; }
    .ci-modal { padding: 20px; }
    .ci-card { padding: 18px 16px; }
}
