Files
F-r-ldraledigplannerare/frontend/src/styles/components.css
T
jacobh2 d5f33e8c7f Tell parents how to save the days expiring at age 4
The dashboard stated the loss and stopped there. With Jacob at 48/48 savable
and 24 days over the cap, and Amelie at 3/48 with 45 days of headroom, those
24 days are not lost at all — transferring them before the 4th birthday saves
every one. The app never said so.

`_rule_age4_pooling_loss` already computed exactly that advice, bounded by the
FK-reported `transferable_days_left`, in finished Swedish and English. It never
ran: `age4_pooling_tip_min_child_age_years` held it back until the child turned
2. The calendar IS the plan, so gate on the plan instead — the noise case is a
newborn with nothing planned, not a young child whose parents have planned in
detail. `age4_pooling_tip_min_planned_days` (20) replaces the age gate.

Both variants drop to `info`. A projection four years out should not read as a
verdict on the user's planning; the hero carries the alarm, this card carries
the advice. The copy now leads with "plans change, this is only a projection"
and closes by pointing at keeping balances up to date, since parents will come
back and record what they actually took.

- Suppress `preserve_for_age_4` whenever `age4_pooling_loss` fires for the same
  child. The pooling tip states the same loss plus the remedy and the correct
  per-parent cap, so emitting both gave two contradictory "you're losing N
  days" figures.
- `preserve_for_age_4` now sends `parent_cap` and its copy interpolates it. It
  claimed "only 96 days can be saved" — false for a two-parent family, where
  the cap is 48 each, as the Age4Bars card two rows below already showed.
- The hero grows a "How to save them" line derived from the tip itself, so the
  two can never disagree on the number. Dismissing the tip retires both.
- "Försäkringskassan" in that line links to FK's BankID login carrying a `goto`
  to Min föräldrapenning — the e-service showing "Dagar ni kan föra över" —
  so the transfer is one click away. `translate()` returns a plain string and
  word order differs between locales, so the anchor's position travels inside
  the template as `{fk}` and the rendered string is split around it.

Verified in the browser: hero, link target, tip severity and the absence of
`preserve_for_age_4`, in both languages and at 390px. Note the demo seed cannot
reach this shape — it gives the surplus parent no FK snapshot at all.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DXPBfr1v7F71t6QcbHCaaT
2026-09-20 09:51:10 +02:00

707 lines
13 KiB
CSS

/* Dashboard (Översikt)
* ------------------------------------------------------------------------
* Pure typography and whitespace: the hero is a headline, the key figures
* are three numerals, and the only hairlines on the page sit between the
* year rows. Nothing here is a tile or a card. */
/* Hero — the headline. Its framing (motivate / warning / reassure) is a
* short coloured rule above the text, never a tinted box. */
.dashboard-hero {
margin-bottom: var(--sp-4);
}
.dashboard-hero::before {
content: '';
display: block;
width: var(--sp-6);
height: 4px;
margin-bottom: var(--sp-4);
border-radius: var(--radius-sm);
background-color: var(--c-accent);
}
.dashboard-hero--warning::before {
background-color: var(--c-danger);
}
.dashboard-hero--reassure::before {
background-color: var(--c-success);
}
.dashboard-hero__message {
margin: 0;
max-width: 24ch;
font-size: var(--fs-2xl);
font-weight: 600;
line-height: var(--lh-tight);
letter-spacing: -0.02em;
color: var(--c-text);
}
.dashboard-hero__remedy {
margin: var(--sp-2) 0 0;
max-width: 72ch;
font-size: var(--fs-sm);
color: var(--c-text-muted);
}
.dashboard-hero__remedy-label {
font-weight: 500;
color: var(--c-text);
}
/* One muted line under the hero while the figures still rest on the
* statutory assumption for at least one parent. The lead word (the e2e
* hook) is the only emphasised part. */
.dashboard__estimate {
margin: 0 0 var(--sp-5);
max-width: 64ch;
font-size: var(--fs-sm);
color: var(--c-text-muted);
}
.dashboard__estimate-badge {
font-weight: 500;
color: var(--c-warning);
}
/* Key figures — three tabular numerals, 14px labels, no tiles. */
.key-figures {
display: flex;
flex-wrap: wrap;
gap: var(--sp-4) var(--sp-7);
margin: var(--sp-6) 0 var(--sp-7);
}
.key-figures__item {
display: flex;
flex-direction: column-reverse;
gap: var(--sp-1);
}
.key-figures__value {
margin: 0;
font-size: var(--fs-2xl);
font-weight: 600;
line-height: 1;
letter-spacing: -0.02em;
font-variant-numeric: tabular-nums;
color: var(--c-text);
}
.key-figures__value--danger {
color: var(--c-danger);
}
.key-figures__label {
font-size: var(--fs-sm);
color: var(--c-text-muted);
}
/* Age4 bars — 6px meters, one per parent: the fill is the accent, the
* unfilled track a lighter step of the same hue. */
.age4-bars {
display: flex;
flex-direction: column;
gap: var(--sp-3);
margin-bottom: var(--sp-6);
}
.age4-bars__title {
margin: 0;
font-size: var(--fs-sm);
font-weight: 500;
color: var(--c-text-muted);
}
.age4-bars__row {
display: grid;
grid-template-columns: minmax(0, 1fr) auto;
align-items: baseline;
column-gap: var(--sp-3);
row-gap: var(--sp-1);
}
.age4-bars__label {
order: 1;
font-size: var(--fs-sm);
font-weight: 500;
}
.age4-bars__stats {
order: 2;
display: flex;
flex-wrap: wrap;
justify-content: flex-end;
gap: var(--sp-3);
font-size: var(--fs-sm);
font-variant-numeric: tabular-nums;
color: var(--c-text-muted);
}
.age4-bars__expiring {
font-weight: 500;
color: var(--c-danger);
}
.age4-bars__track {
order: 3;
grid-column: 1 / -1;
height: 6px;
border-radius: var(--radius-full);
background-color: var(--c-accent-weak);
overflow: hidden;
}
.age4-bars__fill {
height: 100%;
border-radius: var(--radius-full);
background-color: var(--c-accent);
transition: width 0.3s ease;
}
/* Year rows — one native <details> per calendar year: the year, a thin
* per-parent timeline of planned leave, and each parent's end-of-year
* figures. Hairlines between rows come from `.disclosure`. */
.year-rows {
display: flex;
flex-direction: column;
}
/* The section after the rows opens with its own hairline. */
.year-rows > .disclosure:last-child {
border-bottom: none;
}
.year-rows__legend {
display: flex;
flex-wrap: wrap;
gap: var(--sp-4);
margin: 0 0 var(--sp-2);
padding: 0;
list-style: none;
font-size: var(--fs-sm);
color: var(--c-text-muted);
}
.year-rows__legend-item {
display: flex;
align-items: center;
gap: var(--sp-2);
margin: 0;
}
.year-rows__swatch {
display: inline-block;
width: 14px;
height: 8px;
border-radius: 2px;
flex-shrink: 0;
}
.year-rows__swatch--vacation,
.year-row__band--vacation {
background-color: var(--c-leave-vacation-bar);
}
.year-rows__swatch--sjukpenning,
.year-row__band--sjukpenning {
background-color: var(--c-leave-sjukpenning);
}
/* Lägsta is a white fill told apart by a 1px dark outline and a hatch, not
* a hue (see the --c-leave-* tokens). */
.year-rows__swatch--lagsta,
.year-row__band--lagsta {
background-color: var(--c-leave-lagsta);
background-image: repeating-linear-gradient(
135deg,
transparent 0 3px,
var(--c-leave-lagsta-hatch) 3px 4px
);
box-shadow: inset 0 0 0 1px var(--c-leave-lagsta-outline);
}
.year-row__summary {
display: grid;
grid-template-columns: 3.5rem minmax(0, 1fr) auto var(--icon-sm);
align-items: center;
column-gap: var(--sp-4);
row-gap: var(--sp-2);
padding: var(--sp-3) 0;
font-weight: 400;
}
.year-row__summary:hover {
background-color: var(--c-row-hover);
}
.year-row__summary::after {
grid-row: 1;
grid-column: 4;
}
.year-row__year {
grid-row: 1;
grid-column: 1;
font-size: var(--fs-base);
font-weight: 500;
color: var(--c-text);
}
.year-row__track {
grid-row: 1;
grid-column: 2;
display: flex;
flex-direction: column;
gap: 2px;
min-width: 0;
}
.year-row__lane {
position: relative;
height: 8px;
border-radius: 2px;
background-color: var(--c-band-gap);
}
/* In a couple the lanes run in the same order as the figures beside them
* (you first), and every band names its parent on hover — a cap mark at
* the start of a lane read as a band on 1 January, so there is none. */
.year-row__band {
position: absolute;
top: 0;
height: 100%;
min-width: 3px;
border-radius: 2px;
transition: opacity 0.15s;
}
.year-row__band:hover {
opacity: 0.8;
}
.year-row__band:focus-visible {
outline: 2px solid var(--c-accent);
outline-offset: 2px;
}
/* Per-parent figures: name · FP kvar N · Semester kvar N · sparas N. Laid
* out as one grid across parents so the columns line up. */
.year-row__figures {
grid-row: 1;
grid-column: 3;
display: grid;
grid-template-columns: auto auto auto;
align-items: baseline;
column-gap: var(--sp-4);
row-gap: 2px;
font-size: var(--fs-sm);
white-space: nowrap;
}
.year-row__parent {
display: contents;
}
.year-row__name {
color: var(--c-text-muted);
}
.year-row__figure-label {
color: var(--c-text-muted);
}
.year-row__figure-value {
font-weight: 500;
color: var(--c-text);
}
.year-row__figure-sub {
color: var(--c-text-muted);
}
.year-row__figure-danger {
font-weight: 500;
color: var(--c-danger);
}
.year-row__body {
padding: var(--sp-2) 0 var(--sp-5) 3.5rem;
}
.year-row__table {
width: auto;
margin-bottom: var(--sp-4);
font-size: var(--fs-sm);
}
.year-row__table th,
.year-row__table td {
padding: var(--sp-1) 0 var(--sp-1) var(--sp-5);
border-bottom: none;
}
.year-row__table th:first-child,
.year-row__table td:first-child {
padding-left: 0;
}
.year-row__table thead th {
padding-bottom: var(--sp-2);
font-weight: 500;
color: var(--c-text);
}
.year-row__table tr:hover td {
background-color: transparent;
}
.year-row__group th {
padding-top: var(--sp-3);
font-weight: 500;
color: var(--c-text);
}
.year-row__cell-label {
font-weight: 400;
color: var(--c-text-muted);
}
.year-row__cell--num {
text-align: right;
}
.year-row__cell--danger {
color: var(--c-danger);
}
.year-row__row--emphasis td {
font-weight: 500;
}
.year-row__badge {
margin-right: var(--sp-2);
}
.year-row__wishes-title {
margin: 0 0 var(--sp-2);
font-size: var(--fs-sm);
font-weight: 500;
color: var(--c-text);
}
.year-row__wish-list,
.year-row__remedies {
margin: 0;
padding: 0;
list-style: none;
font-size: var(--fs-sm);
}
.year-row__wish {
display: flex;
flex-wrap: wrap;
align-items: baseline;
column-gap: var(--sp-3);
margin: 0 0 var(--sp-1);
}
.year-row__wish-name {
font-weight: 500;
}
.year-row__wish-weeks {
color: var(--c-text-muted);
}
.year-row__wish-weeks--short,
.year-row__shortfall {
color: var(--c-danger);
}
.year-row__remedies {
flex-basis: 100%;
padding-left: var(--sp-4);
color: var(--c-text-muted);
}
.year-row__remedies li {
margin: 0;
}
/* Tips — a plain list. Severity is a small dot before the title; the
* dismiss is a bare glyph button. */
.dashboard__tips-list {
display: flex;
flex-direction: column;
gap: var(--sp-4);
}
.tip-card {
padding: 0 0 0 var(--sp-5);
position: relative;
}
.tip-card::before {
content: '';
position: absolute;
left: 0;
top: 8px;
width: 8px;
height: 8px;
border-radius: var(--radius-full);
background-color: var(--c-text-faint);
}
.tip-card--warning::before {
background-color: var(--c-warning);
}
.tip-card--action::before {
background-color: var(--c-accent);
}
.tip-card__header {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: var(--sp-3);
}
.tip-card__title {
margin: 0;
font-size: var(--fs-base);
font-weight: 500;
color: var(--c-text);
}
.tip-card__dismiss {
flex-shrink: 0;
width: var(--icon-lg);
height: var(--icon-lg);
border-radius: var(--radius-sm);
font-size: var(--fs-lg);
line-height: 1;
}
.tip-card__body {
margin: var(--sp-1) 0 0;
max-width: 72ch;
font-size: var(--fs-sm);
color: var(--c-text-muted);
}
/* "Detaljer" — one disclosure row at the foot of the page. */
.dashboard__details {
margin-top: var(--sp-6);
}
.dashboard__details-body {
display: flex;
flex-direction: column;
gap: var(--sp-5);
align-items: flex-start;
}
/* Overview metrics — an unboxed label/value list. */
.overview-metrics {
width: 100%;
}
.overview-metrics__title {
margin: 0 0 var(--sp-2);
font-size: var(--fs-sm);
font-weight: 500;
color: var(--c-text-muted);
}
.overview-metrics__list {
display: grid;
grid-template-columns: minmax(0, 1fr) auto;
column-gap: var(--sp-4);
row-gap: var(--sp-1);
max-width: 56ch;
font-size: var(--fs-sm);
}
.overview-metrics__item {
display: contents;
}
.overview-metrics__label {
color: var(--c-text-muted);
}
.overview-metrics__value {
text-align: right;
font-variant-numeric: tabular-nums;
font-weight: 500;
color: var(--c-text);
}
.overview-metrics__item--summary .overview-metrics__label,
.overview-metrics__item--summary .overview-metrics__value {
padding-top: var(--sp-1);
font-weight: 600;
color: var(--c-text);
}
/* Parental-leave snapshot — one numeric column per parent. */
.parental-leave-breakdown {
display: flex;
flex-direction: column;
gap: var(--sp-3);
width: 100%;
}
.parental-leave-breakdown__empty {
margin: 0;
font-size: var(--fs-sm);
color: var(--c-text-muted);
}
.parental-leave-breakdown__table {
width: auto;
font-size: var(--fs-sm);
}
.parental-leave-breakdown__table th,
.parental-leave-breakdown__table td {
padding: var(--sp-1) 0 var(--sp-1) var(--sp-5);
border-bottom: none;
}
.parental-leave-breakdown__table th:first-child,
.parental-leave-breakdown__table td:first-child {
padding-left: 0;
}
.parental-leave-breakdown__table tbody th {
font-weight: 400;
color: var(--c-text-muted);
}
.parental-leave-breakdown__table thead th {
font-weight: 500;
color: var(--c-text);
}
.parental-leave-breakdown__table tr:hover td {
background-color: transparent;
}
.parental-leave-breakdown__num {
text-align: right;
font-weight: 500;
color: var(--c-text);
}
.parental-leave-breakdown__provenance {
margin: 0;
padding: 0;
list-style: none;
font-size: var(--fs-sm);
color: var(--c-text-muted);
}
.parental-leave-breakdown__provenance li {
margin: 0;
}
.parental-leave-breakdown__provenance-name {
font-weight: 500;
color: var(--c-text);
}
.parental-leave-breakdown__badge {
margin-right: var(--sp-1);
}
.parental-leave-breakdown__reserved-note {
margin: 0;
max-width: 64ch;
font-size: var(--fs-sm);
color: var(--c-text-muted);
}
/* Form styles */
.form-group {
margin-bottom: var(--sp-5);
}
.form-group label {
display: block;
margin-bottom: var(--sp-2);
font-weight: 500;
color: var(--c-text);
font-size: var(--fs-base);
}
.form-group input,
.form-group select,
.form-group textarea {
width: 100%;
max-width: 400px;
}
.form-group textarea {
resize: vertical;
min-height: 100px;
}
.settings-page > .alert {
margin-bottom: var(--sp-4);
}
/* Fieldsets */
fieldset {
border: 1px solid var(--c-border);
border-radius: var(--radius);
padding: var(--sp-4);
margin-bottom: var(--sp-5);
}
legend {
font-weight: 600;
color: var(--c-text);
padding: 0 var(--sp-2);
margin-left: calc(var(--sp-2) * -1);
}
/* Input Components
*
* `ChildBirthdayInput` now builds its fields from `.field`/`.field__label`/
* `.field__control` (primitives.css) directly rather than its own
* `.child-birthday-input__*` set — that set is gone from here accordingly. */
.vacation-days-input,
.planning-goal-selector,
.parent-profile-input {
margin-bottom: var(--sp-5);
}
.vacation-days-input__label,
.planning-goal-selector__label,
.parent-profile-input__label {
display: block;
margin-bottom: var(--sp-2);
font-weight: 500;
color: var(--c-text);
font-size: var(--fs-base);
}
.vacation-days-input__field,
.planning-goal-selector__select,
.parent-profile-input__field {
width: 100%;
max-width: 400px;
}
.vacation-days-input__range,
.parent-profile-input__help {
font-size: var(--fs-sm);
color: var(--c-text-muted);
margin-top: var(--sp-2);
}