/* Компоненты ui.js: карточки, показатели, таблица, графики, тосты, диалог, пустое состояние. */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-1); padding: 18px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-sub { color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.grid-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
@media (max-width: 860px) { .grid-2 { grid-template-columns: 1fr; } }

.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 14px 16px; box-shadow: var(--shadow-1); }
.stat-label { color: var(--muted); font-size: 13px; }
.stat-value { font-size: 26px; font-weight: 750; line-height: 1.2; margin: 2px 0; font-variant-numeric: tabular-nums; }
.stat-hint { color: var(--muted); font-size: 12.5px; }
.delta { display: inline-block; font-size: 12.5px; font-weight: 700; padding: 1px 8px; border-radius: 999px; }
.delta.good { background: var(--ok-soft); color: var(--ok); }
.delta.bad { background: var(--bad-soft); color: var(--bad); }
.delta.flat { background: var(--surface-2); color: var(--muted); }

.rows { list-style: none; display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.row:first-child { border-top: 0; }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.badge { padding: 2px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 650; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge.approved { background: var(--ok-soft); color: var(--ok); }
.badge.pending { background: var(--warn-soft); color: var(--warn); }
.badge.rejected { background: var(--bad-soft); color: var(--bad); }
.badge.paused { background: var(--info-soft); color: var(--info); }

/* Таблица */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl th { font-size: 12.5px; color: var(--muted); font-weight: 650; background: var(--surface-2); }
.tbl .r { text-align: right; font-variant-numeric: tabular-nums; }
.tbl-empty { text-align: center !important; color: var(--muted); padding: 24px !important; }
.th-sort { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; color: inherit; font: inherit; font-weight: 650; cursor: pointer; padding: 0; }
.th-sort:hover { color: var(--text); }

/* Графики */
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .line { stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.chart .pt { stroke: var(--surface); stroke-width: 1.5; }
.ser-0 { fill: var(--c0); stroke: var(--c0); } .ser-1 { fill: var(--c1); stroke: var(--c1); } .ser-2 { fill: var(--c2); stroke: var(--c2); }
.ser-3 { fill: var(--c3); stroke: var(--c3); } .ser-4 { fill: var(--c4); stroke: var(--c4); } .ser-5 { fill: var(--c5); stroke: var(--c5); }
.chart .bar { stroke: none; }
.chart .line.ser-0, .chart .line.ser-1, .chart .line.ser-2, .chart .line.ser-3, .chart .line.ser-4, .chart .line.ser-5 { fill: none; }
.spark { width: 100%; display: block; }
.spark-bar { fill: var(--c0); }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; font-size: 13px; color: var(--muted); }
.legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; stroke: none; }

/* Пустое состояние */
.empty { text-align: center; padding: 36px 16px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty h2 { color: var(--text); }
.empty p { max-width: 420px; }
.empty-ico { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 16px; background: var(--surface-2); color: var(--muted); }

/* Тосты и диалог */
.toasts { position: fixed; z-index: 100; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; max-width: calc(100vw - 32px); }
@media (max-width: 860px) { .toasts { bottom: calc(var(--bottom-nav-h) + 12px); left: 16px; right: 16px; } }
.toast { background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: var(--r-sm); box-shadow: var(--shadow-2); font-weight: 600; }
.toast-ok { background: var(--ok); color: #fff; }
.toast-error { background: var(--bad); color: #fff; }
.overlay { position: fixed; inset: 0; z-index: 90; background: var(--overlay); display: grid; place-items: center; padding: 16px; }
.dialog { width: 100%; max-width: 420px; background: var(--surface); border-radius: var(--r-lg); padding: 22px; box-shadow: var(--shadow-2); }
.dialog p { color: var(--muted); margin-top: 8px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
