/* DSF · componentes. Estados por atributos (aria-*, :disabled, data-state); variables nuevas con respaldo. Referencia: docs/componentes/. */

/* Tonos: --dsf-tone (pleno), --dsf-tone-surface (fondo), --dsf-tone-text (texto e icono, 4,5:1). */
.dsf-alert, .dsf-banner, .dsf-badge, .dsf-state, .dsf-empty, .dsf-error { --dsf-tone: var(--dsf-text-secondary); --dsf-tone-surface: var(--dsf-fill); --dsf-tone-text: var(--dsf-text-secondary); }
.dsf-progress { --dsf-tone: var(--dsf-accent); }
.dsf-alert--info, .dsf-banner--info, .dsf-toast--info, .dsf-badge--info, .dsf-state--loading { --dsf-tone: var(--dsf-info); --dsf-tone-surface: var(--dsf-info-surface); --dsf-tone-text: var(--dsf-info-text); }
.dsf-alert--success, .dsf-banner--success, .dsf-toast--success, .dsf-badge--ok, .dsf-badge--success, .dsf-progress--success { --dsf-tone: var(--dsf-success); --dsf-tone-surface: var(--dsf-success-surface); --dsf-tone-text: var(--dsf-success-text); }
.dsf-alert--warning, .dsf-banner--warning, .dsf-toast--warning, .dsf-badge--warning, .dsf-state--offline, .dsf-progress--warning { --dsf-tone: var(--dsf-warning); --dsf-tone-surface: var(--dsf-warning-surface); --dsf-tone-text: var(--dsf-warning-text); }
.dsf-alert--danger, .dsf-banner--danger, .dsf-toast--danger, .dsf-badge--danger, .dsf-error, .dsf-state--error, .dsf-state--blocked, .dsf-progress--danger { --dsf-tone: var(--dsf-danger); --dsf-tone-surface: var(--dsf-danger-surface); --dsf-tone-text: var(--dsf-danger-text); }

.dsf-link, .dsf-link--accent { border-radius: 2px; color: var(--dsf-link); text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 42%, transparent); text-underline-offset: .2em; transition: color var(--dsf-motion-fast), text-decoration-color var(--dsf-motion-fast); }
.dsf-link:hover { color: var(--dsf-link-hover); text-decoration-color: currentColor; }
.dsf-link:active { text-decoration-thickness: 2px; }
.dsf-link[aria-disabled="true"] { color: var(--dsf-text-tertiary); text-decoration: none; pointer-events: none; }

.dsf-list { margin: 0; padding: 0; list-style: none; }
.dsf-list > li { position: relative; padding-inline-start: var(--dsf-space-5); margin-block: var(--dsf-space-2); }
.dsf-list > li::before { content: ""; position: absolute; inset-inline-start: var(--dsf-space-1); top: .66em; width: 5px; height: 5px; border-radius: 50%; background: var(--dsf-text-tertiary); }
.dsf-list--check > li::before { width: 8px; height: 4px; top: .55em; border: solid var(--dsf-success); border-width: 0 0 2px 2px; border-radius: 0; background: transparent; transform: rotate(-45deg); }
.dsf-list--num { counter-reset: item; }
.dsf-list--num > li::before { counter-increment: item; content: counter(item); top: 0; width: auto; height: auto; background: none; color: var(--dsf-text-tertiary); font-size: var(--dsf-text-footnote); font-feature-settings: var(--dsf-font-feature-numeric); }

/* Insignia, etiqueta, tecla, avatar y separador. */
.dsf-badge { display: inline-flex; align-items: center; gap: var(--dsf-space-1); min-height: 24px; padding-inline: var(--dsf-space-2); border-radius: var(--dsf-radius-pill); outline: 1px solid transparent; outline-offset: -1px; background: var(--dsf-tone-surface); color: var(--dsf-tone-text); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--dsf-tone) 24%, transparent); font-size: var(--dsf-text-caption); font-weight: var(--dsf-weight-semibold); line-height: 1; letter-spacing: var(--dsf-tracking-caption); white-space: nowrap; }
.dsf-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.dsf-badge--mute { color: var(--dsf-text-secondary); }
.dsf-tag { display: inline-flex; align-items: center; gap: var(--dsf-space-1); max-width: 100%; min-height: 28px; padding-inline: var(--dsf-space-2); border: 1px solid var(--dsf-separator-strong); border-radius: var(--dsf-radius-xs); background: var(--dsf-surface); color: var(--dsf-text); font-size: var(--dsf-text-footnote); font-weight: var(--dsf-weight-medium); line-height: 1.2; overflow-wrap: anywhere; }
.dsf-tag:has(> .dsf-tag__remove) { padding-inline-end: 1px; }
.dsf-tag__remove { position: relative; display: inline-grid; place-items: center; flex: none; width: 24px; height: 24px; padding: 0; border: 0; border-radius: calc(var(--dsf-radius-xs) - 2px); background: none; color: var(--dsf-text-secondary); cursor: pointer; font: inherit; }
.dsf-tag__remove:hover { background: var(--dsf-fill); color: var(--dsf-text); }
.dsf-tag__remove:active { background: var(--dsf-fill-pressed); }
.dsf-tag__label { min-width: 0; }
.dsf-tag[aria-disabled="true"] { opacity: .48; }
.dsf-tag__remove:disabled { background: none; cursor: not-allowed; }
.dsf-kbd { display: inline-block; min-width: 1.5em; padding: 0 .375em; border: 1px solid var(--dsf-separator-strong); border-bottom-width: 2px; border-radius: var(--dsf-radius-xs); background: var(--dsf-surface); color: var(--dsf-text-secondary); font: var(--dsf-weight-medium) var(--dsf-text-caption)/1.5 var(--dsf-font-mono); text-align: center; white-space: nowrap; }
.dsf-kbd kbd { font: inherit; }
.dsf-kbd__sep { color: var(--dsf-text-tertiary); }
.dsf-avatar { display: inline-grid; place-items: center; flex: none; width: 2rem; aspect-ratio: 1; overflow: hidden; border-radius: var(--dsf-radius-pill); outline: 1px solid transparent; outline-offset: -1px; background: var(--dsf-fill-strong); color: var(--dsf-text); font-size: var(--dsf-text-caption); font-weight: var(--dsf-weight-semibold); line-height: 1; text-transform: uppercase; vertical-align: middle; user-select: none; }
.dsf-avatar img { width: 100%; height: 100%; object-fit: cover; }
.dsf-avatar--sm { width: 1.5rem; font-size: .625rem; }
.dsf-avatar--lg { width: 3rem; font-size: var(--dsf-text-body); }
.dsf-divider { flex: none; height: 0; margin: var(--dsf-space-4) 0; border: 0; border-top: 1px solid var(--dsf-separator); }
.dsf-divider--vertical { align-self: stretch; width: 0; height: auto; margin: 0 var(--dsf-space-1); border-top: 0; border-inline-start: 1px solid var(--dsf-separator); }

/* Campos: altura común con los botones. */
.dsf-field { display: grid; gap: var(--dsf-space-2); margin-bottom: var(--dsf-space-4); }
.dsf-field__row { display: flex; align-items: center; justify-content: space-between; gap: var(--dsf-space-3); }
.dsf-fieldset { min-width: 0; margin: 0 0 var(--dsf-space-4); padding: 0; border: 0; }
.dsf-legend { margin-bottom: var(--dsf-space-2); padding: 0; color: var(--dsf-text); font-size: var(--dsf-text-body-sm); font-weight: var(--dsf-weight-semibold); }
.dsf-label { color: var(--dsf-text-secondary); font-size: var(--dsf-text-body-sm); font-weight: var(--dsf-weight-medium); }
.dsf-required { margin-inline-start: 2px; color: var(--dsf-danger-text); }
.dsf-label > .dsf-help { display: inline; font-weight: var(--dsf-weight-regular); }
.dsf-help, .dsf-field-message, .dsf-counter { margin: 0; color: var(--dsf-text-tertiary); font-size: var(--dsf-text-footnote); line-height: var(--dsf-leading-compact); }
.dsf-counter { font-feature-settings: var(--dsf-font-feature-numeric); text-align: end; white-space: nowrap; }
.dsf-field-message--error, .dsf-counter[data-state="over"] { color: var(--dsf-danger-text); font-weight: var(--dsf-weight-medium); }
.dsf-counter[data-state="warning"] { color: var(--dsf-warning-text); font-weight: var(--dsf-weight-medium); }
/* El error lleva signo, no solo color. */
.dsf-field-message--error::before { content: "!"; display: inline-grid; place-items: center; width: 1.25em; height: 1.25em; margin-inline-end: .375em; border-radius: 50%; background: var(--dsf-danger-text); color: var(--dsf-surface); font-size: .85em; font-weight: var(--dsf-weight-bold); vertical-align: .05em; }
/* Borde de control a 3:1 frente al fondo y la superficie (WCAG 1.4.11). */
.dsf-input, .dsf-textarea, .dsf-select, .dsf-input-group { width: 100%; min-height: var(--dsf-control-height); padding: 0 var(--dsf-space-3); border: 1px solid var(--dsf-outline); border-radius: var(--dsf-radius-sm); background: var(--dsf-bg-elevated); color: var(--dsf-text); transition: border-color var(--dsf-motion-fast), box-shadow var(--dsf-motion-fast), background-color var(--dsf-motion-fast); }
.dsf-textarea { min-height: 112px; padding-block: var(--dsf-space-3); resize: vertical; }
.dsf-input::placeholder, .dsf-textarea::placeholder { color: var(--dsf-text-tertiary); opacity: 1; }
:is(.dsf-input, .dsf-textarea, .dsf-select, .dsf-input-group):hover { border-color: var(--dsf-text-tertiary); }
/* Foco: borde + anillo = 3 px; contorno transparente para colores forzados. */
:is(.dsf-input, .dsf-textarea, .dsf-select):focus:not(.dsf-input-group > *), .dsf-input-group:has(> :is(.dsf-input, .dsf-textarea, .dsf-select):focus) { outline: 2px solid transparent; border-color: var(--dsf-focus-ring); box-shadow: 0 0 0 calc(var(--dsf-focus-width) - 1px) var(--dsf-focus-ring); }
:is(.dsf-input, .dsf-textarea, .dsf-select)[aria-invalid="true"], .dsf-input-group:has(> [aria-invalid="true"]) { border-color: var(--dsf-danger); }
:is(.dsf-input, .dsf-textarea)[readonly] { border-style: dashed; background: var(--dsf-bg); }
:is(.dsf-input, .dsf-textarea, .dsf-select):disabled, .dsf-input-group:has(> :disabled:is(.dsf-input, .dsf-textarea, .dsf-select)) { border-color: var(--dsf-separator); background: var(--dsf-fill); color: var(--dsf-disabled); cursor: not-allowed; }
.dsf-input--compact { min-height: var(--dsf-control-sm); }
.dsf-input--search { padding-inline-start: 36px; background-image: radial-gradient(circle at 17px calc(50% - 2px), transparent 5px, var(--dsf-text-tertiary) 5.5px 7px, transparent 7.5px), linear-gradient(45deg, transparent 38%, var(--dsf-text-tertiary) 38% 62%, transparent 62%); background-position: 0 0, 21px calc(50% + 6px); background-size: auto, 6px 6px; background-repeat: no-repeat; }
.dsf-input--search:dir(rtl) { background-image: radial-gradient(circle at calc(100% - 17px) calc(50% - 2px), transparent 5px, var(--dsf-text-tertiary) 5.5px 7px, transparent 7.5px), linear-gradient(-45deg, transparent 38%, var(--dsf-text-tertiary) 38% 62%, transparent 62%); background-position: 0 0, calc(100% - 21px) calc(50% + 6px); }
/* Campo compuesto (prefijo, sufijo o caja con textarea): el grupo lleva borde y foco. */
.dsf-input-group { display: flex; align-items: stretch; padding: 0; }
.dsf-input-group > :is(.dsf-input, .dsf-textarea, .dsf-select) { flex: 1; min-width: 0; border: 0; background: none; outline: 0; box-shadow: none; }
.dsf-input-group > :is(.dsf-input, .dsf-select) { min-height: 0; }
.dsf-input-group--block { flex-direction: column; }
.dsf-input-group--block > .dsf-input-group__addon { justify-content: flex-end; gap: var(--dsf-space-1); padding: var(--dsf-space-1); }
.dsf-input-group__addon { display: flex; align-items: center; flex: none; padding-inline: var(--dsf-space-3); color: var(--dsf-text-tertiary); font-size: var(--dsf-text-body-sm); white-space: nowrap; }
.dsf-input-group > .dsf-input + .dsf-input-group__addon { padding-inline-start: 0; }
.dsf-input-group__addon:has(.dsf-btn) { padding-inline: var(--dsf-space-1); }
.dsf-input-group__addon + .dsf-input { padding-inline-start: 0; }

/* Casilla y opción: nativas, dibujadas. */
.dsf-check, .dsf-radio { display: flex; align-items: flex-start; gap: var(--dsf-space-2); min-height: var(--dsf-control-height); padding-block: var(--dsf-space-2); color: var(--dsf-text); cursor: pointer; }
.dsf-radio-group { display: grid; }
.dsf-check :where([type="checkbox"]:not(.dsf-toggle)), .dsf-radio :where([type="radio"]) { appearance: none; display: grid; place-content: center; flex: none; width: 20px; height: 20px; margin: 2px 0 0; border: 1.5px solid var(--dsf-outline); border-radius: calc(var(--dsf-radius-xs) - 2px); background: var(--dsf-bg-elevated); color: var(--dsf-accent-contrast); cursor: inherit; transition: background-color var(--dsf-motion-fast), border-color var(--dsf-motion-fast); }
.dsf-radio :where([type="radio"]) { border-radius: 50%; }
:is(.dsf-check, .dsf-radio):hover :where([type="checkbox"]:not(.dsf-toggle), [type="radio"]) { border-color: var(--dsf-text-tertiary); }
.dsf-check :where([type="checkbox"]:not(.dsf-toggle)):is(:checked, :indeterminate), .dsf-radio :where([type="radio"]):checked { border-color: var(--dsf-accent); background: var(--dsf-accent); }
.dsf-check :where([type="checkbox"]:not(.dsf-toggle))::before { content: ""; width: 10px; height: 5px; border: solid currentColor; border-width: 0 0 2px 2px; transform: translateY(-1px) rotate(-45deg) scale(0); transition: transform var(--dsf-motion-fast) var(--dsf-ease-standard); }
.dsf-check :where([type="checkbox"]:not(.dsf-toggle)):checked::before { transform: translateY(-1px) rotate(-45deg); }
.dsf-check :where([type="checkbox"]:not(.dsf-toggle)):indeterminate::before { height: 0; border-width: 0 0 2px; transform: none; }
.dsf-radio :where([type="radio"])::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; transform: scale(0); transition: transform var(--dsf-motion-fast) var(--dsf-ease-standard); }
.dsf-radio :where([type="radio"]):checked::before { transform: none; }
:is(.dsf-check, .dsf-radio) :where(input)[aria-invalid="true"] { border-color: var(--dsf-danger); }
:is(.dsf-check, .dsf-radio):has(:disabled) { opacity: .48; cursor: not-allowed; }
/* Marcado por partes: div > input + __text (label, ayuda y error). */
.dsf-check__text { display: grid; gap: 2px; min-width: 0; }
div:is(.dsf-check, .dsf-radio) { cursor: auto; }
:is(.dsf-check__label, .dsf-radio__label, .dsf-check__input, .dsf-radio__input) { cursor: pointer; }
:is(.dsf-check, .dsf-radio):has(:disabled) :is(label, input) { cursor: not-allowed; }
.dsf-switch > .dsf-check__text { padding-block-start: 2px; }
.dsf-radio-group[data-orientation="horizontal"] { display: flex; flex-wrap: wrap; column-gap: var(--dsf-space-5); }
.dsf-radio-group[data-orientation="horizontal"] > :not(.dsf-radio) { flex-basis: 100%; }

/* Interruptor: button[role=switch][aria-checked] o input[type=checkbox].
   Apagado: el contorno identifica el control a 3:1 (WCAG 1.4.11). */
.dsf-toggle { --dsf-toggle-x: 20px; position: relative; flex: none; width: 48px; height: 28px; margin: 0; padding: 0; appearance: none; border: 0; border-radius: var(--dsf-radius-pill); background: var(--dsf-fill-strong); box-shadow: inset 0 0 0 1px var(--dsf-outline); cursor: pointer; transition: background-color var(--dsf-motion-fast), box-shadow var(--dsf-motion-fast); }
.dsf-toggle:dir(rtl) { --dsf-toggle-x: -20px; }
.dsf-toggle::after { content: ""; position: absolute; top: 2px; inset-inline-start: 2px; width: 24px; height: 24px; border-radius: 50%; background: #FFFFFF; box-shadow: var(--dsf-shadow-1); transition: transform var(--dsf-motion-base) var(--dsf-ease-standard), width var(--dsf-motion-fast) var(--dsf-ease-standard); }
.dsf-toggle:hover { background: var(--dsf-fill-pressed); }
.dsf-toggle:active::after { width: 28px; }
.dsf-toggle:is([aria-checked="true"], :checked) { background: var(--dsf-accent); box-shadow: none; }
.dsf-toggle:is([aria-checked="true"], :checked):hover { background: var(--dsf-accent-hover); }
.dsf-toggle:is([aria-checked="true"], :checked)::after { transform: translateX(var(--dsf-toggle-x)); }
.dsf-toggle:is([aria-checked="true"], :checked):active::after { transform: translateX(calc(var(--dsf-toggle-x) * .8)); }
.dsf-toggle:disabled, .dsf-toggle[aria-disabled="true"] { opacity: .48; cursor: not-allowed; }
.dsf-toggle[aria-invalid="true"]:not([aria-checked="true"], :checked) { box-shadow: inset 0 0 0 2px var(--dsf-danger); }

/* Partes iguales; si no caben (320 px) pasan a otra fila en lugar de desbordar. */
/* Elegir una entre varias (D-030): pestañas, filtros, periodo y selectores son
   lo mismo, una pista gris y la elegida en una píldora clara levantada. En
   oscuro la píldora va un punto más clara que la pista, que antes no se
   distinguía. Una pieza propia que elige una entre varias usa estas variables. */
:root {
  --dsf-segmented-track: var(--dsf-fill);
  --dsf-segmented-pill: light-dark(var(--dsf-surface-elevated), color-mix(in srgb, var(--dsf-text) 8%, var(--dsf-surface-elevated)));
  --dsf-segmented-shadow: 0 1px 3px light-dark(rgb(0 0 0 / .12), rgb(0 0 0 / .45)), 0 0 0 .5px rgb(0 0 0 / .04);
}
.dsf-segmented { display: inline-flex; flex-wrap: wrap; gap: 2px; max-width: 100%; padding: 2px; border-radius: var(--dsf-radius-sm); background: var(--dsf-segmented-track); }
.dsf-segmented button { flex: 1 1 0; min-width: max-content; min-height: calc(var(--dsf-control-height) - 4px); padding-inline: var(--dsf-space-3); border: 0; border-radius: var(--dsf-radius-xs); background: transparent; color: var(--dsf-text-secondary); cursor: pointer; font-size: var(--dsf-text-body-sm); font-weight: var(--dsf-weight-medium); line-height: var(--dsf-leading-tight); transition: background-color var(--dsf-motion-fast), color var(--dsf-motion-fast); }
.dsf-segmented button:hover { color: var(--dsf-text); }
/* Elegido: fondo, sombra y peso. */
.dsf-segmented button:is([aria-pressed="true"], [aria-checked="true"], [aria-selected="true"]) { background: var(--dsf-segmented-pill); color: var(--dsf-text); font-weight: var(--dsf-weight-semibold); box-shadow: var(--dsf-segmented-shadow); }
.dsf-segmented button:disabled { opacity: .48; cursor: not-allowed; }
.dsf-segmented--block { display: flex; width: 100%; }
/* Icono solo (D-018): el nombre va en aria-label y title del botón. */
.dsf-segmented__icon { display: inline-flex; align-items: center; justify-content: center; vertical-align: middle; }
.dsf-segmented__icon svg { width: 18px; height: 18px; }
.dsf-segmented__sample { font-weight: var(--dsf-weight-semibold); line-height: 1; }
.dsf-segmented__sample--compact { font-size: 12px; }
.dsf-segmented__sample--comfortable { font-size: 15px; }
.dsf-segmented__sample--spacious { font-size: 18px; }

/* Pestañas (APG). */
.dsf-tabs__list { display: flex; gap: var(--dsf-space-1); overflow-x: auto; border-bottom: 1px solid var(--dsf-separator); scrollbar-width: none; }
.dsf-tabs__tab { position: relative; display: inline-flex; align-items: center; flex: none; gap: var(--dsf-space-2); min-height: var(--dsf-control-height); padding-inline: var(--dsf-space-3); border: 0; background: none; color: var(--dsf-text-secondary); cursor: pointer; font-size: var(--dsf-text-body-sm); font-weight: var(--dsf-weight-medium); text-decoration: none; white-space: nowrap; transition: color var(--dsf-motion-fast); }
.dsf-tabs__tab:hover, .dsf-tabs__tab[aria-selected="true"] { color: var(--dsf-text); }
.dsf-tabs__tab[aria-selected="true"]::after { content: ""; position: absolute; inset: auto var(--dsf-space-2) 0; border-bottom: 3px solid var(--dsf-accent); border-radius: 3px 3px 0 0; }
.dsf-tabs__tab:focus-visible { outline-offset: -3px; }
.dsf-tabs__tab:is(:disabled, [aria-disabled="true"]) { opacity: .48; cursor: not-allowed; }
.dsf-tabs__panel { padding-block: var(--dsf-space-4); }
.dsf-tabs[data-orientation="vertical"] { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--dsf-space-4); }
.dsf-tabs[data-orientation="vertical"] > .dsf-tabs__list { flex-direction: column; overflow: visible; border-bottom: 0; border-inline-end: 1px solid var(--dsf-separator); }
.dsf-tabs[data-orientation="vertical"] .dsf-tabs__tab[aria-selected="true"]::after { inset-block: var(--dsf-space-1); inset-inline: auto 0; border-bottom: 0; border-inline-end: 3px solid var(--dsf-accent); border-radius: 3px; }
.dsf-tabs[data-orientation="vertical"] .dsf-tabs__panel { padding-block: 0; }

/* Menú y tooltip: con popover nativo y ancla, junto al disparador. */
.dsf-menu { min-width: 12rem; max-width: min(20rem, calc(100vw - 2 * var(--dsf-space-4))); max-height: min(24rem, calc(100dvh - 2 * var(--dsf-space-4))); margin: 0; overflow-y: auto; padding: var(--dsf-space-1); border: 1px solid var(--dsf-separator); border-radius: var(--dsf-radius-md); background: var(--dsf-surface-elevated); color: var(--dsf-text); box-shadow: var(--dsf-shadow-2); }
.dsf-menu__item { display: flex; align-items: center; gap: var(--dsf-space-2); width: 100%; min-height: calc(var(--dsf-control-sm) + var(--dsf-space-1)); padding-inline: var(--dsf-space-3); border: 0; border-radius: var(--dsf-radius-sm); background: none; color: inherit; cursor: pointer; font-size: var(--dsf-text-body-sm); text-align: start; text-decoration: none; }
.dsf-menu__item:is(:hover, :focus-visible) { background: var(--dsf-fill); }
.dsf-menu__item:focus-visible { outline-offset: -2px; }
.dsf-menu__item:active { background: var(--dsf-fill-pressed); }
.dsf-menu__item[aria-checked="true"]::after { content: "✓" / ""; margin-inline-start: auto; color: var(--dsf-accent-text); }
.dsf-menu__item .dsf-kbd { margin-inline-start: auto; }
.dsf-menu__item > .dsf-menu__label { flex: 1; min-width: 0; }
.dsf-menu__icon { display: inline-grid; place-items: center; flex: none; width: 1.25em; }
.dsf-menu__item--danger { color: var(--dsf-danger-text); }
.dsf-menu__item--danger:is(:hover, :focus-visible) { background: var(--dsf-danger-surface); }
.dsf-menu__item:is(:disabled, [aria-disabled="true"]) { background: none; color: var(--dsf-text-tertiary); cursor: not-allowed; }
.dsf-menu__sep { height: 0; margin: var(--dsf-space-1) 0; border: 0; border-top: 1px solid var(--dsf-separator); }
.dsf-menu > .dsf-menu__label { margin: 0; padding: var(--dsf-space-2) var(--dsf-space-3) var(--dsf-space-1); color: var(--dsf-text-tertiary); font-size: var(--dsf-text-caption); font-weight: var(--dsf-weight-semibold); }
.dsf-tooltip { max-width: min(20rem, calc(100vw - 2 * var(--dsf-space-2))); margin: 0; padding: var(--dsf-space-1) var(--dsf-space-2); border: 1px solid transparent; border-radius: var(--dsf-radius-xs); background: var(--dsf-text); color: var(--dsf-bg-elevated); box-shadow: var(--dsf-shadow-1); font-size: var(--dsf-text-footnote); line-height: var(--dsf-leading-compact); overflow-wrap: anywhere; }
.dsf-tooltip:not([popover]) { position: absolute; z-index: var(--dsf-z-tooltip); }
@supports (position-area: block-end) {
  .dsf-menu[popover] { inset: auto; margin-block: var(--dsf-space-1); position-area: block-end span-inline-end; position-try-fallbacks: flip-block, flip-inline; }
  .dsf-tooltip[popover] { inset: auto; margin: var(--dsf-space-1); position-area: block-start; position-try-fallbacks: flip-block; }
}
/* Sin popover: .dsf-popover-anchor coloca la burbuja según data-placement, sin JS. */
.dsf-popover-anchor { position: relative; display: inline-block; vertical-align: middle; }
.dsf-popover-anchor > :is(.dsf-menu, .dsf-tooltip):not([popover]) { position: absolute; z-index: var(--dsf-z-tooltip); width: max-content; }
.dsf-popover-anchor > .dsf-menu:not([popover]) { top: calc(100% + var(--dsf-space-1)); inset-inline-start: 0; }
.dsf-popover-anchor > .dsf-menu[data-placement$="end"] { inset-inline: auto 0; }
.dsf-popover-anchor > .dsf-menu[data-placement^="top"] { top: auto; bottom: calc(100% + var(--dsf-space-1)); }
.dsf-popover-anchor > .dsf-tooltip:not([popover]) { bottom: calc(100% + var(--dsf-space-1)); left: 50%; translate: -50% 0; }
.dsf-popover-anchor > .dsf-tooltip[data-placement="bottom"] { top: calc(100% + var(--dsf-space-1)); bottom: auto; }
.dsf-popover-anchor > .dsf-tooltip:is([data-placement="start"], [data-placement="end"]) { top: 50%; bottom: auto; left: auto; translate: 0 -50%; }
.dsf-popover-anchor > .dsf-tooltip[data-placement="start"] { inset-inline-end: calc(100% + var(--dsf-space-1)); }
.dsf-popover-anchor > .dsf-tooltip[data-placement="end"] { inset-inline-start: calc(100% + var(--dsf-space-1)); }
/* Menú como hoja (D-031): en pantallas estrechas sale desde abajo, a todo el ancho, al alcance
   del pulgar y con el fondo oscurecido, con la forma de .dsf-more-sheet. .dsf-menu--float lo
   deja junto a su botón. */
@media (max-width: 767px) {
  .dsf-menu:not(.dsf-menu--float):is([popover], .dsf-popover-anchor > *) { position: fixed; inset: auto 0 0; z-index: var(--dsf-z-overlay); width: 100%; min-width: 0; max-width: none; max-height: calc(100dvh - max(24px, env(safe-area-inset-top))); margin: 0; padding: 6px 8px calc(10px + env(safe-area-inset-bottom)); border: 0; border-radius: var(--dsf-radius-xl) var(--dsf-radius-xl) 0 0; box-shadow: var(--dsf-shadow-3); position-area: none; }
  .dsf-popover-anchor > .dsf-menu:not(.dsf-menu--float, [popover]) { box-shadow: 0 0 0 100vmax var(--dsf-scrim), var(--dsf-shadow-3); }
  .dsf-menu[popover]:not(.dsf-menu--float)::backdrop { background: var(--dsf-scrim); }
  .dsf-menu:not(.dsf-menu--float):is([popover], .dsf-popover-anchor > *) .dsf-menu__item { gap: 14px; min-height: 50px; padding-inline: 12px; font-size: var(--dsf-text-body); }
}

/* Progreso: <progress> o role=progressbar + __bar. Spinner en dsf-core. */
.dsf-progress { display: block; width: 100%; height: 6px; overflow: hidden; border: 0; border-radius: var(--dsf-radius-pill); background: var(--dsf-fill-strong); color: var(--dsf-tone); appearance: none; }
.dsf-progress::-webkit-progress-bar { background: transparent; }
.dsf-progress::-webkit-progress-value { border-radius: inherit; background: currentColor; transition: width var(--dsf-motion-base) var(--dsf-ease-standard); }
.dsf-progress::-moz-progress-bar { border-radius: inherit; background: currentColor; }
.dsf-progress__bar { display: block; height: 100%; border-radius: inherit; background: currentColor; transition: width var(--dsf-motion-base) var(--dsf-ease-standard); }
.dsf-progress--indeterminate, progress.dsf-progress:indeterminate { background: linear-gradient(currentColor 0 0) -100% 0 / 40% 100% no-repeat var(--dsf-fill-strong); animation: dsf-indeterminate 1.4s var(--dsf-ease-standard) infinite; }
.dsf-progress--indeterminate > .dsf-progress__bar { display: none; }
progress.dsf-progress:indeterminate::-moz-progress-bar { background: none; }
@keyframes dsf-indeterminate { to { background-position: 200% 0; } }
.dsf-progress__value { float: inline-end; color: var(--dsf-text-secondary); font-feature-settings: var(--dsf-font-feature-numeric); }
.dsf-spinner--sm { width: 1rem; }
.dsf-spinner--lg { width: 2rem; border-width: 3px; }

/* Migas, paginación y desplegables. */
.dsf-breadcrumb ol { display: flex; flex-wrap: wrap; align-items: center; gap: var(--dsf-space-1) var(--dsf-space-2); margin: 0; padding: 0; list-style: none; color: var(--dsf-text-secondary); font-size: var(--dsf-text-body-sm); }
.dsf-breadcrumb li { display: inline-flex; align-items: center; gap: var(--dsf-space-2); min-width: 0; }
.dsf-breadcrumb li + li::before { content: "/" / ""; color: var(--dsf-text-tertiary); }
.dsf-breadcrumb a { display: inline-flex; align-items: center; min-height: 24px; border-radius: 2px; color: inherit; text-decoration: none; }
.dsf-breadcrumb a:hover { color: var(--dsf-text); text-decoration: underline; }
.dsf-breadcrumb [aria-current="page"] { color: var(--dsf-text); font-weight: var(--dsf-weight-medium); }
.dsf-pagination, .dsf-pagination :is(ul, ol) { display: flex; flex-wrap: wrap; align-items: center; gap: var(--dsf-space-1); margin: 0; padding: 0; list-style: none; }
.dsf-pagination > :is(a, button, span), .dsf-pagination li > :is(a, button, span) { display: inline-flex; align-items: center; justify-content: center; min-width: var(--dsf-control-height); min-height: var(--dsf-control-height); padding-inline: var(--dsf-space-2); border: 0; border-radius: var(--dsf-radius-sm); background: none; color: var(--dsf-text-secondary); font-size: var(--dsf-text-body-sm); font-weight: var(--dsf-weight-medium); font-feature-settings: var(--dsf-font-feature-numeric); text-decoration: none; }
.dsf-pagination :is(a, button):hover { background: var(--dsf-fill); color: var(--dsf-text); cursor: pointer; }
.dsf-pagination [aria-current="page"] { background: var(--dsf-accent-subtle); color: var(--dsf-text); font-weight: var(--dsf-weight-semibold); box-shadow: inset 0 0 0 1px var(--dsf-accent); }
.dsf-pagination :is(:disabled, [aria-disabled="true"]) { opacity: .48; pointer-events: none; }
.dsf-disclosure > summary { display: flex; align-items: center; gap: var(--dsf-space-2); min-height: var(--dsf-control-height); border-radius: var(--dsf-radius-xs); cursor: pointer; font-weight: var(--dsf-weight-semibold); list-style: none; }
.dsf-disclosure > summary::-webkit-details-marker { display: none; }
.dsf-disclosure > summary::after { content: ""; flex: none; width: 7px; height: 7px; margin-inline: auto var(--dsf-space-1); border: solid currentColor; border-width: 0 2px 2px 0; transform: translateY(-2px) rotate(45deg); transition: transform var(--dsf-motion-fast) var(--dsf-ease-standard); }
.dsf-disclosure[open] > summary::after { transform: translateY(2px) rotate(-135deg); }
.dsf-disclosure > summary ~ * { margin-block: 0 var(--dsf-space-3); color: var(--dsf-text-secondary); }
.dsf-accordion { border-block: 1px solid var(--dsf-separator); }
.dsf-accordion > .dsf-disclosure + .dsf-disclosure { border-top: 1px solid var(--dsf-separator); }
.dsf-accordion > .dsf-disclosure > summary { min-height: var(--dsf-control-lg); }

/* Barra de herramientas y zona para soltar. */
.dsf-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--dsf-space-1); min-width: 0; }
.dsf-toolbar > [role="group"] { display: flex; gap: 2px; }
.dsf-toolbar > .dsf-divider--vertical { margin-block: var(--dsf-space-1); }

.dsf-dropzone { display: grid; place-items: center; align-content: center; gap: var(--dsf-space-2); min-height: 160px; padding: var(--dsf-space-6) var(--dsf-space-4); border: 2px dashed var(--dsf-outline); border-radius: var(--dsf-radius-md); background: var(--dsf-bg); color: var(--dsf-text-secondary); text-align: center; cursor: pointer; transition: border-color var(--dsf-motion-fast), background-color var(--dsf-motion-fast); }
.dsf-dropzone:hover { border-color: var(--dsf-text-tertiary); background: var(--dsf-fill); }
.dsf-dropzone:has(> input:focus-visible) { outline: var(--dsf-focus-width) solid var(--dsf-focus-ring); outline-offset: var(--dsf-focus-offset); }
.dsf-dropzone[data-state="dragging"] { border-style: solid; border-color: var(--dsf-accent); background: var(--dsf-accent-subtle); color: var(--dsf-text); }
.dsf-dropzone:is([data-state="error"], [aria-invalid="true"]) { border-color: var(--dsf-danger); background: var(--dsf-danger-surface); }
div.dsf-dropzone { cursor: auto; }
.dsf-dropzone > p { margin: 0; }
.dsf-dropzone .dsf-help { color: inherit; }
.dsf-dropzone:is([aria-disabled="true"], [data-disabled]) { opacity: .48; cursor: not-allowed; }
.dsf-dropzone[aria-busy="true"] { cursor: progress; }
:is(.dsf-dropzone__title, .dsf-dropzone__label) { color: var(--dsf-text); font-weight: var(--dsf-weight-semibold); }

.dsf-table-surface { --dsf-corner-outer: var(--dsf-radius-lg); --dsf-corner-inset: var(--dsf-space-1); position: relative; overflow: hidden; border: 1px solid var(--dsf-separator); background: var(--dsf-surface); box-shadow: var(--dsf-shadow-1); }
.dsf-table-surface__header { display: flex; align-items: center; justify-content: space-between; gap: var(--dsf-space-4); padding: var(--dsf-space-4); }
.dsf-table-surface__header p { margin: var(--dsf-space-1) 0 0; color: var(--dsf-text-tertiary); }
.dsf-table-surface__progress { padding: var(--dsf-space-2) var(--dsf-space-4); border-top: 1px solid var(--dsf-separator); color: var(--dsf-text-secondary); font-size: var(--dsf-text-footnote); }
.dsf-table-surface[aria-busy="true"] tbody { color: var(--dsf-text-tertiary); }
.dsf-table-wrap { overflow-x: auto; border-radius: inherit; overscroll-behavior-inline: contain; }
.dsf-table { width: 100%; border-collapse: collapse; font-size: var(--dsf-text-body-sm); }
.dsf-table th, .dsf-table td { padding: var(--dsf-space-3) var(--dsf-space-4); border-bottom: 1px solid var(--dsf-separator); text-align: start; }
.dsf-table th { color: var(--dsf-text-tertiary); font-size: var(--dsf-text-footnote); font-weight: var(--dsf-weight-semibold); }
.dsf-table tbody tr { transition: background-color var(--dsf-motion-fast); }
.dsf-table tbody tr:hover { background: var(--dsf-fill); }
/* Elegida: fondo y barra, no solo color. */
.dsf-table tbody tr[aria-selected="true"] { background: var(--dsf-accent-subtle); }
.dsf-table__caption { padding: var(--dsf-space-3) var(--dsf-space-4); font-weight: var(--dsf-weight-semibold); text-align: start; }
.dsf-table .dsf-table__empty { padding-block: var(--dsf-space-8); color: var(--dsf-text-secondary); text-align: center; }
.dsf-table__sort { display: inline-flex; align-items: center; gap: var(--dsf-space-1); margin: calc(-1 * var(--dsf-space-1)) calc(-1 * var(--dsf-space-2)); padding: var(--dsf-space-1) var(--dsf-space-2); border: 0; border-radius: var(--dsf-radius-xs); background: none; color: inherit; cursor: pointer; font: inherit; }
.dsf-table__sort:hover { background: var(--dsf-fill); color: var(--dsf-text); }
.dsf-table th:is([aria-sort="ascending"], [aria-sort="descending"]) { color: var(--dsf-text); }
.dsf-table .num { text-align: end; font-feature-settings: var(--dsf-font-feature-numeric); }
.dsf-card__header { display: flex; align-items: center; justify-content: space-between; gap: var(--dsf-space-4); padding: var(--dsf-space-4); }
.dsf-panel-body { padding: clamp(var(--dsf-space-4), 3vw, var(--dsf-space-7)); }
.dsf-offset-top { margin-top: var(--dsf-space-5); }

.dsf-stat { padding: var(--dsf-space-4); border-radius: var(--dsf-radius-md); background: var(--dsf-surface); border: 1px solid var(--dsf-separator); }
.dsf-stat__label { margin: 0; color: var(--dsf-text-tertiary); font-size: var(--dsf-text-footnote); font-weight: var(--dsf-weight-medium); }
.dsf-stat__value { margin: var(--dsf-space-1) 0 0; font-size: var(--dsf-text-title); font-weight: var(--dsf-weight-bold); line-height: 1.1; letter-spacing: var(--dsf-tracking-title); font-feature-settings: var(--dsf-font-feature-numeric); }
.dsf-stat__delta { margin: var(--dsf-space-2) 0 0; color: var(--dsf-text-tertiary); font-size: var(--dsf-text-footnote); font-weight: var(--dsf-weight-medium); }
.dsf-stat__delta--up { color: var(--dsf-success-text); }
.dsf-stat__delta--down { color: var(--dsf-danger-text); }

/* Estados y vacío: icono, título, texto y acción. */
.dsf-empty, .dsf-error, .dsf-state { min-height: 200px; display: grid; align-content: center; justify-items: start; gap: var(--dsf-space-3); padding: var(--dsf-space-6); border: 1px solid var(--dsf-separator); border-radius: var(--dsf-radius-md); background: var(--dsf-surface); }
.dsf-empty > *, .dsf-error > *, .dsf-state > * { margin: 0; }
.dsf-empty--center, .dsf-state--center { justify-items: center; text-align: center; }
.dsf-empty__icon, .dsf-state-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--dsf-radius-md); background: var(--dsf-tone-surface); color: var(--dsf-tone-text); }
.dsf-state__title { font-size: var(--dsf-text-body-lg); font-weight: var(--dsf-weight-semibold); line-height: var(--dsf-leading-title); }
.dsf-state__text { max-width: 52ch; color: var(--dsf-text-secondary); font-size: var(--dsf-text-body-sm); }
.dsf-state__actions { display: flex; flex-wrap: wrap; gap: var(--dsf-space-2); }
/* Detalle técnico de un error, plegado (D-031): la frase en llano arriba y lo técnico en «Detalles». */
.dsf-state__details { width: 100%; max-width: 52ch; color: var(--dsf-text-secondary); font-size: var(--dsf-text-footnote); }
.dsf-state__details > summary { display: inline-flex; align-items: center; min-height: var(--dsf-control-sm); padding: 0 var(--dsf-space-2); border-radius: var(--dsf-radius-sm); cursor: pointer; list-style: none; }
.dsf-state__details > summary::-webkit-details-marker { display: none; }
.dsf-state__details > summary::after { content: ""; width: 6px; height: 6px; margin-inline-start: 8px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; rotate: 45deg; translate: 0 -2px; }
.dsf-state__details[open] > summary::after { rotate: -135deg; translate: 0 1px; }
.dsf-state__details > summary:hover { background: var(--dsf-fill); color: var(--dsf-text); }
.dsf-state__details > pre { max-height: 12rem; margin: var(--dsf-space-1) 0 0; overflow: auto; padding: var(--dsf-space-2) var(--dsf-space-3); border-radius: var(--dsf-radius-sm); background: var(--dsf-fill); font: var(--dsf-text-footnote)/1.45 var(--dsf-font-mono); text-align: start; white-space: pre-wrap; overflow-wrap: anywhere; }
.dsf-skeleton { display: grid; gap: var(--dsf-space-3); padding: var(--dsf-space-5); }
.dsf-skeleton span { display: block; width: 100%; height: 10px; border-radius: var(--dsf-radius-pill); background: var(--dsf-fill); animation: dsf-pulse 1.35s ease-in-out infinite alternate; }
.dsf-skeleton span:nth-child(1) { width: 48%; height: 18px; }
.dsf-skeleton span:nth-child(2) { width: 86%; }
.dsf-skeleton span:nth-child(3) { width: 64%; }
@keyframes dsf-pulse { to { opacity: .48; } }

/* Avisos: .dsf-alert en bloque, .dsf-banner a lo ancho; el primer hijo aria-hidden es el icono. */
.dsf-alert { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--dsf-space-3); padding: var(--dsf-space-4); border: 1px solid color-mix(in srgb, var(--dsf-tone) 28%, transparent); border-radius: var(--dsf-radius-md); background: var(--dsf-tone-surface); color: var(--dsf-text); }
.dsf-banner { display: flex; flex-wrap: wrap; align-items: center; gap: var(--dsf-space-2) var(--dsf-space-3); padding: var(--dsf-space-3) var(--dsf-gutter); border-bottom: 1px solid color-mix(in srgb, var(--dsf-tone) 28%, transparent); background: var(--dsf-tone-surface); color: var(--dsf-text); font-size: var(--dsf-text-body-sm); }
:is(.dsf-alert, .dsf-banner) > [aria-hidden="true"]:first-child { color: var(--dsf-tone-text); font-weight: var(--dsf-weight-bold); }
.dsf-alert__actions, .dsf-banner__actions { display: flex; flex-wrap: wrap; gap: var(--dsf-space-2); }
.dsf-alert > .dsf-alert__actions { grid-column: 2; }
.dsf-banner__actions { margin-inline-start: auto; }
/* Por partes (React): icono, cuerpo (título, texto, acciones) y cerrar en otra columna. */
.dsf-alert:has(> .dsf-alert__close) { grid-template-columns: auto minmax(0, 1fr) auto; }
.dsf-alert__body:first-child { grid-column: span 2; }
.dsf-alert__body { display: grid; gap: var(--dsf-space-1); }
.dsf-alert__body > .dsf-alert__actions { margin-top: var(--dsf-space-2); }
/* Aviso en una línea (D-029): icono, texto que se corta con «…» y una acción a la derecha.
   Con --warning es el aviso de atención (lo que espera a alguien sin ser un error). */
.dsf-alert--compact { display: flex; align-items: center; gap: var(--dsf-space-3); padding: var(--dsf-space-2) var(--dsf-space-3); font-size: var(--dsf-text-body-sm); }
.dsf-alert--compact > .dsf-alert__body { display: flex; flex: 1 1 auto; align-items: center; gap: var(--dsf-space-1) var(--dsf-space-3); min-width: 0; }
.dsf-alert--compact :is(.dsf-alert__title, .dsf-alert__text) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dsf-alert--compact .dsf-alert__title { flex: 0 1 auto; min-width: 0; }
.dsf-alert--compact .dsf-alert__text { flex: 1 1 0; min-width: 0; margin: 0; }
.dsf-alert--compact .dsf-alert__title + .dsf-alert__text { font-size: inherit; }
.dsf-alert--compact .dsf-alert__actions { flex: none; flex-wrap: nowrap; margin: 0 0 0 auto; }
.dsf-alert--compact > [aria-hidden="true"]:first-child svg { display: block; width: 18px; height: 18px; }
.dsf-banner__body { display: flex; flex: 1 1 16rem; flex-wrap: wrap; align-items: center; gap: var(--dsf-space-1) var(--dsf-space-3); min-width: 0; }
:is(.dsf-alert__title, .dsf-banner__title, .dsf-toast__title, .dsf-toast__description) { margin: 0; }
:is(.dsf-alert__title, .dsf-banner__title, .dsf-toast__title) { font-weight: var(--dsf-weight-semibold); }
.dsf-alert__title + .dsf-alert__text { color: var(--dsf-text-secondary); font-size: var(--dsf-text-body-sm); }
:is(.dsf-alert__close, .dsf-banner__close, .dsf-toast__close) { position: relative; display: inline-grid; place-items: center; flex: none; width: var(--dsf-control-sm); height: var(--dsf-control-sm); margin: calc(-1 * var(--dsf-space-1)); padding: 0; border: 0; border-radius: var(--dsf-radius-sm); background: none; color: inherit; cursor: pointer; font: inherit; font-size: 1.25rem; line-height: 1; }
:is(.dsf-alert__close, .dsf-banner__close, .dsf-toast__close):hover { background: color-mix(in srgb, currentColor 12%, transparent); }
:is(.dsf-alert__close, .dsf-banner__close, .dsf-toast__close):active { background: color-mix(in srgb, currentColor 20%, transparent); }

.dsf-app { min-height: 100dvh; display: grid; grid-template-columns: minmax(220px, 240px) minmax(0, 1fr); }
.dsf-app > * { min-width: 0; }
.dsf-app__workspace { min-width: 0; }
/* Barras fijas: el foco no queda tapado (2.4.11). */
/* La app ajusta --dsf-sticky-top / --dsf-sticky-bottom si tiene otras barras. */
html { scroll-padding-block: calc(var(--dsf-sticky-top, 0px) + var(--dsf-space-4)) calc(var(--dsf-sticky-bottom, 0px) + env(safe-area-inset-bottom) + var(--dsf-space-4)); }
:where(html:has(.dsf-topbar)) { --dsf-sticky-top: 72px; }
.dsf-skip-link { position: fixed; z-index: var(--dsf-z-tooltip); top: var(--dsf-space-2); inset-inline-start: var(--dsf-space-2); padding: var(--dsf-space-3) var(--dsf-space-4); border-radius: var(--dsf-radius-sm); background: var(--dsf-text); color: var(--dsf-bg-elevated); transform: translateY(calc(-100% - var(--dsf-space-3))); }
.dsf-skip-link:focus { transform: translateY(0); }
.dsf-sidebar { position: sticky; top: 0; display: flex; flex-direction: column; height: 100dvh; overflow-y: auto; padding: var(--dsf-space-5); border-inline-end: 1px solid var(--dsf-separator); background: color-mix(in srgb, var(--dsf-surface-solid) 92%, var(--dsf-bg)); }
.dsf-sidebar__title { margin-bottom: var(--dsf-space-6); }
.dsf-sidebar nav { flex: 1; align-content: start; }
.dsf-sidebar__footer { margin-top: var(--dsf-space-6); padding-top: var(--dsf-space-4); border-top: 1px solid var(--dsf-separator); }
.dsf-navitem { min-height: var(--dsf-hit-target); display: flex; align-items: center; gap: var(--dsf-space-3); padding-inline: var(--dsf-space-3); border-radius: var(--dsf-radius-sm); color: var(--dsf-text-secondary); text-decoration: none; border: 0; background: transparent; cursor: pointer; font-size: var(--dsf-text-body-sm); font-weight: var(--dsf-weight-medium); transition: background-color var(--dsf-motion-fast), color var(--dsf-motion-fast), transform var(--dsf-motion-press); }
.dsf-navitem:hover { background: var(--dsf-fill); color: var(--dsf-text); }
.dsf-navitem:active { background: var(--dsf-fill-pressed); transform: scale(.98); }
.dsf-navitem__icon { display: inline-grid; place-items: center; flex: none; width: 1.25rem; }
.dsf-navitem[aria-current="page"] { background: var(--dsf-fill-strong); color: var(--dsf-text); font-weight: var(--dsf-weight-semibold); }
.dsf-topbar { position: sticky; top: 0; z-index: var(--dsf-z-sticky); display: flex; align-items: center; justify-content: space-between; gap: var(--dsf-space-4); min-height: 72px; padding: var(--dsf-space-3) clamp(var(--dsf-space-4), 3vw, var(--dsf-space-7)); background: var(--dsf-surface-glass); -webkit-backdrop-filter: blur(var(--dsf-blur-md)) saturate(1.35); backdrop-filter: blur(var(--dsf-blur-md)) saturate(1.35); box-shadow: 0 1px 0 var(--dsf-separator); }
.dsf-topbar__eyebrow, .dsf-topbar__title { margin: 0; }
.dsf-mobile-nav { display: none; }

.dsf-media { --dsf-corner-outer: var(--dsf-radius-lg); --dsf-corner-inset: var(--dsf-space-2); position: relative; min-width: 0; margin: 0; padding: var(--dsf-corner-inset); overflow: hidden; border: 1px solid var(--dsf-separator); background: var(--dsf-surface); }
.dsf-media__asset, .dsf-media__fallback { position: absolute; inset: var(--dsf-corner-inset); width: calc(100% - 2 * var(--dsf-corner-inset)); height: calc(100% - 2 * var(--dsf-corner-inset)); }
.dsf-media__asset { display: block; object-fit: cover; }
.dsf-media__fallback { display: grid; place-items: center; padding: var(--dsf-space-4); background: var(--dsf-fill); color: var(--dsf-text-secondary); text-align: center; }
.dsf-media[data-state="ready"] .dsf-media__fallback { display: none; }

.dsf-visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }

.dsf-hero-grid { display: grid; align-items: center; gap: clamp(var(--dsf-space-7), 6vw, var(--dsf-space-11)); }
@media (min-width: 880px) { .dsf-hero-grid { grid-template-columns: minmax(0, .88fr) minmax(360px, 1.12fr); } }
.dsf-product-preview { position: relative; min-height: 470px; display: grid; align-items: end; padding: clamp(var(--dsf-space-4), 3vw, var(--dsf-space-7)); border: 1px solid var(--dsf-separator); border-radius: var(--dsf-radius-xl); background: var(--dsf-bg-elevated); box-shadow: var(--dsf-shadow-3); overflow: hidden; }
.dsf-product-preview::before { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, transparent 58%, color-mix(in srgb, var(--dsf-text) 4%, transparent)); pointer-events: none; }
.dsf-product-window { position: relative; z-index: 1; overflow: hidden; border: 1px solid var(--dsf-separator); border-radius: var(--dsf-radius-lg); background: var(--dsf-surface); box-shadow: var(--dsf-shadow-2); }
.dsf-product-window__bar { height: 42px; display: flex; align-items: center; gap: 6px; padding-inline: var(--dsf-space-4); border-bottom: 1px solid var(--dsf-separator); }
.dsf-product-window__bar span { width: 8px; height: 8px; border-radius: 50%; background: var(--dsf-fill-strong); }
.dsf-product-window__body { display: grid; grid-template-columns: 120px 1fr; min-height: 300px; }
.dsf-product-window__nav { padding: var(--dsf-space-4); border-inline-end: 1px solid var(--dsf-separator); background: var(--dsf-fill); }
.dsf-product-window__content { display: grid; gap: var(--dsf-space-4); padding: var(--dsf-space-5); }
.dsf-preview-line { display: block; height: 10px; border-radius: var(--dsf-radius-pill); background: var(--dsf-fill-strong); }
.dsf-preview-line--title { width: 48%; height: 20px; background: var(--dsf-text); }
.dsf-preview-line--short { width: 64%; }
.dsf-preview-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--dsf-space-3); }
.dsf-preview-tile { min-height: 94px; border: 1px solid var(--dsf-separator); border-radius: var(--dsf-radius-md); background: var(--dsf-surface-elevated); }

/* Capas: se desplazan por dentro si no caben. */
.dsf-overlay { position: fixed; inset: 0; z-index: var(--dsf-z-overlay); display: grid; padding: var(--dsf-space-4); background: var(--dsf-scrim); opacity: 0; visibility: hidden; pointer-events: none; transition: opacity var(--dsf-motion-base) var(--dsf-ease-standard), visibility 0s linear var(--dsf-motion-base); }
.dsf-overlay[data-state="open"] { opacity: 1; visibility: visible; pointer-events: auto; transition-delay: 0s; }
.dsf-modal, .dsf-sheet, .dsf-drawer { overflow-y: auto; overscroll-behavior: contain; background: var(--dsf-surface-glass); border: 1px solid var(--dsf-separator); box-shadow: var(--dsf-shadow-3); -webkit-backdrop-filter: blur(var(--dsf-blur-lg)) saturate(1.4); backdrop-filter: blur(var(--dsf-blur-lg)) saturate(1.4); }
.dsf-modal { width: min(100%, 500px); max-height: 100%; margin: auto; padding: var(--dsf-space-5); border-radius: var(--dsf-radius-lg); transform: scale(.96); opacity: 0; transition: transform var(--dsf-motion-base) var(--dsf-ease-entrance), opacity var(--dsf-motion-base); }
.dsf-overlay[data-state="open"] .dsf-modal, dialog.dsf-modal[open] { transform: scale(1); opacity: 1; }
dialog.dsf-modal::backdrop { background: var(--dsf-scrim); }
.dsf-sheet { align-self: end; width: min(100%, 680px); max-height: min(82dvh, 760px); margin: 0 auto calc(-1 * var(--dsf-space-4)); padding: var(--dsf-space-3) var(--dsf-space-5) calc(var(--dsf-space-5) + env(safe-area-inset-bottom)); border-radius: var(--dsf-radius-xl) var(--dsf-radius-xl) 0 0; transform: translateY(110%); touch-action: pan-y; will-change: transform; }
.dsf-overlay[data-state="open"] .dsf-sheet { transform: translateY(0); }
.dsf-sheet__handle { position: relative; width: 38px; height: 5px; margin: 0 auto var(--dsf-space-4); border-radius: var(--dsf-radius-pill); background: var(--dsf-fill-strong); cursor: grab; touch-action: none; }
.dsf-sheet__handle::before { content: ""; position: absolute; inset: -14px -24px; }
.dsf-sheet__handle:active { cursor: grabbing; }
.dsf-drawer { justify-self: end; width: min(92vw, 420px); margin: calc(-1 * var(--dsf-space-4)); margin-inline-start: 0; padding: var(--dsf-space-5); border-radius: var(--dsf-radius-xl) 0 0 var(--dsf-radius-xl); transform: translateX(110%); transition: transform var(--dsf-motion-slow) var(--dsf-ease-entrance); }
.dsf-drawer:dir(rtl) { border-radius: 0 var(--dsf-radius-xl) var(--dsf-radius-xl) 0; transform: translateX(-110%); }
.dsf-overlay[data-state="open"] .dsf-drawer { transform: translateX(0); }
.dsf-overlay__header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--dsf-space-4); margin-bottom: var(--dsf-space-4); }
.dsf-overlay__header > * { margin: 0; }
.dsf-overlay__description { margin-top: var(--dsf-space-1); color: var(--dsf-text-secondary); font-size: var(--dsf-text-body-sm); }
.dsf-overlay__footer { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--dsf-space-2); margin-top: var(--dsf-space-5); }

/* Toast: suelto en la esquina o apilado en .dsf-toast-region (aria-live). */
.dsf-toast { position: fixed; inset-inline-end: var(--dsf-space-4); bottom: calc(var(--dsf-space-4) + env(safe-area-inset-bottom)); z-index: var(--dsf-z-toast); max-width: min(380px, calc(100vw - 2 * var(--dsf-space-4))); padding: var(--dsf-space-3) var(--dsf-space-4); border: 1px solid transparent; border-radius: var(--dsf-radius-md); background: var(--dsf-text); color: var(--dsf-bg-elevated); box-shadow: var(--dsf-shadow-2); animation: dsf-toast-in var(--dsf-motion-base) var(--dsf-ease-entrance); }
.dsf-toast > .dsf-btn:focus-visible { outline-color: currentColor; box-shadow: none; }
.dsf-toast > .dsf-btn { --dsf-btn-fg: currentColor; --dsf-btn-hover: color-mix(in srgb, currentColor 14%, transparent); float: inline-end; margin-block: calc(-1 * var(--dsf-space-2)); margin-inline: var(--dsf-space-3) calc(-1 * var(--dsf-space-2)); text-decoration: underline; }
.dsf-toast-region { position: fixed; inset-inline-end: var(--dsf-space-4); bottom: calc(var(--dsf-space-4) + env(safe-area-inset-bottom)); z-index: var(--dsf-z-toast); display: flex; flex-direction: column; align-items: flex-end; gap: var(--dsf-space-2); width: min(380px, calc(100vw - 2 * var(--dsf-space-4))); margin: 0; padding: 0; list-style: none; pointer-events: none; }
.dsf-toast-region > * { pointer-events: auto; }
.dsf-toast-region .dsf-toast { position: static; max-width: 100%; }
.dsf-toast-region__list { display: flex; flex-direction: column; gap: var(--dsf-space-2); margin: 0; padding: 0; list-style: none; pointer-events: none; }
.dsf-toast-region__list > * { pointer-events: auto; }
/* Por partes (React): cuerpo, acción y cerrar; el tono, en una barra al inicio. */
.dsf-toast:has(> .dsf-toast__body) { display: flex; align-items: center; gap: var(--dsf-space-2); padding-inline-end: var(--dsf-space-2); }
.dsf-toast__body { flex: 1; min-width: 0; }
.dsf-toast__description { font-size: var(--dsf-text-body-sm); }
.dsf-toast .dsf-toast__action { --dsf-btn-bg: color-mix(in srgb, currentColor 14%, transparent); --dsf-btn-hover: color-mix(in srgb, currentColor 22%, transparent); --dsf-btn-press: color-mix(in srgb, currentColor 30%, transparent); float: none; margin: 0; text-decoration: none; }
/* El tono marca el contorno entero, nunca una barra a un lado (D-013). */
.dsf-toast:is(.dsf-toast--info, .dsf-toast--success, .dsf-toast--warning, .dsf-toast--danger) { border-color: color-mix(in srgb, var(--dsf-tone) 50%, var(--dsf-bg-elevated)); }
@keyframes dsf-toast-in { from { opacity: 0; transform: translateY(8px); } }

.dsf-rise-stagger > * { opacity: 0; transform: translateY(8px); animation: dsf-rise-in var(--dsf-motion-slow) var(--dsf-ease-entrance) forwards; }
.dsf-rise-stagger > *:nth-child(2) { animation-delay: 40ms; }
.dsf-rise-stagger > *:nth-child(3) { animation-delay: 80ms; }
.dsf-rise-stagger > *:nth-child(4) { animation-delay: 120ms; }

/* Contratos antiguos sin salida visual. */
.dsf-blob, .dsf-sparkle, .dsf-dots::before, .dsf-grain::after, .dsf-wave { display: none !important; }

@media (max-width: 900px) {
  .dsf-app { grid-template-columns: 1fr; }
  .dsf-sidebar { display: none; }
  .dsf-mobile-nav { position: sticky; top: 0; z-index: var(--dsf-z-sticky); display: flex; gap: var(--dsf-space-1); overflow-x: auto; padding: var(--dsf-space-2) var(--dsf-space-4); border-bottom: 1px solid var(--dsf-separator); background: var(--dsf-surface-solid); }
  .dsf-mobile-nav .dsf-navitem { flex: 0 0 auto; }
  .dsf-topbar { top: calc(var(--dsf-hit-target) + 2 * var(--dsf-space-2) + 1px); }
  :where(html:has(.dsf-mobile-nav)) { --dsf-sticky-top: calc(72px + var(--dsf-hit-target) + var(--dsf-space-4)); }
}

@media (max-width: 620px) {
  .dsf-product-preview { min-height: 380px; }
  .dsf-product-window__body { grid-template-columns: 1fr; }
  .dsf-product-window__nav { display: none; }
  .dsf-preview-row { grid-template-columns: 1fr; }
  .dsf-preview-tile:nth-child(n + 2) { display: none; }
  .dsf-topbar { align-items: flex-start; flex-wrap: wrap; }
  .dsf-topbar .dsf-actions { width: 100%; margin-top: 0; }
  .dsf-card__header { align-items: flex-start; flex-direction: column; }
  .dsf-table-surface__header { align-items: flex-start; flex-direction: column; }
  .dsf-table--responsive thead { display: none; }
  .dsf-table--responsive, .dsf-table--responsive tbody, .dsf-table--responsive tr, .dsf-table--responsive td { display: block; width: 100%; }
  .dsf-table--responsive tr { padding: var(--dsf-space-3) var(--dsf-space-4); border-bottom: 1px solid var(--dsf-separator); }
  .dsf-table--responsive td { display: grid; grid-template-columns: minmax(7rem, .7fr) minmax(0, 1fr); gap: var(--dsf-space-3); padding: var(--dsf-space-1) 0; border: 0; text-align: start; }
  .dsf-table--responsive td::before { content: attr(data-label); color: var(--dsf-text-tertiary); font-size: var(--dsf-text-footnote); font-weight: var(--dsf-weight-semibold); }
  .dsf-table--responsive .num { text-align: start; }
  .dsf-toast-region { inset-inline-start: var(--dsf-space-4); width: auto; align-items: stretch; }
}

/* Táctil: 44 px; lo pequeño amplía su zona sin crecer. */
@media (pointer: coarse) {
  .dsf-input, .dsf-select, .dsf-input-group, .dsf-input--compact, .dsf-check, .dsf-radio, .dsf-tabs__tab, .dsf-menu__item, .dsf-breadcrumb a, .dsf-disclosure > summary { min-height: var(--dsf-hit-target); }
  .dsf-tabs[data-orientation="vertical"] { grid-template-columns: minmax(0, 1fr); }
  .dsf-input-group > .dsf-input { min-height: 0; }
  .dsf-segmented button { min-height: calc(var(--dsf-hit-target) - 4px); }
  .dsf-pagination > :is(a, button, span), .dsf-pagination li > :is(a, button, span) { min-width: var(--dsf-hit-target); min-height: var(--dsf-hit-target); }
  .dsf-toggle::before, .dsf-tag__remove::after, :is(.dsf-alert__close, .dsf-banner__close, .dsf-toast__close)::after { content: ""; position: absolute; inset: min(0px, calc(50% - var(--dsf-hit-target) / 2)); }
}

/* Colores forzados: lo elegido con colores de sistema; casillas nativas. */
@media (forced-colors: active) {
  :is(.dsf-input, .dsf-textarea, .dsf-select):focus, .dsf-input-group:has(> :is(.dsf-input, .dsf-textarea, .dsf-select):focus) { outline-color: Highlight; }
  .dsf-check :where([type="checkbox"]:not(.dsf-toggle)), .dsf-radio :where([type="radio"]) { appearance: auto; }
  .dsf-toggle { forced-color-adjust: none; outline-color: CanvasText; border: 1px solid ButtonText; background: Canvas; box-shadow: none; }
  .dsf-toggle::after { top: 1px; inset-inline-start: 1px; background: ButtonText; box-shadow: none; }
  .dsf-toggle:is([aria-checked="true"], :checked) { border-color: Highlight; background: Highlight; }
  .dsf-toggle:is([aria-checked="true"], :checked)::after { background: HighlightText; }
  .dsf-segmented button:is([aria-pressed="true"], [aria-checked="true"], [aria-selected="true"]), .dsf-navitem[aria-current="page"], .dsf-pagination [aria-current="page"], .dsf-table tbody tr[aria-selected="true"], .dsf-menu__item:is(:hover, :focus-visible) { forced-color-adjust: none; outline-color: CanvasText; background: Highlight; color: HighlightText; }
  .dsf-menu__item:focus-visible { outline-color: HighlightText; }
  :is(.dsf-tabs__tab, .dsf-menu__item, .dsf-segmented button):is(:disabled, [aria-disabled="true"]) { color: GrayText; }
  .dsf-progress { forced-color-adjust: none; border: 1px solid CanvasText; background: Canvas; color: Highlight; }
  :is(.dsf-progress--indeterminate, progress.dsf-progress:indeterminate) { background: linear-gradient(Highlight 0 0) -100% 0 / 40% 100% no-repeat Canvas; }
  .dsf-progress::-webkit-progress-bar { forced-color-adjust: none; }
  :is(.dsf-spinner, .dsf-btn__spinner) { forced-color-adjust: none; border-color: Canvas; border-top-color: CanvasText; }
  .dsf-skeleton span { outline: 1px solid; }
}

@media (prefers-reduced-motion: reduce) {
  .dsf-rise-stagger > * { opacity: 1; transform: none; animation: none; }
  .dsf-skeleton span, .dsf-toast { animation: none; }
  .dsf-modal, .dsf-sheet, .dsf-drawer { transform: none !important; transition: opacity var(--dsf-motion-base) linear; }
  /* La carga sigue viéndose. */
  .dsf-spinner, .dsf-btn__spinner { animation-duration: 1.6s !important; animation-iteration-count: infinite !important; }
  .dsf-progress--indeterminate, progress.dsf-progress:indeterminate { background-size: 100% 100%; animation: dsf-pulse 1.4s ease-in-out infinite alternate; animation-duration: 1.4s !important; animation-iteration-count: infinite !important; }
}

[data-contrast="more"] :is(.dsf-table-surface, .dsf-media, .dsf-state) { border-color: var(--dsf-separator-strong); }
[data-contrast="more"] :is(.dsf-input, .dsf-textarea, .dsf-select, .dsf-input-group) { border-color: var(--dsf-text-secondary); }
[data-contrast="more"] .dsf-segmented { box-shadow: inset 0 0 0 1px var(--dsf-outline); }
@media (prefers-contrast: more) {
  :is(.dsf-table-surface, .dsf-media, .dsf-state):not([data-contrast="normal"] *) { border-color: var(--dsf-separator-strong); }
  :is(.dsf-input, .dsf-textarea, .dsf-select, .dsf-input-group):not([data-contrast="normal"] *) { border-color: var(--dsf-text-secondary); }
  .dsf-segmented:not([data-contrast="normal"] *) { box-shadow: inset 0 0 0 1px var(--dsf-outline); }
}

@media (prefers-reduced-transparency: reduce) {
  .dsf-topbar, .dsf-modal, .dsf-sheet, .dsf-drawer { background: var(--dsf-surface-solid); -webkit-backdrop-filter: none; backdrop-filter: none; }
}

/* ============================================================
   Herramientas · marco de página común
   La herramienta ocupa la pantalla (0.4.0) y no lleva cajas (0.4.1): la
   ventana del navegador es el marco. Desde 0.4.2 la cabecera es compacta,
   como la de un editor de documentos: a la izquierda la herramienta (icono,
   título y subtítulo) y sus acciones; a la derecha, desde 0.4.3, la web a la
   vista: marca, «Crea tu web», «Herramientas», «Sobre mí» y «©».
   Contrato y HTML de referencia: docs/patrones/herramientas.md.
   ============================================================ */
/* Same horizontal position in every tool, with or without a scrollbar. */
html:has(.dsf-tool) { scrollbar-gutter: stable; }
.dsf-tool {
  /* Alto de la cabecera fija (0.8.12, D-027): otro elemento fijo de la
     herramienta se coloca debajo con top: var(--dsf-tool-header-h). */
  --dsf-tool-header-h: 52px;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  padding: 0 var(--dsf-gutter) var(--dsf-gutter);
}
.dsf-tool > main { display: flex; flex-direction: column; flex: 1; min-height: 0; }
/* Sin cajas: la página toma el color de superficie y las superficies de primer
   nivel pierden borde, radio y sombra; dos seguidas se separan con una línea. */
body:has(> .dsf-tool) { background: var(--dsf-surface); }
.dsf-tool > main > .dsf-surface { background: none; border: 0; border-radius: 0; box-shadow: none; }
.dsf-tool > main > .dsf-surface + .dsf-surface { border-top: 1px solid var(--dsf-separator); }
/* Lienzo a sangre: llega a los bordes de la ventana (editores de pantalla entera). */
.dsf-tool__canvas {
  margin: 0 calc(-1 * var(--dsf-gutter)) calc(-1 * var(--dsf-gutter));
  border-top: 1px solid var(--dsf-separator);
}

/* Cabecera compacta: una fila de 52 px. Desde 0.8.12 (D-027) queda fija
   arriba al hacer scroll, a sangre y con el fondo de la página; al despegarse
   del principio aparece una línea debajo. */
.dsf-tool__header {
  position: sticky;
  top: 0;
  z-index: var(--dsf-z-sticky);
  display: flex;
  align-items: center;
  gap: var(--dsf-space-3);
  min-height: var(--dsf-tool-header-h);
  margin: 0 calc(-1 * var(--dsf-gutter)) var(--dsf-space-2);
  padding: var(--dsf-space-1) var(--dsf-gutter);
  background: var(--dsf-surface);
  box-shadow: 0 1px 0 transparent;
}
@supports (animation-timeline: scroll()) {
  .dsf-tool__header {
    animation: dsf-tool-header-stuck linear both;
    animation-timeline: scroll();
    animation-range: 0 8px;
  }
}
@keyframes dsf-tool-header-stuck { to { box-shadow: 0 1px 0 var(--dsf-separator); } }
.dsf-tool__header > div:not([class]) { min-width: 0; margin-inline-end: auto; }
.dsf-tool__icon { width: 32px; height: 32px; flex: none; }
.dsf-tool__title {
  margin: 0;
  overflow: hidden;
  font-size: var(--dsf-text-body-lg);
  font-weight: var(--dsf-weight-semibold);
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dsf-tool__subtitle {
  margin: 0;
  overflow: hidden;
  color: var(--dsf-text-secondary);
  font-size: var(--dsf-text-caption);
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dsf-tool__actions { display: flex; align-items: center; gap: var(--dsf-space-1); flex: none; }
.dsf-tool__actions .dsf-btn { white-space: nowrap; }

/* La web a la vista, a la derecha (0.4.3, D-004): la marca entera enlaza a la
   web; «Crea tu web», «Herramientas» y «Sobre mí» son botones; «©» abre la nota
   de datos, los enlaces propios y la autoría. Sin menú para la navegación.
   0.4.4 (D-005): todo va en una cápsula de relleno, aparte de la herramienta. */
.dsf-tool__site {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: none;
  padding: 3px 10px;
  border-radius: var(--dsf-radius-pill);
  background: var(--dsf-fill);
}
.dsf-tool__actions + .dsf-tool__site { margin-inline-start: var(--dsf-space-2); }
.dsf-tool__site .dsf-btn { white-space: nowrap; border-radius: var(--dsf-radius-pill); }
.dsf-tool__brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--dsf-hit-target);
  gap: var(--dsf-space-2);
  min-height: var(--dsf-hit-target);
  padding-inline: var(--dsf-space-1) var(--dsf-space-2);
  border-radius: var(--dsf-radius-pill);
  color: var(--dsf-text);
  text-decoration: none;
  transition: background-color var(--dsf-motion-fast) var(--dsf-ease-standard);
}
.dsf-tool__brand:hover { background: var(--dsf-fill); }
.dsf-tool__brand img { width: 32px; height: 32px; flex: none; border-radius: var(--dsf-radius-pill); }
.dsf-tool__brand svg { display: block; width: auto; height: 20px; }
.dsf-tool__about-toggle {
  display: grid;
  place-items: center;
  flex: none;
  width: var(--dsf-hit-target);
  height: var(--dsf-hit-target);
  padding: 0;
  border: 0;
  border-radius: var(--dsf-radius-pill);
  background: none;
  color: var(--dsf-text-secondary);
  font: inherit;
  font-size: var(--dsf-text-body-lg);
  cursor: pointer;
  transition: background-color var(--dsf-motion-fast) var(--dsf-ease-standard);
}
.dsf-tool__about-toggle:hover { background: var(--dsf-fill); color: var(--dsf-text); }
.dsf-tool__about-toggle:active,
.dsf-tool__brand:active { background: var(--dsf-fill-pressed); }

/* «©»: privacidad, licencias y autoría. */
.dsf-tool__about {
  position: fixed;
  inset: auto;
  inset-block-start: calc(var(--dsf-tool-header-h) + var(--dsf-space-1));
  inset-inline-end: var(--dsf-gutter);
  margin: 0;
  width: min(320px, calc(100vw - 2 * var(--dsf-gutter)));
  max-height: calc(100dvh - 64px);
  overflow: auto;
  padding: var(--dsf-space-5);
  border: 1px solid var(--dsf-separator);
  border-radius: var(--dsf-radius-lg);
  background: var(--dsf-surface-elevated);
  color: var(--dsf-text-secondary);
  box-shadow: var(--dsf-shadow-3);
  font-size: var(--dsf-text-footnote);
}
.dsf-tool__about:popover-open { display: grid; gap: var(--dsf-space-3); }
.dsf-tool__about::backdrop { background: transparent; }
.dsf-tool__about p { margin: 0; }
.dsf-tool__about a:not(.dsf-btn) { color: var(--dsf-text); text-underline-offset: 3px; }
.dsf-tool__about a:not(.dsf-btn):hover { color: var(--dsf-link-hover); }
/* En pantallas estrechas los botones que no caben en la cabecera aparecen aquí. */
.dsf-tool__about-site { display: none; gap: var(--dsf-space-2); padding-bottom: var(--dsf-space-3); border-bottom: 1px solid var(--dsf-separator); }
.dsf-tool__about-site .dsf-btn { justify-content: center; width: 100%; }
.dsf-tool__links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: var(--dsf-space-5);
}
.dsf-tool__links > a,
.dsf-tool__links > details > summary { display: inline-flex; align-items: center; min-height: var(--dsf-hit-target); }
.dsf-tool__links > details > summary { gap: var(--dsf-space-2); cursor: pointer; color: var(--dsf-text); list-style: none; }
.dsf-tool__links > details > summary::-webkit-details-marker { display: none; }
.dsf-tool__links > details > summary::before {
  content: "";
  border-block: 4px solid transparent;
  border-inline-start: 6px solid currentColor;
  transition: transform var(--dsf-motion-fast);
}
.dsf-tool__links > details[open] > summary::before { transform: rotate(90deg); }
.dsf-tool__links > details[open] > summary:dir(rtl)::before { transform: rotate(-90deg); }
.dsf-tool__links > details[open] { flex-basis: 100%; order: 1; }
.dsf-tool__links > details > div { margin-bottom: var(--dsf-space-2); }
.dsf-tool__links > details > div p + p { margin-top: var(--dsf-space-2); }

/* Con ratón la cápsula es baja (28 px por botón, como D-003); en táctil
   conserva los 44 px de objetivo. */
@media (pointer: fine) {
  .dsf-tool__site .dsf-btn { min-height: 28px; padding-block: 0; }
  .dsf-tool__site .dsf-tool__brand { min-width: 28px; min-height: 28px; padding-inline-start: 0; }
  .dsf-tool__site .dsf-tool__brand img { width: 26px; height: 26px; }
  .dsf-tool__site .dsf-tool__about-toggle { width: 28px; height: 28px; }
}

@media (max-width: 1099px) {
  .dsf-tool__link { display: none; }
  .dsf-tool__about-site { display: grid; }
}
@media (max-width: 767px) {
  .dsf-tool__header { gap: var(--dsf-space-2); }
  .dsf-tool__subtitle { display: none; }
  .dsf-tool__actions .dsf-btn { padding-inline: var(--dsf-space-2); }
  /* En el móvil la marca se queda en Desfi y «Crea tu web» pasa a «©». */
  .dsf-tool__cta, .dsf-tool__site .dsf-tool__brand svg { display: none; }
  .dsf-tool__site .dsf-tool__brand { padding-inline: 0; }
}
/* Brand guide: below legible size, Desfi alone represents the signature. */
@media (max-width: 359px) {
  .dsf-tool__brand svg { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .dsf-tool__about-toggle, .dsf-tool__brand { transition: none; }
}
/* La línea bajo la cabecera sigue al scroll, no es movimiento: se mantiene aunque la
   herramienta apague todas sus animaciones con movimiento reducido (* { animation: none !important }). */
@media (prefers-reduced-motion: reduce) { @supports (animation-timeline: scroll()) {
  .dsf-tool .dsf-tool__header { animation: dsf-tool-header-stuck linear both !important; animation-timeline: scroll() !important; animation-range: 0 8px !important; }
} }

/* ============================================================
   Marca de rotulador · .dsf-mark
   Resaltado de texto en línea. Variantes semánticas para diferencias
   (insert/delete) y de acento. --sweep lo dibuja de izquierda a derecha;
   --dsf-mark-delay escalona varias marcas. Sin movimiento con
   prefers-reduced-motion.
   ============================================================ */
.dsf-mark {
  --dsf-mark-ink: var(--dsf-accent);
  --dsf-mark-tint: color-mix(in srgb, var(--dsf-mark-ink) 16%, transparent);
  padding-inline: 2px;
  border-radius: calc(var(--dsf-radius-xs) / 2);
  color: inherit;
  background-image: linear-gradient(var(--dsf-mark-tint), var(--dsf-mark-tint));
  background-repeat: no-repeat;
  background-position: 0 70%;
  background-size: 100% 100%;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
.dsf-mark--insert { --dsf-mark-ink: var(--dsf-success); color: var(--dsf-success-text); text-decoration: none; }
.dsf-mark--delete { --dsf-mark-ink: var(--dsf-danger); --dsf-mark-tint: color-mix(in srgb, var(--dsf-danger) 14%, transparent); color: var(--dsf-danger-text); text-decoration: line-through; text-decoration-thickness: 1.5px; }
.dsf-mark--sweep { animation: dsf-mark-sweep .55s var(--dsf-mark-delay, 0s) cubic-bezier(.3, .7, .2, 1) both; }
.dsf-mark--sweep-alt { animation: dsf-mark-sweep-alt .55s var(--dsf-mark-delay, 0s) cubic-bezier(.3, .7, .2, 1) both; }
@keyframes dsf-mark-sweep { from { background-size: 0% 100%; } }
@keyframes dsf-mark-sweep-alt { from { background-size: 0% 100%; } }
@media (prefers-reduced-motion: reduce) { .dsf-mark--sweep, .dsf-mark--sweep-alt { animation: none; } }
@media (prefers-contrast: more) { .dsf-mark { background-image: none; text-decoration: underline; text-decoration-thickness: 2px; } .dsf-mark--delete { text-decoration: line-through; } }
