/* «Расходы на AI»: the Settings row (#sp-entry) and the sub-screen (#section-usage).
   Brief: .impeccable/surfaces/static-spend-js.md. Colors only from palette.css / design.css roles. */

/* ---------------------------------------------------------------- shared */
.sp-cur{margin-left:.14em;font-size:.6em;font-weight:500;letter-spacing:0;color:var(--plum-600)}
.sp-skel{display:block;border-radius:8px;background:var(--plum-150)}
.sp-skel-entry{width:104px;height:30px}
.sp-skel-line{width:170px;height:12px}
.sp-skel-hero{width:168px;height:48px}
.sp-hero .sp-skel-line{margin-top:14px}
.sp-skel-label{width:64px;height:11px;margin-bottom:10px}
.sp-skel-value{width:78px;height:20px}
.sp-skel-chart{width:100%;height:130px;border-radius:10px;background:var(--plum-100)}
#sp-entry ::selection,#section-usage ::selection{background:var(--plum-200);color:var(--plum-900)}

/* ---------------------------------------------------------------- Settings row */
.sp-entry [data-sp-entry]:focus{outline:none}
.sp-entry-row{display:flex;align-items:center;justify-content:space-between;gap:14px 24px;flex-wrap:wrap}
.settings-section p.sp-entry-figure{display:flex;align-items:baseline;flex-wrap:wrap;gap:4px 12px;margin:0;color:var(--ink);line-height:1.2}
.sp-entry-row[aria-busy="true"] .sp-entry-figure{align-items:center}
.sp-entry-total{font-size:26px;font-weight:600;letter-spacing:-.035em;line-height:1.1;font-variant-numeric:tabular-nums;color:var(--ink);white-space:nowrap}
.sp-entry-meta{font-size:13px;color:var(--muted);font-variant-numeric:tabular-nums}
.sp-entry .btn{min-height:40px}
.sp-entry-error{display:flex;align-items:center;flex-wrap:wrap;gap:8px 16px}
.sp-entry-error .inline-error{margin:0}

/* ---------------------------------------------------------------- sub-screen */
#section-usage{flex:1;min-height:0;min-width:0;display:flex}
.sp-page{display:flex;flex-direction:column}
.sp-page .page-heading{max-width:980px;flex-wrap:wrap}
.sp-month select{appearance:auto;min-height:40px;padding:8px 12px;border:1px solid var(--line);border-radius:10px;background:var(--white);color:var(--ink);font:inherit;font-size:13px;font-weight:500;cursor:pointer}
.sp-month select:hover{border-color:var(--plum-300)}
.sp-month select:focus-visible{outline:2px solid var(--plum-500);outline-offset:2px}
.sp-body{max-width:980px}
.sp-body:focus{outline:none}

.sp-summary{display:grid;grid-template-columns:minmax(0,auto) minmax(0,1fr);align-items:end;gap:28px 56px;margin-top:34px}
.sp-summary-empty{grid-template-columns:minmax(0,1fr)}
.sp-total{font-size:44px;font-weight:600;letter-spacing:-.045em;line-height:1;font-variant-numeric:tabular-nums;color:var(--ink);white-space:nowrap}
.sp-caption{margin-top:12px;font-size:13px;color:var(--muted)}
.sp-stats{display:flex;flex-wrap:wrap;margin:0;padding-bottom:3px}
.sp-stat{padding:0 28px;border-left:1px solid var(--plum-150)}
.sp-stat:first-child{padding-left:0;border-left:0}
.sp-stat dt{font-size:12px;color:var(--muted)}
.sp-stat dd{margin:7px 0 0;font-size:19px;font-weight:600;letter-spacing:-.02em;line-height:1.2;font-variant-numeric:tabular-nums;color:var(--ink);white-space:nowrap}
.sp-later{font-size:14px;font-weight:500;letter-spacing:0;color:var(--muted)}
.sp-empty{margin-top:18px;font-size:14px;line-height:1.7;color:var(--muted);max-width:60ch}
.sp-error{display:flex;align-items:center;flex-wrap:wrap;gap:10px 16px;margin-top:34px}
.sp-error .inline-error{margin:0}

/* Daily bars */
.sp-chart{position:relative;margin:40px 0 0}
.sp-plot{position:relative;border-radius:8px;touch-action:pan-y}
.sp-plot:focus-visible{outline:2px solid var(--plum-500);outline-offset:6px}
.sp-plot svg{display:block;overflow:visible}
.sp-grid{stroke:var(--plum-150);stroke-width:1;shape-rendering:crispEdges}
.sp-axis{font-size:11px;fill:var(--muted);font-variant-numeric:tabular-nums}
.sp-axis.is-today{fill:var(--mint-700);font-weight:600}
.sp-col{fill:var(--plum-100)}
.sp-bar{fill:var(--plum-700);opacity:.82;transition:opacity var(--fast)}
.sp-bar.is-today{fill:var(--mint-600);opacity:1}
.sp-bar.is-active{opacity:1}
.sp-bar.is-active:not(.is-today){fill:var(--plum-900)}
.sp-tick{stroke:var(--plum-300);stroke-width:1.5;stroke-linecap:round}
.sp-tick.is-zero{stroke:var(--plum-500)}
.sp-tick.is-today{stroke:var(--mint-600)}
.sp-tip{position:absolute;z-index:2;transform:translate(-50%,-100%);padding:6px 10px;border-radius:8px;background:var(--plum);color:var(--plum-50);font-size:12px;font-weight:500;line-height:1.3;white-space:nowrap;font-variant-numeric:tabular-nums;pointer-events:none;box-shadow:0 6px 18px oklch(from var(--plum-950) l c h / .16)}
.sp-tip[hidden]{display:none}

/* «На что потрачено» */
.sp-purposes{max-width:640px;margin-top:44px}
.sp-purposes h3{font-size:14px;font-weight:600;letter-spacing:-.01em;margin-bottom:6px}
.sp-purpose-list{list-style:none;margin:0;padding:0}
.sp-purpose{padding:13px 0 12px}
.sp-purpose-head{display:flex;align-items:baseline;flex-wrap:wrap;gap:2px 10px;margin-bottom:9px}
.sp-purpose-label{font-size:13.5px;font-weight:500;color:var(--ink)}
.sp-purpose-meta{font-size:12px;color:var(--muted);font-variant-numeric:tabular-nums}
.sp-purpose-cost{margin-left:auto;font-size:13.5px;font-weight:500;font-variant-numeric:tabular-nums;color:var(--ink);white-space:nowrap}
.sp-share{display:block;height:4px;border-radius:2px;background:var(--plum-150);overflow:hidden}
.sp-share span{display:block;height:100%;border-radius:2px;background:var(--plum-700)}

/* «Подробности» */
.sp-details{max-width:640px;margin:36px 0 0}
.sp-table-wrap{overflow-x:auto;margin-bottom:14px}
.sp-table{width:100%;border-collapse:collapse;font-size:13px;font-variant-numeric:tabular-nums}
.sp-table th,.sp-table td{padding:9px 0;border-bottom:1px solid var(--line);text-align:right;white-space:nowrap}
.sp-table thead th{font-size:12px;font-weight:500;color:var(--muted)}
.sp-table th:first-child{text-align:left;padding-right:18px}
.sp-table tbody th{font-weight:400;color:var(--ink)}
.sp-table td{padding-left:18px;color:var(--ink)}
.sp-note{font-size:12px;line-height:1.65;color:var(--muted);margin:0 0 8px;max-width:68ch}

@media (max-width:720px){
 .sp-summary{grid-template-columns:minmax(0,1fr);gap:22px}
 .sp-stats{display:block;padding:0}
 .sp-stat,.sp-stat:first-child{display:flex;align-items:baseline;justify-content:space-between;gap:16px;padding:11px 0;border-left:0;border-top:1px solid var(--plum-150)}
 .sp-stat:last-child{border-bottom:1px solid var(--plum-150)}
 .sp-stat dd{margin:0;font-size:16px}
 .sp-stats-skel .sp-stat{align-items:center}
 .sp-stats-skel .sp-skel-label{margin:0}
 .sp-chart{margin-top:30px}
 .sp-skel-chart{height:120px}
 .sp-purposes{margin-top:34px}
}
@media (max-width:650px){
 .sp-page .page-heading{display:flex;align-items:center}
 .sp-month select{min-height:44px;font-size:16px}
 .sp-entry .btn{min-height:44px}
 .sp-total{font-size:40px}
}
@media (prefers-reduced-motion:reduce){.sp-bar{transition:none}}
