/* ---------- The creator's AI spend page (web/ai-usage.js) ---------- */
/* Feature groups of the daily chart: three hues validated for the graphite surface (#232326, CVD-safe as adjacent
   pairs) and a neutral grey for «other». Status colours (--ok, --warn, --danger) stay reserved for outcomes. */
.aiu-g-blog { --aiu-color: #3987e5; }
.aiu-g-seo { --aiu-color: #d95926; }
.aiu-g-admin-text { --aiu-color: #199e70; }
.aiu-g-other { --aiu-color: #8e8e96; }

/* Every block of the page sits in one column with the site's section rhythm; blocks never set their own outer margin,
   so the period cards, the panels, the filters, the totals and the empty state can never touch. */
.aiu-page { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-section); }
.aiu-page > * { min-width: 0; margin: 0; }

.aiu-notice { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 12px 14px;
  border: 1px solid var(--line-2); border-radius: var(--radius-md); background: var(--panel-2); color: var(--text); font-size: 14px; line-height: 1.5; }

.aiu-window { width: 100%; min-height: 0; grid-template-columns: minmax(0, 1fr); justify-content: stretch; align-content: start; justify-items: start;
  padding: var(--space-card); border-color: var(--line); background: var(--panel); color: var(--text); font-weight: 400; text-align: left; }
.aiu-window:hover { background: var(--panel-2); }
.aiu-window.is-active { border-color: var(--line-2); background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--text-2); }
.aiu-window .value { font-family: var(--font-display); font-size: clamp(20px, 5vw, 30px); font-weight: 600; }

.aiu-panels { align-items: stretch; }
.aiu-budget, .aiu-account { display: grid; align-content: start; gap: 12px; }
.aiu-budget > *, .aiu-account > * { margin: 0; }
/* Both panel heads are as tall as the small «Обновить» button, so the two titles share one line. */
.aiu-budget .section-title, .aiu-account .section-title { min-height: 44px; margin: 0; }
.aiu-budget > button, .aiu-account > button { justify-self: start; }
.aiu-big { font-family: var(--font-display); font-size: clamp(22px, 4.6vw, 28px); font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; }
.aiu-budget-line { gap: 6px 16px; font-size: 14px; }
.aiu-meter { display: block; width: 100%; height: 8px; border: 0; border-radius: 999px; background: var(--panel-3); -webkit-appearance: none; appearance: none; }
.aiu-meter::-webkit-meter-bar { height: 8px; border: 0; border-radius: 999px; background: var(--panel-3); }
.aiu-meter::-webkit-meter-optimum-value { border-radius: 999px; background: var(--text-2); }
.aiu-meter::-webkit-meter-suboptimum-value { border-radius: 999px; background: var(--warn); }
.aiu-meter::-webkit-meter-even-less-good-value { border-radius: 999px; background: var(--danger); }
.aiu-meter::-moz-meter-bar { border-radius: 999px; background: var(--text-2); }
.aiu-meter:-moz-meter-sub-optimum::-moz-meter-bar { background: var(--warn); }
.aiu-meter:-moz-meter-sub-sub-optimum::-moz-meter-bar { background: var(--danger); }
.aiu-alert { padding: 10px 12px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--panel-2); font-size: 14px; line-height: 1.5; }
.aiu-alert.warn { border-color: rgb(228 174 79 / .45); background: rgb(228 174 79 / .08); }
.aiu-alert.danger { border-color: rgb(242 122 111 / .5); background: rgb(242 122 111 / .08); }

.aiu-balance { display: grid; gap: 4px; padding: 0 0 12px; border-bottom: 1px solid var(--line); }
.aiu-balance p { margin: 0; }
.aiu-balance .value { font-family: var(--font-display); font-weight: 600; }
.aiu-account h3 { font-size: 15px; }
.aiu-facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 16px; font-size: 14px; }
.aiu-facts dt { color: var(--muted); }
.aiu-facts dd { margin: 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.aiu-key-status { color: var(--text-2); }

.aiu-filters-section .section-title { flex-wrap: wrap; }
.aiu-filters-section > .aiu-filters { margin: 0; }
.aiu-filters-section .segmented { flex-wrap: wrap; }
.aiu-filters { display: grid; gap: 0 16px; grid-template-columns: minmax(0, 1fr); align-items: end; }
.aiu-filters select { width: 100%; }
.aiu-filter-actions { gap: 8px; padding-top: 12px; }
.aiu-filters .form-error:empty { display: none; }

.aiu-empty { padding: 40px var(--space-card); }
.aiu-empty h2 { margin-bottom: 6px; }
.aiu-empty p { margin: 0; }
.aiu-chart .stats-chart { margin-top: 4px; }
.aiu-seg { fill: var(--aiu-color); }
.aiu-hit { fill: transparent; }
.aiu-day:hover .aiu-hit { fill: rgb(255 255 255 / .05); }
.aiu-chart .chart-dates span:nth-child(2) { text-align: center; }
.aiu-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 14px 0 0; padding: 0; list-style: none; color: var(--text-2); font-size: 13px; }
.aiu-legend li { display: inline-flex; align-items: center; gap: 7px; }
.aiu-legend strong { color: var(--text); font-weight: 500; }
.aiu-swatch { width: 10px; height: 10px; flex: none; border-radius: 3px; background: var(--aiu-color); }

.aiu-table td:first-child { max-width: 360px; overflow-wrap: anywhere; }
.aiu-link { min-width: 0; min-height: 0; padding: 0; border: 0; background: none; color: var(--text); font: inherit; text-align: left; text-decoration: underline;
  text-decoration-color: var(--line-2); text-underline-offset: 3px; cursor: pointer; }
.aiu-link:hover { color: var(--primary-hover); text-decoration-color: var(--text-2); }
.aiu-error { background: rgb(242 122 111 / .1); color: var(--danger); font-family: var(--font-mono); font-size: 12px; }
.aiu-model-cell { font-family: var(--font-mono); font-size: 13px; overflow-wrap: anywhere; }
.aiu-cost { display: inline-block; }
.aiu-money { white-space: nowrap; }
.aiu-sub { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; white-space: nowrap; }

@media (min-width: 720px) {
  .aiu-filters { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; }
  .aiu-filters .form-error { grid-column: 1 / -1; }
}
@media (max-width: 619px) {
  .aiu-window { padding: var(--space-card-sm); }
  .aiu-empty { padding: 28px var(--space-card-sm); }
}
@media (max-width: 540px) {
  .aiu-table td:first-child { max-width: none; }
  .aiu-link { text-align: right; }
  .aiu-facts { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .aiu-facts dd { margin-bottom: 8px; }
}
@media (forced-colors: active) {
  .aiu-seg { fill: CanvasText; }
  .aiu-swatch { background: CanvasText; }
}
