/*
 * Espona · sistema de disseny (FD, validat per l'Oriol el 22/10/2026)
 *
 * Disseny: https://claude.ai/artifact/26PywcFTsWnZvZZ88wUzDz
 *   - Tipografies: Bricolage Grotesque (titulars) i Archivo (text).
 *   - Colors: tinta #1F1A14, fons #ECEAE3, llima #D4F03C.
 *   - Cantonades rectes (4-6 px); només les insígnies d'estat són rodones.
 *
 * Ordre del fitxer:
 *   1. Fonts (servides des d'assets/fonts)
 *   2. Fitxes (variables). Les noves són --e-*; les antigues (--bg-page,
 *      --text-primary, --font-serif...) hi apunten, perquè les pàgines
 *      d'abans canviïn d'aspecte sense tocar-les.
 *   3. Base i classes de sempre (.card, .btn, .form-control, taules...)
 *   4. Components nous (.e-*): capçalera, botons, targetes, insígnies, camps
 * La pàgina viva de components és design-system.php.
 */

/* Bricolage Grotesque i Archivo (OFL), servides des d'Espona. Subconjunts llatí i llatí ampliat. */
@font-face {
  font-family: 'Bricolage Grotesque';
  font-style: normal;
  font-weight: 400 800;
  font-stretch: 75% 100%;
  font-display: swap;
  src: url(../fonts/bricolage-grotesque-normal-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Bricolage Grotesque';
  font-style: normal;
  font-weight: 400 800;
  font-stretch: 75% 100%;
  font-display: swap;
  src: url(../fonts/bricolage-grotesque-normal-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Archivo';
  font-style: italic;
  font-weight: 400 700;
  font-stretch: 62% 125%;
  font-display: swap;
  src: url(../fonts/archivo-italic-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Archivo';
  font-style: italic;
  font-weight: 400 700;
  font-stretch: 62% 125%;
  font-display: swap;
  src: url(../fonts/archivo-italic-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-weight: 400 700;
  font-stretch: 62% 125%;
  font-display: swap;
  src: url(../fonts/archivo-normal-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-weight: 400 700;
  font-stretch: 62% 125%;
  font-display: swap;
  src: url(../fonts/archivo-normal-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* ── 2. Fitxes ─────────────────────────────────────────────────────── */
:root {
    /* Colors de marca */
    --e-ink: #1F1A14;           /* tinta: text, capçalera, botó principal */
    --e-ink-2: #4B4338;         /* tinta suau: text secundari, vores fosques */
    --e-ink-3: #5E5649;         /* text terciari (contrast AA sobre blanc i fons) */
    --e-paper: #F3F1EA;         /* text sobre tinta */
    --e-bg: #ECEAE3;            /* fons de pàgina */
    --e-surface: #FFFFFF;       /* targetes */
    --e-surface-2: #F6F4EE;     /* zones dins de targetes */
    --e-line: #E2DED3;          /* vores de targeta */
    --e-line-2: #CFC9BB;        /* vores de camps i botons secundaris */
    --e-line-3: #EEEAE0;        /* separadors suaus */
    --e-lime: #D4F03C;          /* accent */
    --e-lime-2: #C3DF2A;        /* accent en hover */
    --e-lime-soft: #F1F9C8;

    /* Estats (fons / text) */
    --e-ok-bg: #DDF0DA;   --e-ok: #22571F;
    --e-info-bg: #E3ECFB; --e-info: #1D4FA8;
    --e-warn-bg: #FBEFD9; --e-warn: #8A5300;
    --e-bad-bg: #FBE4E1;  --e-bad: #A3261C;
    --e-mute-bg: #ECE7DC; --e-mute: #4B4338;

    /* Xarxes (fons / text) */
    --e-ig-bg: #F1E6FB; --e-ig: #5B2C83;
    --e-fb-bg: #E3ECFB; --e-fb: #1D4FA8;
    --e-li-bg: #E1EEF6; --e-li: #0B5A86;
    --e-wp-bg: #ECE7DC; --e-wp: #4B4338;
    --e-gb-bg: #E4F2E1; --e-gb: #2F6B2F;

    /* Tipografia */
    --e-font-display: 'Bricolage Grotesque', 'Archivo', system-ui, sans-serif;
    --e-font-text: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;

    /* Forma */
    --e-radius: 6px;
    --e-radius-sm: 4px;
    --e-radius-pill: 999px;
    --e-focus: 0 0 0 3px var(--e-lime), 0 0 0 5px var(--e-ink);
    --e-shadow: 0 1px 2px rgba(31, 26, 20, .06), 0 8px 24px rgba(31, 26, 20, .06);

    /* Fitxes antigues → noves (no les esborris: les fan servir totes les pàgines) */
    --bg-page: var(--e-bg);
    --bg-surface: var(--e-surface);
    --bg-surface-alt: var(--e-surface-2);
    --bg-dark: var(--e-ink);
    --bg-dark-hover: #2E2820;
    --text-primary: var(--e-ink);
    --text-secondary: var(--e-ink-2);
    --text-tertiary: var(--e-ink-3);
    --text-on-dark: var(--e-paper);
    --border: var(--e-line-2);
    --border-light: var(--e-line);
    --accent: var(--e-lime);
    --accent-hover: var(--e-lime-2);
    --accent-text: var(--e-ink);
    --accent-subtle: var(--e-lime-soft);
    --success: var(--e-ok);       --success-bg: var(--e-ok-bg);
    --error: var(--e-bad);        --error-bg: var(--e-bad-bg);
    --warning: var(--e-warn);     --warning-bg: var(--e-warn-bg);
    --info: var(--e-info);        --info-bg: var(--e-info-bg);
    --font-serif: var(--e-font-display);
    --font-condensed: var(--e-font-text);
    --font-body: var(--e-font-text);
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
}

/* Tema fosc: opcional (data-theme="dark" a <html>). Encara no s'activa sol:
   moltes pàgines antigues tenen fons blancs escrits a mà. */
[data-theme="dark"] {
    --e-ink: #F3F1EA;
    --e-ink-2: #CFC9BB;
    --e-ink-3: #A9A293;
    --e-paper: #1F1A14;
    --e-bg: #15120E;
    --e-surface: #221D17;
    --e-surface-2: #2A241D;
    --e-line: #3A332A;
    --e-line-2: #4B4338;
    --e-line-3: #2E2820;
    --e-lime-soft: #34391A;
    --bg-dark: #0E0C09;
    --e-ok-bg: #1E3A1C;   --e-ok: #A8DCA2;
    --e-info-bg: #1B2A44; --e-info: #A9C4F5;
    --e-warn-bg: #3D2C0F; --e-warn: #F2C27A;
    --e-bad-bg: #44191A;  --e-bad: #F3A39B;
    --e-mute-bg: #2E2820; --e-mute: #CFC9BB;
}

/* ── 3. Base ───────────────────────────────────────────────────────── */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--e-font-text);
    background: var(--e-bg);
    color: var(--e-ink);
    line-height: 1.55;
    font-size: 15px;
    font-stretch: 90%; /* Archivo una mica condensada (petició de l'Oriol, 22/10) */
    -webkit-font-smoothing: antialiased;
}
a { color: var(--e-ink); text-decoration: none; border-bottom: 1px solid var(--e-line-2); }
a:hover { border-bottom-color: var(--e-ink); }
:focus-visible { outline: none; box-shadow: var(--e-focus); border-radius: var(--e-radius-sm); }
h1, h2, h3 { font-family: var(--e-font-display); font-stretch: 85%; font-weight: 700; letter-spacing: -0.01em; line-height: 1.15; }
button, input, select, textarea { font-family: inherit; }
input[type=checkbox], input[type=radio] { accent-color: var(--e-ink); width: 18px; height: 18px; vertical-align: middle; }
.e-card--dark code { background: #2E2820 !important; color: #F3F1EA; }

.container { max-width: 1360px; margin: 0 auto; padding: 32px; }
.page-header {
    display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 16px;
    margin-bottom: 28px;
}
.page-header h1, .page-title {
    font-family: var(--e-font-display);
    font-stretch: 78%;
    font-size: 44px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.02em;
}

.card {
    background: var(--e-surface);
    border: 0;
    border-radius: var(--e-radius);
    padding: 24px;
    margin-bottom: 16px;
}
.card h2 { font-family: var(--e-font-display); font-stretch: 85%; font-size: 24px; font-weight: 700; margin-bottom: 16px; }

.stat-card { text-align: left; padding: 20px 24px; }
.stat-card .stat-number { font-family: var(--e-font-display); font-stretch: 80%; font-size: 40px; font-weight: 800; line-height: 1; color: var(--e-ink); }
.stat-card .stat-label { font-size: 14px; font-weight: 600; color: var(--e-ink-2); margin-top: 6px; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 44px; padding: 0 20px;
    border-radius: var(--e-radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    font-family: var(--e-font-text); font-size: 15px; font-weight: 700; line-height: 1;
    text-align: center; text-decoration: none;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.btn:hover { border-bottom-color: transparent; }
.btn-primary { background: var(--e-ink); color: var(--e-paper); border-color: var(--e-ink); }
.btn-primary:hover { background: #3A332A; border-color: #3A332A; }
.btn-accent { background: var(--e-lime); color: #1F1A14; border-color: var(--e-lime); }
.btn-accent:hover { background: var(--e-lime-2); border-color: var(--e-lime-2); }
.btn-secondary { background: var(--e-surface); color: var(--e-ink); border-color: var(--e-line-2); }
.btn-secondary:hover { border-color: var(--e-ink); }
.btn-ghost { background: transparent; color: var(--e-ink); border-color: transparent; }
.btn-ghost:hover { background: var(--e-surface-2); }
.btn-danger { background: var(--e-bad); color: #fff; border-color: var(--e-bad); }
.btn-danger:hover { background: #7E1B13; border-color: #7E1B13; }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 14px; }
.btn[disabled], .btn:disabled { opacity: .5; cursor: not-allowed; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; color: var(--e-ink); }
.form-control {
    width: 100%; min-height: 44px; padding: 10px 12px;
    border: 1px solid var(--e-line-2); border-radius: var(--e-radius-sm);
    font-family: var(--e-font-text); font-size: 15px; color: var(--e-ink);
    background: var(--e-surface);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.form-control:focus { outline: none; border-color: var(--e-ink); box-shadow: 0 0 0 3px var(--e-lime); }
.form-control::placeholder { color: var(--e-ink-3); }
select.form-control { appearance: auto; }
textarea.form-control { resize: vertical; min-height: 88px; line-height: 1.5; }

table { width: 100%; border-collapse: collapse; }
th { font-size: 13px; font-weight: 700; color: var(--e-ink-2); text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--e-line-2); }
td { padding: 12px 14px; border-bottom: 1px solid var(--e-line-3); font-size: 14px; }
tr { transition: background .15s ease; }
tbody tr:hover { background: var(--e-surface-2); }

.toast {
    position: fixed; top: 24px; right: 24px; z-index: 10000;
    padding: 14px 18px; min-width: 280px; max-width: 420px;
    display: flex; align-items: center; gap: 16px;
    border-radius: var(--e-radius); border-left: 4px solid;
    font-size: 15px; font-weight: 600;
    box-shadow: var(--e-shadow);
    animation: slideDown .3s ease; transition: opacity .3s ease;
}
.toast-message { flex: 1; }
.toast-close { background: none; border: none; font-size: 20px; cursor: pointer; opacity: .6; color: inherit; padding: 0; line-height: 1; }
.toast-close:hover { opacity: 1; }
.toast-success { background: var(--e-ok-bg); color: var(--e-ok); border-left-color: var(--e-ok); }
.toast-error { background: var(--e-bad-bg); color: var(--e-bad); border-left-color: var(--e-bad); }
.toast-info { background: var(--e-info-bg); color: var(--e-info); border-left-color: var(--e-info); }
.toast-warning { background: var(--e-warn-bg); color: var(--e-warn); border-left-color: var(--e-warn); }
.toast-action { background: var(--e-ink); color: var(--e-paper); border: 0; border-radius: var(--e-radius-sm); min-height: 36px; padding: 0 14px; font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; flex: none; }
.toast-action:hover { background: #3A332A; }
@media (max-width: 600px) { .toast { left: 12px; right: 12px; top: 12px; min-width: 0; max-width: none; } }

.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(31, 26, 20, .6); z-index: 10001; align-items: center; justify-content: center; }
.modal-overlay.open { display: flex; }
.modal { background: var(--e-surface); border-radius: var(--e-radius); padding: 28px; max-width: 420px; width: 90%; animation: fadeInUp .2s ease; }
.modal h3 { font-family: var(--e-font-display); font-stretch: 85%; font-size: 22px; margin-bottom: 8px; }
.modal p { font-size: 15px; color: var(--e-ink-2); margin-bottom: 20px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* Insígnies d'estat antigues: ara són les rodones del sistema */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: var(--e-radius-pill); font-size: 13px; font-weight: 700; line-height: 1.4; background: var(--e-mute-bg); color: var(--e-mute); }
.badge-draft { background: var(--e-mute-bg); color: var(--e-mute); }
.badge-review { background: var(--e-warn-bg); color: var(--e-warn); }
.badge-approved { background: var(--e-lime-soft); color: #3F4A00; }
.badge-published { background: var(--e-ok-bg); color: var(--e-ok); }
.badge-partial { background: var(--e-warn-bg); color: var(--e-warn); }
.badge-archived { background: var(--e-line-3); color: var(--e-ink-3); }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.empty-state { text-align: center; padding: 48px 24px; color: var(--e-ink-2); }
.empty-state p { font-size: 16px; margin-bottom: 16px; }
.progress-track { height: 8px; background: var(--e-line-3); border-radius: var(--e-radius-pill); overflow: hidden; }
.progress-fill { height: 100%; background: var(--e-ink); border-radius: var(--e-radius-pill); transition: width .4s ease; }

.site-footer { border-top: 1px solid var(--e-line); margin-top: 48px; padding: 28px 32px; color: var(--e-ink-3); font-size: 13px; }
.site-footer .footer-inner { max-width: 1360px; margin: 0 auto; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 16px; align-items: center; }
.site-footer a { color: var(--e-ink-2); border: none; }
.site-footer a:hover { color: var(--e-ink); }
.site-footer .footer-links { display: flex; gap: 20px; flex-wrap: wrap; }

@keyframes fadeInUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

.card-section-title { font-family: var(--e-font-display); font-stretch: 85%; font-size: 20px; font-weight: 700; margin: 24px 0 8px; }
.card-section-desc { font-size: 14px; color: var(--e-ink-2); margin-bottom: 16px; }
.channel-block { border: 1px solid var(--e-line); border-radius: var(--e-radius); padding: 16px; margin-bottom: 8px; }
.channel-badge { display: inline-flex; align-items: center; padding: 2px 8px; font-size: 12px; font-weight: 700; border-radius: var(--e-radius); color: #fff; }
.channel-toggle { flex: 1; font-weight: 600; cursor: pointer; margin: 0; font-size: 15px; color: var(--e-ink); }
.channel-status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 12px; border-radius: var(--e-radius-sm); font-size: 14px; }
.channel-status-ok { background: var(--e-ok-bg); }
.channel-status-label { font-weight: 700; color: var(--e-ok); font-size: 13px; }
.channel-status-name { color: var(--e-ink-2); }
.channel-status-meta { color: var(--e-ink-3); font-size: 13px; }
.channel-status .btn { margin-left: auto; }
.channel-hint { font-size: 13px; color: var(--e-ink-3); }

.layout-2col { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.layout-editor { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.layout-halves { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.layout-thirds { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.layout-3-1 { display: grid; grid-template-columns: 3fr 1fr; gap: 16px; }
.flex-row { display: flex; gap: 8px; }
.flex-row-lg { display: flex; gap: 16px; }
.flex-wrap { flex-wrap: wrap; }
.flex-col { display: flex; flex-direction: column; }
.gap-xs { gap: 4px; } .gap-sm { gap: 8px; } .gap-md { gap: 16px; } .gap-xl { gap: 32px; }
.items-center { align-items: center; } .items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.radio-label { display: flex; align-items: center; gap: 8px; font-size: 15px; color: var(--e-ink); cursor: pointer; }

/* ── 4. Components nous ────────────────────────────────────────────── */

/* Capçalera */
.e-header { background: var(--bg-dark); color: #F3F1EA; }
.e-header__in { max-width: 1360px; margin: 0 auto; padding: 0 32px; display: flex; align-items: center; gap: 24px; min-height: 64px; }
.e-header a { border: 0; }
.e-logo { display: inline-flex; align-items: center; border: 0; flex: none; }
.e-logo img { height: 30px; width: auto; display: block; }
.e-nav { display: flex; flex-wrap: wrap; gap: 4px; flex: 1 1 auto; align-items: center; }
.e-nav a, .e-nav summary {
    display: inline-flex; align-items: center; gap: 8px; min-height: 40px;
    padding: 0 14px; border-radius: var(--e-radius-sm);
    color: #E6E2D6; font-weight: 500; font-size: 15px; cursor: pointer; list-style: none;
}
.e-nav summary::-webkit-details-marker { display: none; }
.e-nav a:hover, .e-nav summary:hover { background: #2E2820; color: #F3F1EA; }
.e-nav a[aria-current="page"] { background: #F3F1EA; color: #1F1A14; font-weight: 600; }
.e-nav .e-count { background: var(--e-lime); color: #1F1A14; border-radius: var(--e-radius-pill); padding: 1px 8px; font-size: 13px; font-weight: 700; }
.e-more { position: relative; }
.e-more__menu { position: absolute; top: calc(100% + 6px); left: 0; z-index: 50; min-width: 220px; background: var(--e-surface); border-radius: var(--e-radius); box-shadow: var(--e-shadow); padding: 6px; display: flex; flex-direction: column; }
.e-more > .e-more__menu { left: auto; right: 0; }   /* «Més» és a la dreta del menú: s'obre cap a dins, no fora de la pantalla */
.e-more__menu hr { border: 0; border-top: 1px solid var(--e-line-3); margin: 4px 6px; }
.e-more__menu .e-count { margin-left: auto; background: var(--e-surface-2); color: var(--e-ink-2); border-radius: var(--e-radius-pill); padding: 0 8px; font-size: 13px; font-weight: 700; }
.e-more__menu a { color: var(--e-ink); min-height: 40px; }
.e-more__menu a:hover { background: var(--e-surface-2); color: var(--e-ink); }
.e-user { display: flex; align-items: center; gap: 10px; flex: none; }
.e-avatar { width: 40px; height: 40px; border-radius: var(--e-radius-pill); background: #4B4338; color: #F3F1EA; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex: none; }
.e-user a { color: #CFC9BB; font-size: 14px; }
.e-user a:hover { color: #F3F1EA; }
.e-burger { display: none; margin-left: auto; width: 44px; height: 44px; border: 1px solid #4B4338; border-radius: var(--e-radius-sm); background: transparent; color: #F3F1EA; font-size: 20px; cursor: pointer; }


/* Targetes i seccions */
.e-card { background: var(--e-surface); border-radius: var(--e-radius); padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.e-card--dark { background: var(--e-ink); color: var(--e-paper); }
.e-card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.e-card__title { font-family: var(--e-font-display); font-stretch: 85%; font-weight: 700; font-size: 24px; margin: 0; }
.e-item { display: flex; gap: 16px; padding: 14px; border: 1px solid var(--e-line); border-radius: var(--e-radius); }

/* Insígnies d'estat: rodones */
.e-status { display: inline-flex; align-items: center; gap: 6px; border-radius: var(--e-radius-pill); padding: 3px 10px; font-size: 13px; font-weight: 700; line-height: 1.4; white-space: nowrap; }
.e-status--draft { background: var(--e-mute-bg); color: var(--e-mute); }
.e-status--review { background: var(--e-warn-bg); color: var(--e-warn); }
.e-status--approved { background: var(--e-lime-soft); color: #3F4A00; }
.e-status--scheduled { background: var(--e-info-bg); color: var(--e-info); }
.e-status--published { background: var(--e-ok-bg); color: var(--e-ok); }
.e-status--partial { background: var(--e-warn-bg); color: var(--e-warn); }
.e-status--error { background: var(--e-bad-bg); color: var(--e-bad); }
.e-status--archived { background: var(--e-line-3); color: var(--e-ink-3); }
.e-status--lime { background: var(--e-lime); color: #1F1A14; }

/* Insígnies de xarxa: rectes */
.e-net { display: inline-flex; align-items: center; border-radius: var(--e-radius); padding: 2px 7px; font-size: 13px; font-weight: 700; line-height: 1.4; }
.e-net--instagram { background: var(--e-ig-bg); color: var(--e-ig); }
.e-net--facebook { background: var(--e-fb-bg); color: var(--e-fb); }
.e-net--linkedin { background: var(--e-li-bg); color: var(--e-li); }
.e-net--wordpress { background: var(--e-wp-bg); color: var(--e-wp); }
.e-net--google_business { background: var(--e-gb-bg); color: var(--e-gb); }

/* Camps */
.e-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.e-field__label { font-size: 14px; font-weight: 600; }
.e-field__hint { font-size: 13px; color: var(--e-ink-3); }
.e-field__error { font-size: 13px; color: var(--e-bad); font-weight: 600; }

/* Titulars */
.e-display { font-family: var(--e-font-display); font-stretch: 78%; font-weight: 800; font-size: 56px; line-height: 1; letter-spacing: -0.02em; margin: 0; }
.e-lead { font-size: 18px; color: var(--e-ink-2); margin: 0; }
.e-muted { color: var(--e-ink-3); }
.e-visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── Mòbil ─────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
    .e-header__in { padding: 0 16px; flex-wrap: wrap; gap: 12px; }
    .e-burger { display: inline-flex; align-items: center; justify-content: center; }
    .e-nav, .e-user { display: none; width: 100%; }
    .e-header.open .e-nav { display: flex; flex-direction: column; align-items: stretch; padding-bottom: 12px; }
    .e-header.open .e-user { display: flex; padding-bottom: 16px; }
    .e-more > .e-more__menu { position: static; box-shadow: none; background: #2E2820; }
    .e-more > .e-more__menu a { color: #E6E2D6; }
    .e-more > .e-more__menu a:hover, .e-more > .e-more__menu a[aria-current="page"] { background: #3A332B; color: #F3F1EA; }
    .e-more > .e-more__menu hr { border-top-color: #4B4338; }
    .e-more > .e-more__menu .e-count { background: #4B4338; color: #F3F1EA; }
    /* La marca activa continua sent un desplegable que flota per sobre (abans s'obria dins la capçalera,
       empenyia el botó del menú i la marca triada quedava en text clar sobre llima clar) */
    .e-brand { position: static; }
    .e-brand__menu { left: 16px; right: 16px; min-width: 0; top: 60px; max-height: 65vh; }
    .e-header__in { position: relative; }
}
@media (max-width: 768px) {
    .container { padding: 16px; }
    .page-header { flex-direction: column; align-items: stretch; }
    .page-header h1, .page-title { font-size: 32px; }
    .e-display { font-size: 38px; }
    .layout-2col, .layout-editor, .layout-halves, .layout-thirds, .layout-3-1, .grid-2, .grid-3 { grid-template-columns: 1fr !important; }
    .card { padding: 16px; }
    .card h2 { font-size: 20px; }
    .stat-card .stat-number { font-size: 30px; }
    .page-header .btn { width: 100%; }
    table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }
    table th, table td { padding: 8px 10px; font-size: 13px; }
    .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .form-control { font-size: 16px; } /* sense zoom a iOS */
    .flex-row { flex-wrap: wrap; }
    .calendar-grid { display: flex; flex-direction: column; gap: 0; background: none; }
    .calendar-header-cell { display: none; }
    .calendar-cell.empty { display: none; }
    .calendar-cell { min-height: auto; padding: 16px; border-bottom: 1px solid var(--e-line); display: flex; flex-direction: column; gap: 4px; }
    .calendar-cell.today { border-left: 3px solid var(--e-lime); }
    .calendar-day { font-size: 15px; font-weight: 700; margin-bottom: 2px; }
    .calendar-post { font-size: 13px; padding: 8px 10px; width: 100%; }
    .calendar-thumb { width: 32px; height: 32px; }
    .calendar-nav { gap: 8px; }
    .calendar-nav h2 { font-size: 16px; min-width: 120px; }
    .prop-selector select { font-size: 14px; }
    #img-modal div { max-width: 95vw !important; }
    #img-modal img { max-width: 95vw !important; max-height: 85vh !important; }
}

/* Pàgines d'accés (login, contrasenya oblidada, restabliment) */
body.e-auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--e-bg); }
.e-auth .login-wrapper { width: 100%; max-width: 440px; padding: 20px; }
.e-auth .login-box { background: var(--e-surface); border-radius: var(--e-radius); padding: 40px 36px; border-top: 6px solid var(--e-lime); }
.e-auth .e-auth__logo { display: flex; justify-content: center; margin-bottom: 12px; }
.e-auth .login-box h1:not(.e-auth__logo) { font-family: var(--e-font-display); font-stretch: 80%; font-weight: 800; font-size: 32px; text-align: center; margin-bottom: 8px; }
.e-auth .subtitle { font-size: 15px; color: var(--e-ink-2); text-align: center; margin-bottom: 28px; }
.e-auth .btn { width: 100%; margin-top: 8px; }
.e-auth .alert-error, .e-auth .alert-success { padding: 10px 14px; border-radius: var(--e-radius-sm); border-left: 4px solid; margin-bottom: 16px; font-size: 14px; }
.e-auth .alert-error { background: var(--e-bad-bg); color: var(--e-bad); }
.e-auth .alert-success { background: var(--e-ok-bg); color: var(--e-ok); }
.e-auth .remember-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.e-auth .remember-row label { font-size: 14px; color: var(--e-ink-2); display: flex; align-items: center; gap: 6px; font-weight: 500; margin: 0; }
.e-auth .remember-row a, .e-auth .back-link { font-size: 14px; color: var(--e-ink-2); }
.e-auth .back-link { display: block; text-align: center; margin-top: 16px; }

/* Només per a lectors de pantalla */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* Marca activa (capçalera) */
.e-brand { position: relative; flex: none; }
.e-brand summary { list-style: none; display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px; border-radius: var(--e-radius-sm); background: #2E2820; color: #F3F1EA; font-weight: 700; font-size: 15px; cursor: pointer; max-width: 240px; }
.e-brand summary::-webkit-details-marker { display: none; }
.e-brand summary:hover { background: #3A332B; }
.e-brand__dot { width: 9px; height: 9px; border-radius: 999px; background: var(--e-lime); flex: none; }
.e-brand__name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.e-brand__menu { max-height: 70vh; overflow: auto; }
.e-brand__menu a[aria-current="true"] { font-weight: 700; background: var(--e-lime-soft); }
@media (max-width: 900px) { .e-brand summary { max-width: 52vw; } }
[hidden] { display: none !important; }

/* Avisos dins de les pàgines (.alert-info / -warning / -error / -success) */
.alert { padding: 12px 16px; border-radius: var(--e-radius-sm); border-left: 4px solid; font-size: 15px; line-height: 1.45; }
.alert-info { background: var(--e-info-bg); color: var(--e-info); }
.alert-warning { background: var(--e-warn-bg); color: var(--e-warn); }
.alert-error { background: var(--e-bad-bg); color: var(--e-bad); }
.alert-success { background: var(--e-ok-bg); color: var(--e-ok); }
.alert a { color: inherit; font-weight: 700; }

/* Capçalera de pàgina de les pantalles del procés: títol a l'esquerra, eines a la dreta */
.e-pagehead { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.e-pagehead__t { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.e-pagehead__tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.e-monthnav { display: flex; align-items: center; gap: 8px; }
.e-monthnav .btn { width: 44px; padding: 0; }
.e-monthnav strong { min-width: 132px; text-align: center; font-size: 16px; }
.e-monthnav h1 { font-size: 40px; }
@media (max-width: 600px) {
    .e-monthnav { flex-wrap: wrap; }
    .e-monthnav h1 { font-size: 28px; }
    .e-pagehead__tools { width: 100%; }
    .e-pagehead__tools .e-seg { flex: 1 1 100%; }
    .e-pagehead__tools .e-seg > * { flex: 1 1 0; justify-content: center; }
}

/* Control segmentat (Mes · Setmana · Llista, modes, pestanyes de vista) */
.e-seg { display: inline-flex; gap: 4px; background: var(--e-line); padding: 4px; border-radius: var(--e-radius-sm); }
.e-seg a, .e-seg button { min-height: 38px; display: inline-flex; align-items: center; padding: 0 14px; border-radius: 3px; border: 0; background: transparent; font: inherit; font-weight: 600; font-size: 14px; color: var(--e-ink-2); cursor: pointer; white-space: nowrap; }
.e-seg a:hover, .e-seg button:hover { color: var(--e-ink); }
.e-seg [aria-current="page"], .e-seg [aria-selected="true"], .e-seg [aria-pressed="true"] { background: var(--e-surface); color: var(--e-ink); font-weight: 700; }

/* Menú d'accions (details): «Altres eines», «Nova peça» per marca… */
.e-menu { position: relative; }
.e-menu > summary { list-style: none; }
.e-menu > summary::-webkit-details-marker { display: none; }
.e-menu > .e-more__menu { left: auto; right: 0; max-height: 360px; overflow: auto; }
.e-menu > .e-more__menu a, .e-menu > .e-more__menu button { display: flex; align-items: center; min-height: 40px; padding: 0 14px; border: 0; border-radius: var(--e-radius-sm); background: none; font: inherit; font-size: 15px; color: var(--e-ink); text-align: left; cursor: pointer; }
.e-menu > .e-more__menu a:hover, .e-menu > .e-more__menu button:hover { background: var(--e-surface-2); }

/* Selecció de moltes peces (assets/js/espona-bulk.js) */
.e-selecting [data-bulk-id] { position: relative; cursor: pointer; user-select: none; }
.e-pick { display: none; position: absolute; top: 6px; right: 6px; z-index: 3; width: 20px; height: 20px; border-radius: 4px; border: 2px solid var(--e-ink-2); background: var(--e-surface); pointer-events: none; }
.e-selecting .e-pick { display: block; }
.e-selecting [data-bulk-id].is-picked { outline: 3px solid var(--e-ink); outline-offset: -2px; }
.e-selecting .is-picked > .e-pick { background: var(--e-ink); border-color: var(--e-ink); }
.e-selecting .is-picked > .e-pick::after { content: ""; position: absolute; left: 5px; top: 1px; width: 5px; height: 10px; border: solid var(--e-lime); border-width: 0 3px 3px 0; transform: rotate(45deg); }
.e-selecting [data-bulk-locked] { opacity: .45; cursor: not-allowed; }
.e-selecting [data-bulk-locked] > .e-pick { display: none; }
.e-bulk { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 900; width: min(1120px, calc(100vw - 24px)); max-height: calc(100vh - 32px); overflow: auto;
    background: var(--e-ink); color: var(--e-paper); border-radius: var(--e-radius); box-shadow: 0 12px 40px rgba(31, 26, 20, .35); padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; }
.e-bulk__row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.e-bulk__n { font-size: 15px; margin-right: auto; }
.e-bulk .btn-ghost { color: #E6E2D6; }
.e-bulk .btn-ghost:hover { background: #2E2820; color: #F3F1EA; }
.e-bulk__quick { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding-top: 10px; border-top: 1px solid #3A332A; font-size: 14px; }
.e-bulk__f { display: inline-flex; align-items: center; gap: 6px; color: #CFC9BB; font-weight: 600; }
.e-bulk select, .e-bulk input[type="month"] { min-height: 36px; padding: 0 8px; border: 1px solid #4B4338; border-radius: var(--e-radius-sm); background: #2E2820; color: #F3F1EA; font: inherit; font-size: 14px; color-scheme: dark; }
.e-bulk__confirm p { font-size: 15px; line-height: 1.45; margin-bottom: 10px; }
.e-bulk__warn { color: #F2C66D; font-weight: 700; }
.e-chips { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.e-chip { min-height: 36px; padding: 0 12px; border-radius: var(--e-radius-sm); border: 1px solid #4B4338; background: transparent; color: #E6E2D6; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.e-chip[aria-pressed="true"] { background: var(--e-paper); border-color: var(--e-paper); color: var(--e-ink); }
body.e-has-bulk { padding-bottom: 200px; }
@media (max-width: 700px) {
    .e-bulk { bottom: 8px; padding: 10px 12px; }
    .e-bulk__n { flex: 1 1 100%; }
    .e-bulk__row .btn { flex: 1 1 auto; }
}
