/*!
 * TemaDesAny para Documenso 1.0 (Digital DesAny): sign.digitaldesany.com con el sistema de
 * diseño de digitaldesany.com, el mismo que TemaDesAny en FacturaScripts.
 *
 * Solo CSS sobre el HTML de Documenso 2.19: no cambia ni una clase ni un elemento. Lo carga
 * Nginx Proxy Manager al servir cada página (npm/sign.conf), sin tocar el contenedor.
 *
 * Cómo está hecho:
 * - Documenso pinta casi todo con variables (Tailwind y shadcn/ui: --background, --primary...,
 *   en tripletes HSL). Aquí se redefinen con los colores de la marca, en claro y en oscuro, y
 *   con eso cambia toda la aplicación. Es lo que más aguanta una actualización de Documenso.
 * - Lo que Documenso pinta con colores fijos (su verde, el fondo de rayas del acceso, el logo)
 *   se sustituye con selectores concretos. Los que dependen de clases de Documenso están
 *   marcados con «depende de» y los comprueba local/pruebas/tema.py.
 * - El modo lo decide Documenso (menú de usuario > Tema: claro, oscuro o sistema): pone la
 *   clase dark en <html>. Las piezas que Documenso fuerza en claro llevan .dark-mode-disabled.
 *
 * Orden: fuentes, tokens (claro y oscuro), variables de Documenso, base, marca, cabecera,
 * botones, campos, tarjetas y tablas, capas, colores fijos de Documenso, acceso, firma,
 * móvil, movimiento reducido e impresión.
 */

/* 0. Fuentes ------------------------------------------------------------------------------ */
/* Las de la marca (las mismas de TemaDesAny), servidas desde el propio sign.digitaldesany.com.
   Un archivo por alfabeto cubre todos los pesos. */
@font-face {
    font-family: "Bricolage Grotesque";
    font-style: normal;
    font-display: swap;
    font-weight: 200 800;
    src: url("fonts/bricolage-grotesque-latin-wght.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: "Bricolage Grotesque";
    font-style: normal;
    font-display: swap;
    font-weight: 200 800;
    src: url("fonts/bricolage-grotesque-latin-ext-wght.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: "Onest";
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url("fonts/onest-latin-wght.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: "Onest";
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url("fonts/onest-latin-ext-wght.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: "IBM Plex Mono";
    font-style: normal;
    font-display: swap;
    font-weight: 400;
    src: url("fonts/ibm-plex-mono-latin-400.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: "IBM Plex Mono";
    font-style: normal;
    font-display: swap;
    font-weight: 400;
    src: url("fonts/ibm-plex-mono-latin-ext-400.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: "IBM Plex Mono";
    font-style: normal;
    font-display: swap;
    font-weight: 500;
    src: url("fonts/ibm-plex-mono-latin-500.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: "IBM Plex Mono";
    font-style: normal;
    font-display: swap;
    font-weight: 500;
    src: url("fonts/ibm-plex-mono-latin-ext-500.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* 1. Tokens de la marca --------------------------------------------------------------------- */
/* Comunes a los dos modos. Los nombres y valores son los de TemaDesAny (FacturaScripts). */
html:root {
    --dda-font-display: "Bricolage Grotesque", system-ui, sans-serif;
    --dda-font-body: "Onest", system-ui, sans-serif;
    --dda-font-mono: "IBM Plex Mono", ui-monospace, monospace;
    --dda-fs-overline: 0.6875rem;
    --dda-tracking-tight: -0.02em;
    --dda-tracking-wide: 0.06em;
    --dda-tracking-wider: 0.12em;
    --dda-radius-md: 10px;
    --dda-radius-lg: 16px;
    --dda-radius-full: 999px;
    --dda-facet-cut: 22px;
    --dda-ease: cubic-bezier(.22, .61, .36, 1);
    --dda-fast: 150ms;
    --dda-normal: 280ms;

    /* Fondo facetado: las seis figuras de FacetFieldBackground (web), con su sitio, tamaño, giro y
       opacidad. Cada SVG lleva el giro dentro, con margen para no recortarse; de ahí los px que
       se restan a cada posición. */
    --dda-facetas-tam: 653px 653px, 398px 398px, 483px 483px, 312px 312px, 241px 241px, 185px 185px;
    --dda-facetas-pos:
        calc(-10vw - 97px) calc(-14vh - 97px),
        calc(76vw - 59px) calc(4vh - 59px),
        calc(-8vw - 71px) calc(58vh - 71px),
        calc(82vw - 46px) calc(80vh - 46px),
        calc(46vw - 36px) calc(32vh - 36px),
        calc(30vw - 27px) calc(68vh - 27px);
    --dda-facetas-oscuro:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-21 -21 142 142'%3E%3Cg transform='rotate%2812 50 50%29' opacity='0.16' fill='none' stroke='%238b5cf6' stroke-width='1'%3E%3Cpath d='M20 15H55L75 25L85 50L75 75L55 85H20Z'/%3E%3Cpath d='M38 50L20 15M38 50L55 15M38 50L75 25M38 50H85M38 50L75 75M38 50L55 85M38 50L20 85'/%3E%3C/g%3E%3C/svg%3E"),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-21 -21 142 142'%3E%3Cg transform='rotate%28-22 50 50%29' opacity='0.14' fill='none' stroke='%2322d3ee' stroke-width='1'%3E%3Cpath d='M20 15H55L75 25L85 50L75 75L55 85H20Z'/%3E%3Cpath d='M38 50L20 15M38 50L55 15M38 50L75 25M38 50H85M38 50L75 75M38 50L55 85M38 50L20 85'/%3E%3C/g%3E%3C/svg%3E"),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-21 -21 142 142'%3E%3Cg transform='rotate%2838 50 50%29' opacity='0.14' fill='none' stroke='%23f472b6' stroke-width='1'%3E%3Cpath d='M20 15H55L75 25L85 50L75 75L55 85H20Z'/%3E%3Cpath d='M38 50L20 15M38 50L55 15M38 50L75 25M38 50H85M38 50L75 75M38 50L55 85M38 50L20 85'/%3E%3C/g%3E%3C/svg%3E"),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-21 -21 142 142'%3E%3Cg transform='rotate%28-10 50 50%29' opacity='0.16' fill='none' stroke='%237275f3' stroke-width='1'%3E%3Cpath d='M20 15H55L75 25L85 50L75 75L55 85H20Z'/%3E%3Cpath d='M38 50L20 15M38 50L55 15M38 50L75 25M38 50H85M38 50L75 75M38 50L55 85M38 50L20 85'/%3E%3C/g%3E%3C/svg%3E"),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-21 -21 142 142'%3E%3Cg transform='rotate%2864 50 50%29' opacity='0.1' fill='none' stroke='%238b5cf6' stroke-width='1'%3E%3Cpath d='M20 15H55L75 25L85 50L75 75L55 85H20Z'/%3E%3Cpath d='M38 50L20 15M38 50L55 15M38 50L75 25M38 50H85M38 50L75 75M38 50L55 85M38 50L20 85'/%3E%3C/g%3E%3C/svg%3E"),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-21 -21 142 142'%3E%3Cg transform='rotate%28-35 50 50%29' opacity='0.09' fill='none' stroke='%2322d3ee' stroke-width='1'%3E%3Cpath d='M20 15H55L75 25L85 50L75 75L55 85H20Z'/%3E%3Cpath d='M38 50L20 15M38 50L55 15M38 50L75 25M38 50H85M38 50L75 75M38 50L55 85M38 50L20 85'/%3E%3C/g%3E%3C/svg%3E");
    --dda-facetas-claro:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-21 -21 142 142'%3E%3Cg transform='rotate%2812 50 50%29' opacity='0.16' fill='none' stroke='%237c3aed' stroke-width='1'%3E%3Cpath d='M20 15H55L75 25L85 50L75 75L55 85H20Z'/%3E%3Cpath d='M38 50L20 15M38 50L55 15M38 50L75 25M38 50H85M38 50L75 75M38 50L55 85M38 50L20 85'/%3E%3C/g%3E%3C/svg%3E"),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-21 -21 142 142'%3E%3Cg transform='rotate%28-22 50 50%29' opacity='0.14' fill='none' stroke='%230891b2' stroke-width='1'%3E%3Cpath d='M20 15H55L75 25L85 50L75 75L55 85H20Z'/%3E%3Cpath d='M38 50L20 15M38 50L55 15M38 50L75 25M38 50H85M38 50L75 75M38 50L55 85M38 50L20 85'/%3E%3C/g%3E%3C/svg%3E"),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-21 -21 142 142'%3E%3Cg transform='rotate%2838 50 50%29' opacity='0.14' fill='none' stroke='%23db2777' stroke-width='1'%3E%3Cpath d='M20 15H55L75 25L85 50L75 75L55 85H20Z'/%3E%3Cpath d='M38 50L20 15M38 50L55 15M38 50L75 25M38 50H85M38 50L75 75M38 50L55 85M38 50L20 85'/%3E%3C/g%3E%3C/svg%3E"),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-21 -21 142 142'%3E%3Cg transform='rotate%28-10 50 50%29' opacity='0.16' fill='none' stroke='%234f46e5' stroke-width='1'%3E%3Cpath d='M20 15H55L75 25L85 50L75 75L55 85H20Z'/%3E%3Cpath d='M38 50L20 15M38 50L55 15M38 50L75 25M38 50H85M38 50L75 75M38 50L55 85M38 50L20 85'/%3E%3C/g%3E%3C/svg%3E"),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-21 -21 142 142'%3E%3Cg transform='rotate%2864 50 50%29' opacity='0.1' fill='none' stroke='%237c3aed' stroke-width='1'%3E%3Cpath d='M20 15H55L75 25L85 50L75 75L55 85H20Z'/%3E%3Cpath d='M38 50L20 15M38 50L55 15M38 50L75 25M38 50H85M38 50L75 75M38 50L55 85M38 50L20 85'/%3E%3C/g%3E%3C/svg%3E"),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-21 -21 142 142'%3E%3Cg transform='rotate%28-35 50 50%29' opacity='0.09' fill='none' stroke='%230891b2' stroke-width='1'%3E%3Cpath d='M20 15H55L75 25L85 50L75 75L55 85H20Z'/%3E%3Cpath d='M38 50L20 15M38 50L55 15M38 50L75 25M38 50H85M38 50L75 75M38 50L55 85M38 50L20 85'/%3E%3C/g%3E%3C/svg%3E");
}

/* Claro: el [data-theme="light"] del sistema de diseño. También para lo que Documenso fuerza en
   claro dentro del modo oscuro (.dark-mode-disabled: los campos sobre el PDF). */
html:root,
html .dark-mode-disabled {
    color-scheme: light;
    --dda-bg: #faf9fc;
    --dda-surface: #ffffff;
    --dda-raised: #f1eff8;
    --dda-line: #e3e0ee;
    --dda-line-strong: #c8c3dc;
    --dda-field-line: #b9b3d0;
    --dda-ink: #171522;
    --dda-ink-2: #454154;
    --dda-ink-3: #68647c;
    --dda-violet: #7c3aed;
    --dda-indigo: #4f46e5;
    --dda-magenta: #db2777;
    --dda-cyan: #0891b2;
    --dda-ok: #0f766e;
    --dda-warn: #b45309;
    --dda-bad: #be123c;
    --dda-on-accent: #ffffff;
    --dda-violet-text: #6d28d9;
    --dda-ok-text: #115e59;
    --dda-ok-tint: #e3f5f2;
    --dda-violet-tint: #ede9fe;
    --dda-field: #ffffff;
    --dda-hover: rgba(23, 21, 34, .04);
    --dda-shadow-1: 0 1px 2px rgba(23, 21, 34, .06), 0 2px 8px rgba(23, 21, 34, .05);
    --dda-shadow-2: 0 6px 20px rgba(23, 21, 34, .08), 0 16px 48px rgba(23, 21, 34, .08);
    --dda-bar: rgba(250, 249, 252, .85);
    --dda-mix: black;
    --dda-facetas: var(--dda-facetas-claro);
}

/* Oscuro: el de la marca y el de la web. */
html.dark:not(.dark-mode-disabled) {
    color-scheme: dark;
    --dda-bg: #0b0b10;
    --dda-surface: #131319;
    --dda-raised: #1b1b24;
    --dda-line: #26262f;
    --dda-line-strong: #3a3a46;
    --dda-field-line: #464654;
    --dda-ink: #f4f4f7;
    --dda-ink-2: #a4a4b0;
    --dda-ink-3: #8a8a97;
    --dda-violet: #8b5cf6;
    --dda-indigo: #7275f3;
    --dda-magenta: #f472b6;
    --dda-cyan: #22d3ee;
    --dda-ok: #2dd4bf;
    --dda-warn: #fbbf24;
    --dda-bad: #fb7185;
    --dda-on-accent: #0b0b10;
    --dda-violet-text: #9a78fa;
    --dda-ok-text: #61dbc8;
    --dda-ok-tint: rgba(45, 212, 191, .1);
    --dda-violet-tint: rgba(139, 92, 246, .16);
    --dda-field: #0f0f15;
    --dda-hover: rgba(244, 244, 247, .05);
    --dda-shadow-1: 0 1px 2px rgba(0, 0, 0, .5), 0 2px 10px rgba(0, 0, 0, .35);
    --dda-shadow-2: 0 6px 20px rgba(0, 0, 0, .4), 0 16px 48px rgba(0, 0, 0, .35);
    --dda-bar: rgba(11, 11, 16, .82);
    --dda-mix: white;
    --dda-facetas: var(--dda-facetas-oscuro);
}

/* La línea aurora: de cian a magenta. Solo como línea, nunca como relleno (sistema de diseño). */
html:root {
    --dda-aurora: linear-gradient(120deg, var(--dda-cyan), var(--dda-indigo), var(--dda-violet), var(--dda-magenta));
}

/* 2. Variables de Documenso ---------------------------------------------------------------- */
/* Tripletes HSL de los mismos colores (Tailwind los usa como hsl(var(--x) / alfa)). Más
   específicos que los de Documenso (:root y .dark:not(.dark-mode-disabled)), ganan en
   cualquier orden. Las equivalencias:
   background = fondo, card y popover = superficie, muted, secondary y accent = elevado,
   border = línea, input = borde de campo, primary = violeta, ring = cian (foco),
   destructive = rosa, warning = ámbar, muted-foreground = texto secundario. */
html:root,
html .dark-mode-disabled {
    --font-sans: "Onest";
    --background: 260 33.3% 98.2%;
    --foreground: 249.2 23.6% 10.8%;
    --muted: 253.3 39.1% 95.5%;
    --muted-foreground: 250 10.7% 43.9%;
    --popover: 0 0% 100%;
    --popover-foreground: 249.2 23.6% 10.8%;
    --card: 0 0% 100%;
    --card-border: 252.9 29.2% 90.6%;
    --card-border-tint: 124 58 237;
    --card-foreground: 249.2 23.6% 10.8%;
    --field-card: 251.4 91.3% 95.5%;
    --field-card-border: 262.1 83.3% 57.8%;
    --field-card-foreground: 249.2 23.6% 10.8%;
    --widget: 253.3 39.1% 95.5%;
    --widget-foreground: 252.9 29.2% 90.6%;
    --border: 252.9 29.2% 90.6%;
    --input: 252.4 23.6% 75.9%;
    --primary: 262.1 83.3% 57.8%;
    --primary-foreground: 0 0% 100%;
    --secondary: 253.3 39.1% 95.5%;
    --secondary-foreground: 249.2 23.6% 10.8%;
    --accent: 253.3 39.1% 95.5%;
    --accent-foreground: 249.2 23.6% 10.8%;
    --destructive: 345.3 82.7% 40.8%;
    --destructive-foreground: 0 0% 100%;
    --ring: 191.6 91.4% 36.5%;
    --radius: .625rem;
    --warning: 26 90.5% 37.1%;
}

html.dark:not(.dark-mode-disabled) {
    --background: 240 18.5% 5.3%;
    --foreground: 240 15.8% 96.3%;
    --muted: 240 14.3% 12.4%;
    --muted-foreground: 240 7.1% 66.7%;
    --popover: 240 13.6% 8.6%;
    --popover-foreground: 240 15.8% 96.3%;
    --card: 240 13.6% 8.6%;
    --card-border: 240 10.6% 16.7%;
    --card-border-tint: 139 92 246;
    --card-foreground: 240 15.8% 96.3%;
    --widget: 240 13.6% 8.6%;
    --widget-foreground: 240 14.3% 12.4%;
    --border: 240 10.6% 16.7%;
    --input: 240 9.1% 30.2%;
    --field-border: 252.9 29.2% 90.6%;
    --primary: 258.3 89.5% 66.3%;
    --primary-foreground: 240 18.5% 5.3%;
    --secondary: 240 14.3% 12.4%;
    --secondary-foreground: 240 15.8% 96.3%;
    --accent: 240 14.3% 12.4%;
    --accent-foreground: 240 15.8% 96.3%;
    --destructive: 351.3 94.5% 71.4%;
    --destructive-foreground: 240 18.5% 5.3%;
    --ring: 187.9 85.7% 53.3%;
    --radius: .625rem;
    --warning: 43.3 96.4% 56.3%;
    --envelope-editor-background: 240 18.5% 5.3%;
}

/* 3. Base ----------------------------------------------------------------------------------- */
/* El fondo va en <html> y el <body> queda transparente: así se ve el fondo facetado (detrás de
   todo, fijo) en las pantallas que no ponen el suyo. */
html:root {
    background-color: var(--dda-bg);
    scrollbar-color: var(--dda-line-strong) transparent;
}

html body {
    background-color: transparent;
    font-family: var(--dda-font-body);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-variant-numeric: tabular-nums;
}

/* El fondo de la web (FacetFieldBackground): las figuras facetadas del logo, en línea, muy
   tenues y quietas. Sin eventos: no estorba a nada. */
html body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background-image: var(--dda-facetas);
    background-repeat: no-repeat;
    background-size: var(--dda-facetas-tam);
    background-position: var(--dda-facetas-pos);
}

/* Títulos en la tipografía de los titulares de la web. */
html :is(h1, h2, h3, h4) {
    font-family: var(--dda-font-display);
    letter-spacing: -0.01em;
}

html h1 {
    letter-spacing: var(--dda-tracking-tight);
}

html :is(code, kbd, pre, samp) {
    font-family: var(--dda-font-mono);
}

html ::selection {
    background: var(--dda-violet);
    color: #fff;
}

/* En oscuro, el violeta de los enlaces y textos en color sube un punto: el de la web para texto
   pequeño (más de 5:1 sobre todas las superficies). */
html.dark:not(.dark-mode-disabled) :is(.text-primary, .hover\:text-primary:hover) {
    color: var(--dda-violet-text);
}

/* Textos tenues de Documenso (su gris con transparencia: 2,5:1 en claro): el gris tenue de la
   marca, que llega a 4,5:1 sobre todas las superficies, como en FacturaScripts. */
html :is(.text-muted-foreground\/60, .text-muted-foreground\/70, .text-muted-foreground\/80, .text-foreground\/50) {
    color: var(--dda-ink-3);
}

html.dark:not(.dark-mode-disabled) :is(.dark\:text-muted-foreground\/60, .dark\:text-muted-foreground\/70) {
    color: var(--dda-ink-3);
}

/* El número de resultados de cada grupo del buscador (Ctrl+K), atenuado con opacidad. */
html [cmdk-root] .font-normal.opacity-60 {
    opacity: 1;
    color: var(--dda-ink-3);
}

/* Iniciales en amarillo (el color de un destinatario): un punto más oscuras. */
html .bg-yellow-200.text-yellow-700 {
    color: #854d0e;
}

html ::-webkit-scrollbar-thumb {
    border-radius: var(--dda-radius-full);
}

/* 4. Marca ---------------------------------------------------------------------------------- */
/* Documenso pinta su logo como un SVG en línea con estas medidas (depende de: viewBox del logo
   y del icono). Se vacía y lleva de fondo el de Digital DesAny (isotipo y nombre, en trazos),
   con su proporción. El «Powered by Documenso» de la página de firma se queda como está: es
   un enlace a Documenso y se quita, si se quiere, desde su administración (README). */
html svg[viewBox="0 0 2248 320"]:not(a[href^="https://documenso.com"] *) {
    aspect-ratio: 6.066 / 1;
    background: url("img/marca-claro.svg") left center / contain no-repeat;
}

html.dark:not(.dark-mode-disabled) svg[viewBox="0 0 2248 320"]:not(a[href^="https://documenso.com"] *) {
    background-image: url("img/marca-oscuro.svg");
}

html svg[viewBox="0 0 84 84"] {
    aspect-ratio: 65 / 70;
    background: url("img/isotipo.svg") center / contain no-repeat;
}

html svg[viewBox="0 0 2248 320"]:not(a[href^="https://documenso.com"] *) > *,
html svg[viewBox="0 0 84 84"] > * {
    visibility: hidden;
}

/* 5. Cabecera ------------------------------------------------------------------------------- */
/* Como la de la web: traslúcida sobre el fondo, con desenfoque y una línea debajo. */
html header.sticky.top-0,
html nav.embed--DocumentWidgetHeader {
    border-bottom: 1px solid var(--dda-line);
    background-color: var(--dda-bar);
    -webkit-backdrop-filter: saturate(140%) blur(12px);
    backdrop-filter: saturate(140%) blur(12px);
}

/* Menú principal (Documentos, Plantillas): el de la web, en mono y mayúsculas, con la línea
   aurora bajo el apartado abierto (depende de: .items-baseline > a, y .text-foreground en el
   activo). */
html header .items-baseline > a,
html.dark:not(.dark-mode-disabled) header .items-baseline > a {
    position: relative;
    padding-block: .375rem;
    font-family: var(--dda-font-mono);
    font-size: .75rem;
    font-weight: 400;
    letter-spacing: var(--dda-tracking-wide);
    text-transform: uppercase;
    color: var(--dda-ink-3);
}

/* (la segunda línea de cada regla gana a la clase con la que Documenso los atenúa en oscuro) */
html header .items-baseline > a:is(:hover, .text-foreground),
html.dark:not(.dark-mode-disabled) header .items-baseline > a:is(:hover, .text-foreground) {
    opacity: 1;
    color: var(--dda-ink);
}

html header .items-baseline > a::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -2px;
    height: 2px;
    background: var(--dda-aurora);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--dda-normal) var(--dda-ease);
}

html header .items-baseline > a:hover::after {
    transform: scaleX(.35);
}

html header .items-baseline > a.text-foreground::after {
    transform: scaleX(1);
}

/* 6. Botones -------------------------------------------------------------------------------- */
/* Los de la web: tipografía de titulares y radio de 10px (depende de: las clases base del
   Button de Documenso). */
html .ring-offset-background.transition-colors[class*="disabled:pointer-events-none"]:is(button, a) {
    font-family: var(--dda-font-display);
    font-weight: 600;
    letter-spacing: -0.005em;
}

/* Los rellenos de la acción principal llevan el halo de su color, como en la web. */
html .bg-primary.text-primary-foreground:is(button, a) {
    box-shadow: 0 6px 18px -8px color-mix(in oklch, hsl(var(--primary)) 70%, transparent);
}

html .bg-primary.text-primary-foreground:is(button, a):hover {
    background-color: color-mix(in oklch, hsl(var(--primary)) 85%, var(--dda-mix));
    box-shadow: 0 8px 24px -8px color-mix(in oklch, hsl(var(--primary)) 85%, transparent);
}

html .bg-destructive.text-destructive-foreground:is(button, a):hover {
    background-color: color-mix(in oklch, hsl(var(--destructive)) 85%, var(--dda-mix));
}

html :is(button, a):active:not(:disabled).ring-offset-background.transition-colors[class*="disabled:pointer-events-none"] {
    transform: scale(.98);
}

/* 7. Campos --------------------------------------------------------------------------------- */
/* Con caja, como la calculadora de la web. */
html :is(input, textarea).border-input,
html button[role="combobox"].border-input {
    background-color: var(--dda-field);
    transition: border-color var(--dda-fast) var(--dda-ease), background-color var(--dda-fast) var(--dda-ease);
}

html :is(input, textarea).border-input:hover:not(:disabled):not(:focus) {
    border-color: var(--dda-ink-3);
}

/* Al enfocar un campo: borde y halo violeta, pegado (como en FacturaScripts), en lugar del anillo
   separado que Documenso pone a todo. Los botones siguen con el anillo cian. */
html :is(input, textarea).border-input:focus,
html button[role="combobox"].border-input:focus-visible {
    border-color: var(--dda-violet);
    --tw-ring-color: color-mix(in oklch, var(--dda-violet) 35%, transparent);
    --tw-ring-offset-width: 0px;
}

html :is(input, textarea)::placeholder {
    color: var(--dda-ink-3);
    opacity: .75;
}

html label {
    color: var(--dda-ink);
}

/* Casillas y radios marcados: el violeta, ya con --primary. */

/* 8. Tarjetas, tablas y listas ------------------------------------------------------------- */
/* Tarjetas de Documenso (depende de: Card, «group relative border-2 bg-background
   text-foreground»): superficie con una línea fina, sin el halo gris de Documenso. */
html .group.relative.border-2.bg-background.text-foreground {
    border-width: 1px;
    border-color: var(--dda-line);
    background-color: var(--dda-surface);
    box-shadow: none;
}

/* Contenedores con borde (tablas, paneles): la superficie de la marca debajo. */
html .rounded-md.border:has(> .overflow-auto > table),
html .rounded-lg.border:has(> .overflow-auto > table) {
    border-color: var(--dda-line);
    background-color: var(--dda-surface);
}

/* Cabeceras de tabla: mono, mayúsculas y gris tenue, como en la web. */
html thead th {
    font-family: var(--dda-font-mono);
    font-size: var(--dda-fs-overline);
    font-weight: 400;
    letter-spacing: var(--dda-tracking-wider);
    text-transform: uppercase;
    color: var(--dda-ink-3);
}

/* 9. Capas: menús, diálogos y avisos -------------------------------------------------------- */
html :is([role="menu"], [role="listbox"], [data-radix-popper-content-wrapper] > div) {
    border-color: var(--dda-line);
    box-shadow: var(--dda-shadow-2);
}

html [role="dialog"],
html [role="alertdialog"] {
    border-color: var(--dda-line);
    box-shadow: var(--dda-shadow-2);
}

html [role="dialog"] h2,
html [role="alertdialog"] h2 {
    font-family: var(--dda-font-display);
    font-weight: 650;
}

/* 10. Colores fijos de Documenso ------------------------------------------------------------ */
/* Su verde de marca, que no pasa por las variables: el violeta de la nuestra. */
html .bg-documenso,
html.dark:not(.dark-mode-disabled) .dark\:bg-documenso {
    background-color: var(--dda-violet);
}

html .text-documenso {
    color: var(--dda-violet-text);
}

html .bg-documenso-200 {
    background-color: #ede9fe;
}

html .border-documenso-300 {
    border-color: #c4b5fd;
}

html .text-documenso-700,
html .hover\:text-documenso-600:hover {
    color: #6d28d9;
}

html .text-documenso-800 {
    color: #5b21b6;
}

html .text-documenso-900 {
    color: #4c1d95;
}

/* En oscuro, fuera de lo que Documenso fuerza en claro: los enlaces en su verde oscuro pasan al
   violeta para texto y los tintes claros, al tinte violeta del modo oscuro. */
html.dark:not(.dark-mode-disabled) :is(.text-documenso-700, .hover\:text-documenso-600:hover):not(.dark-mode-disabled *) {
    color: var(--dda-violet-text);
}

html.dark:not(.dark-mode-disabled) .bg-documenso-200:not(.dark-mode-disabled *) {
    background-color: var(--dda-violet-tint);
}

html.dark:not(.dark-mode-disabled) .bg-documenso-200:not(.dark-mode-disabled *) :is(.text-documenso-800, .text-documenso-900),
html.dark:not(.dark-mode-disabled) :is(.text-documenso-800, .text-documenso-900).bg-documenso-200:not(.dark-mode-disabled *) {
    color: var(--dda-violet-text);
}

/* El apartado abierto del menú de ajustes (verde fijo en Documenso): el tinte violeta con la
   barra a la izquierda, como las pestañas de las fichas de FacturaScripts. */
html :is(.bg-\[\#F1FBEA\], .hover\:bg-\[\#F1FBEA\]:hover) {
    background-color: var(--dda-violet-tint);
    box-shadow: inset 2px 0 0 var(--dda-violet);
}

html.dark:not(.dark-mode-disabled) :is(.dark\:bg-\[\#1C2515\], .dark\:hover\:bg-\[\#1C2515\]:hover) {
    background-color: var(--dda-violet-tint);
}

html.dark:not(.dark-mode-disabled) :is(.dark\:text-\[\#F1FBEA\], .dark\:hover\:text-\[\#F1FBEA\]:hover) {
    color: var(--dda-ink);
}

/* El verde de «hecho» (firmado, completado, el papel de firmante): el turquesa de la marca, el
   mismo de «cobrado» en FacturaScripts. */
html :is(.text-green-500, .text-green-600, .text-emerald-600) {
    color: var(--dda-ok);
}

html :is(.text-green-700, .text-green-800, .text-green-900, .text-emerald-700) {
    color: var(--dda-ok-text);
}

html :is(.bg-green-50, .bg-green-100, .bg-emerald-500\/10) {
    background-color: var(--dda-ok-tint);
}

html :is(.bg-green-500, .bg-green-600) {
    background-color: var(--dda-ok);
}

html :is(.border-green-200, .border-emerald-500) {
    border-color: color-mix(in oklch, var(--dda-ok) 45%, transparent);
}

html .ring-green-600\/20 {
    --tw-ring-color: color-mix(in oklch, var(--dda-ok) 30%, transparent);
}

html .stroke-green-600 {
    stroke: var(--dda-ok);
}

html.dark:not(.dark-mode-disabled) :is(.dark\:text-green-300, .dark\:text-green-400, .dark\:text-emerald-300, .dark\:text-emerald-400) {
    color: var(--dda-ok-text);
}

html.dark:not(.dark-mode-disabled) :is(.dark\:bg-green-400\/10, .dark\:bg-green-500\/10) {
    background-color: var(--dda-ok-tint);
}

html.dark:not(.dark-mode-disabled) .dark\:bg-green-400 {
    background-color: var(--dda-ok);
}

html.dark:not(.dark-mode-disabled) :is(.dark\:border-green-400\/30, .dark\:border-green-500\/20) {
    border-color: color-mix(in oklch, var(--dda-ok) 30%, transparent);
}

html.dark:not(.dark-mode-disabled) .dark\:ring-green-500\/20 {
    --tw-ring-color: color-mix(in oklch, var(--dda-ok) 25%, transparent);
}

/* El paso abierto del editor usa el mismo verde: ahí significa «estás aquí», así que violeta.
   Basta con cambiar los colores de «hecho» dentro del botón (depende de: data-testid). */
html button[data-testid^="envelope-editor-step-"] {
    --dda-ok: var(--dda-violet);
    --dda-ok-text: var(--dda-violet-text);
    --dda-ok-tint: var(--dda-violet-tint);
}

/* Barras de avance (editor y firma): la línea aurora. */
html .relative.h-\[4px\].bg-muted > .bg-primary {
    background: var(--dda-aurora);
}

/* Grises fijos de Tailwind, solo en claro (en oscuro Documenso ya pone los suyos): los neutros
   de la marca, que tiran a violeta. */
html:not(.dark) :is(.bg-gray-50, .bg-neutral-50, .bg-gray-100, .bg-neutral-100, .hover\:bg-gray-50:hover, .hover\:bg-gray-100:hover) {
    background-color: var(--dda-raised);
}

html:not(.dark) :is(.bg-gray-200, .bg-neutral-200) {
    background-color: var(--dda-line);
}

html:not(.dark) :is(.border-gray-100, .border-gray-200, .border-neutral-200, .hover\:border-gray-200:hover) {
    border-color: var(--dda-line);
}

html:not(.dark) :is(.border-gray-300, .border-neutral-300) {
    border-color: var(--dda-line-strong);
}

html:not(.dark) .divide-neutral-200 > :not([hidden]) ~ :not([hidden]) {
    border-color: var(--dda-line);
}

html:not(.dark) :is(.text-gray-400, .text-gray-500, .text-slate-500) {
    color: var(--dda-ink-3);
}

html:not(.dark) :is(.text-gray-600, .text-gray-700) {
    color: var(--dda-ink-2);
}

html:not(.dark) :is(.text-gray-800, .text-gray-900) {
    color: var(--dda-ink);
}

/* 11. Acceso (entrar, crear cuenta, contraseña olvidada...) --------------------------------- */
/* Es la entrada a la herramienta: como en FacturaScripts, el momento de la marca. Se reconoce
   por el fondo de rayas de Documenso (depende de: img[alt="background pattern"]). Ese fondo se
   quita en todas partes (acceso, errores y la tarjeta de «Documento firmado») para que se vea
   el facetado. Encima de la tarjeta, la marca. */
html img[alt="background pattern"] {
    display: none;
}

html main:has(> div > div > img[alt="background pattern"])::before {
    content: "";
    display: block;
    flex: none;
    width: 194px;
    height: 32px;
    margin-bottom: 2rem;
    background: url("img/marca-claro.svg") center / contain no-repeat;
}

html.dark:not(.dark-mode-disabled) main:has(> div > div > img[alt="background pattern"])::before {
    background-image: url("img/marca-oscuro.svg");
}

/* Crear cuenta: sin el panel de Documenso de la izquierda (su fundador y sus perfiles
   públicos; depende de: img[alt="community-cards"]). */
html main div:has(> div > img[alt="community-cards"]) {
    display: none;
}

/* (en crear cuenta, Documenso sube el formulario 4rem en pantallas grandes: la marca, otro tanto) */
@media (min-width: 1024px) {
    html main:has(> div > div > img[alt="background pattern"]):has(img[alt="community-cards"])::before {
        margin-bottom: 6rem;
    }
}

/* La tarjeta del formulario, la única con el corte facetado y la línea aurora arriba. */
html main:has(> div > div > img[alt="background pattern"]) .rounded-xl.border.border-border {
    border-width: 0;
    border-top: 2px solid;
    border-image: var(--dda-aurora) 1;
    border-radius: 0;
    background: var(--dda-surface);
    box-shadow: inset 0 0 0 1px var(--dda-line);
    clip-path: polygon(0 0, calc(100% - var(--dda-facet-cut)) 0, 100% var(--dda-facet-cut), 100% 100%, 0 100%);
}

html main:has(> div > div > img[alt="background pattern"]) .rounded-xl.border.border-border > h1 {
    font-size: clamp(1.75rem, 1.5rem + 1vw, 2.125rem);
    font-weight: 700;
    line-height: 1.1;
}

html main:has(> div > div > img[alt="background pattern"]) .rounded-xl.border.border-border > hr {
    border-color: var(--dda-line);
}

/* 12. Firma (lo que ve el cliente) ---------------------------------------------------------- */
/* Documenso deja clases embed--* en la página de firma para personalizarla: se usan aquí. */
html .embed--DocumentWidgetContainer {
    background-color: var(--dda-surface);
}

/* Alrededor del PDF: el fondo de la marca (las páginas siguen siendo blancas). */
html .min-h-screen.w-screen.bg-gray-50 {
    background-color: var(--dda-raised);
}

html.dark:not(.dark-mode-disabled) .min-h-screen.w-screen.bg-gray-50 {
    background-color: var(--dda-bg);
}

/* «Powered by Documenso»: discreto, con la superficie de la marca. */
html a[href^="https://documenso.com"].fixed {
    border-top: 1px solid var(--dda-line);
    border-left: 1px solid var(--dda-line);
    background-color: var(--dda-surface);
    color: var(--dda-ink-3);
    font-family: var(--dda-font-mono);
    letter-spacing: var(--dda-tracking-wide);
}

/* 13. Móvil --------------------------------------------------------------------------------- */
@media (max-width: 767px) {
    html main:has(> div > div > img[alt="background pattern"])::before {
        width: 160px;
        height: 28px;
        margin-bottom: 1.5rem;
    }
}

/* 14. Movimiento reducido e impresión ------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    html header .items-baseline > a::after {
        transition: none;
    }
}

@media print {
    html body::before {
        display: none;
    }
}
