/* Habillage Tempolia, chargé après Fusio : les composants et leurs droits restent natifs. */
:root {
    --tp-ink: #3a3741;
    --tp-muted: #6e6b76;
    --tp-pink: #e6007e;
    --tp-pink-dark: #bc0067;
    --tp-soft: #fceef5;
    --tp-line: #e8e5ec;
    --tp-page: #f7f7fa;
    --tp-header: 78px;
    --tp-nav: 224px;
    --bs-primary: #bc0067;
    --bs-primary-rgb: 188, 0, 103;
    --bs-link-color: #bc0067;
    --bs-link-color-rgb: 188, 0, 103;
    --bs-link-hover-color: #920050;
    --bs-link-hover-color-rgb: 146, 0, 80;
    --bs-body-color: #3a3741;
    --bs-body-color-rgb: 58, 55, 65;
    --bs-body-bg: #f7f7fa;
    --bs-border-color: #e8e5ec;
}

html { min-height: 100%; }
body {
    margin: 0;
    padding-top: var(--tp-header);
    background: var(--tp-page);
    color: var(--tp-ink);
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}
a { text-underline-offset: 3px; }
:where(a, button, input, select, textarea):focus-visible {
    outline: 3px solid #bc006788;
    outline-offset: 3px;
}
[hidden] { display: none !important; }
.tempolia-skip {
    position: fixed;
    top: -100px;
    left: 24px;
    z-index: 1100;
    padding: 12px 18px;
    background: #fff;
    color: var(--tp-pink-dark);
}
.tempolia-skip:focus { top: 10px; }
.tempolia-topbar {
    position: fixed;
    inset: 0 0 auto;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    height: var(--tp-header);
    padding: 0 32px;
    border-bottom: 1px solid var(--tp-line);
    background: #fff;
}
.tempolia-brand { display: flex; align-items: center; gap: 22px; color: var(--tp-ink); text-decoration: none; }
.tempolia-brand img { width: 184px; height: auto; }
.tempolia-brand span { border-left: 1px solid var(--tp-line); padding-left: 22px; font-size: 15px; font-weight: 700; }
.tempolia-topbar nav { display: flex; align-items: center; gap: 8px; }
.tempolia-topbar nav a { border-radius: 8px; padding: 10px 14px; color: var(--tp-muted); font-size: 14px; font-weight: 600; text-decoration: none; }
.tempolia-topbar nav a:hover { background: var(--tp-soft); color: var(--tp-pink-dark); }
.tempolia-topbar nav .tempolia-doc-link { border: 1px solid var(--tp-line); color: var(--tp-ink); }
.tempolia-welcome { display: none; }

/* Navigation et espace de travail : tables et éditeurs gardent toute leur largeur utile. */
body .fusio-navigation {
    top: var(--tp-header);
    bottom: 0;
    height: auto;
    width: var(--tp-nav);
    background: #fff;
    border-right: 1px solid var(--tp-line);
}
body .fusio-navigation > nav { width: auto; padding: 16px 14px 32px; }
body .fusio-navigation > nav > h1 {
    margin: 0 0 16px;
    padding: 12px;
    background: none;
    border: 0;
    color: var(--tp-muted);
    font-size: 11px;
    font-weight: 750;
    letter-spacing: .12em;
    text-transform: uppercase;
}
body .fusio-navigation > nav > h1 > span { display: none; }
body .fusio-navigation-heading {
    margin: 12px 0 4px;
    padding: 11px 12px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--tp-muted);
    font-size: 12px;
    font-weight: 700;
}
body .fusio-navigation-heading-active,
body .fusio-navigation-heading:hover { background: #f6f5f8; color: var(--tp-ink); }
body .fusio-navigation > nav > div > ul > li > a,
body .fusio-navigation > nav > div > ul > li > a:link,
body .fusio-navigation > nav > div > ul > li > a:visited,
body .fusio-navigation > nav > div > ul > li > a:active {
    margin: 3px 0;
    padding: 10px 12px;
    border-radius: 8px;
    background: transparent;
    color: var(--tp-ink);
    font-size: 14px;
}
body .fusio-navigation > nav > div > ul > li > a:hover { background: #f6f5f8; color: var(--tp-ink); }
/* Garder la même spécificité que :link/:visited pour conserver le repère hors survol. */
body .fusio-navigation > nav > div > ul > li > a[aria-current="page"],
body .fusio-navigation > nav > div > ul > li > a.active {
    background: var(--tp-soft);
    color: var(--tp-pink-dark);
    box-shadow: inset 3px 0 0 var(--tp-pink);
    font-weight: 750;
}
body .fusio-navigation i { margin-right: 10px; }
body .fusio-navigation .panel { background: transparent; }
/* Le catalogue technique Fusio reste hors de la navigation courante. */
body .fusio-navigation > nav > div > ul > li:has(> a[href="/apps/fusio/marketplace"]) { display: none; }
/* La monétisation Fusio n'entre pas dans le parcours API Tempolia. */
body .fusio-navigation > nav > div:has(a[href="/apps/fusio/plan"], a[href="/apps/fusio/transaction"]),
body .fusio-tabs .nav-item:has(> a[href="/apps/fusio/account/subscription"]) { display: none; }
body .fusio-container { margin-left: var(--tp-nav); padding: 26px 28px 40px; }
body .fusio-content { min-width: 0; padding: 28px; border: 1px solid var(--tp-line); border-radius: 14px; background: #fff; box-shadow: 0 4px 24px #3a374105; }
body .fusio-content > * > h1 {
    margin: 0 0 26px;
    padding: 0 0 22px;
    border-bottom: 1px solid var(--tp-line);
    background: none;
    color: var(--tp-ink);
    font-size: 28px;
    font-weight: 750;
    letter-spacing: -.035em;
    line-height: 1.25;
}
body .fusio-content > * > h1 > a { color: var(--tp-ink); }
body .fusio-header-profile { float: none; width: fit-content; margin: 0 0 14px auto; }
body .fusio-header-profile #userMenu,
body .fusio-header-profile #userMenu:hover { border: 1px solid var(--tp-line); border-radius: 9px; background: #fff; padding: 8px 12px; color: var(--tp-ink); }
body.tempolia-client-space .fusio-navigation { display: none; }
body.tempolia-client-space .fusio-container { max-width: 1320px; margin-inline: auto; }
body .nav-tabs { gap: 4px; padding-bottom: 1px; border-color: var(--tp-line); }
body .nav-tabs .nav-link { border: 0; border-bottom: 2px solid transparent; border-radius: 6px 6px 0 0; padding: 10px 14px; color: var(--tp-muted); font-size: 14px; }
body .nav-tabs .nav-link:hover { background: #f8f7fa; color: var(--tp-ink); }
body .nav-tabs .nav-link.active { background: var(--tp-soft); border-bottom-color: var(--tp-pink); color: var(--tp-pink-dark); font-weight: 650; }
body .card { border-color: var(--tp-line); border-radius: 12px; overflow: hidden; }
body .card-header { padding: 14px 18px; border-color: var(--tp-line); background: #faf9fb; color: var(--tp-ink); font-weight: 650; }
body .card-body { padding: 20px; }
body .table { --bs-table-striped-bg: #faf9fc; --bs-table-hover-bg: #fceef580; --bs-table-border-color: #e8e5ec; }
body .table > thead > tr > th { padding: 14px 12px; background: #f8f7fa; color: var(--tp-muted); font-size: 12px; font-weight: 700; }
body .table > tbody > tr > td { padding: 13px 12px; vertical-align: middle; }
body .btn { border-radius: 8px; font-weight: 600; }
body .btn-primary {
    --bs-btn-bg: #bc0067;
    --bs-btn-border-color: #bc0067;
    --bs-btn-hover-bg: #990054;
    --bs-btn-hover-border-color: #990054;
    --bs-btn-active-bg: #850049;
    --bs-btn-active-border-color: #850049;
    --bs-btn-disabled-bg: #bc0067;
    --bs-btn-disabled-border-color: #bc0067;
    --bs-btn-focus-shadow-rgb: 188, 0, 103;
}
body .btn-secondary { --bs-btn-bg: #625c6c; --bs-btn-border-color: #625c6c; }
body .form-label, body label { margin-bottom: 8px; color: var(--tp-ink); font-size: 14px; font-weight: 600; }
body .form-control, body .form-select { min-height: 42px; border-color: #dcd8e2; border-radius: 8px; color: var(--tp-ink); }
body .form-control:focus, body .form-select:focus { border-color: #c54389; box-shadow: 0 0 0 3px #bc006712; }
body .form-control:disabled, body .form-control[readonly] { background-color: #f6f5f8; color: #6e6b76; }
body .dropdown-menu { padding: 6px; border: 1px solid var(--tp-line); border-radius: 10px; box-shadow: 0 12px 32px #3a374114; }
body .dropdown-item { border-radius: 5px; padding: 9px 12px; }
body .dropdown-item:hover, body .dropdown-item:focus { background: var(--tp-soft); color: var(--tp-pink-dark); }
body .page-link { color: var(--tp-pink-dark); }
body .active > .page-link { background: var(--tp-pink-dark); border-color: var(--tp-pink-dark); color: #fff; }

/* Connexion et récupération du compte : même identité que le portail public. */
body.tempolia-page-auth {
    background: radial-gradient(ellipse at 0 100%, #fce7f2 0, transparent 55%), #fcfbfd;
}
.tempolia-page-auth .tempolia-topbar { padding-inline: max(32px, calc((100vw - 1216px) / 2)); }
.tempolia-page-auth app-navigation { display: none; }
body.tempolia-page-auth .fusio-container { max-width: 1240px; margin: 0 auto; padding: 24px 40px; }
body.tempolia-page-auth .fusio-content { padding: 0; border: 0; background: transparent; box-shadow: none; }
.tempolia-page-auth .tempolia-welcome {
    display: block;
    position: absolute;
    top: max(190px, calc(50vh - 150px));
    left: max(40px, calc((100vw - 1160px) / 2));
    width: min(44vw, 520px);
}
.tempolia-eyebrow { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; color: var(--tp-pink-dark); font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.tempolia-eyebrow::before { width: 28px; height: 2px; background: var(--tp-pink); content: ""; }
.tempolia-welcome h1 { margin: 0 0 26px; color: var(--tp-ink); font-size: clamp(38px, 3.7vw, 56px); font-weight: 800; letter-spacing: -.055em; line-height: 1.09; }
.tempolia-welcome h1 span { text-decoration: underline; text-decoration-color: #f1bad5; text-decoration-thickness: 6px; text-underline-offset: 7px; }
.tempolia-welcome p { max-width: 430px; margin-bottom: 26px; color: var(--tp-muted); font-size: 17px; line-height: 1.75; }
.tempolia-welcome > a { display: inline-block; color: var(--tp-pink-dark); font-size: 14px; font-weight: 700; text-decoration: none; }
.tempolia-welcome > a:hover { text-decoration: underline; }
body .fusio-login {
    position: static;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    width: auto;
    height: auto;
    min-height: calc(100dvh - var(--tp-header) - 48px);
    padding: 36px 0;
    background: transparent;
    z-index: auto;
}
body .fusio-login-panel { width: 420px; max-width: 100%; margin: 0; border: 1px solid var(--tp-line); border-radius: 18px; background: #fff; box-shadow: 0 20px 64px #3a37410d; overflow: hidden; }
body .fusio-login-panel > header { padding: 32px 34px 0; border: 0 !important; background: #fff !important; text-align: left !important; }
body .fusio-login-panel > header > h1 { display: none; }
.tempolia-auth-title { margin: 0 0 10px; color: var(--tp-ink); font-size: 26px; font-weight: 750; letter-spacing: -.035em; }
.tempolia-auth-description { margin: 0; color: var(--tp-muted); font-size: 14px; line-height: 1.65; }
body .fusio-login-panel-body { margin: 0; padding: 28px 34px 30px; }
body .fusio-login-panel-body .form-control { min-height: 48px; }
body .fusio-login-panel-body .mb-3 { margin-bottom: 22px !important; }
body .fusio-login-panel-body button[type="submit"] { width: 100%; min-height: 48px; margin: 2px 0 20px !important; }
body .fusio-login-panel-body .float-end { float: none !important; display: block; text-align: center; }
body .fusio-login-panel-body .float-end a { color: var(--tp-muted); font-size: 13px; }
body .fusio-login-panel > .border-top { display: flex; justify-content: center; padding: 16px !important; border-color: var(--tp-line) !important; background: #fcfbfd !important; }
body .fusio-login-panel > .border-top a { color: var(--tp-muted); font-size: 12px; text-decoration: none; }
.tempolia-access-help { margin: 22px 0 0; padding-top: 20px; border-top: 1px solid var(--tp-line); color: var(--tp-muted); font-size: 13px; line-height: 1.7; text-align: center; }
.tempolia-access-help a { color: var(--tp-pink-dark); font-weight: 600; }

@media (min-width: 1600px) { .tempolia-page-auth .tempolia-welcome { top: calc(50vh - 150px); } }
@media (max-width: 1100px) {
    :root { --tp-nav: 190px; }
    body .fusio-container { padding: 22px 16px; }
    body .fusio-content { padding: 22px; }
    .tempolia-page-auth .tempolia-welcome { width: 40vw; }
    body .fusio-login-panel { width: 390px; }
}
@media (max-width: 800px) {
    :root { --tp-header: 72px; }
    .tempolia-topbar, .tempolia-page-auth .tempolia-topbar { gap: 12px; padding: 0 20px; }
    .tempolia-brand { gap: 12px; }
    .tempolia-brand img { width: 145px; }
    .tempolia-brand span { padding-left: 12px; font-size: 13px; }
    .tempolia-topbar nav a { padding: 9px 10px; font-size: 13px; }
    .tempolia-topbar .tempolia-support-link { display: none; }
    .tempolia-page-auth .tempolia-welcome { position: static; width: auto; max-width: 540px; margin: 42px auto 0; padding: 0 24px; text-align: center; }
    .tempolia-eyebrow { justify-content: center; margin-bottom: 18px; }
    .tempolia-welcome h1 { margin-bottom: 18px; font-size: 38px; }
    .tempolia-welcome h1 br { display: none; }
    .tempolia-welcome p { max-width: none; margin-bottom: 0; font-size: 15px; }
    .tempolia-welcome > a { display: none; }
    body.tempolia-page-auth .fusio-container { padding: 28px 20px 40px; }
    body .fusio-login { min-height: 0; justify-content: center; padding: 0; }
    body .fusio-login-panel { width: 440px; }
    body .fusio-navigation { position: static; width: auto; border-right: 0; border-bottom: 1px solid var(--tp-line); }
    body .fusio-navigation > nav { padding: 8px 16px; }
    body .fusio-navigation > nav > h1 { display: none; }
    body .fusio-container { margin-left: 0; }
    body .fusio-navigation > nav > div > ul { display: flex; flex-wrap: wrap; gap: 4px 12px; }
    body .nav-tabs { flex-wrap: nowrap; overflow-x: auto; white-space: nowrap; }
    body .table-responsive { max-width: 100%; }
    body .fusio-content .table { display: block; overflow-x: auto; white-space: nowrap; }
}
@media (max-width: 480px) {
    .tempolia-topbar, .tempolia-page-auth .tempolia-topbar { padding-inline: 16px; }
    .tempolia-brand img { width: 125px; }
    .tempolia-brand span { border: 0; padding: 0; font-size: 12px; }
    .tempolia-brand { gap: 10px; }
    .tempolia-topbar nav a { padding: 9px; font-size: 12px; }
    .tempolia-welcome h1 { font-size: 33px; }
    .tempolia-page-auth .tempolia-welcome { margin-top: 32px; }
    body .fusio-login-panel > header { padding: 26px 24px 0; }
    body .fusio-login-panel-body { padding: 24px; }
    body .fusio-content { padding: 18px 14px; }
    body .fusio-container { padding: 16px 8px; }
}
