/* Package limits page (/account/limits), after the dashboard-design rules: wordless (explanations live in tooltips), the problem is the
   most salient mark, healthy data is calm teal and grey, intensity grows toward the problem. Colours are the app's own tokens
   (brand teal for data, shared warning/danger for flags); state is always a word or a symbol as well as a colour. */
html[data-ui="v2"] .fx-page--limits{
  --lim-ok:#0FA3A0; --lim-warn:var(--fx-warning-dot); --lim-high:var(--fx-danger-dot); --lim-track:var(--fx-surface-sunken);
  --lim-t0:#DDF3F2; --lim-t1:#74CFCC; --lim-t2:#0B8784; --lim-zero:var(--fx-surface-sunken);
}
html[data-ui="v2"].dark .fx-page--limits{--lim-ok:#2FB5B2; --lim-t0:#0C3C3B; --lim-t1:#0B706E; --lim-t2:#2FB5B2}
.fx-page--limits > .fx-card{margin-block-end:var(--fx-space-4)}
.fx-page--limits .fx-card > h2,.fx-lim-head h2{margin-block:0 var(--fx-space-3);display:flex;align-items:center;gap:var(--fx-space-2)}

/* tooltip anchor: a small "i" */
.fx-lim-info{display:inline-grid;place-items:center;inline-size:18px;block-size:18px;border:1px solid var(--fx-border-strong);border-radius:50%;font:600 11px/1 var(--fx-font-sans,inherit);color:var(--fx-text-muted);cursor:help;vertical-align:middle}
.fx-lim-info:hover,.fx-lim-info:focus-visible{color:var(--fx-text);border-color:var(--fx-text-muted);outline:none}
[data-tip]:focus-visible{outline:2px solid var(--lim-ok);outline-offset:2px;border-radius:6px}

/* KPI strip: one card, tiles divided by hairlines */
.fx-lim-kpis{display:grid;grid-template-columns:repeat(4,1fr);padding:0;overflow:hidden}
.fx-lim-kpi{display:grid;gap:4px;align-content:start;padding:var(--fx-space-4) var(--fx-space-5);border-inline-end:1px solid var(--fx-border);min-inline-size:0}
.fx-lim-kpi:last-child{border-inline-end:0}
.fx-lim-kpi__label{color:var(--fx-text-muted);font-size:var(--fx-text-sm,.875rem)}
.fx-lim-kpi__value{font-size:1.9rem;font-weight:600;letter-spacing:-.03em;font-variant-numeric:tabular-nums;line-height:1.15;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.fx-lim-kpi__value small{font-size:.55em;font-weight:500;color:var(--fx-text-muted);letter-spacing:0}
.fx-lim-kpi__base{color:var(--fx-text-muted);font-size:var(--fx-text-sm,.8125rem);font-variant-numeric:tabular-nums;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.fx-lim-kpi--warn .fx-lim-kpi__value{color:var(--fx-warning)}
.fx-lim-kpi--warn .fx-lim-kpi__base{color:var(--fx-warning);font-weight:600}
.fx-lim-kpi--ok .fx-lim-kpi__base{color:var(--lim-ok);font-weight:600}
.fx-lim-kpi__track{display:block;block-size:6px;border-radius:3px;background:var(--lim-track);overflow:hidden;margin-block-start:6px}
.fx-lim-kpi__track span{display:block;block-size:100%;inline-size:calc(var(--fx-pct) * 1%);background:var(--fx-text-muted);opacity:.55;border-radius:3px}

/* ranked bullet rows: problems first */
.fx-lim-list{list-style:none;margin:0;padding:0;display:grid}
.fx-lim-row{padding-block:var(--fx-space-3);border-block-start:1px solid var(--fx-border)}
.fx-lim-row:first-child{border-block-start:0;padding-block-start:0}
.fx-lim-row__head{display:flex;flex-wrap:wrap;align-items:center;gap:var(--fx-space-2) var(--fx-space-3);margin-block-end:var(--fx-space-2)}
.fx-lim-row__name{font-weight:500}
.fx-lim-row__num{margin-inline-start:auto;font-variant-numeric:tabular-nums;white-space:nowrap}
.fx-lim-row__num strong{font-size:1.1em;font-weight:600}
/* «اطلب زيادة»: a quiet link beside the value; a button on a row with a problem; the form opens inline under the row head */
.fx-lim-req{display:inline-block}
.fx-lim-req:has(details[open]){flex-basis:100%}
.fx-lim-req summary{cursor:pointer;color:var(--fx-text-muted);font-size:var(--fx-text-sm,.8125rem);list-style:none;white-space:nowrap}
.fx-lim-req summary::-webkit-details-marker{display:none}
.fx-lim-req summary::before{content:"+ ";font-weight:700}
.fx-lim-req summary:hover{color:var(--fx-text)}
.fx-lim-req.is-urgent summary{color:var(--fx-text);font-weight:600;padding:3px 12px;border:1px solid var(--fx-border-strong);border-radius:999px;background:var(--fx-surface)}
.fx-lim-req.is-urgent summary:hover{border-color:var(--fx-text-muted)}
.fx-lim-flag{display:inline-flex;align-items:center;gap:4px;padding:1px 8px;border-radius:999px;background:var(--fx-warning-bg);color:var(--fx-warning);font-size:var(--fx-text-sm,.8125rem);font-weight:600;font-variant-numeric:tabular-nums;cursor:help}

.fx-lim-chip{display:inline-flex;align-items:center;gap:6px;padding:2px 10px;border-radius:999px;font-size:var(--fx-text-sm,.8125rem);font-weight:500;background:var(--lim-track);color:var(--fx-text-muted)}
.fx-lim-chip__dot{inline-size:8px;block-size:8px;border-radius:50%;background:var(--fx-text-muted)}
.fx-lim-chip--ok .fx-lim-chip__dot{background:var(--lim-ok)}
.fx-lim-chip--warn{background:var(--fx-warning-bg);color:var(--fx-warning);font-weight:600}
.fx-lim-chip--warn .fx-lim-chip__dot{background:var(--lim-warn)}
.fx-lim-chip--high,.fx-lim-chip--full{background:var(--fx-danger-bg);color:var(--fx-danger);font-weight:600}
.fx-lim-chip--high .fx-lim-chip__dot,.fx-lim-chip--full .fx-lim-chip__dot{background:var(--lim-high)}
.fx-lim-chip--full .fx-lim-chip__dot{border-radius:2px}

/* bullet bar: actual (solid), projected to month end (striped), the pace tick (where you would be today) */
.fx-lim-bar{position:relative;block-size:10px;border-radius:5px;background:var(--lim-track)}
.fx-lim-bar__fill,.fx-lim-bar__proj{position:absolute;inset-block:0;inset-inline-start:0;border-radius:5px;inline-size:calc(var(--fx-pct) * 1%)}
.fx-lim-bar__fill{background:var(--lim-ok);transition:inline-size var(--fx-dur-slow,.4s) var(--fx-ease-out,ease-out)}
.fx-lim-bar__proj{background:repeating-linear-gradient(135deg,color-mix(in srgb,var(--lim-ok) 45%,transparent) 0 4px,transparent 4px 8px)}
.fx-lim-bar__proj.is-over{background:repeating-linear-gradient(135deg,color-mix(in srgb,var(--lim-high) 70%,transparent) 0 4px,transparent 4px 8px)}
.fx-lim-row--warn .fx-lim-bar__fill{background:var(--lim-warn)}
.fx-lim-row--high .fx-lim-bar__fill,.fx-lim-row--full .fx-lim-bar__fill{background:var(--lim-high)}
.fx-lim-bar__pace{position:absolute;inset-block:-4px;inset-inline-start:calc(var(--fx-pct) * 1%);inline-size:2px;margin-inline-start:-1px;background:var(--fx-text);opacity:.5;border-radius:1px}

/* history heatmap: counters x 12 months, tiers of the share of today's limit */
.fx-lim-head{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:var(--fx-space-2) var(--fx-space-4)}
.fx-lim-legend{list-style:none;margin:0;padding:0;display:flex;flex-wrap:wrap;gap:var(--fx-space-3);color:var(--fx-text-muted);font-size:var(--fx-text-sm,.8125rem)}
.fx-lim-legend li{display:flex;align-items:center;gap:6px}
.fx-lim-heat{display:grid;gap:5px;overflow-x:auto;padding:4px}
.fx-lim-heat__row{display:grid;grid-template-columns:minmax(130px,1.4fr) repeat(12,minmax(22px,1fr));gap:5px;align-items:center}
.fx-lim-heat__name{font-size:var(--fx-text-sm,.875rem);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.fx-lim-heat__month{text-align:center;color:var(--fx-text-muted);font-size:11px;font-variant-numeric:tabular-nums}
.fx-lim-heat__month.is-current{color:var(--lim-ok);font-weight:700}
.fx-lim-heat__month.is-current::after{content:"";display:block;inline-size:5px;block-size:5px;margin:2px auto 0;border-radius:50%;background:var(--lim-ok)}
.fx-lim-cell{display:grid;place-items:center;block-size:28px;border-radius:8px;font-size:11px;font-weight:700;background:var(--lim-zero);color:#fff;cursor:default}
.fx-lim-legend .fx-lim-cell{inline-size:18px;block-size:18px;border-radius:5px}
.fx-lim-cell--t0{background:var(--lim-t0)}
.fx-lim-cell--t1{background:var(--lim-t1)}
.fx-lim-cell--t2{background:var(--lim-t2)}
.fx-lim-cell--t3{background:var(--lim-high)}
.fx-lim-cell--unl{background:var(--lim-zero)}
.fx-lim-cell--none{background:transparent;border:1px dashed var(--fx-border-strong)}
.fx-lim-cell.is-current{box-shadow:0 0 0 2px var(--fx-surface),0 0 0 3px var(--lim-ok)}
.fx-lim-cell:hover,.fx-lim-cell:focus-visible{filter:brightness(1.12)}

.fx-lim-two{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:var(--fx-space-4);margin-block-end:var(--fx-space-4)}
.fx-lim-two > .fx-card{margin:0}
.fx-lim-list--compact .fx-lim-row{padding-block:var(--fx-space-2)}
.fx-lim-features{list-style:none;margin:0;padding:0;display:flex;flex-wrap:wrap;gap:var(--fx-space-2)}
.fx-lim-feature{display:inline-flex;align-items:center;gap:6px;padding:5px 12px;border:1px solid var(--fx-border);border-radius:999px;color:var(--fx-text-muted);font-size:var(--fx-text-sm,.875rem)}
.fx-lim-feature.is-on{color:var(--fx-text);border-color:color-mix(in srgb,var(--lim-ok) 55%,var(--fx-border))}
.fx-lim-feature__mark{font-weight:700}
.fx-lim-feature.is-on .fx-lim-feature__mark{color:var(--lim-ok)}
.fx-lim-table summary{cursor:pointer;font-weight:600}

@media (max-width:900px){.fx-lim-kpis{grid-template-columns:repeat(2,1fr)}.fx-lim-kpi:nth-child(2){border-inline-end:0}.fx-lim-kpi:nth-child(-n+2){border-block-end:1px solid var(--fx-border)}}
@media (max-width:760px){
  .fx-lim-two{grid-template-columns:1fr}
  /* a phone shows the last six months (the oldest six columns are hidden) so the current month is never off-screen */
  .fx-lim-heat__row{grid-template-columns:96px repeat(6,minmax(24px,1fr))}
  .fx-lim-heat__row > :nth-child(n+2):nth-child(-n+7){display:none}
}
@media (prefers-reduced-motion:reduce){.fx-lim-bar__fill{transition:none}}

/* a longer explanation (several words) wraps instead of running on one line */
.fx-act-tip.fx-act-tip--wrap{white-space:normal;inline-size:max-content;max-inline-size:min(300px,90vw);line-height:1.55;font-weight:500}
