/* Data Collection workspace: compact navigation and readable task-focused pages. */
.data-collection-tabs {
    margin: 0 0 12px;
    padding: 3px;
    display: flex;
    align-items: center;
    gap: 3px;
    max-width: max-content;
    overflow-x: auto;
    background: var(--surface-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 9px;
}
.data-collection-tab {
    min-height: 34px;
    padding: 7px 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 650;
    text-decoration: none;
    white-space: nowrap;
    border: 1px solid transparent;
    border-radius: 7px;
}
.data-collection-tab:hover { color: var(--text-primary); background: var(--surface-primary); }
.data-collection-tab.is-active { color: var(--text-primary); background: var(--surface-primary); border-color: var(--border-default); box-shadow: var(--shadow-xs); }
.data-collection-tab:focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 68%, white); outline-offset: 2px; }

.data-collection-schedule { max-width: 920px; margin: 0; }
.data-collection-schedule-card { max-width: 920px; margin-top: 0; }
.data-collection-schedule-card .admin-settings-group { padding: 14px; }
.data-collection-schedule-card .admin-settings-group-head p { margin: 4px 0 0; color: var(--text-muted); font-size: 11px; }

.monitoring-global-metrics { margin-bottom: 12px; gap: 8px; }
.monitoring-region-list { display: grid; gap: 14px; }
.monitoring-region-section { min-width: 0; }
.monitoring-region-head { margin-bottom: 9px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.monitoring-region-title-row { gap: 8px; }
.monitoring-region-title-row h2 { font-size: 15px; }
.monitoring-region-title-row span,
.monitoring-region-head p { font-size: 10.5px; }
.monitoring-region-actions { margin-left: auto; gap: 6px; }
.monitoring-region-actions form { margin: 0; }
.monitoring-region-source-grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 9px; }
.monitoring-region-source-grid .source-card { min-height: 0; padding: 11px; border-radius: 9px; }
.monitoring-region-source-grid .source-card-head { gap: 9px; }
.monitoring-region-source-grid .source-logo { width: 32px; height: 32px; }
.monitoring-region-source-grid .source-title { min-width: 0; }
.monitoring-region-source-grid .source-title strong { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; font-size: 12px; line-height: 1.3; overflow-wrap: anywhere; }
.monitoring-region-source-grid .source-title span { display: block; margin-top: 2px; overflow: hidden; color: var(--text-muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.monitoring-region-source-grid .source-state { font-size: 10px; }
.monitoring-region-source-grid .source-stats { margin-top: 9px; padding-top: 9px; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.monitoring-region-source-grid .source-stat b { font-size: 14px; }
.monitoring-region-source-grid .source-stat-coverage b { font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.monitoring-region-source-grid .source-stat small { font-size: 9.5px; }
.monitoring-region-source-grid .source-card-foot { margin-top: 9px; padding-top: 8px; }
.monitoring-region-source-grid .source-last-run,
.monitoring-region-source-grid .source-card-open-hint { font-size: 10px; line-height: 1.35; }
.monitoring-region-empty { min-height: 78px; }

.control-stores-panel { overflow: hidden; }
.control-stores-panel .table-header { padding: 11px 12px; margin: 0; }
.control-stores-panel .table-header h2 { font-size: 14px; }
.control-stores-panel .table-header p { margin: 4px 0 0; font-size: 10.5px; }
.control-stores-table { width: 100%; min-width: 940px; table-layout: fixed; font-size: 11.5px; }
.control-stores-table th,
.control-stores-table td { padding: 8px 9px; vertical-align: middle; }
.control-stores-table th { font-size: 10.5px; }
.control-stores-table th:nth-child(1) { width: 190px; }
.control-stores-table th:nth-child(2) { width: 245px; }
.control-stores-table th:nth-child(3) { width: auto; }
.control-stores-table td:first-child strong { font-size: 11.5px; }
.control-stores-table .muted { font-size: 10px; }
.control-stores-table .inline-grid-form { display: grid; grid-template-columns: minmax(180px, 1.45fr) 135px 145px auto; gap: 7px; align-items: end; }
.control-stores-table .settings-field { min-width: 0; }
.control-stores-table .settings-field label { font-size: 10px; }
.control-stores-table .settings-field input,
.control-stores-table .settings-field select { width: 100%; min-height: 34px; padding: 6px 7px; font-size: 11px; }
.control-stores-table .checkbox-card { min-height: 34px; padding: 6px 7px; align-items: center; }
.control-stores-table .checkbox-card strong { font-size: 10.5px; }
.control-stores-table .settings-form-actions { margin: 0; align-self: end; }
.control-stores-table .settings-form-actions.pm-form-actions { margin-top: 0; }

/* Run History owns one explicit column contract. The native <summary> only
   controls disclosure; the nested run-history-grid owns table geometry. */
.parser-run-history-panel {
    --run-history-columns: minmax(210px, 1.5fr) 112px 84px minmax(170px, .9fr) 70px minmax(180px, 1fr) 22px;
    --run-history-gap: 10px;
    overflow: hidden;
}
.parser-run-history-heading { padding: 11px 12px 8px; }
.parser-run-history-heading h2 { font-size: 14px; }
.parser-run-live-indicator { font-size: 10.5px; color: var(--text-muted); }

.run-history-table-head,
.run-history-grid {
    width: 100%;
    display: grid;
    grid-template-columns: var(--run-history-columns);
    gap: var(--run-history-gap);
    align-items: center;
}
.run-history-table-head {
    min-height: 34px;
    padding: 0 12px;
    color: var(--text-muted);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .02em;
    background: var(--surface-secondary);
    border-top: 1px solid var(--border-subtle);
    border-bottom: 1px solid var(--border-subtle);
}
.run-history-list { display: grid; gap: 0; }
.run-history-row { border-bottom: 1px solid var(--border-subtle); background: var(--surface-primary); }
.run-history-row:last-child { border-bottom: 0; }
.run-history-summary {
    width: 100%;
    display: block;
    min-height: 0;
    padding: 0;
    list-style: none;
    cursor: pointer;
}
.run-history-summary::marker { content: ""; }
.run-history-summary::-webkit-details-marker { display: none; }
.run-history-grid { min-height: 64px; padding: 9px 12px; }
.run-history-summary:hover { background: var(--surface-secondary); }
.run-history-row[open] .run-history-summary { background: color-mix(in srgb, var(--surface-secondary) 70%, var(--surface-primary)); }
.run-history-source { min-width: 0; display: grid; gap: 3px; }
.run-history-source strong {
    overflow: hidden;
    color: var(--text-primary);
    font-size: 12.5px;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.run-history-source small {
    overflow: hidden;
    color: var(--text-muted);
    font-size: 10.5px;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.run-history-result,
.run-history-stat,
.run-history-time,
.run-history-changes { min-width: 0; }
.run-history-result { display: flex; align-items: center; }
.run-history-result .badge { width: fit-content; max-width: 100%; font-size: 10.75px; }
.run-history-stat { display: grid; align-content: center; gap: 3px; }
.run-history-stat b { color: var(--text-primary); font-size: 14px; line-height: 1; font-variant-numeric: tabular-nums; }
.run-history-stat.is-error b { color: var(--danger); }
.run-history-changes {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: center;
    gap: 10px;
}
.run-history-changes > span { min-width: 0; display: grid; gap: 2px; }
.run-history-changes small { color: var(--text-muted); font-size: 9.75px; line-height: 1.15; white-space: nowrap; }
.run-history-changes b { color: var(--text-primary); font-size: 12.5px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.run-history-time { display: grid; align-content: center; gap: 3px; }
.run-history-time strong { overflow: hidden; color: var(--text-primary); font-size: 11.25px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.run-history-time small { overflow: hidden; color: var(--text-muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.run-history-chevron { justify-self: end; color: var(--text-muted); font-size: 15px; line-height: 1; transition: transform var(--transition-fast); }
.run-history-row[open] .run-history-chevron { transform: rotate(180deg); }

.run-history-result::before,
.run-history-stat::before,
.run-history-changes::before,
.run-history-time::before { display: none; content: attr(data-label); }

.run-history-body {
    padding: 13px 14px 15px;
    background: color-mix(in srgb, var(--surface-secondary) 45%, var(--surface-primary));
    border-top: 1px solid var(--border-subtle);
}
.run-history-note { margin: 0 0 10px; padding: 9px 10px; display: grid; gap: 3px; color: var(--text-secondary); font-size: 11px; line-height: 1.4; border-radius: 8px; }
.run-history-note.is-warning { background: var(--warning-soft); border: 1px solid color-mix(in srgb, var(--warning) 25%, var(--border-default)); }
.run-history-note.is-success { background: var(--success-soft); border: 1px solid color-mix(in srgb, var(--success) 22%, var(--border-default)); }
.run-history-note strong { color: var(--text-primary); font-size: 11.5px; }
.run-history-detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.run-history-detail-grid > div { min-width: 0; padding: 8px 9px; display: grid; gap: 3px; background: var(--surface-primary); border: 1px solid var(--border-subtle); border-radius: 8px; }
.run-history-detail-grid span { color: var(--text-muted); font-size: 9.75px; }
.run-history-detail-grid strong { overflow: hidden; color: var(--text-primary); font-size: 11.25px; text-overflow: ellipsis; white-space: nowrap; }
.run-history-actions { margin-top: 10px; justify-content: flex-end; }
.run-history-actions form { margin: 0; }
.run-history-task-details,
.run-history-log-details { margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--border-subtle); }
.disclosure-summary-inline { color: var(--text-secondary); font-size: 11px; }
.run-history-task-list { margin-top: 8px; padding: 0 9px; border: 1px solid var(--border-subtle); border-radius: 8px; background: var(--surface-primary); }
.run-history-task-row { min-width: 0; padding: 8px 0; display: grid; grid-template-columns: minmax(180px, 1.4fr) auto repeat(4, minmax(82px, .55fr)) minmax(180px, .9fr); gap: 8px; align-items: center; border-bottom: 1px solid var(--border-subtle); font-size: 10.5px; }
.run-history-task-row:last-child { border-bottom: 0; }
.run-history-task-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 620; }
.run-history-log-details .run-error { margin: 8px 0; }
.run-history-log-details .run-log { margin-top: 8px; }

@media (max-width: 1240px) {
    .monitoring-region-source-grid { grid-template-columns: repeat(2, minmax(230px, 1fr)); }
    .control-stores-table .inline-grid-form { grid-template-columns: minmax(170px, 1fr) 125px 135px auto; }
    .parser-run-history-panel {
        --run-history-columns: minmax(180px, 1.35fr) 102px 72px minmax(140px, .82fr) 62px minmax(150px, .92fr) 20px;
        --run-history-gap: 8px;
    }
    .run-history-task-row { grid-template-columns: minmax(170px, 1.3fr) auto repeat(3, minmax(76px, .5fr)); }
    .run-history-task-row > :nth-last-child(2),
    .run-history-task-row > :last-child { display: none; }
}
@media (max-width: 1050px) {
    .parser-run-history-panel {
        --run-history-columns: minmax(180px, 1fr) 104px 72px 64px 22px;
        --run-history-gap: 8px;
    }
    .run-history-table-head { display: none; }
    .run-history-grid { min-height: 68px; }
    .run-history-changes,
    .run-history-time { display: none; }
    .run-history-result,
    .run-history-stat { align-self: stretch; align-content: center; }
    .run-history-result::before,
    .run-history-stat::before { display: block; margin-bottom: 3px; color: var(--text-muted); font-size: 9px; font-weight: 650; letter-spacing: .02em; }
    .run-history-detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .run-history-task-row { grid-template-columns: minmax(160px, 1fr) auto minmax(80px, .5fr); }
    .run-history-task-row > :nth-child(n+4) { display: none; }
}
@media (max-width: 720px) {
    .data-collection-tabs { max-width: 100%; width: 100%; }
    .monitoring-region-head { flex-direction: column; }
    .monitoring-region-actions { width: 100%; margin-left: 0; justify-content: flex-end; }
    .monitoring-region-source-grid { grid-template-columns: 1fr; }
    .control-stores-table { min-width: 860px; }
    .parser-run-history-panel {
        --run-history-columns: minmax(145px, 1fr) 98px 66px 58px 20px;
        --run-history-gap: 7px;
    }
    .run-history-grid { min-height: 70px; }
    .run-history-detail-grid { grid-template-columns: 1fr 1fr; }
    .run-history-task-row { grid-template-columns: minmax(140px, 1fr) auto; }
    .run-history-task-row > :nth-child(n+3) { display: none; }
}
@media (max-width: 560px) {
    .monitoring-region-source-grid .source-stats { grid-template-columns: 1fr 1fr; }
    .monitoring-region-source-grid .source-stat:last-child { grid-column: auto; }
    .parser-run-history-panel {
        --run-history-columns: minmax(135px, 1fr) 96px 58px 20px;
        --run-history-gap: 7px;
    }
    .run-history-stat[data-label="Получено"] { display: none; }
    .run-history-detail-grid { grid-template-columns: 1fr; }
}

