/* Noè Social — panel stylesheet (loaded after the vendor CSS in css/lib/).
   This file is the narrow baseline + every component; wide-viewport layout (>=1024px: fixed
   sidebar) lives in css/src/wide.css. Direct-<link> mode: no build step. */

/* ---------- Webfonts (vendored from @fontsource by vendor.sh into css/fonts/) ---------- */

@font-face { font-family: 'Inter'; font-style: normal; font-display: swap; font-weight: 300; src: url('../fonts/inter-latin-300-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-display: swap; font-weight: 400; src: url('../fonts/inter-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-display: swap; font-weight: 500; src: url('../fonts/inter-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-display: swap; font-weight: 600; src: url('../fonts/inter-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Montserrat'; font-style: normal; font-display: swap; font-weight: 500; src: url('../fonts/montserrat-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Montserrat'; font-style: normal; font-display: swap; font-weight: 600; src: url('../fonts/montserrat-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Montserrat'; font-style: normal; font-display: swap; font-weight: 700; src: url('../fonts/montserrat-latin-700-normal.woff2') format('woff2'); }

/* ---------- Design tokens: the ONLY place colors, fonts and radii are defined ---------- */

:root {
    /* Noè brand (noe.fi.it) */
    --noe-black: #1C1C1C;
    --noe-red: #E63329;
    --noe-red-hover: #C42C23;
    --noe-white: #FFFFFF;
    --noe-grey-light: #F4F4F2;
    --noe-grey: #888888;
    --noe-border: #E0E0E0;
    --noe-green: #4A6741;

    /* Derived for UI legibility: #888 on white is 3.5:1, too light for small body text. */
    --color-text: var(--noe-black);
    --color-text-muted: #5C5C5A;
    --color-text-faint: var(--noe-grey);
    --color-bg: var(--noe-grey-light);
    --color-surface: var(--noe-white);
    --color-surface-hover: #FAFAF8;
    --color-border: var(--noe-border);
    --color-border-strong: #CFCFCB;
    --color-accent: var(--noe-red);
    --color-accent-hover: var(--noe-red-hover);
    --color-accent-soft: #FCEBEA;
    --color-success: var(--noe-green);
    --color-success-soft: #EAF0E8;
    --color-sidebar: var(--noe-black);
    --color-sidebar-text: #B9B9B6;
    --color-sidebar-hover: #2A2A2A;
    --color-focus: rgba(230, 51, 41, 0.28);
    --color-overlay: rgba(28, 28, 28, 0.48);
    --color-warning-soft: #FDF6E3;
    --color-warning-border: #EEDBA6;
    --color-warning-text: #6B4E0A;
    --color-error-text: #8F1F18;
    --color-media-bg: #ECECE9;       /* behind thumbnails: shows the real shape of the file */
    --color-media-dark: var(--noe-black);
    --color-success-text: #2F4429;
    --color-success-border: #C9D6C5;
    --color-accent-border: #F3C3C0;  /* around a soft red: errors, changes requested */
    --color-warning-dot: #C98A1B;    /* amber marks (dots, icons), never text: too light */
    --color-scheduled: #2F5D8A;      /* Blu programmato: what goes out by itself, never an action */
    --color-scheduled-soft: #EAF0F6;
    --color-scheduled-border: #C6D5E5;
    --color-divider: #EEEEEB;        /* separators inside a white surface */
    --color-surface-sunken: #FBFBFA; /* header rows of lists and tables */
    --color-data: #5C5C5A;           /* marks of the charts (Statistiche): one ink, bars differ by length, not hue */
    --color-data-strong: var(--noe-black);
    --color-data-soft: #ECECE9;      /* chart tracks, empty slots */
    --color-sidebar-border: #2E2E2E; /* lines on the dark sidebar */
    --color-sidebar-raised: #333331; /* a lighter step of the sidebar: menus, avatars, focus */
    --color-sidebar-label: #7A7A77;  /* small capitals on the dark sidebar */

    /* Social platforms (Canali): only on the platform icons and avatars, never on the UI chrome */
    --brand-facebook: #0866FF;
    --brand-instagram: #E1306C;
    --brand-instagram-gradient: linear-gradient(45deg, #F58529 0%, #DD2A7B 45%, #8134AF 75%, #515BD4 100%);
    --brand-threads: #000000;
    --brand-linkedin: #0A66C2;
    --brand-youtube: #FF0000;

    --font-heading: 'Montserrat', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;

    --radius: 4px;
    --radius-pill: 999px;
    --shadow-pop: 0 12px 32px rgba(28, 28, 28, 0.16);
    --sidebar-width: 240px;

    /* Bootstrap 5.3 hooks, mapped onto the tokens above */
    --bs-body-font-family: var(--font-body);
    --bs-body-font-size: 14px;
    --bs-body-color: var(--color-text);
    --bs-body-bg: var(--color-bg);
    --bs-border-color: var(--color-border);
    --bs-border-radius: var(--radius);
    --bs-border-radius-sm: var(--radius);
    --bs-link-color: var(--color-text);
    --bs-link-color-rgb: 28, 28, 28;
    --bs-link-hover-color: var(--color-accent);
    --bs-link-hover-color-rgb: 230, 51, 41;
}

/* ---------- Base ---------- */

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.5;
    color: var(--color-text);
    background: var(--color-bg);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .page-title, .nav-item, .brand, legend.form-label, .form-label, th {
    font-family: var(--font-heading);
}

a { color: var(--color-text); text-decoration-color: var(--color-border-strong); text-underline-offset: 3px; }
a:hover { color: var(--color-accent); }

#app { min-height: 100vh; }

.spacer { flex: 1 1 auto; }
.text-faint { color: var(--color-text-faint); }
.d-none { display: none !important; }

:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }

/* ---------- Bootstrap theming ---------- */

.btn {
    --bs-btn-font-family: var(--font-heading);
    --bs-btn-font-weight: 600;
    --bs-btn-font-size: 13.5px;
    --bs-btn-padding-x: 16px;
    --bs-btn-padding-y: 8px;
    --bs-btn-border-radius: var(--radius);
    --bs-btn-focus-box-shadow: 0 0 0 3px var(--color-focus);
    letter-spacing: 0.01em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
}

.btn .mdi { font-size: 17px; line-height: 1; }

.btn-sm {
    --bs-btn-padding-x: 10px;
    --bs-btn-padding-y: 5px;
    --bs-btn-font-size: 12.5px;
}

.btn-primary {
    --bs-btn-bg: var(--color-accent);
    --bs-btn-border-color: var(--color-accent);
    --bs-btn-hover-bg: var(--color-accent-hover);
    --bs-btn-hover-border-color: var(--color-accent-hover);
    --bs-btn-active-bg: var(--color-accent-hover);
    --bs-btn-active-border-color: var(--color-accent-hover);
    --bs-btn-disabled-bg: var(--color-accent);
    --bs-btn-disabled-border-color: var(--color-accent);
    --bs-btn-focus-shadow-rgb: 230, 51, 41;
}

.btn-secondary {
    --bs-btn-color: var(--color-text);
    --bs-btn-bg: var(--color-surface);
    --bs-btn-border-color: var(--color-border-strong);
    --bs-btn-hover-color: var(--color-text);
    --bs-btn-hover-bg: var(--noe-grey-light);
    --bs-btn-hover-border-color: var(--noe-grey);
    --bs-btn-active-color: var(--color-text);
    --bs-btn-active-bg: var(--noe-border);
    --bs-btn-active-border-color: var(--noe-grey);
    --bs-btn-disabled-color: var(--color-text-faint);
    --bs-btn-disabled-bg: var(--color-surface);
    --bs-btn-disabled-border-color: var(--color-border);
}

.btn-danger {
    --bs-btn-bg: var(--color-accent);
    --bs-btn-border-color: var(--color-accent);
    --bs-btn-hover-bg: var(--color-accent-hover);
    --bs-btn-hover-border-color: var(--color-accent-hover);
    --bs-btn-active-bg: var(--color-accent-hover);
    --bs-btn-active-border-color: var(--color-accent-hover);
}

.btn-link-danger {
    --bs-btn-color: var(--color-accent);
    --bs-btn-bg: transparent;
    --bs-btn-border-color: transparent;
    --bs-btn-hover-color: var(--color-accent-hover);
    --bs-btn-hover-bg: var(--color-accent-soft);
    --bs-btn-hover-border-color: transparent;
    --bs-btn-active-color: var(--color-accent-hover);
    --bs-btn-active-bg: var(--color-accent-soft);
    --bs-btn-padding-x: 10px;
}

.btn-block { width: 100%; }

/* Inline button loader (setBusy in utils.js) */
.btn-loading { position: relative; }
.btn-loading.is-loading .btn-label { visibility: hidden; }
.btn-loading.is-loading::after,
form.loading .btn-loading::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
.btn-secondary.btn-loading.is-loading::after { border-color: var(--color-border); border-top-color: var(--color-text); }
form.loading .btn-loading { pointer-events: none; }
form.loading .btn-loading .btn-label { visibility: hidden; }

.form-control, .form-select {
    font-size: 14px;
    border-color: var(--color-border-strong);
    border-radius: var(--radius);
    padding: 7px 11px;
    color: var(--color-text);
    background-color: var(--color-surface);
}
.form-select { padding-right: 34px; }
.form-control::placeholder { color: var(--color-text-faint); }
.form-control:focus, .form-select:focus {
    background-color: var(--color-surface);
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px var(--color-focus);
}
.form-control.is-invalid, .form-select.is-invalid { border-color: var(--color-accent); background-image: none; padding-right: 11px; }
.form-control.is-invalid:focus { box-shadow: 0 0 0 3px var(--color-focus); }

.form-check-input { border-color: var(--color-border-strong); cursor: pointer; }
.form-check-input:checked { background-color: var(--color-success); border-color: var(--color-success); }
.form-check-input:focus { border-color: var(--color-success); box-shadow: 0 0 0 3px rgba(74, 103, 65, 0.25); }
.form-switch .form-check-input:focus:not(:checked) {
    --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23888888'/%3e%3c/svg%3e");
}
.form-check-input:disabled { cursor: not-allowed; }
.form-check-label { cursor: pointer; font-weight: 500; }

/* ---------- Icon buttons ---------- */

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: var(--radius);
    background: transparent;
    color: var(--color-text-muted);
    font-size: 18px;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
}
.btn-icon:hover { background: var(--noe-grey-light); color: var(--color-text); }
.btn-icon-danger:hover { background: var(--color-accent-soft); color: var(--color-accent); }
.btn-icon-dark { color: var(--color-sidebar-text); }
.btn-icon-dark:hover { background: var(--color-sidebar-hover); color: var(--noe-white); }

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0;
    margin-bottom: 6px;
    border: 0;
    background: none;
    color: var(--color-text-muted);
    font-family: var(--font-heading);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
}
.btn-back:hover { color: var(--color-accent); }

.btn-link-subtle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--color-text-muted);
    font-size: 13px;
    text-decoration: underline;
    text-decoration-color: var(--color-border-strong);
    text-underline-offset: 3px;
    cursor: pointer;
}
.btn-link-subtle:hover { color: var(--color-accent); text-decoration-color: currentColor; }

/* ---------- Brand wordmark ---------- */

.brand {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    color: inherit;
    text-decoration: none;
    font-size: 18px;
    line-height: 1;
}
.brand:hover { color: inherit; }
.brand-mark {
    width: 8px;
    height: 8px;
    background: var(--noe-red);
    align-self: center;
    margin-right: 2px;
}
.brand-name { font-family: var(--font-heading); font-weight: 700; letter-spacing: -0.01em; }
.brand-product { font-family: var(--font-heading); font-weight: 500; opacity: 0.72; }

/* ---------- App shell: sidebar + content (narrow baseline: off-canvas sidebar + topbar) ---------- */

.app-layout { min-height: 100vh; }

.sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1040;
    width: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    background: var(--color-sidebar);
    color: var(--noe-white);
    transform: translateX(-100%);
    transition: transform 0.22s ease;
}
.sidebar.open { transform: translateX(0); box-shadow: var(--shadow-pop); }

.sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 1030;
    background: var(--color-overlay);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}
.sidebar-overlay.show { opacity: 1; pointer-events: auto; }

.sidebar-header { padding: 26px 22px 22px; }
.sidebar-header .brand { color: var(--noe-white); }

.sidebar-nav { flex: 1 1 auto; overflow-y: auto; padding: 4px 12px; }

.nav-group + .nav-group { margin-top: 22px; }

.nav-group-label {
    padding: 0 10px 8px;
    font-family: var(--font-heading);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #7A7A77;
}

.nav-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 10px;
    border-radius: var(--radius);
    color: var(--color-sidebar-text);
    font-size: 13.5px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
}
.nav-item .mdi { font-size: 19px; line-height: 1; }
.nav-item:hover { background: var(--color-sidebar-hover); color: var(--noe-white); }
.nav-item.active { background: var(--color-sidebar-hover); color: var(--noe-white); font-weight: 600; }
.nav-item.active::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 8px;
    bottom: 8px;
    width: 3px;
    background: var(--noe-red);
}
.nav-item.active .mdi { color: var(--noe-red); }

.sidebar-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 14px 16px;
    border-top: 1px solid #2E2E2E;
}
.sidebar-user { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; line-height: 1.3; }
.sidebar-user-name {
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-user-role { font-size: 12px; color: var(--color-sidebar-text); }

.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #333331;
    color: var(--noe-white);
    font-family: var(--font-heading);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.avatar-sm { width: 32px; height: 32px; font-size: 11.5px; background: var(--noe-grey-light); color: var(--color-text); border: 1px solid var(--color-border); }

.topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    align-items: baseline;
    gap: 6px;
    padding: 10px 16px;
    background: var(--color-sidebar);
    color: var(--noe-white);
}
.topbar #menuToggle { color: var(--noe-white); align-self: center; margin-right: 6px; }
.topbar #menuToggle:hover { background: var(--color-sidebar-hover); }

#pageContent { padding: 24px 16px 64px; }

/* ---------- Page scaffolding ---------- */

.page { max-width: 1240px; }
.page-form { max-width: 1040px; }

.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}
.page-title { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -0.015em; line-height: 1.2; }
.page-subtitle { margin: 6px 0 0; color: var(--color-text-muted); max-width: 640px; }
.page-actions { display: flex; gap: 8px; }

.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}
.toolbar .form-select { width: auto; min-width: 150px; }
.toolbar-filters { display: contents; }
.toolbar-count { margin-left: auto; color: var(--color-text-muted); font-size: 13px; white-space: nowrap; }
.toolbar-legend { display: inline-flex; align-items: center; gap: 4px 6px; color: var(--color-text-faint); font-size: 12.5px; margin-left: 6px; }
.toolbar-legend .mdi { font-size: 15px; margin-left: 6px; }

.search-field { position: relative; flex: 1 1 260px; max-width: 360px; }
.search-field > .mdi {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-faint);
    font-size: 18px;
    pointer-events: none;
}
.search-field .form-control { padding-left: 34px; }

/* Segmented control (filters and radio choices) */
.segmented {
    display: inline-flex;
    flex-wrap: wrap;
    padding: 3px;
    gap: 2px;
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius);
}
.segmented-item {
    position: relative;
    margin: 0;
    padding: 5px 12px;
    border: 0;
    border-radius: 3px;
    background: transparent;
    color: var(--color-text-muted);
    font-family: var(--font-heading);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
}
.segmented-item:hover { color: var(--color-text); background: var(--noe-grey-light); }
.segmented-item.is-active,
.segmented-radio .segmented-item:has(input:checked) { background: var(--noe-black); color: var(--noe-white); }
.segmented-radio input { position: absolute; opacity: 0; pointer-events: none; }
.segmented-radio .segmented-item:has(input:focus-visible) { outline: 2px solid var(--color-accent); outline-offset: 1px; }

/* Banners, empty states, loaders */
.alert-banner {
    padding: 10px 14px;
    margin-bottom: 16px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    font-size: 13.5px;
}
.alert-banner.is-error { background: var(--color-accent-soft); border-color: var(--color-accent-border); color: var(--color-error-text); }
.alert-banner.is-warning {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    background: var(--color-warning-soft);
    border-color: var(--color-warning-border);
    color: var(--color-warning-text);
}
.alert-banner.is-warning .mdi { font-size: 17px; line-height: 1.2; }

.empty-state {
    padding: 56px 24px;
    text-align: center;
    background: var(--color-surface);
    border: 1px dashed var(--color-border-strong);
    border-radius: var(--radius);
    color: var(--color-text-muted);
}
.empty-state > div > .mdi, .empty-state > .mdi { display: block; font-size: 40px; color: var(--color-text-faint); line-height: 1; margin-bottom: 12px; }
.empty-state h2 { font-size: 16px; font-weight: 600; color: var(--color-text); margin: 0 0 6px; }
.empty-state p { margin: 0 auto 16px; max-width: 420px; }

.page-loading { display: flex; align-items: center; justify-content: center; padding: 48px 0; }
#loadingMore.page-loading { padding: 24px 0; }
.spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--color-border);
    border-top-color: var(--noe-red);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
.spinner-sm { width: 18px; height: 18px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Data table ---------- */

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
}
.data-table th {
    padding: 10px 16px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    background: var(--color-surface-sunken);
    border-bottom: 1px solid var(--color-border);
    text-align: left;
    white-space: nowrap;
}
.data-table td { padding: 11px 16px; border-bottom: 1px solid var(--color-divider); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr { cursor: pointer; transition: background-color 0.12s; }
.data-table tbody tr:hover td { background: var(--color-surface-hover); }
.data-table .col-active { width: 160px; }
.data-table .col-date { width: 120px; color: var(--color-text-muted); white-space: nowrap; }
.data-table .col-actions { width: 44px; text-align: right; }
.row-chevron { color: var(--color-text-faint); font-size: 20px; }
.data-table tbody tr:hover .row-chevron { color: var(--color-accent); }

.person { display: flex; align-items: center; gap: 12px; min-width: 0; }
.person-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.person-name { font-weight: 600; }
.row-link { color: inherit; text-decoration: none; }
.row-link:hover, .data-table tbody tr:hover .row-link { color: var(--color-accent); }
.person-email { color: var(--color-text-muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.badge-you {
    margin-left: 6px;
    padding: 1px 7px;
    border-radius: var(--radius-pill);
    background: var(--noe-grey-light);
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
    font-size: 11px;
    font-weight: 500;
    vertical-align: 1px;
}

.user-row.is-inactive .person-name,
.user-row.is-inactive .person-email,
.user-row.is-inactive .role-pill,
.user-row.is-inactive .avatar { opacity: 0.5; }

.form-switch { display: flex; align-items: center; gap: 10px; }
.form-switch .form-check-input { margin: 0; flex: 0 0 auto; }
.switch-state { font-size: 13px; color: var(--color-text-muted); }
.switch-state-off { display: none; }
.user-row.is-inactive .switch-state-on { display: none; }
.user-row.is-inactive .switch-state-off { display: inline; color: var(--color-accent); }

/* Role pills (by tier name, never by number) */
.role-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: var(--radius-pill);
    font-family: var(--font-heading);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.02em;
    border: 1px solid var(--color-border-strong);
    color: var(--color-text-muted);
    background: var(--color-surface);
    white-space: nowrap;
}
.role-pill.role-approver { background: var(--color-success-soft); border-color: var(--color-success-border); color: var(--noe-green); }
.role-pill.role-admin { background: var(--noe-black); border-color: var(--noe-black); color: var(--noe-white); }

/* ---------- Forms ---------- */

.form-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 24px;
}
.form-narrow { max-width: 680px; }

fieldset.form-row { border: 0; padding: 0; min-width: 0; }
.form-row { margin-bottom: 20px; }
.form-row:last-child { margin-bottom: 0; }
.form-label, legend.form-label {
    display: block;
    margin-bottom: 6px;
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--color-text);
    float: none;
    width: auto;
}
.form-hint { margin-top: 6px; font-size: 12.5px; color: var(--color-text-muted); }
.field-error { display: none; margin-top: 6px; font-size: 12.5px; font-weight: 500; color: var(--color-accent); }
.form-row-foot { display: flex; align-items: flex-start; gap: 12px; }
.form-row-foot .field-error { flex: 1 1 auto; }
.form-row-foot .target-text-source { flex: 1 1 0; min-width: 160px; }
.form-row-foot .target-counter { flex: 0 1 auto; text-align: right; white-space: normal; }
.char-count { margin-top: 6px; margin-left: auto; font-size: 12px; color: var(--color-text-faint); white-space: nowrap; font-variant-numeric: tabular-nums; }
.form-meta { margin: 0; font-size: 12.5px; color: var(--color-text-muted); }
.form-shortcut { font-size: 12px; color: var(--color-text-faint); margin-right: 4px; }

.form-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 24px;
}
.form-card > .form-actions { padding-top: 20px; border-top: 1px solid var(--color-border); }

/* The format of a rubrica (#formats/<id>): categories, then one card per platform; the empty ones quieter */
.format-form { display: grid; gap: 16px; max-width: 760px; }
.format-form > .form-banner { margin: 0; }
/* Five platform cards push the button far down: the save bar stays at the bottom of the window, as in Impostazioni */
.format-form > .form-actions {
    position: sticky;
    bottom: 0;
    z-index: 1;
    margin-top: 0;
    padding: 14px 0;
    border-top: 1px solid var(--color-border);
    background: var(--color-bg);
}
.format-card-title { display: flex; align-items: center; gap: 8px; margin: 0 0 14px; font-size: 15px; font-weight: 600; }
.format-card-title .mdi { font-size: 19px; color: var(--color-text-muted); }
.format-card > .form-hint:first-of-type { margin: -8px 0 14px; }
.format-card.is-empty { background: transparent; border-style: dashed; }
.format-grid, .format-kinds { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 16px; }
.format-grid > .form-row, .format-kinds > .form-row { margin-bottom: 20px; }
.format-kinds > .form-row { margin-bottom: 0; }

.form-split { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.form-split > .form-actions { margin-top: 0; }
.textarea-body { min-height: 260px; line-height: 1.55; resize: vertical; }

/* Radio choice cards (user role) */
.choice-list { display: grid; gap: 8px; }
.choice {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 12px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color 0.15s, background-color 0.15s;
}
.choice:hover { border-color: var(--color-border-strong); background: var(--color-surface-hover); }
.choice:has(input:checked) { border-color: var(--noe-black); box-shadow: inset 0 0 0 1px var(--noe-black); }
.choice input { margin-top: 3px; accent-color: var(--noe-black); }
.choice-body { display: flex; flex-direction: column; gap: 4px; }
.choice-text { color: var(--color-text-muted); font-size: 13px; }
fieldset:disabled .choice { cursor: not-allowed; opacity: 0.6; }

/* ---------- Tags ---------- */

.tag-create { margin-bottom: 22px; }
.tag-create-line { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.tag-create-line > .form-control { flex: 1 1 240px; max-width: 340px; }

.palette { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.swatch {
    position: relative;
    width: 24px;
    height: 24px;
    padding: 0;
    border-radius: 50%;
    border: 2px solid var(--color-surface);
    background: var(--swatch, transparent);
    box-shadow: 0 0 0 1px var(--color-border-strong);
    cursor: pointer;
    transition: transform 0.12s, box-shadow 0.12s;
}
.swatch:hover { transform: scale(1.12); }
.swatch.is-selected { box-shadow: 0 0 0 2px var(--noe-black); }
.swatch-none {
    background: linear-gradient(135deg, transparent 45%, var(--noe-grey) 45%, var(--noe-grey) 55%, transparent 55%), var(--color-surface);
}
.swatch-custom {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    background: var(--color-surface);
    color: var(--color-text-muted);
    font-size: 13px;
}
.swatch-custom.is-selected { background: var(--swatch); color: var(--noe-white); }
.swatch-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; }

.tag-grid { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; }

.tag-chip {
    --tag-color: var(--noe-grey);
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 7px 14px 7px 12px;
    border-radius: var(--radius-pill);
    border: 1px solid color-mix(in srgb, var(--tag-color) 32%, var(--noe-border));
    background: color-mix(in srgb, var(--tag-color) 9%, var(--noe-white));
    color: var(--color-text);
    font-size: 13.5px;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
}
.tag-chip:hover { border-color: var(--tag-color); box-shadow: 0 2px 8px rgba(28, 28, 28, 0.08); }
.tag-chip.is-new { animation: tag-flash 1.6s ease-out; }
@keyframes tag-flash {
    0% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--tag-color) 45%, transparent); }
    100% { box-shadow: 0 0 0 0 transparent; }
}
/* Entry of the tags page: the chip plus, for Approvatore+, the bin on its corner (shown on hover or keyboard focus) */
.tag-item { position: relative; display: inline-flex; }
.tag-chip-delete {
    position: absolute;
    top: -8px;
    right: -8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    border: 1px solid var(--color-border-strong);
    border-radius: 50%;
    background: var(--color-surface);
    color: var(--color-text-muted);
    font-size: 14px;
    box-shadow: 0 1px 4px rgba(28, 28, 28, 0.12);
    cursor: pointer;
    opacity: 0;
    transform: scale(0.85);
    transition: opacity 0.12s, transform 0.12s, background-color 0.15s, color 0.15s, border-color 0.15s;
}
.tag-item:hover .tag-chip-delete,
.tag-item:focus-within .tag-chip-delete { opacity: 1; transform: none; }
@media (hover: none) { .tag-chip-delete { opacity: 1; transform: none; } }
.tag-chip-delete:hover,
.tag-chip-delete:focus-visible { background: var(--color-accent-soft); border-color: var(--color-accent-border); color: var(--color-accent); }
/* A rubrica's format, beside its chip: dashed while it has none */
.tag-chip-format {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: -4px;
    padding: 6px 12px;
    border: 1px dashed var(--color-border-strong);
    border-radius: var(--radius-pill);
    color: var(--color-text-muted);
    font-size: 12.5px;
    text-decoration: none;
    transition: border-color 0.15s, color 0.15s, background-color 0.15s;
}
.tag-chip-format.has-format { border-style: solid; color: var(--color-text); background: var(--color-surface); }
.tag-chip-format:hover,
.tag-chip-format:focus-visible { border-color: var(--noe-black); color: var(--color-text); }
.tag-chip-format .mdi { font-size: 15px; }
.tag-dot { flex: 0 0 auto; width: 9px; height: 9px; border-radius: 50%; background: var(--tag-color); }
.tag-name { font-weight: 600; }
.tag-counts { display: inline-flex; gap: 8px; color: var(--color-text-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.tag-count { display: inline-flex; align-items: center; gap: 2px; }
.tag-count .mdi { font-size: 14px; }
.tag-count.is-zero { color: #B3B3B0; }

.tag-edit {
    flex: 1 1 100%;
    max-width: 560px;
    padding: 16px;
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    border-left: 4px solid var(--tag-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-pop);
}
.tag-edit .form-row { margin-bottom: 12px; }
.tag-edit-usage { margin: 12px 0 0; font-size: 12.5px; color: var(--color-text-muted); }
.tag-edit-actions { display: flex; align-items: center; gap: 8px; margin-top: 14px; }

.tag-mini {
    --tag-color: var(--noe-grey);
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 1px 9px 1px 7px;
    border-radius: var(--radius-pill);
    border: 1px solid color-mix(in srgb, var(--tag-color) 30%, var(--noe-border));
    background: color-mix(in srgb, var(--tag-color) 8%, var(--noe-white));
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}
.tag-mini .tag-dot { width: 7px; height: 7px; }
/* Category of an editorial entry in a flat list (F2b): tells "Prodotti" pillar from "Prodotti" rubrica. */
.tag-kind {
    padding-right: 5px;
    border-right: 1px solid color-mix(in srgb, var(--tag-color) 30%, var(--noe-border));
    color: var(--color-text-muted);
    font-family: var(--font-heading);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* Categories (F2b): one section per kind on the tags page, grouped pickers in the forms */
.tag-kind-select { flex: 0 0 auto; width: auto; min-width: 150px; }
.tag-sections { display: flex; flex-direction: column; gap: 28px; }
.tag-section-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 2px; }
.tag-section-title { margin: 0; font-size: 15px; font-weight: 700; letter-spacing: -0.005em; }
.tag-section-count { font-size: 12.5px; color: var(--color-text-muted); font-variant-numeric: tabular-nums; }
.tag-section-head .bt-new-in-kind { margin-left: auto; }
.tag-section-sub { margin: 0 0 12px; font-size: 13px; color: var(--color-text-muted); }
.tag-section-empty {
    margin: 0;
    padding: 12px 14px;
    background: var(--color-surface);
    border: 1px dashed var(--color-border-strong);
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--color-text-muted);
}
.tag-picker-groups { display: flex; flex-direction: column; gap: 14px; }
.tag-picker-label {
    display: block;
    margin-bottom: 6px;
    font-family: var(--font-heading);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-text-muted);
}

.tag-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-toggle {
    --tag-color: var(--noe-grey);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 11px 4px 9px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--color-border-strong);
    background: var(--color-surface);
    color: var(--color-text-muted);
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.12s;
}
.tag-toggle:hover { border-color: var(--tag-color); color: var(--color-text); }
.tag-toggle[aria-pressed="true"] {
    border-color: var(--tag-color);
    background: color-mix(in srgb, var(--tag-color) 14%, var(--noe-white));
    color: var(--color-text);
    font-weight: 600;
}
.tag-toggle[aria-pressed="true"]::after { content: '\F012C'; font-family: 'Material Design Icons'; font-size: 13px; margin-left: 2px; }

/* ---------- Snippets ---------- */

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }

.snippet-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px 16px 12px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.snippet-card:hover { border-color: var(--color-border-strong); box-shadow: 0 4px 14px rgba(28, 28, 28, 0.07); }
.snippet-card.is-draft { background: #FCFCFB; border-style: dashed; }

.snippet-card-head { display: flex; align-items: center; gap: 6px; }
.snippet-date { font-size: 12px; color: var(--color-text-faint); white-space: nowrap; }

.kind-badge, .draft-badge {
    padding: 2px 8px;
    border-radius: var(--radius);
    font-family: var(--font-heading);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
    background: var(--noe-grey-light);
}
.kind-badge.kind-disclaimer { background: var(--color-surface); border-color: var(--color-border-strong); color: var(--color-text); }
.kind-badge.kind-hashtag { background: var(--color-success-soft); border-color: var(--color-success-border); color: var(--noe-green); }
.kind-badge.kind-cta { background: var(--color-accent-soft); border-color: var(--color-accent-border); color: var(--color-accent-hover); }
.draft-badge { background: var(--color-surface); border-style: dashed; border-color: var(--color-border-strong); }

.snippet-title { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.35; }
.snippet-body {
    margin: 0;
    white-space: pre-line;
    color: var(--color-text-muted);
    font-size: 13.5px;
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere;
}
.snippet-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.snippet-card-foot { display: flex; align-items: center; gap: 2px; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--color-divider); }
.snippet-copy.is-done { --bs-btn-color: var(--noe-green); --bs-btn-border-color: var(--noe-green); --bs-btn-hover-color: var(--noe-green); }

/* ---------- Media library: tile grid (assets.js) ---------- */

.upload-limits { margin: -10px 0 16px; font-size: 12.5px; color: var(--color-text-muted); }
.upload-limits:empty { display: none; }

.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 14px; }

.asset-tile {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 0;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    color: var(--color-text);
    text-align: left;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.asset-tile:hover { border-color: var(--color-border-strong); box-shadow: 0 4px 14px rgba(28, 28, 28, 0.08); }
.asset-tile:active { transform: translateY(1px); }
.asset-tile.is-new { animation: asset-flash 2s ease-out; }
@keyframes asset-flash {
    0% { box-shadow: 0 0 0 4px var(--color-focus); border-color: var(--color-accent); }
    100% { box-shadow: 0 0 0 0 transparent; }
}

/* Square cell: overflow + an absolutely placed image keep a tall picture from stretching the
   flex item past its aspect-ratio (min-height: auto would let the content win). */
.asset-thumb {
    position: relative;
    display: block;
    flex: 0 0 auto;
    aspect-ratio: 1;
    overflow: hidden;
    background: var(--color-media-bg);
}
.asset-thumb img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: contain; }
.asset-thumb-none {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    color: var(--color-text-faint);
}
.asset-tile.is-archived .asset-thumb img { opacity: 0.5; filter: grayscale(0.7); }
.asset-tile.is-expired { border-color: var(--color-accent-border); }

.asset-duration {
    position: absolute;
    right: 8px;
    bottom: 8px;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 1px 7px 1px 4px;
    border-radius: 3px;
    background: rgba(28, 28, 28, 0.8);
    color: var(--noe-white);
    font-size: 11.5px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.asset-duration .mdi { font-size: 14px; line-height: 1; }

.asset-flags { position: absolute; left: 8px; top: 8px; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.asset-flag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 7px 2px 5px;
    border-radius: 3px;
    font-family: var(--font-heading);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.03em;
    color: var(--noe-white);
}
.asset-flag .mdi { font-size: 13px; line-height: 1; }
.asset-flag.is-expired { background: var(--color-accent); }
.asset-flag.is-archived { background: rgba(28, 28, 28, 0.82); }

.asset-caption { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 9px 11px 10px; }
.asset-title, .asset-specs { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.asset-title { font-size: 13px; font-weight: 600; line-height: 1.35; }
.asset-specs { font-size: 11.5px; color: var(--color-text-muted); font-variant-numeric: tabular-nums; }

/* Pick mode (post composer): ordered selection */
.asset-check {
    position: absolute;
    right: 8px;
    top: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid var(--noe-white);
    background: rgba(28, 28, 28, 0.28);
    color: var(--noe-white);
    font-family: var(--font-heading);
    font-size: 12px;
    font-weight: 700;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}
.asset-tile.is-selected { border-color: var(--color-accent); box-shadow: 0 0 0 1px var(--color-accent); }
.asset-tile.is-selected .asset-check { background: var(--color-accent); }

/* Files dragged over the window (uploader.enableDrop) */
.drop-overlay {
    position: fixed;
    inset: 0;
    z-index: 1900;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(28, 28, 28, 0.55);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
}
.drop-overlay.show { opacity: 1; pointer-events: auto; }
.drop-overlay-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    max-width: 480px;
    padding: 40px 56px;
    border: 2px dashed var(--color-accent);
    border-radius: var(--radius);
    background: var(--color-surface);
    text-align: center;
    box-shadow: var(--shadow-pop);
    pointer-events: none;
}
.drop-overlay-box > .mdi { font-size: 44px; line-height: 1; color: var(--color-accent); }
.drop-overlay-box strong { font-family: var(--font-heading); font-size: 17px; }
.drop-overlay-hint { font-size: 13px; color: var(--color-text-muted); }

/* ---------- Upload queue (uploader.js): dock outside #pageContent ---------- */

.upload-dock {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1500;
    width: min(380px, calc(100vw - 32px));
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-pop);
    overflow: hidden;
}
/* Toasts move to the top while the dock holds the corner. */
body:has(#uploadDock) #toast-container { top: 20px; bottom: auto; }

.upload-dock-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 8px 8px 14px;
    background: var(--noe-black);
    color: var(--noe-white);
}
.upload-dock-icon { font-size: 18px; line-height: 1; }
.upload-dock-icon.mdi-alert-circle-outline { color: #FF7A72; }
.upload-dock-icon.mdi-check-circle-outline { color: #9CC48F; }
.upload-dock-title { flex: 1 1 auto; min-width: 0; font-family: var(--font-heading); font-size: 13px; font-weight: 600; }

.upload-dock-overall { height: 3px; background: #3A3A38; }
.upload-dock-overall .upload-bar-fill { display: block; height: 100%; background: var(--noe-red); transition: width 0.3s; }

.upload-list { list-style: none; margin: 0; padding: 0; max-height: 330px; overflow-y: auto; }
.upload-item { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 12px; border-bottom: 1px solid var(--color-divider); }
.upload-item:last-child { border-bottom: 0; }

.upload-thumb {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 3px;
    background: var(--color-media-bg);
    color: var(--color-text-faint);
    font-size: 20px;
    overflow: hidden;
}
.upload-thumb img { width: 100%; height: 100%; object-fit: cover; }
.upload-item.is-error .upload-thumb { background: var(--color-accent-soft); color: var(--color-accent); }

.upload-body { display: flex; flex-direction: column; gap: 3px; flex: 1 1 auto; min-width: 0; }
.upload-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upload-status { font-size: 12px; color: var(--color-text-muted); }
.upload-status.is-done { display: inline-flex; align-items: baseline; gap: 3px; color: var(--noe-green); }
.upload-status .mdi { font-size: 13px; }
.upload-error { font-size: 12px; line-height: 1.4; color: var(--color-error-text); }

.upload-progress { display: flex; align-items: center; gap: 8px; }
.upload-bar { flex: 1 1 auto; height: 4px; border-radius: 2px; background: var(--color-media-bg); overflow: hidden; }
.upload-bar .upload-bar-fill { display: block; height: 100%; border-radius: 2px; background: var(--noe-red); transition: width 0.3s; }
.upload-percent { min-width: 32px; font-size: 11.5px; text-align: right; color: var(--color-text-muted); font-variant-numeric: tabular-nums; }

.upload-actions { display: flex; align-items: center; flex: 0 0 auto; }

/* ---------- Asset sheet (#library/edit-<id>) ---------- */

.page-asset { max-width: 1240px; }
.page-header-main { min-width: 0; }
.asset-page-title { overflow-wrap: anywhere; }

.asset-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.asset-media { order: 0; min-width: 0; }
.asset-form { order: 1; }
.asset-info { order: 2; display: grid; gap: 16px; min-width: 0; }

/* The thumbnail (already cached by the grid) sits behind the original while it loads. */
.asset-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    height: clamp(260px, 58vh, 620px);
    margin: 0;
    border-radius: var(--radius);
    background: var(--color-media-dark) center / contain no-repeat;
    overflow: hidden;
}
.asset-preview img, .asset-preview video { display: block; width: 100%; height: 100%; object-fit: contain; }
.asset-preview-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
/* PDF (F3b): the first page on the light media ground, like a sheet on a desk */
.asset-preview.is-document { padding: 18px; background-color: var(--color-media-bg); }
.asset-preview.is-document img { filter: drop-shadow(0 2px 8px rgba(28, 28, 28, 0.18)); }
.asset-preview-none {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    max-width: 320px;
    padding: 24px;
    text-align: center;
    font-size: 13px;
    color: var(--color-text-muted);
}
.asset-preview-none .mdi { font-size: 56px; line-height: 1; color: var(--color-text-faint); }

.asset-card { padding: 18px 20px; }
.card-title {
    margin: 0 0 12px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-text-muted);
}

.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 7px 18px; margin: 0; font-size: 13px; }
.facts dt { font-weight: 500; color: var(--color-text-muted); }
.facts dd { margin: 0; font-variant-numeric: tabular-nums; }
.facts-break { overflow-wrap: anywhere; }

.asset-posts { list-style: none; margin: 0; padding: 0; }
.asset-post { display: flex; flex-direction: column; gap: 2px; padding: 8px 0; border-bottom: 1px solid var(--color-divider); text-decoration: none; }
.asset-posts li:last-child .asset-post { border-bottom: 0; }
.asset-post-title { font-weight: 600; }
.asset-post-meta { font-size: 12px; color: var(--color-text-muted); }

.asset-state-line { display: flex; align-items: baseline; gap: 8px; margin: 0 0 12px; font-size: 13.5px; }
.state-dot { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: var(--color-success); transform: translateY(-1px); }
.asset-state.is-archived .state-dot { background: var(--noe-grey); }
.asset-state-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.asset-state .form-hint { margin-top: 10px; }

.asset-rights { border: 0; padding: 0; margin: 0 0 4px; min-width: 0; }
.asset-rights > legend { margin-bottom: 10px; }
.form-sublabel { display: block; margin-bottom: 6px; font-size: 12.5px; font-weight: 500; color: var(--color-text-muted); }
.date-line { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.date-line .form-control { width: auto; min-width: 170px; }
/* Narrow form column: the buttons stay on one line, the shortcut hint goes under them. */
.asset-form .form-shortcut { order: 1; flex-basis: 100%; margin: 0; text-align: right; }

/* ---------- Canali (accounts.js) ---------- */

.alert-banner.is-success { background: var(--color-success-soft); border-color: var(--color-success-border); color: var(--color-success-text); }
.alert-banner.is-info { background: var(--color-surface); border-color: var(--color-border-strong); color: var(--color-text); }
.alert-banner code,
.account-alert code {
    padding: 1px 5px;
    border-radius: 3px;
    background: rgba(28, 28, 28, 0.06);
    color: inherit;
    font-size: 12px;
    overflow-wrap: anywhere;
}

.oauth-notice { display: flex; align-items: flex-start; gap: 10px; padding: 12px 8px 12px 14px; }
.oauth-notice > .mdi { font-size: 20px; line-height: 1.15; }
.oauth-notice-body { flex: 1 1 auto; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.oauth-notice-title { font-family: var(--font-heading); font-weight: 600; }
.oauth-notice-detail { margin-top: 4px; font-size: 12.5px; opacity: 0.9; overflow-wrap: anywhere; }
.oauth-notice-close { flex: 0 0 auto; width: 28px; height: 28px; margin-top: -3px; color: inherit; }
.oauth-notice-close:hover { background: rgba(28, 28, 28, 0.06); color: inherit; }

.accounts-error { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.accounts-error #accountsErrorText { flex: 1 1 auto; }
.accounts-empty { margin-bottom: 28px; padding: 36px 24px; }

.platform-facebook { --platform-color: var(--brand-facebook); }
.platform-instagram { --platform-color: var(--brand-instagram); --platform-bg: var(--brand-instagram-gradient); }
.platform-threads { --platform-color: var(--brand-threads); }
.platform-linkedin { --platform-color: var(--brand-linkedin); }
.platform-youtube { --platform-color: var(--brand-youtube); }

.provider-section { margin-bottom: 32px; }
.provider-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 12px; }
.provider-icons { display: inline-flex; flex: 0 0 auto; }
.platform-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--platform-bg, var(--platform-color, var(--noe-black)));
    color: var(--noe-white);
    font-size: 21px;
    line-height: 1;
}
.platform-icon + .platform-icon { margin-left: -9px; box-shadow: 0 0 0 2px var(--color-bg); }
.provider-text { flex: 1 1 260px; min-width: 0; }
.provider-title { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.provider-sub { margin: 2px 0 0; font-size: 13px; color: var(--color-text-muted); }
.provider-count { font-size: 13px; color: var(--color-text-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.provider-missing { margin-bottom: 12px; }
.provider-guide { display: block; margin-top: 2px; }
.provider-note { margin: 0 0 12px; font-size: 13px; color: var(--color-text-muted); }
.provider-empty {
    margin: 0;
    padding: 16px 18px;
    background: var(--color-surface);
    border: 1px dashed var(--color-border-strong);
    border-radius: var(--radius);
    font-size: 13.5px;
    color: var(--color-text-muted);
}

.account-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(400px, 100%), 1fr));
    gap: 14px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.account-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
    padding: 16px 18px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}
.account-row.is-expired, .account-row.is-error { border-color: var(--color-accent-border); }
.account-row.is-new { animation: asset-flash 2.4s ease-out; }

.account-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.account-avatar { position: relative; flex: 0 0 auto; width: 46px; height: 46px; }
.account-avatar-fallback,
.account-avatar-img { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 50%; }
.account-avatar-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--platform-bg, var(--platform-color, var(--noe-black)));
    color: var(--noe-white);
    font-size: 24px;
}
.account-avatar-img { object-fit: cover; background: var(--color-media-bg); }
.account-avatar.is-broken .account-avatar-img { display: none; }
.account-platform {
    position: absolute;
    right: -4px;
    bottom: -4px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--platform-bg, var(--platform-color, var(--noe-black)));
    color: var(--noe-white);
    font-size: 12px;
    box-shadow: 0 0 0 2px var(--color-surface);
}
.account-text { flex: 1 1 auto; display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.account-name { font-weight: 600; overflow-wrap: anywhere; }
.account-name a { color: inherit; text-decoration: none; }
.account-name a:hover { color: var(--color-accent); }
.account-name .mdi-open-in-new { margin-left: 4px; font-size: 13px; color: var(--color-text-faint); }
.account-sub { font-size: 12.5px; color: var(--color-text-muted); overflow-wrap: anywhere; }
.badge-new {
    margin-left: 6px;
    padding: 1px 7px;
    border-radius: var(--radius-pill);
    background: var(--color-accent);
    color: var(--noe-white);
    font-family: var(--font-heading);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.03em;
    vertical-align: 1px;
}

.status-pill {
    flex: 0 0 auto;
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 10px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--color-border-strong);
    background: var(--color-surface);
    color: var(--color-text-muted);
    font-family: var(--font-heading);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
}
.status-pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--noe-grey); }
.status-pill.is-active { background: var(--color-success-soft); border-color: var(--color-success-border); color: var(--noe-green); }
.status-pill.is-active::before { background: var(--color-success); }
.status-pill.is-expired, .status-pill.is-error { background: var(--color-accent-soft); border-color: var(--color-accent-border); color: var(--color-error-text); }
.status-pill.is-expired::before, .status-pill.is-error::before { background: var(--color-accent); }

.account-explain { margin: 0; font-size: 13px; color: var(--color-text-muted); }
.account-alert { display: flex; align-items: flex-start; gap: 8px; margin: 0; padding: 8px 10px; border-radius: var(--radius); font-size: 12.5px; line-height: 1.45; overflow-wrap: anywhere; }
.account-alert > .mdi { flex: 0 0 auto; font-size: 16px; line-height: 1.15; }
.account-alert.is-error { background: var(--color-accent-soft); color: var(--color-error-text); }
.account-alert.is-warning { background: var(--color-warning-soft); color: var(--color-warning-text); }

.account-facts { gap: 5px 16px; font-size: 12.5px; }
.account-facts dd.is-expiring { color: var(--color-warning-text); }
.expiring-pill {
    display: inline-block;
    margin-right: 4px;
    padding: 0 7px;
    border-radius: var(--radius-pill);
    background: var(--color-warning-soft);
    border: 1px solid var(--color-warning-border);
    font-family: var(--font-heading);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.03em;
}
.account-expiry-hint { display: block; margin-top: 2px; font-weight: 500; }

.account-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--color-divider);
}
.account-actions .bt-remove-account { margin-left: auto; }

/* ---------- Impostazioni (settings.js, accounts.js, users.js) ---------- */

/* The section tabs reuse the status tabs of the posts list; here they are links to pages. */
.settings-tabs { margin-bottom: 18px; }
.settings-tabs a.status-tab { display: inline-block; text-decoration: none; }
.settings-lead { max-width: 640px; margin: 0 0 20px; color: var(--color-text-muted); }

/* Generali: one card, sections separated by a rule; each row = label on the left, value on the right, the
   explanation underneath on the whole width. */
.settings-card { max-width: 820px; padding-top: 8px; }
.settings-section { padding: 18px 0 4px; }
.settings-section + .settings-section { border-top: 1px solid var(--color-border); }
.settings-section-title { margin: 0 0 4px; font-size: 15px; font-weight: 700; }
.settings-section-lead { margin: 0 0 12px; font-size: 13px; color: var(--color-text-muted); }
.settings-field { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 0 20px; margin: 0; padding: 12px 0; }
.settings-field + .settings-field { border-top: 1px solid var(--color-divider); }
.settings-field > .settings-switch, .settings-field > .settings-hint, .settings-field > .field-error { grid-column: 1 / -1; }
.settings-label { font-weight: 600; font-size: 13.5px; }
.settings-switch { margin: 0; }
.settings-switch .form-check-label { font-weight: 600; font-size: 13.5px; }
.settings-value { display: inline-flex; align-items: center; gap: 8px; }
.settings-value .form-control { width: 96px; text-align: right; font-variant-numeric: tabular-nums; }
.settings-unit { min-width: 84px; font-size: 13px; color: var(--color-text-muted); }
.settings-hint { max-width: 62ch; margin-top: 4px; }
.settings-changed { display: flex; align-items: center; gap: 4px; margin: 0 0 6px; font-size: 12px; color: var(--color-text-muted); }
.settings-changed .mdi { font-size: 14px; color: var(--color-text-faint); }
/* The save bar stays at the bottom of the window while the form scrolls: the first field is far from the button. */
.settings-card > .form-actions {
    position: sticky;
    bottom: 0;
    z-index: 1;
    margin: 8px -24px -24px;
    padding: 14px 24px;
    border-top: 1px solid var(--color-border);
    border-radius: 0 0 var(--radius) var(--radius);
    background: var(--color-surface);
}

/* The version in use: a second card under the form, read-only rows. */
.settings-build { margin-top: 20px; padding-top: 0; }
.settings-build-value { font-size: 13.5px; font-variant-numeric: tabular-nums; }
code.settings-build-value { font-size: 13px; color: var(--color-text); }

@media (max-width: 600px) {
    .settings-field { grid-template-columns: minmax(0, 1fr); gap: 6px; }
    .settings-unit { min-width: 0; }
}

/* ---------- Post: list (posts.js) ---------- */

.status-tabs-wrap { margin-bottom: 16px; overflow-x: auto; scrollbar-width: thin; }
.status-tabs {
    display: inline-flex;
    gap: 2px;
    border-bottom: 1px solid var(--color-border-strong);
    min-width: 100%;
}
.status-tab {
    position: relative;
    padding: 9px 14px 10px;
    border: 0;
    background: none;
    color: var(--color-text-muted);
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: color 0.15s;
}
.status-tab:hover, .status-tab.is-active { color: var(--color-text); }
.status-tab.is-active::after {
    content: '';
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: -1px;
    height: 3px;
    background: var(--noe-red);
}

.date-range { display: inline-flex; align-items: center; gap: 6px; }
.date-range .form-control { width: auto; min-width: 140px; }
.date-range-label { font-size: 12.5px; color: var(--color-text-muted); white-space: nowrap; }

/* Filters with their title above (every filters bar): the toolbar lines them up on the controls, not on the titles */
.toolbar:has(.filter-field) { align-items: flex-end; }
.filter-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.filter-label { font-size: 12px; font-weight: 600; letter-spacing: 0.01em; color: var(--color-text-muted); white-space: nowrap; }

/* A filter choice drawn with the badges a post carries (tagmenu.js, templates/tagMenu) */
.tag-menu { position: relative; }
/* .tag-menu in front: wins over .toolbar .form-select */
.tag-menu .tag-menu-button {
    display: flex;
    align-items: center;
    min-width: 190px;
    max-width: 280px;
    min-height: 38px;
    text-align: left;
    cursor: pointer;
}
.tag-menu-button .tag-mini { min-width: 0; max-width: 100%; }
/* In a form (report sheet) the choice is as wide as its column, like the selects next to it */
.form-row .tag-menu .tag-menu-button { width: 100%; min-width: 0; max-width: none; }
.tag-menu-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.tag-menu-all { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tag-menu-pop {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 30;
    width: max(100%, 280px);
    padding: 6px;
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow-pop);
}
.tag-menu-pop[hidden] { display: none; }
.tag-menu-pop.is-right { left: auto; right: 0; }
.tag-menu-pop.is-fixed { position: fixed; z-index: 1100; }   /* in a sheet: over the sheet, which would cut it (tagMenu.placeFixed) */
.tag-menu-search { margin-bottom: 6px; }
.tag-menu-options { display: flex; flex-direction: column; gap: 1px; max-height: 340px; overflow-y: auto; }
.tag-menu-group { display: flex; flex-direction: column; gap: 1px; }
.tag-menu-group-label {
    padding: 10px 8px 4px;
    font-family: var(--font-heading);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-text-muted);
}
.tag-menu-option {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 6px 8px;
    border: 0;
    border-radius: var(--radius);
    background: transparent;
    color: var(--color-text);
    font: inherit;
    font-size: 13.5px;
    text-align: left;
    cursor: pointer;
}
.tag-menu-option:hover,
.tag-menu-option:focus-visible { background: var(--color-bg); outline: none; }
.tag-menu-option .tag-mini { min-width: 0; font-size: 12.5px; }
.tag-menu-check { margin-left: auto; color: var(--color-accent); font-size: 16px; line-height: 1; visibility: hidden; }
.tag-menu-option[aria-selected="true"] .tag-menu-check { visibility: visible; }
.tag-menu-option[aria-selected="true"] .tag-menu-all { font-weight: 600; }
.tag-menu-option[hidden],
.tag-menu-group[hidden],
.tag-menu-empty[hidden] { display: none; }
.tag-menu-empty { margin: 0; padding: 8px; font-size: 13px; color: var(--color-text-muted); }

.post-list { container: postlist / inline-size; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); }
.post-list-head { display: none; }

.post-row {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr);
    grid-template-areas: "thumb main" "thumb channels" "thumb state" "thumb people";
    gap: 6px 14px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-divider);
    cursor: pointer;
    transition: background-color 0.12s;
}
.post-row:last-child { border-bottom: 0; }
.post-row:hover { background: var(--color-surface-hover); }

/* The colour of a post (posts.tone, templates/statusLegend; Bianca, 2026-11-17): the row tinted, a band on the left */
.tone-draft { --tone-bg: var(--color-bg); --tone-line: var(--color-border-strong); }
.tone-review { --tone-bg: var(--color-warning-soft); --tone-line: var(--color-warning-dot); }
.tone-ok { --tone-bg: var(--color-scheduled-soft); --tone-line: var(--color-scheduled); }
.tone-out { --tone-bg: var(--color-success-soft); --tone-line: var(--color-success); }
.tone-ko { --tone-bg: var(--color-accent-soft); --tone-line: var(--color-accent); }
.tone-archived { --tone-bg: var(--color-surface); --tone-line: var(--color-border); }
.post-row[class*="tone-"] { background: var(--tone-bg); box-shadow: inset 5px 0 0 var(--tone-line); }
.post-row[class*="tone-"]:hover { background: var(--tone-bg); box-shadow: inset 5px 0 0 var(--tone-line), inset 0 0 0 1px var(--tone-line); }
.status-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 14px; font-size: 13px; color: var(--color-text-muted); }
.status-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.status-legend-item::before { content: ''; width: 14px; height: 14px; border-radius: 3px; background: var(--tone-bg); box-shadow: inset 4px 0 0 var(--tone-line), inset 0 0 0 1px var(--tone-line); }
.post-row:hover .post-title { color: var(--color-accent); }

.post-thumb {
    grid-area: thumb;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 3px;
    background: var(--color-media-bg);
    color: var(--color-text-faint);
    font-size: 24px;
    overflow: hidden;
}
.post-thumb img { width: 100%; height: 100%; object-fit: cover; }
.post-thumb-count {
    position: absolute;
    right: 3px;
    bottom: 3px;
    padding: 0 5px;
    border-radius: 3px;
    background: rgba(28, 28, 28, 0.8);
    color: var(--noe-white);
    font-size: 10.5px;
    font-weight: 600;
    line-height: 16px;
}

.post-main { grid-area: main; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.post-title { font-weight: 600; font-size: 14px; line-height: 1.35; overflow-wrap: anywhere; }
.post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; font-size: 12px; color: var(--color-text-muted); }
.post-type { display: inline-flex; align-items: center; gap: 3px; margin-right: 4px; }
.post-type .mdi { font-size: 14px; }

.post-channels { grid-area: channels; display: flex; flex-wrap: wrap; gap: 4px; margin: 0; padding: 0; list-style: none; align-content: flex-start; }
.channel-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 1px 8px 1px 2px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-pill);
    background: var(--color-surface);
    font-size: 12px;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.channel-chip.is-none { padding-left: 8px; color: var(--color-text-faint); border-style: dashed; }
.channel-chip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--platform-bg, var(--platform-color, var(--noe-black)));
    color: var(--noe-white);
    font-size: 12px;
}
.channel-chip.no-date .channel-chip-when { color: var(--color-text-faint); }
.channel-chip.is-published { border-color: var(--color-success-border); background: var(--color-success-soft); }
.channel-chip.is-failed { border-color: var(--color-accent-border); background: var(--color-accent-soft); }
.channel-chip.is-processing { border-color: var(--color-warning-border); background: var(--color-warning-soft); }
.channel-chip.is-skipped .channel-chip-when { text-decoration: line-through; color: var(--color-text-faint); }
.channel-chip-link { color: var(--color-text-muted); text-decoration: none; font-size: 13px; }
.channel-chip-link:hover { color: var(--color-accent); }

.post-state { grid-area: state; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.post-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 10px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--color-border-strong);
    background: var(--color-surface);
    color: var(--color-text-muted);
    font-family: var(--font-heading);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
}
.post-pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--noe-grey); }
.post-pill.is-draft { border-style: dashed; }
.post-pill.is-in_review { background: var(--color-warning-soft); border-color: var(--color-warning-border); color: var(--color-warning-text); }
.post-pill.is-in_review::before { background: var(--color-warning-dot); }
.post-pill.is-changes_requested { background: var(--color-accent-soft); border-color: var(--color-accent-border); color: var(--color-error-text); }
.post-pill.is-changes_requested::before { background: var(--color-accent); }
.post-pill.is-rejected { border-color: var(--color-accent-border); color: var(--color-error-text); }
.post-pill.is-rejected::before { background: var(--noe-black); }
.post-pill.is-approved, .post-pill.is-scheduled, .post-pill.is-publishing { background: var(--color-scheduled-soft); border-color: var(--color-scheduled-border); color: var(--color-scheduled); }
.post-pill.is-approved::before, .post-pill.is-scheduled::before, .post-pill.is-publishing::before { background: var(--color-scheduled); }
.post-pill.is-published { background: var(--color-success-soft); border-color: var(--color-success-border); color: var(--color-success-text); }
.post-pill.is-published::before { background: var(--color-success); }
.post-pill.is-partial, .post-pill.is-failed { background: var(--color-accent); border-color: var(--color-accent); color: var(--noe-white); }
.post-pill.is-partial::before, .post-pill.is-failed::before { background: var(--noe-white); }
.post-pill.is-archived { color: var(--color-text-faint); }
.post-reapprove { font-size: 11.5px; font-weight: 600; color: var(--color-warning-text); }
.post-pub-summary { font-size: 11.5px; font-weight: 600; color: var(--color-text-muted); white-space: nowrap; }
.post-pub-summary.is-failed { color: var(--color-error-text); }
.post-pub-summary.is-publishing { color: var(--color-scheduled); }
.channel-chip-mark { color: var(--color-accent); font-size: 13px; }

.post-people { grid-area: people; display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: 12.5px; color: var(--color-text-muted); }
.post-person { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.post-person .mdi { font-size: 14px; color: var(--color-text-faint); }
.post-modified { display: none; }
.post-comments { display: inline-flex; align-items: center; gap: 3px; color: var(--color-text-muted); }

/* The list switches layout on its OWN width, not the window's: the sidebar takes 240 px of a desktop window, so a
   1280 px window leaves the list about 940 px. Middle: title on the left, channels, state and people in a side column.
   Wide: one line per post with a header. The title column is flexible and takes its share first (a fixed-max column
   like minmax(200px, 300px) is grown before any fr, and would squeeze the title to a few letters). */

@container postlist (min-width: 720px) {
    .post-row {
        grid-template-columns: 56px minmax(0, 1fr) minmax(170px, 240px);
        grid-template-areas: "thumb main channels" "thumb main state" "thumb main people";
        align-items: start;
    }
}

@container postlist (min-width: 1000px) {
    .post-list-head {
        display: grid;
        grid-template-columns: 56px minmax(220px, 1fr) minmax(150px, 0.6fr) 140px 160px 100px;
        gap: 14px;
        padding: 9px 16px;
        border-bottom: 1px solid var(--color-border);
        background: var(--color-surface-sunken);
        font-family: var(--font-heading);
        font-size: 11px;
        font-weight: 600;
        letter-spacing: 0.06em;
        text-transform: uppercase;
        color: var(--color-text-muted);
    }
    .post-list-head .col-post { grid-column: 1 / span 2; }
    .post-row {
        grid-template-columns: 56px minmax(220px, 1fr) minmax(150px, 0.6fr) 140px 160px 100px;
        grid-template-areas: "thumb main channels state people modified";
        align-items: center;
    }
    .post-people { flex-direction: column; }
    .post-modified { grid-area: modified; display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; color: var(--color-text-muted); font-variant-numeric: tabular-nums; }
}

/* ---------- Post: composer (composer.js, approval.js) ---------- */

.page-composer { max-width: 1480px; }
.composer-header { margin-bottom: 14px; }
.composer-title { overflow-wrap: anywhere; }
.composer-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin: 8px 0 0; font-size: 13px; color: var(--color-text-muted); }

/* Action bar: sticks to the top while one scrolls the form */
.composer-bar { position: sticky; top: 0; z-index: 20; margin: 0 -4px 16px; padding: 0 4px; background: var(--color-bg); }
/* Under the narrow topbar (sticky too); wide.css puts it back at the top. */
.topbar ~ #pageContent .composer-bar { top: 52px; }
.composer-bar-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 16px;
    padding: 10px 12px 10px 16px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: 0 2px 10px rgba(28, 28, 28, 0.05);
}
.composer-bar-state { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; min-width: 0; flex: 1 1 260px; }
.composer-bar-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.dirty-mark, .saved-mark { display: inline-flex; align-items: center; gap: 2px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.dirty-mark[hidden], .saved-mark[hidden], .composer-blocked[hidden] { display: none; }
.dirty-mark { color: var(--color-warning-text); }
.dirty-mark .mdi { font-size: 20px; color: var(--color-warning-dot); margin: -4px 0; }
.saved-mark { color: var(--noe-green); }
.checks-summary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--color-text-muted);
    font-size: 12.5px;
    cursor: pointer;
}
#composerChecks::before { content: ''; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: var(--noe-grey); vertical-align: 1px; }
#composerChecks.is-error { color: var(--color-error-text); font-weight: 600; }
#composerChecks.is-error::before { background: var(--color-accent); }
#composerChecks.is-warning { color: var(--color-warning-text); }
#composerChecks.is-warning::before { background: var(--color-warning-dot); }
#composerChecks.is-ok { color: var(--noe-green); }
#composerChecks.is-ok::before { background: var(--color-success); }
.checks-summary:hover #composerChecks { text-decoration: underline; text-underline-offset: 3px; }
#composerChecking[hidden] { display: none; }
.composer-blocked, .composer-hints { flex: 1 1 100%; margin: 0; font-size: 12.5px; }
.composer-blocked { color: var(--color-error-text); }
.composer-hints { padding: 0; list-style: none; color: var(--color-text-muted); }
.composer-hints li::before { content: '\F02FC'; font-family: 'Material Design Icons'; margin-right: 6px; color: var(--color-text-faint); }
.publish-slot { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.publish-slot:empty, .publish-slot[hidden] { display: none; }
.publish-live { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--color-scheduled); }
.publish-live[hidden] { display: none; }
.bar-shortcuts { display: none; font-size: 12px; color: var(--color-text-faint); white-space: nowrap; }
.bar-shortcuts kbd {
    display: inline-block;
    min-width: 18px;
    margin: 0 1px;
    padding: 0 4px;
    border: 1px solid var(--color-border-strong);
    border-bottom-width: 2px;
    border-radius: 3px;
    background: var(--color-surface);
    color: var(--color-text-muted);
    font-family: var(--font-body);
    font-size: 11px;
    line-height: 16px;
    text-align: center;
}
@media (min-width: 1180px) {
    .bar-shortcuts { display: inline; }
    .composer-bar-actions + .publish-slot:not([hidden]) { padding-left: 16px; border-left: 1px solid var(--color-border); }
}

/* Publication state of a channel (publication.targetState → templates/postTargetState) */
.pub-state {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 8px 10px;
    margin: 0 0 14px;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface-sunken);
    font-size: 13px;
}
.pub-state-icon { flex: 0 0 auto; font-size: 18px; line-height: 1.1; color: var(--color-text-muted); }
.pub-state-body { flex: 1 1 220px; min-width: 0; }
.pub-state-body p { margin: 0; }
.pub-state-body p + p { margin-top: 4px; }
.pub-state-title strong { font-weight: 600; }
.pub-state-sub, .pub-state-platform { color: var(--color-text-muted); }
.pub-state-reason { color: var(--color-text); }
.pub-state-detail { color: var(--color-text-muted); font-size: 12.5px; overflow-wrap: anywhere; white-space: pre-line; }
.pub-state-warn { color: var(--color-error-text); font-weight: 600; }
.pub-state-notice { color: var(--color-warning-text); }
.pub-state-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.pub-state.is-published { border-color: var(--color-success-border); background: var(--color-success-soft); }
.pub-state.is-published .pub-state-icon { color: var(--noe-green); }
.pub-state.is-failed { border-color: var(--color-accent-border); background: var(--color-accent-soft); }
.pub-state.is-failed .pub-state-icon, .pub-state.is-failed .pub-state-title { color: var(--color-error-text); }
.pub-state.is-processing, .pub-state.is-pending { border-color: var(--color-scheduled-border); background: var(--color-scheduled-soft); }
.pub-state.is-processing .pub-state-icon, .pub-state.is-pending .pub-state-icon { color: var(--color-scheduled); }
.pub-state.is-live .pub-state-icon { animation: pub-pulse 1.6s ease-in-out infinite; }
.pub-state.is-compact { margin: 0 0 10px; padding: 7px 10px; font-size: 12.5px; }
.pub-state.is-compact .pub-state-icon { font-size: 16px; }
@keyframes pub-pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .pub-state.is-live .pub-state-icon { animation: none; } }

.tab-state { font-size: 14px; line-height: 1; color: var(--color-text-muted); }
.tab-state.is-published { color: var(--noe-green); }
.tab-state.is-failed { color: var(--color-accent); }
.tab-state.is-processing, .tab-state.is-pending { color: var(--color-scheduled); }

/* "Programma" sheet (publication.openSchedule → templates/postSchedule) */
.sheet-schedule { max-width: 640px; }
.sched-post { padding-bottom: 14px; border-bottom: 1px solid var(--color-border); }
.sched-list { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.sched-row { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--color-border); }
.sched-row-main { flex: 1 1 auto; min-width: 0; }
.sched-row-main p { margin: 0; }
.sched-row-name { margin-bottom: 6px !important; line-height: 1.3; padding-top: 5px; }
.sched-row .form-switch { margin-bottom: 6px; }
.sched-date-line[hidden] { display: none; }
.sched-date-line { margin-bottom: 6px; }
.sched-when { font-size: 13px; color: var(--noe-green); font-variant-numeric: tabular-nums; }
.sched-when.is-done { color: var(--color-text-muted); }
.sched-row.is-error .sched-when { color: var(--color-error-text); font-weight: 600; }
.sched-row.is-error .sched-date { border-color: var(--color-accent); }
.sched-account { margin-top: 4px !important; font-size: 12.5px; color: var(--color-warning-text); }
.sched-comment { margin-top: 14px; }
#scheduleSummary.is-error { color: var(--color-error-text); font-weight: 600; }
#btSchedClearPost[hidden] { display: none; }

/* Lists inside a confirm (publishNow) */
.dialog-list { margin: 6px 0 10px; padding-left: 20px; }
.dialog-list li + li { margin-top: 2px; }
.dialog-list-warn { color: var(--color-warning-text); font-size: 12.5px; }
.dialog-note { margin: 8px 0 0; font-size: 13px; }
.dialog-list-meta { color: var(--color-text-muted); font-size: 12.5px; }
.dialog-warn { margin: 10px 0 0; padding: 8px 10px; border-radius: var(--radius); background: var(--color-accent-soft); color: var(--color-error-text); }
.dialog-message > p:first-child { margin-top: 0; }
.dialog-message .dialog-warn strong { color: inherit; }
.pub-state.is-retrying { border-color: var(--color-warning-border); background: var(--color-warning-soft); }
.pub-state.is-retrying .pub-state-icon { color: var(--color-warning-dot); }

.btn-success-noe {
    --bs-btn-color: var(--noe-white);
    --bs-btn-bg: var(--noe-green);
    --bs-btn-border-color: var(--noe-green);
    --bs-btn-hover-color: var(--noe-white);
    --bs-btn-hover-bg: #3B5434;
    --bs-btn-hover-border-color: #3B5434;
    --bs-btn-active-color: var(--noe-white);
    --bs-btn-active-bg: #3B5434;
    --bs-btn-active-border-color: #3B5434;
    --bs-btn-disabled-color: var(--noe-white);
    --bs-btn-disabled-bg: var(--noe-green);
    --bs-btn-disabled-border-color: var(--noe-green);
    --bs-btn-focus-shadow-rgb: 74, 103, 65;
}

.composer-notice { display: flex; align-items: flex-start; gap: 8px; }
.composer-notice > .mdi { font-size: 18px; line-height: 1.2; }
.composer-notice-text { flex: 1 1 auto; }
.composer-notice-close { width: 26px; height: 26px; margin: -3px -6px -3px 0; color: inherit; }

/* Dal piano (posts.brief, 0030): above the master text, open while the post has no text */
.composer-brief { margin: 0 0 16px; padding: 10px 12px; border: 1px solid var(--color-scheduled-border); border-radius: var(--radius); background: var(--color-scheduled-soft); }
.composer-brief-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.composer-brief-head > .mdi { color: var(--color-scheduled); font-size: 18px; }
.composer-brief-line { flex: 1 1 auto; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--color-text-muted); }
.composer-brief-toggle { margin-left: auto; }
.composer-brief-list { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 10px 0 8px; }
.composer-brief-list dt { font-weight: 600; color: var(--color-text-muted); }
.composer-brief-list dd { margin: 0; white-space: pre-line; }
.composer-brief-list ul { margin: 0; padding-left: 18px; }
.composer-brief .form-hint { margin: 0; }

/* Call to action of the brand (getFormats.cta): under the categories */
.composer-cta { margin: 0 0 16px; }
.composer-cta-title { display: block; font-weight: 600; color: var(--color-text); margin-bottom: 2px; }
.composer-cta-row { margin: 2px 0; }
.composer-cta-where { color: var(--color-text-muted); }
.composer-cta-text { color: var(--color-text); }
.composer-cta-tip { font-style: italic; }
.composer-cta-copy { padding: 0 2px; vertical-align: baseline; }
.composer-validate-error[hidden] { display: none; }

.composer { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.composer-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.composer-main > .alert-banner { margin-bottom: 0; }
.composer-card { padding: 20px 22px; }
.composer-card > .card-title, .card-head { margin-bottom: 16px; }
.card-head { display: flex; align-items: baseline; gap: 10px; }
.card-head .card-title { margin: 0; }
.card-head-end { margin-left: auto; }
.card-head-end[hidden] { display: none; }
.card-count { font-size: 12.5px; color: var(--color-text-muted); }
.composer-card .form-row { margin-bottom: 18px; }
.composer-card .form-row:last-child { margin-bottom: 0; }

.segmented-icons .segmented-item .mdi { font-size: 15px; vertical-align: -2px; margin-right: 1px; }
.segmented-radio .segmented-item:has(input:disabled) { cursor: not-allowed; opacity: 0.6; }

.text-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; margin-bottom: 6px; }
.text-head .form-label { margin-bottom: 0; }
.text-tools { display: inline-flex; flex-wrap: wrap; gap: 4px 14px; }
.text-tools .btn-link-subtle { font-size: 12.5px; text-decoration: none; }
.text-tools .btn-link-subtle .mdi { font-size: 16px; }
.composer .textarea-body { min-height: 200px; }

.master-counters { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
.master-counters:empty { display: none; }
.master-counters-label { font-size: 12px; color: var(--color-text-muted); margin-right: 2px; }
.master-counter {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 1px 9px 1px 3px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.master-counter > .mdi {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--platform-bg, var(--platform-color, var(--noe-black)));
    color: var(--noe-white);
    font-size: 11px;
}
.master-counter.is-over { border-color: var(--color-accent); background: var(--color-accent-soft); color: var(--color-error-text); font-weight: 600; }
.master-counter-cut { color: var(--color-text-faint); }
.char-count.is-over { color: var(--color-accent); font-weight: 600; }

/* Issues from validatePost, next to their field */
.issue-list { display: flex; flex-direction: column; gap: 4px; margin: 8px 0 0; padding: 0; list-style: none; }
.issue { display: flex; align-items: flex-start; gap: 6px; font-size: 12.5px; line-height: 1.45; }
.issue > .mdi { flex: 0 0 auto; font-size: 15px; line-height: 1.2; }
.issue.is-error { color: var(--color-error-text); }
.issue.is-error > .mdi { color: var(--color-accent); }
.issue.is-warning { color: var(--color-warning-text); }
.issue.is-warning > .mdi { color: var(--color-warning-dot); }
#postMediaIssues .issue-list, #channelsIssues .issue-list { margin: 0 0 12px; }

/* Media of the post */
.media-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-bottom: 14px; }
.media-actions .form-hint { margin: 0; }
.media-empty {
    margin: 0;
    padding: 14px 16px;
    border: 1px dashed var(--color-border-strong);
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--color-text-muted);
}
.media-items { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.media-item {
    display: grid;
    grid-template-columns: auto auto 72px minmax(0, 1fr);
    grid-template-areas: "handle n thumb body" "handle n thumb actions";
    align-items: center;
    gap: 4px 10px;
    padding: 8px 10px 8px 4px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
}
.media-item.sortable-ghost { opacity: 0.4; }
.media-item.sortable-chosen { box-shadow: var(--shadow-pop); }
.media-item.is-missing, .media-item.is-expired, .media-item.is-archived { border-color: var(--color-accent-border); }
.media-handle { grid-area: handle; align-self: stretch; display: flex; align-items: center; font-size: 20px; color: var(--color-text-faint); cursor: grab; }
.media-handle:active { cursor: grabbing; }
.media-n {
    grid-area: n;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--noe-black);
    color: var(--noe-white);
    font-family: var(--font-heading);
    font-size: 11px;
    font-weight: 700;
}
.media-thumb {
    grid-area: thumb;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    border-radius: 3px;
    background: var(--color-media-bg);
    overflow: hidden;
}
/* aspect-ratio 1 = a media without sizes (a PDF): without it the box is 72 x 0 and the preview vanishes.
   The inline style of composer.cropStyle sets the real ratio when there is one. */
.media-thumb-img { display: block; width: min(72px, calc(72px * var(--r, 1))); aspect-ratio: 1; background-repeat: no-repeat; }
.media-thumb-img.is-doc { background-size: contain !important; background-color: var(--noe-white); }
.media-thumb-none { font-size: 28px; color: var(--color-text-faint); }
.media-play { position: absolute; font-size: 26px; color: var(--noe-white); text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5); }
.media-body { grid-area: body; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.media-title { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-specs { font-size: 12px; color: var(--color-text-muted); font-variant-numeric: tabular-nums; }
.media-flags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.media-flags:empty { display: none; }
.media-flag {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 0 7px 0 5px;
    border-radius: 3px;
    background: var(--noe-grey-light);
    color: var(--color-text-muted);
    font-size: 11.5px;
    line-height: 20px;
    text-decoration: none;
    white-space: nowrap;
}
.media-flag .mdi { font-size: 13px; }
.media-flag.is-crop { background: var(--color-scheduled-soft); color: var(--color-scheduled); }
.media-flag.is-render { background: var(--color-success-soft); color: var(--noe-green); }
.media-flag.is-render:hover { color: var(--noe-green); text-decoration: underline; }
.media-flag.is-bad { background: var(--color-accent-soft); color: var(--color-error-text); }
.media-flag.is-cover { background: var(--color-scheduled-soft); color: var(--color-scheduled); }

/* Data of the type: link card, poll, post to reshare (templates/postTypeData) */
.composer-card .td-intro { margin: -8px 0 16px; }
.td-options { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; counter-reset: td-option; }
.td-option-row { display: flex; align-items: center; gap: 8px; counter-increment: td-option; }
.td-option-row::before { content: counter(td-option); flex: 0 0 18px; font-size: 12px; font-weight: 600; color: var(--color-text-faint); text-align: right; font-variant-numeric: tabular-nums; }
.td-option-row .form-control { flex: 1 1 auto; min-width: 0; }
.td-option-row .char-count { flex: 0 0 auto; margin: 0; min-width: 104px; text-align: right; }
.td-option-row .bt-td-remove { flex: 0 0 auto; }
.td-add { margin-top: 10px; font-size: 12.5px; text-decoration: none; }
.td-code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12.5px; }
.td-found { display: flex; align-items: center; gap: 6px; margin: 8px 0 0; font-size: 12.5px; color: var(--color-success-text); }
.td-found[hidden] { display: none; }
.td-found a { color: inherit; overflow-wrap: anywhere; }
.media-issues .issue-list { margin-top: 4px; }
.media-actions-row { grid-area: actions; display: flex; flex-wrap: wrap; align-items: center; gap: 2px; }
.media-actions-row .bt-media-crop { margin-right: 6px; }
.btn-icon:disabled { opacity: 0.35; cursor: default; background: none; }

/* Channels */
.channel-toggles { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.channel-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 14px 5px 5px;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-pill);
    background: var(--color-surface);
    color: var(--color-text-muted);
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s, background-color 0.15s, color 0.15s;
}
.channel-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.channel-toggle-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--noe-grey-light);
    color: var(--color-text-faint);
    font-size: 15px;
    transition: background 0.15s, color 0.15s;
}
.channel-toggle:hover { border-color: var(--noe-grey); color: var(--color-text); }
.channel-toggle:has(input:checked) { border-color: var(--noe-black); color: var(--color-text); box-shadow: inset 0 0 0 1px var(--noe-black); }
.channel-toggle:has(input:checked) .channel-toggle-icon { background: var(--platform-bg, var(--platform-color)); color: var(--noe-white); }
.channel-toggle:has(input:focus-visible) { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.channel-toggle:has(input:disabled) { cursor: not-allowed; opacity: 0.7; }

.channel-tabs { display: flex; flex-wrap: wrap; gap: 2px; border-bottom: 1px solid var(--color-border-strong); }
.channel-tab {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 12px 9px;
    border: 0;
    background: none;
    color: var(--color-text-muted);
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.channel-tab:hover, .channel-tab.is-active { color: var(--color-text); }
.channel-tab.is-active::after { content: ''; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 3px; background: var(--platform-color, var(--noe-black)); }
.channel-tab-icon { font-size: 17px; color: var(--platform-color, var(--noe-black)); }
.tab-badge:empty { display: none; }
.tab-badge {
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    color: var(--noe-white);
}
.tab-badge.is-error { background: var(--color-accent); }
.tab-badge.is-warning { background: var(--color-warning-dot); }

.channel-panel { padding-top: 16px; }
.channel-panel[hidden] { display: none; }
.channel-panel-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 14px; }
.platform-icon-sm { width: 30px; height: 30px; font-size: 17px; }
.channel-panel-text { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; line-height: 1.3; }
.channel-panel-name { font-family: var(--font-heading); font-weight: 700; }
.channel-panel-when { font-size: 12.5px; color: var(--color-text-muted); }
.target-issues[data-field="media"] .issue-list { margin: 0 0 14px; }
.channel-panel-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 24px; }
.channel-panel .form-switch { margin-bottom: 8px; }
.target-date-line[hidden], .target-inherit[hidden] { display: none; }
.target-inherit { margin-top: 0; }
.target-account-line { display: flex; align-items: flex-start; gap: 10px; }
.target-account-line.is-inactive strong { color: var(--color-error-text); }
.target-account-text { display: flex; flex-direction: column; line-height: 1.35; min-width: 0; overflow-wrap: anywhere; }
.target-account-text .form-hint { margin-top: 2px; }

.classify-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 20px 16px; margin-bottom: 20px; }
.classify-grid > .form-row { margin-bottom: 0; }
.tag-fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.tag-fieldset:disabled .tag-toggle { cursor: not-allowed; opacity: 0.7; }
.composer .form-control:disabled, .composer .form-select:disabled { background-color: #F7F7F5; color: var(--color-text-muted); }

/* Right column: preview, history, comparison */
.composer-side { min-width: 0; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); }
.side-tabs { display: flex; gap: 2px; padding: 0 10px; border-bottom: 1px solid var(--color-border); }
.side-tab {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 11px 8px 12px;
    border: 0;
    background: none;
    color: var(--color-text-muted);
    font-family: var(--font-heading);
    font-size: 12.5px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
}
.side-tab .mdi { font-size: 16px; }
/* Four tabs (numbers, preview, history, comparison) do not fit the column with their icons: words only */
.side-tab:hover, .side-tab.is-active { color: var(--color-text); }
.side-tab.is-active::after { content: ''; position: absolute; left: 6px; right: 6px; bottom: -1px; height: 3px; background: var(--noe-red); }
.side-tab-count { min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--noe-grey-light); font-size: 11px; line-height: 18px; text-align: center; }
.side-pane { padding: 16px; }
.side-pane[hidden] { display: none; }

.preview-switches { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.preview-switch {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px 3px 7px;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-pill);
    background: var(--color-surface);
    color: var(--color-text-muted);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}
.preview-switch .mdi { font-size: 15px; color: var(--platform-color, var(--noe-black)); }
.preview-switch.is-active { border-color: var(--noe-black); color: var(--color-text); box-shadow: inset 0 0 0 1px var(--noe-black); }
.preview-label { display: flex; align-items: center; gap: 6px; margin: 0 0 10px; font-family: var(--font-heading); font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--color-text-muted); }
.preview-label .mdi { font-size: 16px; }
.preview-note { margin: 10px 0 0; font-size: 12px; color: var(--color-text-faint); }
.preview-empty { padding: 32px 12px; text-align: center; color: var(--color-text-muted); }
.preview-empty .mdi { font-size: 34px; color: var(--color-text-faint); }

/* Previews: a neutral take on each platform's layout, no marks */
.pv {
    --pv-ink: #1F1F1F;
    --pv-sub: #6B6B68;
    --pv-line: #E4E4E1;
    --pv-soft: #F1F1EE;
    max-width: 460px;
    margin: 0 auto;
    background: #FFFFFF;
    border: 1px solid var(--pv-line);
    border-radius: 8px;
    color: var(--pv-ink);
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    overflow: hidden;
}
.pv-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; }
.pv-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--noe-black);
    color: var(--noe-white);
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 700;
}
.pv-avatar-square { border-radius: 6px; }
.pv-avatar-ring { width: 34px; height: 34px; font-size: 11px; box-shadow: 0 0 0 2px #FFFFFF, 0 0 0 4px #D6D6D3; }
.pv-who { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; line-height: 1.3; }
.pv-who strong { font-size: 14px; }
.pv-sub { font-size: 12px; color: var(--pv-sub); }
.pv-sub .mdi { font-size: 12px; }
.pv-more-icon { font-size: 20px; color: var(--pv-sub); }
.pv-body { padding: 0 14px 12px; }
/* Line breaks of the post text kept on the spans that carry it, not on .pv-text: the template's own
   indentation between the tags would show up as spaces before the first line. */
.pv-text { overflow-wrap: anywhere; line-height: 1.45; }
.pv-short, .pv-full { white-space: pre-wrap; }
.pv-text.is-cut .pv-full { display: none; }
.pv-text.is-cut.is-open .pv-short { display: none; }
.pv-text.is-cut.is-open .pv-full { display: inline; }
.pv-more { padding: 0 0 0 2px; border: 0; background: none; color: var(--pv-sub); font: inherit; font-weight: 600; cursor: pointer; }
.pv-more:hover { text-decoration: underline; }
.pv-tag, .pv-link { color: var(--color-scheduled); font-weight: 500; }
.pv-inline-name { margin-right: 4px; }
.pv-media { background: #F1F1EE; }
.pv-slides { position: relative; }
.pv-frame { position: relative; display: flex; align-items: center; justify-content: center; width: min(100%, calc(560px * var(--r, 1))); margin: 0 auto; aspect-ratio: 1; background-color: #F1F1EE; background-repeat: no-repeat; }
.pv-frame.is-doc { --r: 0.75; aspect-ratio: 0.75; background-size: contain !important; background-color: #FFFFFF; border-top: 1px solid var(--pv-line); border-bottom: 1px solid var(--pv-line); }
.pv-frame.is-video { background-color: #1C1C1C; }
.pv-frame.is-missing { color: var(--color-text-faint); font-size: 36px; }
.pv-play { display: inline-flex; align-items: center; justify-content: center; width: 54px; height: 54px; border-radius: 50%; background: rgba(28, 28, 28, 0.6); color: #FFFFFF; font-size: 30px; }
button.pv-play { padding: 0; border: 0; cursor: pointer; transition: background-color 0.15s ease, transform 0.15s ease; }
button.pv-play:hover { background: rgba(28, 28, 28, 0.82); }
button.pv-play:focus-visible { outline: 2px solid #FFFFFF; outline-offset: 2px; }
/* The video playing in the preview covers its frame (overlays of reel and story too: the controls stay usable),
   whole and uncropped, black bands where its ratio differs: the approver sees all of it */
.pv-video { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; object-fit: contain; background: #000000; }
/* First frame of the video at full quality, over the thumbnail and under the play button */
.pv-cover { position: absolute; inset: 0; z-index: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.pv-player > .pv-cover { object-fit: contain; }
.pv-frame > .pv-play, .pv-player > .pv-play { position: relative; z-index: 1; }
.pv-duration { z-index: 1; }
.is-playing > .pv-cover { display: none; }
.is-playing > .pv-play, .is-playing > .pv-duration { visibility: hidden; }
.pv-duration { position: absolute; right: 8px; bottom: 8px; padding: 1px 6px; border-radius: 3px; background: rgba(0, 0, 0, 0.75); color: #FFFFFF; font-size: 11.5px; font-weight: 600; }
.pv-doc { position: absolute; left: 10px; top: 10px; display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 3px; background: rgba(28, 28, 28, 0.82); color: #FFFFFF; font-size: 11.5px; font-weight: 600; }
.pv-count { position: absolute; right: 10px; top: 10px; padding: 1px 8px; border-radius: 10px; background: rgba(28, 28, 28, 0.7); color: #FFFFFF; font-size: 11.5px; font-weight: 600; }
.pv-nav {
    position: absolute;
    top: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    color: #1F1F1F;
    font-size: 22px;
    line-height: 1;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
    transform: translateY(-50%);
    cursor: pointer;
}
.pv-nav, .pv-count { z-index: 3; }
/* The pages of a PDF, browsed like LinkedIn's document carousel (composer.paintDoc) */
.pv-page {
    position: absolute;
    top: 50%;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(28, 28, 28, 0.7);
    color: #FFFFFF;
    font-size: 22px;
    line-height: 1;
    transform: translateY(-50%);
    cursor: pointer;
}
.pv-page.is-prev { left: 8px; }
.pv-page.is-next { right: 8px; }
.pv-page:hover { background: rgba(28, 28, 28, 0.88); }
.pv-page-count { position: absolute; left: 50%; bottom: 10px; z-index: 3; padding: 1px 8px; border-radius: 10px; background: rgba(28, 28, 28, 0.7); color: #FFFFFF; font-size: 11.5px; font-weight: 600; transform: translateX(-50%); }
.pv-frame.is-doc.is-loading .pv-page { opacity: 0.5; }
.pv-nav.is-prev { left: 8px; }
.pv-nav.is-next { right: 8px; }
.pv-nav:hover { background: #FFFFFF; }
.pv-strip { display: flex; gap: 4px; padding: 6px; background: #FFFFFF; overflow-x: auto; scrollbar-width: thin; }
.pv-strip-item { flex: 0 0 auto; width: calc(44px * var(--r, 1)); height: 44px; padding: 0; border: 0; border-radius: 3px; background-color: #F1F1EE; background-repeat: no-repeat; opacity: 0.6; aspect-ratio: auto !important; cursor: pointer; }
.pv-strip-item:hover { opacity: 0.85; }
.pv-strip-item.is-on { opacity: 1; box-shadow: 0 0 0 2px var(--color-scheduled); }
.pv-actions { display: flex; align-items: center; gap: 16px; padding: 10px 14px; font-size: 22px; color: var(--pv-ink); }
.pv-actions-spread { justify-content: space-around; border-top: 1px solid var(--pv-line); font-size: 20px; color: var(--pv-sub); }
.pv-instagram .pv-actions { padding-bottom: 6px; }
.pv-foot { padding: 0 14px 12px; margin: 0; }

/* LinkedIn: the link card (cover cut to 1.91:1 as LinkedIn does), the poll, the reshared post */
.pv-card { border-top: 1px solid var(--pv-line); border-bottom: 1px solid var(--pv-line); }
.pv-card-cover { aspect-ratio: 1.91 !important; background-color: var(--pv-soft); background-size: cover !important; background-position: center !important; background-repeat: no-repeat; }
.pv-card-body { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; background: var(--pv-soft); }
.pv-article-read { border-bottom: 1px solid var(--pv-line); }
.pv-article-read > summary { display: flex; align-items: center; gap: 6px; padding: 10px 14px; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--color-scheduled); }
.pv-article-read > summary:hover { text-decoration: underline; }
.pv-article { padding: 4px 14px 14px; max-height: 70vh; overflow-y: auto; font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; }
.pv-article-title { margin: 6px 0 12px; font-size: 18px; line-height: 1.3; }
.pv-article p { margin: 0 0 12px; }
.td-article-text { min-height: 220px; resize: vertical; }
.pv-card-title { font-size: 14px; line-height: 1.35; overflow-wrap: anywhere; }
.pv-poll { display: flex; flex-direction: column; gap: 8px; margin: 0 14px 12px; padding: 12px 14px; border: 1px solid var(--pv-line); border-radius: 8px; }
.pv-poll p { margin: 0; }
.pv-poll-question { font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.pv-poll-option { display: block; padding: 6px 12px; border: 1px solid var(--color-scheduled); border-radius: 999px; color: var(--color-scheduled); font-weight: 600; text-align: center; overflow-wrap: anywhere; }
.pv-reshare { display: flex; align-items: flex-start; gap: 8px; margin: 0 14px 12px; padding: 12px 14px; border: 1px solid var(--pv-line); border-radius: 8px; color: var(--pv-sub); font-size: 13px; overflow-wrap: anywhere; }
.pv-reshare > .mdi { font-size: 18px; line-height: 1; }

.pv-youtube { border-radius: 10px; }
.pv-player { position: relative; display: flex; align-items: center; justify-content: center; aspect-ratio: 16 / 9 !important; background-color: #1C1C1C; background-repeat: no-repeat; background-size: contain !important; background-position: center !important; }
.pv-youtube.is-short .pv-player { aspect-ratio: 9 / 16 !important; max-height: 520px; margin: 0 auto; }
.pv-player.is-empty { color: #8E8E8B; font-size: 36px; }
.pv-yt-title { margin: 12px 14px 4px; font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; font-size: 16px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.pv-youtube .pv-head { padding-top: 6px; }
.pv-youtube .pv-avatar { width: 34px; height: 34px; }
.pv-yt-desc { margin: 0 14px 14px; padding: 10px 12px; border-radius: 8px; background: #F2F2F0; font-size: 13px; max-height: 220px; overflow: auto; }

.pv-threads { display: flex; gap: 10px; padding: 14px; }
.pv-threads .pv-avatar { width: 36px; height: 36px; }
.pv-threads-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.pv-threads-head strong { font-size: 14px; }
.pv-threads .pv-media { border-radius: 8px; overflow: hidden; }
.pv-threads .pv-actions { padding: 4px 0 0; font-size: 19px; gap: 18px; }

.pv-vertical { border: 0; background: none; }
.pv-vertical-frame {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: min(100%, 320px);
    aspect-ratio: 9 / 16 !important;
    margin: 0 auto;
    border-radius: 12px;
    background-color: #1C1C1C;
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center;
    color: #FFFFFF;
    overflow: hidden;
}
.pv-vertical-frame::after { content: ''; position: absolute; inset: 0; background: linear-gradient(rgba(0, 0, 0, 0.35), transparent 22%, transparent 60%, rgba(0, 0, 0, 0.55)); pointer-events: none; }
.pv-vertical-top { position: relative; z-index: 1; display: flex; align-items: center; gap: 8px; padding: 12px; }
.pv-vertical-top .pv-avatar { width: 30px; height: 30px; font-size: 10.5px; box-shadow: 0 0 0 2px #FFFFFF; }
.pv-vertical-top .pv-sub { color: rgba(255, 255, 255, 0.8); }
.pv-vertical .pv-play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 1; }
.pv-vertical-caption { position: relative; z-index: 1; margin-top: auto; padding: 12px 52px 14px 12px; font-size: 13px; max-height: 40%; overflow: hidden; }
.pv-vertical-caption .pv-more, .pv-vertical-caption .pv-tag, .pv-vertical-caption .pv-link { color: #FFFFFF; }
.pv-vertical-side { position: absolute; right: 10px; bottom: 16px; z-index: 1; display: flex; flex-direction: column; gap: 14px; font-size: 24px; }

/* History */
.history-list { display: flex; flex-direction: column; gap: 14px; margin: 0; padding: 0; list-style: none; max-height: 520px; overflow-y: auto; }
.history-item { display: flex; gap: 10px; }
.history-body { flex: 1 1 auto; min-width: 0; }
.history-line { margin: 0; font-size: 13px; line-height: 1.4; }
.history-meta { margin: 1px 0 0; font-size: 12px; color: var(--color-text-faint); }
.history-comment {
    margin: 6px 0 0;
    padding: 8px 10px;
    border-radius: var(--radius);
    background: var(--noe-grey-light);
    font-size: 13px;
    line-height: 1.5;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.history-item.is-approved .avatar { background: var(--color-success-soft); border-color: var(--color-success-border); color: var(--noe-green); }
.history-item.is-changes .history-comment, .history-item.is-rejected .history-comment { background: var(--color-accent-soft); color: var(--color-error-text); }
.history-item.is-submitted .avatar { background: var(--color-warning-soft); border-color: var(--color-warning-border); color: var(--color-warning-text); }
.history-item.is-publish .avatar { background: var(--color-scheduled-soft); border-color: var(--color-scheduled-border); color: var(--color-scheduled); }
.history-empty { margin: 0; font-size: 13px; color: var(--color-text-muted); }
.history-form { margin: 16px 0 0; padding-top: 14px; border-top: 1px solid var(--color-border); }
.history-form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 8px; }

/* What changed since approval */
.ver-intro, .ver-empty { margin: 0 0 12px; font-size: 13px; color: var(--color-text-muted); }
.ver-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.ver-item { padding: 10px 12px; border: 1px solid var(--color-border); border-left: 4px solid var(--color-border-strong); border-radius: var(--radius); background: var(--color-surface); }
.ver-item.is-submitted { border-left-color: var(--color-warning-dot); }
.ver-item.is-approved { border-left-color: var(--color-scheduled); }
.ver-item.is-before { border-left-color: var(--color-divider); background: var(--color-surface-sunken); }
.ver-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.ver-kind { font-family: var(--font-heading); font-size: 12.5px; font-weight: 600; }
.ver-latest { padding: 0 6px; border-radius: var(--radius-pill); background: var(--color-success-soft); color: var(--color-success-text); font-size: 11px; font-weight: 600; }
.ver-when { font-size: 12px; color: var(--color-text-muted); }
.ver-changes { margin: 4px 0 0; font-size: 13px; }
.ver-media { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ver-thumb { display: grid; place-items: center; width: 52px; height: 52px; border: 1px solid var(--color-border); border-radius: 3px; background: var(--color-media-bg); overflow: hidden; color: var(--color-text-muted); font-size: 20px; }
.ver-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ver-thumb:hover { border-color: var(--noe-black); }
.ver-thumb.is-gone { opacity: 0.6; }
.ver-texts { margin-top: 8px; }
.ver-texts > summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--color-scheduled); }
.ver-text { margin-top: 10px; }
.ver-text-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.ver-text-label { font-family: var(--font-heading); font-size: 11px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--color-text-muted); }
.ver-text-body { max-height: 320px; overflow-y: auto; padding: 8px 10px; border: 1px solid var(--color-border); border-radius: var(--radius); font-size: 13px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.ver-text-body del { background: var(--color-accent-soft); color: var(--color-error-text); text-decoration: line-through; }
.ver-text-body ins { background: var(--color-success-soft); color: var(--color-success-text); text-decoration: none; box-shadow: inset 0 -1px 0 var(--color-success-border); }
.ver-text-empty { margin: 0; font-size: 13px; color: var(--color-text-faint); }

/* ---------- Home (dashboard.js) ---------- */

.page-dashboard, .page-calendar { max-width: 1480px; }

/* Platform marks shared by the home and the calendar */
.mini-platforms { display: inline-flex; gap: 3px; vertical-align: middle; }
.mini-platform {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--platform-bg, var(--platform-color, var(--noe-black)));
    color: var(--noe-white);
    font-size: 11px;
    line-height: 1;
}

.dash-date::first-letter { text-transform: uppercase; }

/* The brief: the page's one loud element. Plain sentences in the heading face; the underlined words point
   at the block below that explains them, red underline = something to act on. */
.dash-brief { max-width: 60ch; margin: 2px 0 26px; font-family: var(--font-heading); font-size: 22px; font-weight: 500; line-height: 1.5; letter-spacing: -0.01em; color: var(--color-text); text-wrap: pretty; }
.dash-brief-link {
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    letter-spacing: inherit;
    text-align: inherit;
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-decoration-color: var(--color-border-strong);
    text-underline-offset: 5px;
    cursor: pointer;
}
.dash-brief-link.is-alert { text-decoration-color: var(--color-accent); }
.dash-brief-link:hover { color: var(--color-accent); text-decoration-color: currentColor; }
.dash-brief-link:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 3px; border-radius: 2px; }

/* The flow of the posts through the workflow: the steps in order on one line, the side exits hanging under
   the step they leave from. The line runs behind the numbers; each step cuts it with the page colour. */
.dash-flow {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    margin: 0 0 24px;
    padding: 0;
    list-style: none;
    background: linear-gradient(var(--color-border-strong), var(--color-border-strong)) no-repeat 0 17px / 100% 1px;
}
.flow-step { min-width: 0; }
.flow-step:last-child { background: var(--color-bg); }   /* the line stops at the last step */
/* A step: the number and its label are one link; "di cui N tuoi" is a second link under the label (subgrid keeps
   it in the label's column whatever the width of the number). The box cuts the line with the page colour. */
.flow-box { display: inline-grid; grid-template-columns: auto auto; column-gap: 8px; padding-right: 12px; background: var(--color-bg); }
.flow-step:not(:first-child) .flow-box { padding-left: 12px; }
.flow-link { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; align-items: start; color: var(--color-text); text-decoration: none; }
.flow-n { font-family: var(--font-heading); font-size: 26px; font-weight: 700; line-height: 34px; font-variant-numeric: tabular-nums; }
.flow-label { padding-top: 8px; font-size: 13px; line-height: 1.3; color: var(--color-text-muted); }
.flow-box > .flow-mine { grid-column: 2; margin-top: -8px; }
.flow-mine { font-size: 12px; color: var(--color-text-muted); text-decoration: underline; text-decoration-color: var(--color-border-strong); text-underline-offset: 3px; }
.flow-link:hover .flow-label, .flow-mine:hover { color: var(--color-accent); }
.flow-step.is-zero .flow-n { color: var(--color-text-faint); }
.flow-exits { margin: 2px 0 0; padding: 0; list-style: none; }
.flow-step:not(:first-child) .flow-exits { padding-left: 12px; }
.flow-exits li { position: relative; padding: 3px 0 0 18px; }
.flow-exits li::before { content: ''; position: absolute; left: 6px; top: 0; width: 8px; height: 13px; border-left: 1px solid var(--color-border-strong); border-bottom: 1px solid var(--color-border-strong); }
.flow-exit { font-size: 13px; color: var(--color-text-muted); text-decoration: none; }
.flow-exit strong { color: var(--color-text); font-variant-numeric: tabular-nums; }
.flow-exit.is-alert, .flow-exit.is-alert strong { color: var(--color-error-text); }
.flow-exit:hover { text-decoration: underline; text-underline-offset: 3px; }

/* Narrow screens: the same flow, top to bottom, the line on the left. */
@media (max-width: 760px) {
    .dash-brief { font-size: 19px; }
    .dash-flow { grid-template-columns: minmax(0, 1fr); gap: 4px; background-position: 13px 0; background-size: 1px 100%; }
    .flow-step:not(:first-child) .flow-box, .flow-step:not(:first-child) .flow-exits { padding-left: 0; }
    .flow-box { padding: 0 8px 0 0; }
    .flow-n { min-width: 28px; text-align: center; background: var(--color-bg); }
    .flow-exits { padding-left: 36px; }
}

.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.dash-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.dash-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 16px 18px 14px; scroll-margin-top: 16px; }
.dash-card-title:focus { outline: none; }
/* A block with nothing inside: no white surface, title and "nothing here" on one line. White = look inside. */
.dash-card.is-empty { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 14px; padding-top: 11px; padding-bottom: 11px; background: transparent; }
.dash-card.is-empty .dash-card-head { display: contents; }
.dash-card.is-empty .dash-empty { order: 1; margin: 0; }
.dash-card.is-empty .dash-card-link { order: 2; margin-left: auto; }
/* Reached from a pointer of the brief: lights up once, then goes back to normal. */
.dash-card.is-pointed { animation: dash-pointed 1.6s ease-out; }
@keyframes dash-pointed {
    0%, 35% { border-color: var(--color-accent); box-shadow: 0 0 0 3px var(--color-focus); }
    100% { border-color: var(--color-border); box-shadow: 0 0 0 3px transparent; }
}
@media (prefers-reduced-motion: reduce) {
    .dash-card.is-pointed { animation: none; border-color: var(--color-accent); box-shadow: 0 0 0 3px var(--color-focus); }
}
.dash-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.dash-card-title { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 14px; font-weight: 700; }
.dash-card-title .mdi { font-size: 18px; color: var(--color-text-muted); }
.dash-card-count { min-width: 22px; padding: 0 7px; border-radius: 11px; background: var(--noe-grey-light); font-size: 12px; font-weight: 700; line-height: 22px; text-align: center; }
.dash-card-count.is-alert { background: var(--color-error-text); color: var(--noe-white); }   /* white on brand red is 4.3:1 at 12 px */
.dash-card-link { margin-left: auto; font-size: 12.5px; font-weight: 600; color: var(--color-text-muted); text-decoration: none; white-space: nowrap; }
.dash-card-link:hover { color: var(--color-accent); }
.dash-list { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.dash-list > li { position: relative; display: flex; align-items: flex-start; border-top: 1px solid var(--color-divider); }
.dash-list > li:first-child { border-top: 0; }
.dash-item { display: flex; align-items: flex-start; gap: 10px; flex: 1 1 auto; min-width: 0; padding: 9px 4px; color: inherit; text-decoration: none; border-radius: 3px; }
a.dash-item:hover { background: var(--color-surface-hover); }
a.dash-item:hover .dash-item-title { color: var(--color-accent); }
.dash-thumb { display: flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 40px; height: 40px; border-radius: 3px; background: var(--color-media-bg); color: var(--color-text-faint); font-size: 18px; overflow: hidden; }
.dash-thumb img { width: 100%; height: 100%; object-fit: cover; }
.dash-item-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 auto; }
.dash-item-title { font-weight: 600; font-size: 13.5px; line-height: 1.35; overflow-wrap: anywhere; }
.dash-item-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; font-size: 12.5px; color: var(--color-text-muted); }
.dash-item-meta .is-past { color: var(--color-error-text); font-weight: 600; }
.dash-item-error { display: flex; gap: 4px; margin-top: 2px; font-size: 12.5px; font-weight: 600; color: var(--color-error-text); }
.dash-item.has-errors .dash-thumb { box-shadow: 0 0 0 2px var(--color-accent); }
.dash-item-warn { font-size: 12.5px; color: var(--color-warning-text); }
.dash-item-reason { font-size: 12.5px; color: var(--color-text); }
.dash-item-detail { font-size: 12px; color: var(--color-text-muted); overflow-wrap: anywhere; }
.dash-quote { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; padding: 6px 10px; border-left: 3px solid var(--color-accent); border-radius: 0 3px 3px 0; background: var(--color-accent-soft); font-size: 12.5px; }
.dash-quote-text { color: var(--color-error-text); white-space: pre-line; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.dash-quote-who { color: var(--color-text-muted); font-size: 11.5px; }
.dash-day { margin: 14px 0 2px; font-family: var(--font-heading); font-size: 13px; font-weight: 600; color: var(--color-text); }
.dash-day:first-of-type { margin-top: 0; }
.dash-item-slot { align-items: center; }
.dash-time { flex: 0 0 auto; width: 42px; font-weight: 700; font-variant-numeric: tabular-nums; }
.dash-state.is-ok { color: var(--noe-green); }
.dash-state.is-live { color: var(--color-scheduled); font-weight: 600; }
.dash-state.is-warning { color: var(--color-warning-text); }
.dash-kind { flex: 0 0 auto; font-size: 20px; line-height: 1.1; }
/* Did not leave or stuck: the deep red of errors (readable at 12.5 px, unlike the brand red). Trying again by itself:
   the amber text of warnings, no alarm. */
.dash-problem.is-failed .dash-kind, .dash-problem.is-failed .dash-kind-label,
.dash-problem.is-late .dash-kind, .dash-problem.is-late .dash-kind-label { color: var(--color-error-text); }
.dash-problem.is-retrying .dash-kind, .dash-problem.is-retrying .dash-kind-label { color: var(--color-warning-text); }
.dash-ext { flex: 0 0 auto; align-self: center; padding: 6px 8px; color: var(--color-text-muted); font-size: 16px; text-decoration: none; }
.dash-ext:hover { color: var(--color-accent); }
.dash-empty { display: flex; align-items: center; gap: 6px; margin: 4px 0 2px; font-size: 13px; color: var(--color-text-muted); }
.dash-empty .mdi { font-size: 17px; color: var(--noe-green); }
.dash-more { margin: 8px 0 0; font-size: 12.5px; color: var(--color-text-muted); }
.dash-more a { font-weight: 600; }

/* The strategy's questions (templates/dashPrompts): not links, rows with their own actions. The kind is told by the
   icon and the label, in ink; the only red is an overdue date (.is-past). The actions sit at the end of the meta line
   and wrap under it when the column is narrow. */
.dash-prompt .dash-kind { color: var(--color-text-muted); }
.dash-prompt .dash-kind-label { color: var(--color-text); font-weight: 600; }
.dash-prompt-text { margin: 0; white-space: pre-line; }
.dash-prompt-why { margin: 0; font-size: 12.5px; line-height: 1.45; color: var(--color-text-muted); white-space: pre-line; overflow-wrap: anywhere; }
.dash-prompt .dash-item-meta { margin-top: 3px; }
.dash-prompt-actions { display: inline-flex; align-items: center; gap: 14px; margin-left: auto; padding-left: 8px; }
.dash-prompt-actions .btn-link-subtle { font-size: 12.5px; }
.dash-prompt-actions .btn-link-subtle:disabled { opacity: 0.55; cursor: default; }
.dash-prompt-form { margin: 8px 0 2px; }
.dash-prompt-form .form-control { font-size: 13.5px; }
.dash-prompt-form-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px 10px; margin-top: 8px; }

@media (min-width: 1180px) {
    .dash-grid { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
}

/* ---------- Calendar (calendar.js) ---------- */

.cal-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-bottom: 12px; }
.cal-nav { display: flex; align-items: center; gap: 6px; }
.cal-period { margin: 0 0 0 8px; font-size: 18px; font-weight: 700; }
.cal-period::first-letter { text-transform: uppercase; }
#btCalToday:disabled { opacity: 0.55; }
.cal-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.cal-main { min-width: 0; }

.cal { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); overflow: hidden; }
.cal-weekdays, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-weekdays span { padding: 8px 10px; border-bottom: 1px solid var(--color-border); background: var(--color-surface-sunken); font-family: var(--font-heading); font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-text-muted); }
.cal-day { display: flex; flex-direction: column; min-width: 0; min-height: 118px; padding: 4px 5px 6px; border-right: 1px solid var(--color-divider); border-bottom: 1px solid var(--color-divider); }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day:nth-last-child(-n+7) { border-bottom: 0; }
.cal-day.is-weekend { background: #FCFCFB; }
.cal-day.is-out { background: #F8F8F6; }
.cal-day.is-out .cal-day-n { color: var(--color-text-faint); }
.cal-day-head { display: flex; margin-bottom: 3px; }
.cal-day-open { display: inline-flex; align-items: baseline; gap: 4px; padding: 2px 6px; border: 0; border-radius: 12px; background: none; color: var(--color-text); cursor: pointer; }
.cal-day-open:hover { background: var(--noe-grey-light); }
.cal-day-n { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cal-day-month { font-size: 11.5px; color: var(--color-text-muted); text-transform: lowercase; }
.cal-day.is-today .cal-day-open { background: var(--noe-red); color: var(--noe-white); }
.cal-day.is-today .cal-day-month { color: inherit; }
.cal-items { display: flex; flex-direction: column; gap: 3px; margin: 0; padding: 0; list-style: none; }
.cal-entry.is-extra { display: none; }
.cal-day.is-open .cal-entry.is-extra { display: block; }
.cal-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0 5px;
    padding: 3px 6px 3px 5px;
    border: 1px solid var(--color-border);
    border-left: 4px solid var(--pillar, var(--color-border-strong));
    border-radius: 3px;
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 12px;
    line-height: 1.3;
    text-decoration: none;
    min-width: 0;
}
.cal-item:hover { border-color: var(--noe-black); border-left-color: var(--pillar, var(--noe-black)); }
/* The post's colour (posts.tone) as the background; the left band stays the pillar's */
.cal-item[class*="tone-"] { background: var(--tone-bg); border-color: var(--tone-line); border-left-color: var(--pillar, var(--tone-line)); }
.cal-item[class*="tone-"] .cal-item-state { color: var(--tone-line); }
.cal-item-badge { display: none; }
.cal-month .cal-item-badge { display: inline-block; order: 4; flex-basis: 100%; font-size: 10.5px; font-weight: 600; letter-spacing: 0.01em; color: var(--tone-line, var(--color-text-muted)); }
.cal-month .cal-item.tone-draft .cal-item-badge { color: var(--color-text-muted); }
.cal-month .cal-item.tone-review .cal-item-badge { color: var(--color-warning-text); }
.cal-item-icon { flex: 0 0 auto; font-size: 14px; color: var(--platform-color, var(--noe-black)); }
.cal-item-time { flex: 0 0 auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.cal-item-title { flex: 1 1 0; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-item-state { flex: 0 0 auto; font-size: 13px; color: var(--color-text-faint); }
.cal-item-status { display: none; flex: 1 1 100%; font-size: 11.5px; color: var(--color-text-muted); }
.cal-item.is-published { background: var(--color-success-soft); }
.cal-item.is-published .cal-item-state { color: var(--noe-green); }
.cal-item.is-failed, .cal-item.has-error { background: var(--color-accent-soft); }
.cal-item.is-failed .cal-item-state, .cal-item.has-error .cal-item-state { color: var(--color-accent); }
.cal-item.is-processing .cal-item-state, .cal-item.post-scheduled .cal-item-state, .cal-item.post-publishing .cal-item-state { color: var(--color-scheduled); }
.cal-item.post-draft, .cal-item.post-in_review, .cal-item.post-changes_requested, .cal-item.post-rejected { border-style: dashed; border-left-style: solid; }
.cal-item.is-skipped .cal-item-title { text-decoration: line-through; color: var(--color-text-faint); }
/* Month: icon, time and state on the first line, the title below on the whole width of the day (two lines at most).
   Beside them it got the few pixels left in a 90 px day and broke letter by letter. */
.cal-month .cal-item { align-items: center; }
.cal-month .cal-item-title { flex-basis: 100%; order: 3; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.cal-month .cal-item-state { margin-left: auto; }
.cal-more { align-self: flex-start; margin-top: 3px; padding: 1px 6px; border: 0; border-radius: 3px; background: none; color: var(--color-text-muted); font-size: 11.5px; font-weight: 600; cursor: pointer; }
.cal-more:hover { background: var(--noe-grey-light); color: var(--color-text); }

/* Week: seven columns, one card per channel */
.cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-wday { min-width: 0; min-height: 360px; padding: 0 6px 10px; border-right: 1px solid var(--color-divider); }
.cal-wday:last-child { border-right: 0; }
.cal-wday.is-weekend { background: #FCFCFB; }
.cal-wday-head { display: flex; align-items: baseline; gap: 6px; margin: 0 -6px 8px; padding: 8px 10px; border-bottom: 1px solid var(--color-border); background: var(--color-surface-sunken); }
.cal-wday-name { font-family: var(--font-heading); font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-text-muted); }
.cal-wday-n { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.cal-wday.is-today .cal-wday-n { padding: 0 7px; border-radius: 12px; background: var(--noe-red); color: var(--noe-white); }
.cal-wday-empty { margin: 4px 2px; font-size: 12px; color: var(--color-text-faint); }
.cal-week .cal-items { gap: 6px; }
.cal-week .cal-item { padding: 6px 7px 7px 6px; align-items: flex-start; }
.cal-week .cal-item-title { flex-basis: 100%; order: 3; white-space: normal; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; font-weight: 600; margin-top: 2px; }
.cal-week .cal-item-state { margin-left: auto; }
.cal-week .cal-item-status { display: block; order: 4; margin-top: 2px; }

/* "Da pianificare" */
.cal-side { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 14px 16px; }
.cal-side-head { display: flex; align-items: center; gap: 8px; }
.cal-side-title { margin: 0; font-size: 14px; font-weight: 700; }
.cal-side-sub { margin: 4px 0 10px; font-size: 12.5px; color: var(--color-text-muted); }
.uns-list { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }
.uns-item { display: flex; flex-direction: column; gap: 3px; padding: 7px 9px; border: 1px solid var(--color-border); border-left: 4px solid var(--pillar, var(--color-border-strong)); border-radius: 3px; color: inherit; text-decoration: none; }
.uns-item:hover { border-color: var(--noe-black); border-left-color: var(--pillar, var(--noe-black)); }
.uns-item:hover .uns-title { color: var(--color-accent); }
.uns-title { font-size: 13px; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.uns-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 6px; font-size: 12px; color: var(--color-text-muted); }

/* "Da pianificare" goes beside the calendar when the page itself has room, not the window (the sidebar takes 240 px):
   the days must stay wide enough for an item. */
.page-calendar { container: calpage / inline-size; }
@container calpage (min-width: 1000px) {
    .cal-layout { grid-template-columns: minmax(0, 1fr) 300px; }
    .cal-side { position: sticky; top: 24px; max-height: calc(100vh - 48px); overflow-y: auto; }
}
@media (max-width: 760px) {
    .cal-day { min-height: 76px; }
    .cal-item-title { display: none; }
    .cal-week { grid-template-columns: minmax(0, 1fr); }
    .cal-wday { min-height: 0; border-right: 0; border-bottom: 1px solid var(--color-divider); }
}

/* ---------- Statistiche (stats.js) ---------- */

.page-stats { max-width: 1480px; }
.stats-toolbar { gap: 10px 12px; }
.stats-dates { display: inline-flex; align-items: center; gap: 6px; color: var(--color-text-muted); }
.stats-dates[hidden] { display: none; }
.stats-period { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.stats-dates .form-control { width: auto; }
/* Refetch keeps the frame: the old numbers stay, dimmed, until the new ones arrive */
#statsGrid { container-type: inline-size; transition: opacity 0.15s; }
#statsGrid.is-refreshing { opacity: 0.55; pointer-events: none; }

/* Banners: amber = an Admin has to act; is-info = just so you know */
.stats-notice { display: flex; align-items: flex-start; gap: 8px; }
.stats-notice > .mdi { font-size: 17px; line-height: 1.25; }
.stats-notice-text { margin: 0; }

/* Stat tiles: proportional figures (a standalone number), the change in words with an arrow */
.stats-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-tile { padding: 14px 16px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); }
.stat-label, .stat-value, .stat-delta, .stat-note { margin: 0; }
.stat-label { font-family: var(--font-heading); font-size: 12.5px; font-weight: 600; color: var(--color-text-muted); }
.stat-value { margin-top: 4px; font-family: var(--font-heading); font-size: 26px; font-weight: 700; line-height: 1.25; }
.stat-delta { margin-top: 4px; font-size: 12.5px; color: var(--color-text-muted); }
.stat-delta .mdi { font-size: 14px; vertical-align: -1px; color: var(--color-text); }
.stat-delta.is-up .mdi { color: var(--noe-green); }
.stat-note { margin-top: 2px; font-size: 12.5px; color: var(--color-text-muted); }

.stats-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; margin-bottom: 16px; }
@container (min-width: 900px) {
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.stats-card .dash-card-head { flex-wrap: wrap; }
.stats-card .dash-card-head .segmented { margin-left: auto; }
.segmented-sm .segmented-item { padding: 3px 9px; font-size: 12px; }
.stats-caption { margin: -2px 0 12px; font-size: 12.5px; color: var(--color-text-muted); }
.stats-footnote { margin: 10px 0 0; font-size: 12px; line-height: 1.45; color: var(--color-text-muted); }

/* Trend: thin columns from one baseline, 4 px rounded tops; values only on the highest and the last */
.trend-chart { display: flex; align-items: stretch; gap: 6px; height: 196px; padding-top: 20px; }
.trend-col { display: flex; flex-direction: column; align-items: center; flex: 1 1 0; min-width: 0; cursor: default; }
.trend-plot { position: relative; display: flex; align-items: flex-end; justify-content: center; flex: 1 1 auto; width: 100%; border-bottom: 1px solid var(--color-border-strong); }
.trend-bar { width: 100%; max-width: 24px; background: var(--color-data); border-radius: 4px 4px 0 0; }
.trend-col:hover .trend-bar { background: var(--color-data-strong); }
.trend-col.is-few .trend-bar { opacity: 0.45; }
.trend-value { position: absolute; left: -10px; right: -10px; margin-bottom: 3px; text-align: center; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.trend-label { margin-top: 6px; font-size: 11.5px; color: var(--color-text-muted); white-space: nowrap; }
.trend-chart.is-dense .trend-label { font-size: 10.5px; }

/* Per azienda / Per piattaforma. Half a page wide (two cards per row from 900 px): the headers are in sentence case
   like the day × time table beside it, and two-word ones wrap — in capitals with spacing they made the table 100 px
   wider than the card at 1280 px and the rate went out of sight behind a scroll bar. The scroll stays only as a last
   resort */
.stats-platforms { overflow-x: auto; }
.stats-mini-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.stats-mini-table th, .stats-mini-table td { padding: 8px 5px; border-bottom: 1px solid var(--color-divider); text-align: left; }
.stats-mini-table tr > :first-child { padding-left: 0; }
.stats-mini-table tr > :last-child { padding-right: 0; }
.stats-mini-table thead th { font-size: 12px; font-weight: 600; line-height: 1.3; color: var(--color-text-muted); white-space: normal; vertical-align: bottom; }
.stats-mini-table tbody th { font-family: var(--font-body); font-weight: 600; }
.stats-mini-table tbody tr:last-child > * { border-bottom: 0; }
.col-num { text-align: right !important; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stats-platform { display: inline-flex; align-items: center; gap: 8px; }
.stats-platform-sub { display: block; font-size: 12px; font-weight: 400; color: var(--color-text-muted); }

/* Cosa funziona: one ink, bars differ by length; the category keeps its colour on the dot, as on the tags */
.stats-group-tabs { margin-bottom: 10px; }
.hbars { display: flex; flex-direction: column; gap: 11px; margin: 0; padding: 0; list-style: none; }
.hbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name value" "track track" "sub sub"; gap: 3px 10px; }
.hbar-name { grid-area: name; display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 13.5px; font-weight: 600; overflow-wrap: anywhere; }
.hbar-name .mdi { color: var(--color-text-muted); }
.hbar-dot { flex: 0 0 auto; width: 9px; height: 9px; border-radius: 50%; background: var(--tag-color, var(--color-text-faint)); }
.hbar-value { grid-area: value; font-family: var(--font-heading); font-weight: 700; font-variant-numeric: tabular-nums; }
.hbar-track { grid-area: track; height: 10px; background: var(--color-data-soft); border-radius: 0 4px 4px 0; }
.hbar-fill { display: block; height: 100%; background: var(--color-data); border-radius: 0 4px 4px 0; }
.hbar-track:hover .hbar-fill { background: var(--color-data-strong); }
.hbar-sub { grid-area: sub; font-size: 12px; color: var(--color-text-muted); }
.hbar.is-few .hbar-fill { opacity: 0.45; }
.hbar.is-none .hbar-name { font-weight: 500; color: var(--color-text-muted); }

/* Giorno x fascia: four steps of the same ink, ink text up to the third, white on the darkest */
.heat { width: 100%; border-collapse: separate; border-spacing: 3px; table-layout: fixed; font-size: 12px; }
.heat thead th { padding: 0 2px 4px; font-size: 11.5px; font-weight: 600; text-align: center; color: var(--color-text-muted); }
.heat tbody th { width: 46px; padding-right: 4px; font-size: 12px; font-weight: 600; text-align: left; color: var(--color-text-muted); }
.heat-hours { display: block; font-family: var(--font-body); font-size: 10.5px; font-weight: 400; color: var(--color-text-faint); }
.heat-cell { height: 34px; border-radius: 3px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; background: var(--color-surface-sunken); color: var(--color-text); }
.heat-cell.is-empty { background: transparent; box-shadow: inset 0 0 0 1px var(--color-divider); }
.heat-1 { background: color-mix(in srgb, var(--color-data) 14%, var(--color-surface)); }
.heat-2 { background: color-mix(in srgb, var(--color-data) 32%, var(--color-surface)); }
.heat-3 { background: color-mix(in srgb, var(--color-data) 58%, var(--color-surface)); }
.heat-4 { background: var(--color-data-strong); color: var(--noe-white); }
.heat-cell.is-few { opacity: 0.55; }
.heat-cell[data-tip]:hover { box-shadow: 0 0 0 2px var(--color-data-strong); }
.stats-heat-best { margin: 10px 0 0; font-size: 13px; }

/* Follower */
.stats-followers-list { margin: 0; padding: 0; list-style: none; }
.stats-follower { display: grid; grid-template-columns: auto minmax(0, 1fr) 96px auto; align-items: center; gap: 2px 12px; padding: 9px 0; border-top: 1px solid var(--color-divider); }
.stats-follower:first-child { border-top: 0; }
.stats-follower-name { font-size: 13.5px; font-weight: 600; overflow-wrap: anywhere; }
.stats-follower-sub { display: block; font-size: 12px; font-weight: 400; color: var(--color-text-muted); }
.stats-follower-spark svg { display: block; width: 96px; height: 28px; overflow: visible; }
.stats-follower-spark path { fill: none; stroke: var(--color-data); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.stats-follower-last { font-family: var(--font-heading); font-size: 17px; font-weight: 700; text-align: right; }
.stats-follower-delta { grid-column: 2 / -1; font-size: 12px; text-align: right; color: var(--color-text-muted); }
.stats-follower-delta.is-up strong { color: var(--color-success-text); }

/* Il lavoro della redazione */
.stats-work-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px 16px; margin: 0; padding: 0; list-style: none; }
.stats-work-list li { display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; line-height: 1.35; color: var(--color-text-muted); }
.stats-work-list strong { font-family: var(--font-heading); font-size: 20px; color: var(--color-text); }
.stats-work-list strong.is-alert { color: var(--color-error-text); }

/* Le uscite: the table view of everything above */
.stats-list { margin-bottom: 24px; }
.stats-list-head .segmented { margin-left: auto; }
.stats-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 11px;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-pill);
    background: var(--color-surface);
    font-family: var(--font-heading);
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text);
    cursor: pointer;
}
.stats-chip:hover { background: var(--noe-grey-light); }
.stats-chip.is-active { background: var(--noe-black); border-color: var(--noe-black); color: var(--noe-white); }
.stats-table-wrap { overflow-x: auto; }
.stats-table { border: 0; border-radius: 0; }
.stats-table tbody tr { cursor: default; }
.stats-table th, .stats-table td { padding: 9px 10px; }
.stats-exit { display: flex; align-items: center; gap: 10px; min-width: 240px; }
.stats-exit-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stats-exit-title { font-size: 13.5px; font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
.stats-ext { color: var(--color-text-muted); text-decoration: none; }
.stats-ext:hover { color: var(--color-accent); }
.stats-sum { margin-left: 3px; font-size: 11px; color: var(--color-text-faint); cursor: help; }
.stats-state-cell { min-width: 180px; }
.stats-state { display: block; font-size: 12.5px; color: var(--color-text-muted); }
.stats-state.is-waiting { color: var(--color-scheduled); }
.stats-state.is-error { color: var(--color-error-text); }
.stats-state.is-partial { color: var(--color-warning-text); }

/* Statistics of a post, under the preview (templates/postSide .side-metrics; stats.paintPost → templates/postMetrics) */
.side-metrics { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--color-divider); }
.side-metrics-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.side-metrics-title { margin: 0; font-family: var(--font-heading); font-size: 15px; font-weight: 700; }
.side-metrics-all { flex: 0 0 auto; font-size: 12.5px; }
.pm-totals, .pm-channel { margin-bottom: 12px; padding: 12px 14px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); }
.pm-totals-title { margin: 0 0 8px; font-family: var(--font-heading); font-size: 13px; font-weight: 700; }
.pm-figures { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.pm-figure { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.pm-figure-value { font-family: var(--font-heading); font-size: 20px; font-weight: 700; }
.pm-figure-label { font-size: 12px; line-height: 1.3; color: var(--color-text-muted); }
.pm-head { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 10px; }
.pm-head .mini-platform { margin-top: 1px; }
.pm-head-text { flex: 1 1 auto; min-width: 0; }
.pm-name, .pm-when { margin: 0; }
.pm-name { font-size: 13.5px; overflow-wrap: anywhere; }
.pm-when { font-size: 12px; color: var(--color-text-muted); }
.pm-ext { flex: 0 0 auto; color: var(--color-text-muted); font-size: 16px; text-decoration: none; }
.pm-ext:hover { color: var(--color-accent); }
.pm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px 12px; margin: 0 0 10px; }
.pm-cell dt { font-size: 12px; font-weight: 400; line-height: 1.3; color: var(--color-text-muted); }
.pm-cell dd { margin: 0; font-family: var(--font-heading); font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pm-state { margin: 0 0 6px; font-size: 12.5px; line-height: 1.45; color: var(--color-text-muted); }
.pm-state.is-waiting { color: var(--color-scheduled); }
.pm-state.is-error { color: var(--color-error-text); }
.pm-state.is-partial { color: var(--color-warning-text); }
.pm-trend { display: flex; align-items: center; gap: 10px; margin: 4px 0 6px; font-size: 12px; color: var(--color-text-muted); }
.pm-trend svg { flex: 0 0 auto; width: 96px; height: 28px; overflow: visible; }
.pm-trend path { fill: none; stroke: var(--color-data); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.pm-history { font-size: 12.5px; }
.pm-history summary { cursor: pointer; font-weight: 600; color: var(--color-text-muted); }
.pm-history summary:hover { color: var(--color-text); }
.pm-history ul { margin: 6px 0 0; padding: 0; list-style: none; }
.pm-history li + li { margin-top: 3px; }

/* The one tooltip of the page (stats.bindTips): text only, above the mark */
.stats-tip {
    position: fixed;
    z-index: 1100;
    max-width: 280px;
    padding: 6px 9px;
    border-radius: var(--radius);
    background: var(--noe-black);
    color: var(--noe-white);
    font-size: 12px;
    line-height: 1.4;
    pointer-events: none;
    box-shadow: var(--shadow-pop);
}
.stats-tip[hidden] { display: none; }

/* ---------- Report (reports.js) ---------- */

/* The list: one white sheet per report; the pill says where it is (green ready, blue while the server works on it
   by itself, red failed) */
.report-rows { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; list-style: none; }
.report-row { display: flex; align-items: flex-start; gap: 4px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); transition: border-color 0.15s; }
.report-row:hover { border-color: var(--color-border-strong); }
.report-row-link { display: flex; flex-direction: column; gap: 4px; flex: 1 1 auto; min-width: 0; padding: 14px 18px; color: inherit; text-decoration: none; }
.report-row-link:hover { color: inherit; }
.report-row-link:hover .report-row-headline { color: var(--color-accent); }
.report-row-top { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 12.5px; color: var(--color-text-muted); }
.report-row-period { font-family: var(--font-heading); font-weight: 600; color: var(--color-text); }
.report-row-filters::before, .report-kicker-filters::before { content: '\00B7'; margin-right: 10px; }
.report-row-headline { font-family: var(--font-heading); font-size: 15px; font-weight: 700; line-height: 1.35; overflow-wrap: anywhere; transition: color 0.15s; }
.report-row-status { font-size: 13px; color: var(--color-text-muted); }
.report-row-status.is-warn { color: var(--color-warning-text); }
.report-row-focus { font-size: 13px; overflow-wrap: anywhere; }
.report-row-focus .mdi { color: var(--color-text-muted); }
.report-row-meta { font-size: 12.5px; color: var(--color-text-muted); }
.report-row-actions { display: flex; align-items: center; gap: 4px; flex: 0 0 auto; padding: 12px 12px 0 0; }

.report-pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border: 1px solid var(--color-border-strong); border-radius: var(--radius-pill); background: var(--color-surface); font-family: var(--font-heading); font-size: 11.5px; font-weight: 600; line-height: 1.5; color: var(--color-text-muted); white-space: nowrap; }
.report-pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--noe-grey); }
.report-pill.is-done { background: var(--color-success-soft); border-color: var(--color-success-border); color: var(--color-success-text); }
.report-pill.is-done::before { background: var(--color-success); }
.report-pill.is-queued, .report-pill.is-running { background: var(--color-scheduled-soft); border-color: var(--color-scheduled-border); color: var(--color-scheduled); }
.report-pill.is-queued::before, .report-pill.is-running::before { display: none; }
.report-pill.is-failed { background: var(--color-accent-soft); border-color: var(--color-accent-border); color: var(--color-error-text); }
.report-pill.is-failed::before { background: var(--color-accent); }
.report-spin { width: 9px; height: 9px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 0.9s linear infinite; }

/* The sheet: a new report */
.sheet-report { max-width: 640px; }
.sheet-report form { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.sheet-report form > .alert-banner { margin: 0 22px 8px; }
.sheet-report form > .alert-banner[hidden] { display: none; }
.report-sheet-period { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.report-sheet-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 20px 16px; margin-bottom: 20px; }
.report-sheet-grid > .form-row { margin-bottom: 0; }
.form-label-note { font-family: var(--font-body); font-weight: 400; color: var(--color-text-muted); }
.report-sheet-note { display: flex; gap: 8px; margin: 0; padding: 10px 12px; background: var(--color-bg); border-radius: var(--radius); font-size: 13px; color: var(--color-text-muted); }
.report-sheet-note .mdi { font-size: 17px; line-height: 1.2; }

/* One report */
.report-view { container-type: inline-size; }
.report-back { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 14px; font-family: var(--font-heading); font-size: 13px; font-weight: 600; color: var(--color-text-muted); text-decoration: none; }
.report-back:hover { color: var(--color-accent); }
.report-kicker { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 0 0 8px; font-size: 12.5px; color: var(--color-text-muted); }
.report-title { max-width: 900px; overflow-wrap: anywhere; }

.report-progress { display: flex; align-items: flex-start; gap: 14px; padding: 18px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); }
.report-progress.is-warn { background: var(--color-warning-soft); border-color: var(--color-warning-border); color: var(--color-warning-text); }
.report-progress.is-warn > .mdi { font-size: 20px; line-height: 1.2; }
.report-progress .spinner { flex: 0 0 auto; margin-top: 1px; }
.report-progress p { margin: 0; }
.report-progress-text { font-family: var(--font-heading); font-weight: 600; }
.report-progress p.report-progress-note, .report-progress p.report-progress-focus { margin-top: 4px; font-size: 13px; color: var(--color-text-muted); }
.report-progress.is-warn p.report-progress-note { color: inherit; }

.report-summary { max-width: 860px; margin-bottom: 20px; }
.report-summary-text { margin: 0 0 8px; font-size: 15.5px; line-height: 1.6; }
.report-confidence { display: flex; align-items: baseline; gap: 6px; margin: 0; font-size: 13px; color: var(--color-text-muted); }
.report-confidence strong { font-family: var(--font-heading); font-weight: 600; color: var(--color-text); }
.report-dot { display: inline-block; flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: var(--noe-grey); }
.report-confidence.is-alta .report-dot { background: var(--color-success); }
.report-confidence.is-media .report-dot { background: var(--color-warning-dot); }

.report-card { margin-bottom: 16px; }
.report-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; margin-bottom: 16px; }
.report-grid > .report-card { margin-bottom: 0; }
@container (min-width: 900px) {
    .report-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.report-focus-q { margin: 0 0 6px; color: var(--color-text-muted); overflow-wrap: anywhere; }
.report-focus-a { margin: 0; white-space: pre-line; }

.report-findings, .report-groups, .report-patterns, .report-post-list, .report-recs-list { margin: 0; padding: 0; list-style: none; }
.report-finding p, .report-group p, .report-pattern p, .report-post-main p, .report-rec p { margin: 0; }
.report-finding + .report-finding, .report-group + .report-group, .report-pattern + .report-pattern { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--color-divider); }
.report-finding-title { display: flex; align-items: center; gap: 6px; }
.report-finding-title strong { font-family: var(--font-heading); font-weight: 700; }
.report-finding p.report-finding-detail { margin-top: 3px; }
.report-label { margin-right: 4px; font-family: var(--font-heading); font-size: 12.5px; font-weight: 600; color: var(--color-text-muted); }

/* The posts a finding or a recommendation points at */
.report-finding p.report-chips, .report-rec p.report-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.report-chips-label { margin-right: 2px; font-size: 12.5px; color: var(--color-text-muted); }
.report-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 260px; padding: 2px 10px 2px 2px; border: 1px solid var(--color-border); border-radius: var(--radius-pill); background: var(--color-surface); font-size: 12.5px; color: var(--color-text); text-decoration: none; }
.report-chip:hover { border-color: var(--color-border-strong); }
.report-chip-thumb { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 22px; height: 22px; border-radius: 50%; overflow: hidden; background: var(--color-media-bg); color: var(--color-text-faint); font-size: 13px; }
.report-chip-thumb img { width: 100%; height: 100%; object-fit: cover; }
.report-chip-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* What to do: numbered, the priority on a dot (red = do it first: a thing to act on) */
.report-rec { padding: 14px 0; border-top: 1px solid var(--color-divider); }
.report-rec:first-child { padding-top: 2px; border-top: 0; }
.report-rec:last-child { padding-bottom: 0; }
.report-rec-head { display: flex; align-items: baseline; gap: 10px; }
.report-rec-n { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 24px; height: 24px; border-radius: 50%; background: var(--noe-black); color: var(--noe-white); font-family: var(--font-heading); font-size: 12px; font-weight: 700; }
.report-rec-title { margin: 0; font-size: 15px; font-weight: 700; line-height: 1.35; }
.report-rec p.report-rec-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin: 6px 0 0 34px; font-size: 12.5px; color: var(--color-text-muted); }
.report-rec p.report-rec-action { margin: 8px 0 0 34px; }
.report-rec p.report-chips { margin-left: 34px; }
.report-rec-dl { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px 14px; margin: 8px 0 0 34px; font-size: 13px; }
@container (min-width: 700px) {
    .report-rec-dl { grid-template-columns: max-content minmax(0, 1fr); }
}
.report-rec-dl dt { font-family: var(--font-heading); font-size: 12.5px; font-weight: 600; line-height: 1.6; color: var(--color-text-muted); }
.report-rec-dl dd { margin: 0 0 4px; }
.report-prio, .report-rec-platform { display: inline-flex; align-items: center; gap: 6px; }
.report-prio { font-family: var(--font-heading); font-weight: 600; color: var(--color-text); }
.report-prio.is-alta .report-dot { background: var(--color-accent); }
.report-prio.is-media .report-dot { background: var(--color-warning-dot); }

/* The posts to look at */
.report-post { display: flex; gap: 14px; padding: 14px 0; border-top: 1px solid var(--color-divider); }
.report-post:first-child { padding-top: 2px; border-top: 0; }
.report-post:last-child { padding-bottom: 0; }
.report-post-thumb { width: 64px; height: 64px; }
.report-post-main { display: flex; flex-direction: column; gap: 6px; flex: 1 1 auto; min-width: 0; font-size: 13.5px; }
.report-post-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.report-post-title { font-family: var(--font-heading); font-size: 14px; font-weight: 700; text-decoration: none; overflow-wrap: anywhere; }
.report-post-exits { display: flex; flex-direction: column; gap: 3px; margin: 0; padding: 0; list-style: none; font-size: 12.5px; color: var(--color-text-muted); font-variant-numeric: tabular-nums; }
.report-post-exits li { display: flex; align-items: center; gap: 6px; }

.report-verdict { display: inline-flex; align-items: center; padding: 1px 9px; border: 1px solid var(--color-border-strong); border-radius: var(--radius-pill); background: var(--color-surface); font-family: var(--font-heading); font-size: 11.5px; font-weight: 600; color: var(--color-text-muted); white-space: nowrap; }
.report-verdict.is-good { background: var(--color-success-soft); border-color: var(--color-success-border); color: var(--color-success-text); }
.report-verdict.is-weak { background: var(--color-warning-soft); border-color: var(--color-warning-border); color: var(--color-warning-text); }
.report-verdict.is-unknown { border-style: dashed; color: var(--color-text-faint); }

.report-group-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.report-group-kind { font-family: var(--font-heading); font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-text-muted); }
.report-group p + p { margin-top: 4px; }
.report-pattern { display: flex; gap: 10px; }
.report-pattern-icon { font-size: 18px; line-height: 1.3; color: var(--color-text-muted); }
.report-pattern p.report-pattern-area { font-family: var(--font-heading); font-size: 12.5px; font-weight: 600; color: var(--color-text-muted); }
.report-pattern p.report-pattern-evidence { margin-top: 3px; font-size: 12.5px; color: var(--color-text-muted); }

.report-gaps-list { margin: 0; padding-left: 18px; }
.report-gaps-list li + li { margin-top: 4px; }
.report-source-list { margin: 0; padding-left: 24px; font-size: 13px; }
.report-source-list li + li { margin-top: 3px; }
.report-source-list a { overflow-wrap: anywhere; }
.report-research { margin-top: 12px; }
.report-research summary { cursor: pointer; font-family: var(--font-heading); font-size: 13px; font-weight: 600; color: var(--color-text-muted); }
.report-research summary:hover { color: var(--color-text); }
.report-research-text { margin: 10px 0; font-size: 13.5px; white-space: pre-line; }
.report-meta { max-width: 860px; margin: 4px 0 0; font-size: 12.5px; color: var(--color-text-muted); }

/* ---------- Page modals in #bodyModal (dialog.openModal) ---------- */

#bodyModal.is-open {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background: var(--color-overlay);
    animation: fade-in 0.15s ease-out;
}
body.has-modal { overflow: hidden; }
.sheet {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 720px;
    max-height: calc(100vh - 48px);
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-pop);
    animation: dialog-in 0.18s ease-out;
}
.sheet-wide { max-width: 1120px; height: calc(100vh - 48px); }
.sheet-crop { max-width: 1080px; }
.sheet-head { display: flex; align-items: center; gap: 12px; padding: 16px 16px 8px 22px; }
.sheet-title { flex: 1 1 auto; margin: 0; font-size: 17px; font-weight: 700; overflow-wrap: anywhere; }
.sheet-title-sub { font-weight: 500; color: var(--color-text-muted); }
.sheet-sub { margin: 0; padding: 0 22px 8px; font-size: 13px; color: var(--color-text-muted); }
.sheet-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 4px 22px 12px; }
.sheet-tools .search-field { max-width: none; }
.sheet-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 8px 22px 16px; }
.sheet-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 22px; border-top: 1px solid var(--color-border); }
.sheet-count { font-size: 13px; color: var(--color-text-muted); }
.sheet > .alert-banner { margin: 0 22px 8px; }
.sheet > .alert-banner[hidden] { display: none; }
.sheet-body .asset-browser > .toolbar { position: sticky; top: -8px; z-index: 2; padding: 8px 0; margin-top: -8px; background: var(--color-surface); }

/* Saved texts picker */
.snippet-picks { display: flex; flex-direction: column; gap: 8px; margin: 0 0 8px; padding: 0; list-style: none; }
.snippet-pick {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    color: var(--color-text);
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.snippet-pick:hover, .snippet-pick:focus-visible { border-color: var(--color-accent); box-shadow: 0 0 0 1px var(--color-accent); }
.snippet-pick-head { display: flex; align-items: center; gap: 8px; }
.snippet-pick-title { flex: 1 1 auto; font-weight: 600; min-width: 0; }
.snippet-pick-insert { display: inline-flex; align-items: center; gap: 2px; font-family: var(--font-heading); font-size: 12px; font-weight: 600; color: var(--color-accent); opacity: 0; transition: opacity 0.15s; }
.snippet-pick:hover .snippet-pick-insert, .snippet-pick:focus-visible .snippet-pick-insert { opacity: 1; }
.snippet-pick-body { font-size: 13px; color: var(--color-text-muted); white-space: pre-line; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }

/* Crop tool */
.crop-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 8px 22px 16px; overflow: auto; }
.crop-canvas { display: flex; align-items: center; justify-content: center; min-height: 240px; padding: 12px; border-radius: var(--radius); background: var(--color-media-dark); }
.crop-stage { position: relative; line-height: 0; overflow: hidden; touch-action: none; user-select: none; }
.crop-image { display: block; max-width: 100%; max-height: 62vh; pointer-events: none; }
.crop-box {
    position: absolute;
    left: 0;
    top: 0;
    border: 2px solid #FFFFFF;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.58);
    cursor: move;
    outline: none;
}
.crop-box:focus-visible { border-color: var(--noe-red); }
.crop-box.is-readonly { cursor: default; }
.crop-stage.is-dragging .crop-box { cursor: grabbing; }
.crop-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(to right, transparent 33%, rgba(255, 255, 255, 0.45) 33%, rgba(255, 255, 255, 0.45) calc(33% + 1px), transparent calc(33% + 1px), transparent 66%, rgba(255, 255, 255, 0.45) 66%, rgba(255, 255, 255, 0.45) calc(66% + 1px), transparent calc(66% + 1px)),
        linear-gradient(to bottom, transparent 33%, rgba(255, 255, 255, 0.45) 33%, rgba(255, 255, 255, 0.45) calc(33% + 1px), transparent calc(33% + 1px), transparent 66%, rgba(255, 255, 255, 0.45) 66%, rgba(255, 255, 255, 0.45) calc(66% + 1px), transparent calc(66% + 1px));
    pointer-events: none;
}
.crop-handle { position: absolute; z-index: 1; width: 16px; height: 16px; background: #FFFFFF; border: 2px solid var(--noe-black); border-radius: 2px; }
.crop-handle.is-nw { left: -9px; top: -9px; cursor: nwse-resize; }
.crop-handle.is-ne { right: -9px; top: -9px; cursor: nesw-resize; }
.crop-handle.is-sw { left: -9px; bottom: -9px; cursor: nesw-resize; }
.crop-handle.is-se { right: -9px; bottom: -9px; cursor: nwse-resize; }
.crop-side .form-label { margin-bottom: 8px; }
.crop-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.crop-preset {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius);
    background: var(--color-surface);
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.crop-preset:hover { border-color: var(--noe-grey); }
.crop-preset.is-active { background: var(--noe-black); border-color: var(--noe-black); color: var(--noe-white); }
.crop-preset:disabled { cursor: default; opacity: 0.6; }
.crop-preset-post { padding: 0 5px; border-radius: 3px; background: var(--noe-red); color: var(--noe-white); font-size: 10px; letter-spacing: 0.03em; text-transform: uppercase; }
.crop-info { margin: 0 0 4px; font-weight: 600; font-variant-numeric: tabular-nums; }
.crop-small { color: var(--color-warning-text); }
.crop-small[hidden] { display: none; }

/* Comment dialogs (dialog.prompt) */
.dialog-prompt { max-width: 520px; }
.dialog-field-label { margin: 16px 0 6px; }
.dialog-prompt .dialog-message + .dialog-field { margin-top: 14px; }
.dialog-field { resize: vertical; min-height: 90px; }

@media (min-width: 1300px) {
    .composer { grid-template-columns: minmax(0, 1fr) minmax(380px, 440px); }
    .composer-side { position: sticky; top: 96px; max-height: calc(100vh - 112px); overflow-y: auto; }
}

@media (min-width: 900px) {
    .crop-layout { grid-template-columns: minmax(0, 1fr) 260px; }
}

/* ---------- Login ---------- */

.login-screen { min-height: 100vh; display: flex; flex-direction: column; background: var(--color-surface); }

.login-brand {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 28px 24px;
    background: var(--noe-black);
    color: var(--noe-white);
}
.brand-large { font-size: 26px; }
.login-claim { margin: 0; max-width: 360px; font-family: var(--font-heading); font-size: 15px; font-weight: 500; line-height: 1.45; color: #D8D8D5; }
.login-foot { display: none; margin: 0; font-size: 12px; color: #8E8E8B; letter-spacing: 0.04em; }

.login-panel { flex: 1 1 auto; display: flex; align-items: flex-start; justify-content: center; padding: 40px 24px; }
.tokenForm { width: 100%; max-width: 380px; }
.tokenForm form { display: flex; flex-direction: column; }
.tokenForm .form-label { margin-top: 14px; }
.tokenForm .btn-block { margin-top: 20px; padding-top: 10px; padding-bottom: 10px; }
.tokenForm .btn-link-subtle { margin-top: 16px; align-self: flex-start; }
.login-title { margin: 0 0 6px; font-size: 26px; font-weight: 700; letter-spacing: -0.015em; }
.login-lead { margin: 0 0 6px; color: var(--color-text-muted); }
.input-code { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; letter-spacing: 0.06em; }

.login-message { margin: 18px 0 0; padding: 10px 12px; border-radius: var(--radius); font-size: 13px; }
.login-message.is-error { background: var(--color-accent-soft); color: #8F1F18; }
.login-message.is-info { background: var(--noe-grey-light); color: var(--color-text); }

/* ---------- Dialog (dialog.js) ---------- */

.dialog-background {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: var(--color-overlay);
    animation: fade-in 0.15s ease-out;
}
.dialog {
    width: 100%;
    max-width: 440px;
    padding: 24px;
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-pop);
    animation: dialog-in 0.18s ease-out;
}
.dialog-title { margin-bottom: 8px; font-family: var(--font-heading); font-size: 17px; font-weight: 700; }
.dialog-message { color: var(--color-text-muted); line-height: 1.55; }
.dialog-message strong { color: var(--color-text); font-weight: 600; }
.dialog-buttons { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes dialog-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } }

/* ---------- Toasts (dialog.toast) ---------- */

#toast-container {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 2100;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: min(420px, calc(100vw - 40px));
}
.toast {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: auto;
    padding: 11px 12px 11px 14px;
    border: 0;
    border-radius: var(--radius);
    background: var(--noe-black);
    color: var(--noe-white);
    font-size: 13.5px;
    box-shadow: var(--shadow-pop);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.25s, transform 0.25s;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-icon { font-size: 18px; line-height: 1.2; }
.toast-success .toast-icon { color: #9CC48F; }
.toast-error .toast-icon { color: #FF7A72; }
.toast-warning .toast-icon { color: #F2C14E; }
.toast-info .toast-icon { color: #B9B9B6; }
.toast-message { flex: 1 1 auto; line-height: 1.45; padding-top: 1px; }
.toast-close { border: 0; background: none; color: #8E8E8B; font-size: 16px; padding: 0 2px; cursor: pointer; line-height: 1.2; }
.toast-close:hover { color: var(--noe-white); }

/* Password show/hide toggle — paired with initPasswordToggles() in js/src/utils.js. */
.password-toggle-wrap { position: relative; display: block; }
.password-toggle-wrap input { padding-right: 36px; }
.password-toggle-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    opacity: 0.55;
    padding: 4px 6px;
    line-height: 1;
    font-size: 1.15rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
}
.password-toggle-btn:hover { opacity: 1; background: rgba(127, 127, 127, 0.12); }

/* ---------- Aziende: the company the panel works in (brands.js) ---------- */

/* The company's colour is data (brands.color), like a tag's: it arrives as --dot on the element */
.brand-dot {
    display: inline-block;
    flex: 0 0 auto;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--dot, var(--color-text-faint));
}
.brand-dot-lg { width: 14px; height: 14px; margin-top: 4px; }

/* The selector in the sidebar header: where you work, and the way to another company */
.brand-switch { position: relative; margin-top: 18px; }
.brand-switch:empty { display: none; }
.brand-current {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--color-sidebar-border);
    border-radius: var(--radius);
    background: transparent;
    color: var(--noe-white);
    font: inherit;
    text-align: left;
}
button.brand-current { cursor: pointer; transition: background-color 0.15s, border-color 0.15s; }
button.brand-current:hover,
button.brand-current[aria-expanded="true"] { background: var(--color-sidebar-hover); border-color: var(--color-sidebar-raised); }
.brand-current-text { display: flex; flex: 1 1 auto; flex-direction: column; min-width: 0; line-height: 1.25; }
.brand-current-label {
    font-family: var(--font-heading);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-sidebar-label);
}
.brand-current-name { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-chevron { color: var(--color-sidebar-text); font-size: 18px; line-height: 1; }

/* Things to do: on the button for the other companies (a bubble on its corner: the name keeps its room), in the
   menu for each one. The deep red of the alerts (white on the brand red is too weak at this size) */
.brand-elsewhere {
    position: absolute;
    top: -7px;
    right: -7px;
    min-width: 18px;
    padding: 0 5px;
    border: 2px solid var(--color-sidebar);
    border-radius: var(--radius-pill);
    background: var(--color-error-text);
    color: var(--noe-white);
    font-size: 10.5px;
    font-weight: 600;
    line-height: 14px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}
.brand-todo {
    min-width: 20px;
    padding: 1px 6px;
    border-radius: var(--radius-pill);
    background: var(--color-error-text);
    color: var(--noe-white);
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.5;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.brand-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 10;
    display: grid;
    gap: 2px;
    padding: 6px;
    border: 1px solid var(--color-sidebar-raised);
    border-radius: var(--radius);
    background: var(--color-sidebar-hover);
    box-shadow: var(--shadow-pop);
}
.brand-menu[hidden] { display: none; }
.brand-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px;
    border: 0;
    border-radius: var(--radius);
    background: transparent;
    color: var(--color-sidebar-text);
    font: inherit;
    font-size: 13.5px;
    text-align: left;
    cursor: pointer;
}
.brand-option:hover,
.brand-option:focus-visible { background: var(--color-sidebar-raised); color: var(--noe-white); outline: none; }
.brand-option-name { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-check { visibility: hidden; color: var(--noe-red); font-size: 16px; line-height: 1; }
.brand-option.is-current { color: var(--noe-white); font-weight: 600; }
.brand-option.is-current .brand-check { visibility: visible; }

/* Narrow windows: the company next to the wordmark in the top bar */
.topbar-brand { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; align-self: center; font-size: 13px; color: var(--color-sidebar-text); }
.topbar-brand-name { max-width: 40vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Impostazioni › Aziende */
.brand-list { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.brand-card {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 14px;
    padding: 18px 20px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
}
.brand-card-body { flex: 1 1 320px; min-width: 0; }
.brand-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.brand-card-name { font-family: var(--font-heading); font-size: 16px; font-weight: 700; text-decoration: none; }
.brand-card-context { margin: 0 0 8px; color: var(--color-text-muted); font-size: 13px; line-height: 1.5; }
.brand-card-missing { display: flex; gap: 6px; margin: 0 0 8px; color: var(--color-warning-text); font-size: 13px; line-height: 1.5; }
.brand-card-missing .mdi { color: var(--color-warning-dot); font-size: 16px; line-height: 1.2; }
.brand-card-usage { margin: 0; color: var(--color-text-faint); font-size: 12.5px; }
.brand-card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.brand-context { min-height: 200px; line-height: 1.55; resize: vertical; }
.brand-context-hint { display: flex; gap: 12px; align-items: baseline; }
.form-row-short .form-control { max-width: 160px; }

/* The companies of a person: chips in the list, check boxes in the form */
.col-brands { min-width: 160px; }
.brand-chips { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.brand-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; white-space: nowrap; }
.brand-chips-all { color: var(--color-text-muted); font-size: 13px; }
.brand-chips-none { color: var(--color-error-text); font-size: 13px; }
.brand-choices { display: flex; flex-wrap: wrap; gap: 8px; }
.brand-choice {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color 0.15s, background-color 0.15s;
}
.brand-choice:hover { border-color: var(--color-border-strong); background: var(--color-surface-hover); }
.brand-choice:has(input:checked) { border-color: var(--noe-black); box-shadow: inset 0 0 0 1px var(--noe-black); }
.brand-choice input { margin: 0; accent-color: var(--noe-black); }

/* Shared views (Calendario, Statistiche): the companies on screen, one toggle each (brands.renderFilter). Off = the dot
   fades and the text goes muted; on = the black inset border of a chosen company, as in the person's form */
.brand-filter { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.brand-toggle {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 12px;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-pill);
    background: var(--color-surface);
    color: var(--color-text-muted);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s, color 0.15s;
}
.brand-toggle .brand-dot { opacity: 0.3; transition: opacity 0.15s; }
.brand-toggle:hover { color: var(--color-text); border-color: var(--noe-black); }
.brand-toggle.is-on { color: var(--color-text); border-color: var(--noe-black); box-shadow: inset 0 0 0 1px var(--noe-black); }
.brand-toggle.is-on .brand-dot { opacity: 1; }
.brand-toggle:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
/* The company of an item when more than one is on screen */
.cal-item-brand { width: 7px; height: 7px; align-self: center; }
.uns-brand, .stats-brand { display: inline-flex; align-items: center; gap: 5px; }
.uns-brand .brand-dot, .stats-brand .brand-dot, .stats-follower-sub .brand-dot { width: 8px; height: 8px; }

/* Canali: the channels no company has yet */
.unassigned-section .provider-icons .mdi { font-size: 22px; color: var(--color-warning-dot); }

/* Upload dock: a file going to another company than the one on screen */
.upload-brand { display: block; font-size: 12px; color: var(--color-text-muted); }

/* Nuovo report: the company has no description for the AI */
.report-context-missing { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 16px; }

/* Impostazioni › Profili: who can be tagged (profiles.js) */
.profiles-lead p { margin: 0 0 8px; }
.profiles-how { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; font-size: 13px; }
.profiles-how li { display: flex; gap: 8px; align-items: flex-start; }
.profiles-how .mdi { flex: 0 0 auto; font-size: 16px; line-height: 1.2; color: var(--color-text-faint); }
.profile-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.profile-list.is-archived .profile-card { background: var(--color-surface-sunken); }
.profile-list.is-archived .profile-card-name { color: var(--color-text-muted); }
.profiles-subtitle { margin: 28px 0 10px; font-size: 14px; font-weight: 700; color: var(--color-text-muted); }
.profile-card {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 12px 14px;
    padding: 14px 18px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
}
.profile-card .avatar { flex: 0 0 auto; }
.profile-card-body { flex: 1 1 300px; min-width: 0; }
.profile-card-name { display: inline-block; margin-bottom: 4px; font-family: var(--font-heading); font-size: 15px; font-weight: 700; text-decoration: none; }
.profile-places { display: flex; flex-wrap: wrap; gap: 2px 16px; margin: 0 0 4px; padding: 0; list-style: none; font-size: 13px; }
.profile-place { display: inline-flex; align-items: baseline; gap: 5px; min-width: 0; }
.profile-place .mdi { font-size: 15px; color: var(--color-text-muted); }
.profile-place a { overflow-wrap: anywhere; }
.profile-place-how { color: var(--color-text-faint); font-size: 12px; white-space: nowrap; }
.profile-card-missing { margin: 0 0 4px; color: var(--color-warning-text); font-size: 13px; }
.profile-card-notes { margin: 0 0 4px; color: var(--color-text-muted); font-size: 13px; white-space: pre-line; }
.profile-card-usage { margin: 0; color: var(--color-text-faint); font-size: 12.5px; }
.profile-card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
span.profile-card-name { color: var(--color-text); }
/* One's own profile on top (0017): the card, or the invitation to add it */
.profiles-subtitle.is-first { margin-top: 8px; }
.profiles-mine-empty {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 14px;
    padding: 14px 18px;
    border: 1px dashed var(--color-border-strong);
    border-radius: var(--radius);
    background: var(--color-surface);
}
.profiles-mine-empty .avatar { flex: 0 0 auto; }
.profiles-mine-empty p { flex: 1 1 320px; margin: 0; color: var(--color-text-muted); font-size: 13.5px; }
.profiles-mine-hint .mdi { margin-right: 2px; color: var(--color-text-faint); }

/* Composer: the tagged profiles of the post, and how each channel tags them */
.profile-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 10px; padding: 0; list-style: none; }
.profile-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 100%;
    padding: 4px 4px 4px 6px;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-pill);
    background: var(--color-surface);
}
.profile-chip .avatar-sm { width: 26px; height: 26px; font-size: 10.5px; }
.profile-chip-text { display: flex; flex-direction: column; min-width: 0; font-size: 13px; line-height: 1.25; }
.profile-chip-where { color: var(--color-text-faint); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-chip.is-archived { border-style: dashed; }
.profile-chip .btn-icon { width: 28px; height: 28px; font-size: 16px; }
.profiles-none { margin: 0 0 10px; color: var(--color-text-muted); font-size: 13px; }
.profile-add-line .form-select { max-width: 360px; }
.target-tags { margin: -4px 0 14px; padding: 10px 12px; border: 1px solid var(--color-divider); border-radius: var(--radius); background: var(--color-surface-sunken); font-size: 13px; }
.target-tags-title { margin: 0 0 6px; font-weight: 600; }
.target-tags-list { display: grid; gap: 3px; margin: 0; padding: 0; list-style: none; }
.target-tags-list li { display: flex; gap: 6px; align-items: baseline; }
.target-tags-list li > strong { flex: 0 0 auto; white-space: nowrap; }
.target-tags-list .target-tags-how { flex: 1 1 auto; min-width: 0; }
.target-tags-list .mdi { flex: 0 0 auto; color: var(--color-text-muted); }
.target-tags-list .is-manual .mdi { color: var(--color-warning-dot); }
.target-tags-list .is-none { color: var(--color-text-faint); }
.target-tags-list .is-none .mdi { color: var(--color-text-faint); }
.target-tags-how { color: var(--color-text-muted); }
.target-tags-list .is-none .target-tags-how { color: var(--color-text-faint); }

/* A channel out with tags to add by hand (templates/postTagTodo): same frame as the publication state */
.tag-todo {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 8px 10px;
    margin: 0 0 14px;
    padding: 10px 12px;
    border: 1px solid var(--color-warning-border);
    border-radius: var(--radius);
    background: var(--color-warning-soft);
    font-size: 13px;
}
.tag-todo.is-done { border-color: var(--color-border); background: var(--color-surface-sunken); }
.tag-todo-icon { flex: 0 0 auto; font-size: 18px; line-height: 1.1; color: var(--color-warning-dot); }
.tag-todo.is-done .tag-todo-icon { color: var(--color-success); }
.tag-todo-body { flex: 1 1 240px; min-width: 0; }
.tag-todo-body p { margin: 0 0 4px; }
.tag-todo-how { color: var(--color-warning-text); }
.tag-todo-list { display: flex; flex-wrap: wrap; gap: 2px 14px; margin: 0; padding: 0; list-style: none; font-weight: 600; }
.tag-todo-list .mdi { font-size: 12px; font-weight: 400; }
.tag-todo.is-done .tag-todo-list { font-weight: 400; color: var(--color-text-muted); }
.tag-todo-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-left: auto; }

/* Preview: the tag mark on the media (Instagram) */
.pv-media-wrap { position: relative; }
.pv-tag-mark {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(28, 28, 28, 0.6);
    color: var(--noe-white);
    font-size: 15px;
}
.pv-vertical-frame .pv-tag-mark { top: auto; bottom: 14px; }
.pv-tagged { display: flex; gap: 6px; align-items: baseline; margin: 0; padding: 0 14px 6px; font-size: 12.5px; color: var(--color-text-muted); overflow-wrap: anywhere; }

/* Home: exits with profiles to tag by hand */
.dash-totag-item { gap: 10px; }
.dash-totag-main { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; min-width: 0; padding: 9px 4px; }
.dash-totag-main .dash-item-title { color: inherit; text-decoration: none; }
.dash-totag-main .dash-item-title:hover { text-decoration: underline; }
.dash-totag-who { font-size: 12.5px; overflow-wrap: anywhere; }
.dash-totag-actions { display: flex; align-items: center; gap: 4px; align-self: center; }

/* Home: the brand's profiles, to open them and to act as the Page as soon as a post is out */
.dash-page { display: flex; align-items: center; gap: 10px; }
.dash-page-main { display: flex; align-items: center; gap: 8px; flex: 1 1 auto; min-width: 0; padding: 9px 4px; color: inherit; text-decoration: none; }
.dash-page-main:hover .dash-page-name { text-decoration: underline; }
.dash-page-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-page-handle { font-size: 12.5px; color: var(--color-text-muted); white-space: nowrap; }
.dash-page-manage { flex: 0 0 auto; white-space: nowrap; }
/* Exits: two links on the right leave less room; the date line wraps as text, the platform mark stays beside it */
.dash-recent .dash-item-meta { flex-wrap: nowrap; align-items: flex-start; }
.dash-recent .dash-item-meta > span:last-child { min-width: 0; }

/* A post published outside the suite and found on the Page (posts.origin = external, migrations/0019) */
.post-origin { font-size: 11.5px; font-weight: 600; color: var(--color-text-muted); white-space: nowrap; }

/* Composer, «Consigli» tab (advisor.js, templates/postAdvice): score, what to do, timing, texts, images, topics */
.side-advice { display: flex; flex-direction: column; gap: 14px; font-size: 13.5px; }
.advice-run { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.advice-intro, .advice-note, .advice-limit, .advice-foot, .advice-when, .advice-muted { margin: 0; color: var(--color-text-muted); }
.advice-limit, .advice-foot, .advice-when { font-size: 12px; }
.advice-error { margin: 0; color: var(--color-error-text); }
.advice-wait { margin: 0; color: var(--color-text-muted); }
.advice-stale, .advice-capped { display: flex; gap: 6px; margin: 0; padding: 8px 10px; border: 1px solid var(--color-warning-border); border-radius: var(--radius); background: var(--color-warning-soft); color: var(--color-warning-text); }
.advice-head { display: flex; align-items: center; gap: 14px; padding: 12px; border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-surface); }
.advice-score { flex: 0 0 auto; display: flex; align-items: baseline; justify-content: center; width: 72px; height: 72px; border-radius: 50%; border: 4px solid var(--color-border-strong); padding-top: 18px; outline: none; }
.advice-score:focus-visible { box-shadow: 0 0 0 3px var(--color-focus); }
.advice-score-n { font-family: var(--font-heading); font-size: 24px; font-weight: 700; line-height: 1; }
.advice-score-of { font-size: 11px; color: var(--color-text-muted); }
.advice-head.is-alto .advice-score { border-color: var(--color-success); }
.advice-head.is-medio .advice-score { border-color: var(--color-warning-dot); }
.advice-head.is-basso .advice-score { border-color: var(--color-error-text); }
.advice-head-text { min-width: 0; }
.advice-level { margin: 0; font-weight: 700; }
.advice-head.is-alto .advice-level { color: var(--color-success-text); }
.advice-head.is-medio .advice-level { color: var(--color-warning-text); }
.advice-head.is-basso .advice-level { color: var(--color-error-text); }
.advice-verdict { margin: 2px 0; }
.advice-block { padding-top: 12px; border-top: 1px solid var(--color-divider); }
.advice-title { margin: 0 0 8px; font-family: var(--font-heading); font-size: 14px; font-weight: 700; }
.advice-block.is-first .advice-title { color: var(--color-error-text); }
.advice-sub { margin: 8px 0 4px; font-size: 12.5px; font-weight: 600; color: var(--color-text-muted); }
.advice-tips { display: flex; flex-direction: column; gap: 10px; margin: 0; padding-left: 20px; }
.advice-tip p { margin: 0; }
.advice-tip-title { font-weight: 600; }
.advice-tip.is-alta::marker { color: var(--color-error-text); font-weight: 700; }
.advice-factors { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }
.advice-factor { display: grid; grid-template-columns: 9.5em 1fr auto; align-items: center; gap: 2px 8px; }
.advice-factor-label { font-size: 12.5px; }
.advice-bar { height: 6px; border-radius: var(--radius-pill); background: var(--color-surface-sunken); overflow: hidden; }
.advice-bar span { display: block; height: 100%; background: var(--color-data); }
.advice-factor.is-weak .advice-bar span { background: var(--color-error-text); }
.advice-factor-n { font-size: 12px; color: var(--color-text-muted); font-variant-numeric: tabular-nums; }
.advice-factor-note { grid-column: 1 / -1; font-size: 12px; color: var(--color-text-muted); }
.advice-time { display: flex; align-items: center; gap: 4px; margin: 0; }
.advice-time-why { margin: 0 0 8px 24px; font-size: 12.5px; }
.advice-slots { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; list-style: none; font-size: 12.5px; }
.advice-image { display: flex; gap: 10px; margin-bottom: 10px; }
.advice-thumb { position: relative; flex: 0 0 64px; width: 64px; height: 64px; border-radius: var(--radius); overflow: hidden; background: var(--color-media-bg); }
.advice-thumb img { width: 100%; height: 100%; object-fit: cover; }
.advice-thumb .mdi { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 24px; color: var(--color-surface); }
.advice-image-text { min-width: 0; }
.advice-image-text p { margin: 0 0 2px; }
.advice-image-title { font-weight: 600; overflow-wrap: anywhere; }
.advice-brief { padding: 8px 10px; border: 1px dashed var(--color-border-strong); border-radius: var(--radius); }
.advice-brief dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; margin: 0; }
.advice-brief dt { font-size: 12px; color: var(--color-text-muted); }
.advice-brief dd { margin: 0; }
.advice-topics { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.advice-topics p { margin: 0; }
.advice-topic-title { font-weight: 600; }
.advice-idea-meta { font-size: 12px; color: var(--color-text-muted); }
.advice-data-note { display: flex; gap: 6px; font-size: 12.5px; }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* Bootstrap overrides that must follow the components above */
.form-switch { padding-left: 0; min-height: 0; margin-bottom: 0; }
.form-switch .form-check-input { margin-left: 0; width: 2.3em; height: 1.25em; }
.toast:not(.show) { display: flex; }

/* Più storie in un post: una sopra l'altra dentro il riquadro 9:16, una in vista, con le barrette come sul telefono */
.pv-vertical-frame .pv-frame { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; aspect-ratio: auto !important; background-color: #1C1C1C; }
.pv-vertical-frame .pv-nav { z-index: 3; }
.pv-story-bars { position: absolute; left: 8px; right: 8px; top: 6px; z-index: 2; display: flex; gap: 3px; }
.pv-story-bars span { flex: 1 1 0; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, 0.4); }
.pv-story-bars span.is-on { background: #FFFFFF; }

/* Storie Instagram da pubblicare a mano (0027) */
.pub-manual-steps { margin: 6px 0 0; padding-left: 20px; font-size: 13px; }
.pub-manual-steps li { margin: 2px 0; }

/* UTM dei link al sito (0026) */
.target-utm { margin: 10px 0 0; padding: 10px 12px; border: 1px solid var(--color-divider); border-radius: 8px; background: var(--color-surface-sunken); }
.target-utm-row { display: flex; align-items: center; gap: 8px; margin: 4px 0; min-width: 0; }
.target-utm-label { flex: 0 0 auto; color: var(--color-text-muted); font-size: 12px; }
.target-utm-url { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.target-utm .form-hint { margin: 6px 0 0; }

/* Solleciti e report ai direttori (0025) */
.settings-users { border: 0; margin: 0; padding: 0; min-width: 0; }
.settings-users .settings-label { margin-bottom: 6px; }
.settings-user-row { display: flex; gap: 8px; align-items: center; margin: 4px 0; }
.settings-user-mail { color: var(--color-text-muted); font-size: 13px; }
.report-sent { white-space: nowrap; }

/* Report: obiettivi e contatti (0024) */
.report-goal-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.report-goal-table th, .report-goal-table td { padding: 8px 10px; border-bottom: 1px solid var(--color-divider); text-align: left; vertical-align: middle; font-weight: 400; }
.report-goal-table thead th { color: var(--color-text-muted); font-size: 12px; font-weight: 600; }
.report-goal-table tbody th { font-weight: 600; }
.report-goal-table .col-num { text-align: right; white-space: nowrap; width: 1%; }
.report-goal-monthly { display: block; color: var(--color-text-muted); font-size: 12px; font-weight: 400; }
.report-contacts-line { margin: 14px 0 0; }
.contacts-table .contact-n { width: 90px; text-align: right; }
.contacts-month { max-width: 260px; }
.contacts-history-title { margin-top: 18px; }
.contacts-history { margin: 0; padding: 0; list-style: none; font-size: 13px; color: var(--color-text-muted); columns: 2; }
.contacts-history strong { color: var(--color-text); font-weight: 600; }
.direction-goals { display: flex; flex-direction: column; gap: 8px; margin: 8px 0; }
.direction-goal { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.direction-goal .form-select { width: auto; flex: 1 1 160px; }
.direction-goal .goal-value { width: 110px; text-align: right; }
.direction-goal-text { margin: 0; }

/* Impostazioni › Luoghi */
.page-places .form-card { margin-bottom: 20px; }
.place-list { max-width: 720px; margin: 0; padding: 0; list-style: none; }
.place-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--color-divider); }
.place-row.is-archived { opacity: 0.65; }
.place-text { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; }
.place-meta { color: var(--color-text-muted); font-size: 13px; overflow-wrap: anywhere; }

/* Report: la strada, i canali, gli export, il controllo dei numeri, le domande (0022) */
.report-path { border-left: 3px solid var(--color-accent); }
.report-path-text { margin: 0 0 12px; line-height: 1.55; white-space: pre-wrap; }
.report-steps { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; list-style: none; }
.report-steps li { display: flex; gap: 12px; align-items: baseline; }
.report-steps p { margin: 2px 0 0; color: var(--color-text-muted); font-size: 13px; }
.report-step-when { flex: 0 0 72px; font-size: 12px; font-weight: 600; color: var(--color-text-muted); }
.report-channels { display: flex; flex-direction: column; gap: 18px; margin: 0; padding: 0; list-style: none; }
.report-channel > p { margin: 0 0 8px; line-height: 1.5; }
.report-numbers { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 0; }
.report-number { padding: 8px 10px; border: 1px solid var(--color-divider); border-radius: 6px; }
.report-number dt { font-size: 12px; font-weight: 500; color: var(--color-text-muted); }
.report-number dd { margin: 2px 0; font-size: 17px; font-weight: 600; }
.report-number-source { font-size: 11px; color: var(--color-text-faint); }
.report-number-source.is-export { color: var(--color-scheduled); }
.report-question { margin: 0 0 4px; }
.report-question-from { color: var(--color-text-faint); }
.report-export-rows-list { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 0; padding: 0; list-style: none; }
.report-export-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.report-export-channel { display: inline-flex; align-items: center; gap: 6px; min-width: 110px; font-weight: 500; }
.report-export-todo { flex: 1 1 220px; font-size: 12px; color: var(--color-text-muted); }
.report-export-files { flex: 1 0 100%; display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; list-style: none; font-size: 13px; }
.report-export-files:empty { display: none; }
.report-export-files li { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.report-export-list { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; font-size: 13px; }
.report-export-rows { color: var(--color-text-faint); }
.report-sheet-progress { margin: 0 24px 8px; font-size: 13px; color: var(--color-text-muted); }
.report-review-lead { margin: 4px 0 16px; color: var(--color-text-muted); }
.report-review-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.report-review-name { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; overflow-wrap: anywhere; }
.report-review-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 16px; align-items: start; }
.report-review-image img { display: block; width: 100%; height: auto; border: 1px solid var(--color-divider); border-radius: 6px; }
.report-review-table { width: 100%; margin: 10px 0; border-collapse: collapse; font-size: 13px; }
.report-review-table th { padding: 0 4px 4px; font-size: 12px; font-weight: 500; color: var(--color-text-muted); text-align: left; }
.report-review-table td { padding: 2px 4px; }
.report-review-notes { margin: 10px 0 0; font-size: 13px; color: var(--color-text-muted); }
.report-review-sub { margin: 0 0 8px; font-size: 14px; }
.report-review-foot { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; margin-bottom: 24px; }
.report-direction-image img { display: block; max-width: 100%; max-height: 320px; margin-bottom: 8px; border-radius: 6px; }
.report-message { margin-bottom: 12px; }
.report-message.is-user { padding: 8px 12px; border-radius: 6px; background: var(--color-surface-sunken); }
.report-message-body { margin: 0; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.report-message-meta { margin: 4px 0 0; font-size: 12px; color: var(--color-text-faint); }
.report-message-sources { margin: 6px 0 0; padding-left: 18px; font-size: 12px; }
.report-ask-foot { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.report-ask-wait { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--color-text-muted); }
@media (max-width: 1100px) { .report-review-body { grid-template-columns: minmax(0, 1fr); } }

/* La presentazione in PDF: una pagina 16:9 per slide, visibile solo in stampa (reportDeck.print) */
#reportPrint { display: none; }
@media print {
    @page { size: 13.333in 7.5in; margin: 0; }
    body.is-printing > *:not(#reportPrint) { display: none !important; }
    body.is-printing { background: #FFFFFF; }
    body.is-printing #reportPrint { display: block; }
    .deck-slide { position: relative; box-sizing: border-box; width: 13.333in; height: 7.5in; padding: 0.4in 0.6in; overflow: hidden; break-after: page; color: #33444F; font-family: Inter, sans-serif; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .deck-slide.is-cover { display: flex; flex-direction: column; justify-content: center; background: #1F3A52; color: #FFFFFF; }
    .deck-cover-kicker { margin: 0; font-size: 20pt; }
    .deck-cover-title { margin: 8pt 0; font-family: Montserrat, sans-serif; font-size: 46pt; font-weight: 700; }
    .deck-cover-sub { margin: 0 0 24pt; font-size: 18pt; color: #D5DDE4; }
    .deck-cover-note { margin: 0; font-size: 17pt; line-height: 1.35; }
    .deck-kicker { margin: 0; font-size: 10pt; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: #5B7083; }
    .deck-title { margin: 4pt 0 14pt; font-family: Montserrat, sans-serif; font-size: 22pt; font-weight: 700; line-height: 1.2; color: #1F3A52; }
    .deck-text { margin: 0 0 10pt; font-size: 14pt; line-height: 1.4; white-space: pre-wrap; }
    .deck-text.is-small { font-size: 11pt; color: #5B7083; }
    .deck-points { display: flex; flex-direction: column; gap: 8pt; margin: 0; padding: 0; list-style: none; font-size: 12pt; line-height: 1.35; }
    .deck-points.is-small { gap: 6pt; font-size: 10pt; }
    .deck-points strong { display: block; color: #1F3A52; }
    .deck-points span { display: block; }
    .deck-points em { display: block; color: #5B7083; }
    .deck-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 0.3in; }
    .deck-columns h3 { margin: 0 0 6pt; font-size: 13pt; color: #1F3A52; }
    .deck-table { width: 100%; border-collapse: collapse; font-size: 11pt; }
    .deck-table th { padding: 4pt 6pt; background: #1F3A52; color: #FFFFFF; text-align: left; }
    .deck-table td { padding: 4pt 6pt; border: 0.75pt solid #D5DDE4; vertical-align: top; }
    .deck-n { position: absolute; right: 0.5in; bottom: 0.25in; font-size: 9pt; color: #5B7083; }
}

/* ---- Identità del brand (#identity, identity.js, migrations/0028) ---- */
.identity-brand { color: var(--color-text-muted); font-weight: 500; }
.identity-meta { display: flex; gap: 8px; align-items: flex-start; max-width: 860px; margin: 0 0 18px; padding: 10px 14px; border: 1px solid var(--color-border); border-radius: 8px; background: var(--color-surface-sunken); color: var(--color-text-muted); font-size: 14px; }
.identity-meta code { font-size: 13px; }
/* The board as a carousel (4:5 plates) beside what to keep in mind when writing; one column when narrow */
.page-identity { container-type: inline-size; }
.identity-layout { display: grid; grid-template-columns: 1fr; gap: 24px; max-width: 1100px; }
@container (min-width: 820px) { .identity-layout { grid-template-columns: 440px 1fr; align-items: start; } }
.identity-board-show { min-width: 0; }
.identity-slides { position: relative; aspect-ratio: 4 / 5; max-width: 440px; background: var(--color-media-bg); border: 1px solid var(--color-border); border-radius: var(--radius); overflow: hidden; outline-offset: 3px; }
.identity-slide { margin: 0; position: absolute; inset: 0; }
.identity-slide img { display: block; width: 100%; height: 100%; object-fit: contain; }
.identity-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; border: 0; border-radius: var(--radius-pill); background: var(--color-surface); box-shadow: var(--shadow-pop); color: var(--color-text); font-size: 22px; display: grid; place-items: center; cursor: pointer; }
.identity-nav.is-prev { left: 10px; }
.identity-nav.is-next { right: 10px; }
.identity-nav:hover { color: var(--color-accent); }
.identity-caption { display: flex; justify-content: space-between; gap: 12px; max-width: 440px; margin: 10px 0 8px; }
.identity-caption-count { color: var(--color-text-muted); font-variant-numeric: tabular-nums; }
.identity-thumbs { display: flex; gap: 6px; max-width: 440px; overflow-x: auto; padding-bottom: 4px; }
.identity-thumb { flex: 0 0 auto; width: 48px; padding: 0; border: 2px solid transparent; border-radius: var(--radius); background: var(--color-media-bg); cursor: pointer; }
.identity-thumb img { display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 2px; }
.identity-thumb.is-active { border-color: var(--color-accent); }
.identity-side { display: grid; gap: 16px; min-width: 0; }
.identity-card { padding: 16px 18px; border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-surface); }
.identity-card h2 { margin: 0 0 12px; font-size: 16px; }
.identity-essentials { margin: 0 0 12px; padding: 0; list-style: none; display: grid; gap: 10px; }
.identity-ess-label { display: block; margin-bottom: 4px; font-size: 13px; font-weight: 600; color: var(--color-text-muted); }
.identity-note { margin: 0 0 12px; color: var(--color-text-muted); font-size: 14px; }
.identity-chip { display: inline-block; margin: 0 6px 6px 0; padding: 2px 8px; border: 1px solid var(--color-border); border-radius: 999px; font-size: 13px; background: var(--color-surface); }
.identity-chip.is-bad { border-color: var(--color-warning-border); background: var(--color-warning-soft); color: var(--color-warning-text); text-decoration: line-through; text-decoration-thickness: 1px; }
.identity-logos { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.identity-logo { display: block; width: 120px; height: 72px; padding: 8px; border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-surface); }
.identity-logo.is-dark { background: var(--color-media-dark); }
.identity-logo img { width: 100%; height: 100%; object-fit: contain; }
.identity-empty { max-width: 640px; padding: 16px 18px; border: 1px dashed var(--color-border-strong); border-radius: 8px; }
.identity-list .place-row.is-past { opacity: 0.8; }
.identity-list .is-ok { color: var(--color-success-text); }
.identity-list .is-no { color: var(--color-warning-text); }
.form-row-inline { display: flex; gap: 14px; flex-wrap: wrap; }
.form-row-inline > div { flex: 1 1 160px; }
.status-tab.is-separate { margin-left: 18px; position: relative; }
.status-tab.is-separate::before { content: ""; position: absolute; left: -10px; top: 20%; bottom: 20%; border-left: 1px solid var(--color-divider); }

/* ---------- Post section, part 1 (2026-11-30): caption as it appears, by hand, overlays ---------- */

/* The caption fields write in the font of the social networks (the render below shows it as it appears) */
.caption-field { font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; font-size: 14px; line-height: 1.45; }
.caption-render { margin-top: 14px; }
.caption-render-label { display: flex; align-items: center; gap: 6px; margin: 0 0 8px; font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--color-text-muted); }
.pv-caption-only { max-width: 520px; margin: 0; }
.pv-caption-only .pv-body { padding: 0 14px 14px; }
.pv-caption-only .preview-note { padding: 0 14px 14px; margin: 0; }
.pv-caption-title { margin: 0; padding: 0 14px 8px; font-weight: 600; }

/* Tagged profiles, date, place, UTM: one card, a block each */
.publish-block + .publish-block { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--color-divider); }
.publish-block-title { display: block; margin: 0 0 8px; font-size: 13px; font-weight: 600; color: var(--color-text); }
.publish-block .card-head { margin-bottom: 8px; }
.publish-block .card-head .publish-block-title { margin: 0; }

/* «La pubblico a mano» */
.target-manual-row.is-advised { padding: 10px 12px; border: 1px solid var(--color-warning-border); border-radius: var(--radius); background: var(--color-warning-soft); }
.target-manual-advice { display: flex; gap: 6px; margin: 6px 0 0; font-size: 13px; color: var(--color-warning-text); }
.tab-manual { font-size: 14px; color: var(--color-text-muted); }

/* Side column without the preview */
.side-empty { display: flex; gap: 8px; margin: 0; padding: 16px; font-size: 13px; color: var(--color-text-muted); }
.side-empty .mdi { font-size: 18px; color: var(--color-text-faint); }
.bt-preview-big { margin-top: 10px; font-size: 12.5px; }

/* Overlays of the composer: the concept for whoever approves, the preview almost full screen */
.composer-overlay { position: fixed; inset: 0; z-index: 1950; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--color-overlay); animation: fade-in 0.15s ease-out; }
.composer-overlay-box { display: flex; flex-direction: column; width: 100%; max-width: 640px; max-height: calc(100vh - 48px); background: var(--color-surface); border-radius: var(--radius); box-shadow: var(--shadow-pop); }
.composer-overlay.is-preview .composer-overlay-box { max-width: min(1100px, 96vw); height: calc(100vh - 48px); }
.composer-overlay-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--color-border); }
.composer-overlay-title { margin: 0; font-size: 16px; font-weight: 600; }
.composer-overlay-close { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: var(--radius); background: transparent; color: var(--color-text-muted); font-size: 22px; cursor: pointer; }
.composer-overlay-close:hover { background: var(--color-surface-sunken); color: var(--color-text); }
.composer-overlay-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 18px 22px; }
.concept-text p { margin: 0 0 10px; line-height: 1.55; }
.composer-overlay.is-preview .composer-overlay-body { display: flex; justify-content: center; }
.composer-overlay.is-preview #side-preview { width: 100%; max-width: 680px; }
.composer-overlay.is-preview .pv { max-width: 640px; font-size: 15px; }
.composer-overlay.is-preview .pv-frame { width: min(100%, calc(80vh * var(--r, 1))); }
.composer-overlay.is-preview .pv-vertical-frame { width: min(100%, calc((100vh - 220px) * 9 / 16)); }

/* One Caption with tabs «Tutte | Facebook | …» (2026-11-30) */
.caption-tabs { margin-bottom: 14px; }
.tab-own { font-size: 13px; color: var(--color-text-muted); }
.caption-render-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.caption-render-head .caption-render-label { margin: 0; }
.caption-render-switch { display: flex; gap: 4px; }
.caption-render-switch .preview-switch { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; padding: 0; border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-surface); color: var(--color-text-muted); cursor: pointer; }
.caption-render-switch .preview-switch.is-active { border-color: var(--color-text); color: var(--color-text); }

/* Approval in stages and «Cosa non funziona?» (0033, 2026-11-30) */
.post-stage { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 999px; background: var(--color-success-soft, var(--color-surface-sunken)); color: var(--color-success-text, var(--color-text)); font-size: 12px; font-weight: 600; }
.submit-intro { margin: 0 0 12px; color: var(--color-text-muted); font-size: 13.5px; }
.submit-stages { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.submit-stage { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--color-border); border-radius: var(--radius); cursor: pointer; }
.submit-stage:has(input:checked) { border-color: var(--color-text); }
.submit-stage.is-off { opacity: 0.6; cursor: not-allowed; }
.submit-stage input { margin-top: 3px; }
.submit-stage-text { display: flex; flex-direction: column; gap: 2px; }
.overlay-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.nonva-areas { margin: 0 0 14px; padding: 0; border: 0; }
.nonva-area { padding: 10px 0; border-bottom: 1px solid var(--color-divider); }
.nonva-check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.nonva-more { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 8px 0 0 24px; }
.nonva-more .nonva-note { width: 100%; }
.nonva-item { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; cursor: pointer; }
.nonva-error { display: block; }
.nonva-error[hidden] { display: none; }
.history-stage { color: var(--color-text-muted); font-weight: 400; }
.history-nonva { margin: 6px 0 0; padding: 8px 10px; border-left: 3px solid var(--color-warning-border); background: var(--color-warning-soft); border-radius: 0 var(--radius) var(--radius) 0; font-size: 13px; }
.history-nonva-title { margin: 0 0 4px; font-weight: 600; }
.history-nonva ul { margin: 0; padding-left: 16px; }
