/* финальный авторитет внешнего слоя для graph/analysis/notes */

#screen-chart .chart-inline-total:empty,
#screen-chart .chart-help-note:empty,
#screen-chart .chart-detail-empty:empty,
#screen-chart .chart-detail-line:empty,
#screen-notes .notes-days-count:empty,
#screen-notes .notes-meta-line:empty,
#screen-notes .notes-meta-row:empty,
#screen-analysis .analysis-date-label:empty {
  display: none !important;
}

#screen-chart .chart-details-card[style*="display: none"],
#screen-chart .chart-detail-panel[style*="display: none"],
#screen-notes [style*="display: none"],
#screen-analysis [style*="display: none"] {
  pointer-events: none;
}

#screen-chart .chart-wrap,
#screen-chart .chart-summary,
#screen-chart .chart-details-card,
#chart-metric-glossary.metric-glossary,
#screen-analysis .analysis-period-card,
#screen-analysis .analysis-counts-card,
#screen-analysis .analysis-top-card,
#screen-analysis .analysis-ai-card,
#screen-notes .notes-recent-block,
#screen-notes .notes-recent-card,
#screen-notes .notes-entry {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

#screen-chart .chart-help-note,
#screen-chart .chart-detail-line,
#screen-chart .chart-detail-empty,
#screen-analysis .analysis-empty,
#screen-analysis .analysis-ai-text,
#screen-notes .notes-entry-text,
#screen-notes .notes-recent-text {
  overflow-wrap: anywhere;
}

#screen-chart .chart-help-note {
  display: block;
  margin-bottom: 12px;
}

#screen-chart .chart-details-card + .chart-details-card {
  margin-top: 16px;
}

#screen-chart .chart-detail-panel + .chart-detail-panel {
  margin-top: 14px;
}

#screen-notes .notes-date-row,
#screen-notes .notes-range-row,
#screen-analysis .analysis-period-btns,
#screen-analysis .range-picker-row {
  margin-bottom: 14px;
}

#screen-analysis .analysis-list-title {
  line-height: 1.25;
}

#screen-analysis .analysis-period-row,
#screen-analysis .analysis-counts-row,
#screen-analysis .analysis-period-row span,
#screen-analysis .analysis-counts-row span,
#screen-analysis .analysis-period-row strong,
#screen-analysis .analysis-counts-row strong {
  min-width: 0;
}

#screen-analysis .analysis-top-card,
#screen-analysis .analysis-counts-card,
#screen-analysis .analysis-period-card,
#screen-notes .notes-recent-card,
#screen-notes .notes-entry,
#screen-chart .chart-details-card {
  overflow: hidden;
}

#screen-chart .chart-landing-summary-line,
#screen-chart .chart-landing-forecast-line {
  display: none !important;
}

#screen-chart .chart-landing-hero,
#screen-chart .chart-landing-hero-compact,
#screen-chart .chart-detail-metrics-grid,
#screen-chart .chart-detail-metrics-grid.compact,
#chart-metric-glossary .metric-glossary-grid,
#screen-analysis .analysis-glossary-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 10px;
}

#screen-chart .chart-hero-card,
#screen-chart .chart-hero-card-metric,
#screen-chart .chart-detail-metric,
#chart-metric-glossary .metric-glossary-item,
#screen-analysis .analysis-glossary-item {
  min-width: 0;
}

#screen-analysis #analysis-body {
  display: grid;
  gap: 16px;
  align-content: start;
}

#screen-analysis .analysis-period-card,
#screen-analysis .analysis-counts-card,
#screen-analysis .analysis-top-card,
#screen-analysis .analysis-ai-card {
  width: min(100%, 980px);
  margin-left: 0;
  margin-right: 0;
}

#screen-analysis .analysis-list {
  display: grid;
  gap: 10px;
}

#screen-analysis .analysis-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(150,118,45,.10);
}

#screen-analysis .analysis-item:last-child {
  border-bottom: none;
}

#screen-analysis .analysis-item-main {
  flex: 1 1 auto;
  min-width: 0;
}

#screen-analysis .analysis-item strong {
  flex: 0 0 auto;
  min-width: 72px;
  text-align: right;
}

#screen-chart .chart-details-body {
  display: grid;
  gap: 14px;
}

#screen-chart .chart-detail-list {
  display: grid;
  gap: 8px;
}

#screen-notes .notes-recent-block {
  display: grid;
  gap: 12px;
}

#screen-notes .notes-recent-card {
  margin-bottom: 0;
}

#screen-notes .notes-entry {
  margin-bottom: 0;
}

@media (max-width: 900px) {
  #screen-analysis .analysis-period-card,
  #screen-analysis .analysis-counts-card,
  #screen-analysis .analysis-top-card,
  #screen-analysis .analysis-ai-card {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .date-picker-row,
  .notes-date-row {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    align-items: stretch !important;
  }

  .date-picker-row > *,
  .notes-date-row > *,
  .range-picker-row > * {
    flex: 1 1 calc(50% - 4px) !important;
    min-width: 0 !important;
  }

  .range-picker-row {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }

  .date-picker-row input[type=date],
  .range-picker-row input[type=date],
  .notes-date-row input[type=date] {
    width: 100% !important;
    min-width: 0 !important;
  }

  .notes-date-row .btn-sm {
    width: 100% !important;
    min-width: 0 !important;
    padding: 9px 8px !important;
  }

  #screen-chart .chart-landing-hero,
  #screen-chart .chart-landing-hero-compact,
  #screen-chart .chart-detail-metrics-grid,
  #screen-chart .chart-detail-metrics-grid.compact,
  #chart-metric-glossary .metric-glossary-grid,
  #screen-analysis .analysis-glossary-list {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px;
  }

  #screen-chart .chart-details-card,
  #screen-analysis .analysis-period-card,
  #screen-analysis .analysis-counts-card,
  #screen-analysis .analysis-top-card,
  #screen-analysis .analysis-ai-card,
  #screen-notes .notes-recent-card,
  #screen-notes .notes-entry {
    border-radius: 16px;
  }

  #screen-analysis .analysis-period-row,
  #screen-analysis .analysis-counts-row {
    min-height: 52px;
    padding: 14px 14px !important;
    gap: 12px;
  }

  #screen-analysis .analysis-period-row strong,
  #screen-analysis .analysis-counts-row strong {
    min-width: 70px;
    max-width: 44%;
    font-size: 13px;
  }
}
