:root {
  color-scheme: light;
  --page: #f7f5fc;
  --panel: #ffffff;
  --panel-soft: #f5f1ff;
  --panel-warm: #fff9e7;
  --text: #211a31;
  --muted: #716a7d;
  --line: #e3ddef;
  --line-strong: #d2c7e9;
  --violet: #6d3ce7;
  --violet-dark: #332069;
  --violet-soft: #eee8ff;
  --yellow: #ffc928;
  --yellow-hover: #f2ba00;
  --success: #178267;
  --warning: #a8640d;
  --danger: #b93863;
  --shadow-sm: 0 8px 22px rgba(48, 28, 87, 0.07);
  --shadow-md: 0 18px 44px rgba(48, 28, 87, 0.13);
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 8% 0%, rgba(109, 60, 231, 0.11), transparent 26rem),
    radial-gradient(circle at 95% 4%, rgba(255, 201, 40, 0.14), transparent 23rem),
    linear-gradient(180deg, #fff 0, var(--page) 32rem);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.62;
}

[hidden] {
  display: none !important;
}

:where(button, input, select, a):focus-visible {
  outline: 3px solid rgba(109, 60, 231, 0.26);
  outline-offset: 2px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

a {
  color: inherit;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.app-shell {
  width: min(1560px, calc(100% - 40px));
  margin: 0 auto;
  padding-bottom: 54px;
}

.eyebrow {
  margin-bottom: 5px;
  color: var(--violet);
  font-size: 11px;
  font-weight: 820;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.primary-button,
.ghost-button,
.text-button,
.source-button,
.card-action,
.danger-button {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 0 15px;
  font-weight: 760;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease, border-color 150ms ease;
}

.primary-button,
.source-button {
  background: var(--yellow);
  color: #261b34;
  box-shadow: 0 9px 18px rgba(230, 170, 0, 0.17);
}

.primary-button:hover,
.source-button:hover {
  transform: translateY(-1px);
  background: var(--yellow-hover);
  box-shadow: 0 12px 24px rgba(230, 170, 0, 0.23);
}

.ghost-button,
.card-action {
  border-color: var(--line);
  background: var(--panel);
  color: var(--violet-dark);
}

.ghost-button:hover,
.card-action:hover {
  border-color: var(--line-strong);
  background: var(--panel-soft);
}

.text-button {
  min-height: 34px;
  border: 0;
  background: transparent;
  color: var(--violet);
  padding-inline: 7px;
}

.danger-button {
  background: var(--danger);
  color: #fff;
}

.danger-button.compact,
.primary-button.compact,
.ghost-button.compact {
  width: auto;
  min-height: 38px;
}

.text-link {
  color: var(--violet);
  font-size: 13px;
  font-weight: 760;
  text-decoration: none;
}

.text-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Header */
.topbar {
  display: flex;
  min-height: 88px;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  border-bottom: 1px solid var(--line);
  padding: 14px 0;
}

.brand-block {
  display: flex;
  min-width: 270px;
  align-items: center;
  gap: 13px;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  position: relative;
  display: grid;
  flex: 0 0 52px;
  width: 52px;
  height: 52px;
  place-items: center;
  overflow: hidden;
  border-radius: 17px;
  background: linear-gradient(145deg, var(--violet-dark), var(--violet));
  box-shadow: 0 12px 27px rgba(59, 32, 123, 0.25);
}

.brand-mark::after {
  content: "";
  position: absolute;
  inset: 2px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 15px;
}

.brand-mark svg {
  width: 30px;
  height: 30px;
  fill: var(--yellow);
  stroke: var(--violet-dark);
  stroke-width: 1.7;
}

.brand-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.brand-copy strong {
  font-size: clamp(20px, 2vw, 27px);
  font-weight: 850;
  letter-spacing: -0.04em;
  line-height: 1.05;
}

.brand-copy small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
}

.region-switcher {
  display: grid;
  width: 210px;
  gap: 4px;
}

.region-switcher > span,
.sync-caption {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.region-switcher select,
.toolbar-field select,
.toolbar-field input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  padding: 0 12px;
}

.region-switcher select:focus,
.toolbar-field select:focus,
.toolbar-field input:focus {
  border-color: var(--violet);
  outline: 3px solid rgba(109, 60, 231, 0.12);
}

.sync-state {
  display: grid;
  min-width: 114px;
  gap: 4px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  color: var(--success);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status-pill::before {
  content: "";
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(23, 130, 103, 0.12);
}

.status-pill.is-bad {
  color: var(--danger);
}

.status-pill.is-bad::before {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(185, 56, 99, 0.12);
}

.author-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 780;
  white-space: nowrap;
}

.author-avatar {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 50%;
  background: var(--violet-soft);
  color: var(--violet-dark);
  font-weight: 850;
}

.monitor-button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding-inline: 19px;
  white-space: nowrap;
}

/* Dashboard and filters */
.dashboard-controls {
  display: grid;
  gap: 13px;
  margin: 20px 0 24px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(140px, 0.68fr)) minmax(270px, 1.35fr);
  gap: 12px;
}

.metric-card {
  display: grid;
  min-height: 82px;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.93);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}

.metric-card::before {
  content: "✦";
  display: grid;
  width: 40px;
  height: 40px;
  grid-row: 1;
  place-items: center;
  border-radius: 12px;
  background: var(--violet-soft);
  color: var(--violet);
  font-size: 18px;
}

.metric-card:nth-child(2)::before { content: "▤"; }
.metric-card:nth-child(3)::before { content: "◎"; }
.metric-card:nth-child(4)::before {
  content: "◷";
  background: #fff5d4;
  color: var(--warning);
}

.metric-card span {
  grid-column: 2;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.metric-card strong {
  grid-column: 3;
  color: var(--violet-dark);
  font-size: 27px;
  font-weight: 850;
  white-space: nowrap;
}

.metric-status strong {
  font-size: 16px;
}

.filter-toolbar {
  display: grid;
  grid-template-columns: minmax(440px, 1.45fr) minmax(210px, 0.72fr) minmax(245px, 0.9fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.95);
  padding: 10px;
  box-shadow: var(--shadow-sm);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 3px;
  border-radius: 11px;
  background: var(--panel-soft);
  padding: 4px;
}

.segmented button {
  min-height: 36px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  padding: 0 7px;
  font-size: 11px;
  font-weight: 760;
}

.segmented button:hover {
  color: var(--violet-dark);
}

.segmented button.is-active {
  background: var(--violet);
  color: #fff;
  box-shadow: 0 6px 14px rgba(109, 60, 231, 0.2);
}

.search-field {
  position: relative;
}

.search-field > span {
  position: absolute;
  top: 50%;
  left: 13px;
  z-index: 1;
  color: var(--muted);
  transform: translateY(-50%);
}

.search-field input {
  padding-left: 38px;
}

.toolbar-reset {
  min-height: 42px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--violet);
  padding-inline: 10px;
  font-size: 12px;
  font-weight: 780;
}

.toolbar-reset:hover {
  background: var(--violet-soft);
}

/* Main workspace */
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 352px;
  align-items: start;
  gap: 22px;
}

.news-panel,
.tech-column {
  min-width: 0;
}

.news-head {
  display: flex;
  min-height: 58px;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  padding: 0 2px;
}

.news-head h2 {
  font-size: 29px;
  font-weight: 860;
  letter-spacing: -0.04em;
}

.news-head p:not(.eyebrow) {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.news-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.quiet-pill {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--muted);
  padding: 0 11px;
  font-size: 11px;
  font-weight: 760;
  white-space: nowrap;
}

.news-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  gap: 18px;
  min-height: 360px;
}

.news-list > .empty-state {
  grid-column: 1 / -1;
}

.news-card {
  display: flex;
  min-width: 0;
  overflow: hidden;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease, opacity 160ms ease;
}

.news-card:hover {
  transform: translateY(-3px);
  border-color: #cbbcf1;
  box-shadow: var(--shadow-md);
}

.news-card.is-saved {
  border-color: #a98bea;
  box-shadow: 0 0 0 2px rgba(109, 60, 231, 0.08), var(--shadow-sm);
}

.news-card.is-hiding {
  opacity: 0;
  transform: scale(0.98);
}

.news-media {
  position: relative;
  width: 100%;
  overflow: hidden;
  aspect-ratio: 16 / 8.7;
  background: var(--panel-soft);
}

.news-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 350ms ease;
}

.news-card:hover .news-media img {
  transform: scale(1.025);
}

.news-placeholder {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  background:
    radial-gradient(circle at 75% 20%, rgba(255, 201, 40, 0.34), transparent 34%),
    linear-gradient(145deg, #eee7ff, #faf8ff);
  color: var(--violet-dark);
  font-size: 12px;
  font-weight: 720;
}

.news-region-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.91);
  color: var(--violet-dark);
  padding: 0 10px;
  font-size: 10px;
  font-weight: 820;
  box-shadow: 0 6px 16px rgba(32, 20, 59, 0.12);
  backdrop-filter: blur(8px);
}

.news-card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
}

.news-source-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 10px;
}

.news-source-line strong {
  overflow: hidden;
  color: var(--violet-dark);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.news-source-line span {
  flex: 0 0 auto;
}

.news-card h3 {
  font-size: clamp(17px, 1.35vw, 21px);
  font-weight: 840;
  line-height: 1.25;
  letter-spacing: -0.025em;
}

.news-card h3 a {
  color: var(--text);
  text-decoration: none;
}

.news-card h3 a:hover {
  color: var(--violet);
}

.summary {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.summary.is-muted {
  font-style: italic;
}

.tourist-hook {
  display: -webkit-box;
  overflow: hidden;
  border-left: 3px solid var(--yellow);
  border-radius: 0 8px 8px 0;
  background: var(--panel-warm);
  color: #564a64;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.42;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-size: 10px;
}

.tag {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  border-radius: 999px;
  background: var(--violet-soft);
  color: var(--violet-dark);
  padding: 0 8px;
  font-size: 10px;
  font-weight: 720;
}

.relevance-score {
  margin-left: auto;
  color: var(--violet-dark);
  font-weight: 760;
}

.confirmation-badge {
  color: var(--warning);
  font-size: 10px;
  font-weight: 760;
}

.publication-sources {
  color: var(--muted);
  font-size: 10px;
}

.source-chips {
  display: none;
}

.news-actions {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) auto auto;
  gap: 7px;
  margin-top: auto;
  padding-top: 3px;
}

.source-button,
.card-action {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding-inline: 10px;
  font-size: 11px;
  text-decoration: none;
}

.card-action {
  background: #fff;
}

.save-action[aria-pressed="true"] {
  border-color: #b9a2ef;
  background: var(--violet-soft);
}

/* Technical column */
.tech-column {
  display: grid;
  gap: 14px;
}

.technical-panel,
.operations-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-sm);
}

.technical-panel {
  border-color: #d7c9f6;
  background:
    radial-gradient(circle at 100% 0%, rgba(255, 201, 40, 0.21), transparent 11rem),
    linear-gradient(145deg, #fff, #f8f4ff);
  padding: 18px;
}

.technical-panel-head,
.operations-header,
.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.technical-panel h2,
.operations-header h2 {
  font-size: 20px;
  font-weight: 840;
  letter-spacing: -0.025em;
}

.technical-live {
  width: 11px;
  height: 11px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 5px rgba(23, 130, 103, 0.12);
}

.technical-lead {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.48;
}

.technical-counters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 14px;
}

.technical-counters > span {
  display: grid;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.82);
  padding: 10px;
}

.technical-counters strong {
  color: var(--violet-dark);
  font-size: 13px;
}

.technical-counters small {
  color: var(--muted);
  font-size: 9px;
}

.technical-actions {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.technical-actions .primary-button,
.technical-actions .ghost-button {
  width: 100%;
}

.technical-actions .download-log-button {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  justify-content: center;
}

.filter-sync-status {
  margin-top: 11px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
  text-align: center;
}

.maintenance-link {
  width: 100%;
  margin-top: 10px;
  border: 0;
  background: transparent;
  color: var(--danger);
  padding: 5px;
  font-size: 10px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.operations-header {
  padding: 16px 17px 13px;
  border-bottom: 1px solid var(--line);
}

.operations-grid {
  display: grid;
  gap: 0;
}

.panel {
  min-width: 0;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.panel:last-child {
  border-bottom: 0;
}

.panel-head {
  min-height: 48px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.panel-head h2 {
  font-size: 13px;
  font-weight: 820;
}

.source-list,
.run-list {
  display: grid;
  max-height: 330px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.run-list {
  max-height: 260px;
}

.source-row,
.run-row {
  display: grid;
  gap: 5px;
  border-bottom: 1px solid var(--line);
  padding: 11px 13px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.source-row:last-child,
.run-row:last-child {
  border-bottom: 0;
}

.source-row:hover,
.run-row:hover {
  background: #fbf9ff;
}

.source-row.is-error,
.run-row.is-error {
  background: #fff8fa;
}

.source-row-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
}

.source-detail-button {
  min-width: 0;
  overflow: hidden;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 0;
  font-size: 11px;
  font-weight: 790;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-dot {
  flex: 0 0 auto;
  border-radius: 999px;
  background: #eef1f0;
  color: var(--muted);
  padding: 3px 6px;
  font-size: 8px;
  font-weight: 800;
}

.status-dot.ok {
  background: #e4f5ef;
  color: var(--success);
}

.status-dot.error {
  background: #fbe8ee;
  color: var(--danger);
}

.source-row-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.source-row-actions .text-button,
.source-row-actions a {
  min-height: auto;
  color: var(--violet);
  padding: 0;
  font-size: 9px;
  font-weight: 740;
  text-decoration: none;
}

.run-row strong {
  color: var(--text);
  font-size: 10px;
}

.source-inspector[hidden] {
  display: none;
}

.inspector-body {
  display: grid;
  gap: 12px;
  padding: 13px;
}

.inspector-status {
  display: grid;
  gap: 4px;
  border: 1px solid #bfe4d8;
  border-radius: 11px;
  background: #f2fbf8;
  padding: 11px;
  color: var(--muted);
  font-size: 10px;
}

.inspector-status strong {
  color: var(--success);
  font-size: 12px;
}

.inspector-status.is-error {
  border-color: #efc3d1;
  background: #fff7fa;
}

.inspector-status.is-error strong,
.error-text {
  color: var(--danger);
}

.inspector-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.inspector-grid span {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px;
  color: var(--muted);
  font-size: 8px;
}

.inspector-grid strong {
  display: block;
  color: var(--text);
  font-size: 15px;
}

.inspector-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.inspector-section {
  display: grid;
  gap: 6px;
  font-size: 10px;
}

.inspector-item,
.inspector-run {
  display: grid;
  gap: 3px;
  border-top: 1px solid var(--line);
  color: var(--text);
  padding-top: 7px;
  text-decoration: none;
}

.inspector-item small,
.inspector-run small {
  color: var(--muted);
}

.empty-state {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.76);
  color: var(--muted);
  padding: 46px 20px;
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

.empty-state.compact {
  border-radius: 9px;
  padding: 12px;
  font-size: 10px;
}

/* Back to top */
.back-to-top {
  position: fixed;
  right: max(22px, calc((100vw - 1560px) / 2 + 8px));
  bottom: 24px;
  z-index: 900;
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  background: var(--violet-dark);
  color: #fff;
  padding: 0 17px;
  font-size: 12px;
  font-weight: 790;
  box-shadow: 0 14px 32px rgba(48, 28, 87, 0.28);
}

.back-to-top:hover {
  transform: translateY(-2px);
  background: var(--violet);
}

.back-to-top span:first-child {
  font-size: 18px;
}

.parser-status-dock {
  position: fixed;
  left: max(22px, calc((100vw - 1560px) / 2 + 8px));
  bottom: 24px;
  z-index: 950;
  display: grid;
  width: min(430px, calc(100vw - 44px));
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 11px;
  border: 1px solid rgba(111, 65, 190, 0.22);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
  padding: 11px 12px;
  box-shadow: 0 18px 52px rgba(48, 28, 87, 0.24);
  backdrop-filter: blur(12px);
}

.parser-status-spinner {
  width: 17px;
  height: 17px;
  border: 2px solid var(--violet-soft);
  border-top-color: var(--violet);
  border-radius: 50%;
  animation: parser-spin 0.8s linear infinite;
}

.parser-status-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.parser-status-copy strong,
.parser-status-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.parser-status-copy strong { font-size: 12px; }
.parser-status-copy small { color: var(--muted); font-size: 10px; }

.parser-status-track {
  height: 3px;
  overflow: hidden;
  margin-top: 3px;
  border-radius: 999px;
  background: var(--violet-soft);
}

.parser-status-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--violet), var(--yellow));
  transition: width 240ms ease;
}

.parser-status-percent { color: var(--violet); font-size: 12px; }

.parser-status-open {
  border: 0;
  border-radius: 9px;
  background: var(--violet-soft);
  color: var(--violet-dark);
  padding: 8px 10px;
  font: inherit;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
}

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

/* Dialogs */
.progress-modal,
.monitoring-modal,
.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  overflow-y: auto;
  padding: 20px;
  background: rgba(32, 22, 54, 0.5);
  backdrop-filter: blur(8px);
}

.progress-card,
.monitoring-card,
.confirm-card {
  width: min(760px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  padding: 22px;
  box-shadow: 0 28px 80px rgba(36, 22, 66, 0.3);
}

.monitoring-card {
  display: flex;
  overflow: hidden;
  flex-direction: column;
  padding: 0;
}

.confirm-card {
  width: min(480px, 100%);
}

.progress-head,
.monitoring-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.progress-head h2,
.monitoring-head h2,
.confirm-card h2 {
  font-size: 22px;
  font-weight: 840;
}

.progress-head > strong {
  color: var(--violet);
  font-size: 25px;
}

.progress-track {
  height: 9px;
  overflow: hidden;
  margin-top: 18px;
  border-radius: 999px;
  background: var(--violet-soft);
}

.progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--violet), #9d7af2);
  transition: width 220ms ease;
}

.progress-current {
  min-height: 22px;
  margin-top: 13px;
  color: var(--muted);
  font-size: 13px;
}

.progress-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 13px;
}

.progress-stats span {
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel-soft);
  padding: 10px;
  color: var(--muted);
  font-size: 10px;
}

.progress-stats strong {
  display: block;
  color: var(--text);
  font-size: 19px;
}

.progress-publication,
.monitoring-recency {
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--violet-soft);
  color: var(--text);
  padding: 11px 13px;
  font-size: 12px;
  line-height: 1.45;
}

.progress-publication {
  margin-top: 12px;
}

.progress-publication.is-ok {
  color: var(--success);
}

.progress-publication.is-error,
.monitoring-recency.is-error {
  border-color: #efc3d1;
  color: var(--danger);
}

.progress-sources,
.monitoring-source-list {
  display: grid;
  gap: 7px;
  overflow-y: auto;
}

.progress-sources {
  max-height: 230px;
  margin-top: 13px;
}

.progress-source,
.monitoring-source-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 9px 11px;
  color: var(--muted);
  font-size: 11px;
}

.progress-source.is-running { border-color: var(--violet); color: var(--text); }
.progress-source.is-ok strong { color: var(--success); }
.progress-source.is-error strong { color: var(--danger); }

.progress-actions,
.monitoring-actions,
.confirm-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.monitoring-head {
  padding: 21px 22px 13px;
}

.monitoring-recency {
  margin: 0 22px 13px;
}

.monitoring-recency.is-warning {
  border-color: #efd99b;
  background: #fff9e8;
  color: var(--warning);
}

.monitoring-source-list {
  min-height: 120px;
  padding: 0 22px 4px;
}

.monitoring-source-row > div {
  min-width: 0;
}

.monitoring-source-row strong,
.monitoring-source-row small {
  display: block;
}

.monitoring-source-row strong {
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.monitoring-source-row small {
  margin-top: 2px;
  font-size: 9px;
}

.monitoring-source-row.is-error {
  border-color: #efc3d1;
  background: #fff9fb;
}

.monitoring-source-result,
.monitoring-source-status {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
}

.monitoring-source-status {
  font-size: 10px;
  font-weight: 790;
}

.monitoring-source-row.is-ok .monitoring-source-status { color: var(--success); }
.monitoring-source-row.is-error .monitoring-source-status { color: var(--danger); }

.monitoring-retry-button,
.error-info {
  display: inline-grid;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  background: #fff;
  color: var(--danger);
}

.monitoring-retry-button {
  width: 28px;
  height: 28px;
  padding: 0;
  font-size: 17px;
}

.monitoring-retry-button.is-running {
  animation: spin 850ms linear infinite;
}

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

.error-info {
  position: relative;
  width: 17px;
  height: 17px;
  font-family: Georgia, serif;
  font-size: 11px;
  cursor: help;
}

.error-info::after {
  content: attr(data-tooltip);
  position: absolute;
  right: -8px;
  bottom: calc(100% + 9px);
  z-index: 20;
  width: min(330px, 72vw);
  padding: 9px 11px;
  border-radius: 9px;
  background: #26202f;
  color: #fff;
  box-shadow: var(--shadow-md);
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.45;
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: 150ms ease;
}

.error-info:hover::after,
.error-info:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

.monitoring-loading {
  padding: 28px 12px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.monitoring-actions {
  justify-content: space-between;
  margin-top: 0;
  padding: 15px 22px 21px;
}

.monitoring-actions > div {
  display: flex;
  gap: 8px;
}

.download-log-button {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.confirm-card > p:not(.eyebrow) {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 84px;
  z-index: 1500;
  max-width: min(400px, calc(100vw - 40px));
  border-radius: 12px;
  background: var(--violet-dark);
  color: #fff;
  padding: 12px 15px;
  box-shadow: var(--shadow-md);
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: 170ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Responsive layout */
@media (max-width: 1320px) {
  .topbar {
    align-items: center;
  }

  .topbar-actions {
    display: flex;
  }

  .sync-state {
    display: none;
  }

  .monitor-button {
    grid-column: auto;
  }

  .filter-toolbar {
    grid-template-columns: minmax(410px, 1.35fr) minmax(190px, 0.7fr) minmax(220px, 0.9fr) auto;
  }

  .workspace {
    grid-template-columns: minmax(0, 1fr) 330px;
  }
}

@media (max-width: 1080px) {
  .topbar {
    align-items: flex-start;
  }

  .author-chip {
    display: none;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: minmax(190px, 1fr) auto;
  }

  .monitor-button {
    grid-column: 1 / -1;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-toolbar {
    grid-template-columns: 1fr 1fr auto;
  }

  .filter-toolbar .segmented {
    grid-column: 1 / -1;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .tech-column {
    grid-row: 1;
    grid-template-columns: minmax(280px, 0.75fr) minmax(0, 1.25fr);
  }

  .technical-panel {
    position: static;
  }

  .operations-panel {
    min-width: 0;
  }

  .operations-grid {
    grid-template-columns: 1fr 1fr;
  }

  .source-inspector {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .news-panel {
    grid-row: 2;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 24px, 700px);
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
    gap: 14px;
    padding: 15px 0;
  }

  .brand-block {
    min-width: 0;
  }

  .brand-copy small {
    white-space: normal;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: 1fr auto;
  }

  .region-switcher {
    width: auto;
  }

  .monitor-button {
    grid-column: 1 / -1;
  }

  .metrics {
    gap: 8px;
  }

  .metric-card {
    min-height: 72px;
    grid-template-columns: 34px 1fr;
    gap: 8px;
    padding: 11px;
  }

  .metric-card::before {
    width: 34px;
    height: 34px;
    grid-row: 1 / 3;
  }

  .metric-card span,
  .metric-card strong {
    grid-column: 2;
  }

  .metric-card strong,
  .metric-status strong {
    margin: 0;
    font-size: 18px;
  }

  .filter-toolbar {
    grid-template-columns: 1fr;
  }

  .filter-toolbar .segmented {
    grid-column: auto;
    grid-template-columns: repeat(3, 1fr);
  }

  .toolbar-reset {
    min-height: 34px;
  }

  .tech-column {
    display: contents;
  }

  .technical-panel {
    grid-row: 1;
  }

  .news-panel {
    grid-row: 2;
  }

  .operations-panel {
    grid-row: 3;
  }

  .operations-grid { grid-template-columns: 1fr; }

  .news-list {
    grid-template-columns: 1fr;
  }

  .news-head h2 {
    font-size: 25px;
  }

  .back-to-top {
    right: 14px;
    bottom: 14px;
    width: 46px;
    justify-content: center;
    padding: 0;
  }

  .back-to-top span:last-child {
    display: none;
  }

  .toast {
    right: 14px;
    bottom: 70px;
  }
}

@media (max-width: 540px) {
  .brand-mark {
    flex-basis: 46px;
    width: 46px;
    height: 46px;
  }

  .brand-copy strong {
    font-size: 19px;
  }

  .author-chip {
    display: none;
  }

  .topbar-actions {
    grid-template-columns: 1fr;
  }

  .metrics {
    grid-template-columns: 1fr 1fr;
  }

  .metric-status strong {
    overflow: hidden;
    font-size: 13px;
    text-overflow: ellipsis;
  }

  .news-actions {
    grid-template-columns: 1fr 1fr;
  }

  .source-button {
    grid-column: 1 / -1;
  }

  .technical-counters,
  .progress-stats,
  .inspector-grid {
    grid-template-columns: 1fr;
  }

  .monitoring-source-row,
  .monitoring-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .monitoring-actions > div,
  .monitoring-actions button,
  .monitoring-actions .download-log-button {
    width: 100%;
  }

  .monitoring-actions button,
  .monitoring-actions .download-log-button {
    justify-content: center;
  }

  .progress-actions,
  .confirm-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .progress-actions button,
  .confirm-actions button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
