/*
 * The new building blocks of the templates band (bausteine.mjs, owner 2026-10-26).
 * Page CSS of draft V4, like entwurf.css: colours from the system's tokens and the
 * page's chart variables (--e-c1 …), sizes in the page's own px.
 */

/* Section head: the headline in one line where there is room (owner, 2026-10-26). */
@media (min-width: 1100px) {
  #templates .e-section__head--row > div:first-child { max-width: none; }
  #templates .e-h2 { white-space: nowrap; }
}

/* --- Rows with an icon circle: transactions, holdings ------------------------- */
.e-tx { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; }
.e-tx li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--e-outline); }
.e-tx li:last-child { border-bottom: 0; }
.e-tx__ic { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--e-quiet-track); color: var(--sw-color-text-secondary); }
.e-tx__ic .sw-icon { width: 18px; height: 18px; }
.e-tx__who { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.e-tx__who strong { font-size: 14px; font-weight: var(--sw-font-weight-semibold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.e-tx__who small { font-size: 12px; color: var(--e-muted); }
.e-tx__amt { font-size: 14px; font-weight: var(--sw-font-weight-semibold); white-space: nowrap; }
:is(.e-tx__amt, .e-depot__chg)[data-in] { color: var(--sw-color-status-success-text); }

/* --- Loan calculator ------------------------------------------------------------ */
.e-loan { display: flex; flex-direction: column; gap: 16px; }
.e-loan__out { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border-radius: 14px; background: var(--e-quiet-track); }
.e-loan__label { font-size: 13px; color: var(--e-muted); }
.e-loan__rate { font-size: 36px; line-height: 1.1; font-weight: var(--sw-font-weight-bold); letter-spacing: -0.035em; }
.e-loan__sub { font-size: 12px; color: var(--e-muted); }
.e-loan__term { display: flex; flex-direction: column; gap: 0; }
/* The marks sit under the thumb's centre, from the slider's own measures (slider.css): the
   track is inset by half a target on each side, its line runs through the middle of a
   target-high row, the thumb is space-25 across. So skin, density and size move them along. */
.e-loan__marks {
  position: relative; height: 14px; font-size: 11px; color: var(--e-muted); font-variant-numeric: tabular-nums;
  margin-inline: calc(var(--sw-target) / 2);
  margin-block-start: calc(var(--sw-space-25) / 2 + 4px - var(--sw-target) / 2);
}
.e-loan__marks span { position: absolute; top: 0; translate: -50% 0; white-space: nowrap; }
[dir="rtl"] .e-loan__marks span { translate: 50% 0; }
.e-loan__marks [data-on] { color: var(--sw-color-text-primary); font-weight: var(--sw-font-weight-semibold); }
.e-loan__split { display: flex; flex-direction: column; gap: 8px; }
.e-loan__bar { display: flex; gap: 3px; height: 10px; }
.e-loan__bar i { min-width: 6px; border-radius: 999px; background: var(--e-c1); transition: flex-grow 0.2s ease-out; }
.e-loan__bar i + i { background: var(--e-c2); }
.e-loan__legend { justify-content: space-between; }
.e-loan__legend li { gap: 6px; }
.e-loan__legend b { margin-inline-start: 2px; color: var(--sw-color-text-primary); }

/* --- Transfer --------------------------------------------------------------------- */
.e-xfer__amount .sw-field__input { font-size: 22px; font-weight: var(--sw-font-weight-semibold); letter-spacing: -0.01em; }
/* Two facts in one row, so the card keeps its button above the fade in every density and size. */
.e-facts { display: flex; justify-content: space-between; gap: 12px; margin: 0 0 6px; font-size: 13px; }
.e-facts div { display: flex; gap: 6px; }
.e-facts dt { color: var(--e-muted); }
.e-facts dd { margin: 0; font-weight: var(--sw-font-weight-semibold); font-variant-numeric: tabular-nums; }

/* --- Spending by category: the accent in five steps, the legend says it in words --- */
.e-big.e-spend__total { margin: 14px 0 6px; font-size: 34px; letter-spacing: -0.035em; }
.e-spend__note { display: flex; align-items: center; gap: 8px; margin: 0 0 18px; font-size: 13px; color: var(--e-muted); }
.e-spend__bar { display: flex; gap: 3px; height: 14px; margin-bottom: 20px; }
.e-spend__bar i { min-width: 6px; border-radius: 4px; }
.e-spend__legend { gap: 10px; font-size: 14px; }
.e-spend i[data-i="0"] { background: var(--e-c1); }
/* The lightest step stays visible on the card in dark and in more contrast (variant check, 2026-10-26). */
.e-spend { --e-k1: 76%; --e-k2: 56%; --e-k3: 40%; --e-k4: 28%; }
[data-sw-contrast="more"] .e-spend { --e-k1: 82%; --e-k2: 66%; --e-k3: 52%; --e-k4: 40%; }
.e-spend i[data-i="1"] { background: color-mix(in srgb, var(--e-c1) var(--e-k1), var(--sw-color-surface-raised)); }
.e-spend i[data-i="2"] { background: color-mix(in srgb, var(--e-c1) var(--e-k2), var(--sw-color-surface-raised)); }
.e-spend i[data-i="3"] { background: color-mix(in srgb, var(--e-c1) var(--e-k3), var(--sw-color-surface-raised)); }
.e-spend i[data-i="4"] { background: color-mix(in srgb, var(--e-c1) var(--e-k4), var(--sw-color-surface-raised)); }
@supports not (color: color-mix(in srgb, red, red)) { 
  .e-spend i[data-i="1"] { background: var(--sw-color-accent-border); }
  .e-spend i[data-i="2"] { background: var(--sw-color-accent-muted); }
  .e-spend i[data-i="3"] { background: var(--sw-color-accent-subtle); }
  .e-spend i[data-i="4"] { background: var(--sw-color-border-default); }
 }

/* --- Savings goal ------------------------------------------------------------------ */
.e-goal { display: flex; flex-direction: column; align-items: center; gap: 18px; padding-top: 6px; text-align: center; }
.e-goal__ring { position: relative; width: 196px; height: 196px; }
.e-goal__ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
/* Right to left the ring fills the other way round. */
[dir="rtl"] .e-goal__ring svg { transform: rotate(-90deg) scaleY(-1); }
.e-goal__track { fill: none; stroke: var(--e-quiet-track); stroke-width: 3.4; }
.e-goal__arc { fill: none; stroke: var(--e-c1); stroke-width: 3.4; stroke-linecap: round; }
.e-goal__c { position: absolute; inset: 0; display: grid; place-content: center; gap: 2px; }
.e-goal__c b { font-size: 30px; line-height: 1.1; font-weight: var(--sw-font-weight-bold); letter-spacing: -0.035em; }
.e-goal__c small { font-size: 12px; color: var(--e-muted); }
.e-goal__text { display: flex; flex-direction: column; gap: 2px; }
.e-goal__text strong { font-size: 17px; font-weight: var(--sw-font-weight-semibold); }
.e-goal__text .sw-text { margin: 0; }
.e-goal__row { align-self: stretch; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--e-quiet-track); text-align: start; }
.e-goal__rate { display: flex; flex-direction: column; }
.e-goal__rate small { font-size: 12px; color: var(--e-muted); }
.e-goal__rate b { font-size: 15px; font-weight: var(--sw-font-weight-semibold); }

/* --- Portfolio ---------------------------------------------------------------------- */
.e-depot { display: flex; flex-direction: column; gap: 14px; }
.e-depot__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.e-big.e-depot__value { margin: 4px 0 0; font-size: 32px; letter-spacing: -0.035em; }
.e-depot__range { align-self: flex-start; }
.e-depot__chart { margin: 0; }
.e-depot__chart .e-spark { height: 96px; }
.e-depot__chart .e-spark__line { stroke-width: 2.25; }
/* Time runs left to right in every direction, like the page's other charts: the months follow the curve. */
.e-depot__chart figcaption { direction: ltr; display: flex; justify-content: space-between; margin-top: 6px; font-size: 11px; color: var(--e-muted); }
.e-depot__list { margin: 0; }
.e-depot__list li { padding: 8px 0; }
.e-depot__list .e-spark { width: 64px; height: 26px; flex: none; }
.e-depot__chg { min-width: 52px; text-align: end; font-size: 13px; font-weight: var(--sw-font-weight-semibold); }

/* --- Card: the brand's accent as the card, frosted when frozen ------------------------ */
.e-pay { display: flex; flex-direction: column; gap: 18px; }
/*
 * The card has two faces and turns between them (B-166): the card is the turning body,
 * each face carries the surface. A face clips itself, since a clipping body would
 * flatten the turn. With reduced motion the faces swap without the turn.
 */
.e-pay__card {
  position: relative; aspect-ratio: 1.586; border-radius: 16px; color: var(--sw-color-text-on-accent); cursor: pointer;
  transform-style: preserve-3d; transition: transform 0.6s var(--sw-motion-easing-standard);
  box-shadow: 0 14px 30px -14px color-mix(in srgb, var(--sw-color-accent-default) 80%, transparent);
}
.e-pay__card[data-back] { transform: rotateY(180deg); }
.e-pay__face {
  position: absolute; inset: 0; box-sizing: border-box; padding: 18px 20px; overflow: hidden; border-radius: inherit;
  display: flex; flex-direction: column; justify-content: space-between;
  -webkit-backface-visibility: hidden; backface-visibility: hidden;
  background:
    radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--sw-color-text-on-accent) 22%, transparent), transparent 55%),
    linear-gradient(135deg, var(--sw-color-accent-default), var(--sw-color-accent-pressed));
}
.e-pay__back { transform: rotateY(180deg); justify-content: flex-start; gap: 10px; padding-block-start: 0; }
@media (prefers-reduced-motion: reduce) {
  .e-pay__card { transition: none; }
}
:root[data-e-motion="still"] .e-pay__card { transition: none; }
.e-pay__stripe { display: block; flex: none; block-size: 34px; margin-block-start: 16px; margin-inline: -20px; background: color-mix(in srgb, var(--sw-color-text-on-accent) 82%, var(--sw-color-accent-pressed)); }
.e-pay__back .e-pay__num { font-size: 17px; letter-spacing: 0.06em; }
.e-pay__facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; margin: 0; font-size: 12px; }
.e-pay__facts dd { margin: 0; font-weight: var(--sw-font-weight-semibold); }
.e-pay__limit { inline-size: min(300px, calc(100vw - 32px)); }
.e-pay__limit-text { margin: var(--sw-space-2) 0 0; font-size: var(--sw-font-size-sm); color: var(--sw-color-text-secondary); }
.e-pay__limit-actions { display: flex; justify-content: flex-end; gap: var(--sw-space-2); margin-block-start: var(--sw-space-3); }
@supports not (color: color-mix(in srgb, red, red)) { 
  .e-pay__card { box-shadow: 0 14px 30px -14px rgb(0 0 0 / 0.35); }
  .e-pay__face { background: linear-gradient(135deg, var(--sw-color-accent-default), var(--sw-color-accent-pressed)); }
  .e-pay__stripe { background: var(--sw-color-text-on-accent); opacity: 0.85; }
 }
.e-pay__face::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(115deg, transparent 38%, color-mix(in srgb, var(--sw-color-text-on-accent) 12%, transparent) 50%, transparent 62%); }
.e-pay__top { display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: var(--sw-font-weight-semibold); letter-spacing: 0.02em; }
.e-pay__chip { width: 38px; height: 28px; border-radius: 6px; background: linear-gradient(135deg, color-mix(in srgb, currentColor 60%, transparent), color-mix(in srgb, currentColor 25%, transparent)); }
@supports not (color: color-mix(in srgb, red, red)) { .e-pay__chip { background: currentColor; opacity: 0.42; } }
.e-pay__num { font-family: var(--sw-font-family-mono); font-size: 20px; letter-spacing: 0.1em; }
.e-pay__foot { display: flex; justify-content: space-between; font-size: 13px; }
.e-pay__frost {
  /* Chromium does not clip a backdrop-filter to the parent's rounded overflow: the frost
     rounds itself, or its blurred square corners show outside the card (B-166). */
  position: absolute; inset: 0; z-index: 1; border-radius: inherit; display: grid; place-content: center; justify-items: center; gap: 6px;
  font-size: 14px; font-weight: var(--sw-font-weight-semibold); color: var(--sw-color-text-primary);
  background: color-mix(in srgb, var(--sw-color-surface-raised) 66%, transparent);
  -webkit-backdrop-filter: blur(6px) saturate(0.5); backdrop-filter: blur(6px) saturate(0.5);
}
@supports not (color: color-mix(in srgb, red, red)) { .e-pay__frost { background: var(--sw-color-surface-raised); } }
.e-pay__frost .sw-icon { width: 22px; height: 22px; }
.e-pay__actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.e-pay__act.sw-button { width: 100%; height: auto; min-height: 64px; padding: 10px 4px; flex-direction: column; gap: 6px; font-size: 13px; }
.e-pay__act .sw-button__label { display: flex; flex-direction: column; align-items: center; gap: 6px; }

/* --- Assistant ------------------------------------------------------------------------ */
.e-asst { display: flex; flex-direction: column; gap: 16px; height: 100%; box-sizing: border-box; padding-bottom: 22px; }
.e-asst__q { align-self: flex-end; max-width: 85%; padding: 10px 14px; border-radius: 16px 16px 4px 16px; background: var(--sw-color-accent-default); color: var(--sw-color-text-on-accent); font-size: 14px; }
.e-asst__steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; font-size: 13px; }
.e-asst__steps li { display: grid; grid-template-columns: 20px minmax(0, 1fr); align-items: center; gap: 8px 10px; color: var(--sw-color-text-secondary); }
.e-asst__steps .sw-progress-circle { --sw-progress-circle-size: 20px; width: 20px; }
.e-asst__found { grid-column: 2; display: flex; flex-wrap: wrap; gap: 6px; }
.e-asst__found .e-status { font-size: 12px; }
.e-asst__ok { width: 20px; height: 20px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--sw-color-status-success-surface); color: var(--sw-color-status-success-text); }
.e-asst__ok .sw-icon { width: 13px; height: 13px; }
.e-asst__steps li[data-state="run"] > span:last-child {
  background: linear-gradient(90deg, var(--sw-color-text-secondary) 0 35%, var(--sw-color-text-primary) 50%, var(--sw-color-text-secondary) 65% 100%);
  background-size: 260% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: e-shimmer 1.8s linear infinite;
}
@keyframes e-shimmer { from { background-position: 100% 0; } to { background-position: -160% 0; } }
[data-e-paused="true"] .e-asst__steps li > span:last-child { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) {
  .e-asst__steps li[data-state="run"] > span:last-child { animation: none; background: none; color: var(--sw-color-text-primary); }
}
.e-asst__box { margin-top: auto; padding: 4px 8px 8px; border: 1px solid var(--sw-color-border-default, var(--e-outline)); border-radius: 18px; background: var(--sw-color-surface-raised); box-shadow: 0 6px 18px -10px rgb(0 0 0 / 0.18); }
/* The composer is the frame; the TextArea inside it has none of its own. */
.e-asst__box .sw-field__box { border-color: transparent; box-shadow: none; background: transparent; }
.e-asst__box:focus-within { outline: 2px solid var(--sw-color-accent-default); outline-offset: 2px; }
.e-asst__bar { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.e-asst__chips { flex: 1; min-width: 0; display: flex; overflow: hidden; }
/* A suggestion stays on one line in every size; what does not fit ends in an ellipsis. */
.e-asst__chips .sw-button { max-width: 100%; white-space: nowrap; }
.e-asst__chips .sw-button__label { overflow: hidden; text-overflow: ellipsis; }

/* --- Calendar with quick picks ----------------------------------------------------------- */
.e-when { display: flex; flex-direction: column; gap: 12px; }
.e-when__quick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.e-when__quick .sw-toggle-button { width: 100%; }
/* An error is not faded out. In a month of six weeks it reaches into the stage's fade, by up to
   25px at Weit and LG; it still ends inside the stage (B-135, D-362). */
.e-slide__stage:has(.e-when__field[data-invalid]) { -webkit-mask-image: none; mask-image: none; }

/* --- Share access ---------------------------------------------------------------------------- */
.e-grant { margin-top: 16px; }
.e-grant__row { display: grid; grid-template-columns: minmax(0, 1fr) 118px; gap: 8px; align-items: end; }
.e-grant__link { display: flex; align-items: center; gap: 8px; padding: 4px 4px 4px 12px; border-radius: 12px; background: var(--e-quiet-track); }
.e-grant__url { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; font-family: var(--sw-font-family-mono); font-size: 13px; color: var(--sw-color-text-secondary); }
.e-grant__url > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.e-grant__url .sw-icon { flex: none; }
