/* Flying Posts: dashboard, analytics and chart styles (.dash- .ana- .ch-) */

/* ---------- Charts ---------- */
.ch-host { display: block; width: 100%; min-width: 0; }
.ch { position: relative; width: 100%; }
.ch-svg { display: block; max-width: 100%; overflow: visible; outline: none; }
.ch-svg:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
.ch-grid { stroke: var(--border); stroke-width: 1; stroke-dasharray: 2 4; }
.ch-axis { fill: var(--text-muted); font-size: 11px; font-family: inherit; }
.ch-guide { stroke: var(--text-muted); stroke-width: 1; stroke-dasharray: 3 3; pointer-events: none; }
.ch-hl { fill: var(--text); opacity: 0.06; pointer-events: none; }
.ch-center { fill: var(--text); font-size: 20px; font-weight: 700; font-family: inherit; }
.ch-arc { transition: opacity 0.15s ease; cursor: pointer; }
.ch-arc.dim { opacity: 0.3; }
.ch-empty { display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 13px; border: 1px dashed var(--border); border-radius: var(--radius); text-align: center; padding: 16px; }
.ch-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; }
.ch-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; font-size: 12px; color: var(--text-muted); }
.ch-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.ch-tip { position: absolute; z-index: 5; pointer-events: none; background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); padding: 8px 10px; font-size: 12px; min-width: 110px; max-width: 240px; }
.ch-tip[hidden] { display: none; }
.ch-tip-head { font-weight: 600; margin-bottom: 4px; }
.ch-tip-row { display: flex; align-items: center; gap: 6px; line-height: 1.6; }
.ch-tip-name { color: var(--text-muted); flex: 1; }
.ch-tip-val { font-weight: 600; font-variant-numeric: tabular-nums; }
.ch-donut { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; justify-content: center; }
.ch-donut-list { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 150px; display: flex; flex-direction: column; gap: 2px; }
.ch-donut-row { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 6px; font-size: 13px; outline: none; }
.ch-donut-row.on, .ch-donut-row:focus-visible { background: var(--surface-2); }
.ch-donut-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-donut-val { font-weight: 600; font-variant-numeric: tabular-nums; }
.ch-donut-pct { width: 36px; text-align: right; font-size: 12px; }
.ch-spark { display: block; width: 100%; }
@media (prefers-reduced-motion: reduce) { .ch-arc { transition: none; } }

/* ---------- Dashboard ---------- */
.dash, .ana { max-width: 1280px; margin: 0 auto; }
.dash-loading { display: flex; justify-content: center; padding: 64px 0; }
.dash-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.dash-greet { margin: 0 0 4px; font-size: 26px; line-height: 1.2; letter-spacing: -0.01em; }
.dash-quick { flex-wrap: wrap; gap: 8px; }
.dash-kpis { margin-bottom: 8px; }
.dash-kpi { display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.dash-kpi-value { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.dash-kpi-spark { height: 34px; margin-top: 10px; }
.dash-up { color: var(--success); }
.dash-down { color: var(--danger); }
.dash-note { margin: 8px 2px 0; }
.dash-note a { color: var(--primary); }
.dash-main { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px; margin-top: 16px; align-items: start; }
.dash-col { min-width: 0; }
.dash-card-head { align-items: center; margin-bottom: 8px; }
.dash-card-head .card-title { margin: 0; }
.dash-card-head a { color: var(--primary); text-decoration: none; }
.dash-card-head a:hover { text-decoration: underline; }
.dash-list { display: flex; flex-direction: column; gap: 2px; }
.dash-day { padding: 10px 8px 4px; text-transform: uppercase; letter-spacing: 0.06em; font-size: 11px; }
.dash-more { padding: 8px; }
.dash-row, .dash-attn { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 9px 8px; background: none; border: 0; border-radius: 8px; color: var(--text); font: inherit; cursor: pointer; }
.dash-row:hover, .dash-attn:hover { background: var(--surface-2); }
.dash-row:focus-visible, .dash-attn:focus-visible, .dash-stage:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.dash-brand { width: 4px; align-self: stretch; border-radius: 2px; flex: none; min-height: 28px; }
.dash-row-main { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: 1px; }
.dash-row-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-row-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-row-time { flex: none; }
.dash-plats { display: flex; gap: 4px; flex: none; }
.dash-attn-icon { flex: none; display: inline-flex; width: 28px; height: 28px; align-items: center; justify-content: center; border-radius: 8px; }
.dash-attn-failed .dash-attn-icon { color: var(--danger); background: color-mix(in srgb, var(--danger) 14%, transparent); }
.dash-attn-manual .dash-attn-icon, .dash-attn-warn .dash-attn-icon { color: var(--warning); background: color-mix(in srgb, var(--warning) 16%, transparent); }
.dash-clear { display: flex; align-items: center; gap: 10px; padding: 14px 4px; color: var(--success); }
.dash-clear span { color: var(--text-muted); }
.dash-pipe-bar { display: flex; height: 10px; gap: 2px; border-radius: 6px; overflow: hidden; margin: 4px 0 14px; background: var(--surface-2); }
.dash-seg { display: block; min-width: 4px; }
.dash-pipe { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.dash-stage { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 12px; background: var(--surface-2); border: 1px solid transparent; border-radius: 10px; color: var(--text); font: inherit; cursor: pointer; text-align: left; }
.dash-stage:hover { border-color: var(--border); }
.dash-stage-n { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.dash-stage-l { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); }
.dash-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dash-st-idea { background: #a78bfa; }
.dash-st-draft { background: #94a3b8; }
.dash-st-ready { background: #38bdf8; }
.dash-st-scheduled { background: #6366f1; }
.dash-st-published { background: var(--success); }
.dash-st-failed { background: var(--danger); }

@media (max-width: 1000px) {
  .dash-main { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 800px) {
  .dash-greet { font-size: 22px; }
  .dash-kpis.grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-kpi-value { font-size: 23px; }
  .dash-row .dash-plats { display: none; }
}
@media (max-width: 480px) {
  .dash-pipe { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-quick .btn { flex: 1 1 auto; justify-content: center; }
}

/* ---------- Analytics ---------- */
.ana-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.ana-controls .select { min-width: 150px; }
.ana-custom { gap: 8px; align-items: center; }
.ana-custom .input { width: auto; }
.ana-results { gap: 16px; }
.ana-stats.grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ana-stat { display: flex; flex-direction: column; gap: 2px; }
.ana-stat-value { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.ana-charts.grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ana-chart { min-height: 200px; margin-top: 8px; }
.ana-table-wrap { overflow-x: auto; max-width: 100%; }
.ana-table { width: 100%; }
.ana-table th, .ana-table td { white-space: nowrap; }
.ana-num { text-align: right; font-variant-numeric: tabular-nums; }
.ana-plat { gap: 8px; align-items: center; }
.ana-plat-wrap { display: grid; grid-template-columns: minmax(0, 3fr) minmax(220px, 2fr); gap: 24px; align-items: center; }
.ana-donut { min-width: 0; }
.ana-post { max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
.ana-link { background: none; border: 0; padding: 0; color: var(--text); font: inherit; font-weight: 500; cursor: pointer; text-align: left; max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ana-link:hover { color: var(--primary); text-decoration: underline; }
.ana-data { margin-top: 16px; }
.ana-data-body { margin-top: 16px; }
.ana-form-top { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.ana-form-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.ana-drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; padding: 28px 16px; border: 2px dashed var(--border); border-radius: var(--radius); color: var(--text-muted); cursor: pointer; transition: border-color 0.15s ease, background 0.15s ease; }
.ana-drop:hover, .ana-drop.over, .ana-drop:focus-visible { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 7%, transparent); outline: none; }
.ana-drop .small { max-width: 560px; }
.ana-preview { display: flex; flex-direction: column; gap: 8px; }
.ana-preview-head { align-items: center; gap: 8px; }
.ana-preview-table td, .ana-preview-table th { font-size: 12px; }
.ana-warn { display: flex; align-items: center; gap: 6px; color: var(--warning); }
.ana-import-sum { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 8px; background: var(--surface-2); }
.ana-import-sum.ok { color: var(--success); }
.ana-import-sum.warn { color: var(--warning); }
.ana-errors { margin: 8px 0 0; padding-left: 18px; color: var(--text-muted); display: flex; flex-direction: column; gap: 2px; max-height: 200px; overflow-y: auto; }
.ana-sync-list { display: flex; flex-direction: column; gap: 6px; }
.ana-sync-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--surface-2); border-radius: 8px; }
.ana-sync-name { font-weight: 500; }

@media (max-width: 1000px) {
  .ana-form-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ana-plat-wrap { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 800px) {
  .ana-stats.grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ana-charts.grid { grid-template-columns: minmax(0, 1fr); }
  .ana-stat-value { font-size: 22px; }
}
@media (max-width: 560px) {
  .ana-form-top { grid-template-columns: minmax(0, 1fr); }
  .ana-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ana-controls .select { flex: 1; }
}
