:root {
    --treeend-green:#a8d96b;
    --treeend-green-bright:#55d91f;
    --treeend-green-dark:#30422a;
    --treeend-green-soft:#eff8e8;
    --treeend-fuchsia:#ff18cf;
    --treeend-text:#273126;
    --treeend-muted:#7c8778;
    --treeend-line:#dfe8da;
    --treeend-shadow:0 10px 28px rgba(40,62,32,.14);
}

.treeend-next-home *, .treeend-next-portal *, .treeend-next-access * { box-sizing:border-box; }
body:has(.treeend-next-home) .entry-title,
body:has(.treeend-next-portal) .entry-title,
body:has(.treeend-next-access) .entry-title { display:none !important; }
body:has(.treeend-next-home) .entry-content,
body:has(.treeend-next-portal) .entry-content,
body:has(.treeend-next-access) .entry-content { max-width:none !important; width:100% !important; }

.treeend-next-visually-hidden { position:absolute !important; width:1px !important; height:1px !important; overflow:hidden !important; clip:rect(0 0 0 0) !important; white-space:nowrap !important; }

/* =========================================================
   ACCESSO / ISCRIZIONE — L'ALBERO È LA PORTA
========================================================= */
.treeend-next-access {
    max-width:1380px;
    margin:0 auto;
    padding:28px 24px 58px;
    color:var(--treeend-text);
}
.treeend-next-access-layout {
    display:grid;
    grid-template-columns:minmax(480px,1.15fr) minmax(390px,.85fr);
    gap:34px;
    align-items:stretch;
    min-height:720px;
}
.treeend-next-access-tree-stage {
    position:relative;
    min-height:650px;
    overflow:hidden;
    border-radius:28px;
    background:linear-gradient(180deg,#edf7e8 0%,#fff7db 100%);
    box-shadow:var(--treeend-shadow);
}
.treeend-next-access-tree-stage > img:not(.treeend-next-access-logo) {
    position:absolute;
    inset:0;
    width:100%;
    height:100%;
    object-fit:contain;
    object-position:center;
    background:#fff;
    opacity:1;
}
.treeend-next-access-tree-stage::after {
    content:"";
    position:absolute;
    inset:0;
    background:linear-gradient(180deg,rgba(255,255,255,.02) 30%,rgba(255,255,255,.55) 100%);
    pointer-events:none;
}
.treeend-next-access-tree-copy {
    position:absolute;
    z-index:2;
    left:38px;
    right:38px;
    bottom:30px;
    text-align:center;
    color:var(--treeend-green-dark);
}
.treeend-next-access-logo { width:150px; max-width:42%; height:auto; margin:0 auto 10px; display:block; }
.treeend-next-access-tree-copy h1 { margin:0 0 8px; font-size:clamp(34px,4.4vw,64px); line-height:1.02; }
.treeend-next-access-tree-copy p { margin:5px auto; max-width:620px; font-size:18px; }
.treeend-next-auth-side { display:flex; flex-direction:column; justify-content:center; }
.treeend-next-auth-grid { display:grid; gap:18px; }
.treeend-next-auth-card {
    background:rgba(255,255,255,.96);
    border:1px solid #dce6d6;
    border-radius:20px;
    padding:23px;
    box-shadow:0 8px 22px rgba(0,0,0,.06);
}
.treeend-next-auth-card h2 { margin:0 0 16px; color:var(--treeend-green-dark); font-size:26px; }
.treeend-next-auth-card label { display:block; margin:0 0 12px; font-weight:650; }
.treeend-next-auth-card input[type="email"],
.treeend-next-auth-card input[type="password"] {
    width:100%;
    margin-top:5px;
    border:1px solid #bdcbb5;
    border-radius:10px;
    padding:11px 13px;
    font-size:16px;
    background:#fff;
}
.treeend-next-auth-card input:focus { outline:none; border-color:#7ca65c; box-shadow:0 0 0 3px rgba(169,217,109,.25); }
.treeend-next-remember { display:flex !important; align-items:center; gap:8px; font-weight:500 !important; }
.treeend-next-access-primary, .treeend-next-access-secondary {
    display:inline-block;
    border:0;
    border-radius:23px;
    padding:10px 18px;
    text-decoration:none !important;
    cursor:pointer;
    font-size:15px;
}
.treeend-next-access-primary { background:var(--treeend-green-dark); color:#fff !important; }
.treeend-next-access-primary:hover { filter:brightness(1.08); }
.treeend-next-access-secondary { background:#edf3e9; color:var(--treeend-green-dark) !important; }
.treeend-next-auth-small { margin:11px 0 0; font-size:13px; color:#70796d; }
.treeend-next-auth-message { margin:0 0 14px; padding:12px 15px; border-radius:10px; background:#fff3f3; border:1px solid #eccaca; text-align:center; }
.treeend-next-honeypot { position:absolute !important; left:-99999px !important; opacity:0 !important; width:1px !important; height:1px !important; }
.treeend-next-human-check { margin:12px 0; min-height:65px; display:flex; align-items:center; justify-content:flex-start; }
.treeend-next-access-logged { min-height:720px; }
.treeend-next-access-logged .treeend-next-access-tree-stage { max-width:900px; margin:0 auto; }

/* =========================================================
   HOME — DOMANDA SULL'ALBERO
========================================================= */
.treeend-next-home {
    position:relative;
    max-width:1250px;
    min-height:760px;
    margin:0 auto;
    overflow:hidden;
    border-radius:28px;
    background:linear-gradient(180deg,#edf7e8 0%,#fff7db 100%);
    box-shadow:var(--treeend-shadow);
    font-family:inherit;
}
.treeend-next-home-tree-image {
    position:absolute;
    inset:0;
    width:100%;
    height:100%;
    object-fit:contain;
    object-position:center;
    background:#fff;
}
.treeend-next-home::after {
    content:"";
    position:absolute;
    inset:0;
    background:linear-gradient(180deg,rgba(255,255,255,.02) 18%,rgba(255,255,255,.22) 54%,rgba(255,255,255,.72) 100%);
    pointer-events:none;
}
.treeend-next-home-overlay {
    position:relative;
    z-index:2;
    min-height:760px;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    padding:80px 30px 60px;
    text-align:center;
}
.treeend-next-home-logo { width:165px; height:auto; margin-bottom:8px; filter:drop-shadow(0 2px 5px rgba(255,255,255,.75)); }
.treeend-next-home-date { font-family:Georgia,'Times New Roman',serif; color:var(--treeend-green-dark); font-size:21px; margin-bottom:16px; background:rgba(255,255,255,.55); padding:5px 13px; border-radius:16px; backdrop-filter:blur(5px); }
.treeend-next-home h1 {
    max-width:820px;
    margin:0 0 20px;
    color:var(--treeend-green-dark);
    font-size:clamp(38px,6.2vw,82px);
    line-height:1.02;
    text-shadow:0 2px 12px rgba(255,255,255,.8);
}
.treeend-next-home-input-wrap { width:min(690px,90vw); padding:8px; border-radius:34px; background:rgba(98,151,60,.76); box-shadow:0 8px 24px rgba(44,67,34,.18); }
.treeend-next-home-input {
    width:100%;
    border:2px solid rgba(255,255,255,.9);
    border-radius:27px;
    padding:14px 19px;
    font-size:19px;
    background:rgba(255,255,255,.94);
    outline:none;
}
.treeend-next-home-input:focus { box-shadow:0 0 0 4px rgba(255,255,255,.3); }
.treeend-next-home-message { min-height:35px; margin:18px auto 0; padding:5px 12px; font-size:21px; font-weight:650; color:var(--treeend-green-dark); opacity:0; transition:opacity .35s ease; background:rgba(255,255,255,.58); border-radius:16px; }
.treeend-next-home-message.is-visible { opacity:1; }
.treeend-next-home-enter { margin-top:13px; color:var(--treeend-green-dark); font-weight:700; text-decoration:none; }
.treeend-next-home-enter:hover { text-decoration:underline; }

/* =========================================================
   PORTALE 2.0 — ISPIRATO ALLA TAVOLA STORICA TAMTAMER
========================================================= */
.treeend-next-portal {
    max-width:1480px;
    margin:0 auto;
    padding:18px 22px 80px;
    color:var(--treeend-text);
    overflow:visible;
}
.treeend-next-app-shell {
    display:grid;
    grid-template-columns:255px minmax(0,1fr);
    gap:34px;
    align-items:start;
}
.treeend-next-sidebar {
    position:sticky;
    top:24px;
    min-width:0;
    padding:8px 16px 22px 4px;
    border-right:1px solid #e5ebe1;
}
.treeend-next-logo {
    width:220px;
    max-width:96%;
    height:auto;
    display:block;
    margin:0 0 12px;
    border-radius:18px;
    box-shadow:0 5px 16px rgba(0,0,0,.12);
    overflow:hidden;
}
.treeend-next-online { color:var(--treeend-green-bright); font-weight:800; margin:5px 0 14px; }
.treeend-next-online span { display:inline-block; width:13px; height:13px; margin-right:7px; background:var(--treeend-green-bright); vertical-align:-1px; }
.treeend-next-profile-card { display:grid; grid-template-columns:76px minmax(0,1fr); gap:11px; align-items:center; margin-bottom:9px; }
.treeend-next-profile-card img { width:76px; height:76px; object-fit:cover; border-radius:8px; box-shadow:0 4px 12px rgba(0,0,0,.15); background:#f2f4ef; }
.treeend-next-profile-card strong { display:block; font-size:16px; color:var(--treeend-green-dark); overflow-wrap:anywhere; }
.treeend-next-profile-card small { display:block; margin-top:3px; color:var(--treeend-muted); }
.treeend-next-photo-button { display:inline-block; margin:3px 0 18px; padding:6px 10px; border:1px solid #b7c7ad; border-radius:18px; cursor:pointer; font-size:12px; }
.treeend-next-side-section { margin:14px 0 24px; }
.treeend-next-side-section h3 { margin:0 0 8px; font-size:15px; color:var(--treeend-fuchsia); letter-spacing:.03em; }
.treeend-next-layer-tabs { display:flex; flex-direction:column; align-items:stretch; gap:1px; }
.treeend-next-layer-tab {
    width:100%;
    min-width:0;
    border:0;
    background:transparent;
    color:#777;
    text-align:left;
    padding:5px 8px;
    cursor:pointer;
    font-weight:750;
    font-size:15px;
    line-height:1.05;
    text-transform:uppercase;
    border-left:4px solid transparent;
    display:flex;
    align-items:center;
    gap:8px;
    white-space:nowrap;
}
.treeend-next-layer-label {
    display:block;
    flex:1 1 auto;
    min-width:0;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}
.treeend-next-layer-drag {
    flex:0 0 auto;
    display:inline-flex;
    width:24px;
    height:24px;
    align-items:center;
    justify-content:center;
    border-radius:6px;
    color:#929b8f;
    font-size:18px;
    line-height:1;
    cursor:grab;
    touch-action:none;
    user-select:none;
}
.treeend-next-layer-drag:hover { background:#eef4ea; color:var(--treeend-green-dark); }
.treeend-next-layer-tab.is-dragging {
    opacity:.72;
    background:#f3f8ef;
    box-shadow:0 5px 16px rgba(48,66,42,.12);
    z-index:5;
}
body.treeend-next-is-reordering { user-select:none; }
.treeend-next-layer-tab:hover { background:#f5f8f2; color:var(--treeend-green-dark); }
.treeend-next-layer-tab.is-active { color:var(--treeend-green-bright); border-left-color:var(--treeend-green-bright); background:#f8fbf5; }
.treeend-next-new-layer { margin:9px 0 0 8px; padding:5px 9px; border:1px solid #c8d3c2; border-radius:16px; background:#fff; color:#6f786c; cursor:pointer; font-size:12px; }
.treeend-next-new-layer:disabled { opacity:.45; cursor:not-allowed; }
.treeend-next-layer-quota { margin:8px 8px 0; font-size:11px; line-height:1.35; color:#7b8578; }
.treeend-next-layer-quota strong { color:var(--treeend-green-dark); }
.treeend-next-layer-quota small { display:block; margin-top:4px; color:#8b667d; }
.treeend-next-layer-quota.is-full { padding:7px 8px; border-radius:9px; background:#fff4fb; border:1px solid #f0cde5; }
.treeend-next-layer-limit-note { margin:8px 0 12px; padding:8px 10px; border-radius:9px; background:#f3f8ef; color:#53614e; font-size:13px; }
.treeend-next-content-legend p { margin:0 0 7px; color:#868d83; font-size:12px; }
.treeend-next-content-icons { display:grid; gap:4px; color:#70786d; font-size:13px; }
.treeend-next-logout { display:inline-block; margin-top:6px; color:#7b8478; text-decoration:none; font-size:12px; }
.treeend-next-logout:hover { text-decoration:underline; }

.treeend-next-agenda-column { min-width:0; overflow:visible; }
.treeend-next-agenda-head {
    display:flex;
    justify-content:space-between;
    gap:30px;
    align-items:flex-start;
    margin-bottom:20px;
}
.treeend-next-context { min-width:260px; padding-top:2px; }
.treeend-next-context-kicker { color:var(--treeend-fuchsia); font-size:12px; font-weight:800; letter-spacing:.12em; }
.treeend-next-context h1 {
    --context-color:var(--treeend-green-dark);
    margin:3px 0 6px;
    color:var(--treeend-green-dark);
    font-size:clamp(34px,4.5vw,68px);
    line-height:.98;
    letter-spacing:-.02em;
    text-transform:uppercase;
}
.treeend-next-context h1::after { content:""; display:block; width:62px; height:4px; margin-top:9px; background:var(--context-color); }
.treeend-next-context p { max-width:470px; margin:9px 0 0; color:#778074; font-size:13px; line-height:1.4; }
.treeend-next-time-nav { display:flex; flex-direction:column; align-items:flex-end; flex:0 0 auto; }
.treeend-next-weekday { position:relative; display:inline-block; margin:0 7px 3px 0; padding:5px 13px; background:var(--treeend-green-dark); color:#fff; font-size:14px; font-weight:800; border-radius:3px 3px 0 3px; }
.treeend-next-weekday::after { content:""; position:absolute; right:0; bottom:-8px; border-top:8px solid var(--treeend-green-dark); border-left:8px solid transparent; }
.treeend-next-rotor { display:flex; gap:8px; align-items:stretch; }
.treeend-next-rotor-unit {
    width:112px;
    min-height:120px;
    display:grid;
    grid-template-rows:25px 1fr 25px;
    align-items:center;
    justify-items:center;
    overflow:hidden;
    border-radius:5px;
    background:linear-gradient(180deg,#72d832 0%,#d9f2ca 48%,#54ce17 52%,#b6ea98 100%);
    color:#fff;
    box-shadow:0 5px 10px rgba(0,0,0,.18), inset 0 1px 0 rgba(255,255,255,.55);
    touch-action:none;
}
.treeend-next-year-unit { width:150px; }
.treeend-next-rotor-unit button { width:100%; height:100%; border:0; background:rgba(255,255,255,.16); color:#fff; cursor:pointer; font-size:14px; }
.treeend-next-rotor-unit button:hover { background:rgba(255,255,255,.28); }
.treeend-next-rotor-value { width:100%; height:100%; display:flex; align-items:center; justify-content:center; border-top:1px solid rgba(255,255,255,.8); border-bottom:1px solid rgba(255,255,255,.85); font-size:clamp(32px,3.4vw,48px); font-weight:800; text-shadow:0 2px 2px rgba(0,0,0,.35); }
.treeend-next-rotor-unit.is-turning .treeend-next-rotor-value { animation:treeendRotor .18s ease-out; }
@keyframes treeendRotor { 0%{transform:translateY(-7px);opacity:.5} 100%{transform:translateY(0);opacity:1} }

.treeend-next-agenda { position:relative; overflow:visible; }
.treeend-next-hours { position:relative; border-left:4px solid var(--treeend-green-bright); overflow:visible; }
.treeend-next-hour { min-height:58px; position:relative; padding:8px 6px 8px 25px; border-bottom:1px solid rgba(48,66,42,.055); }
.treeend-next-hour-head { display:flex; align-items:center; gap:13px; min-height:29px; }
.treeend-next-hour-time { min-width:58px; color:var(--treeend-green-bright); font-size:18px; font-weight:850; }
.treeend-next-hour-add { border:0; background:transparent; padding:4px 5px; color:#aaa; cursor:pointer; font-size:12px; }
.treeend-next-hour-add:hover { color:var(--treeend-fuchsia); }
.treeend-next-events { margin:0 0 0 58px; display:grid; gap:9px; }

.treeend-next-event-rich {
    --event-color:var(--treeend-green);
    position:relative;
    max-width:900px;
    padding:7px 9px 9px 12px;
    border-left:4px solid var(--event-color);
    background:#fff;
}
.treeend-next-event-top { display:flex; justify-content:space-between; gap:10px; align-items:flex-start; }
.treeend-next-event-main { display:flex; gap:9px; align-items:baseline; min-width:0; }
.treeend-next-event-minute { color:var(--treeend-green-bright); font-size:16px; white-space:nowrap; }
.treeend-next-event-text { color:#252a24; font-size:16px; font-weight:650; line-height:1.35; overflow-wrap:anywhere; }
.treeend-next-event-layer { flex:0 0 auto; border-radius:10px; padding:2px 7px; background:#f2f6ef; color:#6d766a; font-size:10px; }
.treeend-next-event-tools {
    position:relative;
    display:flex;
    flex-wrap:wrap;
    align-items:center;
    gap:3px;
    margin:8px 0 1px;
    padding:5px 8px;
    border:4px solid var(--treeend-fuchsia);
    background:#fff;
    color:var(--treeend-fuchsia);
    font-size:11px;
}
.treeend-next-event-tools > span { margin-right:3px; font-weight:750; }
.treeend-next-event-tools button { border:0; background:transparent; padding:2px 4px; color:#6f766c; cursor:pointer; font-size:11px; }
.treeend-next-event-tools button:hover { color:var(--treeend-fuchsia); }
.treeend-next-event-tools.is-uploading::after { content:"Caricamento…"; position:absolute; inset:0; display:flex; align-items:center; justify-content:center; background:rgba(255,255,255,.92); color:var(--treeend-green-dark); font-weight:800; }

.treeend-next-attachments { display:flex; flex-wrap:wrap; gap:9px; margin-top:8px; }
.treeend-next-attachment { position:relative; min-width:0; }
.treeend-next-attachment img { display:block; width:160px; height:105px; object-fit:cover; border-radius:5px; box-shadow:0 3px 9px rgba(0,0,0,.13); }
.treeend-next-attachment-image span, .treeend-next-attachment-video span, .treeend-next-attachment-audio span { display:block; max-width:190px; margin-top:3px; color:#737b70; font-size:10px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.treeend-next-attachment video { display:block; width:min(330px,100%); max-height:230px; border-radius:5px; background:#111; }
.treeend-next-attachment audio { width:min(330px,100%); }
.treeend-next-file-link, .treeend-next-external-link { display:inline-block; max-width:360px; padding:7px 10px; border:1px solid #d6dfd1; border-radius:6px; background:#f8faf6; color:#4e6347 !important; text-decoration:none !important; overflow-wrap:anywhere; font-size:12px; }
.treeend-next-note { max-width:450px; padding:9px 11px; border-left:4px solid #f0cf52; background:#fffbe8; color:#504d35; font-size:12px; }
.treeend-next-note strong { display:block; margin-bottom:4px; }
.treeend-next-note p { margin:0; line-height:1.4; }
.treeend-next-attachment-delete { position:absolute; top:-7px; right:-7px; width:20px; height:20px; display:flex; align-items:center; justify-content:center; padding:0; border:0; border-radius:50%; background:#333; color:#fff; cursor:pointer; font-size:14px; line-height:1; opacity:.82; }
.treeend-next-attachment-delete:hover { background:#b20000; opacity:1; }
.treeend-next-youtube {
    width:min(420px, 78vw);
    aspect-ratio:16 / 9;
    overflow:hidden;
    border-radius:10px;
    background:#000;
    margin-bottom:5px;
}
.treeend-next-youtube iframe {
    width:100%;
    height:100%;
    border:0;
    display:block;
}
.treeend-next-photo-source-actions {
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:10px;
    margin:12px 0 4px;
}
.treeend-next-photo-source-actions button {
    border:1px solid #d6ded2;
    background:#fff;
    color:#30422a;
    border-radius:9px;
    padding:12px 10px;
    font-weight:750;
    cursor:pointer;
}
.treeend-next-photo-source-actions button.primary {
    background:#30422a;
    color:#fff;
    border-color:#30422a;
}
.treeend-next-modal-hint {
    margin:5px 0 10px;
    color:#6e776b;
    font-size:12px;
    line-height:1.45;
}
.treeend-next-modal-row small[data-layer-count] {
    display:block;
    margin-top:5px;
    color:#7f887c;
    font-size:11px;
    text-align:right;
}


.treeend-next-now-line {
    position:absolute;
    left:-290px;
    right:-4px;
    height:4px;
    background:var(--treeend-fuchsia);
    z-index:40;
    pointer-events:none;
    transition:top .3s linear;
}
.treeend-next-now-clock { position:absolute; right:0; top:-25px; color:var(--treeend-fuchsia); font-size:16px; font-weight:850; white-space:nowrap; }

/* =========================================================
   MODALI
========================================================= */
.treeend-next-modal-backdrop { position:fixed; inset:0; z-index:100000; display:flex; align-items:center; justify-content:center; padding:20px; background:rgba(0,0,0,.42); }
.treeend-next-modal { width:min(460px,100%); background:#fff; border-radius:14px; padding:20px; box-shadow:0 18px 44px rgba(0,0,0,.28); }
.treeend-next-modal h3 { margin:0 0 15px; color:var(--treeend-green-dark); }
.treeend-next-modal-row { display:grid; gap:5px; margin-bottom:12px; }
.treeend-next-modal select, .treeend-next-modal input, .treeend-next-modal textarea { width:100%; font:inherit; font-size:16px; padding:10px 12px; border:1px solid #cad4c5; border-radius:9px; resize:vertical; }
.treeend-next-modal-actions { display:flex; justify-content:flex-end; gap:8px; margin-top:15px; }
.treeend-next-modal-actions button { border:0; border-radius:19px; padding:8px 15px; cursor:pointer; }
.treeend-next-modal-actions .primary { background:var(--treeend-green-dark); color:#fff; }

.treeend-next-login-needed { max-width:700px; margin:40px auto; padding:20px; background:#f6f8f4; border-radius:12px; text-align:center; }

@media (max-width: 1050px) {
    .treeend-next-app-shell { grid-template-columns:210px minmax(0,1fr); gap:22px; }
    .treeend-next-rotor-unit { width:94px; }
    .treeend-next-year-unit { width:132px; }
    .treeend-next-now-line { left:-240px; }
    .treeend-next-access-layout { grid-template-columns:1fr; min-height:0; }
    .treeend-next-access-tree-stage { min-height:560px; }
    .treeend-next-auth-grid { grid-template-columns:1fr 1fr; }
}

@media (max-width: 820px) {
    .treeend-next-portal { padding-left:12px; padding-right:12px; }
    .treeend-next-app-shell { grid-template-columns:1fr; }
    .treeend-next-sidebar { position:relative; top:auto; border-right:0; border-bottom:1px solid #e5ebe1; padding:0 0 15px; }
    .treeend-next-sidebar .treeend-next-logo { width:190px; }
    .treeend-next-profile-card { width:min(360px,100%); }
    .treeend-next-layer-tabs { display:flex; flex-direction:column; flex-wrap:nowrap; gap:2px; }
    .treeend-next-layer-tab { width:100%; border-left:3px solid transparent; border-bottom:0; padding:7px 8px; }
    .treeend-next-layer-tab.is-active { border-left-color:var(--treeend-green-bright); border-bottom-color:transparent; }
    .treeend-next-content-legend { display:none; }
    .treeend-next-agenda-head { flex-direction:column; }
    .treeend-next-time-nav { width:100%; align-items:flex-start; }
    .treeend-next-weekday { margin-left:auto; }
    .treeend-next-rotor { width:100%; }
    .treeend-next-rotor-unit { flex:1; width:auto; min-width:0; min-height:106px; }
    .treeend-next-year-unit { flex:1.35; width:auto; }
    .treeend-next-now-line { left:-12px; right:-12px; }
    .treeend-next-events { margin-left:0; }
    .treeend-next-auth-grid { grid-template-columns:1fr; }
}

@media (max-width: 560px) {
    .treeend-next-access { padding:12px; }
    .treeend-next-access-tree-stage { min-height:460px; border-radius:18px; }
    .treeend-next-access-tree-copy { left:18px; right:18px; bottom:18px; }
    .treeend-next-home { min-height:650px; border-radius:0; }
    .treeend-next-home-overlay { min-height:650px; padding-left:15px; padding-right:15px; }
    .treeend-next-home h1 { font-size:44px; }
    .treeend-next-context h1 { font-size:38px; }
    .treeend-next-rotor { gap:5px; }
    .treeend-next-rotor-value { font-size:29px; }
    .treeend-next-year-unit .treeend-next-rotor-value { font-size:25px; }
    .treeend-next-hour { padding-left:14px; }
    .treeend-next-hour-time { min-width:50px; font-size:16px; }
    .treeend-next-event-main { flex-direction:column; gap:1px; }
    .treeend-next-event-rich { padding-left:8px; }
    .treeend-next-event-tools { border-width:3px; }
    .treeend-next-attachment img { width:125px; height:90px; }
}

/* =========================================================
   TREEEND 2.1 — LAYER CONDIVISI
========================================================= */
.treeend-next-layer-actions{
    display:flex;
    gap:8px;
    flex-wrap:wrap;
    margin-top:10px;
}
.treeend-next-share-layer{
    border:1px solid #ff20bd;
    background:#fff;
    color:#b90083;
    border-radius:999px;
    padding:7px 12px;
    font-size:11px;
    font-weight:800;
    letter-spacing:.04em;
    cursor:pointer;
}
.treeend-next-share-layer:hover{ background:#fff1fb; }
.treeend-next-share-layer[hidden]{ display:none !important; }
.treeend-next-share-help{
    margin:0 0 14px;
    line-height:1.45;
    color:#4b5547;
}
.treeend-next-members{
    margin-top:18px;
    border-top:1px solid #e5eadf;
    padding-top:10px;
}
.treeend-next-member-row{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    padding:9px 0;
    border-bottom:1px solid #eef2ea;
}
.treeend-next-member-row > div{
    display:grid;
    gap:2px;
}
.treeend-next-member-row strong{ font-size:14px; color:#263a21; }
.treeend-next-member-row small{ font-size:12px; color:#697467; }
.treeend-next-member-row span{ font-size:11px; color:#9a4b86; }
.treeend-next-member-row button{
    border:1px solid #d9dfd2;
    background:#fff;
    border-radius:999px;
    padding:5px 9px;
    cursor:pointer;
    font-size:11px;
}
.treeend-next-event-meta{
    display:flex;
    align-items:center;
    gap:8px;
    flex-wrap:wrap;
}
.treeend-next-event-author{
    font-size:11px;
    color:#7b8476;
    font-style:italic;
}
.treeend-next-readonly{
    margin-top:7px;
    font-size:11px;
    color:#8b9486;
}


/* TreeEnd 2.2 — nome Layer globale univoco */
.treeend-next-layer-name-help{margin:0 0 14px;color:#44523e;line-height:1.45}
.treeend-next-layer-availability{margin-top:8px;padding:9px 11px;border-radius:8px;font-size:13px;font-weight:600}
.treeend-next-layer-availability.is-neutral{background:#f4f5f3;color:#6b7467}
.treeend-next-layer-availability.is-checking{background:#f5f7ee;color:#68785b}
.treeend-next-layer-availability.is-available{background:#edf8e5;color:#315923}
.treeend-next-layer-availability.is-taken{background:#fff0f0;color:#8a2e2e}


/* 2.5 — eliminazione evento */
.treeend-next-event-tools .treeend-next-event-delete {
    margin-left: auto;
    border-color: #b84a4a;
    color: #9b2929;
    background: #fff7f7;
}
.treeend-next-event-tools .treeend-next-event-delete:hover {
    background: #fbe9e9;
}
@media (max-width: 680px) {
    .treeend-next-event-tools .treeend-next-event-delete {
        margin-left: 0;
    }
}

/* =========================================================
   BRANDING 2.7 — Tree End in primo piano
========================================================= */
.treeend-next-home,
.treeend-next-access { position:relative; }
.treeend-next-corner-logo {
    position:absolute;
    top:22px;
    left:24px;
    z-index:12;
    width:220px;
    max-width:42vw;
    height:auto;
    display:block;
    border-radius:18px;
    box-shadow:0 5px 16px rgba(0,0,0,.14);
    overflow:hidden;
}
.treeend-next-copyright {
    position:absolute;
    left:24px;
    bottom:15px;
    z-index:12;
    font-size:10px;
    line-height:1.25;
    color:#7b8478;
    letter-spacing:.01em;
}
.treeend-next-copyright-sidebar {
    position:static;
    margin-top:26px;
    max-width:190px;
}
body.treeend-next-active-page .site-branding,
body.treeend-next-active-page .custom-logo-link,
body.treeend-next-active-page .site-logo {
    display:none !important;
}

/* Azioni proprietario Layer */
.treeend-next-layer-actions { display:flex; flex-wrap:wrap; gap:6px; align-items:center; }
.treeend-next-share-layer,
.treeend-next-archive-layer {
    margin:9px 0 0;
    padding:5px 9px;
    border:1px solid #c8d3c2;
    border-radius:16px;
    background:#fff;
    color:#6f786c;
    cursor:pointer;
    font-size:12px;
}
.treeend-next-archive-layer { border-color:#dfc7d8; color:#8c446f; }
.treeend-next-archive-help { margin:0 0 10px; line-height:1.45; color:#53614e; }
.treeend-next-archive-status { margin:12px 0; padding:10px 12px; border-radius:10px; background:#f3f8ef; color:#53614e; font-size:13px; }
.treeend-next-modal-actions button.danger { background:#8e315f; color:#fff; border-color:#8e315f; }
.treeend-next-modal-actions button.danger:disabled { opacity:.45; cursor:not-allowed; }

@media (max-width:720px) {
    .treeend-next-corner-logo { top:14px; left:14px; width:160px; max-width:48vw; border-radius:14px; }
    .treeend-next-copyright { left:14px; bottom:10px; font-size:9px; }
}
body.treeend-next-active-page header .wp-block-site-logo,
body.treeend-next-active-page header img.custom-logo { display:none !important; }

.treeend-next-local-human {
    margin:12px 0 14px;
    padding:10px 12px;
    border:1px solid #d7e2d1;
    border-radius:10px;
    background:#f7faf5;
}
.treeend-next-local-human label { margin:0 !important; font-size:14px; color:#53614e; }
.treeend-next-local-human input[type="number"] {
    width:96px;
    margin:6px 0 0;
    border:1px solid #bdcbb5;
    border-radius:8px;
    padding:8px 10px;
    font-size:16px;
    background:#fff;
}


/* =========================================================
   TREE END 2.8 — EXPORT INDIPENDENTE + VISTA MENSILE
========================================================= */
.treeend-next-export-layer {
    margin:9px 0 0;
    padding:5px 9px;
    border:1px solid #bfd5b7;
    border-radius:16px;
    background:#fff;
    color:#496641;
    cursor:pointer;
    font-size:12px;
}
.treeend-next-export-layer:disabled { opacity:.55; cursor:wait; }
.treeend-next-view-switch {
    display:inline-flex;
    gap:3px;
    margin:0 0 9px auto;
    padding:3px;
    background:#edf3e9;
    border-radius:999px;
}
.treeend-next-view-switch button {
    border:0;
    background:transparent;
    color:#6c7867;
    border-radius:999px;
    padding:6px 13px;
    font-size:11px;
    font-weight:700;
    letter-spacing:.05em;
    cursor:pointer;
}
.treeend-next-view-switch button.is-active { background:#fff; color:#30422a; box-shadow:0 1px 5px rgba(48,66,42,.14); }
.treeend-next-month-view { width:100%; padding:8px 0 24px; }
.treeend-next-month-weekdays,
.treeend-next-month-grid {
    display:grid;
    grid-template-columns:repeat(7,minmax(0,1fr));
    gap:5px;
}
.treeend-next-month-weekdays { margin-bottom:5px; }
.treeend-next-month-weekdays > div {
    padding:7px 5px;
    text-align:center;
    font-size:11px;
    font-weight:700;
    color:#71806c;
    text-transform:uppercase;
}
.treeend-next-month-day {
    min-height:112px;
    border:1px solid #dfe8da;
    background:#fff;
    border-radius:9px;
    padding:7px;
    text-align:left;
    color:#30422a;
    cursor:pointer;
    overflow:hidden;
}
.treeend-next-month-day:hover { border-color:#9fc58e; box-shadow:0 3px 11px rgba(48,66,42,.08); }
.treeend-next-month-day.is-empty { visibility:hidden; pointer-events:none; }
.treeend-next-month-day.is-today { border:2px solid #ff0099; padding:6px; }
.treeend-next-month-number { display:block; font-size:15px; font-weight:800; margin-bottom:7px; }
.treeend-next-month-events { display:flex; flex-direction:column; gap:4px; }
.treeend-next-month-event {
    display:block;
    border-left:3px solid var(--event-color,#A9D96D);
    background:#f5f8f3;
    border-radius:4px;
    padding:3px 5px;
    font-size:10px;
    line-height:1.25;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
}
.treeend-next-month-event strong { font-size:9px; margin-right:3px; }
.treeend-next-month-more { font-size:9px; color:#7a8577; padding-left:5px; }
.treeend-next-portal.is-month-view .treeend-next-rotor-unit[data-part="day"] { opacity:.28; pointer-events:none; }

@media (max-width:900px) {
    .treeend-next-month-day { min-height:88px; padding:5px; }
    .treeend-next-month-event { font-size:9px; }
}
@media (max-width:640px) {
    .treeend-next-month-weekdays, .treeend-next-month-grid { gap:2px; }
    .treeend-next-month-day { min-height:64px; padding:4px; border-radius:6px; }
    .treeend-next-month-event { display:none; }
    .treeend-next-month-more { display:none; }
    .treeend-next-month-day:has(.treeend-next-month-event) .treeend-next-month-number::after {
        content:' •'; color:#ff0099;
    }
}

@media (max-width: 520px) {
    .treeend-next-photo-source-actions { grid-template-columns:1fr; }
    .treeend-next-youtube { width:100%; }
}

/* Native camera/library pickers: the file input itself receives the tap.
   This is more reliable on iPhone Safari/PWA than clicking a hidden input by JS. */
.treeend-next-native-file-label {
    position:relative; display:inline-flex; align-items:center; justify-content:center;
    min-height:44px; padding:10px 14px; border:1px solid #b9c5b2; border-radius:8px;
    background:#fff; color:#33422f; font-weight:700; cursor:pointer; overflow:hidden;
}
.treeend-next-native-file-label.primary { background:#496b3b; color:#fff; border-color:#496b3b; }
.treeend-next-native-file-label input[type=file] {
    position:absolute; inset:0; width:100%; height:100%; opacity:0; cursor:pointer;
}

/* =========================================================
   2.10 — BANDIERINA PERSONALE + SCHEDA EVENTO
========================================================= */
.treeend-next-event-top{cursor:pointer}
.treeend-next-event-flag{
    flex:0 0 auto;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:3px;
    min-width:32px;
    min-height:30px;
    padding:3px 8px;
    border:1px solid #d8ded3;
    border-radius:999px;
    background:#fff;
    color:#7a8376;
    cursor:pointer;
    font-size:20px;
    line-height:1;
}
.treeend-next-event-flag small{font-size:10px;font-weight:800;color:inherit}
.treeend-next-event-flag:hover{border-color:var(--treeend-fuchsia);color:var(--treeend-fuchsia)}
.treeend-next-event-flag.is-flagged{
    border-color:var(--treeend-fuchsia);
    background:#fff0f8;
    color:var(--treeend-fuchsia);
}
.treeend-next-event-flag:disabled{opacity:.55;cursor:wait}
.treeend-next-event-origin{
    flex:0 0 auto;
    border-radius:10px;
    padding:2px 7px;
    background:#fff0f8;
    color:#9a4b86;
    font-size:10px;
    font-weight:750;
}
.treeend-next-attachment-author{
    display:block;
    margin-top:4px;
    color:#8a9286;
    font-size:10px;
    font-style:italic;
}
.treeend-next-event-detail-modal{width:min(760px,100%);max-height:90vh;overflow:auto}
.treeend-next-detail-loading{padding:20px 0;text-align:center;color:#71806b}
.treeend-next-detail-head{
    border-left:5px solid var(--event-color,#A9D96D);
    padding:4px 0 5px 14px;
    margin-bottom:18px;
}
.treeend-next-detail-date{font-size:13px;color:#687465}
.treeend-next-detail-head h4{margin:5px 0 7px;font-size:22px;line-height:1.3;color:#263a21}
.treeend-next-detail-meta{display:flex;flex-wrap:wrap;gap:8px 16px;font-size:12px;color:#6d7669}
.treeend-next-detail-flag-area{
    display:grid;
    grid-template-columns:minmax(180px,.8fr) minmax(240px,1.5fr);
    gap:18px;
    padding:14px;
    border-radius:12px;
    background:#f7faf5;
    margin-bottom:18px;
}
.treeend-next-detail-flag-area [data-detail-flag-button]{display:flex;align-items:center;gap:9px;align-content:flex-start;flex-wrap:wrap}
.treeend-next-detail-flag-label{font-size:12px;color:#53614f}
.treeend-next-detail-in-being{font-size:12px;color:#53614f;font-weight:700}
.treeend-next-detail-flaggers strong{display:block;margin-bottom:7px;color:#30422a;font-size:13px}
.treeend-next-detail-flaggers ul{margin:0;padding-left:18px;columns:2;column-gap:28px}
.treeend-next-detail-flaggers li{break-inside:avoid;margin-bottom:3px;font-size:12px;color:#525c50}
.treeend-next-detail-flaggers p{margin:0;font-size:12px;color:#8a9286}
.treeend-next-detail-content h4{margin:0 0 10px;color:#30422a;font-size:15px}
.treeend-next-detail-attachments{display:flex;flex-wrap:wrap;gap:12px}
.treeend-next-detail-empty{font-size:12px;color:#8a9286}

@media (max-width:680px){
    .treeend-next-event-top{align-items:center}
    .treeend-next-event-flag{min-width:30px;min-height:28px;padding:2px 7px;font-size:18px}
    .treeend-next-detail-flag-area{grid-template-columns:1fr}
    .treeend-next-detail-flaggers ul{columns:1}
    .treeend-next-event-detail-modal{max-height:92vh}
}

/* =========================================================
   2.11 — DISCUSSIONE EVENTO: DOMANDE / RISPOSTE
========================================================= */
.treeend-next-event-discussion{
    margin-top:22px;
    padding-top:18px;
    border-top:1px solid #dfe8db;
}
.treeend-next-discussion-head h4{margin:0;color:#30422a;font-size:18px}
.treeend-next-discussion-head p{margin:4px 0 14px;color:#6f796b;font-size:12px}
.treeend-next-discussion-settings{
    background:#f7faf4;
    border:1px solid #dce7d7;
    border-radius:12px;
    padding:12px;
    margin-bottom:14px;
}
.treeend-next-discussion-settings label{display:block;font-size:12px;font-weight:700;color:#30422a}
.treeend-next-discussion-settings select{width:100%;margin-top:6px;padding:8px;border:1px solid #c9d8c3;border-radius:8px;background:#fff}
.treeend-next-discussion-settings>button{margin-top:10px}
.treeend-next-participant-list{margin-top:10px;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px 12px}
.treeend-next-participant-row{display:flex!important;align-items:center;gap:7px;font-weight:400!important;font-size:12px!important}
.treeend-next-participant-row small{color:#7c8877}
.treeend-next-discussion-locked{padding:12px;background:#fff7ea;border:1px solid #f0d7a8;border-radius:10px;color:#795f2b;font-size:13px}
.treeend-next-question-composer,.treeend-next-answer-composer{display:flex;gap:8px;align-items:flex-end;margin:10px 0}
.treeend-next-question-composer textarea,.treeend-next-answer-composer textarea{flex:1;min-height:64px;resize:vertical;border:1px solid #cbd8c6;border-radius:10px;padding:9px 10px;font:inherit}
.treeend-next-question-composer button,.treeend-next-answer-composer button,.treeend-next-discussion-settings button,.treeend-next-discussion-message-tools button,.treeend-next-discussion-attach-tools button{
    border:1px solid #b8cbae;background:#fff;color:#30422a;border-radius:999px;padding:7px 11px;cursor:pointer;font-size:12px
}
.treeend-next-question-composer button:hover,.treeend-next-answer-composer button:hover,.treeend-next-discussion-settings button:hover,.treeend-next-discussion-message-tools button:hover,.treeend-next-discussion-attach-tools button:hover{background:#eef6e9}
.treeend-next-discussion-list{display:flex;flex-direction:column;gap:14px}
.treeend-next-discussion-question{
    position:relative;
    width:82%;
    margin-right:auto;
    background:#fff;
    border:1px solid #d7e0d2;
    border-radius:12px;
    padding:12px;
    box-shadow:0 2px 8px rgba(48,66,42,.06);
}
.treeend-next-discussion-answers{margin-top:10px;margin-left:10%;display:flex;flex-direction:column;gap:9px}
.treeend-next-discussion-answer{
    width:92%;
    margin-left:auto;
    background:#f4f6f4;
    border:1px solid #d7dddd;
    border-radius:12px;
    padding:11px;
}
.treeend-next-discussion-answer.is-accepted{border-color:#91bf77;background:#f0f8eb;box-shadow:0 0 0 2px rgba(145,191,119,.12)}
.treeend-next-discussion-meta{display:flex;align-items:center;gap:7px;flex-wrap:wrap;font-size:11px;color:#778074;margin-bottom:6px}
.treeend-next-discussion-meta strong{color:#30422a}
.treeend-next-discussion-meta time{font-size:10px}
.treeend-next-discussion-badge{font-size:10px;letter-spacing:.04em;font-weight:800;background:#30422a;color:#fff;border-radius:999px;padding:3px 7px}
.treeend-next-discussion-badge.answer{background:#7c8a78}
.treeend-next-solution-badge{background:#a9d96d;color:#20331c;border-radius:999px;padding:3px 7px;font-weight:800}
.treeend-next-discussion-body{font-size:14px;line-height:1.45;color:#333;margin-bottom:6px}
.treeend-next-discussion-message-tools{display:flex;gap:6px;flex-wrap:wrap;margin:6px 0}
.treeend-next-discussion-message-tools button.is-accepted{background:#a9d96d;border-color:#8abd58;font-weight:700}
.treeend-next-discussion-attach-tools{display:flex;gap:5px;flex-wrap:wrap;align-items:center;margin-top:7px;padding-top:7px;border-top:1px dashed #d9e1d5}
.treeend-next-discussion-attach-tools span{font-size:11px;color:#7d8678}
.treeend-next-discussion-attachments{display:flex;gap:8px;flex-wrap:wrap;margin-top:8px}
.treeend-next-discussion-attachment{max-width:220px}
.treeend-next-discussion-attachment img{max-width:180px;max-height:130px;object-fit:cover}
.treeend-next-discussion-attachment video{max-width:220px}
.treeend-next-discussion-attachment audio{max-width:220px}
@media(max-width:700px){
    .treeend-next-participant-list{grid-template-columns:1fr}
    .treeend-next-discussion-question{width:96%}
    .treeend-next-discussion-answers{margin-left:3%}
    .treeend-next-discussion-answer{width:97%}
    .treeend-next-question-composer,.treeend-next-answer-composer{flex-direction:column;align-items:stretch}
}

/* 2.12 — modifica semplice di data, ora e Layer dell'evento */
.treeend-next-event-tools .treeend-next-event-edit {
    margin-left:auto;
    border:1px solid #c9d7c3;
    border-radius:12px;
    padding:3px 8px;
    background:#f6faf3;
    color:var(--treeend-green-dark);
    font-weight:700;
}
.treeend-next-event-tools .treeend-next-event-edit + .treeend-next-event-delete { margin-left:4px; }
.treeend-next-edit-event-help { margin:0 0 14px; color:#586552; line-height:1.45; font-size:13px; }
.treeend-next-edit-date-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:8px; }
@media (max-width:680px) {
    .treeend-next-event-tools .treeend-next-event-edit { margin-left:0; }
    .treeend-next-edit-date-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
}

/* =========================================================
   2.13 — selezione multipla dei Layer nella modifica evento
========================================================= */
.treeend-next-edit-layer-checks{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:8px;
    margin-top:6px;
}
.treeend-next-edit-layer-choice{
    display:flex;
    align-items:center;
    gap:8px;
    padding:9px 10px;
    border:1px solid #d8e4d0;
    border-radius:10px;
    background:#f8fbf6;
    cursor:pointer;
    font-size:14px;
}
.treeend-next-edit-layer-choice input{margin:0;}
.treeend-next-edit-layer-choice.is-locked{opacity:.6;cursor:not-allowed;}
.treeend-next-edit-layer-note{display:block;margin-top:7px;color:#6d7768;line-height:1.35;}
@media (max-width:640px){
    .treeend-next-edit-layer-checks{grid-template-columns:1fr;}
}

/* =========================================================
   2.14 — avatar autore e ricorrenze
========================================================= */
.treeend-next-event-top{justify-content:flex-start;}
.treeend-next-event-content{min-width:0;flex:1;}
.treeend-next-event-avatar{
    flex:0 0 30px;
    width:30px;
    height:30px;
    border-radius:50%;
    overflow:hidden;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    margin-top:1px;
    background:#edf3e8;
    color:#496044;
    font-size:10px;
    font-weight:850;
    letter-spacing:.03em;
    box-shadow:0 1px 4px rgba(0,0,0,.12);
}
.treeend-next-event-avatar img{width:100%;height:100%;object-fit:cover;display:block;}
.treeend-next-event-avatar.is-initials{border:1px solid #d3dfcc;}
.treeend-next-event-repeat{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    width:20px;
    height:20px;
    border-radius:50%;
    background:#eef5e9;
    color:var(--treeend-green-dark);
    font-size:13px;
    font-weight:900;
    flex:0 0 auto;
}
.treeend-next-detail-recurrence{color:var(--treeend-green-dark);font-weight:750;}
.treeend-next-recurrence-box{
    margin:5px 0 14px;
    padding:12px;
    border:1px solid #d8e4d0;
    border-radius:12px;
    background:#f8fbf6;
}
.treeend-next-recurrence-box.is-existing{border-left:4px solid var(--treeend-green-bright);}
.treeend-next-recurrence-title{margin-bottom:9px;color:#34472f;}
.treeend-next-recurrence-box small{display:block;color:#6d7768;line-height:1.35;}
.treeend-next-repeat-no-end{display:flex;align-items:center;gap:8px;margin:4px 0 9px;font-size:14px;color:#44523e;}
.treeend-next-repeat-no-end input{margin:0;}
@media (max-width:680px){
    .treeend-next-event-avatar{width:28px;height:28px;flex-basis:28px;}
}


/* =========================================================
   2.18 — LAUNCHER APPLICAZIONI + ACCOUNT
   Nove quadratini verdi compatti; al clic si apre il pannello
   grande con le applicazioni leggibili. Accanto: account.
========================================================= */
:root { --treeend-logo-green:#0d5236; }

.treeend-next-top-tools{
    position:absolute;
    top:18px;
    right:18px;
    z-index:30;
    display:flex;
    align-items:flex-start;
    gap:10px;
}
.treeend-next-app-launcher,.treeend-next-account-menu{position:relative;}
.treeend-next-message-bell{
    position:relative;width:42px;height:42px;border:1px solid #d9e2d5;border-radius:50%;
    background:rgba(255,255,255,.92);color:var(--treeend-logo-green)!important;display:flex;align-items:center;justify-content:center;
    box-shadow:0 4px 14px rgba(30,60,35,.14);text-decoration:none!important;transition:background .16s ease,box-shadow .16s ease,transform .16s ease;
}
.treeend-next-message-bell:hover{background:#f7faf5;box-shadow:0 6px 18px rgba(30,60,35,.2);transform:translateY(-1px);}
.treeend-next-message-bell svg{width:20px;height:20px;display:block;fill:currentColor;}
.treeend-next-message-bell.has-unread{color:#fff!important;background:var(--treeend-logo-green);}
.treeend-next-message-badge{position:absolute;top:-5px;right:-5px;min-width:18px;height:18px;padding:0 5px;border-radius:10px;background:#ff18cf;color:#fff;
    display:flex;align-items:center;justify-content:center;font-size:9px;font-weight:900;line-height:1;box-shadow:0 0 0 2px #fff;}
.treeend-next-message-badge[hidden]{display:none!important;}
.treeend-next-app-launcher-button{
    width:42px;
    height:42px;
    padding:7px;
    display:grid;
    grid-template-columns:repeat(3,7px);
    grid-template-rows:repeat(3,7px);
    gap:3px;
    align-content:center;
    justify-content:center;
    border:1px solid #d9e2d5;
    border-radius:50%;
    background:rgba(255,255,255,.92);
    box-shadow:0 4px 14px rgba(30,60,35,.14);
    cursor:pointer;
}
.treeend-next-app-launcher-button span{
    width:7px;height:7px;border-radius:1.5px;background:var(--treeend-logo-green);display:block;
}
.treeend-next-app-launcher-button:hover{background:#f7faf5;box-shadow:0 6px 18px rgba(30,60,35,.2);}

.treeend-next-app-panel,
.treeend-next-account-panel{
    position:absolute;
    top:50px;
    right:0;
    border:1px solid #dce5d8;
    border-radius:20px;
    background:rgba(255,255,255,.985);
    box-shadow:0 18px 45px rgba(32,55,35,.22);
    backdrop-filter:blur(12px);
}
.treeend-next-app-panel[hidden],.treeend-next-account-panel[hidden]{display:none !important;}
.treeend-next-app-panel{width:286px;padding:14px;}
.treeend-next-app-panel-title{
    margin:1px 4px 10px;
    color:#6d7768;
    font-size:10px;
    font-weight:900;
    letter-spacing:.12em;
}
.treeend-next-app-panel-grid{
    display:grid;
    grid-template-columns:repeat(3,1fr);
    gap:8px;
}
.treeend-next-app-tile{
    aspect-ratio:1/1;
    min-width:0;
    border-radius:12px;
    background:var(--treeend-logo-green);
    color:#fff !important;
    text-decoration:none !important;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    overflow:hidden;
    box-shadow:0 3px 10px rgba(18,67,43,.14);
    border:1px solid rgba(255,255,255,.22);
    transition:transform .16s ease,box-shadow .16s ease,filter .16s ease;
}
a.treeend-next-app-tile:hover{
    transform:translateY(-2px);
    box-shadow:0 7px 16px rgba(18,67,43,.22);
    filter:brightness(1.08);
}
.treeend-next-app-tile.is-active{box-shadow:0 0 0 2px rgba(255,24,207,.65),0 5px 14px rgba(18,67,43,.2);}
.treeend-next-app-tile.is-disabled{opacity:.82;cursor:default;}
.treeend-next-app-icon{display:block;width:43px;height:43px;line-height:0;margin-bottom:6px;}
.treeend-next-app-icon svg{width:100%;height:100%;display:block;color:#fff;}
.treeend-next-app-label{
    display:block;
    max-width:78px;
    color:#fff;
    font-size:10px;
    line-height:1;
    font-weight:850;
    letter-spacing:.045em;
    white-space:nowrap;
}

.treeend-next-account-button{
    width:42px;height:42px;padding:0;border:1px solid #d9e2d5;border-radius:50%;overflow:hidden;
    background:#eef4eb;color:var(--treeend-green-dark);display:flex;align-items:center;justify-content:center;
    box-shadow:0 4px 14px rgba(30,60,35,.14);font-weight:900;font-size:12px;cursor:pointer;
}
.treeend-next-account-button img{width:100%;height:100%;object-fit:cover;display:block;}
.treeend-next-account-panel{width:min(360px,calc(100vw - 24px));padding:16px;max-height:min(78vh,680px);overflow:auto;}
.treeend-next-account-head{display:grid;grid-template-columns:56px minmax(0,1fr);gap:11px;align-items:center;margin-bottom:10px;}
.treeend-next-account-head strong{display:block;color:var(--treeend-green-dark);font-size:15px;overflow-wrap:anywhere;}
.treeend-next-account-head small{display:block;color:#7a8476;font-size:11px;overflow-wrap:anywhere;margin-top:2px;}
.treeend-next-account-avatar-large{width:56px;height:56px;border-radius:50%;overflow:hidden;background:#e3eddf;color:var(--treeend-green-dark);display:flex;align-items:center;justify-content:center;font-weight:900;}
.treeend-next-account-avatar-large img{width:100%;height:100%;object-fit:cover;display:block;}
.treeend-next-account-photo{display:inline-block;margin:0 0 10px;border:1px solid #cad8c4;border-radius:18px;padding:6px 10px;color:var(--treeend-green-dark);font-size:11px;font-weight:800;cursor:pointer;background:#fff;}
.treeend-next-account-fields{display:grid;grid-template-columns:1fr 1fr;gap:8px;}
.treeend-next-account-fields label,.treeend-next-account-password label{display:grid;gap:4px;color:#66715f;font-size:9px;font-weight:850;text-transform:uppercase;letter-spacing:.04em;}
.treeend-next-account-fields label.is-wide{grid-column:1/-1;}
.treeend-next-account-fields input,.treeend-next-account-fields textarea,.treeend-next-account-password input{
    width:100%;min-width:0;border:1px solid #cfdacb;border-radius:9px;padding:8px 9px;background:#fff;color:#2f392c;font:inherit;font-size:12px;text-transform:none;letter-spacing:0;
}
.treeend-next-account-save,.treeend-next-account-password button{
    margin-top:10px;border:0;border-radius:18px;background:var(--treeend-green-dark);color:#fff;padding:8px 12px;font-size:11px;font-weight:800;cursor:pointer;
}
.treeend-next-account-password{margin-top:12px;padding-top:10px;border-top:1px solid #e1e8de;}
.treeend-next-account-password summary{cursor:pointer;color:var(--treeend-green-dark);font-size:11px;font-weight:850;margin-bottom:9px;}
.treeend-next-account-password label{margin:7px 0;}
.treeend-next-account-status{min-height:17px;margin:2px 0 8px;color:#6d7768;font-size:10px;}
.treeend-next-account-status.is-ok{color:#2d7a3f;}
.treeend-next-account-status.is-error{color:#9a3455;}
.treeend-next-account-logout{display:inline-block;margin-top:12px;color:#7b4662 !important;font-size:10px;font-weight:800;text-decoration:none !important;}

@media (max-width:700px){
    .treeend-next-top-tools{top:10px;right:10px;gap:7px;}
    .treeend-next-app-launcher-button,.treeend-next-account-button,.treeend-next-message-bell{width:38px;height:38px;}
    .treeend-next-app-panel,.treeend-next-account-panel{top:45px;}
    .treeend-next-app-panel{width:248px;padding:11px;border-radius:17px;}
    .treeend-next-app-panel-grid{gap:6px;}
    .treeend-next-app-icon{width:36px;height:36px;margin-bottom:5px;}
    .treeend-next-app-label{font-size:8.5px;max-width:66px;}
    .treeend-next-account-panel{width:min(330px,calc(100vw - 20px));right:0;padding:13px;}
    .treeend-next-account-fields{grid-template-columns:1fr;}
    .treeend-next-account-fields label.is-wide{grid-column:auto;}
}

/* =========================================================
   2.16 — HOME CONTATTI
   Stesso Baobab / stesso font della domanda Home Agenda.
========================================================= */
.treeend-next-contacts-home .treeend-next-home-overlay{padding-bottom:150px;}
.treeend-next-section-emblem{
    position:absolute;
    z-index:6;
    left:50%;
    top:68%;
    transform:translate(-50%,18px);
    display:flex;
    flex-direction:column;
    align-items:center;
    gap:7px;
    color:var(--treeend-logo-green) !important;
    text-decoration:none !important;
    animation:treeend-emblem-rise .7s cubic-bezier(.2,.8,.2,1) .12s both;
}
.treeend-next-section-emblem-icon{
    width:82px;
    height:82px;
    display:flex;
    align-items:center;
    justify-content:center;
    border-radius:15px;
    background:var(--treeend-logo-green);
    color:#fff;
    border:1px solid rgba(255,255,255,.8);
    box-shadow:0 10px 24px rgba(18,67,43,.2),0 0 0 5px rgba(255,255,255,.32);
}
.treeend-next-section-emblem-icon svg{width:62%;height:62%;display:block;color:#fff;}
.treeend-next-section-emblem strong{
    font-size:18px;
    letter-spacing:.16em;
    line-height:1;
    color:var(--treeend-logo-green);
}
@keyframes treeend-emblem-rise{
    from{opacity:0;transform:translate(-50%,42px) scale(.88);}
    to{opacity:1;transform:translate(-50%,0) scale(1);}
}

/* =========================================================
   2.17 — CONTATTI 2.0
   Stessa architettura visuale dell'Agenda: sidebar con gli
   stessi Layer, vista ELENCO e vista TEMPO con rotore.
========================================================= */
.treeend-next-contacts-portal-v2{position:relative;}
.treeend-next-contacts-column{min-width:0;}
.treeend-next-contacts-side-note p{
    margin:0 0 10px;color:#6d7768;font-size:11px;line-height:1.45;
}
.treeend-next-contacts-back-agenda{
    display:inline-block;color:var(--treeend-green-dark);font-size:11px;font-weight:800;text-decoration:none;
}
.treeend-next-contacts-back-agenda:hover{text-decoration:underline;}
.treeend-next-contacts-rotor-wrap{display:flex;flex-direction:column;align-items:flex-end;}
.treeend-next-contacts-rotor-wrap[hidden]{display:none !important;}

.treeend-next-contacts-directory-v2{min-width:0;}
.treeend-next-contacts-directory-toolbar{
    display:grid;
    grid-template-columns:minmax(170px,230px) minmax(260px,1fr);
    gap:12px;
    align-items:end;
    margin:0 0 14px;
    padding:12px;
    border:1px solid #e2e9de;
    border-radius:14px;
    background:#f9fbf8;
}
.treeend-next-contacts-directory-toolbar label{
    display:grid;gap:5px;min-width:0;color:#6f796b;font-size:10px;font-weight:850;letter-spacing:.05em;text-transform:uppercase;
}
.treeend-next-contacts-directory-toolbar select,
.treeend-next-contacts-directory-toolbar input{
    width:100%;min-width:0;border:1px solid #cdd9c7;border-radius:9px;background:#fff;padding:9px 11px;color:var(--treeend-text);font:inherit;font-size:13px;text-transform:none;letter-spacing:0;
}
.treeend-next-contact-table-wrap{width:100%;overflow-x:auto;border:1px solid #e1e8dd;border-radius:12px;background:#fff;}
.treeend-next-contact-table{width:100%;border-collapse:collapse;table-layout:fixed;}
.treeend-next-contact-table th{
    padding:10px 12px;text-align:left;color:#53604f;background:#f5f8f3;border-bottom:1px solid #dfe7dc;font-size:11px;font-weight:900;letter-spacing:.03em;cursor:pointer;user-select:none;
}
.treeend-next-contact-table th:hover{color:var(--treeend-fuchsia);}
.treeend-next-contact-table td{
    padding:9px 12px;border-bottom:1px solid #edf1ea;color:#4c5549;font-size:12px;vertical-align:middle;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
.treeend-next-contact-table tr:last-child td{border-bottom:0;}
.treeend-next-contact-table tbody tr:hover{background:#f7faf5;}
.treeend-next-contact-table tbody tr.has-unread{background:#fff8fd;}
.treeend-next-contact-table tbody tr.has-unread:hover{background:#fff2fb;}
.treeend-next-contact-name-button{
    width:100%;min-width:0;display:flex;align-items:center;gap:8px;border:0;background:transparent;padding:0;color:var(--treeend-green-dark);font:inherit;font-weight:800;text-align:left;cursor:pointer;
}
.treeend-next-contact-name-text{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.treeend-next-contact-unread{margin-left:auto;flex:0 0 auto;min-width:20px;height:20px;padding:0 6px;border-radius:12px;background:#ff18cf;color:#fff;
    display:inline-flex;align-items:center;justify-content:center;font-size:9px;font-weight:900;line-height:1;box-shadow:0 2px 8px rgba(255,24,207,.18);}
.treeend-next-contact-chip.has-unread{border-color:rgba(255,24,207,.35);background:#fff8fd;}
.treeend-next-contact-chip .treeend-next-contact-unread{margin-left:auto;}

.treeend-next-contact-hour{min-height:58px;}
.treeend-next-contact-events{display:flex;flex-direction:column;gap:7px;margin-left:70px;margin-top:-29px;padding:0 0 6px 0;}
.treeend-next-contact-timeline-item{display:flex;align-items:center;gap:8px;flex-wrap:wrap;}
.treeend-next-contact-chip{
    display:flex;align-items:center;gap:9px;min-width:230px;max-width:100%;padding:6px 10px 6px 7px;border:1px solid #dce7d7;border-radius:22px;background:#f4f8f1;color:var(--treeend-text);cursor:pointer;text-align:left;
}
.treeend-next-contact-chip:hover{background:#eef6e9;}
.treeend-next-contact-chip-main{display:flex;flex-direction:column;min-width:0;}
.treeend-next-contact-chip-main strong{font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.treeend-next-contact-chip-main small{font-size:10px;color:#768172;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.treeend-next-contact-avatar{
    flex:0 0 34px;width:34px;height:34px;border-radius:50%;overflow:hidden;display:inline-flex;align-items:center;justify-content:center;background:#dfeadb;color:#365438;font-size:10px;font-weight:850;
}
.treeend-next-contact-avatar img{width:100%;height:100%;object-fit:cover;display:block;}
.treeend-next-contact-avatar.is-initials{letter-spacing:.03em;}
.treeend-next-contact-loading,.treeend-next-contact-empty{
    margin:14px 0;padding:13px;border:1px dashed #d4ddd0;border-radius:11px;color:#6d7768;background:#fafcf9;font-size:12px;
}
.treeend-next-contact-table .treeend-next-contact-loading{text-align:center;border:0;background:#fff;}

.treeend-next-contact-detail-modal{width:min(720px,100%);max-height:90vh;overflow:auto;}
.treeend-next-contact-detail-head{display:flex;align-items:center;gap:12px;margin-bottom:14px;padding-bottom:12px;border-bottom:1px solid #e5ebe1;}
.treeend-next-contact-detail-head .treeend-next-contact-avatar{width:54px;height:54px;flex-basis:54px;}
.treeend-next-contact-detail-head div{display:flex;flex-direction:column;gap:2px;}
.treeend-next-contact-detail-head small{color:#758070;}
.treeend-next-contact-edit-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:0 10px;}
.treeend-next-contact-wide{grid-column:1/-1;}
.treeend-next-business-card-box{margin-top:9px;padding:12px;border:1px solid #dce7d7;border-radius:12px;background:#f8fbf6;}
.treeend-next-business-card-box>div{display:flex;flex-direction:column;gap:3px;margin-bottom:8px;}
.treeend-next-business-card-box small{color:#6f796b;font-size:11px;line-height:1.4;}
.treeend-next-business-card-box img{display:block;max-width:240px;max-height:150px;object-fit:contain;margin:8px 0;border-radius:8px;border:1px solid #dfe6db;}
.treeend-next-business-card-box button{border:1px solid #c8d8c1;border-radius:18px;background:#fff;color:#30422a;padding:7px 11px;cursor:pointer;}

@media (max-width:700px){
    .treeend-next-contacts-directory-toolbar{grid-template-columns:1fr;gap:8px;padding:9px;}
    .treeend-next-contacts-rotor-wrap{align-items:flex-start;width:100%;}
    .treeend-next-contact-table-wrap{overflow:visible;border:0;background:transparent;}
    .treeend-next-contact-table,.treeend-next-contact-table tbody,.treeend-next-contact-table tr,.treeend-next-contact-table td{display:block;width:100%;}
    .treeend-next-contact-table thead{display:none;}
    .treeend-next-contact-table tr{margin:0 0 9px;padding:8px 10px;border:1px solid #dfe7dc;border-radius:11px;background:#fff;}
    .treeend-next-contact-table td{display:grid;grid-template-columns:82px minmax(0,1fr);gap:8px;align-items:center;padding:5px 0;border:0;white-space:normal;overflow:visible;}
    .treeend-next-contact-table td::before{content:attr(data-label);color:#7a8376;font-size:9px;font-weight:850;text-transform:uppercase;letter-spacing:.04em;}
    .treeend-next-contact-name-button{min-width:0;}
    .treeend-next-contact-events{margin-left:56px;margin-top:-28px;}
    .treeend-next-contact-chip{min-width:0;width:100%;}
    .treeend-next-contact-edit-grid{grid-template-columns:1fr;}
    .treeend-next-contact-wide{grid-column:auto;}
}

/* =========================================================
   2.16 — MODIFICA EVENTO MOBILE
   Evita la finestra troppo larga e rende leggibile l'elenco Layer.
========================================================= */
.treeend-next-edit-event-modal{
    width:min(620px,calc(100vw - 24px));
    max-width:100%;
    max-height:calc(100dvh - 30px);
    overflow:auto;
    overflow-x:hidden;
}
.treeend-next-edit-event-modal .treeend-next-modal-body{min-width:0;}
.treeend-next-edit-event-modal .treeend-next-edit-layer-checks{
    width:100%;
    min-width:0;
    max-height:220px;
    overflow-y:auto;
    overflow-x:hidden;
    padding-right:3px;
}
.treeend-next-edit-event-modal .treeend-next-edit-layer-choice{
    min-width:0;
    width:100%;
}
.treeend-next-edit-event-modal .treeend-next-edit-layer-choice span{
    min-width:0;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}
@media (max-width:700px){
    .treeend-next-contacts-home .treeend-next-home-overlay{padding-top:115px;padding-bottom:145px;}
    .treeend-next-section-emblem{top:72%;}
    .treeend-next-section-emblem-icon{width:68px;height:68px;border-radius:13px;}
    .treeend-next-section-emblem strong{font-size:14px;}
    .treeend-next-contacts-topbar{min-height:105px;padding-right:102px;}
    .treeend-next-contacts-topbar .treeend-next-logo{width:175px;}
    .treeend-next-contacts-controls{grid-template-columns:1fr 1fr;}
    .treeend-next-contact-search{grid-column:1/-1;}
    .treeend-next-contact-list{grid-template-columns:1fr;}
    .treeend-next-contacts-head{align-items:flex-start;flex-direction:column;}
    .treeend-next-contacts-profile{display:none;}
    .treeend-next-edit-event-backdrop{
        align-items:flex-start;
        padding:8px;
        overflow-y:auto;
        -webkit-overflow-scrolling:touch;
    }
    .treeend-next-edit-event-modal{
        width:100%;
        max-width:100%;
        max-height:none;
        min-height:0;
        margin:4px 0 16px;
        padding:14px;
        border-radius:12px;
    }
    .treeend-next-edit-event-modal .treeend-next-edit-date-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;}
    .treeend-next-edit-event-modal .treeend-next-edit-layer-checks{grid-template-columns:1fr;max-height:165px;}
    .treeend-next-edit-event-modal .treeend-next-modal-actions{
        position:sticky;
        bottom:-14px;
        margin:13px -14px -14px;
        padding:10px 14px 12px;
        background:rgba(255,255,255,.97);
        border-top:1px solid #e3e8e0;
        z-index:3;
    }
}
@media (max-width:480px){
    .treeend-next-contacts-controls{grid-template-columns:1fr;}
    .treeend-next-contact-search{grid-column:auto;}
    .treeend-next-contacts-datebar strong{min-width:0;flex:1;font-size:17px;}
    .treeend-next-contact-edit-grid{grid-template-columns:1fr;}
    .treeend-next-contact-wide{grid-column:auto;}
    .treeend-next-contact-card{grid-template-columns:38px minmax(0,1fr);align-items:center;}
    .treeend-next-contact-level-badge{grid-column:2;justify-self:start;}
}

/* =========================================================
   2.19 — launcher globale, icone rinnovate, contatti eliminabili,
   correzione definitiva selezione Layer su mobile.
========================================================= */
.treeend-next-portal,
.treeend-next-access,
.treeend-next-home{position:relative;}

/* Il launcher resta un semplice 3x3 verde, senza cerchio invadente. */
.treeend-next-app-launcher-button{
    border:0;
    border-radius:10px;
    background:transparent;
    box-shadow:none;
    padding:4px;
}
.treeend-next-app-launcher-button:hover{
    background:rgba(13,82,54,.06);
    box-shadow:none;
}
.treeend-next-app-launcher-button span{
    border-radius:2px;
    box-shadow:0 1px 2px rgba(13,82,54,.16);
}
.treeend-next-app-panel{
    transform-origin:top right;
    animation:treeend-app-panel-open .18s ease-out both;
}
@keyframes treeend-app-panel-open{
    from{opacity:0;transform:scale(.92) translateY(-4px);}
    to{opacity:1;transform:scale(1) translateY(0);}
}
.treeend-next-app-panel-grid{gap:10px;}
.treeend-next-app-tile{
    background:#fff;
    border:1px solid #dce6d8;
    color:var(--treeend-green-dark)!important;
    padding:7px 5px 8px;
    justify-content:flex-start;
}
.treeend-next-app-tile.is-disabled{
    background:var(--treeend-logo-green);
    border-color:rgba(255,255,255,.18);
    min-height:82px;
}
.treeend-next-app-tile.is-active{
    box-shadow:0 0 0 2px rgba(255,24,207,.55),0 6px 16px rgba(18,67,43,.16);
}
.treeend-next-app-icon{
    width:58px;
    height:58px;
    margin:0 auto 5px;
    display:block;
}
.treeend-next-app-icon-img{
    width:100%;
    height:100%;
    object-fit:contain;
    display:block;
    border-radius:11px;
}
.treeend-next-app-label{
    max-width:100%;
    color:var(--treeend-green-dark);
    font-size:10px;
    font-weight:900;
    letter-spacing:.05em;
}
a.treeend-next-app-tile:hover{
    transform:translateY(-2px) scale(1.035);
    background:#fbfdf9;
}

/* L'icona grande della sezione Contatti usa l'immagine approvata. */
.treeend-next-section-emblem-icon{
    padding:0;
    overflow:hidden;
    background:transparent;
    border:0;
}
.treeend-next-section-emblem-icon .treeend-next-app-icon-img{
    width:100%;
    height:100%;
    border-radius:15px;
}

/* Pulsante di cancellazione contatto. */
.treeend-next-contact-actions{align-items:center;}
.treeend-next-modal-actions-spacer{flex:1 1 auto;}
.treeend-next-modal-actions .treeend-next-danger{
    margin-right:auto;
    background:#fff1f1;
    color:#9d2f2f;
    border:1px solid #e9bcbc;
    font-weight:800;
}
.treeend-next-modal-actions .treeend-next-danger:hover{background:#ffe6e6;}

/* Correzione fondamentale: i checkbox NON devono ereditare width:100% dai campi del modal. */
.treeend-next-edit-event-modal .treeend-next-edit-layer-choice input[type="checkbox"]{
    width:18px!important;
    min-width:18px!important;
    max-width:18px!important;
    height:18px!important;
    padding:0!important;
    margin:0!important;
    flex:0 0 18px!important;
    accent-color:var(--treeend-green-dark);
}
.treeend-next-edit-event-modal .treeend-next-edit-layer-choice{
    display:grid!important;
    grid-template-columns:18px minmax(0,1fr)!important;
    align-items:center!important;
    column-gap:9px!important;
}
.treeend-next-edit-event-modal .treeend-next-edit-layer-choice span{
    display:block!important;
    width:auto!important;
    max-width:100%!important;
    min-width:0!important;
    white-space:normal!important;
    overflow:visible!important;
    text-overflow:clip!important;
    overflow-wrap:anywhere!important;
    line-height:1.25!important;
}

@media (max-width:700px){
    .treeend-next-top-tools{top:10px;right:10px;}
    .treeend-next-app-panel{width:min(270px,calc(100vw - 20px));}
    .treeend-next-app-icon{width:54px;height:54px;}
    .treeend-next-app-label{font-size:9px;}

    .treeend-next-edit-event-modal .treeend-next-edit-layer-checks{
        display:flex!important;
        flex-direction:column!important;
        gap:6px!important;
        width:100%!important;
        max-width:100%!important;
        max-height:150px!important;
        overflow-y:auto!important;
        overflow-x:hidden!important;
        padding:2px!important;
    }
    .treeend-next-edit-event-modal .treeend-next-edit-layer-choice{
        width:100%!important;
        max-width:100%!important;
        min-width:0!important;
        padding:8px 9px!important;
        font-size:13px!important;
        border-radius:9px!important;
    }
    .treeend-next-edit-event-modal .treeend-next-edit-layer-note{
        font-size:11px!important;
    }
    .treeend-next-contact-actions{
        flex-wrap:wrap;
    }
    .treeend-next-contact-actions .treeend-next-danger{
        width:100%;
        order:3;
        margin-top:5px;
    }
    .treeend-next-modal-actions-spacer{display:none;}
}

/* =========================================================
   2.20 — LAUNCHER UNIFORME + HEADER INTERNO + MOBILE EVENTI
========================================================= */

/* Nei portali interni il launcher/account occupa una riga propria:
   niente sovrapposizione con ELENCO/TEMPO o GIORNO/MESE. */
.treeend-next-portal > .treeend-next-top-tools{
    position:relative;
    top:auto;
    right:auto;
    z-index:40;
    width:100%;
    min-height:54px;
    display:flex;
    justify-content:flex-end;
    align-items:center;
    gap:9px;
    padding:10px 18px 2px;
    margin:0;
    box-sizing:border-box;
}

/* Pannello applicazioni: tutti i nove riquadri hanno esattamente la stessa dimensione. */
.treeend-next-app-panel{
    width:300px;
    padding:14px;
}
.treeend-next-app-panel-grid{
    grid-template-columns:repeat(3,minmax(0,1fr));
    grid-auto-rows:1fr;
    gap:9px;
}
.treeend-next-app-tile,
.treeend-next-app-tile.is-disabled{
    aspect-ratio:1/1;
    width:100%;
    min-width:0;
    min-height:0;
    padding:7px 6px 8px;
    box-sizing:border-box;
    background:var(--treeend-logo-green);
    border:1px solid rgba(255,255,255,.18);
    color:#fff!important;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    overflow:hidden;
}
.treeend-next-app-tile.is-disabled{opacity:.92;}
.treeend-next-app-tile.is-active{
    background:var(--treeend-logo-green);
    box-shadow:0 0 0 2px rgba(255,24,207,.5),0 6px 16px rgba(18,67,43,.18);
}
.treeend-next-app-icon{
    width:58px;
    height:58px;
    max-width:72%;
    max-height:72%;
    margin:0 auto 5px;
    flex:0 0 auto;
}
.treeend-next-app-icon-img{
    width:100%;
    height:100%;
    object-fit:contain;
    display:block;
    border-radius:10px;
}
.treeend-next-app-label{
    display:block;
    width:100%;
    max-width:100%;
    margin:0;
    padding:0;
    color:#fff!important;
    font-size:9.5px;
    line-height:1.08;
    font-weight:900;
    letter-spacing:.045em;
    text-align:center;
    white-space:normal;
    overflow:visible;
    text-overflow:clip;
}
a.treeend-next-app-tile:hover{
    transform:translateY(-2px) scale(1.025);
    background:#116340;
}

/* La riga delle app precede sempre l'area di lavoro interna. */
.treeend-next-portal > .treeend-next-app-shell{
    position:relative;
    z-index:1;
}

/* MODIFICA EVENTO — lista Layer realmente compatta su telefono. */
.treeend-next-edit-event-modal .treeend-next-edit-layer-checks{
    border:1px solid #dce5d8;
    border-radius:10px;
    background:#fbfcfa;
    padding:5px!important;
    box-sizing:border-box!important;
}
.treeend-next-edit-event-modal .treeend-next-edit-layer-choice{
    box-sizing:border-box!important;
    min-height:34px!important;
    padding:5px 7px!important;
    margin:0!important;
    background:#fff!important;
    border:1px solid #e3e9e0!important;
    border-radius:7px!important;
    color:#2f392c!important;
}
.treeend-next-edit-event-modal .treeend-next-edit-layer-choice input[type="checkbox"]{
    width:15px!important;
    min-width:15px!important;
    max-width:15px!important;
    height:15px!important;
    flex-basis:15px!important;
}
.treeend-next-edit-event-modal .treeend-next-edit-layer-choice span{
    color:#2f392c!important;
    font-size:12px!important;
    line-height:1.15!important;
    font-weight:650!important;
    white-space:normal!important;
    word-break:break-word!important;
    overflow:visible!important;
}

@media (max-width:700px){
    .treeend-next-portal > .treeend-next-top-tools{
        min-height:48px;
        padding:7px 10px 0;
        gap:6px;
    }
    .treeend-next-portal .treeend-next-app-launcher-button,
    .treeend-next-portal .treeend-next-account-button{
        width:38px;
        height:38px;
    }
    .treeend-next-app-panel{
        width:min(278px,calc(100vw - 20px));
        padding:10px;
    }
    .treeend-next-app-panel-grid{gap:7px;}
    .treeend-next-app-tile,
    .treeend-next-app-tile.is-disabled{
        padding:5px 4px 6px;
    }
    .treeend-next-app-icon{
        width:50px;
        height:50px;
        margin-bottom:3px;
    }
    .treeend-next-app-label{
        font-size:8.5px;
        line-height:1.05;
    }

    /* Modal evento più stretto, con Layer bassi e leggibili. */
    .treeend-next-edit-event-backdrop{
        padding:5px!important;
    }
    .treeend-next-edit-event-modal{
        width:calc(100vw - 10px)!important;
        max-width:calc(100vw - 10px)!important;
        padding:11px!important;
        margin:2px 0 10px!important;
    }
    .treeend-next-edit-event-modal .treeend-next-edit-layer-checks{
        max-height:118px!important;
        gap:4px!important;
        padding:4px!important;
    }
    .treeend-next-edit-event-modal .treeend-next-edit-layer-choice{
        display:flex!important;
        align-items:center!important;
        gap:7px!important;
        width:100%!important;
        min-height:30px!important;
        padding:4px 6px!important;
    }
    .treeend-next-edit-event-modal .treeend-next-edit-layer-choice span{
        font-size:11px!important;
        line-height:1.12!important;
    }
    .treeend-next-edit-event-modal .treeend-next-edit-layer-note{
        margin-top:4px!important;
        font-size:10px!important;
        line-height:1.2!important;
    }
}

/* =========================================================
   2.21 — VIDEOCHIAMATA WEBRTC 1:1
========================================================= */
.treeend-next-contact-call-box{
    margin:14px 0;
    padding:14px;
    border:1px solid rgba(46,65,32,.18);
    border-radius:14px;
    background:#f7faf5;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:16px;
}
.treeend-next-contact-call-box strong,
.treeend-next-contact-call-box small{display:block}
.treeend-next-contact-call-box small{margin-top:3px;color:#65705f;font-size:12px;line-height:1.35}
.treeend-next-contact-call-box.is-disabled{opacity:.68}
.treeend-next-video-call-button{
    flex:0 0 auto;
    border:0;
    border-radius:999px;
    padding:10px 16px;
    background:#2e4120;
    color:#fff;
    font-weight:700;
    cursor:pointer;
}
.treeend-next-video-call-button:hover{filter:brightness(1.08)}

.treeend-next-call-backdrop{
    position:fixed;
    inset:0;
    z-index:1000000;
    display:flex;
    align-items:center;
    justify-content:center;
    padding:18px;
    background:rgba(8,18,11,.78);
    backdrop-filter:blur(8px);
}
.treeend-next-call-modal{
    width:min(920px,96vw);
    max-height:94vh;
    overflow:auto;
    border-radius:24px;
    background:#f8fbf6;
    box-shadow:0 28px 90px rgba(0,0,0,.38);
    padding:18px;
}
.treeend-next-call-head{
    display:flex;
    align-items:center;
    gap:12px;
    margin-bottom:14px;
    color:#26391f;
}
.treeend-next-call-head strong,.treeend-next-call-head small{display:block}
.treeend-next-call-head strong{font-size:18px}
.treeend-next-call-head small{margin-top:2px;color:#6a7565;font-size:12px}
.treeend-next-call-peer-avatar{
    width:48px;height:48px;border-radius:50%;overflow:hidden;
    background:#2e4120;color:#fff;display:grid;place-items:center;
    font-weight:800;flex:0 0 auto;
}
.treeend-next-call-peer-avatar img{width:100%;height:100%;object-fit:cover;display:block}
.treeend-next-call-stage{
    position:relative;
    width:100%;
    aspect-ratio:16/9;
    min-height:240px;
    overflow:hidden;
    border-radius:20px;
    background:#0c160d;
}
.treeend-next-call-remote{width:100%;height:100%;object-fit:cover;background:#0c160d;display:block}
.treeend-next-call-local{
    position:absolute;
    right:14px;
    bottom:14px;
    width:min(28%,210px);
    aspect-ratio:3/4;
    object-fit:cover;
    border-radius:14px;
    border:2px solid rgba(255,255,255,.9);
    box-shadow:0 8px 30px rgba(0,0,0,.3);
    background:#182819;
}
.treeend-next-call-status{
    min-height:24px;
    padding:10px 4px 4px;
    text-align:center;
    color:#5d6958;
    font-size:14px;
}
.treeend-next-call-status[data-kind="connected"]{color:#1f6d33;font-weight:700}
.treeend-next-call-status[data-kind="error"]{color:#9d2a2a}
.treeend-next-call-controls{display:flex;justify-content:center;gap:10px;flex-wrap:wrap;margin-top:8px}
.treeend-next-call-btn{
    border:1px solid rgba(46,65,32,.18);
    border-radius:999px;
    padding:10px 15px;
    background:#fff;
    color:#26391f;
    font-weight:700;
    cursor:pointer;
}
.treeend-next-call-btn.is-off{opacity:.65}
.treeend-next-call-btn.is-end{background:#b93636;border-color:#b93636;color:#fff}
.treeend-next-call-privacy{text-align:center;margin:10px 0 0;color:#7a8275;font-size:11px}

.treeend-next-call-incoming{
    position:fixed;
    z-index:1000001;
    right:18px;
    top:18px;
    width:min(420px,calc(100vw - 36px));
}
.treeend-next-call-incoming-card{
    display:grid;
    grid-template-columns:auto 1fr;
    align-items:center;
    gap:12px;
    padding:14px;
    border-radius:18px;
    background:#fff;
    border:1px solid rgba(46,65,32,.18);
    box-shadow:0 18px 55px rgba(0,0,0,.22);
}
.treeend-next-call-incoming-text strong,.treeend-next-call-incoming-text span{display:block}
.treeend-next-call-incoming-text span{font-size:12px;color:#6a7565;margin-top:2px}
.treeend-next-call-incoming-actions{grid-column:1/-1;display:flex;gap:10px;justify-content:flex-end}
.treeend-next-call-incoming-actions button{border:0;border-radius:999px;padding:9px 14px;font-weight:700;cursor:pointer}
.treeend-next-call-incoming-actions .is-decline{background:#f0eeee;color:#8e2e2e}
.treeend-next-call-incoming-actions .is-accept{background:#2e4120;color:#fff}

@media (max-width:640px){
    .treeend-next-contact-call-box{align-items:flex-start;flex-direction:column}
    .treeend-next-video-call-button{width:100%}
    .treeend-next-call-backdrop{padding:0;background:#071008}
    .treeend-next-call-modal{width:100vw;max-height:100vh;min-height:100vh;border-radius:0;padding:12px;display:flex;flex-direction:column}
    .treeend-next-call-stage{flex:1;min-height:0;aspect-ratio:auto;border-radius:18px}
    .treeend-next-call-local{width:30%;max-width:120px;right:10px;bottom:10px}
    .treeend-next-call-head{margin:2px 0 10px}
    .treeend-next-call-controls{padding-bottom:max(6px,env(safe-area-inset-bottom))}
    .treeend-next-call-incoming{top:max(10px,env(safe-area-inset-top));right:10px;width:calc(100vw - 20px)}
}

/* =========================================================
   2.21.1 — MENU 3x3 NATIVO + MUSIC
   Un solo fondo per tutti i 9 riquadri. Le icone sono PNG
   trasparenti avorio; nessun bordo/filetto o fondo incorporato.
========================================================= */
:root{--treeend-app-green:#2E4120;--treeend-app-ivory:#F7F3E8;}
.treeend-next-app-panel-grid{
    display:grid!important;
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
    grid-auto-rows:1fr!important;
    gap:6px!important;
}
.treeend-next-app-tile,
.treeend-next-app-tile.is-disabled,
a.treeend-next-app-tile,
a.treeend-next-app-tile.is-active{
    position:relative!important;
    aspect-ratio:1/1!important;
    width:100%!important;
    min-width:0!important;
    min-height:0!important;
    padding:0!important;
    margin:0!important;
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    overflow:hidden!important;
    background:var(--treeend-app-green)!important;
    background-image:none!important;
    border:0!important;
    outline:0!important;
    box-shadow:none!important;
    border-radius:5px!important;
    color:var(--treeend-app-ivory)!important;
    text-decoration:none!important;
    opacity:1!important;
    transform:none!important;
    filter:none!important;
    transition:background .16s ease,filter .16s ease,transform .16s ease!important;
}
.treeend-next-app-tile.is-disabled{opacity:1!important;cursor:default!important;}
.treeend-next-app-icon{
    width:82%!important;
    height:82%!important;
    max-width:none!important;
    max-height:none!important;
    margin:0!important;
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    line-height:0!important;
    transition:filter .18s ease,transform .18s ease!important;
}
.treeend-next-app-icon-img{
    display:block!important;
    width:100%!important;
    height:100%!important;
    object-fit:contain!important;
    object-position:center!important;
    margin:0!important;
    padding:0!important;
    background:transparent!important;
    background-image:none!important;
    border:0!important;
    outline:0!important;
    box-shadow:none!important;
    border-radius:0!important;
}
.treeend-next-app-label{
    position:absolute!important;
    left:7%!important;
    right:7%!important;
    bottom:8%!important;
    width:auto!important;
    max-width:none!important;
    margin:0!important;
    padding:0!important;
    color:var(--treeend-app-ivory)!important;
    font-size:10px!important;
    line-height:1!important;
    font-weight:900!important;
    letter-spacing:.09em!important;
    text-align:center!important;
    white-space:nowrap!important;
    opacity:0!important;
    transform:translateY(3px)!important;
    transition:opacity .16s ease,transform .16s ease!important;
    pointer-events:none!important;
    text-shadow:0 1px 4px rgba(0,0,0,.35)!important;
}
a.treeend-next-app-tile:hover,
a.treeend-next-app-tile:focus-visible{
    background:#385329!important;
    filter:brightness(1.08)!important;
    transform:scale(1.025)!important;
    box-shadow:none!important;
}
a.treeend-next-app-tile:hover .treeend-next-app-icon,
a.treeend-next-app-tile:focus-visible .treeend-next-app-icon{
    filter:brightness(1.45) drop-shadow(0 0 4px rgba(247,243,232,.32))!important;
    transform:scale(1.06)!important;
}
a.treeend-next-app-tile:hover .treeend-next-app-label,
a.treeend-next-app-tile:focus-visible .treeend-next-app-label{
    opacity:1!important;
    transform:translateY(0)!important;
}
/* Il layer Music è di sistema: fisso come Essere, ma non predefinito. */
.treeend-next-layer-tab[data-layer-system="1"] .treeend-next-layer-drag{display:none!important;}


/* =========================================================
   2.22 — LAYER SCOPRI / MOTORI SELETTIVI
   I Layer personali restano sopra. I sei motori di ricerca
   selettivi sono fissi in fondo, separati visivamente.
========================================================= */
.treeend-next-layer-discover-separator{
    position:relative;
    display:flex;
    align-items:center;
    gap:8px;
    margin:11px 7px 6px;
    color:#8A7754;
    font-size:9px;
    font-weight:900;
    letter-spacing:.18em;
    line-height:1;
    text-transform:uppercase;
    pointer-events:none;
}
.treeend-next-layer-discover-separator::before,
.treeend-next-layer-discover-separator::after{
    content:"";
    height:1px;
    background:#D8D1C3;
    flex:1 1 auto;
}
.treeend-next-layer-discover-separator span{flex:0 0 auto;}
.treeend-next-layer-tab.is-discovery{
    color:#8A7754;
    font-weight:850;
}
.treeend-next-layer-tab.is-discovery:hover{
    color:#5F4C2E;
    background:#FAF7F1;
}
.treeend-next-layer-tab.is-discovery.is-active{
    color:#6B552E;
    border-left-color:#B89A5B;
    background:#FBF8F0;
}
.treeend-next-layer-tab.is-discovery .treeend-next-layer-label::before{
    content:"•";
    display:inline-block;
    margin-right:7px;
    color:#B89A5B;
}
.treeend-next-app-tile-free{
    background:var(--treeend-app-green)!important;
    opacity:1!important;
}
.treeend-next-discovery-layer-active .treeend-next-hour-add{
    display:none!important;
}

.treeend-next-discovery-intro{
    margin:0 0 16px;
    padding:14px 16px;
    border:1px solid #E2DACB;
    border-radius:14px;
    background:#FCFAF5;
    color:#5F5544;
}
.treeend-next-discovery-intro[hidden]{display:none!important;}
.treeend-next-discovery-intro span{
    display:block;
    margin-bottom:4px;
    color:#B89A5B;
    font-size:9px;
    font-weight:900;
    letter-spacing:.18em;
}
.treeend-next-discovery-intro strong{
    display:block;
    color:#4C5A3D;
    font-size:19px;
    line-height:1.15;
}
.treeend-next-discovery-intro p{
    margin:5px 0 0;
    color:#756C5D;
    font-size:13px;
    line-height:1.4;
}

/* =========================================================
   2.23 — IA PERSONALE + hardening icone desktop
========================================================= */
.treeend-next-app-icon-img[src*="app-agenda-v223"],
.treeend-next-app-icon-img[src*="app-contatti-v223"]{
    background:transparent!important;
    border:0!important;
    outline:0!important;
    box-shadow:none!important;
    border-radius:0!important;
    mix-blend-mode:normal!important;
}
.treeend-next-layer-ai-separator{
    position:relative;
    display:flex;
    align-items:center;
    gap:8px;
    margin:13px 7px 6px;
    color:#75627F;
    font-size:9px;
    font-weight:900;
    letter-spacing:.18em;
    line-height:1;
    text-transform:uppercase;
    pointer-events:none;
}
.treeend-next-layer-ai-separator::before,
.treeend-next-layer-ai-separator::after{
    content:"";
    height:1px;
    background:#D8CEDD;
    flex:1 1 auto;
}
.treeend-next-layer-ai-separator span{flex:0 0 auto;}
.treeend-next-layer-tab.is-ai{
    color:#6A5875;
    font-weight:850;
}
.treeend-next-layer-tab.is-ai:hover{
    color:#4F3F59;
    background:#FAF7FB;
}
.treeend-next-layer-tab.is-ai.is-active{
    color:#594665;
    border-left-color:#8C7198;
    background:#FBF8FC;
}
.treeend-next-layer-tab.is-ai .treeend-next-layer-label::before{
    content:"✦";
    display:inline-block;
    margin-right:7px;
    color:#8C7198;
    font-size:.88em;
}

/* =========================================================
   2.24 · IA PERSONALE
========================================================= */
.treeend-next-ai-chat{margin:0 0 18px;padding:18px;border:1px solid rgba(46,65,32,.18);border-radius:18px;background:#f8f7f1;box-shadow:0 10px 28px rgba(46,65,32,.08)}
.treeend-next-ai-chat[hidden]{display:none!important}
.treeend-next-ai-chat-head{display:flex;justify-content:space-between;gap:18px;align-items:flex-start;margin-bottom:10px}
.treeend-next-ai-chat-head>div:first-child{display:grid;grid-template-columns:auto 1fr;column-gap:10px;align-items:center}
.treeend-next-ai-chat-head strong{font-size:1.18rem;color:#2E4120}
.treeend-next-ai-chat-head small{grid-column:2;display:block;color:#66705e;margin-top:2px}
.treeend-next-ai-badge{display:inline-grid;place-items:center;min-width:34px;height:26px;padding:0 8px;border-radius:999px;background:#665675;color:#fff;font-weight:800;font-size:.75rem;letter-spacing:.08em}
.treeend-next-ai-head-actions{display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end}
.treeend-next-ai-head-actions button,.treeend-next-ai-form button,.treeend-next-ai-accept{border:0;border-radius:999px;padding:9px 14px;background:#2E4120;color:#fff;font-weight:700;cursor:pointer}
.treeend-next-ai-head-actions button[data-ai-delete]{background:#fff;color:#8c2f39;border:1px solid rgba(140,47,57,.25)}
.treeend-next-ai-disclosure{margin:8px 0 12px;padding:10px 12px;border-left:4px solid #665675;background:#fff;color:#4f4a54;font-size:.92rem}
.treeend-next-ai-notice{padding:16px;border-radius:14px;background:#fff;border:1px solid rgba(102,86,117,.28);margin-bottom:14px}
.treeend-next-ai-notice p{margin:.55em 0;line-height:1.5}
.treeend-next-ai-toolbar{display:flex;justify-content:space-between;align-items:end;gap:12px;margin-bottom:12px}
.treeend-next-ai-toolbar label{display:grid;gap:4px;font-size:.8rem;font-weight:700;color:#5f6858}
.treeend-next-ai-toolbar select{min-width:240px;max-width:420px;border:1px solid #cfd5c8;border-radius:10px;padding:8px;background:#fff}
.treeend-next-ai-toolbar [data-ai-status]{font-size:.85rem;color:#66705e;text-align:right}
.treeend-next-ai-toolbar-meta{display:flex;flex-direction:column;align-items:flex-end;gap:3px}.treeend-next-ai-toolbar [data-ai-quota]{font-size:.78rem;font-weight:700;color:#665675}.treeend-next-ai-toolbar [data-ai-quota][data-exhausted="1"]{color:#8b6a15}
.treeend-next-ai-toolbar [data-kind="error"]{color:#a1262f}.treeend-next-ai-toolbar [data-kind="warning"]{color:#8b6a15}
.treeend-next-ai-messages{max-height:420px;overflow:auto;padding:10px 4px;display:flex;flex-direction:column;gap:10px}
.treeend-next-ai-message{max-width:84%;padding:12px 14px;border-radius:16px;background:#fff;border:1px solid rgba(46,65,32,.12);line-height:1.48;white-space:normal}
.treeend-next-ai-message.is-user{align-self:flex-end;background:#edf2e7}.treeend-next-ai-message.is-assistant{align-self:flex-start}
.treeend-next-ai-message header{font-size:.78rem;font-weight:800;margin-bottom:5px;color:#2E4120}.treeend-next-ai-message header span{font-weight:600;color:#7a7080}
.treeend-next-ai-empty{padding:22px;text-align:center;color:#737b6d;border:1px dashed #c8d0bf;border-radius:14px;background:rgba(255,255,255,.55)}
.treeend-next-ai-form{display:flex;gap:10px;align-items:flex-end;margin-top:12px}.treeend-next-ai-form textarea{flex:1;resize:vertical;min-height:72px;border:1px solid #cfd5c8;border-radius:14px;padding:12px;font:inherit;background:#fff}.treeend-next-ai-form button{min-width:90px;height:44px}
.treeend-next-ai-form button:disabled,.treeend-next-ai-head-actions button:disabled,.treeend-next-ai-accept:disabled{opacity:.5;cursor:not-allowed}
.treeend-next-legal-check{display:block!important;font-size:.84rem!important;line-height:1.4;margin:10px 0}.treeend-next-legal-check input{width:auto!important;margin-right:6px}.treeend-next-legal{max-width:920px;margin:40px auto;padding:28px;background:#fff;color:#24301d;line-height:1.65}.treeend-next-legal h1,.treeend-next-legal h2{color:#2E4120}.treeend-next-legal-version{font-size:.85rem;color:#6d7468}
@media(max-width:760px){.treeend-next-ai-chat-head,.treeend-next-ai-toolbar,.treeend-next-ai-form{flex-direction:column;align-items:stretch}.treeend-next-ai-head-actions{justify-content:flex-start}.treeend-next-ai-toolbar select{min-width:0;width:100%}.treeend-next-ai-message{max-width:94%}}
.treeend-next-external-blocked{display:grid;gap:6px;padding:14px;border:1px dashed #aeb8a5;border-radius:12px;background:#f4f5f0;color:#4c5745}.treeend-next-external-blocked button{justify-self:start;border:1px solid #2E4120;border-radius:999px;background:#fff;color:#2E4120;padding:7px 11px;font-weight:700;cursor:pointer}

/* 2.25 — IA personale: Memoria TreeEnd + voce browser beta */
.treeend-next-ai-context-toggle{display:flex!important;grid-template-columns:auto 1fr!important;align-items:center!important;gap:7px!important;padding:8px 10px;border:1px solid rgba(102,86,117,.18);border-radius:12px;background:#fff;color:#51495a!important;white-space:nowrap}
.treeend-next-ai-context-toggle input{margin:0;accent-color:#665675}
.treeend-next-ai-context-note{margin:-3px 0 10px;padding:8px 11px;border-radius:10px;background:rgba(102,86,117,.06);color:#6a6370;font-size:.79rem;line-height:1.4}
.treeend-next-ai-form-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap;justify-content:flex-end}
.treeend-next-ai-form-actions .treeend-next-ai-voice-button{min-width:92px;background:#665675}
.treeend-next-ai-form-actions .treeend-next-ai-voice-button.is-listening{background:#8c2f39}
.treeend-next-ai-speak-toggle{display:flex;align-items:center;gap:6px;padding:8px 10px;border:1px solid #cfd5c8;border-radius:999px;background:#fff;color:#5f6858;font-size:.8rem;font-weight:700;white-space:nowrap}
.treeend-next-ai-speak-toggle input{margin:0;accent-color:#665675}
@media(max-width:760px){.treeend-next-ai-context-toggle{white-space:normal}.treeend-next-ai-form-actions{justify-content:flex-start}.treeend-next-ai-form-actions>button{flex:0 0 auto}.treeend-next-ai-speak-toggle{white-space:normal}}


/* =========================================================
   2.26 — CHAT PRIVATA CONTATTI
========================================================= */
.treeend-next-private-chat{
    margin:14px 0;
    border:1px solid rgba(46,65,32,.18);
    border-radius:16px;
    overflow:hidden;
    background:#fff;
}
.treeend-next-private-chat>header{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    padding:12px 14px;
    background:#f3f8ef;
    border-bottom:1px solid rgba(46,65,32,.12);
    color:#2e4120;
}
.treeend-next-private-chat>header strong,
.treeend-next-private-chat>header small{display:block}
.treeend-next-private-chat>header small{margin-top:2px;color:#697564;font-size:11px}
.treeend-next-private-chat>header>span{font-size:22px}
.treeend-next-private-chat-messages{
    height:260px;
    overflow:auto;
    padding:12px;
    background:#fbfdf9;
    scroll-behavior:smooth;
}
.treeend-next-private-chat-empty{
    margin:22px 8px;
    text-align:center;
    color:#7b8576;
    font-size:12px;
}
.treeend-next-private-message{
    display:flex;
    margin:7px 0;
}
.treeend-next-private-message.is-mine{justify-content:flex-end}
.treeend-next-private-message.is-theirs{justify-content:flex-start}
.treeend-next-private-message-bubble{
    max-width:min(78%,520px);
    padding:9px 11px 7px;
    border-radius:15px;
    background:#edf3e9;
    color:#26391f;
    line-height:1.4;
    overflow-wrap:anywhere;
}
.treeend-next-private-message.is-mine .treeend-next-private-message-bubble{
    background:#2e4120;
    color:#fff;
    border-bottom-right-radius:5px;
}
.treeend-next-private-message.is-theirs .treeend-next-private-message-bubble{
    border-bottom-left-radius:5px;
}
.treeend-next-private-message-bubble small{
    display:block;
    margin-top:5px;
    font-size:9px;
    opacity:.68;
    text-align:right;
}
.treeend-next-private-chat-compose{
    display:grid;
    grid-template-columns:minmax(0,1fr) auto;
    gap:8px;
    padding:10px;
    border-top:1px solid rgba(46,65,32,.12);
    background:#fff;
}
.treeend-next-private-chat-compose textarea{
    width:100%;
    min-height:46px;
    max-height:140px;
    resize:vertical;
    border:1px solid #d9e2d5;
    border-radius:12px;
    padding:9px 10px;
    font:inherit;
    line-height:1.35;
}
.treeend-next-private-chat-compose button{
    align-self:end;
    border:0;
    border-radius:999px;
    padding:10px 16px;
    background:#2e4120;
    color:#fff;
    font-weight:750;
    cursor:pointer;
}
.treeend-next-private-chat-compose button:disabled{opacity:.55;cursor:default}
.treeend-next-private-chat-status{
    display:block;
    min-height:18px;
    padding:0 12px;
    color:#6c7767;
    font-size:11px;
}
.treeend-next-private-chat-status[data-kind="error"]{color:#a12d2d}
.treeend-next-private-chat-privacy{
    margin:2px 12px 10px;
    color:#828a7e;
    font-size:10px;
}
@media (max-width:640px){
    .treeend-next-private-chat-messages{height:220px}
    .treeend-next-private-message-bubble{max-width:88%}
    .treeend-next-private-chat-compose{grid-template-columns:1fr}
    .treeend-next-private-chat-compose button{width:100%}
}


/* 2.28 — Chat pubblica eventi Agende comuni */
.treeend-public-event-chat{margin-top:18px;padding:16px;border:1px solid rgba(46,65,32,.18);border-radius:18px;background:rgba(255,255,255,.74)}
.treeend-public-event-chat h3{margin:0 0 4px}.treeend-public-event-chat .treeend-public-chat-subtitle{margin:0 0 12px;opacity:.72;font-size:.9rem}
.treeend-public-chat-list{display:flex;flex-direction:column;gap:10px;max-height:360px;overflow:auto;padding:4px 2px 10px}
.treeend-public-chat-message{padding:10px 12px;border-radius:14px;background:rgba(46,65,32,.07)}
.treeend-public-chat-message.is-mine{outline:1px solid rgba(46,65,32,.18)}
.treeend-public-chat-meta{display:flex;gap:8px;align-items:center;flex-wrap:wrap;font-size:.78rem;opacity:.8;margin-bottom:5px}.treeend-public-chat-meta strong{opacity:1}
.treeend-public-chat-body{white-space:pre-wrap;word-break:break-word}.treeend-public-chat-tools{display:flex;gap:6px;margin-top:7px}.treeend-public-chat-tools button{font-size:.75rem}
.treeend-public-chat-compose{display:grid;grid-template-columns:minmax(130px,.42fr) 1fr auto;gap:8px;align-items:end;margin-top:10px}.treeend-public-chat-compose label{display:grid;gap:4px;font-size:.75rem}.treeend-public-chat-compose textarea{min-height:62px;resize:vertical}
@media(max-width:680px){.treeend-public-chat-compose{grid-template-columns:1fr}.treeend-public-chat-list{max-height:300px}}

/* 2.28.2 — chat pubblica nelle Agende comuni */
.treeend-next-public-chat-list{display:grid;gap:10px;max-height:420px;overflow:auto;margin:12px 0}
.treeend-next-public-chat-message{border:1px solid rgba(46,65,32,.14);border-radius:14px;padding:12px 14px;background:#fff}
.treeend-next-public-chat-message.is-mine{box-shadow:inset 3px 0 0 rgba(46,65,32,.22)}
.treeend-next-public-chat-composer{margin-top:12px}
.treeend-next-public-chat-note{display:block;margin-top:8px;opacity:.68;line-height:1.4}
.treeend-next-public-identity-intro{margin:0 0 14px;line-height:1.45}
.treeend-next-public-identity-options{display:grid;gap:10px}
.treeend-next-public-identity-option{display:grid;gap:4px;width:100%;text-align:left;border:1px solid rgba(46,65,32,.20);border-radius:14px;padding:13px 15px;background:#fff;color:inherit;cursor:pointer}
.treeend-next-public-identity-option:hover,.treeend-next-public-identity-option:focus-visible{border-color:#2E4120;box-shadow:0 0 0 3px rgba(46,65,32,.08);outline:0}
.treeend-next-public-identity-option strong{color:#2E4120;font-size:1rem}
.treeend-next-public-identity-option span{opacity:.72}
.treeend-next-public-identity-option small{opacity:.86}

/* 2.31 — IA: ricerca interna / online + anteprima importazioni */
.treeend-next-ai-search-mode{display:flex;gap:7px;flex-wrap:wrap;align-items:center}
.treeend-next-ai-search-mode label{display:flex!important;grid-template-columns:none!important;align-items:center;gap:6px;padding:8px 10px;border:1px solid rgba(102,86,117,.18);border-radius:999px;background:#fff;color:#51495a!important;white-space:nowrap;cursor:pointer}
.treeend-next-ai-search-mode input{margin:0;accent-color:#665675}
.treeend-next-ai-context-note.is-online{background:rgba(58,109,166,.07);color:#455b72;border:1px solid rgba(58,109,166,.12)}
.treeend-next-ai-import-preview{margin:10px 0 14px;padding:14px;border:1px solid rgba(236,0,140,.22);border-left:4px solid #ec008c;border-radius:14px;background:#fff}
.treeend-next-ai-import-preview[hidden],.treeend-next-ai-sync-jobs[hidden]{display:none!important}
.treeend-next-ai-import-head{display:flex;justify-content:space-between;gap:12px;align-items:flex-start;margin-bottom:10px}
.treeend-next-ai-import-head>div{display:flex;flex-direction:column;gap:2px}.treeend-next-ai-import-head strong{color:#2E4120}.treeend-next-ai-import-head span{font-size:.82rem;color:#687161}
.treeend-next-ai-import-head button,.treeend-next-ai-import-controls button,.treeend-next-ai-sync-row button{border:0;border-radius:999px;padding:8px 12px;background:#2E4120;color:#fff;font-weight:700;cursor:pointer}
.treeend-next-ai-import-list{display:flex;flex-direction:column;gap:6px;max-height:300px;overflow:auto;padding:4px 2px 8px}
.treeend-next-ai-import-row{display:grid!important;grid-template-columns:auto 1fr!important;gap:9px!important;align-items:flex-start!important;padding:9px 10px;border:1px solid #e2e6de;border-radius:10px;background:#fafbf8;font-size:.86rem!important;font-weight:500!important;color:#3f483a!important}
.treeend-next-ai-import-row input{margin-top:3px;accent-color:#ec008c}.treeend-next-ai-import-row span{display:block}.treeend-next-ai-import-row small{display:block;color:#70786b;margin-top:2px}.treeend-next-ai-import-row a{display:inline-block;margin-left:8px;color:#665675;font-weight:700}
.treeend-next-ai-import-controls{display:flex;gap:9px;align-items:end;flex-wrap:wrap;margin-top:10px;padding-top:10px;border-top:1px solid #eceee9}
.treeend-next-ai-import-controls label{display:grid!important;gap:4px!important;font-size:.78rem!important;font-weight:700!important;color:#5f6858!important}.treeend-next-ai-import-controls select,.treeend-next-ai-import-controls input[type="text"]{min-width:180px;border:1px solid #cfd5c8;border-radius:9px;padding:8px;background:#fff}
.treeend-next-ai-import-controls .treeend-next-ai-import-sync{display:flex!important;grid-template-columns:auto 1fr!important;align-items:center!important;gap:6px!important;padding:8px 10px;border:1px solid #d7ddd1;border-radius:999px;background:#fff}.treeend-next-ai-import-sync input{margin:0;accent-color:#665675}
.treeend-next-ai-sync-jobs{margin:7px 0 12px;font-size:.82rem}.treeend-next-ai-sync-jobs summary{cursor:pointer;font-weight:800;color:#665675}.treeend-next-ai-sync-jobs details>div{display:flex;flex-direction:column;gap:6px;margin-top:7px}
.treeend-next-ai-sync-row{display:flex;justify-content:space-between;gap:10px;align-items:center;padding:8px 10px;border:1px solid #e0e4dc;border-radius:10px;background:#fff}.treeend-next-ai-sync-row span{display:flex;flex-direction:column;gap:2px}.treeend-next-ai-sync-row small{color:#6e7768}.treeend-next-ai-sync-row button{padding:6px 10px;font-size:.78rem}
@media(max-width:760px){.treeend-next-ai-search-mode{width:100%}.treeend-next-ai-search-mode label{flex:1 1 calc(50% - 4px);white-space:normal}.treeend-next-ai-import-head,.treeend-next-ai-import-controls,.treeend-next-ai-sync-row{flex-direction:column;align-items:stretch}.treeend-next-ai-import-controls select,.treeend-next-ai-import-controls input[type="text"]{width:100%;min-width:0}}


/* =========================================================
   2.31.11 — TIME NAVIGATOR / VISTA ANNO
   Solo UI: nessuna modifica alle tabelle o alle query Agenda esistenti.
========================================================= */
.treeend-next-date-jump{display:flex;align-items:center;justify-content:flex-end;gap:6px;margin:0 7px 7px 0;flex-wrap:wrap}
.treeend-next-date-jump-fields{display:inline-flex;align-items:center;gap:1px;width:156px;max-width:100%;height:34px;border:1px solid #cfdac9;border-radius:7px;padding:0 7px;background:#fff;color:#30422a;font-weight:750;letter-spacing:.04em;box-sizing:border-box}
.treeend-next-date-jump-fields:focus-within{outline:2px solid rgba(255,0,153,.16);border-color:#ff0099}
.treeend-next-date-jump-fields.has-error{border-color:#c62828;box-shadow:0 0 0 2px rgba(198,40,40,.10)}
.treeend-next-date-jump-fields input{width:2.35em;min-width:0;flex:0 0 auto;height:30px;min-height:0;border:0!important;outline:none!important;box-shadow:none!important;border-radius:0;padding:0;background:transparent;color:inherit;text-align:center;font:inherit;letter-spacing:0;font-size:16px;box-sizing:border-box}
.treeend-next-date-jump-fields input#treeend-next-date-jump-year{flex:1 1 auto;width:4.5em;text-align:left;padding-left:2px}
.treeend-next-date-jump-fields input::placeholder{color:#889488;opacity:1}
.treeend-next-date-jump-fields span{flex:0 0 auto;user-select:none;pointer-events:none}
.treeend-next-era-switch{display:flex;border:1px solid #cfdac9;border-radius:7px;overflow:hidden;background:#f4f7f2}
.treeend-next-era-switch button,.treeend-next-date-jump-go{height:34px;border:0;padding:0 10px;cursor:pointer;font-weight:800}
.treeend-next-era-switch button{background:transparent;color:#687564}
.treeend-next-era-switch button.is-active{background:var(--treeend-green-dark);color:#fff}
.treeend-next-date-jump-go{border-radius:7px;background:var(--treeend-fuchsia);color:#fff}
.treeend-next-year-view{width:100%;padding:8px 0 24px}
.treeend-next-year-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.treeend-next-year-month{border:1px solid #dfe8da;background:#fff;border-radius:9px;overflow:hidden;min-width:0}
.treeend-next-year-month-head{width:100%;display:flex;justify-content:space-between;align-items:center;gap:8px;border:0;border-bottom:1px solid #e8eee4;background:#f5f8f3;padding:9px 11px;color:#30422a;cursor:pointer;text-align:left}
.treeend-next-year-month-head strong{font-size:15px;text-transform:uppercase;letter-spacing:.03em}
.treeend-next-year-month-head span{font-size:11px;color:#71806c;white-space:nowrap}
.treeend-next-year-month-events{display:flex;flex-direction:column;gap:4px;padding:7px;min-height:58px}
.treeend-next-year-event{width:100%;display:grid;grid-template-columns:56px minmax(0,1fr);gap:7px;align-items:start;border:0;border-left:3px solid var(--event-color,#A9D96D);background:#f7f9f6;border-radius:4px;padding:5px 7px;text-align:left;color:#30422a;cursor:pointer;font-size:11px;line-height:1.3}
.treeend-next-year-event strong{font-size:10px;color:#697665}
.treeend-next-year-event span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.treeend-next-year-empty{padding:11px 6px;color:#9aa398;font-size:11px}
.treeend-next-year-more{border:0;background:transparent;color:#7a8577;text-align:left;padding:4px 5px;font-size:10px;cursor:pointer}
.treeend-next-year-more:hover{color:var(--treeend-fuchsia)}
.treeend-next-year-error{padding:18px;color:#8a3a3a}
.treeend-next-portal.is-year-view .treeend-next-rotor-unit[data-part="day"],
.treeend-next-portal.is-year-view .treeend-next-rotor-unit[data-part="month"]{opacity:.28;pointer-events:none}
@media(max-width:760px){.treeend-next-year-grid{grid-template-columns:1fr}.treeend-next-date-jump{justify-content:flex-start;margin-right:0}.treeend-next-date-jump-fields{width:156px;flex:0 0 156px}}
