:root {
    /* Palette Stitch (Strategy / Flow.) */
    --bg: #0f1218;
    --bg-elev: #1c2025;
    --bg-low: #1a1c1f;
    --bg-high: #282a2d;
    --border: #2a3140;
    --border-strong: #42474f;
    --text: #e2e2e6;
    --muted: #9aa3b5;
    --muted-dim: #8c919a;
    --accent: #9dcaff;
    --accent-strong: #d1e4ff;
    --accent-2: #40e0cb;
    --on-primary: #003257;
    --danger: #f07178;
    --ok: #7fd99a;
    --radius: 10px;
    --font: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: var(--font);
    background:
        radial-gradient(1200px 600px at 10% -10%, #1a2740 0%, transparent 55%),
        radial-gradient(900px 500px at 100% 0%, #132a28 0%, transparent 50%),
        var(--bg);
    color: var(--text);
    min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1.4rem;
    border-bottom: 1px solid var(--border);
    background: rgba(15, 18, 24, 0.85);
    backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
}
.brand {
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--text);
    text-decoration: none;
    font-size: 1.1rem;
}
.topbar nav { display: flex; flex-wrap: wrap; gap: 0.9rem; }
.topbar nav a { color: var(--muted); text-decoration: none; font-size: 0.92rem; }
.topbar nav a:hover { color: var(--text); }

.container {
    max-width: none;
    width: 100%;
    margin: 0 auto;
    padding: 1.6rem clamp(1.2rem, 2.5vw, 2rem) 3rem;
}
/* Alias legacy (Settings); tutto il pannello è già full-width */
.container.container-wide { max-width: none; width: 100%; }
.container.container-narrow {
    max-width: 720px;
    padding-left: 1.2rem;
    padding-right: 1.2rem;
}
h1 { margin: 0 0 0.4rem; font-size: 1.6rem; }
h2 { margin: 1.6rem 0 0.6rem; font-size: 1.1rem; color: var(--muted); font-weight: 600; }
.muted { color: var(--muted); margin-top: 0; }

.grid-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.8rem;
    margin-top: 1.2rem;
}
.grid-stats article {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    position: relative;
}
.grid-stats h2 { margin: 0 0 0.4rem; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; }
.grid-stats p { margin: 0; font-size: 1rem; }
.stat-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}
.stat-card-head h2 { margin: 0; }
.stat-help {
    flex: 0 0 auto;
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #12161f;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.stat-help:hover,
.stat-help:focus-visible {
    color: var(--text);
    border-color: var(--accent);
    outline: none;
}
.stat-help-dialog {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-elev);
    color: var(--text);
    padding: 0;
    max-width: min(420px, calc(100vw - 2rem));
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}
.stat-help-dialog::backdrop {
    background: rgba(8, 10, 14, 0.65);
}
.stat-help-dialog-inner {
    padding: 1.1rem 1.15rem 1rem;
}
.stat-help-dialog h3 {
    margin: 0 0 0.55rem;
    font-size: 1.05rem;
}
.stat-help-dialog p {
    margin: 0;
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.5;
}
.stat-help-dialog-actions {
    margin-top: 1rem;
    display: flex;
    justify-content: flex-end;
}

.checklist { color: var(--muted); line-height: 1.6; }
.checklist code { color: var(--accent-2); }

.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    border: 1px solid var(--border);
}
.alert-error { background: rgba(240, 113, 120, 0.12); border-color: var(--danger); color: #ffc4c7; }
.alert-ok { background: rgba(127, 217, 154, 0.12); border-color: var(--ok); color: #c9f0d4; }

.login-body { display: grid; place-items: center; }
.login-wrap { width: min(400px, 92vw); }
.login-panel {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.6rem;
}
.login-panel h1 { margin-bottom: 0.2rem; }
.stack { display: grid; gap: 0.9rem; margin-top: 1.2rem; }
label { display: grid; gap: 0.35rem; font-size: 0.9rem; color: var(--muted); }
input[type="password"],
input[type="text"],
input[type="number"],
input[type="email"],
input[type="search"],
select,
textarea {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 8px;
    padding: 0.7rem 0.8rem;
    font: inherit;
    width: 100%;
}
input[type="checkbox"],
input[type="radio"] {
    width: auto;
    accent-color: var(--accent);
}
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
}
textarea { resize: vertical; min-height: 2.5rem; }
button {
    background: var(--accent-strong);
    color: var(--on-primary);
    border: 0;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
button:hover { filter: brightness(1.06); }
button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    filter: none;
}
button.btn-secondary,
a.btn-secondary {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--muted);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
a.btn-secondary:hover {
    color: var(--text);
    text-decoration: none;
    border-color: var(--muted);
}
button.btn-secondary:hover { filter: none; color: var(--text); border-color: var(--muted); }
input[type="datetime-local"],
input[type="date"] {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 8px;
    padding: 0.7rem 0.8rem;
    font: inherit;
    color-scheme: dark;
}

/* Date field: icona custom sempre visibile + hit-area nativa trasparente */
.date-field {
    position: relative;
    display: inline-flex;
    align-items: center;
    max-width: 100%;
}
.date-field input[type="date"] {
    width: 150px;
    max-width: 100%;
    padding: 0.45rem 2.1rem 0.45rem 0.55rem;
    font-size: 0.88rem;
    color: var(--text);
    background: var(--bg);
    color-scheme: dark;
}
.date-field input[type="date"]::-webkit-calendar-picker-indicator {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    opacity: 0;
    cursor: pointer;
    background: transparent;
    filter: none;
}
.date-field-icon {
    position: absolute;
    right: 0.55rem;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    color: var(--accent);
    pointer-events: none;
    z-index: 0;
}
.date-field-icon svg {
    display: block;
}

/* Strategy hero — mobile first: stack, poi titolo | card */
.strategy-hero {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.strategy-hero-copy {
    min-width: 0;
}
.strategy-hero-copy h1 {
    margin: 0 0 0.2rem;
    font-size: 1.3rem;
    line-height: 1.2;
}
.strategy-hero-copy .muted {
    margin: 0;
    font-size: 0.85rem;
    line-height: 1.35;
    max-width: 36rem;
}
.strategy-status {
    padding: 0.55rem 0.9rem;
    margin: 0;
    background: rgba(240, 113, 120, 0.12);
    border: 1px solid rgba(240, 113, 120, 0.28);
    border-radius: var(--radius);
}
.strategy-status.is-covered {
    background: rgba(127, 217, 154, 0.12);
    border-color: rgba(127, 217, 154, 0.28);
}
.strategy-status-title {
    margin: 0;
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.25;
}
.strategy-status-meta {
    margin: 0.15rem 0 0;
    font-size: 0.78rem;
    color: var(--muted);
    line-height: 1.3;
}
@media (min-width: 640px) {
    .strategy-hero {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 1rem 1.5rem;
    }
    .strategy-hero-copy {
        flex: 1 1 auto;
    }
    .strategy-hero-copy h1 {
        font-size: 1.45rem;
    }
    .strategy-status {
        flex: 0 1 auto;
        min-width: 15rem;
        max-width: 24rem;
    }
}
@media (min-width: 960px) {
    .strategy-status {
        max-width: 26rem;
    }
}
.strategy-bento {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 1.25rem;
}
.strategy-bento-horizon {
    padding: 0.75rem 0.9rem;
    gap: 0.5rem;
}
.strategy-card-top {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.55rem 1rem;
}
.strategy-card-top-main {
    flex: 1 1 12rem;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.strategy-card-top-action {
    flex: 0 0 auto;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.35rem;
}
.strategy-card-top-action form {
    margin: 0;
}
.strategy-card-top-action button {
    width: auto;
    padding: 0.5rem 0.9rem;
    font-size: 0.88rem;
    white-space: nowrap;
}
.strategy-card-title {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text);
    font-weight: 600;
    line-height: 1.3;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}
.strategy-title-icon {
    flex: 0 0 auto;
    display: inline-flex;
    color: #4ade80;
}
.strategy-title-icon svg {
    display: block;
}
.strategy-card-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem 0.85rem;
}
.strategy-card-link {
    font-size: 0.88rem;
    font-weight: 400;
    color: var(--accent);
    text-decoration: none;
    white-space: nowrap;
}
.strategy-card-link:hover {
    color: var(--accent);
    text-decoration: underline;
}
.strategy-horizon-stat {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.3;
}
.strategy-horizon-stat.is-ok { color: var(--ok); }
.strategy-horizon-stat.is-warn { color: #ffb4b8; }
.strategy-bento-advanced {
    padding: 0.75rem 0.9rem;
    gap: 0.5rem;
}
.strategy-generate-form {
    margin: 0;
}
.strategy-generate-week {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem 0.65rem;
}
.strategy-generate-week label {
    margin: 0;
    font-size: 0.82rem;
    color: var(--muted);
    white-space: nowrap;
}
.strategy-generate-replace {
    border: 0;
    padding: 0;
    margin: 0;
    font-size: 0.78rem;
    justify-content: flex-end;
}
.strategy-list {
    display: grid;
    gap: 0.75rem;
    margin-top: 1rem;
}
.strategy-card {
    position: relative;
    background: var(--bg-low);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.9rem 1rem;
}
.strategy-card-linkable {
    display: block;
    color: inherit;
    text-decoration: none;
    transition: border-color 0.15s ease, background 0.15s ease;
    cursor: pointer;
}
.strategy-card-linkable:hover {
    border-color: rgba(157, 202, 255, 0.5);
    background: var(--bg-high);
    color: inherit;
}
.strategy-card-linkable:hover h3 {
    color: var(--accent);
}
.strategy-card-body {
    display: flex;
    gap: 0.85rem;
    align-items: flex-start;
}
.strategy-card-main { flex: 1; min-width: 0; }
.strategy-thumb {
    flex: 0 0 4.5rem;
    width: 4.5rem;
    height: 4.5rem;
    border-radius: 8px;
    background: var(--bg) center/cover no-repeat;
    border: 1px solid var(--border);
}
.strategy-thumb-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.68rem;
    color: var(--muted-dim);
    text-align: center;
    padding: 0.25rem;
    background: var(--bg);
}
.strategy-open-btn {
    position: relative;
    z-index: 2;
    display: inline-block;
    font-weight: 600;
}
.strategy-card header,
.strategy-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.55rem;
}
.strategy-card-meta .strategy-draft-line {
    margin: 0;
    flex: 1 1 auto;
    min-width: 0;
}
.strategy-card-status {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.55rem;
    margin-bottom: 0.35rem;
}
.strategy-card-day {
    margin: 0;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted-dim);
}
.strategy-card h3 {
    margin: 0 0 0.4rem;
    font-size: 0.95rem;
    font-weight: 500;
}
.strategy-meta {
    margin: 0.4rem 0 0;
    font-size: 0.78rem;
    color: var(--accent-2);
}
.strategy-draft-line { margin: 0.55rem 0 0; font-size: 0.85rem; }
.strategy-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.55rem;
}
.strategy-tag {
    font-size: 0.65rem;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    background: rgba(157, 202, 255, 0.1);
    color: var(--accent);
}
.strategy-tag-muted {
    background: rgba(66, 71, 79, 0.35);
    color: var(--muted-dim);
}
.strategy-badge {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    white-space: nowrap;
}
/* Stessi colori del calendario: programmato / pubblicato / errore */
.strategy-badge-programmato {
    background: #f59e0b;
    color: #1a1205;
}
.strategy-badge-pubblicato {
    background: #7fd99a;
    color: #0f1a12;
}
.strategy-badge-errore {
    background: #f07178;
    color: #1a0a0c;
}
.strategy-badge-ok { background: rgba(127, 217, 154, 0.2); color: #c9f0d4; }
.strategy-badge-ready { background: rgba(157, 202, 255, 0.2); color: #cfe4ff; }
.strategy-badge-warn { background: rgba(245, 158, 11, 0.2); color: #ffd89a; }
.strategy-badge-muted { background: rgba(154, 163, 181, 0.15); color: var(--muted-dim); }
@media (min-width: 720px) {
    .strategy-bento {
        grid-template-columns: 1fr 1fr;
        align-items: stretch;
    }
    .strategy-bento > .page-card {
        grid-column: auto;
        min-width: 0;
        height: 100%;
    }
    .strategy-list.list-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (min-width: 1200px) {
    .strategy-list.list-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    .strategy-card-body { flex-direction: column; }
    .strategy-thumb,
    .strategy-thumb-empty {
        width: 100%;
        flex: none;
        height: 7rem;
    }
}
.schedule-box {
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: rgba(23, 27, 36, 0.7);
}

/* Calendario — stesso linguaggio di Strategy */
.calendar-page .cal-month-card {
    gap: 0.75rem;
    padding: 0.9rem 1rem 1rem;
}
.cal-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 0.65rem 1rem;
}
.cal-toolbar-title {
    margin: 0;
    justify-self: start;
}
.cal-nav {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-self: center;
    gap: 0.45rem;
    flex-wrap: nowrap;
}
.cal-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: rgba(23, 27, 36, 0.7);
    color: var(--text);
    text-decoration: none;
    font-size: 1rem;
    line-height: 1;
}
.cal-nav-btn:hover {
    text-decoration: none;
    border-color: rgba(157, 202, 255, 0.45);
    color: var(--accent);
}
.cal-nav-today {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 3.4rem;
    height: 2rem;
    padding: 0 0.65rem;
    border-radius: 8px;
    border: 1px solid rgba(157, 202, 255, 0.35);
    background: rgba(157, 202, 255, 0.1);
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 600;
    text-decoration: none;
}
.cal-nav-today:hover { text-decoration: none; filter: brightness(1.08); }
.cal-nav-today.is-current {
    opacity: 0.55;
    cursor: default;
    pointer-events: none;
}
.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.35rem;
}
.cal-dow {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    padding: 0.15rem 0.2rem 0.35rem;
    text-align: center;
    font-weight: 600;
}
.cal-cell {
    min-height: 6.5rem;
    background: rgba(12, 14, 18, 0.45);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.35rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.cal-empty {
    min-height: 6.5rem;
    background: rgba(12, 14, 18, 0.2);
    border-color: rgba(154, 163, 181, 0.12);
    pointer-events: none;
}
.cal-today {
    border-color: rgba(157, 202, 255, 0.55);
    box-shadow: inset 0 0 0 1px rgba(157, 202, 255, 0.2);
    background: rgba(157, 202, 255, 0.06);
}
.cal-daynum {
    font-size: 0.78rem;
    color: var(--muted);
    font-weight: 600;
}
.cal-daynum.is-today {
    color: var(--accent);
    font-weight: 700;
}
.cal-item {
    display: block;
    font-size: 0.72rem;
    line-height: 1.3;
    padding: 0.35rem 0.4rem;
    border-radius: 6px;
    text-decoration: none;
    color: var(--text);
    border: 1px solid transparent;
}
.cal-item:hover { text-decoration: none; filter: brightness(1.1); }
.cal-item-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.25rem;
    margin-bottom: 0.15rem;
}
.cal-item-body {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.35rem;
}
.cal-item-hook {
    flex: 1 1 auto;
    min-width: 0;
}
.cal-channels {
    flex: 0 0 auto;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    opacity: 0.85;
    line-height: 1.2;
}
.cal-badge {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.08rem 0.28rem;
    border-radius: 3px;
    line-height: 1.2;
}
.cal-item-time { color: inherit; opacity: 0.85; font-size: 0.68rem; font-variant-numeric: tabular-nums; }

/* Programmato = ambra · Pubblicato = verde · Errore = rosso */
.cal-item-scheduled {
    background: rgba(245, 158, 11, 0.18);
    border-color: rgba(245, 158, 11, 0.55);
    color: #ffd89a;
}
.cal-item-scheduled .cal-badge {
    background: #f59e0b;
    color: #1a1205;
}

.cal-item-published {
    background: rgba(127, 217, 154, 0.16);
    border-color: rgba(127, 217, 154, 0.5);
    color: #c9f0d4;
}
.cal-item-published .cal-badge {
    background: #7fd99a;
    color: #0f1a12;
}

.cal-item-failed {
    background: rgba(240, 113, 120, 0.16);
    border-color: rgba(240, 113, 120, 0.55);
    color: #ffc9cd;
}
.cal-item-failed .cal-badge {
    background: #f07178;
    color: #1a0a0c;
}

.cal-item-other {
    background: rgba(154, 163, 181, 0.12);
    border-color: rgba(154, 163, 181, 0.35);
    color: var(--muted);
}
.cal-item-other .cal-badge {
    background: var(--muted);
    color: var(--bg);
}

.cal-legend {
    margin: 0;
    display: flex;
    gap: 0.35rem;
    align-items: center;
    flex-wrap: wrap;
    justify-self: end;
    justify-content: flex-end;
}
.cal-legend-sample {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    cursor: default;
    padding: 0.28rem 0.4rem;
}
.cal-legend-sample:hover { filter: none; }
@media (max-width: 720px) {
    .cal-toolbar {
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "title title"
            "nav legend";
    }
    .cal-toolbar-title { grid-area: title; }
    .cal-nav { grid-area: nav; justify-self: start; }
    .cal-legend { grid-area: legend; }
    .cal-cell,
    .cal-empty { min-height: 4.5rem; }
    .cal-item { font-size: 0.65rem; }
    .calendar-page .cal-month-card { padding: 0.75rem; }
}

/* Insights — stesso linguaggio di Strategy */
.insights-page .page-card {
    margin-bottom: 1rem;
}
.insights-toolbar {
    gap: 0.75rem;
    padding: 0.9rem 1rem;
}
.insights-channels-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    width: 100%;
}
.insights-channels-grid > .page-card {
    margin-bottom: 0;
    min-width: 0;
    grid-column: auto;
}
.insights-channel-card .insights-stats {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 0.55rem;
    justify-content: stretch;
}
.insights-channel-card .insights-stats article {
    width: auto;
    max-width: none;
    min-width: 0;
    padding: 0.55rem 0.55rem 0.5rem;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 0.35rem;
    min-height: 5.25rem;
}
.insights-channel-card .insights-stat-label {
    margin: 0;
    font-size: 14px;
    line-height: 1.25;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.insights-channel-card .insights-stat-value-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.25rem;
    margin-top: auto;
}
.insights-channel-card .insights-stat-value-row p {
    margin: 0;
    font-size: 1.55rem;
    font-weight: 600;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    min-width: 0;
}
.insights-channel-card .insights-stat-value-row .stat-help {
    width: 1.15rem;
    height: 1.15rem;
    font-size: 0.7rem;
}
@media (min-width: 900px) {
    .insights-channels-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        align-items: start;
    }
}
.insights-toolbar-filters {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    min-width: 0;
    flex: 1 1 auto;
}
.insights-filter-rows {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}
.insights-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}
.insights-custom-range {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem 0.65rem;
    align-items: center;
    margin-top: 0.15rem;
}
.insights-custom-range label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.82rem;
    color: var(--muted);
}
.insights-custom-range input[type="date"] {
    font: inherit;
    color: var(--text);
    background: rgba(12, 14, 18, 0.55);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.3rem 0.45rem;
}
.insights-card-meta {
    margin: 0;
    font-size: 0.78rem;
    line-height: 1.35;
    text-align: right;
    max-width: 28rem;
}
.insights-empty {
    margin: 0;
}
.insights-stats {
    margin: 0;
}
.insights-metric-group {
    grid-column: 1 / -1;
    margin: 0.85rem 0 0;
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}
.insights-details {
    margin-top: 0;
}
.insights-channel-footer {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    margin-top: 0.85rem;
    flex-wrap: wrap;
}
.insights-channel-footer-main {
    flex: 1 1 12rem;
    min-width: 0;
}
.insights-metrics-pick {
    flex: 0 0 auto;
    margin-left: auto;
    align-self: flex-start;
    font-size: 0.85rem;
    padding: 0.35rem 0.75rem;
}
.insights-metrics-dialog {
    max-width: min(560px, calc(100vw - 2rem));
    width: min(560px, calc(100vw - 2rem));
    max-height: min(92vh, 820px);
    height: min(92vh, 820px);
    overflow: hidden;
}
.insights-metrics-dialog .stat-help-dialog-inner {
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
}
.insights-metrics-dialog-lead {
    margin: 0 0 0.75rem !important;
    flex: 0 0 auto;
}
.insights-metrics-dialog-toolbar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.65rem;
    flex: 0 0 auto;
}
.insights-metrics-dialog-toolbar .btn-secondary {
    font-size: 0.8rem;
    padding: 0.3rem 0.65rem;
}
.insights-metrics-list {
    overflow-x: hidden;
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding-right: 0.25rem;
    margin: 0 0 0.25rem;
    max-height: none;
}
.insights-metrics-row {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    padding: 0.45rem 0.5rem;
    border-radius: var(--radius);
    border: 1px solid color-mix(in srgb, var(--border, #333) 80%, transparent);
    cursor: pointer;
    font-size: 0.88rem;
}
.insights-metrics-row:hover {
    border-color: var(--accent);
}
.insights-metrics-row input {
    margin-top: 0.2rem;
    flex-shrink: 0;
}
.insights-metrics-row-text {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}
.insights-metrics-row-title {
    font-weight: 600;
    text-transform: capitalize;
}
.insights-metrics-row-help {
    font-size: 0.78rem;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.insights-metrics-dialog-actions {
    gap: 0.5rem;
    flex: 0 0 auto;
    margin-top: 0.75rem;
}
.insights-details > summary {
    cursor: pointer;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 600;
}
.insights-details > summary:hover {
    color: var(--text);
}
.insights-post-list {
    margin-top: 0.5rem;
}
.insights-post-metrics {
    margin-top: 0.35rem;
}
.insights-post-metrics > summary {
    cursor: pointer;
    font-size: 0.8rem;
}
.insights-post-metrics-dl {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
    gap: 0.35rem 0.75rem;
    margin: 0.4rem 0 0.6rem;
    font-size: 0.78rem;
}
.insights-post-metrics-dl div {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    border-bottom: 1px solid color-mix(in srgb, var(--border, #333) 70%, transparent);
    padding-bottom: 0.15rem;
}
.insights-post-metrics-dl dt {
    margin: 0;
    color: var(--muted);
    text-transform: capitalize;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.insights-post-metrics-dl dd {
    margin: 0;
    font-variant-numeric: tabular-nums;
}
.insights-demo-head {
    margin: 0.85rem 0 0.25rem;
    justify-content: flex-start;
    gap: 0.35rem;
}
.insights-demo-line {
    margin: 0;
    font-size: 0.88rem;
}
.insights-table-wrap {
    overflow: auto;
    margin-top: 0.75rem;
}
.insights-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.insights-table th,
.insights-table td {
    padding: 0.4rem 0.45rem;
    border-bottom: 1px solid var(--border);
}
.insights-table th {
    text-align: left;
    color: var(--muted);
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.insights-table th.num,
.insights-table td.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.insights-llm-preview {
    margin: 0;
    white-space: pre-wrap;
    max-height: 280px;
    overflow: auto;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #0b0e13;
    color: var(--accent-2);
    font-family: var(--font-mono);
    font-size: 0.8rem;
}
.insights-post-card .insights-post-head {
    margin: 0 0 0.5rem;
    font-size: 0.9rem;
    line-height: 1.4;
}
.insights-sync-meta {
    margin: 0.5rem 0 0;
    font-size: 0.78rem;
}
@media (max-width: 720px) {
    .insights-card-meta {
        text-align: left;
        max-width: none;
    }
    .insights-toolbar .strategy-card-top-action {
        width: 100%;
    }
    .insights-toolbar .strategy-card-top-action button {
        width: 100%;
    }
}


/* Overlay operazione in corso (submit lunghi: Strategy, LLM, media…) */
.flow-busy {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(8, 10, 14, 0.72);
    backdrop-filter: blur(3px);
}
.flow-busy[hidden] {
    display: none !important;
}
.flow-busy-card {
    width: min(22rem, calc(100vw - 2rem));
    padding: 1.5rem 1.35rem;
    border-radius: 12px;
    border: 1px solid #2a3140;
    background: #141820;
    text-align: center;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
}
.flow-busy-spinner {
    width: 2.25rem;
    height: 2.25rem;
    margin: 0 auto 1rem;
    border-radius: 50%;
    border: 3px solid #2a3140;
    border-top-color: #5b8cff;
    animation: flow-busy-spin 0.75s linear infinite;
}
.flow-busy-label {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text);
}
.flow-busy-hint {
    margin: 0.55rem 0 0;
    font-size: 0.85rem;
    color: var(--muted);
}
body.flow-busy-open {
    overflow: hidden;
}
@keyframes flow-busy-spin {
    to { transform: rotate(360deg); }
}

/* Navigazione piani Strategy (settimane) */
.strategy-bento-weeks,
.strategy-bento-editorial {
    padding: 0.75rem 0.9rem;
    gap: 0.55rem;
}
.strategy-bento-weeks .plan-nav-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.4rem;
}
.strategy-bento-weeks .plan-nav-btn {
    min-width: 0;
    max-width: 100%;
    width: 100%;
    padding: 0.45rem 0.5rem;
    font-size: 0.8rem;
    background: var(--bg-low);
}
.strategy-bento-weeks .plan-nav-meta {
    font-size: 0.72rem;
}
@media (min-width: 480px) {
    .strategy-bento-weeks .plan-nav-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media (min-width: 900px) {
    .strategy-bento-weeks .plan-nav-row {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
    .strategy-bento-weeks .plan-nav-btn {
        font-size: 0.82rem;
        padding: 0.5rem 0.45rem;
    }
}
.strategy-editorial-meta {
    margin: 0;
    font-size: 0.82rem;
}
.plan-nav-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}
.plan-nav-btn {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
    min-width: 7.5rem;
    padding: 0.65rem 0.85rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-elev);
    color: var(--text);
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.25;
}
a.plan-nav-btn:hover {
    text-decoration: none;
    border-color: var(--accent);
    color: var(--text);
}
.plan-nav-btn.is-active {
    border-color: var(--accent);
    background: rgba(61, 156, 240, 0.14);
    box-shadow: inset 0 0 0 1px rgba(61, 156, 240, 0.35);
}
.plan-nav-btn.is-disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.plan-nav-meta {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--muted);
}

/* ——— Shared page shells (dense / full-width) ——— */
.page {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.page-hero h1 { margin-bottom: 0.25rem; }
.page-hero .muted { margin: 0; }
.page-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 1.15rem;
}
.page-card {
    grid-column: span 12;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.35rem;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}
.page-card--half { grid-column: span 12; }
.page-card--third { grid-column: span 12; }
.page-card--grow { min-width: 0; }
.page-card h2,
.page-card-head h2 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text);
    font-weight: 600;
}
.page-card-head .muted {
    margin: 0.3rem 0 0;
    font-size: 0.85rem;
}
.page-actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    align-items: center;
}
.list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
    gap: 0.85rem;
}
.list-grid .strategy-card,
.list-grid .page-card {
    margin: 0;
    height: 100%;
}
.draft-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.15rem;
    align-items: start;
}
.draft-media-preview img,
.draft-media-preview video {
    max-width: min(100%, 420px);
    border-radius: 10px;
    border: 1px solid var(--border);
}
.reel-status-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}
.reel-review {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    align-items: start;
}
.reel-frame {
    width: min(100%, 280px);
    margin: 0 auto;
    aspect-ratio: 9 / 16;
    background: #0b0e13;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}
.reel-frame video {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    background: #000;
    max-width: none;
    border: 0;
    border-radius: 0;
}
.reel-frame.is-empty {
    display: flex;
    align-items: center;
    justify-content: center;
}
.reel-placeholder {
    text-align: center;
    padding: 1rem;
}
.reel-placeholder p { margin: 0.25rem 0; }
.reel-meta { min-width: 0; }
.reel-cover {
    display: grid;
    gap: 0.35rem;
}
.reel-cover img {
    width: 88px;
    height: 88px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border);
}
.image-prompt-preview {
    display: grid;
    gap: 0.55rem;
    padding: 0.85rem 1rem;
    border: 1px dashed var(--border);
    border-radius: 8px;
    background: #0b0e13;
}
.image-prompt-preview-head {
    display: grid;
    gap: 0.2rem;
}
.image-prompt-preview-head strong {
    color: var(--text);
    font-size: 0.92rem;
}
.image-prompt-preview pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 220px;
    overflow: auto;
    padding: 0.75rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #12161f;
    color: var(--accent-2);
    font-family: ui-monospace, Consolas, monospace;
    font-size: 0.78rem;
    line-height: 1.45;
}
@media (min-width: 720px) {
    .reel-review {
        grid-template-columns: minmax(200px, 280px) minmax(0, 1fr);
    }
    .reel-frame { margin: 0; }
}
.draft-slides {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.draft-slides img {
    max-width: 140px;
    border-radius: 8px;
    border: 1px solid var(--border);
}
.notes-draft-item {
    margin: 0;
    padding: 0.9rem 1rem;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.notes-draft-item.is-failed {
    border-color: #6b2a30;
}

/* Appunti — layout densità Strategy */
.notes-page { gap: 1rem; }
.notes-source-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}
.notes-filter-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.7rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-elev);
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
}
.notes-filter-chip:hover {
    color: var(--text);
    text-decoration: none;
    border-color: var(--accent);
}
.notes-filter-chip.is-active {
    border-color: var(--accent);
    background: rgba(61, 156, 240, 0.14);
    color: var(--text);
    box-shadow: inset 0 0 0 1px rgba(61, 156, 240, 0.35);
}
.notes-source-manual {
    background: #8b7cf6;
    color: #120f28;
}
.notes-source-strategy {
    background: #38bdf8;
    color: #0a1a24;
}
.notes-compose .notes-llm-status {
    flex: 0 1 auto;
    max-width: min(100%, 26rem);
}
.notes-compose .notes-llm-status .strategy-status-title {
    font-size: 0.82rem;
}
.notes-compose {
    padding: 0.85rem 1rem;
    gap: 0.65rem;
}
.notes-compose-form {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    margin: 0;
}
.notes-compose-body textarea {
    width: 100%;
    min-height: 4.2rem;
}
.notes-compose-opts {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.55rem;
    align-items: end;
}
.notes-compose-opts label {
    margin: 0;
    font-size: 0.78rem;
    color: var(--muted);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.notes-compose-action button {
    width: 100%;
    padding: 0.5rem 0.9rem;
    font-size: 0.88rem;
}
.notes-bento {
    margin-bottom: 0;
}
.notes-list-card {
    padding: 0.85rem 1rem;
    gap: 0.55rem;
}
.notes-card-hint {
    margin: 0;
    font-size: 0.8rem;
}
.notes-items {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}
.notes-item {
    margin: 0;
    padding: 0.55rem 0.65rem;
    background: var(--bg-low);
    border: 1px solid rgba(66, 71, 79, 0.4);
    border-radius: 8px;
}
.notes-item.is-failed,
.notes-draft.is-failed {
    border-color: rgba(240, 113, 120, 0.45);
}
.notes-item summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.45rem;
    cursor: pointer;
    align-items: center;
}
.notes-item summary::-webkit-details-marker { display: none; }
.notes-item-id {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--accent-2);
}
.notes-item-preview {
    margin: 0;
    flex: 1 1 10rem;
    font-size: 0.85rem;
    color: var(--text);
    line-height: 1.35;
}
.notes-item-links {
    flex: 1 1 100%;
    font-size: 0.78rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.65rem;
}
.notes-edit-form,
.notes-delete-form {
    margin: 0.65rem 0 0;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}
.notes-edit-form label {
    margin: 0;
    font-size: 0.78rem;
    color: var(--muted);
}
.notes-item-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
    margin-top: 0.35rem;
}
.notes-item-actions form { margin: 0; }
.notes-item-actions .btn-secondary,
.notes-item-actions a.btn-secondary {
    padding: 0.4rem 0.7rem;
    font-size: 0.82rem;
}
.notes-draft-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.45rem;
    margin-bottom: 0.3rem;
}
.notes-draft-note {
    font-size: 0.78rem;
}
.notes-draft-actions {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.3rem;
    margin-left: auto;
}
.notes-draft-actions form {
    margin: 0;
    display: inline;
}
.notes-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    white-space: nowrap;
    line-height: 1.2;
    text-decoration: none;
    border: 1px solid transparent;
    cursor: pointer;
    font-family: inherit;
}
a.notes-chip:hover {
    text-decoration: none;
    filter: brightness(1.08);
}
.notes-chip-ok {
    background: rgba(127, 217, 154, 0.12);
    border-color: rgba(127, 217, 154, 0.28);
    color: #c9f0d4;
}
.notes-chip-danger {
    background: rgba(240, 113, 120, 0.12);
    border-color: rgba(240, 113, 120, 0.28);
    color: #ffc9cd;
}
.notes-draft-err {
    margin: 0.25rem 0 0;
    font-size: 0.78rem;
    color: #ffb4b8;
}
@media (min-width: 720px) {
    .notes-compose-opts {
        grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
    }
    .notes-compose-action button {
        width: auto;
        white-space: nowrap;
    }
}
@media (min-width: 960px) {
    .page-card--half { grid-column: span 6; }
    .page-card--third { grid-column: span 4; }
    .draft-layout {
        grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
    }
}

/* ——— Settings (wide + dense cards) ——— */
.settings-page {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.settings-hero h1 { margin-bottom: 0.25rem; }
.settings-hero .muted { margin: 0; }
.settings-status { margin: 0; }
.settings-form { display: flex; flex-direction: column; gap: 1.25rem; }
.settings-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 1.15rem;
}
.settings-card {
    grid-column: span 12;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.35rem;
    display: flex;
    flex-direction: column;
    gap: 0.95rem;
}
.settings-card--half { grid-column: span 12; }
.settings-card-head h2 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text);
    font-weight: 600;
}
.settings-card-head .muted {
    margin: 0.3rem 0 0;
    font-size: 0.85rem;
}
.settings-card-hint {
    margin: 0;
    font-size: 0.82rem;
}
.field-grid {
    display: grid;
    gap: 0.85rem 1rem;
}
.field-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.field-grid--5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.field-grid--5 label { font-size: 0.88rem; }
.field-grid--5 input[type="number"] { min-width: 0; }
.settings-check {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 0.65rem;
    padding-top: 0.35rem;
    border-top: 1px solid rgba(42, 49, 64, 0.7);
}
.settings-check input[type="checkbox"] {
    width: auto;
    margin-top: 0.3rem;
    flex: 0 0 auto;
}
.settings-check span {
    display: grid;
    gap: 0.25rem;
    color: var(--text);
    font-size: 0.9rem;
}
.settings-check .muted { font-size: 0.8rem; }
.settings-creativity {
    max-width: 16rem;
}
.settings-mono {
    font-family: ui-monospace, "Cascadia Code", "JetBrains Mono", Consolas, monospace;
    font-size: 0.85rem;
    line-height: 1.45;
}
.settings-preview h3 {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text);
    font-weight: 600;
}
.settings-preview .muted {
    margin: 0.25rem 0 0.55rem;
    font-size: 0.82rem;
}
.settings-preview pre {
    margin: 0;
    white-space: pre-wrap;
    max-height: 220px;
    overflow: auto;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #0b0e13;
    color: var(--accent-2);
    font-family: ui-monospace, "Cascadia Code", "JetBrains Mono", Consolas, monospace;
    font-size: 0.8rem;
    line-height: 1.5;
}
.settings-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.75rem;
    padding: 0.35rem 0 0.5rem;
}
.settings-actions button {
    min-width: 9rem;
    padding: 0.85rem 1.5rem;
}
.settings-tts-test {
    margin: 0;
    padding-top: 0.25rem;
    border-top: 1px solid rgba(42, 49, 64, 0.5);
}
.settings-pillars {
    margin-top: 0.5rem;
}
.settings-pillars-list {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}
.settings-pillar-row {
    display: grid;
    grid-template-columns: 4rem 1fr;
    gap: 0.45rem 0.65rem;
    padding: 0.65rem 0.75rem;
    background: var(--bg-low);
    border: 1px solid rgba(66, 71, 79, 0.4);
    border-radius: 8px;
    align-items: end;
}
.settings-pillar-row.is-off {
    opacity: 0.55;
}
.settings-pillar-row label {
    margin: 0;
    font-size: 0.75rem;
    color: var(--muted);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.settings-pillar-row input[type="text"],
.settings-pillar-row input[type="number"] {
    width: 100%;
    padding: 0.45rem 0.55rem;
    font-size: 0.88rem;
}
.settings-pillar-active {
    flex-direction: row !important;
    align-items: center;
    gap: 0.4rem !important;
    padding-bottom: 0.35rem;
}
.settings-pillar-add {
    margin: 1rem 0 0;
    padding-top: 0.85rem;
    border-top: 1px solid rgba(42, 49, 64, 0.45);
}
.settings-pillar-add h3 {
    margin: 0 0 0.55rem;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text);
}
.settings-pillar-add-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.55rem;
    align-items: end;
}
.settings-pillar-add-row label {
    margin: 0;
    font-size: 0.75rem;
    color: var(--muted);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.settings-pillar-add-row input {
    width: 100%;
    padding: 0.45rem 0.55rem;
}
@media (min-width: 720px) {
    .settings-pillar-row {
        grid-template-columns: 4rem minmax(10rem, 0.9fr) minmax(12rem, 1.4fr) auto;
    }
    .settings-pillar-add-row {
        grid-template-columns: minmax(10rem, 0.9fr) minmax(12rem, 1.4fr) auto;
    }
}
@media (min-width: 960px) {
    .settings-card--half { grid-column: span 6; }
}
@media (max-width: 900px) {
    .field-grid--4,
    .field-grid--5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
    .field-grid--2,
    .field-grid--4,
    .field-grid--5 { grid-template-columns: 1fr; }
    .settings-actions {
        flex-direction: column-reverse;
        align-items: stretch;
    }
    .settings-creativity { max-width: none; }
}
