/* ============================================================
   LC PAPER 1881 SA — LC CLOUD Design System
   Sharp edges (0 border-radius). Corporate green palette.
   Fonts: IBM Plex Sans (body + headings), Covered By Your Grace (accent).
   ============================================================ */

:root {
    color-scheme: light;
    /* LC CLOUD color palette */
    --forest: #003017;
    --mint: #c8e6d0;
    --tech-green: #00694e;
    --bg: #ffffff;
    --bg-alt: #f8f8f8;
    --sand: #faf8f5;
    --panel: #ffffff;
    --text: #333333;
    --text-secondary: #666666;
    --text-muted: #999999;
    --border: #cccccc;
    --border-light: #e5e5e5;
    /* Semantic */
    --danger: #c0392b;
    --danger-hover: #a93226;
    --warning: #f39c12;
    --success: #00694e;
    --info: #1e5f82;
    --info-hover: #2a7aa0;
    /* Neutral slate for table headers (deliberately distinct from --forest,
       which the top bar and primary button already own). */
    --table-head: #475569;
    /* Aliases for existing code references */
    --primary: #003017;
    --primary-hover: #00442a;
    --primary-light: #00694e;
    --accent: #00694e;
    --pastel: #c8e6d0;
    --surface: #f8f8f8;
    --upstream: #e7f0e3;
    --core: #e3ecf4;
    --downstream: #f4ece3;
    /* Shadows */
    --shadow-sm: 0 1px 4px rgba(0,0,0,.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,.08);
    /* Spacing */
    --sp-xs: 4px;
    --sp-sm: 8px;
    --sp-md: 16px;
    --sp-lg: 24px;
    --sp-xl: 40px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    color: var(--text);
    font-family: 'IBM Plex Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-weight: 400;
    font-size: 16px;
    line-height: 1.5;
    /* Flat neutral canvas (Bold Home redesign). The home hero and the
       coloured section cards provide the visual interest instead of a
       page-wide gradient. */
    background: var(--bg-alt);
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif;
}

/* ── Top bar ─────────────────────────────────── */
.topbar-dark {
    background: var(--forest);
    color: #fff;
    height: 64px;
    padding: 0 1.4rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    position: relative;
    z-index: 100;
    font-family: 'IBM Plex Sans', 'Inter', system-ui, sans-serif;
}
.brand-dark { display: flex; align-items: center; gap: .95rem; flex-shrink: 0; text-decoration: none; }
.brand-dark img { height: 38px; width: auto; object-fit: contain; filter: brightness(10); opacity: .9; }
.brand-separator { width: 1px; height: 26px; background: rgba(255,255,255,.22); flex-shrink: 0; }
.brand-dark h1 {
    margin: 0;
    font-family: 'IBM Plex Sans', 'Inter', system-ui, sans-serif;
    font-size: 1.296rem;
    font-weight: 300;
    color: var(--mint);
    letter-spacing: .03em;
    text-transform: uppercase;
    line-height: 1;
}
.topbar-right { display: flex; align-items: center; height: 100%; gap: .35rem; }
.nav-user-separator { width: 1px; height: 22px; align-self: center; background: rgba(255,255,255,.18); margin: 0 8px; flex-shrink: 0; }

/* Legacy plain nav links (kept for the secondary preview header) */
nav a:not(.nav-group-item):not(.nav-group-trigger):not(.lc-subnav-link) {
    text-decoration: none;
    color: rgba(255,255,255,.75);
    font-family: 'IBM Plex Sans', 'IBM Plex Sans', sans-serif;
    font-weight: 500;
    font-size: .82rem;
    padding: 0 .7rem;
    display: inline-flex;
    align-items: center;
    height: 100%;
    background: transparent;
    border-bottom: 3px solid transparent;
    transition: color .15s, border-color .15s, background .15s;
}
nav a:not(.nav-group-item):not(.nav-group-trigger):not(.lc-subnav-link):hover {
    color: #fff;
    background: rgba(255,255,255,.12);
    border-bottom-color: var(--mint);
}
nav a:not(.nav-group-item):not(.nav-group-trigger):not(.lc-subnav-link).active {
    color: #fff;
    background: rgba(255,255,255,.12);
    border-bottom-color: var(--tech-green);
}

/* ── Primary nav: two-group megamenu ─────────── */
.primary-nav { display: flex; gap: 4px; align-items: center; height: 100%; }

.nav-group {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}
.nav-group::after {
    content: '';
    position: absolute;
    left: 6px;
    right: 6px;
    bottom: 0;
    height: 3px;
    background: transparent;
    transition: background .15s ease;
    pointer-events: none;
}

.nav-group-trigger {
    background: transparent;
    border: none;
    color: rgba(255,255,255,.82);
    font-family: 'IBM Plex Sans', 'IBM Plex Sans', sans-serif;
    font-weight: 500;
    font-size: .82rem;
    padding: 0 .95rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    height: 100%;
    cursor: pointer;
    letter-spacing: 0;
    line-height: 64px;
    transition: color .15s ease, background .15s ease;
}
.nav-group-eyebrow,
.nav-group-trigger > svg { line-height: 1; transform: translateY(-5px); }
.nav-group-eyebrow {
    font-family: 'IBM Plex Sans', 'IBM Plex Sans', sans-serif;
    font-size: .82rem;
    letter-spacing: 0;
    text-transform: none;
    color: inherit;
    line-height: 1;
}
.nav-group-caret {
    transform: translateY(0);
    transition: transform .18s cubic-bezier(0.16, 1, 0.3, 1);
    opacity: .7;
}
.nav-group-trigger:hover,
.nav-group:focus-within .nav-group-trigger,
.nav-group:hover .nav-group-trigger {
    color: #fff;
    background: rgba(255,255,255,.10);
}
.nav-group:focus-within .nav-group-caret,
.nav-group:hover .nav-group-caret { transform: rotate(180deg); }
.nav-group.is-active .nav-group-trigger {
    color: #fff;
    background: rgba(255,255,255,.06);
}
.nav-group.is-active::after { background: var(--tech-green); }

.nav-group-panel {
    position: absolute;
    top: calc(100% + 0px);
    left: 0;
    min-width: 320px;
    background: var(--panel);
    border: 1px solid var(--border-light);
    border-top: 3px solid var(--tech-green);
    padding: .35rem;
    display: flex;
    flex-direction: column;
    gap: 1px;
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
    transition: opacity .18s cubic-bezier(0.16, 1, 0.3, 1), transform .18s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 110;
    box-shadow: 0 8px 24px rgba(0,0,0,.10);
}
.nav-group:hover .nav-group-panel,
.nav-group:focus-within .nav-group-panel {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.nav-group-item {
    display: flex !important;
    flex-direction: column;
    gap: .15rem;
    padding: .65rem .85rem !important;
    text-decoration: none;
    color: var(--text);
    background: var(--panel);
    border-left: 3px solid transparent;
    transition: background .12s ease, border-color .12s ease, color .12s ease;
    height: auto !important;
}
.nav-group-item:hover {
    background: var(--bg-alt);
    border-left-color: var(--tech-green);
    color: var(--forest);
}
.nav-group-item.is-current {
    background: var(--upstream);
    border-left-color: var(--forest);
    color: var(--forest);
}
.nav-group-item-title {
    font-family: 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif;
    font-weight: 600;
    font-size: .92rem;
    color: var(--forest);
    line-height: 1.2;
}
.nav-group-item-desc {
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: .76rem;
    color: var(--text-secondary);
    line-height: 1.35;
}
.nav-group-item-soon {
    display: inline-block;
    font-family: 'IBM Plex Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: .58rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--accent);
    border: 1px solid var(--accent);
    padding: 1px 5px;
    margin-left: .4rem;
    vertical-align: 1px;
    font-weight: 500;
}

/* ── Branding LC PACK checkbox (solid, square, no shadows) ─ */
.brand-check {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    height: 38px;
    cursor: pointer;
    user-select: none;
    font-family: 'IBM Plex Sans', 'IBM Plex Sans', sans-serif;
    font-size: .82rem;
    font-weight: 500;
    color: var(--text);
    line-height: 1;
    padding: 0 4px;
}
.brand-check input { display: none; }
.brand-check-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border: 1.5px solid var(--border);
    background: #fff;
    color: transparent;
    transition: background .12s, border-color .12s, color .12s;
    flex-shrink: 0;
}
.brand-check input:checked + .brand-check-box {
    background: var(--forest);
    border-color: var(--forest);
    color: #fff;
}
.brand-check:hover .brand-check-box { border-color: var(--forest); }
.brand-check-label { line-height: 1; }

/* Branding badge for document lists — only LC PACK is highlighted, LC PAPER is implicit. */
.brand-badge {
    display: inline-block;
    font-family: 'IBM Plex Sans', 'IBM Plex Sans', sans-serif;
    font-size: .64rem;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    padding: 2px 7px;
    margin-left: .5rem;
    vertical-align: 1px;
    border-radius: 0;
    line-height: 1.3;
}
.brand-badge--pack {
    background: #d8ff00;
    color: #1a1a00;
    border: 1px solid #b8de00;
    box-shadow: 0 0 6px rgba(216,255,0,.55);
}
.brand-badge--proposal {
    background: #fde8c8;
    color: #7a4a10;
    border: 1px solid #e6b873;
}

/* Language chips in presentations list */
.pres-lang-chip {
    display: inline-block;
    font-family: 'IBM Plex Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: .68rem;
    letter-spacing: .12em;
    color: var(--text-secondary);
    background: var(--bg-alt);
    border: 1px solid var(--border-light);
    padding: 2px 6px;
    margin-right: 4px;
    text-transform: uppercase;
}

/* Modal X-close button */
.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    transition: color .12s, background .12s;
}
.modal-close:hover { color: var(--forest); background: var(--bg-alt); }

/* Language picker grid (list modal) */
.pres-lang-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pres-lang-pick {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 18px;
    border: 1px solid var(--border-light);
    background: #fff;
    color: var(--forest);
    text-decoration: none;
    transition: border-color .12s, background .12s, transform .08s;
}
.pres-lang-pick:hover { border-color: var(--forest); background: var(--bg-alt); }
.pres-lang-pick:active { transform: translateY(1px); }
.pres-lang-pick-code {
    font-family: 'IBM Plex Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 1.3rem;
    font-weight: 500;
    letter-spacing: .04em;
}
.pres-lang-pick-name { font-size: .82rem; color: var(--text-secondary); }

@media (max-width: 900px) {
    .nav-group-panel { left: auto; right: 0; min-width: 280px; }
    .brand-dark h1 { display: none; }
}

/* User area in header */
.user-area {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-shrink: 0;
}
.user-greeting {
    font-family: 'IBM Plex Sans', 'IBM Plex Sans', sans-serif;
    font-size: .82rem;
    font-weight: 400;
    color: rgba(255,255,255,.85);
    white-space: nowrap;
    line-height: 1;
}
.nav-logout {
    text-decoration: none;
    color: rgba(255,255,255,.78);
    font-family: 'IBM Plex Sans', 'IBM Plex Sans', sans-serif;
    font-size: .82rem;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    padding: .35rem .7rem;
    border: 1px solid rgba(255,255,255,.2);
    background: rgba(255,255,255,.06);
    transition: color .15s, border-color .15s, background .15s;
}
.nav-logout:hover {
    color: #fff;
    border-color: rgba(255,255,255,.5);
    background: rgba(255,255,255,.12);
}

/* ── Panels ──────────────────────────────────── */
.panel {
    background: var(--panel);
    max-width: 1140px;
    margin: var(--sp-md) auto;
    padding: var(--sp-lg);
    border: 1px solid var(--border-light);
    border-radius: 0;
    box-shadow: var(--shadow-sm);
}
.panel:hover {
    box-shadow: var(--shadow-md);
}
.panel-title-row { display: flex; justify-content: space-between; align-items: center; }

.ft-windows-app-callout {
    margin-top: 1rem;
    background: #f0fdf4;
    border-left: 4px solid var(--forest);
}
.ft-windows-app-callout p { margin: 0; color: var(--text-primary); }
.ft-windows-app-callout a { color: var(--forest); font-weight: 600; }

/* FT app mode (Windows WebView2 embed): hide portal chrome */
body.is-ft-app-mode .lc-appbar,
body.is-ft-app-mode .lc-subnav,
body.is-ft-app-mode .topbar-dark,
body.is-ft-app-mode .app-footer,
body.is-ft-app-mode .ft-windows-app-callout,
body.is-ft-app-mode .ft-actions-bar a.secondary[href*="action=fitxes_tecniques"] {
    display: none !important;
}
body.is-ft-app-mode { background: #f5f5f4; }

/* ── Login ───────────────────────────────────── */
/* ── Login (full-bleed corporate wallpaper) ──────────────────── */
.lg-body { min-height: 100vh; margin: 0; }
.lg-bg {
    position: fixed; inset: 0; z-index: -2;
    background: #00271b center / cover no-repeat;
    background-image: linear-gradient(135deg, #002013, #00463a);
}
.lg-bg::after {
    content: ''; position: absolute; inset: 0;
    background: radial-gradient(125% 125% at 50% 35%, rgba(0,20,12,.12), rgba(0,14,8,.6));
}
.lg-wrap {
    position: relative; min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    padding: 2rem 1rem;
}
.lg-stack { width: min(370px, 92vw); }

/* Frosted-glass panel sitting on the card's top edge, carrying the logo */
.lg-frost {
    height: 96px; /* refined to 40% of the card by JS */
    display: flex; align-items: center; justify-content: center;
    background: rgba(0, 58, 38, .34);
    -webkit-backdrop-filter: blur(16px) saturate(1.4);
    backdrop-filter: blur(16px) saturate(1.4);
    border: 1px solid rgba(255,255,255,.22);
    border-bottom: none;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 -6px 26px rgba(0,0,0,.18);
}
.lg-frost img { max-width: 47.6%; max-height: 49.3%; object-fit: contain; filter: brightness(0) invert(1); opacity: .85; }

/* Solid white card */
.lg-card {
    background: #fff;
    padding: 1.7rem 1.6rem 1.5rem;
    box-shadow: 0 26px 60px rgba(0,0,0,.36), 0 4px 16px rgba(0,0,0,.22);
}
.lg-title {
    margin: 0; text-align: center;
    font-family: 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif;
    font-size: 1.24rem; font-weight: 300;
    letter-spacing: .46em; text-indent: .46em; /* keep optically centred */
    background: linear-gradient(95deg, #002616 0%, #0a6b43 52%, #0b9c84 100%);
    -webkit-background-clip: text; background-clip: text;
    color: transparent; -webkit-text-fill-color: transparent;
}
.lg-sep { border: none; border-top: 1px solid rgba(0,0,0,.13); width: 100%; margin: calc(1.25rem - 5px) 0 calc(1.25rem + 5px); }
.lg-form { display: block; }
.lg-hint { margin: 0 0 1rem; text-align: center; font-size: .82rem; color: var(--text-secondary); }
.lg-hint strong { color: var(--forest); font-weight: 600; }
.lg-input {
    width: 100%; border: 1px solid var(--border); border-radius: 0;
    padding: 13px 14px; font-size: .98rem; text-align: center; background: #fff;
}
.lg-input:focus { outline: none; border-color: var(--tech-green); box-shadow: 0 0 0 2px rgba(0,105,78,.14); }
.lg-btn {
    width: 100%; margin-top: .7rem; border: none; cursor: pointer;
    background: var(--forest); color: #fff;
    padding: 13px; font-weight: 600; font-size: .82rem;
    text-transform: uppercase; letter-spacing: .09em;
    transition: background .2s;
}
.lg-btn:hover { background: #00482c; opacity: 1; }
.lg-otp { display: flex; gap: .55rem; }
.lg-otp-box {
    flex: 1 1 0; min-width: 0; aspect-ratio: 1 / 1;
    border: 1px solid var(--border); border-radius: 0; background: #fff;
    text-align: center; font-size: 1.7rem; font-weight: 600; color: var(--forest);
    padding: 0;
}
.lg-otp-box:focus { outline: none; border-color: var(--tech-green); box-shadow: 0 0 0 2px rgba(0,105,78,.16); }
.lg-error { margin: .7rem 0 0; text-align: center; font-size: .8rem; color: var(--danger); }
.lg-back { margin: .85rem 0 0; text-align: center; }
.lg-back a { font-size: .78rem; color: var(--text-secondary); text-decoration: none; }
.lg-back a:hover { color: var(--forest); }
.lg-copyright {
    margin: 15px 0 0; text-align: center;
    font-size: .66rem; letter-spacing: .02em; color: rgba(255,255,255,.82);
    text-shadow: 0 1px 4px rgba(0,0,0,.6);
}
.lg-caption {
    position: fixed; right: 1.6rem; bottom: 1.3rem; margin: 0;
    max-width: 42ch; pointer-events: none;
    display: flex; align-items: flex-end; justify-content: flex-end; gap: .55rem;
}
.lg-caption-text {
    text-align: right; color: #fff; font-size: .92rem; font-weight: 500; line-height: 1.4;
    text-shadow: 0 0 5px rgba(38,38,38,.92), 0 0 13px rgba(28,28,28,.6), 0 1px 2px rgba(0,0,0,.55);
}
.lg-refresh {
    pointer-events: auto; flex-shrink: 0;
    width: 30px; height: 30px; min-width: 0; padding: 0; margin: 0 0 1px;
    display: inline-flex; align-items: center; justify-content: center;
    background: transparent; border: none; cursor: pointer; color: #fff;
    filter: drop-shadow(0 0 5px rgba(38,38,38,.92)) drop-shadow(0 1px 2px rgba(0,0,0,.55));
    opacity: .9; transition: transform .25s ease, opacity .2s;
}
.lg-refresh:hover { opacity: 1; transform: rotate(-35deg); }
.lg-refresh svg { width: 20px; height: 20px; }
.lg-refresh.is-spinning { pointer-events: none; }
.lg-refresh.is-spinning svg { animation: lgSpin .7s linear infinite; }
@keyframes lgSpin { to { transform: rotate(360deg); } }
@media (max-width: 520px) {
    .lg-caption { position: static; max-width: none; justify-content: center; margin: 1.5rem auto 0; }
}

/* ── Form elements ───────────────────────────── */
label {
    display: block;
    font-weight: 600;
    font-size: .82rem;
    color: var(--text-secondary);
    margin-top: .75rem;
    margin-bottom: .25rem;
    text-transform: uppercase;
    letter-spacing: .03em;
}
input, select, button, textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 0;
    padding: 10px 14px;
    font: inherit;
    font-size: .9rem;
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--tech-green);
    box-shadow: 0 0 0 2px rgba(0,105,78,.12);
}
textarea { resize: vertical; }

button, .button {
    background: var(--forest);
    color: #fff;
    text-decoration: none;
    border: none;
    display: inline-block;
    width: auto;
    padding: 10px 20px;
    cursor: pointer;
    margin-top: .75rem;
    border-radius: 0;
    font-weight: 600;
    font-size: .82rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    transition: opacity .2s;
}
button:hover, .button:hover { opacity: .85; }
.button.secondary {
    background: transparent;
    color: var(--forest);
    border: 1px solid var(--border);
}
.button.secondary:hover { background: var(--bg-alt); opacity: 1; }
.disabled-link { opacity: .4; pointer-events: none; }

/* ── Grid layouts ────────────────────────────── */
.grid { display: grid; gap: .75rem; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
fieldset { border: 1px solid var(--border); background: var(--surface); border-radius: 0; padding: .6rem; margin-top: 1rem; }
fieldset label { display: inline-flex; align-items: center; gap: .4rem; margin-right: 1rem; font-weight: 600; text-transform: none; }
fieldset input[type="radio"] { width: auto; }

/* ── Product cards ───────────────────────────── */
.product-card {
    border: 1px solid var(--border-light);
    border-left: 3px solid var(--tech-green);
    border-radius: 0;
    padding: var(--sp-lg);
    margin-bottom: .75rem;
    background: #fff;
    box-shadow: var(--shadow-sm);
}
.product-card:hover { box-shadow: var(--shadow-md); }
.product-header { display: flex; justify-content: space-between; align-items: center; }
.remove-product { width: 32px; height: 32px; padding: 0; font-size: .95rem; line-height: 1; border-radius: 0; }
.remove-product.disabled { opacity: .4; cursor: not-allowed; }
.notice { margin-top: .5rem; padding: .5rem .65rem; background: #fdf8e8; border: 1px solid #e8d88a; border-left: 3px solid var(--warning); border-radius: 0; color: #5a4e0a; font-size: .88rem; }

/* ── Declaracions: info box i botó Gemini ────── */
.decl-info-box {
    width: 100%;
    box-sizing: border-box;
    margin-top: .5rem;
    padding: .6rem .8rem;
    background: #f4f0fb;
    border: 1px solid #d9cdf0;
    border-left: 3px solid #7c4dff;
    border-radius: 0;
    color: #3d2e66;
    font-size: .85rem;
    line-height: 1.5;
}
.decl-info-box ol { margin: .35rem 0 0; padding-left: 1.2rem; }
.decl-info-box li { margin-bottom: .2rem; }
.decl-info-box li:last-child { margin-bottom: 0; }
button.btn-generate-decl, .button.btn-generate-decl {
    background: linear-gradient(135deg, #6a3de8 0%, #9c5bff 55%, #c084fc 100%);
    color: #fff;
}
button.btn-generate-decl:disabled { opacity: .6; cursor: wait; }

/* ── Calc box & phase sections ───────────────── */
.calc-box { margin-top: .75rem; background: var(--surface); border: 1px solid var(--border-light); border-radius: 0; padding: .65rem; }
.calc-box ul { margin: .3rem 0; padding-left: 1.2rem; font-size: .9rem; }
.calc-box li { margin-bottom: .15rem; }
.phase-section { border-radius: 0; padding: .5rem .65rem; margin-bottom: .4rem; }
.phase-section h4 { margin: 0 0 .3rem; font-size: .9rem; font-weight: 600; }
.phase-upstream { background: var(--upstream); border-left: 3px solid #3a8a4a; }
.phase-core { background: var(--core); border-left: 3px solid #3a6a8a; }
.phase-downstream { background: var(--downstream); border-left: 3px solid #8a6a3a; }
.subtotal { margin: .3rem 0 0; font-size: .9rem; color: var(--text); }
.total { margin: .5rem 0 0; font-size: 1rem; font-weight: 600; color: var(--forest); border-top: 2px solid var(--forest); padding-top: .4rem; }

/* ── Factor cards ────────────────────────────── */
.factor-card { border: 1px solid var(--border-light); border-radius: 0; padding: .65rem; background: var(--surface); }
.factor-card-core { border-color: #a8c4d8; background: #f5f9fc; }
.factor-card-downstream { border-color: #d8c4a8; background: #fcf9f5; }
.factor-card-param { border-color: #c0c0c0; background: #f8f8f8; border-style: dashed; }

/* ── Data tables ─────────────────────────────── */
table { width: 100%; border-collapse: collapse; margin-top: .75rem; font-size: .9rem; }
th {
    background: var(--table-head);
    color: #fff;
    font-family: 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif;
    font-weight: 600;
    font-size: .78rem;
    text-transform: none;
    letter-spacing: .01em;
    padding: .55rem .6rem;
    text-align: left;
    border: none;
}
td { border-bottom: 1px solid var(--border-light); padding: .5rem .6rem; text-align: left; }
tbody tr:nth-child(even) { background: var(--bg-alt); }
tbody tr:hover { background: var(--sand); }
/* Collapsible family groups in the technical-sheets list (mirrors the
   Mestre de productes accordion in Tramuntana). */
.ft-group-toolbar { display: flex; gap: .5rem; margin: .75rem 0 .25rem; }
.ft-group-toolbar .button { margin-top: 0; padding: 5px 14px; min-height: 0; font-size: .74rem; }
.ft-table tbody tr.ft-group-head { cursor: pointer; background: var(--bg-alt); }
.ft-table tbody tr.ft-group-head:hover { background: var(--mint); }
.ft-table tbody tr.ft-group-head td { font-weight: 600; color: var(--forest); border-bottom: 1px solid var(--border-light); padding: .5rem .6rem; }
.ft-group-chev { display: inline-block; width: 1em; color: var(--table-head); font-size: .7rem; margin-right: .4rem; }
.ft-group-code { font-family: 'IBM Plex Sans', monospace; font-weight: 700; margin-right: .5rem; }
.ft-group-label { color: var(--text-secondary); font-weight: 500; }
.ft-group-count { display: inline-block; margin-left: .5rem; background: var(--table-head); color: #fff; font-size: .72rem; font-weight: 600; padding: .05rem .45rem; border-radius: 999px; }
.co2-badge { font-weight: 700; color: var(--forest); font-size: .95rem; }
.co2-phases { display: block; font-size: .75rem; color: var(--text-secondary); margin-top: .1rem; font-family: 'IBM Plex Sans', 'Segoe UI', system-ui, -apple-system, sans-serif; }

/* ── Action buttons ──────────────────────────── */
/* Light background + dark outline for every action button. The per-type
   colour lives in the icon (currentColor), and the function is revealed in a
   tooltip on hover (data-tip). */
.actions-cell { white-space: nowrap; }
.actions-cell > .btn-action,
.actions-cell > .action-menu,
.actions-cell > .inline-form,
.actions-cell > .btn-action-sep { margin: 0 .28rem 0 0; vertical-align: middle; }
.inline-form { display: inline-block; }
.btn-action {
    position: relative;
    display: inline-flex;
    margin: 0;
    height: 2rem;
    align-items: center;
    justify-content: center;
    gap: .32rem;
    padding: 0 .62rem;
    font-size: .72rem;
    font-weight: 600;
    border-radius: 0;
    border: 1px solid #2b2b2b;   /* contorn fosc */
    background: #fff;            /* fons clar */
    color: var(--text);
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
    line-height: 1.25;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: .04em;
    transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.btn-action:hover { box-shadow: var(--shadow-sm); }
.btn-action svg { display: block; flex: none; }

/* Icon-only buttons — compact square, the icon carries the colour */
.btn-action.btn-icon { width: 2rem; height: 2rem; padding: 0; }

/* Per-type icon colours (fons clar + contorn fosc per a tots) */
.btn-edit { color: #d39e00; }                 /* groc — llapis */
.btn-edit:hover { background: #fdf6e3; border-color: #d39e00; }

.btn-delete { color: var(--danger); }         /* vermell — paperera */
.btn-delete:hover { background: #fbe9e6; border-color: var(--danger); }

.btn-copy,
.btn-duplicate { color: var(--info); }        /* blau — dos fulls */
.btn-copy:hover,
.btn-duplicate:hover { background: #eaf2f7; border-color: var(--info); }

.btn-invalidate,
.btn-revalidate { color: #7a4f24; }           /* marró — rellotge de sorra */
.btn-invalidate:hover,
.btn-revalidate:hover { background: #f3ece4; border-color: #7a4f24; }

.btn-report { color: #555; }                  /* gris — full amb fletxa avall */
.btn-report:hover { background: var(--bg-alt); border-color: #555; }

.btn-rapport { color: var(--tech-green); }    /* gràfica */
.btn-rapport:hover { background: #e8f1ed; border-color: var(--tech-green); }

/* text-only secondary actions keep their label */
.btn-docs { color: var(--forest); }
.btn-docs:hover { background: var(--bg-alt); border-color: var(--forest); }
.btn-translate { color: #9a7400; }
.btn-translate:hover { background: #fbf3dc; border-color: #9a7400; }

/* Discrete vertical separator between the two action groups */
.btn-action-sep {
    display: inline-block;
    width: 1px;
    height: 1.5rem;
    background: var(--border);
    margin: 0 .2rem;
    vertical-align: middle;
    align-self: center;
}

/* Tooltip with the button's function, shown on hover */
.btn-action[data-tip]::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: #1f2421;
    color: #fff;
    padding: .3rem .5rem;
    font-size: .68rem;
    font-weight: 600;
    letter-spacing: .02em;
    text-transform: none;
    white-space: nowrap;
    border-radius: 3px;
    box-shadow: 0 2px 10px rgba(0,0,0,.25);
    opacity: 0;
    pointer-events: none;
    z-index: 60;
    transition: opacity .12s ease, transform .12s ease;
}
.btn-action[data-tip]::before {
    content: "";
    position: absolute;
    bottom: calc(100% + 3px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    border: 5px solid transparent;
    border-top-color: #1f2421;
    opacity: 0;
    pointer-events: none;
    z-index: 60;
    transition: opacity .12s ease, transform .12s ease;
}
.btn-action[data-tip]:hover::after,
.btn-action[data-tip]:hover::before {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.actions-cell-ft .actions-grid {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: .3rem;
}
.badge-no-vigent { display: inline-block; padding: 2px 8px; font-size: .75rem; background: #f0e8d0; color: #6a5a10; border-radius: 0; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }

/* ── Row action dropdown ──────────────────────── */
.action-menu { position: relative; display: inline-flex; }
.action-caret { flex-shrink: 0; }
.action-menu.is-open .action-menu-trigger {
    background: var(--bg-alt);
    border-color: var(--tech-green);
    color: var(--tech-green);
}
.action-menu-panel {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 60;
    display: none;
    flex-direction: column;
    min-width: 14rem;
    padding: .25rem;
    background: #fff;
    border: 1px solid var(--border);
    box-shadow: 0 8px 24px rgba(0,0,0,.16);
}
.action-menu.is-open .action-menu-panel { display: flex; }
.action-menu-item {
    display: block;
    margin: 0;
    width: 100%;
    text-align: left;
    background: none;
    border: 0;
    padding: .5rem .6rem;
    font-family: inherit;
    font-size: .78rem;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    white-space: nowrap;
}
.action-menu-item:hover { background: var(--bg-alt); color: var(--forest); }

.ft-division-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .75rem;
}
.ft-division-card {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    border: 1px solid var(--border);
    padding: 1rem;
    text-decoration: none;
    color: var(--text);
    background: linear-gradient(135deg, #fff, #f4f7f5);
}
.ft-division-card strong {
    font-size: 1.1rem;
    color: var(--forest);
}
.ft-division-card span {
    font-size: .85rem;
    color: var(--text-secondary);
}
.ft-division-card:hover {
    border-color: var(--tech-green);
}
.ft-line-selector {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    background: #eef2ef;
    border: 1px solid var(--border-light);
    border-radius: 0;
    margin-bottom: 1rem;
}
.ft-line-chip {
    appearance: none;
    border: 0;
    background: transparent;
    color: #3a4a41;
    font-weight: 700;
    font-size: .8rem;
    letter-spacing: .04em;
    padding: .5rem 1rem;
    margin: 0;
    border-radius: 0;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}
.ft-line-chip:hover { color: #14532d; }
.ft-line-chip.is-active {
    background: #14532d;
    color: #fff;
}

.ft-sec-head {
    margin: 1rem 0 .5rem;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #14532d;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: .25rem;
}
.ft-sec-head:first-child { margin-top: 0; }

.ft-layout {
    display: grid;
    grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}
.ft-editor {
    border: 1px solid var(--border-light);
    background: #fff;
    padding: .9rem;
    min-width: 0;
}
.ft-editor input[type="text"],
.ft-editor input[type="date"],
.ft-editor select {
    width: 100%;
    box-sizing: border-box;
}
.ft-preview-shell {
    position: sticky;
    top: 1rem;
    border: 1px solid var(--border-light);
    background: #e8ebe9;
    min-width: 0;
}
.ft-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .6rem .75rem;
    border-bottom: 1px solid var(--border-light);
    background: #fff;
}
.ft-live-a4 {
    padding: 1rem;
    display: flex;
    justify-content: center;
}
.ft-live-a4-inner {
    width: 100%;
    max-width: 210mm;
    aspect-ratio: 210 / 297;
    background: #fff;
    margin: 0 auto;
    box-shadow: 0 4px 20px rgba(0,0,0,.12);
    border: 1px solid #dcdcdc;
    padding: 10mm 12mm 8mm;
    overflow: hidden;
    position: relative;
    font-size: clamp(.7rem, 1.1vw, 1rem);
    display: flex;
    flex-direction: column;
}
.ft-live-watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-32deg);
    font-size: clamp(2.6rem, 7vw, 5rem);
    font-weight: 700;
    letter-spacing: .4rem;
    color: rgba(20, 83, 45, 0.12);
    pointer-events: none;
    z-index: 5;
    white-space: nowrap;
}
.ft-live-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1em;
    margin-bottom: 1.4em;
    padding-bottom: 1em;
    border-bottom: 1px solid #d4d4d4;
}
.ft-live-logo {
    width: 6.5em;
    max-width: 36%;
    height: auto;
}
.ft-live-head-right {
    text-align: right;
}
.ft-live-title {
    margin: 0;
    font-family: 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif;
    font-size: 1.04em;
    color: #4b5563;
    font-weight: 400;
    letter-spacing: .06em;
    text-align: right;
}
.ft-live-head-date {
    margin: .35em 0 0;
    font-size: .82em;
    color: #4f5e58;
}
.ft-live-head-date strong { color: #111827; font-weight: 600; }
.ft-live-pill {
    display: flex;
    align-items: center;
    color: #fff;
    padding: .3em .7em;
    font-size: .82em;
    font-weight: 700;
    letter-spacing: .06em;
    border-radius: 0;
}
.ft-live-pill-lc { background: #14532d; }
.ft-live-pill-client { background: #6b7280; }
.ft-live-product-row {
    display: flex;
    justify-content: center;
    margin: .6em 0 .5em;
}
.ft-live-prod-box {
    display: inline-flex;
    align-items: stretch;
    border: 1px solid #14532d;
}
.ft-live-product {
    display: flex;
    align-items: center;
    margin: 0;
    padding: .3em .7em;
    font-weight: 700;
    font-size: 1.05em;
    color: #14532d;
    line-height: 1.15;
}
.ft-live-meta {
    margin: 0 0 .7em;
    font-size: .88em;
    color: #4f5e58;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1em;
    text-align: center;
}
.ft-live-meta strong { color: #111827; font-weight: 600; }
.ft-live-meta-client {
    display: inline-block;
    border: 1px solid #6b7280;
    white-space: nowrap;
}
.ft-live-client-name {
    display: inline-block;
    vertical-align: top;
    padding: .3em .7em;
    line-height: 1.3;
}
.ft-live-meta-client .ft-live-pill-client {
    display: inline-block;
    vertical-align: top;
    padding: .3em .7em;
    line-height: 1.3;
    font-size: 1em;
}
.ft-ply-field {
    margin-top: .9rem;
}
.ft-ply-help-btn {
    display: inline-block;
    margin-top: .3rem;
    padding: 0;
    background: none;
    border: 0;
    color: #6b7280;
    font-size: .78rem;
    text-decoration: underline;
    cursor: pointer;
}
.ft-ply-help-btn:hover { color: #374151; }
.ft-ply-help {
    margin: .4rem 0 0;
    padding: .5rem .7rem;
    background: #f3f4f6;
    border-left: 3px solid #9ca3af;
    color: #4b5563;
    font-size: .82rem;
    line-height: 1.4;
}
.ft-ply-help[hidden] { display: none; }
.ft-live-fibra {
    margin: 0 0 .5em;
    padding: .35em .7em;
    border: 1px solid #d4d4d4;
    color: #14532d;
    font-weight: 600;
    font-size: .95em;
}
.ft-live-section-title {
    margin: .55em 0 .35em;
    padding: .28em .6em;
    font-size: .82em;
    text-transform: uppercase;
    color: #fff;
    background: #14532d;
    font-weight: 700;
    display: flex;
    justify-content: space-between;
    letter-spacing: .06em;
}
.ft-live-section-title span { opacity: .95; font-weight: 600; }
.ft-live-a4-inner[data-line="MP4"] .ft-live-section-title,
.ft-live-a4-inner[data-line="MP5"] .ft-live-section-title {
    margin-top: 1.1em;
}
.ft-live-compliance {
    margin: .35em 0 .5em;
}
.ft-live-comp-head {
    display: flex;
    gap: .7em;
}
.ft-live-comp-head .ft-live-comp-title {
    flex: 1;
    min-width: 0;
}
.ft-live-comp-title {
    font-size: .62em;
    color: #6b7280;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.ft-live-comp-rule {
    height: 1px;
    background: #d1d5db;
    margin-top: .32em;
}
.ft-live-comp-body {
    display: flex;
    gap: .7em;
    margin-top: .55em;
    align-items: flex-start;
}
.ft-live-comp-col {
    flex: 1;
    min-width: 0;
}
.ft-live-comp-icons {
    display: flex;
    flex-wrap: wrap;
    gap: 1.4mm;
    align-items: flex-start;
}
.ft-live-comp-icons img {
    height: 12mm;
    width: auto;
}
.ft-live-comp-cert {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.ft-live-comp-cap {
    font-size: .5em;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: .03em;
    margin-top: .4mm;
    text-align: center;
    line-height: 1.15;
}
.ft-live-comp-table {
    width: 100%;
    border-collapse: collapse;
}
.ft-live-comp-table td {
    font-size: .74em;
    color: #374151;
    padding: .14em 0;
    border-bottom: 1px dotted #e5e7eb;
}
.ft-cert-noicon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}
.ft-live-cert-title {
    margin-top: 1em;
    font-size: .95em;
    color: #14532d;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
}
.ft-live-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .88em;
}
.ft-live-table td {
    border: none;
    padding: .22em .5em;
    background: transparent;
    border-bottom: 1px dotted #e5e7eb;
}
.ft-live-table td:nth-child(odd) {
    font-weight: 600;
    width: 24%;
    color: #374151;
}
.ft-live-param-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .4em;
    margin-bottom: .5em;
}
.ft-live-param-card {
    border: 1px solid #d4d4d4;
    padding: .35em .55em;
    display: flex;
    flex-direction: column;
    gap: .15em;
    background: #fafafa;
}
.ft-live-param-name {
    font-weight: 700;
    color: #14532d;
    font-size: .88em;
    line-height: 1.2;
}
.ft-live-param-sub {
    display: flex;
    justify-content: space-between;
    gap: .5em;
    font-size: .72em;
    color: #4b5563;
}
.ft-live-param-ref { font-style: italic; }
.ft-live-param-unit { font-weight: 600; color: #111827; }
.ft-live-param-range {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .2em;
    margin-top: .1em;
    padding-top: .2em;
    border-top: 1px dotted #d4d4d4;
}
.ft-live-param-range span {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: .75em;
}
.ft-live-param-range em {
    font-style: normal;
    font-size: .82em;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #6b7280;
}
.ft-live-param-range b {
    color: #14532d;
    font-weight: 700;
    font-size: 1.08em;
}
.ft-live-param-range i {
    font-style: normal;
    color: #6b7280;
    font-weight: 400;
    font-size: .92em;
}
.ft-fallback-title {
    font-family: 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif;
    color: var(--forest);
    font-size: 1.2rem;
    margin-bottom: .25rem;
}
.ft-fallback-code {
    display: inline-block;
    background: var(--forest);
    color: #fff;
    padding: .2rem .5rem;
    font-size: .78rem;
    margin-bottom: .8rem;
}
.ft-cert-preview {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: center;
    gap: 1.6mm;
    margin: 1mm 0 1.5mm;
    padding-top: 0;
}
.ft-cert-preview img {
    width: 18mm;
    height: 18mm;
    object-fit: contain;
    background: #fff;
}
.ft-cert-text {
    display: inline-flex;
    align-items: center;
    border: 1px solid #14532d;
    color: #14532d;
    font-weight: 700;
    letter-spacing: .03em;
    padding: 1.4mm 2.4mm;
    background: #fff;
}
.ft-live-comp-cert.ft-cert-text { font-size: .85em; }
.ft-manual-required {
    background: #fff8c5 !important;
    border-color: #e5b700 !important;
    box-shadow: inset 0 0 0 1px #e5b700;
}
.ft-manual-missing {
    background: #ffecec !important;
    border-color: #dc2626 !important;
    box-shadow: inset 0 0 0 1px #dc2626;
}
.ft-api-filled {
    background: #f0fdf4 !important;
    border-color: #86efac !important;
}
.ft-live-validation {
    margin-top: auto;
    padding-top: 2.5mm;
    border-top: 1px solid #d4d4d4;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.6mm;
    text-align: center;
}
.ft-live-validation img {
    width: 49mm;
    max-width: 100%;
    height: 17mm;
    object-fit: fill;
    display: block;
    margin: 0 auto;
}
.ft-live-vtext {
    font-size: 9pt;
    color: #4b5563;
    text-align: center;
    line-height: 1.25;
}
.ft-live-vcode {
    font-size: 10.5pt;
    letter-spacing: 1.6px;
    font-weight: 700;
    color: #14532d;
    margin-left: 1mm;
}
.ft-live-note {
    margin: 3mm 0 0;
    padding-top: 2mm;
    border-top: 1px solid #d4d4d4;
    font-size: 7.5pt;
    color: #6b7280;
    text-align: center;
    line-height: 1.3;
}
.ft-cert-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .4rem;
}
.ft-cert-option {
    margin: 0;
    display: flex;
    align-items: center;
    gap: .45rem;
    border: 1px solid var(--border-light);
    padding: .4rem .55rem;
    background: #fff;
    text-transform: none;
    letter-spacing: 0;
    font-size: .82rem;
    cursor: pointer;
}
.ft-cert-option:hover { border-color: #14532d; }
.ft-cert-option input[type="checkbox"] {
    width: auto;
    margin: 0;
}
.ft-cert-option img {
    width: 22px;
    height: 22px;
    object-fit: cover;
    flex-shrink: 0;
}
.ft-cert-option span { flex: 1; }

.ft-stack {
    display: flex;
    flex-direction: column;
    gap: .7rem;
}
.ft-stack > div label { display: block; margin-bottom: .25rem; }
.ft-stack > div input { width: 100%; box-sizing: border-box; }
/* Two consecutive stacks appear where the section headings were removed;
   keep the same vertical rhythm as the fields within a stack. */
.ft-editor > .ft-stack + .ft-stack { margin-top: .7rem; }

@keyframes ft-spin { to { transform: translateY(-50%) rotate(360deg); } }
@keyframes ft-wand-shimmer {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.ft-wand-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    padding: 0 1rem;
    /* 1px inset top/bottom (shorter than the code input row) and a 2px white
       gap from the "?" button on its left. */
    margin: 1px 0 1px 2px;
    align-self: stretch;
    background: linear-gradient(270deg, #7c3aed, #14532d, #0ea5e9, #7c3aed);
    background-size: 300% 300%;
    animation: ft-wand-shimmer 3.5s ease infinite;
    color: #fff;
    border: 0;
    font-size: .82rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    box-sizing: border-box;
    letter-spacing: .3px;
    text-shadow: 0 1px 4px rgba(0,0,0,.25);
    transition: filter .2s;
}
.ft-wand-btn:hover { filter: brightness(1.15); animation-play-state: paused; }
.ft-wand-btn svg { flex-shrink: 0; filter: drop-shadow(0 0 3px rgba(255,255,255,.5)); }

.ft-param-cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: .6rem;
}
.ft-param-card {
    border: 1px solid var(--border-light);
    background: #fafafa;
    padding: .6rem .65rem;
    display: flex;
    flex-direction: column;
    gap: .4rem;
}
.ft-param-card label {
    display: block;
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #6b7280;
    margin-bottom: .15rem;
    font-weight: 600;
}
.ft-param-card input[type="text"] {
    width: 100%;
    box-sizing: border-box;
    padding: .35rem .45rem;
    font-size: .85rem;
}
.ft-param-card-name input { font-weight: 600; color: #14532d; }
.ft-param-card-grid-2 {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: .4rem;
}
.ft-param-card-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .4rem;
}

.ft-actions-bar {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
    margin-top: 1rem;
    padding-top: .75rem;
    border-top: 1px solid var(--border-light);
}
.ft-actions-bar .ft-btn-save {
    background: #14532d;
    color: #fff;
    font-weight: 700;
}
/* Save (floppy) icon inside save buttons */
.ft-btn-save,
.btn-with-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
}
.ft-btn-save svg,
.btn-with-icon svg { width: 16px; height: 16px; flex: none; }
.ft-download-group {
    display: inline-flex;
    flex-wrap: nowrap;
    gap: .5rem;
    align-items: center;
    justify-content: flex-end;
    white-space: nowrap;
    height: 42px;
    box-sizing: border-box;
    border: 1px solid var(--border-light);
    padding: 0 0 0 12px;   /* left padding for the label; right edge flush with the button */
}
.ft-download-group > label,
.ft-download-group > select,
.ft-download-group > a,
.ft-download-group > button {
    flex: 0 0 auto;
}
/* Match the height of the "Desar FT" save button */
.ft-actions-bar .ft-btn-save,
.ft-actions-bar > .button.secondary {
    height: 42px;
    min-height: 42px;
    margin-top: 0;
    align-self: center;
    display: inline-flex;
    align-items: center;
}
/* Download button: full box height + flush right so its right and the right
   parts of the top/bottom borders merge with the box border. */
.ft-download-group > #ft-download-btn {
    height: 42px;
    min-height: 42px;
    align-self: center;
    justify-content: center;
    margin: 0 -1px 0 0;
}
.ft-download-group > .ft-pdf-lang {
    height: 34px;
    align-self: center;
    margin: 0;
}
.ft-pdf-lang {
    width: 6.5rem;
    padding: 0 .5rem;
    font-size: .85rem;
    border: 1px solid var(--border-light);
    background: #fff;
}
/* "És una proposta" box — same height as the download button, pushed right
   so it sits just left of the Idioma/Descarregar box. */
.ft-proposal-box {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    height: 42px;
    box-sizing: border-box;
    border: 1px solid var(--border-light);
    padding: 0 12px;
    white-space: nowrap;
}
.ft-proposal-check {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    margin: 0;
    cursor: pointer;
    font-weight: 600;
    font-size: .85rem;
}
.ft-proposal-check input[type="checkbox"] {
    width: auto;
    height: 1.05rem;
    margin: 0;
    flex: none;
}
.ft-info-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1px solid currentColor;
    color: var(--forest);
    font-size: .62rem;
    font-weight: 700;
    font-style: italic;
    font-family: Georgia, 'Times New Roman', serif;
    cursor: help;
    flex: none;
    user-select: none;
}
.ft-info-icon[data-tip]::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    width: 260px;
    background: #1f2d27;
    color: #fff;
    font: 400 .72rem/1.35 'IBM Plex Sans', system-ui, sans-serif;
    font-style: normal;
    letter-spacing: 0;
    text-transform: none;
    padding: 8px 10px;
    border-radius: 4px;
    white-space: normal;
    text-align: left;
    opacity: 0;
    visibility: hidden;
    transition: opacity .15s;
    z-index: 100;
    pointer-events: none;
}
.ft-info-icon:hover::after,
.ft-info-icon:focus::after { opacity: 1; visibility: visible; }
/* Highlighted (pale yellow) fill for the download-PDF button */
#ft-download-btn.btn-report {
    background: #fdf3b8;
    border-color: #e6d676;
}
#ft-download-btn.btn-report:hover {
    background: #f8ea96;
    border-color: #d9c64f;
    color: var(--forest);
}
#ft-download-btn[disabled],
button#ft-download-btn:disabled {
    opacity: .45;
    cursor: not-allowed;
    pointer-events: none;
}
.ft-download-hint {
    flex-basis: 100%;
    margin: 0;
    font-size: .8rem;
    font-style: italic;
    color: var(--text-secondary);
    text-align: right;
}

@media (max-width: 900px) {
    .ft-layout {
        grid-template-columns: 1fr;
    }
    .ft-preview-shell { position: static; }
}
.ft-filters {
    margin-top: .85rem;
    display: grid;
    grid-template-columns: 140px 1fr 180px 1fr 150px auto auto;
    gap: .45rem;
    align-items: end;
}
.ft-filters .button { margin-top: 0; }
.ft-filters button[type="submit"] { display: inline-flex; align-items: center; gap: .4rem; }
.ft-filters button[type="submit"] svg { width: 15px; height: 15px; }

.error { color: var(--danger); font-size: .88rem; margin-top: .4rem; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .8rem; }
.report-output {
    white-space: pre-wrap;
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-left: 3px solid var(--forest);
    border-radius: 0;
    padding: .8rem 1rem;
    font-size: .88rem;
    line-height: 1.6;
}
.hint { color: var(--text-secondary); font-size: .85rem; }

/* ── Responsive ──────────────────────────────── */
@media (max-width: 1023px) {
    .topbar-dark {
        height: auto;
        flex-direction: column;
        align-items: flex-start;
        padding: .65rem 1rem;
        gap: .5rem;
    }
    .topbar-right { flex-direction: column; align-items: flex-start; gap: .5rem; width: 100%; }
    .user-area { width: 100%; justify-content: space-between; }
}
@media (max-width: 768px) {
    body { font-size: 18px; }
    .grid.two, .grid.three { grid-template-columns: 1fr; }
    .ft-layout, .ft-division-grid, .ft-cert-grid { grid-template-columns: 1fr; }
    .ft-filters { grid-template-columns: 1fr; }
    .ft-preview-shell { position: static; min-height: 360px; }
    .ft-live-a4-inner { width: 100%; aspect-ratio: 210 / 297; padding: .8rem; }
    .topbar-dark { height: 48px; }
    input, select, textarea { padding: 12px 14px; min-height: 48px; }
    .image-upload-area--compact { min-height: 48px; }
    button, .button { padding: 12px 20px; min-height: 48px; }
    .btn-action { min-height: 44px; min-width: 44px; padding: .4rem .75rem; }
}

/* ── Inline destination ──────────────────────── */
.inline-destination { display: grid; grid-template-columns: 1fr auto; gap: 0; align-items: stretch; }
.inline-destination input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.inline-calc-distance { margin-top: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; white-space: nowrap; }

/* ── Product code row: input (85%) + "?" helper (15%) in the first column ── */
.ft-code-destination .ft-code-input-group {
    display: grid;
    grid-template-columns: 85% 15%;
    align-items: stretch;
    min-width: 0;
}
.ft-code-destination .ft-ac-wrap { min-width: 0; }
.ft-code-help-btn {
    align-self: stretch;
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 1px solid var(--border);
    border-left: 0;
    background: var(--forest);
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: filter .15s;
}
.ft-code-help-btn:hover { filter: brightness(1.12); }

/* ── Product lookup modal table ── */
.pl-table thead th {
    position: sticky;
    top: 0;
    background: #14532d;
    color: #fff;
    text-align: left;
    padding: .5rem .7rem;
    font-size: .78rem;
    font-weight: 700;
    white-space: nowrap;
}
.pl-table tbody td { padding: .45rem .7rem; border-bottom: 1px solid var(--border-light); }
.pl-table tbody tr:hover { background: #f0fdf4; }
.pl-table tbody tr.pl-selected { background: #dcfce7; }
.pl-table tbody tr.pl-selected td { color: #14532d; font-weight: 600; }
#pl-accept:disabled { opacity: .5; cursor: not-allowed; }
.bbcode-help { margin: .3rem 0 .8rem; font-size: .85rem; color: var(--text-secondary); background: var(--surface); border: 1px solid var(--border-light); border-left: 3px solid var(--accent); border-radius: 0; padding: .4rem .6rem; }

h2 {
    font-family: 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--forest);
    margin: 0 0 .75rem;
    letter-spacing: .01em;
}
h3 {
    font-family: 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif;
    margin-top: 1.25rem;
    margin-bottom: .5rem;
    color: var(--forest);
    font-size: 1rem;
    font-weight: 600;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: .3rem;
}

/* ── Modal ───────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal-box { background: #fff; border-radius: 0; border-top: 4px solid var(--forest); padding: 1.5rem 1.8rem; width: min(440px, 92%); box-shadow: 0 8px 32px rgba(0,0,0,.22); text-align: center; }
.modal-box--xxl { width: min(1480px, 96vw); max-width: 96vw; text-align: left; padding: 1.5rem 2rem; }
.modal-box h3 { border: none; text-align: center; margin-top: 0; }
.modal-box p { color: var(--text-secondary); margin-bottom: 1rem; font-size: .9rem; }
/* Idiomes en graella 2×2; Cancel·lar ocupa l'amplada de les dues columnes */
.modal-langs { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-bottom: 1rem; }
.modal-langs > button { width: 100%; text-align: center; }
.modal-lang-btn { text-align: center; }
.modal-close-btn { width: 100%; margin-top: .3rem; }
.modal-actions { display: flex; gap: .6rem; margin-top: .4rem; }
.modal-actions > button { flex: 1 1 0; margin-top: 0; }
/* Modal amb formulari (Penjar declaració): camps alineats a l'esquerra. */
.modal-box--form { text-align: left; }
.modal-box--form h3 { text-align: center; }
.modal-form-actions { display: flex; gap: .6rem; margin-top: 1.1rem; }
.modal-form-actions > .button { flex: 1 1 0; margin-top: 0; }

/* ── RAPPORT (production report) modal ────────── */
.modal-box--rapport { width: min(1080px, 96%); text-align: left; }
.modal-box--rapport h3 { text-align: left; }
.modal-box--rapport p { text-align: left; }
.rapport-meta { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem 1rem; margin-bottom: 1rem; }
.rapport-meta label { display: block; font-size: .8rem; font-weight: 600; color: var(--text-secondary); margin-bottom: .25rem; }
.rapport-meta input { width: 100%; }
.rapport-table-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .4rem; }
.rapport-table-head strong { font-size: .95rem; color: var(--forest); }
.rapport-table-wrap { overflow-x: auto; border: 1px solid var(--border-light); margin-bottom: .9rem; }
table.rapport-table { width: 100%; border-collapse: collapse; margin: 0; font-size: .82rem; }
table.rapport-table th { background: var(--bg-alt); color: var(--text-secondary); font-weight: 600; text-align: center; padding: .4rem .35rem; border-bottom: 1px solid var(--border-light); white-space: nowrap; }
table.rapport-table td { padding: .25rem .3rem; border-bottom: 1px solid var(--border-light); text-align: center; }
table.rapport-table tbody tr:nth-child(even) { background: transparent; }
table.rapport-table input { width: 100%; min-width: 56px; padding: .3rem .35rem; text-align: right; font-size: .82rem; }
table.rapport-table input[readonly] { background: var(--bg-alt); color: var(--text-secondary); }
table.rapport-table td.rapport-id { font-weight: 700; color: var(--forest); min-width: 28px; }
.rapport-row-del { cursor: pointer; border: none; background: none; color: var(--danger); font-size: 1.1rem; line-height: 1; padding: .1rem .35rem; }
.rapport-row-del:hover { color: var(--danger-hover); }
.rapport-actions { display: flex; gap: .6rem; justify-content: flex-end; flex-wrap: wrap; }
.rapport-actions .button { margin: 0; }
.rapport-add { margin: 0; }

/* ── Image upload ────────────────────────────── */
.image-upload-area { border: 2px dashed var(--border); border-radius: 0; padding: .75rem; text-align: center; cursor: pointer; transition: border-color .2s; }
.image-upload-area:hover { border-color: var(--tech-green); }
.image-upload-area img { max-height: 72px; max-width: 100%; object-fit: contain; }
.image-upload-area .placeholder-text { color: var(--text-secondary); font-size: .85rem; }
.image-upload-area input[type="file"] { display: none; }
/* Compact dropzone (declaració) — empty state matches the height of the
   sibling text input; grows to fit a logo preview when one is selected. */
.image-upload-area--compact { display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 6px 14px; }

/* ── Loading overlay ─────────────────────────── */
.loading-box { text-align: center; color: #fff; }
.loading-box p { margin-top: 1rem; font-size: 1rem; font-weight: 600; letter-spacing: .02em; }
.spinner { width: 32px; height: 32px; border: 3px solid var(--border-light); border-top-color: var(--tech-green); border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Config sections ─────────────────────────── */
/* Pestanyes de la Configuració (materials | generador XXSS i fons) */
.config-tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 2px solid var(--border-light); margin: 0 0 1.5rem; }
.config-tab {
    appearance: none; background: transparent; border: 0; border-bottom: 3px solid transparent;
    margin-bottom: -2px; padding: .7rem 1rem; cursor: pointer;
    font-family: 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif; font-size: .9rem; font-weight: 600;
    color: var(--text-secondary); transition: color .15s, border-color .15s;
}
.config-tab:hover { color: var(--forest); }
.config-tab.is-active { color: var(--forest); border-bottom-color: var(--forest); }
.config-tabpanel { display: none; }
.config-tabpanel.is-active { display: block; }

.config-section { border: 1px solid var(--border-light); border-radius: 0; padding: 1rem 1.2rem; margin-bottom: 1rem; }
.config-section-general { background: #fafbfa; border-left: 3px solid #6a8a76; }
.config-section-co2 { background: #f8faf8; border-left: 3px solid var(--forest); }
.config-section-decl { background: #f8fafc; border-left: 3px solid var(--info); }
.config-section-heading { margin-top: 0 !important; font-size: 1.05rem; border-bottom: none; padding-bottom: 0; }
.config-toggle { display: flex; align-items: center; gap: .55rem; cursor: pointer; font-weight: 600; margin: .25rem 0; }
.config-toggle input[type="checkbox"] { width: auto; height: 1.15rem; margin: 0; flex: none; }
.config-section-desc { margin: .2rem 0 .75rem; font-size: .85rem; color: var(--text-secondary); }

/* ── Subvencions section blocks ──────────────── */
.seccio-block {
    border: 1px solid var(--border-light);
    border-left: 3px solid var(--accent);
    border-radius: 0;
    padding: .75rem .85rem;
    margin-bottom: .75rem;
    background: #fff;
}
.seccio-row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.seccio-row select, .seccio-row input[type="text"] { margin-top: 0; }
.seccio-row .button { margin-top: 0; white-space: nowrap; }
.seccio-content {
    margin-top: .5rem;
    min-height: 100px;
    background: var(--surface);
    border: 1px solid var(--border-light);
    font-size: .88rem;
    line-height: 1.6;
}
.seccio-query::placeholder { font-style: italic; }
.copy-link { display: inline-block; margin-top: .3rem; font-size: .82rem; color: var(--accent); text-decoration: none; cursor: pointer; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.copy-link:hover { text-decoration: underline; color: var(--forest); }

/* ── Collapsible summary ─────────────────────── */
.summary-collapsible {
    position: relative;
    max-height: 9.5em;
    overflow: hidden;
    transition: max-height .3s ease;
}
.summary-collapsible .summary-collapsible-inner {
    /* wrapper for the content */
}
.summary-collapsible .summary-fade {
    position: absolute;
    bottom: 1.6em;
    left: 0;
    right: 0;
    height: 3.5em;
    background: linear-gradient(to bottom, rgba(255,255,255,0), var(--panel, #fff));
    pointer-events: none;
}
.summary-collapsible .summary-toggle {
    display: block;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    font-size: .88rem;
    color: var(--forest);
    text-decoration: underline;
    cursor: pointer;
    background: var(--panel, #fff);
    padding: .15rem 0;
    font-weight: 600;
}
.summary-collapsible.expanded {
    max-height: none;
}
.summary-collapsible.expanded .summary-fade { display: none; }
.summary-collapsible.expanded .summary-toggle { position: static; margin-top: .3rem; }

/* ── Document repository ─────────────────────── */
.doc-seccio-block {
    border: 1px solid var(--border-light);
    border-left: 3px solid var(--warning, #f39c12);
    padding: .6rem .8rem;
    margin-bottom: .6rem;
    background: #fff;
}
.doc-seccio-title {
    margin: 0 0 .3rem;
    font-size: .92rem;
    font-weight: 600;
    color: var(--text);
}
.doc-seccio-empty {
    margin: .2rem 0 0;
    font-size: .85rem;
    color: var(--danger, #c0392b);
    font-style: italic;
}
.doc-list {
    margin: .2rem 0 0;
    padding-left: 1.1rem;
    font-size: .88rem;
}
.doc-list li { margin-bottom: .2rem; }
.doc-link {
    color: var(--forest);
    text-decoration: underline;
    font-weight: 600;
}
.doc-link:hover { color: var(--tech-green); }

/* ── App footer ──────────────────────────────── */
.app-footer {
    text-align: center;
    padding: var(--sp-lg) var(--sp-md);
    margin-top: 1.5rem;
    font-size: .82rem;
    color: var(--text-muted);
    letter-spacing: .03em;
    border-top: 1px solid var(--border-light);
    background: var(--bg-alt);
    box-shadow: 0 9999px 0 9999px var(--bg-alt);
}
/* Footer unificat amb lcxxss: claim DM Sans + «today» manuscrit amb subratllat
   dibuixat a mà, i copyright petit. Mateix aspecte a tots dos sistemes. */
.footer-claim {
    font-family: 'DM Sans', 'IBM Plex Sans', sans-serif;
    font-weight: 300;
    font-size: 19px;
    color: #054f3a;
    letter-spacing: .01em;
    margin-bottom: .25rem;
}
.footer-today {
    font-family: 'Covered By Your Grace', cursive;
    font-weight: 400;
    font-size: 26px;
    color: #1da46f;
    position: relative;
    padding: 0 3px;
    margin-left: 2px;
    text-decoration: none;
}
.footer-today::after {
    content: "";
    position: absolute;
    left: 2px; right: 2px; bottom: 2px;
    height: 2px;
    background: #1da46f;
    transform: rotate(-2.6deg);
    transform-origin: left bottom;
}
.footer-copy {
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-muted);
    letter-spacing: .02em;
}
.footer-config-link {
    color: var(--text-muted);
    text-decoration: underline;
    transition: color .15s;
}
.footer-config-link:hover {
    color: var(--text-secondary);
}

/* ── Frosted glass (utility) ─────────────────── */
.frosted {
    background: rgba(255,255,255,.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,.3);
}

/* ── Memòries ────────────────────────────────── */
.memoria-bloc {
    border: 1px solid var(--border-light);
    border-left: 3px solid var(--tech-green);
    padding: 1rem 1.2rem;
    margin-bottom: .75rem;
    background: var(--bg-alt);
}
.memoria-bloc-image {
    border-left-color: var(--info);
}
.bloc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: .75rem;
}
.bloc-header-actions {
    display: flex;
    gap: .25rem;
    align-items: center;
}
.bloc-btn-remove {
    width: 28px;
    height: 28px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--danger);
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background .15s, color .15s;
}
.bloc-btn-remove:hover {
    background: var(--danger);
    color: #fff;
}
.bloc-btn-move {
    width: 28px;
    height: 28px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text-secondary);
    font-size: .65rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background .15s, color .15s;
}
.bloc-btn-move:hover {
    background: var(--bg-alt);
    color: var(--text);
}
.btn-genera-ia {
    height: 28px;
    border: none;
    border-radius: 6px;
    padding: 0 .7rem;
    margin-right: .35rem;
    font-family: 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif;
    font-size: .72rem;
    font-weight: 600;
    color: #1f2937;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    white-space: nowrap;
    background: linear-gradient(135deg, #8ecbf0 0%, #f7b5d3 100%);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .12);
    transition: filter .15s, transform .05s;
}
.btn-genera-ia:hover { filter: brightness(1.05); }
.btn-genera-ia:active { transform: translateY(1px); }
.btn-genera-ia:disabled { opacity: .65; cursor: default; }
.bloc-type-badge {
    font-family: 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif;
    font-size: .72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    padding: .2rem .6rem;
    color: #fff;
}
.bloc-type-section { background: var(--tech-green); }
.bloc-type-image { background: var(--info); }

.bloc-image-preview {
    border: 1px dashed var(--border);
    padding: .75rem;
    text-align: center;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
}
.bloc-image-preview img {
    max-width: 100%;
    max-height: 120px;
    object-fit: contain;
}

.memoria-bloc-actions .button {
    font-size: .82rem;
}

/* Image library grid (config) */
.image-library-config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: .75rem;
}
.image-library-config-item {
    border: 1px solid var(--border-light);
    background: #fff;
    overflow: hidden;
}
.image-library-config-item img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    display: block;
}
.image-library-config-info {
    padding: .4rem .5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .3rem;
}
.image-library-config-name {
    font-size: .72rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

/* Image library modal grid */
.image-library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: .6rem;
    margin-top: .75rem;
}
.image-library-grid-item {
    cursor: pointer;
    border: 2px solid transparent;
    overflow: hidden;
    transition: border-color .15s;
}
.image-library-grid-item:hover {
    border-color: var(--tech-green);
}
.image-library-grid-item img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    display: block;
}
.image-library-grid-item .img-name {
    font-size: .7rem;
    padding: .25rem .4rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.image-library-grid-item .img-keywords {
    white-space: normal;
    text-align: left;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    max-height: 2.5em;
}

.ft-preview-note {
    margin: 0;
    width: 100%;
    display: flex;
    align-items: center;
    gap: .6rem;
    font-size: .78rem;
    color: #5f6b67;
    line-height: 1.4;
    background: #f5faf7;
    border: 1px solid #e3eee8;
    padding: .55rem .65rem;
}
.ft-preview-note-icon {
    flex: 0 0 auto;
    display: inline-flex;
    color: #2f7a55;
}
.ft-preview-note-icon svg { width: 20px; height: 20px; display: block; }
.ft-preview-note-sep {
    flex: 0 0 auto;
    align-self: stretch;
    width: 1px;
    background: #cfe0d7;
}
.ft-preview-note-text { flex: 1 1 auto; }

.ft-inline-warning {
    margin: .35rem 0 0;
    font-size: .78rem;
    color: #8a6516;
    background: #fff8e8;
    border: 1px solid #f0e1b8;
    padding: .38rem .5rem;
    line-height: 1.35;
}

/* ── Presentations editor ────────────────────────────────── */
.pres-editor { max-width: 1280px; }

/* Single-row header: title + Desar + Identitat + Gemini | Translate + Preview */
.pres-header {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.pres-header-form {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 320px;
    min-width: 0;
}
.pres-title-input {
    flex: 1 1 auto;
    min-width: 180px;
    height: 38px;
    padding: 0 .75rem;
    font-family: 'IBM Plex Sans', 'IBM Plex Sans', sans-serif;
    font-size: 1rem;
    font-weight: 500;
    color: var(--forest);
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 0;
    box-sizing: border-box;
    line-height: 36px;
    vertical-align: middle;
    margin: 0;
    -webkit-appearance: none;
    appearance: none;
}
.pres-title-input:focus { outline: none; border-color: var(--forest); }

.pres-header-sep {
    width: 1px;
    height: 24px;
    background: var(--border-light);
    margin: 0 4px;
    flex-shrink: 0;
}
.pres-header-meta {
    margin-top: .85rem;
    font-size: .78rem;
    color: var(--text-secondary);
    font-family: 'IBM Plex Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
    letter-spacing: .04em;
}

/* Toolbar buttons: 38px tall (matches input + brand check) */
.pres-tool-btn {
    height: 38px;
    padding: 0 14px;
    margin: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: 'IBM Plex Sans', 'IBM Plex Sans', sans-serif;
    font-weight: 500;
    font-size: .82rem;
    line-height: 1;
    color: var(--forest);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 0;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    box-sizing: border-box;
    vertical-align: middle;
    -webkit-appearance: none;
    appearance: none;
    transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.pres-tool-btn:hover {
    background: var(--surface);
    border-color: var(--forest);
}
.pres-tool-btn:active { background: var(--bg-alt); }
.pres-btn-icon { color: currentColor; flex-shrink: 0; display: block; }

/* Primary CTA (Previsualitzar) — filled forest */
.pres-tool-btn-primary {
    color: #fff;
    background: var(--forest);
    border-color: var(--forest);
}
.pres-tool-btn-primary:hover {
    color: #fff;
    background: var(--primary-hover);
    border-color: var(--primary-hover);
}

/* Gemini "magic" button: soft pastel lilac→white gradient with wand icon */
.pres-tool-btn-ai {
    color: #5b3aab;
    border: 1px solid #d6c8f0;
    background: linear-gradient(110deg, #ffffff 0%, #f4ecff 35%, #ece0fb 65%, #ffe5f3 100%);
    background-size: 220% 100%;
    background-position: 0% 50%;
    transition: background-position .4s ease, transform .12s ease, border-color .12s ease, color .12s ease;
}
.pres-tool-btn-ai:hover {
    background-position: 100% 50%;
    color: #4b2da0;
    border-color: #c4afe9;
}
.pres-tool-btn-ai:disabled { opacity: .55; cursor: progress; }
.pres-tool-btn-ai .pres-wand { color: #8059dd; opacity: .95; }

/* Share preview modal */
.pres-share-link {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-bottom: 4px;
}
.pres-share-link input {
    flex: 1;
    height: 38px;
    padding: 0 .65rem;
    font-family: 'IBM Plex Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: .82rem;
    color: var(--text);
    background: var(--bg-alt);
    border: 1px solid var(--border);
    box-sizing: border-box;
    line-height: 1;
}
.pres-preview-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.pres-image-warning {
    margin-top: .9rem;
    padding: .65rem .85rem;
    background: #fff8e8;
    border: 1px solid #f0e1b8;
    color: #6b5a16;
    font-size: .85rem;
    line-height: 1.4;
}
.pres-image-warning a { color: var(--forest); font-weight: 600; }

/* Font picker rows */
.pres-font-opt {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border-light);
    cursor: pointer;
    transition: border-color .12s, background .12s;
}
.pres-font-opt:hover { border-color: var(--forest); }
.pres-font-opt:has(input:checked) { border-color: var(--forest); background: var(--bg-alt); }
.pres-font-opt input { accent-color: var(--forest); width: 16px; height: 16px; }
.pres-font-label {
    flex: 0 0 220px;
    font-size: 1rem;
    color: var(--forest);
    font-weight: 500;
}
.pres-font-preview {
    flex: 1;
    color: var(--text-secondary);
    font-size: .9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pres-editor-grid {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1.5rem;
    margin-top: 1.25rem;
    align-items: start;
}
.pres-sidebar-wrap {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-light);
    max-height: 70vh;
    background: var(--bg);
}
.pres-sidebar {
    flex: 1 1 auto;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.pres-slide-thumb {
    display: grid;
    grid-template-columns: 30px 1fr auto;
    gap: .5rem;
    padding: .65rem .75rem;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    align-items: center;
    transition: background .12s;
    position: relative;
}
.pres-thumb-actions {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 3px;
}
.pres-thumb-move {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: .6rem;
    line-height: 1;
    padding: 1px 2px;
    transition: color .12s;
}
.pres-thumb-move:hover { color: var(--tech-green); }
.pres-slide-thumb:hover { background: var(--surface); }
.pres-slide-thumb.is-selected { background: var(--mint); }
.pres-slide-thumb.is-mand { background: linear-gradient(to right, var(--mint) 0, var(--mint) 4px, transparent 4px); }
.pres-slide-thumb-num {
    font-family: 'IBM Plex Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: .75rem;
    color: var(--text-secondary);
    letter-spacing: .04em;
}
.pres-slide-thumb-body { min-width: 0; }
.pres-slide-thumb-tpl {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 600;
    font-size: .82rem;
    color: var(--forest);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pres-slide-thumb-preview {
    font-size: .7rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}
.pres-thumb-del {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: .85rem;
    line-height: 1;
    padding: 1px 2px;
    transition: color .12s;
}
.pres-thumb-del:hover { color: var(--danger); }
.pres-add-slide {
    flex-shrink: 0;
    background: var(--mint);
    border: none;
    border-top: 1px solid var(--tech-green);
    color: var(--forest);
    font-family: 'IBM Plex Sans', 'IBM Plex Sans', sans-serif;
    font-weight: 600;
    font-size: .88rem;
    padding: 1rem .85rem;
    cursor: pointer;
    transition: background .12s, color .12s;
}
.pres-add-slide:hover { background: var(--tech-green); color: #fff; }

.pres-canvas {
    border: 1px solid var(--border-light);
    background: #ebf0eb;
    min-height: 60vh;
    padding: 1.5rem;
}
.pres-canvas-empty {
    /* fill the canvas (min-height 60vh − 1.5rem padding on each side) so the text centers */
    min-height: calc(60vh - 3rem);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 1.5rem;
}
.pres-canvas-empty p { margin: .5rem 0; }
.pres-canvas-empty-main {
    color: var(--text);
    font-size: 1.05rem;
    font-weight: 500;
    line-height: 1.4;
    max-width: 38ch;
    margin: 0 auto .8rem;
}
.pres-canvas-empty-hint {
    color: var(--text-muted);
    font-size: .78rem;
    line-height: 1.4;
    max-width: 56ch;
    margin: 0 auto;
}

.pres-edit-form { display: flex; flex-direction: column; gap: 1rem; }
.pres-edit-head {
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-light);
}
.pres-edit-tpl-key {
    display: inline-block;
    font-family: 'IBM Plex Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: .7rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    padding: 2px 8px;
    background: var(--mint);
    color: var(--forest);
    margin-bottom: .5rem;
}
.pres-edit-head h3 { margin: 0; color: var(--forest); }
.pres-edit-head p { margin: .35rem 0 0; color: var(--text-secondary); font-size: .82rem; }
.pres-edit-field {
    display: flex;
    flex-direction: column;
    gap: .35rem;
}
.pres-edit-field span {
    font-family: 'IBM Plex Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: .72rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text-secondary);
}
.pres-edit-field input[type=text],
.pres-edit-field textarea {
    border: 1px solid var(--border);
    padding: .55rem .65rem;
    font-family: inherit;
    font-size: .9rem;
    background: #fff;
    border-radius: 0;
}
.pres-edit-field textarea { font-family: 'IBM Plex Sans', 'Segoe UI', system-ui, -apple-system, sans-serif; font-size: .82rem; line-height: 1.55; }
.pres-edit-hint { font-size: .72rem; color: var(--text-muted); margin-top: 2px; }
.pres-edit-hint code { background: var(--surface); padding: 1px 5px; border-radius: 0; }
.pres-budget-hint { color: var(--text-secondary); }
/* Límits/format a la dreta del títol del camp: text petit, gris, sense
   majúscules ni negreta (el títol del camp sí que és uppercase). El selector
   ha de ser prou específic per guanyar a `.pres-edit-field span`. */
.pres-edit-field span .pres-field-note {
    text-transform: none;
    letter-spacing: 0;
    font-weight: 400;
    font-size: .68rem;
    color: var(--text-muted);
    margin-left: .5rem;
}
.pres-edit-field.is-over-budget > span,
.pres-edit-field.is-over-budget .pres-field-note { color: var(--danger); }
.pres-edit-field.is-over-budget input,
.pres-edit-field.is-over-budget textarea { border-color: var(--danger); }

/* Toggle switch (camp type=toggle, p. ex. la diapositiva de vídeo final). */
.pres-toggle { display: flex; align-items: center; }
.pres-switch { display: inline-flex; align-items: center; cursor: pointer; }
.pres-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.pres-switch-track {
    position: relative;
    width: 42px;
    height: 24px;
    background: var(--border);
    border-radius: 999px;
    transition: background .15s ease;
    flex: none;
}
.pres-switch-knob {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 2px rgba(0,0,0,.25);
    transition: transform .15s ease;
}
.pres-switch input:checked + .pres-switch-track { background: #16a17a; }
.pres-switch input:checked + .pres-switch-track .pres-switch-knob { transform: translateX(18px); }
.pres-switch input:focus-visible + .pres-switch-track { box-shadow: 0 0 0 3px rgba(22,161,122,.35); }

.pres-img-row {
    display: flex;
    align-items: center;
    gap: .65rem;
}
.pres-img-preview {
    width: 96px;
    height: 64px;
    border: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: var(--surface);
}
.pres-img-preview img { width: 100%; height: 100%; object-fit: cover; }
.pres-img-none { font-size: .7rem; color: var(--text-muted); }

.pres-edit-actions {
    padding-top: 1rem;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    min-height: 24px;
    align-items: center;
}
.pres-autosave-status {
    font-family: 'IBM Plex Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: .75rem;
    letter-spacing: .04em;
    color: var(--text-muted);
    transition: color .15s;
}
.pres-autosave-status.is-pending { color: var(--text-muted); }
.pres-autosave-status.is-saving { color: var(--text-secondary); }
.pres-autosave-status.is-saved { color: var(--tech-green); }
.pres-autosave-status.is-error { color: var(--danger); }

.pres-tpl-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: .75rem;
    margin: 1rem 0;
}
@media (max-width: 760px) {
    .pres-tpl-grid { grid-template-columns: repeat(2, 1fr); }
}
.pres-tpl-card {
    border: 1px solid var(--border-light);
    background: #fff;
    padding: .5rem .5rem .65rem;
    cursor: pointer;
    text-align: center;
    font-family: inherit;
    transition: border-color .12s, background .12s, transform .08s;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}
.pres-tpl-card:hover { border-color: var(--forest); }
.pres-tpl-card:active { transform: translateY(1px); }
.pres-tpl-thumb {
    width: 100%;
    aspect-ratio: 5 / 3;
    background: var(--bg-alt);
    border: 1px solid var(--border-light);
    overflow: hidden;
    line-height: 0;
}
.pres-tpl-thumb-svg { display: block; width: 100%; height: 100%; }
.pres-tpl-card-name {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 500;
    font-size: .82rem;
    color: var(--forest);
    margin: 0;
    letter-spacing: 0;
}

@media (max-width: 880px) {
    .pres-editor-grid { grid-template-columns: 1fr; }
    .pres-sidebar { max-height: 40vh; }
}

/* ── Inici · landing diagram ──────────────────────────────────── */
/* ── Inici · document registry (editorial index) ────────────── */
:root { --paper: #fcfcfc; --ink: #16211b; --rule: #d9d6c9; }
.inici {
    background:
        linear-gradient(180deg, rgba(0,48,23,.05), rgba(0,48,23,0) 220px),
        var(--paper);
}
/* El fons de la home ha de coincidir amb el fons de l'hero (#f2efe6) perquè no
   es vegi cap tall de color entre l'hero «Hola de nou!» i la graella de targetes. */
body.is-inici { background: #f2efe6; }

.inici-hero { max-width: 940px; margin: 0 auto; padding: 3.4rem 1.6rem 1.8rem; }
.inici-title { margin: 0; }
.inici-greeting {
    display: block;
    font-family: 'Covered By Your Grace', cursive;
    font-weight: 400; font-size: 2rem; line-height: 1;
    color: var(--tech-green); margin-bottom: .35rem;
}
.inici-title-q {
    display: block;
    font-family: 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif;
    font-size: clamp(1.785rem, 4.59vw, 2.89rem); font-weight: 500;
    line-height: 1.02; letter-spacing: -.025em; color: var(--ink);
}
.inici-intro {
    font-size: 1.02rem; color: var(--text-secondary);
    margin: 1.4rem 0 0; max-width: 640px; line-height: 1.6;
}
.inici-intro b { font-weight: 600; color: var(--ink); }

.inici-index { max-width: 940px; margin: 0 auto; padding: 1.4rem 1.6rem 4rem; }
.inici-group { margin-top: 2.6rem; }
.inici-group:first-child { margin-top: .8rem; }
.inici-group-head {
    display: flex; align-items: baseline; gap: 1rem; flex-wrap: wrap;
    padding-bottom: .7rem; border-bottom: 2px solid var(--ink);
}
.inici-group-label {
    font-family: 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif;
    font-size: .86rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .16em; color: var(--ink);
}
.inici-group-note { font-size: .82rem; color: var(--text-secondary); }

.inici-row {
    display: grid;
    grid-template-columns: 64px 1fr auto 28px;
    align-items: center; gap: 1.25rem;
    padding: 1.35rem .4rem 1.35rem .2rem;
    border-bottom: 1px solid var(--rule);
    text-decoration: none; color: inherit;
    position: relative; transition: padding-left .25s ease;
}
.inici-row::before {
    content: ''; position: absolute; left: -1.6rem; right: -1.6rem; top: 0; bottom: 0;
    background: rgba(0,48,23,.04); opacity: 0; transition: opacity .2s ease; z-index: 0;
}
.inici-row:hover::before { opacity: 1; }
.inici-row:hover { padding-left: 1rem; }
.inici-row > * { position: relative; z-index: 1; }

.inici-code {
    font-family: 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif;
    font-size: 1.18rem; font-weight: 700; letter-spacing: .01em;
    color: #fff; background: var(--forest);
    width: 54px; height: 54px;
    display: flex; align-items: center; justify-content: center;
    transition: background .2s ease;
}
.inici-row:hover .inici-code { background: var(--tech-green); }

.inici-row-body { min-width: 0; }
.inici-row-title {
    display: block; font-family: 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif;
    font-size: 1.16rem; font-weight: 600; color: var(--ink);
    line-height: 1.25; margin-bottom: .25rem;
}
.inici-row-desc { display: block; font-size: .86rem; color: var(--text-secondary); line-height: 1.5; max-width: 46ch; }

.inici-row-meta { display: flex; flex-direction: column; align-items: flex-end; gap: .45rem; flex-shrink: 0; }
.inici-tag {
    display: inline-block; font-size: 10px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .07em; padding: 4px 9px; white-space: nowrap;
}
.inici-tag--auto { background: var(--mint); color: var(--forest); }
.inici-tag--ai { background: var(--forest); color: #fff; }
.inici-fmt {
    font-size: .72rem; font-weight: 500; letter-spacing: .03em;
    color: var(--text-muted); text-transform: uppercase;
}

.inici-row-go { display: flex; justify-content: flex-end; color: var(--text-muted); transition: color .2s, transform .25s ease; }
.inici-row-go svg { width: 22px; height: 22px; }
.inici-row:hover .inici-row-go { color: var(--forest); transform: translateX(4px); }

.inici-legend {
    margin: 2.4rem 0 0; display: flex; gap: 1.75rem; flex-wrap: wrap; align-items: center;
    font-size: .8rem; color: var(--text-secondary);
}
.inici-legend-item { display: flex; align-items: center; gap: .5rem; }

@media (max-width: 640px) {
    .inici-row {
        grid-template-columns: 48px 1fr; grid-template-areas: 'code body' 'code meta';
        gap: .4rem 1rem; align-items: start;
    }
    .inici-code { grid-area: code; width: 44px; height: 44px; font-size: 1rem; }
    .inici-row-body { grid-area: body; }
    .inici-row-meta { grid-area: meta; flex-direction: row; align-items: center; justify-content: flex-start; margin-top: .5rem; }
    .inici-row-go { display: none; }
    .inici-row:hover { padding-left: .2rem; }
}

/* ============================================================
   BOLD HOME REDESIGN — app chrome, hero and section cards
   Distinctive per-section colour theming. Palette lives in PHP
   (lc_nav_sections); colours per element are applied inline.
   ============================================================ */

/* ── App header (56px) ───────────────────────────── */
.lc-appbar {
    background: #054f3a;
    height: 56px;
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 14px;
    flex-shrink: 0;
    position: relative;
    z-index: 100;
}
.lc-appbar-brand { display: inline-flex; align-items: center; flex-shrink: 0; line-height: 0; }
.lc-appbar-logo { height: 35.94px; width: auto; object-fit: contain; filter: brightness(10); opacity: .95; }
.lc-appbar-sep { width: 1px; height: 24px; background: rgba(255,255,255,.3); flex-shrink: 0; }
.lc-appbar-title {
    color: #fff;
    opacity: .9;
    font-size: 17px;
    font-weight: 300;
    letter-spacing: .15em;
    text-transform: uppercase;
    position: relative;
    top: 1px;
    white-space: nowrap;
}
/* Títol responsiu: «GENERADOR DE MATERIALS» si hi cap, si no «MATERIALS». */
.lc-appbar-title-full { display: inline; }
.lc-appbar-title-short { display: none; }
@media (max-width: 900px) {
    .lc-appbar-title-full { display: none; }
    .lc-appbar-title-short { display: inline; }
}
.lc-appbar-spacer { flex: 1; }
.lc-appbar-user { color: #fff; font-size: 14px; white-space: nowrap; flex-shrink: 0; }
.lc-appbar-user b { font-weight: 700; }
.lc-appbar-logout {
    color: #a6d2bf;
    font-size: 12px;
    border: 1px solid rgba(255,255,255,.25);
    padding: 5px 10px;
    margin-left: 14px;
    cursor: pointer;
    background: transparent;
    font-family: inherit;
    letter-spacing: .05em;
    text-transform: uppercase;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
    transition: opacity .2s, border-color .2s;
}
.lc-appbar-logout:hover { opacity: .85; border-color: rgba(255,255,255,.5); }

/* ── Section subnav (42px, colour-themed per section) ── */
.lc-subnav {
    display: flex;
    align-items: stretch;
    padding: 0 20px;
    flex-shrink: 0;
    transition: background .2s;
    box-shadow: 0 4px 6px -2px rgba(0,0,0,.15);
    position: relative;
    z-index: 2;
    overflow-x: auto;
    scrollbar-width: none;
}
.lc-subnav::-webkit-scrollbar { display: none; }
.lc-subnav-link {
    display: inline-flex;
    align-items: center;
    font-family: 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif;
    font-size: 13.89px;
    line-height: 1;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    padding: 11px 15.87px;
    margin: 0 10px;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: opacity .2s;
}
.lc-subnav-link:hover { opacity: .82; }

/* ── Home hero (tree rings) ──────────────────────── */
.lc-hero-wrap {
    position: relative;
    background: #f2efe6;
    overflow: hidden;
    padding: 56px 24px 80px;
    text-align: center;
}
.lc-hero-rings {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    -webkit-mask-image: linear-gradient(to bottom, black, transparent);
    mask-image: linear-gradient(to bottom, black, transparent);
    pointer-events: none;
}
.lc-hero-title {
    position: relative;
    font-family: 'DM Sans', 'IBM Plex Sans', sans-serif;
    font-weight: 700;
    font-size: 32px;
    color: #054f3a;
    letter-spacing: -.01em;
    margin-bottom: 10px;
}
.lc-hero-sub {
    position: relative;
    font-family: 'DM Sans', 'IBM Plex Sans', sans-serif;
    font-weight: 400;
    font-size: 18px;
    color: #054f3a;
}

/* ── Home bold cards ─────────────────────────────── */
.lc-home-wrap {
    flex: 1;
    max-width: 1280px;
    width: 100%;
    margin: 0 auto;
    padding: 40px 24px 24px;
}
.lc-home-grid {
    display: grid;
    /* Mai més de 3 targetes per fila: 3×2 (ample) → 2×3 (mitjà) → 1×6 (estret). */
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: -56px;
    position: relative;
    z-index: 1;
}
@media (max-width: 980px) { .lc-home-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .lc-home-grid { grid-template-columns: 1fr; } }
.lc-bold-card {
    box-shadow: 0 6px 20px rgba(0,0,0,.12);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    border-top: 6px solid transparent;
    overflow: hidden;
    transition: transform .25s cubic-bezier(.34,1.56,.64,1), box-shadow .25s ease;
}
.lc-bold-card:hover {
    transform: translateY(-6px) scale(1.015);
    box-shadow: 0 16px 32px rgba(0,0,0,.18);
}
/* Square preview thumbnail; multiple images crossfade (data-rotate). */
.lc-bold-card-media {
    position: relative;
    z-index: 1;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: rgba(0,0,0,.04);
    flex-shrink: 0;
}
.lc-media-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: 0;
    transition: opacity .9s ease;
}
.lc-media-img.is-active { opacity: 1; }
.lc-bold-card-body {
    position: relative;
    z-index: 2;
    /* Overlap the bottom third of the image (media is square, so -33% of the
       card width = 33% of the media height). The top 15% of the coloured body
       fades from transparent to the card colour so the image melts into it. */
    margin-top: -33%;
    background: linear-gradient(to bottom, transparent 0%, var(--card-bg, #fff) 15%);
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 30px 24px 24px;
    flex: 1;
}
.lc-bold-card-icon { line-height: 0; }
.lc-bold-card-icon svg { width: 34px; height: 34px; display: block; }
.lc-bold-card-title {
    font-family: 'DM Sans', 'IBM Plex Sans', sans-serif;
    font-size: 22px;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.15;
}
.lc-bold-card-desc {
    font-size: 14px;
    color: #333333;
    line-height: 1.5;
    flex: 1;
}
.lc-bold-card-last {
    border-top: 1px solid rgba(0,0,0,.1);
    padding-top: 12px;
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    font-size: 12px;
    color: #1a1a1a;
    opacity: .65;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.lc-bold-card-last span { opacity: .8; }

@media (max-width: 640px) {
    /* El títol es manté (versió curta «MATERIALS»); no s'amaga del tot. */
    .lc-hero-title { font-size: 26px; }
    .lc-hero-sub { font-size: 16px; }
    .lc-home-grid { margin-top: -40px; }
}

/* La targeta d'enllaç extern (Creativitats XXSS) rep el mateix tractament que
   la resta: imatges que fan crossfade i cos que se solapa amb la imatge. Només
   es diferencia en què és un enllaç extern (rel="noopener") i no té «Últim:». */

/* ============================================================
   BOLD SECTION LISTS (classes ft2-*)
   Shared panel-less list style for every document section (fitxes,
   declaracions, LCA, memòries, presentacions). The section accent is
   the --sec custom property, set inline on .ft2-wrap from the palette
   in lc_nav_sections(); it defaults to the FT blue.
   ============================================================ */
.ft2-wrap { max-width: 1280px; width: 100%; margin: 0 auto; padding: 32px 24px 40px; --sec: #2f6d90; --ft2-ctl: 42px; }

/* Header row: title · MP tabs · Nova FT */
.ft2-head { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.ft2-title {
    font-family: 'DM Sans', 'IBM Plex Sans', sans-serif;
    font-weight: 500; font-size: 28px; color: #333; margin: 0;
    letter-spacing: -.01em; white-space: nowrap;
}
.ft2-head-spacer { flex: 1; }

/* MP2–MP5 tab pills */
.ft2-mp { display: inline-flex; background: #eef1f2; flex-shrink: 0; height: var(--ft2-ctl); }
.ft2-mp-tab {
    display: inline-flex; align-items: center;
    padding: 0 22px; font-size: 13px; font-weight: 700;
    text-decoration: underline; text-underline-offset: 3px;
    cursor: pointer; white-space: nowrap; border: none; background: transparent;
    color: var(--sec); width: auto; transition: background .2s, color .2s;
}
/* Header-row accent button matches the MP tab-group height. */
.ft2-head .ft2-btn { height: var(--ft2-ctl); padding-top: 0; padding-bottom: 0; }
.ft2-mp-tab.is-active { background: var(--sec); color: #fff; }

/* Accent / ghost buttons */
.ft2-btn {
    display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
    background: var(--sec); color: #fff; border: none; padding: 11px 22px;
    font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
    cursor: pointer; transition: opacity .2s; flex-shrink: 0; text-decoration: none;
    width: auto; min-height: 0; line-height: 1; margin: 0;
}
.ft2-btn:hover { opacity: .85; }
.ft2-btn--sm { padding: 10px 18px; }
.ft2-plus { font-size: 15px; font-weight: 700; line-height: 1; }
.ft2-btn-ghost {
    display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
    background: #fff; color: #333; border: 1px solid #ccc; padding: 10px 16px;
    font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
    cursor: pointer; flex-shrink: 0; text-decoration: none; width: auto; min-height: 0;
    line-height: 1; transition: border-color .2s, color .2s; margin: 0;
}
.ft2-btn-ghost:hover { border-color: #054f3a; color: #054f3a; }
/* Botó de contorn verd bosc sobre el fons de pàgina (Penjar fitxer). */
.ft2-btn-outline {
    display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
    background: var(--bg); color: #054f3a; border: 1px solid #054f3a; padding: 11px 22px;
    font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
    cursor: pointer; transition: background .2s; flex-shrink: 0; text-decoration: none;
    width: auto; min-height: 0; line-height: 1; margin: 0;
}
.ft2-btn-outline:hover { background: rgba(5, 79, 58, .06); }
.ft2-head .ft2-btn-outline { height: var(--ft2-ctl); padding-top: 0; padding-bottom: 0; }

/* Filter bar — every control shares the same fixed height so the row
   lines up perfectly (inputs, accent and ghost buttons computed different
   heights from their own padding/border). */
.ft2-filters { display: flex; flex-wrap: nowrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.ft2-filters select,
.ft2-filters input[type="text"] {
    border: 1px solid #ccc; padding: 10px 12px; font-size: 14px; color: #333;
    background: #fff; min-width: 0; flex: 1 1 0; margin: 0; min-height: 0; width: auto;
    height: var(--ft2-ctl);
}
.ft2-filters .ft2-btn,
.ft2-filters .ft2-btn-ghost { height: var(--ft2-ctl); padding-top: 0; padding-bottom: 0; }
.ft2-div { width: 1px; height: 24px; background: #ccc; flex-shrink: 0; }

/* Table */
.ft2-table-wrap { background: #fff; border: 1px solid #e5e5e5; box-shadow: 0 1px 4px rgba(0,0,0,.04); overflow-x: auto; margin-bottom: 24px; }
/* Nota d'alternativa (Google Sheets) — ocupa l'amplada de la caixa de la
   taula, entre la fila de títol/Nova presentació i la taula del llistat. */
.pres-alt-note {
    background: #faefeb; border: 1px solid #e5e5e5; border-left: 4px solid var(--sec, #9e5f4a);
    box-shadow: 0 1px 4px rgba(0,0,0,.04); padding: 16px 20px; margin-bottom: 20px;
}
.pres-alt-note p { margin: 0; font-size: 13.5px; line-height: 1.6; color: var(--text); }
.pres-alt-note a { color: var(--sec, #9e5f4a); font-weight: 600; word-break: break-all; }
.ft2-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.ft2-table thead th {
    background: #f8f8f8; color: var(--sec); padding: 14px 16px; text-align: left;
    font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
    border-bottom: 2px solid var(--sec);
}
.ft2-table td { padding: 14px 16px; border-bottom: 1px solid #e5e5e5; color: #333; vertical-align: middle; }
.ft2-grouphead { cursor: pointer; transition: background .15s; }
.ft2-grouphead:hover { background: #faf8f5; }
.ft2-chev { display: inline-block; width: 14px; color: #999; font-size: 11px; margin-right: 6px; }
.ft2-code { font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: 13px; font-weight: 700; color: #333; }
.ft2-grouplabel { color: #333; }
.ft2-count {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 20px; height: 20px; padding: 0 6px; background: var(--sec); color: #fff;
    font-size: 11px; font-weight: 700; flex-shrink: 0; margin-left: 10px; vertical-align: middle;
}
.ft2-child:hover { background: #faf8f5; }
.ft2-child-date { display: block; font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: 11px; color: #999; margin-top: 3px; font-weight: 400; }

/* Windows-app callout */
.ft2-callout { background: #fff; border-top: 3px solid var(--sec); padding: 20px 24px; font-size: 14px; color: #333; }
.ft2-callout a { color: var(--sec); font-weight: 600; }

/* Shared bits for the other section lists */
.ft2-table tbody tr { transition: background .15s; }
.ft2-table tbody tr:hover { background: #faf8f5; }
.ft2-date { font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: 12px; color: #666; }
.ft2-estat {
    display: inline-block; padding: 3px 8px; font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .04em; white-space: nowrap;
}
.ft2-estat--generat { background: #16a17a; color: #fff; }
.ft2-estat--esborrany { background: #fdf6d8; color: #8a7a1f; }
.ft2-estat--pendent { background: #fff3cd; color: #856404; }
.ft2-estat--penjat { background: transparent; color: #054f3a; border: 1px solid #054f3a; }

/* Etiquetes de declaracions: xips clicables sota el títol i al filtre. */
.decl-tags { display: block; margin-top: 4px; }
.decl-tag {
    display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px;
    margin: 2px 4px 0 0; background: #eef4f0; color: #054f3a;
    text-decoration: none; white-space: nowrap; transition: background .15s;
}
.decl-tag:hover { background: #d8e8e0; }
.decl-tag--active { background: #054f3a; color: #fff; margin: 0; }
.decl-tag--active:hover { background: #0a6b50; }
.decl-list-error { color: var(--danger, #b3261e); font-size: 13.5px; margin: 0 0 12px; }

@media (max-width: 960px) {
    .ft2-filters { flex-wrap: wrap; }
    .ft2-filters select, .ft2-filters input[type="text"] { flex: 1 1 150px; }
    .ft2-div { display: none; }
}
@media (max-width: 640px) {
    .ft2-wrap { padding: 20px 16px 32px; }
    .ft2-head { gap: 12px; }
    .ft2-title { font-size: 23px; }
}

/* Unsplash surprise picker */
.btn-surprise {
    min-height: 38px;
    border-color: var(--tech-green) !important;
    color: var(--forest) !important;
    font-weight: 700;
}
.unsplash-search-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: .75rem;
    align-items: end;
    margin-bottom: .85rem;
}
.unsplash-search-form label { margin: 0; }
.unsplash-search-form input[type="text"] { width: 100%; }
.unsplash-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: .6rem;
    margin-top: .75rem;
    max-height: 62vh;
    overflow: auto;
}
.unsplash-grid-item {
    cursor: pointer;
    border: 2px solid transparent;
    background: #fff;
    padding: 0;
    overflow: hidden;
    text-align: left;
    transition: border-color .15s;
}
.unsplash-grid-item:hover { border-color: var(--tech-green); }
.unsplash-grid-item img {
    width: 100%;
    height: 112px;
    object-fit: cover;
    display: block;
}
.unsplash-grid-item div {
    padding: .25rem .4rem;
    font-size: .7rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
@media (max-width: 760px) {
    .unsplash-search-form { grid-template-columns: 1fr; }
}
