/* ==========================================================================================
   Page pieces — the home figures, the attention list, the connection meters, the first-run
   steps, the charger's connection card. Built from the same tokens as everything else.
   ========================================================================================== */

/* A section title with one quiet line under it. */
.section-head { margin-block: 0 var(--s-4); }
.section-head h2 { margin: 0; font-size: var(--fs-md); }
.section-head p { margin: 2px 0 0; color: var(--c-muted); font-size: var(--fs-sm); }
.card .card-header > p { margin: 2px 0 0; color: var(--c-muted); font-size: var(--fs-sm); }

.quick-actions { display: flex; flex-wrap: wrap; gap: var(--s-2); }

/* ---- Stat tiles -------------------------------------------------------------------------------
   Label, figure, one optional line. The figure is the darkest, largest thing on the tile; the
   icon is a quiet brand chip (status colours are kept for status). A figure the platform could not
   answer is the words "not available" in the uncertain pill — never a 0. */
.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-4); margin-block-end: var(--s-6); }
.stat {
  position: relative; display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-3);
  min-width: 0; padding: var(--s-5);
  color: var(--c-text); background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg); box-shadow: var(--e-1);
  text-decoration: none;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.stat:hover { color: var(--c-text); text-decoration: none; border-color: var(--c-brand-tint-border); box-shadow: var(--e-2); }
.stat-text { min-width: 0; }
.stat-label { margin: 0 0 var(--s-2); color: var(--c-text-2); font-size: var(--fs-sm); font-weight: var(--fw-medium); line-height: 1.35; }
.stat-value { margin: 0; color: var(--c-text); font-size: var(--fs-2xl); font-weight: var(--fw-semibold); line-height: 1.15; overflow-wrap: anywhere; }
html:lang(ar) .stat-value { line-height: 1.3; }
.stat-value .badge { vertical-align: middle; }
.stat[data-state="unavailable"] .stat-value { font-size: var(--fs-base); line-height: 2.3; }
.stat-hint { margin: var(--s-2) 0 0; color: var(--c-muted); font-size: var(--fs-sm); line-height: 1.4; }
.stat-icon { display: grid; place-items: center; flex-shrink: 0; width: 40px; height: 40px; color: var(--c-brand-text); background: var(--c-brand-tint); border-radius: var(--r-md); font-size: 1.25rem; }
@media (max-width: 1199.98px) { .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 575.98px) {
  .stat-grid { gap: var(--s-3); }
  .stat { padding: var(--s-4); }
  .stat-icon { display: none; }
  .stat-value { font-size: var(--fs-xl); }
}

/* ---- "Needs your attention" ------------------------------------------------------------------- */
.attention-list { list-style: none; margin: 0; padding: 0; }
.attention-row { display: flex; align-items: center; gap: var(--s-3); padding-block: var(--s-3); border-block-end: 1px solid var(--c-border); }
.attention-row:first-child { padding-block-start: 0; }
.attention-row:last-child { border-block-end: 0; padding-block-end: 0; }
.attention-icon { display: grid; place-items: center; flex-shrink: 0; width: 40px; height: 40px; border-radius: var(--r-md); font-size: 1.25rem; }
.attention-row[data-state="needs"] .attention-icon { color: var(--c-bad-text); background: var(--c-bad-tint); }
.attention-row[data-state="clear"] .attention-icon { color: var(--c-ok-text); background: var(--c-ok-tint); }
.attention-row[data-state="unknown"] .attention-icon { color: var(--c-uncertain-text); background: var(--c-uncertain-tint); outline: 1px dashed var(--c-uncertain); outline-offset: -1px; }
.attention-label { flex: 1; min-width: 0; }
.attention-count { min-width: 2ch; font-size: var(--fs-lg); font-weight: var(--fw-semibold); text-align: end; }
.all-clear { display: flex; align-items: center; gap: var(--s-2); margin: var(--s-4) 0 0; color: var(--c-ok-text); font-weight: var(--fw-medium); }
.all-clear .ph { font-size: 1.25rem; }
@media (max-width: 575.98px) {
  .attention-row { flex-wrap: wrap; }
  .attention-label { flex-basis: calc(100% - 52px); }
  .attention-row > .btn { margin-inline-start: auto; }
  .attention-count, .attention-row > .badge { margin-inline-start: 52px; }
}

/* ---- Chargers by connection state: one meter per state --------------------------------------
   The pill names the state (shape + words), the number is the value, the meter is its share. */
.kpi-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-4); }
.kpi-list li { display: block; }
.meter-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); margin-block-end: var(--s-2); }
.meter-row a { text-decoration: none; border-radius: var(--r-pill); }
.meter-n, .kpi-num { color: var(--c-text); font-size: var(--fs-md); font-weight: var(--fw-semibold); }
.meter { --m-fill: var(--c-neutral); --m-track: var(--c-neutral-tint); height: 8px; overflow: hidden; background: var(--m-track); border-radius: var(--r-pill); }
.meter-fill { height: 100%; min-inline-size: 0; background: var(--m-fill); border-radius: var(--r-pill); }
.meter[data-tone="ok"] { --m-fill: var(--c-ok); --m-track: var(--c-ok-tint); }
.meter[data-tone="warn"] { --m-fill: var(--c-warn); --m-track: var(--c-warn-tint); }
.meter[data-tone="bad"] { --m-fill: var(--c-bad); --m-track: var(--c-bad-tint); }

/* ---- "Start here": three numbered steps, each with its own button --------------------------- */
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-5); }
.step { display: flex; align-items: flex-start; gap: var(--s-4); }
.step-num { display: grid; place-items: center; flex-shrink: 0; width: 36px; height: 36px; color: var(--c-brand-text); background: var(--c-brand-tint); border: 1px solid var(--c-brand-tint-border); border-radius: 50%; font-weight: var(--fw-semibold); }
.step[data-done="true"] .step-num { color: var(--c-ok-text); background: var(--c-ok-tint); border-color: var(--c-ok-border); }
.step-text { flex: 1; min-width: 0; }
main .step-title { margin: 0 0 2px; font-size: var(--fs-md); }
.step-body { margin: 0 0 var(--s-3); color: var(--c-muted); }

/* ---- A charger's connection details: what is typed into the charger, one value per row -------
   Label, the value in mono (always left-to-right, selectable in one click), and a copy button. */
.conn-list { margin-block: var(--s-3); background: var(--c-surface-2); border: 1px solid var(--c-border); border-radius: var(--r-md); }
.conn-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-4); padding: var(--s-3) var(--s-4); border-block-end: 1px solid var(--c-border); }
.conn-row:last-child { border-block-end: 0; }
.conn-label { flex: 0 0 10rem; color: var(--c-muted); font-size: var(--fs-sm); }
.card .card-body code.conn-value, code.conn-value { flex: 1 1 14rem; min-width: 0; padding: 0; color: var(--c-text); background: none; font-size: var(--fs-md); overflow-wrap: anywhere; text-align: start; }
[dir="rtl"] code.conn-value { text-align: right; }
.user-select-all { user-select: all; }
@media (max-width: 575.98px) { .conn-label { flex-basis: 100%; } }
