/* =========================================================
   Beige Board - stile
   Palette calda ispirata al marchio Beige, struttura in stile Trello.
   ========================================================= */

:root {
    --espresso: #2a2420;
    --ink: #2b2723;
    --muted: #6b625a;
    --line: #e4ddd4;
    --soft: #f6f2ed;
    --list-bg: #f1ece6;
    --chip: #ebe5dd;
    --chip-hover: #e0d7cc;
    --surface: #ffffff;
    --primary: #7c5c43;
    --primary-hover: #664a35;
    --accent: #d9b48f;
    --focus: #a87f5c;
    --danger: #c9372c;
    --danger-hover: #ae2e24;
    --ok: #1f845a;
    --radius: 12px;
    --shadow-card: 0 1px 1px rgba(42, 36, 32, .2), 0 0 1px rgba(42, 36, 32, .3);
    --shadow-pop: 0 14px 36px rgba(42, 36, 32, .28), 0 0 1px rgba(42, 36, 32, .3);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; }
body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.4;
    color: var(--ink);
    background: var(--soft);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}
body.no-scroll { overflow: hidden; }

button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); }
hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; width: 100%; }
.ic { flex: none; display: block; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.spacer { flex: 1; }
.visually-hidden {
    position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------- Campi ---------- */
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea {
    width: 100%;
    border: 1.5px solid #d6cdc2;
    border-radius: 6px;
    padding: 8px 10px;
    background: #fff;
    font-size: 16px;
    color: var(--ink);
    transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(124, 92, 67, .18);
}
textarea { resize: vertical; line-height: 1.45; }
input[type=checkbox] { width: 16px; height: 16px; margin: 0; accent-color: var(--primary); flex: none; cursor: pointer; }
input:disabled, select:disabled, textarea:disabled { opacity: .6; }

.field { display: grid; gap: 6px; }
.field > label, .field-label { font-size: 12px; font-weight: 700; color: var(--muted); }
.field-hint { color: var(--muted); font-size: 12px; }

.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 46px !important; }
.pw-toggle {
    position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
    width: 38px; height: 38px; border: 0; border-radius: 6px; background: transparent;
    color: var(--muted); display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.pw-toggle:hover { color: var(--ink); background: rgba(42, 36, 32, .07); }
.pw-toggle[aria-pressed="true"] { color: var(--primary); }

/* ---------- Bottoni ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    border: 0; border-radius: 6px; padding: 8px 14px;
    font-weight: 600; font-size: 14px; line-height: 1.2; cursor: pointer;
    text-decoration: none; transition: background .12s, opacity .12s; white-space: nowrap;
}
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-secondary { background: var(--chip); color: var(--ink); }
.btn-secondary:hover:not(:disabled) { background: var(--chip-hover); }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover:not(:disabled) { background: rgba(42, 36, 32, .07); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: var(--danger-hover); }
.btn-light { background: #fff; color: var(--ink); }
.btn-light:hover { background: #f3eee8; }
.btn-sm { padding: 6px 10px; font-size: 13px; }
.btn-lg { padding: 12px 16px; font-size: 15px; }
.btn-block { width: 100%; }

.icon-btn {
    display: inline-flex; align-items: center; justify-content: center; flex: none;
    width: 32px; height: 32px; border: 0; border-radius: 6px;
    background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: rgba(42, 36, 32, .08); color: var(--ink); }
.link-btn {
    border: 0; background: none; padding: 0; font: inherit; color: inherit;
    text-decoration: underline; cursor: pointer; text-align: left;
}

/* ---------- Avatar ---------- */
.avatar {
    display: inline-flex; align-items: center; justify-content: center; flex: none;
    border-radius: 50%; color: #fff; font-weight: 700; line-height: 1; letter-spacing: .02em;
    user-select: none;
}
.avatar.ghost { width: 24px; height: 24px; background: var(--chip) !important; color: var(--muted); }
.avatar.more { width: 28px; height: 28px; background: var(--chip); color: var(--ink); font-size: 11px; }

/* ---------- Colori etichette e copertine ---------- */
.lc-green  { background: #4bce97; color: #164b35; }
.lc-yellow { background: #f5cd47; color: #533f04; }
.lc-orange { background: #fea362; color: #702e00; }
.lc-red    { background: #f87168; color: #5d1f1a; }
.lc-purple { background: #9f8fef; color: #352c63; }
.lc-blue   { background: #579dff; color: #09326c; }
.lc-sky    { background: #6cc3e0; color: #164555; }
.lc-lime   { background: #94c748; color: #37471f; }
.lc-pink   { background: #e774bb; color: #50253f; }
.lc-black  { background: #8590a2; color: #091e42; }
.lc-none   { background: var(--line); color: var(--muted); }

.cv-green  { background: #4bce97; } .cv-yellow { background: #f5cd47; } .cv-orange { background: #fea362; }
.cv-red    { background: #f87168; } .cv-purple { background: #9f8fef; } .cv-blue   { background: #579dff; }
.cv-sky    { background: #6cc3e0; } .cv-lime   { background: #94c748; } .cv-pink   { background: #e774bb; }
.cv-black  { background: #8590a2; }

/* ---------- Sfondi bacheca ---------- */
.bg-beige    { background: linear-gradient(135deg, #e6d8c4 0%, #c4ab8e 100%); }
.bg-sand     { background: linear-gradient(135deg, #efdcbf 0%, #cfa877 100%); }
.bg-espresso { background: linear-gradient(135deg, #5a473a 0%, #2a2420 100%); }
.bg-sage     { background: linear-gradient(135deg, #a9b9a1 0%, #667f61 100%); }
.bg-ocean    { background: linear-gradient(135deg, #2d7fd3 0%, #0b3a73 100%); }
.bg-plum     { background: linear-gradient(135deg, #9a7799 0%, #4d3659 100%); }
.bg-rose     { background: linear-gradient(135deg, #e3b2ab 0%, #b06b68 100%); }
.bg-slate    { background: linear-gradient(135deg, #8a94a0 0%, #3b4550 100%); }
.bg-sunset   { background: linear-gradient(135deg, #f2a65a 0%, #c0503a 100%); }
.bg-forest   { background: linear-gradient(135deg, #4f7a5c 0%, #1e3a2b 100%); }

/* ---------- Avvio ---------- */
#root.boot { height: 100vh; display: grid; place-items: center; }
.boot-logo { width: 140px; height: auto; opacity: .45; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .2; } }

/* ---------- Accesso ---------- */
.auth-root {
    min-height: 100%;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 32px 16px;
    background: linear-gradient(160deg, #f4ece1 0%, #e1cfb9 100%);
}
.auth-card {
    width: 100%; max-width: 400px;
    background: #fff; border-radius: 18px; padding: 34px 28px 28px;
    box-shadow: 0 24px 60px rgba(42, 36, 32, .18);
}
.auth-logo { display: block; width: 150px; height: auto; margin: 0 auto 6px; }
.auth-sub { text-align: center; color: var(--muted); margin: 0 0 24px; }
.auth-tabs { display: flex; background: var(--list-bg); border-radius: 9px; padding: 4px; margin-bottom: 18px; }
.auth-tab {
    flex: 1; border: 0; background: transparent; padding: 9px; border-radius: 6px;
    font-weight: 600; color: var(--muted); cursor: pointer;
}
.auth-tab.is-active { background: #fff; color: var(--ink); box-shadow: var(--shadow-card); }
.auth-form { display: grid; gap: 14px; }
.auth-message {
    padding: 10px 12px; border-radius: 8px; margin-bottom: 14px; font-size: 14px;
    background: #fde8e6; color: #8c1d18;
}
.auth-message.is-info { background: #efe6dc; color: #4a3727; }
.auth-foot { margin: 22px 0 0; color: #7d7064; font-size: 13px; letter-spacing: .02em; }

/* ---------- Struttura app ---------- */
.app-root { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }
.topbar {
    flex: none; position: relative; z-index: 50;
    display: flex; align-items: center; gap: 6px;
    height: 52px; padding: 0 12px;
    background: var(--espresso); color: #fff;
}
.top-logo { display: flex; align-items: center; padding: 4px 8px 4px 2px; border-radius: 6px; }
.top-logo img { height: 28px; width: auto; display: block; }
.top-btn {
    position: relative; display: inline-flex; align-items: center; gap: 6px;
    height: 36px; padding: 0 10px; border: 0; border-radius: 6px;
    background: transparent; color: #fff; text-decoration: none; font-weight: 600; font-size: 14px; cursor: pointer;
}
.top-btn:hover { background: rgba(255, 255, 255, .12); }
.top-btn.icon-only { width: 38px; padding: 0; justify-content: center; }
.top-create { height: 32px; padding: 0 12px; background: var(--accent); color: var(--espresso); }
.top-create:hover:not(:disabled) { background: #e8c7a4; }
.top-spacer { flex: 1; }
.top-avatar { border: 0; background: none; padding: 0; border-radius: 50%; cursor: pointer; display: flex; margin-left: 4px; }
.badge-count {
    position: absolute; top: 1px; right: 1px;
    min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px;
    background: #e5484d; color: #fff; font-size: 11px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid var(--espresso);
}
.main { flex: 1; min-height: 0; position: relative; }
.loading { padding: 40px 16px; text-align: center; color: var(--muted); margin: 0; }
.loading.light { color: #fff; }

/* ---------- Home ---------- */
.home-page { overflow: auto; background: var(--soft); }
.home { max-width: 1120px; margin: 0 auto; padding: 32px 20px 56px; }
.home-hello h1 { font-family: var(--serif); font-size: 32px; font-weight: 600; margin: 0; letter-spacing: -.01em; }
.home-hello p { margin: 4px 0 0; color: var(--muted); }
.home-section { margin-top: 30px; }
.home-section h2 { display: flex; align-items: center; gap: 8px; font-size: 16px; margin: 0 0 12px; }
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.board-tile {
    position: relative; height: 106px; border-radius: 10px; padding: 12px;
    color: #fff; text-decoration: none; overflow: hidden;
    display: flex; flex-direction: column; justify-content: space-between;
    box-shadow: 0 1px 2px rgba(42, 36, 32, .2);
}
.board-tile::before {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, .34), rgba(0, 0, 0, .12));
    transition: background .15s;
}
.board-tile:hover::before { background: rgba(0, 0, 0, .4); }
.board-tile > * { position: relative; }
.tile-title { font-weight: 700; font-size: 16px; line-height: 1.25; word-break: break-word; text-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
.tile-meta { display: inline-flex; gap: 4px; align-items: center; font-size: 12px; opacity: .95; }
.tile-star {
    position: absolute; right: 8px; bottom: 8px; width: 30px; height: 30px;
    border: 0; border-radius: 6px; background: transparent; color: #fff;
    display: flex; align-items: center; justify-content: center; cursor: pointer; opacity: 0;
}
.tile-star:hover { background: rgba(255, 255, 255, .2); }
.board-tile:hover .tile-star, .tile-star.is-on, .tile-star:focus-visible { opacity: 1; }
.tile-star.is-on { color: #f5cd47; }
.tile-new {
    background: var(--chip); color: var(--muted); border: 0; cursor: pointer;
    flex-direction: row; align-items: center; justify-content: center; gap: 6px; font-weight: 600; font-size: 14px;
    box-shadow: none;
}
.tile-new::before { display: none; }
.tile-new:hover { background: var(--chip-hover); color: var(--ink); }
.closed-boards { margin-top: 30px; }
.closed-boards summary { cursor: pointer; font-weight: 700; color: var(--muted); margin-bottom: 12px; }

/* ---------- Pagina bacheca ---------- */
.board-page { display: flex; flex-direction: column; overflow: hidden; }
.board-header {
    flex: none; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px;
    padding: 8px 16px; background: rgba(42, 36, 32, .55); color: #fff;
    -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.bh-left, .bh-right { display: flex; align-items: center; gap: 6px; min-width: 0; }
.board-title {
    margin: 0; padding: 4px 8px; border-radius: 6px; cursor: pointer;
    font-family: var(--serif); font-size: 21px; font-weight: 700; letter-spacing: -.01em;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46vw;
}
.board-title:hover { background: rgba(255, 255, 255, .18); }
.board-title-input { width: min(420px, 60vw) !important; font-size: 18px !important; font-weight: 700; }
.hb-btn {
    display: inline-flex; align-items: center; gap: 6px; flex: none;
    height: 32px; padding: 0 10px; border: 0; border-radius: 6px;
    background: rgba(255, 255, 255, .16); color: #fff; font-weight: 600; font-size: 14px; cursor: pointer;
}
.hb-btn:hover { background: rgba(255, 255, 255, .28); }
.hb-btn.icon-only { width: 32px; padding: 0; justify-content: center; }
.hb-btn.is-starred { color: #f5cd47; }
.hb-btn.is-active, .hb-light { background: #fff; color: var(--ink); }
.hb-light:hover, .hb-btn.is-active:hover { background: #f1ece6; }
.filter-count {
    background: var(--primary); color: #fff; border-radius: 10px; min-width: 18px; height: 18px;
    padding: 0 5px; font-size: 12px; display: inline-flex; align-items: center; justify-content: center;
}
.view-switch { display: flex; flex: none; background: rgba(0, 0, 0, .22); border-radius: 8px; padding: 2px; }
.vs-btn {
    display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px;
    border: 0; border-radius: 6px; background: transparent; color: rgba(255, 255, 255, .88);
    font-weight: 600; font-size: 13px; cursor: pointer;
}
.vs-btn:hover { color: #fff; background: rgba(255, 255, 255, .12); }
.vs-btn.is-on { background: #fff; color: var(--ink); }
.faces { display: flex; align-items: center; border: 0; background: none; padding: 0 2px; cursor: pointer; flex: none; }
.faces .avatar { margin-left: -6px; box-shadow: 0 0 0 2px rgba(42, 36, 32, .55); }
.faces .avatar:first-child { margin-left: 0; }
.closed-banner {
    flex: none; display: flex; gap: 10px; align-items: center; padding: 8px 16px;
    background: #fff4d6; color: #5c4813; font-weight: 600; font-size: 14px;
}

.board-content { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.lists {
    flex: 1; min-height: 0; display: flex; align-items: flex-start; gap: 12px;
    padding: 12px 16px 16px; overflow-x: auto; overflow-y: hidden;
}
.list {
    flex: 0 0 272px; max-height: 100%;
    display: flex; flex-direction: column;
    background: var(--list-bg); border-radius: var(--radius);
    box-shadow: 0 1px 1px rgba(42, 36, 32, .25);
}
.list-header { display: flex; align-items: flex-start; gap: 2px; padding: 8px 6px 4px 10px; cursor: grab; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.list-title {
    flex: 1; min-width: 0; margin: 0; padding: 6px 4px; border-radius: 4px;
    font-size: 14px; font-weight: 700; word-break: break-word; cursor: pointer;
}
.list-title-input { flex: 1; font-weight: 700; font-size: 14px !important; padding: 5px 6px !important; }
.list-count { font-size: 12px; color: var(--muted); padding: 7px 4px; flex: none; }
.list-cards {
    flex: 1 1 auto; min-height: 6px; overflow-y: auto; overflow-x: hidden;
    padding: 2px 8px; display: flex; flex-direction: column; gap: 8px;
}
.list-footer { padding: 6px 8px 8px; }
.add-card-btn {
    width: 100%; display: flex; align-items: center; gap: 6px;
    border: 0; border-radius: 8px; background: transparent; color: var(--muted);
    padding: 8px; font-weight: 600; font-size: 14px; cursor: pointer;
}
.add-card-btn:hover { background: rgba(42, 36, 32, .08); color: var(--ink); }
.composer textarea, .composer-input {
    border: 0 !important; border-radius: 8px; box-shadow: var(--shadow-card) !important;
    resize: none; font-size: 14px; min-height: 58px; padding: 8px 10px;
}
.composer-actions { display: flex; align-items: center; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.composer-actions.spread { justify-content: space-between; }
.add-list-btn {
    flex: 0 0 272px; display: flex; align-items: center; gap: 6px;
    border: 0; border-radius: var(--radius); padding: 12px;
    background: rgba(42, 36, 32, .5); color: #fff; font-weight: 600; font-size: 14px; cursor: pointer;
}
.add-list-btn:hover { background: rgba(42, 36, 32, .64); }
.add-list-form { flex: 0 0 272px; background: var(--list-bg); border-radius: var(--radius); padding: 8px; }

/* ---------- Schede ---------- */
.card {
    flex: none; background: #fff; border-radius: 8px; box-shadow: var(--shadow-card);
    cursor: pointer; overflow: hidden; outline: 2px solid transparent; outline-offset: 0;
    user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.card:hover { outline-color: rgba(124, 92, 67, .55); }
.card:focus-visible { outline-color: var(--focus); }
.card-cover { height: 30px; }
.card-body { padding: 8px 10px; }
.card-labels { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.label-chip {
    min-width: 40px; max-width: 100%; height: 16px; line-height: 16px; padding: 0 8px;
    border-radius: 4px; font-size: 12px; font-weight: 600;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: height .1s;
}
.card-labels.collapsed .label-chip { height: 8px; padding: 0; }
.card-title { margin: 0; font-size: 14px; line-height: 1.35; overflow-wrap: anywhere; white-space: pre-wrap; }
.card-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.card-badges { display: flex; flex-wrap: wrap; gap: 2px 6px; }
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 12px; color: var(--muted); padding: 2px 4px; border-radius: 4px; white-space: nowrap;
}
.card .badge.due[role=button] { cursor: pointer; }
.card .badge.due[role=button]:hover { background: var(--chip); }
.badge.due.overdue, .card .badge.due.overdue:hover { background: var(--danger); color: #fff; }
.badge.due.soon, .card .badge.due.soon:hover { background: #f5cd47; color: #533f04; }
.badge.due.complete, .card .badge.due.complete:hover, .badge.complete { background: var(--ok); color: #fff; }
.card-members { display: flex; margin-left: auto; }
.card-members .avatar + .avatar { margin-left: -4px; box-shadow: 0 0 0 2px #fff; }

/* Drag & drop */
.drag-placeholder { background: rgba(42, 36, 32, .14) !important; box-shadow: none !important; outline: none !important; }
.drag-placeholder > * { visibility: hidden; }
.drag-ghost {
    position: fixed; z-index: 1000; pointer-events: none; margin: 0;
    transform: rotate(3deg); box-shadow: 0 14px 30px rgba(0, 0, 0, .32); opacity: .97;
}
.list-ghost { overflow: hidden; }
body.is-dragging, body.is-dragging * { cursor: grabbing !important; user-select: none; }

/* ---------- Calendario ---------- */
.calendar {
    flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px;
    margin: 12px 16px 16px; padding: 12px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-card);
}
.cal-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cal-head h2 { margin: 0 6px; font-family: var(--serif); font-size: 20px; min-width: 170px; text-align: center; }
.calendar .hb-btn { background: var(--chip); color: var(--ink); }
.calendar .hb-btn:hover { background: var(--chip-hover); }
.cal-scroll { flex: 1; min-height: 0; overflow: auto; }
.cal-grid {
    display: grid; grid-template-columns: repeat(7, minmax(96px, 1fr)); min-width: 680px; min-height: 100%;
    border-top: 1px solid var(--line); border-left: 1px solid var(--line);
}
.cal-dow { padding: 6px 8px; font-size: 12px; font-weight: 700; color: var(--muted); background: var(--soft); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.cal-day { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 4px; display: flex; flex-direction: column; gap: 3px; min-width: 0; overflow: hidden; }
.cal-day.other { background: #faf8f5; color: #a39890; }
.cal-num { align-self: flex-start; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; border-radius: 50%; }
.cal-day.today .cal-num { background: var(--primary); color: #fff; }
.cal-chip {
    display: flex; align-items: center; gap: 5px; width: 100%; min-width: 0;
    border: 0; border-left: 3px solid transparent; background: #fff; box-shadow: var(--shadow-card);
    border-radius: 4px; padding: 3px 6px; font-size: 12px; text-align: left; cursor: pointer;
}
.cal-chip:hover { background: var(--soft); }
.cal-chip.overdue { border-left-color: var(--danger); }
.cal-chip.soon { border-left-color: #f5cd47; }
.cal-chip.complete { border-left-color: var(--ok); color: var(--muted); }
.cal-chip-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-dot { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.cal-note { margin: 0; font-size: 13px; color: var(--muted); }

/* ---------- Tabella ---------- */
.table-wrap { flex: 1; min-height: 0; overflow: auto; margin: 12px 16px 16px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-card); }
.cards-table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 720px; }
.cards-table th {
    position: sticky; top: 0; z-index: 1; background: var(--soft); text-align: left;
    padding: 10px 12px; font-size: 12px; color: var(--muted); font-weight: 700; border-bottom: 1px solid var(--line);
}
.th-sort { border: 0; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; display: inline-flex; gap: 4px; }
.th-sort:hover { color: var(--ink); }
.cards-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.cards-table tbody tr { cursor: pointer; }
.cards-table tbody tr:hover { background: #faf7f3; }
.td-title .link-btn { text-decoration: none; font-weight: 600; }
.td-title .link-btn:hover { text-decoration: underline; }
.td-labels, .td-members { display: flex; flex-wrap: wrap; gap: 4px; }
.cards-table tr.empty td { text-align: center; color: var(--muted); padding: 36px; cursor: default; }

/* ---------- Popover ---------- */
.pop-backdrop { position: fixed; inset: 0; z-index: 600; }
.pop-backdrop.is-sheet { background: rgba(42, 36, 32, .45); display: flex; align-items: flex-end; }
.popover {
    position: fixed; width: 320px; max-width: calc(100vw - 16px); max-height: calc(100vh - 16px);
    overflow: auto; overscroll-behavior: contain;
    background: #fff; border-radius: 10px; box-shadow: var(--shadow-pop); color: var(--ink);
}
.popover.is-sheet {
    position: relative; width: 100%; max-width: none; max-height: 86vh;
    border-radius: 16px 16px 0 0; padding-bottom: env(safe-area-inset-bottom);
    animation: sheet-up .18s ease-out;
}
@keyframes sheet-up { from { transform: translateY(30px); } }
.pop-head {
    position: sticky; top: 0; z-index: 1; background: #fff;
    display: grid; grid-template-columns: 32px 1fr 32px; align-items: center; padding: 8px 8px 4px;
}
.pop-head h3 { margin: 0; text-align: center; font-size: 14px; font-weight: 700; color: var(--muted); }
.pop-spacer { width: 32px; }
.pop-body { padding: 4px 12px 14px; display: grid; gap: 10px; }
.pop-sub { margin: 6px 0 0; font-size: 12px; color: var(--muted); font-weight: 700; }
.pop-text { margin: 0; font-size: 14px; line-height: 1.45; }
.check-row { display: flex; align-items: center; gap: 10px; padding: 6px 4px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.check-row:hover { background: var(--soft); }
.menu-list { display: grid; gap: 2px; margin: 0 -4px; }
.menu-item {
    display: flex; align-items: center; gap: 10px; width: 100%;
    border: 0; background: transparent; text-align: left; padding: 9px 10px; border-radius: 6px;
    font-size: 14px; color: var(--ink); cursor: pointer;
}
.menu-item:hover { background: #f3eee8; }
.menu-item .ic { color: var(--muted); }
.menu-item.danger, .menu-item.danger .ic { color: var(--danger-hover); }
.account-head { display: flex; gap: 10px; align-items: center; padding: 2px 0 10px; border-bottom: 1px solid var(--line); }
.account-head strong, .account-head small { display: block; }

.pick-list { display: grid; gap: 2px; }
.pick-row {
    display: flex; align-items: center; gap: 10px; width: 100%;
    border: 0; background: transparent; padding: 6px; border-radius: 6px;
    text-align: left; font-size: 14px; cursor: pointer; color: var(--ink);
}
.pick-row:hover { background: var(--soft); }
.pick-row.is-on .ic { color: var(--primary); }
.pick-name { flex: 1; }

.label-pill {
    display: inline-flex; align-items: center; min-width: 40px; max-width: 180px; height: 22px;
    padding: 0 8px; border-radius: 4px; font-size: 12px; font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.label-pill.big { height: 32px; padding: 0 12px; font-size: 14px; border: 0; cursor: pointer; }
.label-bar {
    flex: 1; min-width: 0; display: block; height: 32px; line-height: 32px; padding: 0 12px;
    border-radius: 4px; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.label-pick { display: grid; gap: 4px; }
.label-pick-row { display: flex; align-items: center; gap: 4px; }
.label-pick-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; cursor: pointer; }
.label-preview { padding: 18px 16px; background: var(--soft); border-radius: 8px; display: flex; }
.label-manage { display: grid; gap: 6px; }
.label-manage-row { display: flex; gap: 6px; align-items: center; }

.swatch-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.color-swatch {
    height: 32px; border: 0; border-radius: 6px; cursor: pointer;
    display: flex; align-items: center; justify-content: center; color: #fff;
}
.color-swatch.is-on { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--ink); }
.due-dot { width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--chip); color: var(--muted); flex: none; }
.due-dot.overdue { background: var(--danger); color: #fff; }
.due-dot.soon { background: #f5cd47; color: #533f04; }
.due-dot.complete { background: var(--ok); color: #fff; }

.invite-row { display: flex; gap: 8px; }
.invite-row input { flex: 1; min-width: 0; }
.member-list { display: grid; gap: 4px; }
.member-row { display: flex; align-items: center; gap: 10px; padding: 4px 0; }
.member-info { flex: 1; min-width: 0; display: grid; }
.member-info strong { font-size: 14px; }
.member-info small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role-tag { font-size: 12px; color: var(--muted); }
.role-select { width: auto !important; font-size: 13px !important; padding: 4px 6px !important; }

.create-preview { height: 92px; border-radius: 8px; display: flex; gap: 6px; padding: 14px; align-items: flex-start; justify-content: center; }
.create-preview span { width: 48px; height: 56px; background: rgba(255, 255, 255, .85); border-radius: 4px; }
.create-preview span:nth-child(2) { height: 40px; }
.create-preview span:nth-child(3) { height: 64px; }
.bg-mini-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.bg-mini { height: 32px; border: 0; border-radius: 5px; cursor: pointer; color: #fff; display: flex; align-items: center; justify-content: center; }
.bg-mini.is-on { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--ink); }
.stack { display: grid; gap: 12px; }
.date-block { display: grid; gap: 6px; }
.date-pair { display: grid; grid-template-columns: 1.4fr 1fr; gap: 6px; }
.file-pick { cursor: pointer; }

/* ---------- Notifiche ---------- */
.notif-tools { display: flex; justify-content: flex-end; margin-top: -6px; }
.notif-list { display: grid; gap: 2px; margin: 0 -6px; }
.notif {
    display: flex; gap: 10px; align-items: flex-start; width: 100%;
    border: 0; background: transparent; text-align: left; padding: 8px; border-radius: 8px; cursor: pointer; color: var(--ink);
}
.notif:hover { background: var(--soft); }
.notif.unread { background: #f6eee5; }
.notif-text { flex: 1; display: grid; gap: 2px; font-size: 14px; line-height: 1.4; }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-top: 6px; flex: none; }
.empty-state { display: grid; justify-items: center; gap: 8px; padding: 20px; color: var(--muted); text-align: center; }
.empty-state p { margin: 0; }

/* ---------- Finestra modale generica ---------- */
.modal-backdrop {
    position: fixed; inset: 0; z-index: 500; background: rgba(42, 36, 32, .55);
    display: flex; align-items: flex-start; justify-content: center; padding: 48px 16px; overflow: auto;
}
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 560px; box-shadow: var(--shadow-pop); }
.modal-sm { max-width: 440px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 16px 0 22px; }
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-body { padding: 10px 22px 24px; display: grid; gap: 14px; }
.modal-sub { display: flex; align-items: center; gap: 6px; margin: 8px 0 0; font-size: 14px; color: var(--muted); }
.profile-preview { display: flex; align-items: center; gap: 12px; }
.profile-preview strong, .profile-preview small { display: block; }

/* ---------- Pannello menu bacheca ---------- */
.drawer-backdrop { position: fixed; inset: 0; z-index: 450; background: rgba(42, 36, 32, .25); }
.drawer {
    position: absolute; top: 0; right: 0; bottom: 0; width: 360px; max-width: 100vw;
    background: #fff; box-shadow: -8px 0 30px rgba(0, 0, 0, .2);
    display: flex; flex-direction: column; animation: drawer-in .18s ease-out;
}
@keyframes drawer-in { from { transform: translateX(24px); } }
.drawer-head { display: grid; grid-template-columns: 36px 1fr 36px; align-items: center; padding: 10px; border-bottom: 1px solid var(--line); }
.drawer-head h3 { margin: 0; text-align: center; font-size: 16px; }
.drawer-body { flex: 1; overflow: auto; padding: 12px 16px 28px; display: grid; gap: 10px; align-content: start; }
.drawer-section-head { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.drawer-section-head h4 { margin: 0; flex: 1; font-size: 14px; }
.act-list { display: grid; gap: 12px; }
.act-item { display: flex; gap: 10px; align-items: flex-start; border-radius: 6px; }
.act-item.is-link { cursor: pointer; }
.act-item.is-link:hover .act-text p { text-decoration: underline; }
.act-text p { margin: 0; font-size: 14px; line-height: 1.4; }
.act-text small { color: var(--muted); font-size: 12px; }
.bg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.bg-swatch {
    height: 72px; border: 0; border-radius: 8px; cursor: pointer; padding: 8px;
    display: flex; align-items: flex-end; color: #fff; font-weight: 600; text-shadow: 0 1px 2px rgba(0, 0, 0, .45);
}
.bg-swatch.is-on { outline: 3px solid var(--primary); outline-offset: 2px; }
.seg { display: flex; background: var(--list-bg); border-radius: 8px; padding: 3px; }
.seg-btn { flex: 1; border: 0; background: transparent; padding: 7px; border-radius: 6px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg-btn.is-on { background: #fff; color: var(--ink); box-shadow: var(--shadow-card); }
.archived-list { display: grid; gap: 8px; }
.archived-row { display: grid; gap: 2px; padding: 10px; border-radius: 8px; background: var(--soft); }
.archived-title { font-weight: 600; text-decoration: none; }
.archived-actions { display: flex; gap: 6px; margin-top: 6px; }

/* ---------- Dettaglio scheda ---------- */
.card-backdrop {
    position: fixed; inset: 0; z-index: 400; background: rgba(20, 16, 13, .6);
    overflow: auto; overscroll-behavior: contain;
    display: flex; justify-content: center; align-items: flex-start; padding: 48px 16px;
}
.card-modal {
    position: relative; width: 100%; max-width: 780px;
    background: #faf8f5; border-radius: 14px; box-shadow: var(--shadow-pop);
    padding-bottom: 28px; overflow: hidden;
}
.card-modal > .loading { padding: 60px 16px; }
.card-modal.is-dropping { outline: 3px dashed var(--primary); outline-offset: -8px; }
.cm-cover { height: 116px; display: flex; align-items: flex-end; justify-content: flex-end; padding: 10px; }
.cm-close { position: absolute; top: 10px; right: 10px; z-index: 2; width: 38px; height: 38px; background: rgba(255, 255, 255, .7); }
.cm-close:hover { background: #fff; }
.cm-archived { display: flex; gap: 8px; align-items: center; padding: 12px 56px 12px 20px; background: #fff4d6; color: #5c4813; font-weight: 600; font-size: 14px; }
.cm-head { display: flex; gap: 12px; padding: 18px 56px 4px 20px; align-items: flex-start; }
.cm-head > .ic { margin-top: 9px; color: var(--muted); }
.cm-head-text { flex: 1; min-width: 0; }
.cm-title {
    display: block; font-family: var(--serif); font-size: 22px !important; font-weight: 700; line-height: 1.3;
    border-color: transparent !important; background: transparent !important; box-shadow: none !important;
    padding: 2px 6px !important; margin-left: -7px; resize: none; overflow: hidden;
}
.cm-title:focus { background: #fff !important; border-color: var(--primary) !important; }
.cm-in-list { margin: 2px 0 0; font-size: 14px; color: var(--muted); }
.cm-grid { display: grid; grid-template-columns: minmax(0, 1fr) 176px; gap: 16px 20px; padding: 10px 20px 0 52px; }
.cm-main { display: grid; gap: 24px; min-width: 0; align-content: start; }
.cm-meta { display: flex; flex-wrap: wrap; gap: 14px 22px; }
.meta-block h4 { margin: 0 0 6px; font-size: 12px; color: var(--muted); font-weight: 700; }
.meta-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.meta-add {
    width: 32px; height: 32px; border: 0; border-radius: 50%; background: var(--chip); color: var(--ink);
    display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.meta-add:hover { background: var(--chip-hover); }
.due-check { width: 18px !important; height: 18px !important; }
.due-chip {
    display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px;
    border: 0; border-radius: 6px; background: var(--chip); color: var(--ink);
    font-weight: 600; font-size: 14px; cursor: pointer;
}
.due-chip:hover { background: var(--chip-hover); }
.due-tag { font-size: 12px; padding: 1px 6px; border-radius: 3px; }
.due-tag.overdue { background: var(--danger); color: #fff; }
.due-tag.soon { background: #f5cd47; color: #533f04; }
.due-tag.complete { background: var(--ok); color: #fff; }

.cm-section { display: grid; gap: 10px; min-width: 0; }
.cm-section-head { display: flex; align-items: center; gap: 12px; margin-left: -32px; min-width: 0; }
.cm-section-head > .ic { color: var(--muted); width: 20px; }
.cm-section-head h3 { margin: 0; font-size: 16px; font-weight: 700; }
.desc-text { font-size: 14px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; cursor: pointer; }
.desc-placeholder {
    text-align: left; border: 0; border-radius: 6px; background: var(--chip);
    padding: 12px; min-height: 60px; color: var(--muted); font-size: 14px; cursor: pointer;
}
.desc-placeholder:hover { background: var(--chip-hover); }
.desc-editor { min-height: 130px; font-size: 14px !important; }

.att-list { display: grid; gap: 12px; }
.att-row { display: flex; gap: 12px; align-items: flex-start; }
.att-thumb {
    flex: none; width: 104px; height: 72px; border-radius: 6px; background: var(--chip);
    display: flex; align-items: center; justify-content: center; overflow: hidden;
    color: var(--muted); font-weight: 700; font-size: 14px; text-decoration: none;
}
.att-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.att-info { display: grid; gap: 2px; min-width: 0; }
.att-name { font-weight: 700; color: var(--ink); overflow-wrap: anywhere; text-decoration: none; }
.att-name:hover { text-decoration: underline; }
.att-info small { font-size: 12px; }
.att-actions { display: flex; gap: 14px; font-size: 13px; margin-top: 2px; }
.att-actions .link-btn, .att-actions a { color: var(--muted); }

.cl-title { margin: 0; font-size: 16px; font-weight: 700; cursor: pointer; overflow-wrap: anywhere; min-width: 0; }
.progress { display: flex; align-items: center; gap: 10px; }
.progress-pct { font-size: 11px; color: var(--muted); width: 32px; }
.progress-bar { flex: 1; height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--primary); transition: width .2s; }
.progress-fill.full { background: var(--ok); }
.cl-items { display: grid; }
.check-item { display: flex; align-items: flex-start; gap: 10px; padding: 4px 6px; margin: 0 -6px; border-radius: 6px; }
.check-item:hover { background: #efe9e2; }
.item-check { display: flex; padding-top: 3px; cursor: pointer; }
.item-text { flex: 1; min-width: 0; font-size: 14px; line-height: 1.45; padding: 1px 0; cursor: pointer; overflow-wrap: anywhere; }
.item-text.done { text-decoration: line-through; color: var(--muted); }
.item-del { width: 26px; height: 26px; opacity: 0; }
.check-item:hover .item-del, .item-del:focus-visible { opacity: 1; }
.item-edit-wrap { flex: 1; }
.item-adder { margin-left: 26px; }
.item-add-btn { justify-self: start; margin-left: 26px; }

.comment-new { display: flex; gap: 10px; align-items: flex-start; }
.comment-new-box { flex: 1; min-width: 0; }
.comment-input { font-size: 14px !important; resize: none; min-height: 42px; }
.timeline { display: grid; gap: 16px; }
.tl-item { display: flex; gap: 10px; align-items: flex-start; }
.tl-body { flex: 1; min-width: 0; }
.tl-meta { margin: 0 0 4px; font-size: 14px; }
.tl-act .tl-body p { margin: 0; font-size: 14px; }
.comment-bubble {
    background: #fff; border-radius: 8px; padding: 8px 12px; box-shadow: var(--shadow-card);
    font-size: 14px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere;
}
.comment-actions { display: flex; gap: 12px; margin-top: 4px; font-size: 12px; }
.comment-actions .link-btn { color: var(--muted); }
.comment-edit { font-size: 14px !important; }

.cm-side { display: grid; gap: 8px; align-content: start; }
.cm-side h4 { margin: 4px 0 0; font-size: 12px; color: var(--muted); font-weight: 700; }
.side-group { display: grid; gap: 6px; }
.side-btn {
    display: flex; align-items: center; gap: 8px; width: 100%;
    border: 0; border-radius: 6px; background: var(--chip); color: var(--ink);
    padding: 7px 10px; font-weight: 600; font-size: 14px; cursor: pointer; text-align: left;
}
.side-btn:hover { background: var(--chip-hover); }
.side-btn.danger { background: var(--danger); color: #fff; }
.side-btn.danger:hover { background: var(--danger-hover); }

/* ---------- Avvisi ---------- */
.toast {
    position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%);
    z-index: 900; display: flex; align-items: center; gap: 14px;
    background: var(--espresso); color: #fff; padding: 10px 16px; border-radius: 8px;
    font-size: 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, .3); max-width: calc(100vw - 32px);
}
.toast-action { border: 0; background: none; color: var(--accent); font-weight: 700; cursor: pointer; padding: 0; text-decoration: underline; }

/* ---------- Desktop: campi più compatti ---------- */
@media (min-width: 641px) {
    input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea { font-size: 14px; }
}

/* ---------- Dispositivi touch ---------- */
@media (hover: none) {
    .tile-star, .item-del { opacity: 1; }
    .card:hover { outline-color: transparent; }
}

/* ---------- Smartphone ---------- */
@media (max-width: 640px) {
    .hide-sm { display: none !important; }
    .topbar { padding: 0 8px; gap: 4px; }
    .top-logo img { height: 24px; }

    .home { padding: 22px 16px 48px; }
    .home-hello h1 { font-size: 26px; }
    .tile-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .board-tile { height: 92px; }

    .board-header { padding: 8px 12px; gap: 6px; }
    .bh-left { width: 100%; }
    .bh-right { width: 100%; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
    .bh-right::-webkit-scrollbar { display: none; }
    .board-title { font-size: 19px; max-width: calc(100vw - 72px); }
    .vs-label { display: none; }

    .lists { gap: 10px; padding: 10px 12px 12px; scroll-snap-type: x mandatory; scroll-padding: 0 12px; }
    .list, .add-list-btn, .add-list-form { flex-basis: calc(100vw - 48px); scroll-snap-align: start; }
    body.is-dragging .lists { scroll-snap-type: none; }

    .calendar, .table-wrap { margin: 8px; }
    .cal-grid { min-width: 640px; }

    .card-backdrop { padding: 0; }
    .card-modal { max-width: none; min-height: 100%; border-radius: 0; }
    .cm-head { padding: 16px 54px 4px 16px; }
    .cm-head > .ic { display: none; }
    .cm-grid { grid-template-columns: minmax(0, 1fr); padding: 8px 16px 0; }
    .cm-side {
        order: -1; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
        margin: 0 -16px; padding: 2px 16px 6px;
    }
    .cm-side::-webkit-scrollbar { display: none; }
    .cm-side h4 { display: none; }
    .side-group { display: contents; }
    .side-btn { flex: none; width: auto; }
    .cm-section-head { margin-left: 0; }
    .att-thumb { width: 80px; height: 60px; }
    .drawer { width: 100vw; }
    .modal-backdrop { padding: 16px 8px; }
}

/* =========================================================
   Versione 2.1: recupero password, automazioni, Power-Up
   ========================================================= */
.auth-link { display: block; margin: 2px auto 0; color: var(--muted); font-size: 14px; text-align: center; }
.auth-link:hover { color: var(--ink); }
.auth-help { margin: 0 0 4px; color: var(--muted); font-size: 14px; line-height: 1.5; text-align: center; }
.auth-title { font-family: var(--serif); font-size: 22px; text-align: center; margin: 4px 0 8px; }

.avatar.auto { background: var(--espresso); color: var(--accent); }

/* Campi personalizzati sul fronte scheda */
.card-fields { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.field-chip {
    font-size: 11px; line-height: 1.3; padding: 2px 6px; border-radius: 4px;
    background: var(--soft); color: var(--muted); border: 1px solid var(--line);
    max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Campi personalizzati nel dettaglio */
.cf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px 14px; }
.cf-item { display: grid; gap: 4px; }
.cf-label { font-size: 12px; font-weight: 700; color: var(--muted); }
.cf-check { display: flex; align-items: center; gap: 8px; align-self: end; padding: 8px 0; font-size: 14px; font-weight: 600; cursor: pointer; }
.field-manage-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.field-type-icon { width: 30px; height: 30px; border-radius: 6px; background: var(--chip); color: var(--muted); display: flex; align-items: center; justify-content: center; flex: none; }

.side-btn.is-on { background: #e3efe8; color: #164b35; }
.due-chip.is-voted { background: #e3efe8; color: #164b35; }
.danger-text { color: var(--danger-hover) !important; }

/* Automazioni */
.auto-list { display: grid; gap: 10px; }
.auto-card { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fff; display: grid; gap: 6px; }
.auto-card.is-off { opacity: .6; }
.auto-card-head { display: flex; align-items: center; gap: 8px; }
.auto-card-head strong { flex: 1; font-size: 14px; }
.auto-icon { width: 26px; height: 26px; border-radius: 6px; background: var(--espresso); color: var(--accent); display: flex; align-items: center; justify-content: center; flex: none; }
.auto-sentence { margin: 0; font-size: 13px; line-height: 1.45; color: var(--ink); }
.auto-when { font-weight: 700; }
.auto-foot { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.auto-foot .link-btn { color: var(--muted); }
.auto-note { display: grid; gap: 8px; justify-items: start; padding: 10px 12px; border-radius: 8px; background: var(--soft); }
.auto-note p { margin: 0; font-size: 13px; color: var(--muted); }
.preset-list { display: grid; gap: 6px; }
.preset {
    display: flex; align-items: center; gap: 8px; text-align: left; width: 100%;
    border: 1px dashed #cdbfae; border-radius: 8px; background: #fffaf4; padding: 8px 10px;
    font-size: 13px; color: var(--ink); cursor: pointer;
}
.preset:hover { background: #fbf0e3; border-style: solid; }
.preset .ic { color: var(--primary); }
.empty-state.small-gap { padding: 12px; }

.auto-block { display: grid; gap: 8px; padding: 12px; border-radius: 10px; background: var(--soft); }
.auto-step { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 14px; }
.step-tag { font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; padding: 3px 8px; border-radius: 4px; background: var(--espresso); color: var(--accent); }
.step-tag.then { background: var(--primary); color: #fff; }
.trigger-param { display: grid; gap: 6px; }
.actions-box { display: grid; gap: 8px; }
.action-row { display: grid; gap: 6px; padding: 8px; border-radius: 8px; background: #fff; border: 1px solid var(--line); }
.action-top { display: flex; gap: 6px; align-items: center; }
.action-top select { flex: 1; }
.action-params { display: grid; gap: 6px; }
.action-params:empty { display: none; }
.add-action { justify-self: start; }

/* Interruttore on/off */
.switch {
    appearance: none; -webkit-appearance: none; width: 36px !important; height: 20px !important;
    border-radius: 10px; background: #cfc5ba; position: relative; cursor: pointer; transition: background .15s;
}
.switch::after {
    content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
    background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .15s;
}
.switch:checked { background: var(--ok); }
.switch:checked::after { transform: translateX(16px); }

/* Foto profilo */
.avatar.has-photo { background: var(--chip) !important; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.profile-id { display: grid; gap: 2px; min-width: 0; }
.photo-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.photo-actions .btn { cursor: pointer; }
.photo-actions.is-busy { opacity: .5; pointer-events: none; }

/* =========================================================
   Versione 2.2: ruoli
   ========================================================= */
.board-title.is-static { cursor: default; }
.board-title.is-static:hover { background: transparent; }
.role-banner {
    flex: none; display: flex; gap: 10px; align-items: center; padding: 8px 16px;
    background: #e9eef7; color: #253858; font-weight: 600; font-size: 14px;
}
.role-note { display: flex; gap: 8px; align-items: center; margin: 0; padding: 8px 10px; border-radius: 8px; background: var(--soft); color: var(--muted); font-size: 13px; }
.role-note .ic { flex: none; }
.invite-form { display: grid; gap: 8px; }
.invite-role { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.role-tag.role-admin { color: var(--primary); font-weight: 700; }
.role-tag.role-observer { color: #44546f; }
.roles-help { font-size: 13px; color: var(--muted); }
.roles-help summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
.roles-help dl { margin: 6px 0 0; display: grid; gap: 4px; }
.roles-help dt { font-weight: 700; color: var(--ink); }
.roles-help dd { margin: 0 0 6px; line-height: 1.45; }
.perm-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px; border-radius: 10px; background: var(--soft); }
.perm-row strong, .perm-row small { display: block; }
.role-cards { display: grid; gap: 8px; }
.role-card { border: 1px solid var(--line); border-left-width: 4px; border-radius: 8px; padding: 10px 12px; background: #fff; }
.role-card.role-admin { border-left-color: var(--primary); }
.role-card.role-member { border-left-color: var(--ok); }
.role-card.role-observer { border-left-color: #8590a2; }
.role-card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.role-card p { margin: 4px 0 0; font-size: 13px; line-height: 1.45; color: var(--muted); }
.cm-title[readonly] { cursor: default; }
.cm-title[readonly]:focus { background: transparent !important; border-color: transparent !important; }
.label-pill.big:disabled, .due-chip:disabled { cursor: default; opacity: 1; }
.desc-text.is-readonly { cursor: default; }
@media (max-width: 640px) {
    .cm-side .role-note { display: none; }
}

/* =========================================================
   Versione 2.3: compiti delle checklist con persona e scadenza
   ========================================================= */
.check-item { align-items: flex-start; }
.item-meta { display: flex; align-items: center; gap: 4px; flex: none; margin-left: auto; }
.item-act { width: 28px; height: 28px; opacity: 0; }
.check-item:hover .item-act, .item-act:focus-visible { opacity: 1; }
.item-due {
    display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 7px; border: 0; border-radius: 4px;
    background: var(--chip); color: var(--ink); font-size: 12px; font-weight: 600; white-space: nowrap; cursor: pointer;
}
span.item-due { cursor: default; }
button.item-due:hover { background: var(--chip-hover); }
.item-due.overdue { background: var(--danger); color: #fff; }
.item-due.soon { background: #f5cd47; color: #533f04; }
.item-due.complete { background: #dcf3e6; color: #164b35; }
.item-who { border: 0; background: none; padding: 0; border-radius: 50%; display: flex; cursor: pointer; }
span.item-who { cursor: default; }
.item-extras { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.item-pick {
    display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border: 0; border-radius: 6px;
    background: var(--chip); color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer;
}
.item-pick:hover { background: var(--chip-hover); color: var(--ink); }
.item-pick.is-set { background: #efe6dc; color: var(--ink); }
.quick-dates { display: flex; gap: 6px; flex-wrap: wrap; }
.cal-task { background: var(--soft); box-shadow: none; border: 1px solid var(--line); border-left-width: 3px; gap: 4px; }
.cal-task.is-done .cal-chip-text { text-decoration: line-through; color: var(--muted); }
.cal-time { font-weight: 700; color: var(--muted); flex: none; }
.cal-task .avatar { margin-left: auto; font-size: 8px !important; }
@media (hover: none) { .item-act { opacity: 1; } }
@media (max-width: 640px) {
    .check-item.has-meta { flex-wrap: wrap; }
    .check-item.has-meta .item-meta { width: 100%; justify-content: flex-start; padding-left: 26px; }
}

/* =========================================================
   Versione 2.4: amministrazione del sito
   ========================================================= */
.admin-page { overflow: auto; background: var(--soft); }
.admin { max-width: 1120px; margin: 0 auto; padding: 28px 20px 56px; display: grid; gap: 18px; }
.admin-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.admin-head h1 { font-family: var(--serif); font-size: 30px; font-weight: 600; margin: 0; letter-spacing: -.01em; }
.admin-head p { margin: 4px 0 0; }
.admin-head .btn { text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.admin-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.admin-stat { background: #fff; border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow-card); display: grid; gap: 2px; align-content: start; }
.admin-stat strong { font-size: 22px; font-family: var(--serif); }
.admin-stat span { font-size: 13px; font-weight: 600; color: var(--muted); }
.admin-stat small { font-size: 11px; color: var(--muted); line-height: 1.35; }
.admin-toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.admin-tabs { flex: 0 1 340px; }
.admin-search { flex: 1 1 220px; max-width: 360px; }
.admin-list { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-card); overflow: hidden; }
.admin-row {
    display: grid; grid-template-columns: minmax(0, 2.4fr) 1fr 1fr 1fr auto; gap: 12px; align-items: center;
    padding: 12px 16px; border-top: 1px solid var(--line);
}
.admin-row:first-child { border-top: 0; }
.admin-row-head { padding-top: 10px; padding-bottom: 10px; background: var(--soft); font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.admin-person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.admin-cell { font-size: 13px; color: var(--ink); }
.admin-actions { display: flex; align-items: center; gap: 4px; justify-content: flex-end; }
.admin-actions .btn { text-decoration: none; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.admin-badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.admin-badges:empty { display: none; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; border-radius: 999px; background: var(--chip); font-size: 11px; font-weight: 700; color: var(--muted); }
.tag-super { background: #efe6dc; color: var(--primary); }
.tag-off { background: #f3dcd9; color: var(--danger-hover); }
.tag-warn { background: #fbecc2; color: #6b4d00; }
.admin-row.is-disabled .admin-person .avatar, .admin-row.is-disabled .member-info strong { opacity: .5; }
.admin-bg { width: 40px; height: 30px; border-radius: 6px; flex: none; }
.temp-pass { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 17px !important; letter-spacing: .04em; text-align: center; }
.pop-list { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.45; display: grid; gap: 3px; }
.pad { padding: 20px 16px; margin: 0; }
@media (max-width: 760px) {
    .admin { padding: 18px 12px 40px; gap: 14px; }
    .admin-head h1 { font-size: 24px; }
    .admin-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .admin-stat { padding: 12px; }
    .admin-tabs, .admin-search { flex: 1 1 100%; max-width: none; }
    .admin-row-head { display: none; }
    .admin-row { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 10px; padding: 14px 12px; }
    .admin-person { grid-column: 1 / -1; }
    .admin-row .admin-cell { font-size: 12px; }
    .admin-row .admin-cell::before { content: attr(data-label); display: block; font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
    .admin-actions { grid-column: 1 / -1; justify-content: stretch; }
    .admin-actions .btn { flex: 1; justify-content: center; }
}
