:root {
    color-scheme: light dark;
    --bg: light-dark(#f4f5f7, #14161b);
    --ink: light-dark(#1f2430, #e6e8ed);
    --muted: light-dark(#6b7280, #9aa3b2);
    --card-shadow: light-dark(0 6px 18px rgba(0, 0, 0, 0.12), 0 6px 18px rgba(0, 0, 0, 0.5));
    --radius: 14px;

    /* Superfici "chrome" (UI app) - adattive a tema chiaro/scuro */
    --surface: light-dark(#ffffff, #1d2027);
    --surface-2: light-dark(#fafbfc, #23262e);
    --surface-3: light-dark(#f3f4f6, #2a2e37);
    --border: light-dark(#e5e7eb, #333842);
    --border-strong: light-dark(#d1d5db, #3d4350);
    --glass: light-dark(rgba(255, 255, 255, .9), rgba(24, 27, 33, .85));
    --glass-border: light-dark(rgba(15, 23, 42, .06), rgba(255, 255, 255, .08));

    /* Stile post-it cartaceo (rif. CodePen HejChristian "Sticky Note") */
    --ink-dark: #100F0F;
    --ink-25: rgba(16, 15, 15, .22);
    --ink-50: rgba(16, 15, 15, .42);
    --font-hand: 'Shantell Sans', 'Comic Sans MS', cursive;
    --texture-noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.22'/%3E%3C/svg%3E");
    --badge-overdue: #e03131;
    --badge-overdue-text: #fff;
    --badge-today: #f08c00;
    --badge-today-text: #fff;
    --badge-soon: #f59f00;
    --badge-soon-text: rgba(0, 0, 0, .82);
    --badge-future: #4dabf7;
    --badge-future-text: rgba(0, 0, 0, .82);
    --badge-done: #adb5bd;
    --badge-done-text: rgba(0, 0, 0, .65);
    --patient-highlight-border: #228be6;
    --note-action-bg: rgba(255, 255, 255, .32);
    --note-action-border: rgba(0, 0, 0, .14);
    --note-action-fg: #9aa0aa;
    --note-action-done-hover: #2f9e44;
    --note-action-highlight-hover: var(--patient-highlight-border);
    --note-action-share-hover: #1c7ed6;
    --note-action-whatsapp-hover: #25d366;
    --note-action-archive-hover: #f08c00;
    --note-action-delete-hover: #e03131;
}

/* Token espliciti per tema manuale (oltre a light-dark() su :root) */
[data-theme="light"] {
    color-scheme: light;
    --ink: #1f2430;
    --muted: #6b7280;
    --bg: #f4f5f7;
    --surface: #ffffff;
    --surface-2: #fafbfc;
    --surface-3: #f3f4f6;
    --border: #e5e7eb;
    --border-strong: #d1d5db;
    --glass: rgba(255, 255, 255, .9);
    --glass-border: rgba(15, 23, 42, .06);
    --note-action-bg: rgba(255, 255, 255, .32);
    --note-action-border: rgba(0, 0, 0, .14);
    --note-action-fg: #9aa0aa;
    --note-action-done-hover: #2f9e44;
    --note-action-highlight-hover: var(--patient-highlight-border);
    --note-action-share-hover: #1c7ed6;
    --note-action-whatsapp-hover: #25d366;
    --note-action-archive-hover: #f08c00;
    --note-action-delete-hover: #e03131;
}

[data-theme="dark"] {
    color-scheme: dark;
    --ink: #e6e8ed;
    --muted: #9aa3b2;
    --bg: #14161b;
    --surface: #1d2027;
    --surface-2: #23262e;
    --surface-3: #2a2e37;
    --border: #333842;
    --border-strong: #3d4350;
    --glass: rgba(24, 27, 33, .85);
    --glass-border: rgba(255, 255, 255, .08);
    --note-action-bg: rgba(255, 255, 255, .26);
    --note-action-border: rgba(0, 0, 0, .11);
    --note-action-fg: rgba(0, 0, 0, .42);
    --note-action-done-hover: #40c057;
    --note-action-highlight-hover: color-mix(in srgb, var(--patient-highlight-border) 72%, #ffffff);
    --note-action-share-hover: #4dabf7;
    --note-action-whatsapp-hover: #37d67a;
    --note-action-archive-hover: #ff922b;
    --note-action-delete-hover: #ff6b6b;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: radial-gradient(1200px 600px at 50% -10%, #ffffff, var(--bg));
    color: var(--ink);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    flex: 1 0 auto;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 14px 20px 8px;
    background: rgba(255, 255, 255, .9);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(15, 23, 42, .06);
}

.topbar-inner {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.topbar-search-wrap {
    flex: 1 1 220px;
    min-width: 0;
    max-width: 520px;
}

.topbar-search.board-search {
    width: 100%;
}

.topbar-search-wrap .board-search-hint {
    margin: 4px 2px 0;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.logo {
    margin: 0;
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -1px;
}
.logo span { color: #f59f00; }

.tagline {
    margin: 6px 0 0;
    color: var(--muted);
}

.container {
    width: 100%;
    margin: 0;
    padding: 16px 20px 24px;
}

.board-search {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 0 14px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
    transition: border-color .15s ease, box-shadow .15s ease;
}

.board-search:focus-within {
    border-color: #f59f00;
    box-shadow: 0 0 0 3px rgba(245, 159, 0, .12);
}

.board-search-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #9aa0aa;
    flex: 0 0 auto;
}

.board-search-input {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
    border: 0;
    background: transparent;
    padding: 11px 0;
    font-size: .95rem;
    font-family: inherit;
    color: var(--ink);
    outline: none;
}

.board-search-input::-webkit-search-decoration,
.board-search-input::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
    display: none;
}

.board-search-clear {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin: 0 -4px 0 0;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}

.board-search-clear[hidden] {
    display: none !important;
}

.board-search-clear:hover,
.board-search-clear:focus-visible {
    background: rgba(15, 23, 42, .08);
    color: var(--ink);
    outline: none;
}

.board-search-hint {
    margin: 6px 2px 0;
    font-size: .82rem;
    color: var(--muted);
}

.card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    padding: 20px;
}

.section-title {
    margin: 0 0 8px;
    font-size: 1.25rem;
}

.section-help {
    margin: 0 0 18px;
    color: var(--muted);
}

.section-title + .board-header,
.board-header .section-title {
    margin-bottom: 0;
}

.board-header {
    margin: 8px 0 16px;
}

.board-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.view-toggle {
    display: inline-flex;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    flex-shrink: 0;
}

.view-toggle-btn {
    border: 0;
    background: transparent;
    padding: 8px 14px;
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
    color: var(--muted);
}

.view-toggle-btn.is-active {
    background: #1f2430;
    color: #fff;
}

.view-toggle-btn:not(.is-active):hover {
    background: #f3f4f6;
}

.view-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-secondary.has-icon {
    gap: 6px;
}

/* Desktop: mostriamo il testo dei pulsanti, le icone restano nascoste */
.btn-icon {
    display: none;
    flex: 0 0 auto;
}

/* FAB nuova nota, pulsante chiudi composer e backdrop: solo mobile */
.composer-fab {
    display: none;
    position: fixed;
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    z-index: 950;
    width: 56px;
    height: 56px;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: #f59f00;
    color: #1f2430;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .3);
    cursor: pointer;
    transition: transform .12s ease, background .15s ease;
}

.composer-fab:hover { background: #ffb020; }
.composer-fab:active { transform: scale(.94); }

.composer-close {
    display: none;
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 7px;
    background: rgba(255, 255, 255, .14);
    color: #fff;
    cursor: pointer;
}

.composer-close:hover { background: rgba(255, 255, 255, .25); }

.composer-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 890;
    background: rgba(0, 0, 0, .45);
}

.stale-notes-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    background: #fff;
    color: #9ca3af;
    cursor: default;
    flex-shrink: 0;
    transition: color .15s, border-color .15s, background .15s, box-shadow .15s;
}

.stale-notes-btn:not(:disabled) {
    cursor: pointer;
    color: #d97706;
    border-color: #fbbf24;
    background: #fffbeb;
}

.stale-notes-btn.is-open {
    background: #d97706;
    border-color: #d97706;
    color: #fff;
    box-shadow: 0 0 0 2px rgba(217, 119, 6, .25);
}

.stale-notes-btn:disabled {
    opacity: .55;
}

.stale-section-head {
    margin: 0 0 16px;
    padding: 0 4px;
}

.stale-section-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: #92400e;
}

.stale-section-sub {
    margin: 4px 0 0;
    font-size: .9rem;
    color: var(--muted);
}

.stale-list .card-drag-handle {
    display: none;
}

.stale-list .due-list-item {
    border-left: 4px solid #f59e0b;
}

.composer-bar {
    position: sticky;
    bottom: 0;
    left: 0;
    z-index: 900;
    display: flex;
    align-items: flex-end;
    gap: 6px;
    width: 100%;
    padding: 6px 12px;
    background: #1f2430;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, .18);
}

.composer-bar input,
.composer-bar select {
    height: 34px;
    border: 1px solid transparent;
    border-radius: 7px;
    padding: 0 8px;
    font-size: .9rem;
    font-family: inherit;
    background: #fff;
    color: var(--ink);
    outline: none;
}

.composer-bar input:focus,
.composer-bar select:focus {
    border-color: #f59f00;
}

.cb-note,
#note-input.cb-note {
    flex: 1 1 auto;
    min-width: 120px;
    resize: none;
    min-height: 34px;
    max-height: 120px;
    overflow-y: auto;
    padding: 6px 8px;
    line-height: 1.35;
    font-size: .9rem;
    border-radius: 7px;
    border: 1px solid transparent;
    font-family: inherit;
}

.cb-field {
    flex: 0 0 auto;
}

.composer-patient-wrap {
    position: relative;
    flex: 0 0 auto;
    width: 150px;
}

.composer-patient-wrap .cb-patient {
    width: 100%;
    box-sizing: border-box;
}

.patient-suggestions {
    position: absolute;
    bottom: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 10;
    max-height: min(220px, 40vh);
    overflow-y: auto;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    box-shadow: 0 -6px 20px rgba(0, 0, 0, .12);
    padding: 4px;
}

.patient-suggest-item {
    display: block;
    width: 100%;
    border: 0;
    background: transparent;
    text-align: left;
    padding: 8px 10px;
    font-size: .9rem;
    border-radius: 7px;
    cursor: pointer;
    color: var(--ink);
    font-family: inherit;
}

.patient-suggest-item:hover,
.patient-suggest-item.is-active {
    background: #f1f3f5;
}

.cb-topic {
    width: 150px;
}

.cb-due {
    width: 140px;
}

.cb-due-type {
    width: 90px;
}

.cb-add {
    flex: 0 0 auto;
    height: 34px;
    border: 0;
    border-radius: 7px;
    padding: 0 16px;
    font-size: .9rem;
    font-weight: 700;
    cursor: pointer;
    background: #f59f00;
    color: #1f2430;
}
.cb-add:hover { background: #ffb020; }

#note-input,
.field input,
.field select,
.note-body,
.note-select {
    width: 100%;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    background: #fff;
}

#note-input {
    resize: vertical;
}

#note-input:focus,
.field input:focus,
.field select:focus,
.note-body:focus,
.note-select:focus {
    border-color: #f59f00;
}

.composer-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 12px;
}

.composer-grid-3 {
    grid-template-columns: 1.2fr 1fr 0.9fr;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field span,
.field-label {
    font-size: .9rem;
    color: var(--muted);
}

.composer-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-top: 14px;
    flex-wrap: wrap;
}

.composer-row-end {
    justify-content: flex-end;
}

.board-header .section-help {
    margin: 0 0 16px;
    color: var(--muted);
}

.btn-primary,
.btn-secondary,
.btn-ghost {
    border-radius: 10px;
    padding: 10px 18px;
    font-size: .95rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
}

.btn-primary {
    background: #1f2430;
    color: #fff;
}
.btn-primary:hover { background: #000; }

.btn-secondary {
    background: #fff;
    color: var(--ink);
    border: 1px solid #d1d5db;
}
.btn-secondary:hover { background: #f9fafb; }

.btn-ghost {
    background: transparent;
    color: var(--ink);
    border: 1px solid #e5e7eb;
}
.btn-ghost:hover { background: #f3f4f6; }

.board {
    display: flex;
    align-items: flex-start;
    gap: 24px;
    padding-top: 6px;
}

.masonry-col {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.masonry-col > .topic-card,
.masonry-col > .card-drag-placeholder {
    width: 100%;
    margin: 0;
}

/* In ricerca le colonne non si allargano: larghezza naturale del post-it */
.board.board-search-active .masonry-col {
    flex: 0 0 300px;
    width: 300px;
}

.board.board-list {
    display: block;
}

.board.board-patients {
    display: block;
}

.patient-section {
    width: 100%;
}

.patient-section-head {
    font-size: .8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--muted);
    margin: 0 0 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.patient-section-star {
    color: var(--patient-highlight-border, #228be6);
    font-size: 1rem;
}

.patient-section-divider {
    border: 0;
    border-top: 2px dashed #d1d5db;
    margin: 8px 0 20px;
}

.patient-section-empty {
    color: var(--muted);
    font-size: .9rem;
    font-style: italic;
    margin: 0;
    padding: 8px 2px;
    width: 100%;
}

/* Sezione "In evidenza": layout orizzontale */
.patient-section-highlighted .patient-section-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    align-items: flex-start;
    min-height: 80px;
}

.patient-section-highlighted .patient-section-grid > .masonry-col > .topic-card,
.patient-section-highlighted .patient-section-grid > .masonry-col > .card-drag-placeholder {
    width: 100%;
    margin: 0;
}

/* Card trascinata o placeholder come figli diretti della griglia in evidenza */
.patient-section-highlighted .patient-section-grid > .topic-card,
.patient-section-highlighted .patient-section-grid > .card-drag-placeholder {
    width: 300px;
    margin: 0;
}

/* Sezione normale: layout masonry a colonne (JS) */
.patient-section-normal .patient-section-grid {
    display: flex;
    align-items: flex-start;
    gap: 24px;
    min-height: 60px;
}

.patient-section-normal .patient-section-grid > .masonry-col > .topic-card,
.patient-section-normal .patient-section-grid > .masonry-col > .card-drag-placeholder {
    width: 100%;
    margin: 0;
}

/* Sezione "Stand by": layout orizzontale, solo trascinamento */
.patient-section-standby .patient-section-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    align-items: flex-start;
    min-height: 80px;
}

.patient-section-standby .patient-section-grid > .topic-card,
.patient-section-standby .patient-section-grid > .card-drag-placeholder {
    width: 300px;
    margin: 0;
}

.board-list {
    display: block;
}

.due-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    min-height: 56px;
}

.due-section-highlighted {
    width: 100%;
}

.due-highlight-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    align-items: flex-start;
    min-height: 56px;
}

.due-highlight-card,
.due-highlight-grid > .card-drag-placeholder {
    flex: 0 0 auto;
    width: 260px;
    margin: 0;
}

.due-list > .card-drag-placeholder {
    min-height: 0;
    border-radius: 8px;
}

.due-highlight-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    width: 26px;
    height: 26px;
    padding: 0;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    font-family: inherit;
    border: 1px solid var(--note-action-border);
    background: var(--note-action-bg);
    color: var(--note-action-fg);
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.due-highlight-btn:hover:not(.is-active),
.note-highlight-btn:hover:not(.is-active) {
    background: var(--note-action-highlight-hover);
    border-color: var(--note-action-highlight-hover);
    color: #fff;
}

.due-highlight-btn.is-active,
.note-highlight-btn.is-active {
    background: var(--patient-highlight-border);
    border-color: var(--patient-highlight-border);
    color: #fff;
}

.due-highlight-btn.is-active:hover,
.note-highlight-btn.is-active:hover {
    filter: brightness(1.08);
    color: #fff;
}

/* Post-it colorati: icone inattive con vetro trasparente */
.topic-card .due-highlight-btn:not(:hover):not(.is-active),
.topic-card .note-highlight-btn:not(:hover):not(.is-active),
.topic-card .note-item-delete:not(:hover),
.topic-card .note-item-share:not(:hover),
.topic-card .note-item-whatsapp:not(:hover),
.topic-card .note-item-archive:not(:hover),
.topic-card .done-toggle:not(:hover) input:not(:checked) + .done-toggle-mark,
.due-highlight-card .due-highlight-btn:not(:hover):not(.is-active),
.due-highlight-card .note-highlight-btn:not(:hover):not(.is-active),
.due-highlight-card .note-item-delete:not(:hover),
.due-highlight-card .note-item-share:not(:hover),
.due-highlight-card .note-item-whatsapp:not(:hover),
.due-highlight-card .note-item-archive:not(:hover),
.due-highlight-card .done-toggle:not(:hover) input:not(:checked) + .done-toggle-mark {
    background: rgba(255, 255, 255, .30);
    border-color: rgba(0, 0, 0, .12);
    backdrop-filter: brightness(1.08);
    -webkit-backdrop-filter: brightness(1.08);
}

[data-theme="dark"] .topic-card .due-highlight-btn:not(:hover):not(.is-active),
[data-theme="dark"] .topic-card .note-highlight-btn:not(:hover):not(.is-active),
[data-theme="dark"] .topic-card .note-item-delete:not(:hover),
[data-theme="dark"] .topic-card .note-item-share:not(:hover),
[data-theme="dark"] .topic-card .note-item-whatsapp:not(:hover),
[data-theme="dark"] .topic-card .note-item-archive:not(:hover),
[data-theme="dark"] .topic-card .done-toggle:not(:hover) input:not(:checked) + .done-toggle-mark,
[data-theme="dark"] .due-highlight-card .due-highlight-btn:not(:hover):not(.is-active),
[data-theme="dark"] .due-highlight-card .note-highlight-btn:not(:hover):not(.is-active),
[data-theme="dark"] .due-highlight-card .note-item-delete:not(:hover),
[data-theme="dark"] .due-highlight-card .note-item-share:not(:hover),
[data-theme="dark"] .due-highlight-card .note-item-whatsapp:not(:hover),
[data-theme="dark"] .due-highlight-card .note-item-archive:not(:hover),
[data-theme="dark"] .due-highlight-card .done-toggle:not(:hover) input:not(:checked) + .done-toggle-mark {
    background: rgba(255, 255, 255, .26);
    border-color: rgba(0, 0, 0, .10);
    color: rgba(0, 0, 0, .42);
    backdrop-filter: brightness(1.10);
    -webkit-backdrop-filter: brightness(1.10);
}

/* Dashboard e liste scadenza: inattive chrome in dark mode */
[data-theme="dark"] .dashboard .due-highlight-btn:not(:hover):not(.is-active),
[data-theme="dark"] .dashboard .note-highlight-btn:not(:hover):not(.is-active),
[data-theme="dark"] .dashboard .note-item-delete:not(:hover),
[data-theme="dark"] .dashboard .due-list-delete:not(:hover),
[data-theme="dark"] .dashboard .note-item-share:not(:hover),
[data-theme="dark"] .dashboard .note-item-whatsapp:not(:hover),
[data-theme="dark"] .dashboard .note-item-archive:not(:hover),
[data-theme="dark"] .dashboard .done-toggle:not(:hover) input:not(:checked) + .done-toggle-mark,
[data-theme="dark"] .due-list-item .due-highlight-btn:not(:hover):not(.is-active),
[data-theme="dark"] .due-list-item .note-highlight-btn:not(:hover):not(.is-active),
[data-theme="dark"] .due-list-item .note-item-delete:not(:hover),
[data-theme="dark"] .due-list-item .due-list-delete:not(:hover),
[data-theme="dark"] .due-list-item .note-item-share:not(:hover),
[data-theme="dark"] .due-list-item .note-item-whatsapp:not(:hover),
[data-theme="dark"] .due-list-item .note-item-archive:not(:hover),
[data-theme="dark"] .due-list-item .done-toggle:not(:hover) input:not(:checked) + .done-toggle-mark {
    background: var(--surface-3);
    border-color: var(--border);
    color: var(--muted);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

/* Hover colorati: annulla vetro/backdrop */
.due-highlight-btn:hover:not(.is-active),
.note-highlight-btn:hover:not(.is-active),
.note-item-delete:hover,
.due-list-delete:hover,
.note-item-share:hover,
.note-item-whatsapp:hover,
.note-item-archive:hover,
.done-toggle:hover .done-toggle-mark {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.due-list-item {
    display: grid;
    grid-template-columns: minmax(190px, 250px) 1fr auto;
    align-items: center;
    gap: 14px;
    padding: 8px 12px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .06);
}

.due-list-col {
    min-width: 0;
}

.due-list-item.is-dragging,
.due-list-item.is-landing {
    position: fixed;
    margin: 0;
    opacity: 1;
    z-index: 1000;
    pointer-events: none;
    cursor: grabbing;
}

.due-list-item.is-dragging {
    transform: translateY(-8px) scale(1.015) !important;
    box-shadow: 0 14px 24px rgba(16, 15, 15, .22);
    transition: transform 80ms ease, box-shadow 80ms ease !important;
}

.due-list-item.drag-over:not(.is-dragging) {
    opacity: .72;
}

.due-list-item.is-done {
    opacity: .65;
}

.due-list-item.is-done .due-list-body {
    text-decoration: line-through;
}

.due-list-item.is-overdue {
    border-left: 3px solid #e03131;
    background: #fff5f5;
}

.due-list-info {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
}

.due-list-line {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.due-list-line-main .due-list-topic {
    flex: 1 1 auto;
}

.due-list-line-patient .due-list-patient {
    flex: 1 1 auto;
    max-width: none;
}

.due-list-date-col {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    min-height: 28px;
}

.due-list-date-col .note-due {
    margin-left: 0;
}

.due-list-text {
    min-width: 0;
}

.due-list-patient {
    flex: 1 1 90px;
    min-width: 80px;
    max-width: 200px;
    padding: 2px 6px;
    font-size: .78rem;
    font-weight: 600;
    border: 1px solid transparent;
    border-radius: 4px;
    background: #f3f4f6;
    font-family: inherit;
    outline: none;
}

.due-list-patient:focus {
    border-color: #f59f00;
    background: #fff;
}

.due-list-body {
    width: 100%;
    border: none;
    background: transparent;
    resize: none;
    overflow: hidden;
    font-size: .92rem;
    line-height: 1.35;
    font-family: inherit;
    outline: none;
    min-height: 0;
}

.due-list-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: flex-start;
    gap: 4px;
}

.due-list-actions-icons {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.due-list-delete {
    margin-top: 0;
}

.done-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    flex: 0 0 auto;
    cursor: pointer;
}

.done-toggle input {
    position: absolute;
    inset: 0;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.done-toggle-mark {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    border: 1px solid var(--note-action-border);
    background: var(--note-action-bg);
    position: relative;
    transition: background-color .15s ease, border-color .15s ease, filter .15s ease;
}

.done-toggle-mark::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 45%;
    width: 6px;
    height: 11px;
    border: solid var(--note-action-fg);
    border-width: 0 2px 2px 0;
    transform: translate(-50%, -50%) rotate(45deg);
    transition: border-color .15s ease;
}

.done-toggle:hover .done-toggle-mark {
    background: var(--note-action-done-hover);
    border-color: var(--note-action-done-hover);
}

.done-toggle:hover .done-toggle-mark::after {
    border-color: #fff;
}

.done-toggle input:checked + .done-toggle-mark,
.done-toggle:hover input:checked + .done-toggle-mark {
    background: var(--note-action-done-hover);
    border-color: var(--note-action-done-hover);
}

.done-toggle input:checked + .done-toggle-mark::after,
.done-toggle:hover input:checked + .done-toggle-mark::after {
    border-color: #fff;
}

.done-toggle input:checked:hover + .done-toggle-mark {
    filter: brightness(1.08);
}

.topic-card {
    position: relative;
    padding: 16px 16px 24px;
    min-height: 200px;
    color: var(--ink-dark);
    background-color: var(--note-bg, #feff9c);
    background-image:
        var(--texture-noise),
        linear-gradient(165deg, transparent 84%, var(--ink-25) 100%);
    border-radius: 0 0 120px 0 / 0 0 18px 0;
    border-bottom: solid 2px var(--ink-50);
    outline: solid 1px var(--ink-25);
    outline-offset: -1px;
    transform: perspective(1px) rotate(var(--rot, 0deg));
    box-shadow: 0 6px 8px var(--ink-25);
    transition: transform .2s ease, box-shadow .2s ease, border-radius .2s ease, opacity .2s ease;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.topic-card.is-settling {
    transition: transform 220ms cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow .2s ease;
}

.topic-card:hover:not(.is-dragging) {
    transform: perspective(1px) rotate(0deg) translateY(-4px);
    box-shadow: 0 12px 16px var(--ink-25);
}

.topic-title {
    margin: 0;
    font-family: var(--font-hand);
    font-size: 1.45rem;
    font-weight: 700;
    line-height: 1.1;
    border-bottom: 1px solid var(--ink-25);
    padding-bottom: 6px;
}

.topic-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    border-bottom: 1px solid rgba(0, 0, 0, .12);
    padding-bottom: 8px;
    margin-bottom: 4px;
}

.topic-title-row .topic-title {
    border-bottom: 0;
    padding-bottom: 0;
    flex: 1;
    min-width: 0;
}

.topic-title-block {
    flex: 1;
    min-width: 0;
}

.topic-title-block .topic-title {
    border-bottom: 0;
    padding-bottom: 0;
}

.topic-description {
    margin: 4px 0 0;
    font-family: var(--font-hand);
    font-size: .78rem;
    font-weight: 400;
    line-height: 1.35;
    color: rgba(0, 0, 0, .55);
}

.patient-title-input {
    flex: 1;
    min-width: 0;
    border: 0;
    background: transparent;
    font-family: var(--font-hand);
    font-size: 1.45rem;
    font-weight: 700;
    line-height: 1.1;
    padding: 0;
    color: inherit;
    outline: none;
}

.patient-title-input:focus {
    outline: 1px dashed rgba(0, 0, 0, .28);
    outline-offset: 2px;
}

.patient-card-color {
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid rgba(0, 0, 0, .15);
    border-radius: 6px;
    cursor: pointer;
    background: transparent;
    flex-shrink: 0;
}

.patient-color-choice {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

.patient-card-color-badge {
    width: 26px;
    height: 26px;
    padding: 0;
    border: 1px solid rgba(0, 0, 0, .18);
    border-radius: 6px;
    cursor: pointer;
    flex-shrink: 0;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .5);
}

.patient-card-color-native {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: 0;
    border: 0;
    opacity: 0;
    pointer-events: none;
}

.color-popup {
    position: absolute;
    z-index: 1200;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
    padding: 10px;
    width: max-content;
    max-width: 240px;
}

.color-popup-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
}

.color-popup-swatch {
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid rgba(0, 0, 0, .2);
    border-radius: 6px;
    cursor: pointer;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .5);
}

.color-popup-swatch.is-current {
    outline: 2px solid #f59f00;
    outline-offset: 1px;
}

.color-popup-hex {
    display: flex;
    gap: 6px;
    margin-top: 10px;
}

.color-popup-hex-input {
    flex: 1 1 auto;
    width: 100%;
    height: 30px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 0 8px;
    font-family: inherit;
    font-size: .82rem;
    text-transform: uppercase;
}

.color-popup-hex-btn {
    flex: 0 0 auto;
    height: 30px;
    padding: 0 12px;
    border: 0;
    border-radius: 6px;
    background: #f59f00;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
}

.patient-card-neutral {
    background-color: var(--note-bg, #f3f4f6);
}

.patient-card.is-highlighted {
    outline: 3px solid var(--patient-highlight-border, #228be6);
    outline-offset: 3px;
}

.patient-highlight-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(0, 0, 0, .18);
    border-radius: 6px;
    width: 26px;
    height: 26px;
    padding: 0;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    background: rgba(255, 255, 255, .55);
    color: rgba(0, 0, 0, .35);
    font-family: inherit;
}

.patient-highlight-btn:hover {
    background: rgba(255, 255, 255, .9);
}

.patient-highlight-btn.is-active {
    background: var(--patient-highlight-border, #228be6);
    border-color: var(--patient-highlight-border, #228be6);
    color: #fff;
}

.inbox-card {
    outline: 1px dashed var(--ink-50);
    outline-offset: -1px;
}

.inbox-card .topic-title-row {
    border-bottom-color: var(--ink-25);
}

.card-drag-handle {
    cursor: grab;
    user-select: none;
    touch-action: none;
    color: rgba(0, 0, 0, .45);
    font-size: .8rem;
    line-height: 1;
    letter-spacing: -2px;
    padding: 0 2px;
    flex-shrink: 0;
}

.card-drag-handle:active {
    cursor: grabbing;
}

.topic-card.is-dragging {
    position: fixed;
    margin: 0;
    opacity: 1;
    z-index: 1000;
    pointer-events: none;
    cursor: grabbing;
    transform: perspective(1px) rotate(-1.5deg) translateY(-12px) scale(1.035) !important;
    filter:
        drop-shadow(0 22px 28px rgba(16, 15, 15, .32))
        drop-shadow(0 8px 12px rgba(16, 15, 15, .18)) !important;
    border-radius: 0 0 160px 0 / 0 0 36px 0 !important;
    background-image:
        var(--texture-noise),
        linear-gradient(155deg, transparent 78%, rgba(16, 15, 15, .32) 100%) !important;
    transition: transform 80ms ease, filter 80ms ease, border-radius 80ms ease !important;
}

.topic-card.is-landing {
    position: fixed;
    z-index: 1000;
    pointer-events: none;
}

.card-drag-placeholder {
    border-radius: 0 0 120px 0 / 0 0 18px 0;
    background: rgba(16, 15, 15, .05);
    box-shadow: inset 0 0 0 1px rgba(16, 15, 15, .1);
    min-height: 200px;
    transition: height 200ms ease;
}

.topic-card.drag-over:not(.is-dragging) {
    opacity: .72;
    transform: perspective(1px) rotate(var(--rot, 0deg)) scale(0.97);
    filter: drop-shadow(0 3px 6px var(--ink-25));
}

.board.is-reordering .topic-card:not(.is-dragging),
.board.is-reordering .due-list-item:not(.is-dragging) {
    transition: transform 220ms cubic-bezier(0.25, 0.8, 0.25, 1), filter .2s ease, opacity .2s ease;
}

.topic-notes {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.topic-empty {
    margin: 0;
    font-family: var(--font-hand);
    font-size: 1rem;
    font-style: italic;
    color: var(--ink-50);
}

.patient-note-add {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px dashed var(--ink-25);
}

.patient-note-add-toggle {
    width: 100%;
    border: 0;
    background: transparent;
    font-family: var(--font-hand);
    font-size: .92rem;
    color: rgba(0, 0, 0, .55);
    cursor: pointer;
    padding: 4px 2px;
    text-align: left;
    transition: color .15s ease;
}

.patient-note-add-toggle:hover {
    color: rgba(0, 0, 0, .85);
}

.patient-note-add-form {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.patient-note-add-input {
    width: 100%;
    border: 1px solid rgba(0, 0, 0, .15);
    border-radius: 8px;
    padding: 8px 10px;
    font-family: var(--font-hand);
    font-size: .98rem;
    line-height: 1.25;
    color: var(--ink-dark);
    background: rgba(255, 255, 255, .55);
    resize: none;
    overflow: hidden;
    min-height: 0;
    outline: none;
}

.patient-note-add-input:focus {
    border-color: #f59f00;
    background: rgba(255, 255, 255, .85);
}

.patient-note-add-actions {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
}

.patient-note-add-submit {
    border: 0;
    border-radius: 8px;
    padding: 6px 12px;
    font-size: .82rem;
    font-weight: 600;
    cursor: pointer;
    background: #1f2430;
    color: #fff;
}

.patient-note-add-submit:hover {
    background: #000;
}

.patient-note-add-cancel {
    padding: 6px 10px;
    font-size: .82rem;
}

.patient-name-uppercase #patient-input,
.patient-name-uppercase .note-item-patient,
.patient-name-uppercase .due-list-patient,
.patient-name-uppercase .patient-title-input {
    text-transform: uppercase;
}

.note-item {
    background: transparent;
    border: 0;
    border-bottom: 1px dashed var(--ink-25);
    border-radius: 0;
    padding: 4px 2px;
}

.note-item:last-child {
    border-bottom: 0;
}

.note-item.is-done {
    opacity: .6;
}
.note-item.is-done .note-item-body {
    text-decoration: line-through;
}

.note-item.has-patient-multi {
    cursor: help;
}

.note-item-top {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 1px;
}

.note-item-patient {
    flex: 1;
    min-width: 0;
    border: none;
    background: rgba(255, 255, 255, .4);
    border-radius: 4px;
    padding: 1px 5px;
    font-family: var(--font-hand);
    font-size: .88rem;
    font-weight: 600;
    outline: none;
    color: var(--ink-dark);
}

.note-item-patient::placeholder {
    font-weight: 400;
    color: rgba(0, 0, 0, .4);
}

.note-item-patient-badge {
    font-size: .55rem;
    color: rgba(0, 0, 0, .55);
    line-height: 1;
}

.note-item-topic-tag {
    display: inline-block;
    font-size: .68rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 4px;
    background: var(--topic-color, #ffe066);
    color: rgba(0, 0, 0, .75);
    margin-bottom: 2px;
    border: 1px solid rgba(0, 0, 0, .1);
}

.note-item-delete,
.due-list-delete {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--note-action-border);
    background: var(--note-action-bg);
    border-radius: 6px;
    width: 26px;
    height: 26px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    color: var(--note-action-fg);
    padding: 0;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.note-item-delete:hover,
.due-list-delete:hover {
    background: var(--note-action-delete-hover);
    border-color: var(--note-action-delete-hover);
    color: #fff;
}

.note-item-body {
    width: 100%;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: var(--font-hand);
    font-size: .98rem;
    line-height: 1.25;
    color: var(--ink-dark);
    border: none;
    background: transparent;
    resize: none;
    overflow: hidden;
    min-height: 0;
    outline: none;
    display: block;
}

.note-item-controls {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    align-items: center;
    justify-content: flex-end;
    margin-top: 4px;
}

.note-item-controls-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    align-items: center;
    margin-left: auto;
}

.note-item-controls .note-shared-badge {
    margin-right: auto;
}

.note-created-date {
    font-size: .66rem;
    color: rgba(0, 0, 0, .45);
    white-space: nowrap;
    line-height: 1.2;
}

.note-created-date--inline {
    flex: 0 0 auto;
}

.note-created-date--due {
    text-align: right;
}

.checkbox-inline,
.checkbox-field {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: .72rem;
    color: var(--ink);
}
.checkbox-inline input {
    margin: 0;
    width: 13px;
    height: 13px;
}

.note-item-due {
    padding: 1px 3px;
    font-size: .7rem;
    border: 1px solid rgba(0, 0, 0, .15);
    border-radius: 4px;
    background: rgba(255, 255, 255, .6);
    font-family: inherit;
    color: rgba(0, 0, 0, .75);
}

.note-item-meta {
    font-size: .66rem;
    color: rgba(0, 0, 0, .45);
    margin-left: auto;
    white-space: nowrap;
}

.note-item-controls .note-item-delete {
    margin-left: 0;
}

.note-item-archive {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    min-width: 26px;
    flex: 0 0 auto;
    padding: 0;
    border: 1px solid var(--note-action-border);
    border-radius: 6px;
    background: var(--note-action-bg);
    color: var(--note-action-fg);
    cursor: pointer;
    line-height: 1;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.note-item-archive:hover {
    background: var(--note-action-archive-hover);
    border-color: var(--note-action-archive-hover);
    color: #fff;
}

.note-archived-badge {
    font-size: .66rem;
    color: rgba(0, 0, 0, .5);
    font-style: italic;
    white-space: nowrap;
}

.note-item.is-archived,
.due-list-item.is-archived {
    opacity: .75;
}

.archive-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.archive-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, .45);
}

.archive-modal-dialog {
    position: relative;
    width: min(1100px, 100%);
    max-height: min(88vh, 900px);
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .22);
    overflow: hidden;
}

.archive-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px 14px;
    border-bottom: 1px solid #e5e7eb;
}

.archive-modal-title {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 700;
}

.archive-modal-subtitle {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: .9rem;
}

.archive-modal-close {
    border: 0;
    background: transparent;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    color: var(--muted);
    padding: 4px 8px;
    border-radius: 8px;
}
.archive-modal-close:hover {
    background: #f3f4f6;
    color: var(--ink);
}

.archive-table-wrap {
    flex: 1 1 auto;
    overflow: auto;
    min-height: 200px;
}

.archive-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
}

.archive-col-headers th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f8fafc;
    text-align: left;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--muted);
    padding: 10px 12px;
    border-bottom: 1px solid #e5e7eb;
    white-space: nowrap;
}

.archive-filters th {
    position: sticky;
    top: 38px;
    z-index: 2;
    background: #fff;
    padding: 6px 8px 10px;
    border-bottom: 1px solid #e5e7eb;
}

.archive-filter {
    width: 100%;
    min-width: 90px;
    padding: 7px 9px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font: inherit;
    font-size: .85rem;
    background: #fff;
}
.archive-filter:focus {
    outline: 2px solid #93c5fd;
    border-color: #60a5fa;
}

.app-dialog {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: grid;
    place-items: center;
    padding: 18px;
}

.app-dialog-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, .45);
    backdrop-filter: blur(4px);
}

.app-dialog-card {
    position: relative;
    width: min(440px, 100%);
    display: grid;
    grid-template-columns: 44px 1fr;
    gap: 14px;
    padding: 18px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .96), rgba(255, 255, 255, .91)),
        #fff;
    border: 1px solid rgba(15, 23, 42, .12);
    border-radius: 18px;
    box-shadow: 0 26px 70px rgba(15, 23, 42, .28);
    animation: app-dialog-in .14s ease-out;
}

.app-dialog-icon {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: 1px solid rgba(245, 159, 0, .32);
    background: rgba(255, 224, 102, .35);
    color: #8a5a00;
    font-weight: 800;
    font-family: var(--font-ui, system-ui, sans-serif);
}

.app-dialog-danger .app-dialog-icon {
    border-color: rgba(224, 49, 49, .28);
    background: rgba(255, 227, 227, .85);
    color: #c92a2a;
}

.app-dialog-success .app-dialog-icon {
    border-color: rgba(47, 158, 68, .25);
    background: rgba(211, 249, 216, .8);
    color: #2b8a3e;
}

.app-dialog-content {
    min-width: 0;
}

.app-dialog-title {
    margin: 0;
    color: var(--ink);
    font-size: 1.12rem;
    line-height: 1.25;
    font-weight: 800;
}

.app-dialog-message {
    margin: 7px 0 0;
    color: var(--muted);
    font-size: .94rem;
    line-height: 1.45;
    white-space: pre-line;
}

.app-dialog-input {
    width: 100%;
    margin-top: 12px;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    font: inherit;
    background: #fff;
}

.app-dialog-input:focus {
    outline: 2px solid rgba(245, 159, 0, .25);
    border-color: #f59f00;
}

.app-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
}

.app-dialog-btn {
    min-width: 94px;
    padding: 9px 14px;
    border-radius: 12px;
    border: 1px solid transparent;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.app-dialog-btn-ghost {
    border-color: #e5e7eb;
    background: #fff;
    color: var(--ink);
}

.app-dialog-btn-ghost:hover {
    background: #f8fafc;
}

.app-dialog-btn-primary {
    background: #ffe066;
    border-color: #f59f00;
    color: #3b2f00;
}

.app-dialog-btn-primary:hover {
    background: #ffd43b;
}

.app-dialog-danger .app-dialog-btn-primary {
    background: #e03131;
    border-color: #c92a2a;
    color: #fff;
}

.app-dialog-danger .app-dialog-btn-primary:hover {
    background: #c92a2a;
}

@keyframes app-dialog-in {
    from {
        opacity: 0;
        transform: translateY(8px) scale(.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.archive-table tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: top;
    line-height: 1.35;
}

.archive-table tbody tr:hover td {
    background: #f8fafc;
}

.archive-cell-body {
    max-width: 360px;
    white-space: pre-wrap;
    word-break: break-word;
}

.archive-topic {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--topic-color, #ffe066) 55%, #fff);
    font-size: .82rem;
    white-space: nowrap;
}

.archive-audit {
    display: grid;
    gap: 2px;
    min-width: 92px;
}

.archive-audit strong {
    font-size: .84rem;
    font-weight: 700;
    color: var(--ink);
}

.archive-audit small {
    font-size: .74rem;
    color: var(--muted);
    white-space: nowrap;
}

.archive-empty {
    text-align: center;
    color: var(--muted);
    padding: 28px 16px !important;
}

.archive-actions {
    white-space: nowrap;
    text-align: right;
}

.archive-actions .btn-ghost {
    padding: 6px 10px;
    font-size: .82rem;
}

.archive-delete {
    min-width: 32px;
    padding: 6px 8px !important;
    font-size: 1rem;
    line-height: 1;
}

.archive-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 12px 20px 16px;
    border-top: 1px solid #e5e7eb;
    background: #fafbfc;
}

.archive-summary {
    margin: 0;
    color: var(--muted);
    font-size: .9rem;
}

.archive-pagination {
    display: flex;
    align-items: center;
    gap: 10px;
}

.archive-page-info {
    font-size: .88rem;
    color: var(--ink);
    min-width: 110px;
    text-align: center;
}

.archive-page-btn {
    padding: 8px 14px;
    font-size: .88rem;
}

body.archive-open {
    overflow: hidden;
}

.app-toast {
    position: fixed;
    bottom: 70px;
    left: 50%;
    transform: translate(-50%, 16px) scale(.96);
    z-index: 3000;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: rgba(31, 36, 48, .96);
    color: #fff;
    border-radius: 999px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .28);
    font-size: 1rem;
    font-weight: 600;
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease, transform .18s ease;
}

.app-toast.is-visible {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
}

.app-toast-icon {
    font-size: 1.3rem;
    line-height: 1;
}

.note-item-due-type,
.due-list-due-type {
    font-size: .68rem;
    padding: 1px 2px;
    border: 1px solid rgba(0, 0, 0, .15);
    border-radius: 4px;
    background: rgba(255, 255, 255, .6);
    font-family: inherit;
    color: rgba(0, 0, 0, .75);
    cursor: pointer;
}

/* Riga 1 della nota: argomento/paziente + badge scadenza */
.note-item-row1 {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
}

.note-item-row1 .note-item-topic-tag {
    margin-bottom: 0;
}

.note-item-row1 .note-due {
    margin-left: 0;
    flex: 0 0 auto;
}

.note-item-row1 .note-item-topic {
    flex: 1 1 auto;
    min-width: 0;
    max-width: none;
}

.note-item-patient-row {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 3px;
}

.note-due {
    position: relative;
    margin-left: auto;
    display: inline-flex;
    align-items: center;
}

.due-editor {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.due-clear {
    border: 0;
    background: rgba(0, 0, 0, .1);
    border-radius: 4px;
    width: 18px;
    height: 18px;
    cursor: pointer;
    font-size: 13px;
    line-height: 1;
    color: rgba(0, 0, 0, .6);
    padding: 0;
}

.due-clear:hover {
    background: rgba(0, 0, 0, .2);
}

/* Badge scadenza compatto */
.due-badge {
    display: inline-block;
    font-size: .6rem;
    font-weight: 800;
    letter-spacing: .02em;
    line-height: 1;
    padding: 3px 6px;
    border-radius: 4px;
    white-space: nowrap;
    color: #fff;
    background: #868e96;
    border: 0;
    font-family: inherit;
    cursor: pointer;
}

button.due-badge:hover {
    filter: brightness(.95);
}

.due-badge-empty {
    background: transparent;
    color: rgba(0, 0, 0, .45);
    border: 1px dashed rgba(0, 0, 0, .3);
    font-weight: 600;
}

.due-badge-done {
    background: var(--badge-done);
    color: var(--badge-done-text);
}

.due-badge-overdue { background: var(--badge-overdue); color: var(--badge-overdue-text); }
.due-badge-today   { background: var(--badge-today); color: var(--badge-today-text); }
.due-badge-soon    { background: var(--badge-soon); color: var(--badge-soon-text); }
.due-badge-future  { background: var(--badge-future); color: var(--badge-future-text); }

/* Bordo laterale colorato sulle note nei post-it */
.note-item.due-overdue { border-left: 4px solid var(--badge-overdue); }
.note-item.due-today   { border-left: 4px solid var(--badge-today); }
.note-item.due-soon    { border-left: 4px solid var(--badge-soon); }
.note-item.due-future  { border-left: 4px solid var(--badge-future); }

/* Bordo laterale colorato nella vista per scadenza */
.due-list-item.due-overdue {
    border-left: 4px solid var(--badge-overdue);
    background: color-mix(in srgb, var(--badge-overdue) 10%, white);
}
.due-list-item.due-today {
    border-left: 4px solid var(--badge-today);
    background: color-mix(in srgb, var(--badge-today) 10%, white);
}
.due-list-item.due-soon    { border-left: 4px solid var(--badge-soon); }
.due-list-item.due-future  { border-left: 4px solid var(--badge-future); }

.due-list-item.due-overdue .due-list-date-label { color: var(--badge-overdue); }
.due-list-item.due-today .due-list-date-label   { color: var(--badge-today); }

.note-item-topic,
.due-list-topic {
    font-size: .68rem;
    font-weight: 700;
    padding: 1px 4px;
    border: 1px solid rgba(0, 0, 0, .15);
    border-radius: 4px;
    background: rgba(255, 255, 255, .55);
    font-family: inherit;
    color: var(--ink-dark);
    cursor: pointer;
    max-width: 100%;
}

.due-list-topic {
    flex: 0 1 auto;
    min-width: 0;
}

.badge-colors-fieldset {
    border: 0;
    margin: 0;
    padding: 0;
}

.badge-colors-fieldset legend {
    font-size: .9rem;
    color: var(--muted);
    margin-bottom: 8px;
    padding: 0;
}

.badge-colors-row {
    flex-wrap: wrap;
}

.badge-colors-row .field-color {
    flex: 0 0 auto;
    min-width: 72px;
}

.font-opt-shantell { font-family: 'Shantell Sans', cursive; }
.font-opt-caveat { font-family: 'Caveat', cursive; }
.font-opt-patrick { font-family: 'Patrick Hand', cursive; }
.font-opt-kalam { font-family: 'Kalam', cursive; }
.font-opt-architects { font-family: 'Architects Daughter', cursive; }

.patient-popup {
    position: absolute;
    z-index: 1000;
    width: min(320px, calc(100vw - 24px));
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, .18);
    padding: 10px 12px;
    pointer-events: auto;
}

.patient-popup-title {
    font-weight: 800;
    font-size: .95rem;
    margin-bottom: 2px;
}

.patient-popup-help {
    margin: 0 0 8px;
    font-size: .7rem;
    color: var(--muted);
}

.patient-popup-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 240px;
    overflow-y: auto;
}

.patient-popup-item {
    border-left: 3px solid var(--topic-color, #ffe066);
    padding: 4px 0 4px 8px;
    font-size: .78rem;
    line-height: 1.3;
}

.patient-popup-item.is-current {
    background: #f9fafb;
    border-radius: 0 6px 6px 0;
}

.patient-popup-item.is-done {
    opacity: .65;
}

.patient-popup-item.is-done .patient-popup-body {
    text-decoration: line-through;
}

.patient-popup-topic {
    display: block;
    font-weight: 700;
    font-size: .72rem;
    margin-bottom: 1px;
}

.patient-popup-body {
    display: block;
    word-break: break-word;
}

.patient-popup-meta {
    display: block;
    font-size: .66rem;
    color: var(--muted);
    margin-top: 1px;
}

.empty-state {
    text-align: center;
    color: var(--muted);
    margin-top: 40px;
    font-size: 1.05rem;
}

.settings-layout,
.settings-single {
    display: grid;
    gap: 20px;
    width: 100%;
}

.settings-single {
    grid-template-columns: 1fr;
}

@media (min-width: 1100px) {
    .settings-single {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: start;
    }

    .settings-single .settings-section-full {
        grid-column: 1 / -1;
    }
}

.settings-users-compact {
    padding: 14px 16px;
}

.settings-users-compact .section-title {
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.settings-users-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 8px 10px;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e5e7eb;
}

.settings-users-form .field-inline {
    flex: 1 1 140px;
    min-width: 0;
    gap: 3px;
    margin: 0;
}

.settings-users-form .field-inline span {
    font-size: .75rem;
    color: var(--muted);
}

.settings-users-form .field-role {
    flex: 0 1 110px;
}

.settings-users-form input,
.settings-users-form select {
    padding: 7px 10px;
    font-size: .88rem;
    border-radius: 8px;
}

.settings-users-form .btn-primary {
    flex: 0 0 auto;
    padding: 7px 14px;
    font-size: .88rem;
    border-radius: 8px;
}

.settings-users-list {
    display: grid;
    gap: 4px;
}

.settings-users-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 5px 8px;
    border-radius: 8px;
    background: #fafbfc;
    border: 1px solid #eef0f2;
}

.settings-users-row.is-inactive {
    opacity: .55;
}

.settings-users-row-info {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex-wrap: wrap;
}

.settings-users-row-name {
    font-size: .88rem;
    font-weight: 600;
}

.settings-users-row .settings-tag {
    font-size: .68rem;
    padding: 1px 6px;
}

.settings-users-row-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.settings-users-row-actions .btn-ghost {
    padding: 4px 8px;
    font-size: .76rem;
    border-radius: 6px;
}

.settings-users-list .settings-list-empty {
    padding: 10px;
    font-size: .85rem;
}

.settings-single .card {
    width: 100%;
    min-width: 0;
}

.settings-single .settings-form {
    width: 100%;
}

.settings-single .field textarea {
    width: 100%;
    min-height: 64px;
    padding: 8px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-family: inherit;
    font-size: .95rem;
    resize: vertical;
}

.settings-item-desc {
    display: block;
    margin: 2px 0;
    color: var(--muted);
    font-size: .82rem;
    line-height: 1.35;
}

.settings-divider {
    border: 0;
    border-top: 2px dashed #d1d5db;
    margin: 20px 0 16px;
}

.settings-group-title {
    margin: 0 0 12px;
    font-size: 1rem;
    font-weight: 700;
    color: var(--ink);
}

.settings-group {
    margin-bottom: 8px;
}

.topic-form-panel {
    border: 2px solid transparent;
    border-radius: 14px;
    padding: 4px;
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

.topic-form-panel.is-editing {
    border-color: #228be6;
    background: #f0f7ff;
    box-shadow: 0 0 0 4px rgba(34, 139, 230, .12);
    padding: 16px;
}

.topic-form-panel .settings-group + .settings-group {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px dashed #d1d5db;
}

.topic-form-panel .settings-group {
    margin-bottom: 0;
}

.settings-group-list {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 2px dashed #d1d5db;
}

.settings-item.is-editing-item {
    border-color: #228be6;
    box-shadow: 0 0 0 3px rgba(34, 139, 230, .15);
}

.settings-card .postit-color-ref {
    margin-top: 4px;
}

.settings-group + .settings-group {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px dashed #d1d5db;
}

.settings-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
    align-items: start;
}

.settings-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #fafbfc;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.settings-card:hover {
    border-color: #f59f00;
    box-shadow: 0 3px 10px rgba(0, 0, 0, .05);
}

.settings-card-title {
    margin: 0;
    font-size: .9rem;
    font-weight: 700;
    color: var(--ink);
}

.settings-card-help {
    margin: 0;
    font-size: .8rem;
    line-height: 1.4;
    color: var(--muted);
}

.settings-card .field,
.settings-card .checkbox-field {
    margin: 0;
}

.dashboard-topic-sections-list {
    display: grid;
    gap: 8px;
}

.dashboard-topic-section-option {
    align-items: center;
    gap: 8px;
}

.dashboard-topic-section-swatch {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, .12);
    flex-shrink: 0;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.settings-fieldset-plain {
    border: 0;
    padding: 0;
    margin: 0;
}

.settings-fieldset-plain legend {
    display: none;
}

.color-popup-cell {
    position: relative;
    display: inline-flex;
}

.color-popup-del {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 16px;
    height: 16px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #e03131;
    color: #fff;
    font-size: 11px;
    line-height: 16px;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
}

.color-popup-del:hover {
    background: #c92a2a;
}

.field-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
}

.field-row .field {
    flex: 1 1 0;
    min-width: 0;
    margin: 0;
}

.field-row .field-color {
    flex: 0 0 auto;
    max-width: none;
    width: auto;
}

.field-color input[type="color"] {
    width: 64px;
    padding: 4px;
    height: 42px;
    cursor: pointer;
}

.field-row .field-small {
    flex: 0 0 90px;
}

.settings-form {
    display: grid;
    gap: 12px;
    margin-bottom: 20px;
}

.postit-color-ref {
    margin: 0 0 4px;
    padding: 0;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #fafbfc;
    overflow: hidden;
}

.postit-color-ref[open] {
    padding-bottom: 14px;
}

.postit-color-ref-summary {
    list-style: none;
    cursor: pointer;
    padding: 12px 16px;
    font-size: .88rem;
    font-weight: 700;
    color: var(--ink);
    display: flex;
    align-items: center;
    gap: 8px;
    user-select: none;
}

.postit-color-ref-summary::-webkit-details-marker {
    display: none;
}

.postit-color-ref-summary::before {
    content: '\25B8';
    color: var(--muted);
    transition: transform .15s ease;
}

.postit-color-ref[open] .postit-color-ref-summary::before {
    transform: rotate(90deg);
}

.postit-color-ref-title {
    margin: 0 0 4px;
    font-size: .95rem;
    font-weight: 700;
}

.postit-color-ref-help {
    margin: 0 16px 12px;
    font-size: .85rem;
    color: var(--muted);
    line-height: 1.4;
}

.field-optional {
    font-weight: 400;
    color: var(--muted);
    font-size: .8em;
}

.postit-color-ref-list {
    list-style: none;
    margin: 0;
    padding: 0 16px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
    gap: 8px;
}

.postit-color-swatch {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.postit-color-swatch::before {
    content: '';
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: var(--swatch);
    border: 1px solid rgba(0, 0, 0, .12);
    box-shadow: inset 0 1px 2px rgba(255, 255, 255, .35);
}

.postit-color-swatch:hover {
    border-color: #f59f00;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .06);
}

.postit-color-name {
    display: block;
    font-size: .82rem;
    font-weight: 600;
    line-height: 1.2;
}

.postit-color-hex {
    display: block;
    font-size: .72rem;
    color: var(--muted);
    font-family: ui-monospace, Consolas, monospace;
}

.field-small {
    max-width: 140px;
}

.field-color {
    max-width: 180px;
}

.form-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.settings-list {
    display: grid;
    gap: 10px;
}

.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.settings-item:hover {
    border-color: #f59f00;
    box-shadow: 0 3px 10px rgba(0, 0, 0, .06);
}

.settings-item.is-inactive {
    opacity: .55;
}

.settings-item.is-inactive:hover {
    border-color: #e5e7eb;
    box-shadow: none;
}

.settings-item-main {
    display: flex;
    align-items: center;
    gap: 12px;
}

.settings-item-main small {
    display: block;
    color: var(--muted);
    margin-top: 2px;
}

.settings-item-info {
    min-width: 0;
}

.settings-item-name {
    font-size: .98rem;
}

.settings-item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.settings-tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    background: #f1f3f5;
    color: #495057;
    font-size: .72rem;
    font-weight: 600;
    line-height: 1.5;
}

.settings-tag-due {
    background: #fff3bf;
    color: #846100;
}

.settings-tag-hex {
    font-family: ui-monospace, Consolas, monospace;
    text-transform: uppercase;
}

.settings-tag-off {
    background: #ffe3e3;
    color: #c92a2a;
}

.settings-list-empty {
    margin: 0;
    padding: 18px;
    text-align: center;
    color: var(--muted);
    font-size: .9rem;
    border: 1px dashed #d0d5dd;
    border-radius: 10px;
    background: #fafbfc;
}

.settings-item-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.btn-danger {
    color: #c92a2a;
    border-color: #ffc9c9;
}

.btn-danger:hover {
    background: #fff5f5;
}

.color-dot {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, .12);
    box-shadow: inset 0 1px 2px rgba(255, 255, 255, .4);
    flex-shrink: 0;
}

@media (max-width: 720px) {
    .composer-grid,
    .composer-grid-3 {
        grid-template-columns: 1fr;
    }

    /* --- Massimo spazio ai post-it: comprimo header, barre e footer --- */
    .topbar {
        padding: 6px 10px;
    }

    .topbar-inner {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }

    .logo {
        font-size: 1.35rem;
        letter-spacing: -.5px;
    }

    .tagline {
        display: none;
    }

    .topbar-actions {
        width: 100%;
        gap: 6px;
        justify-content: flex-start;
        flex-wrap: wrap;
        align-items: center;
    }

    .topbar-actions .btn-secondary,
    .topbar-actions .btn-primary {
        text-align: center;
        padding: 6px 10px;
        font-size: .82rem;
        border-radius: 8px;
    }

    /* Mobile: i pulsanti diventano sole icone */
    .btn-icon {
        display: inline-flex;
    }

    .topbar-actions .btn-label {
        display: none;
    }

    .topbar-actions .btn-secondary.has-icon {
        width: 38px;
        height: 38px;
        padding: 0;
        justify-content: center;
        flex: 0 0 auto;
    }

    .topbar-user {
        font-size: .78rem;
        padding: 0 2px;
    }

    /* Toggle tema: solo icona, niente etichetta */
    .theme-toggle .theme-toggle-label {
        display: none;
    }
    .theme-toggle {
        flex: 0 0 auto;
        width: 38px;
        height: 38px;
        padding: 0;
        justify-content: center;
    }

    .view-toggle {
        width: auto;
        flex: 0 0 auto;
    }

    .view-toggle-btn {
        flex: 0 0 auto;
        width: 40px;
        height: 38px;
        padding: 0;
        justify-content: center;
    }

    .view-toggle-btn .btn-label {
        display: none;
    }

    .stale-notes-btn {
        flex: 0 0 auto;
        width: 38px;
        height: 38px;
        border-radius: 8px;
    }

    .container {
        padding: 8px 10px 88px;
    }

    .topbar-search-wrap {
        width: 100%;
        max-width: none;
        flex: 0 0 auto;
    }

    .board-search {
        padding: 0 10px;
        border-radius: 10px;
    }

    .board-search-input {
        padding: 8px 0;
        font-size: .9rem;
    }

    .board {
        gap: 12px;
        padding-top: 2px;
    }

    .masonry-col {
        gap: 12px;
    }

    /* Composer: nascosto, si apre dal FAB */
    .composer-fab {
        display: flex;
    }

    body.composer-open .composer-fab {
        display: none;
    }

    .composer-backdrop {
        display: none;
    }

    body.composer-open .composer-backdrop {
        display: block;
    }

    .composer-close {
        display: flex;
        flex: 1 1 100%;
        justify-content: flex-end;
        width: auto;
        height: auto;
        padding: 2px;
        background: transparent;
        color: rgba(255, 255, 255, .8);
    }

    .composer-close:hover {
        background: transparent;
        color: #fff;
    }

    .composer-bar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 900;
        flex-wrap: wrap;
        gap: 6px;
        padding: 8px 10px calc(10px + env(safe-area-inset-bottom, 0px));
        border-radius: 14px 14px 0 0;
        transform: translateY(110%);
        transition: transform .2s ease;
    }

    body.composer-open .composer-bar {
        transform: translateY(0);
    }

    .composer-bar input,
    .composer-bar select {
        height: 36px;
        font-size: .9rem;
    }

    .cb-note,
    #note-input.cb-note {
        min-height: 36px;
        flex: 1 1 100%;
    }

    .cb-add {
        height: 36px;
        padding: 0 16px;
        flex: 1 1 100%;
    }

    .composer-patient-wrap,
    .cb-topic {
        flex: 1 1 100%;
        width: auto;
    }

    .cb-patient {
        width: 100%;
    }

    .cb-due-type {
        flex: 1 1 40%;
        width: auto;
    }

    .cb-due {
        flex: 1 1 50%;
        width: auto;
    }

    .due-list-item {
        grid-template-columns: 1fr;
        align-items: stretch;
        gap: 8px;
    }

    .due-list-date-col {
        align-items: center;
        gap: 8px;
    }

    .due-list-due {
        width: auto;
    }

    .due-list-actions {
        flex-direction: column;
        width: 100%;
        align-items: flex-start;
    }

    .due-list-actions-icons {
        width: 100%;
        justify-content: flex-start;
    }

    .topic-card {
        min-height: 0;
        padding: 12px 12px 18px;
        gap: 8px;
    }

    .card-drag-placeholder {
        min-height: 120px;
    }

    .topic-title {
        font-size: 1.25rem;
    }

    .patient-section-divider {
        margin: 6px 0 14px;
    }
}

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: linear-gradient(160deg, #f8f9fa 0%, #e9ecef 100%);
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 28px 24px;
}

.login-logo {
    margin: 0 0 4px;
    text-align: center;
}

.login-subtitle {
    margin: 0 0 20px;
    text-align: center;
    color: var(--muted);
    font-size: .95rem;
}

.login-form {
    display: grid;
    gap: 12px;
}

.login-submit {
    width: 100%;
    margin-top: 4px;
}

.login-error {
    margin: 0 0 12px;
    padding: 10px 12px;
    border-radius: 8px;
    background: #ffe3e3;
    color: #c92a2a;
    font-size: .9rem;
}

.topbar-user {
    font-size: .85rem;
    font-weight: 600;
    color: var(--muted);
    padding: 0 4px;
}

.note-shared-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    background: #e7f5ff;
    color: #1864ab;
    font-size: .72rem;
    font-weight: 700;
}

.note-item-share {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    min-width: 26px;
    flex: 0 0 auto;
    padding: 0;
    border: 1px solid var(--note-action-border);
    border-radius: 6px;
    background: var(--note-action-bg);
    color: var(--note-action-fg);
    line-height: 1;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.note-item-share:hover {
    background: var(--note-action-share-hover);
    border-color: var(--note-action-share-hover);
    color: #fff;
}

.note-item-whatsapp {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    min-width: 26px;
    flex: 0 0 auto;
    padding: 0;
    border: 1px solid var(--note-action-border);
    border-radius: 6px;
    background: var(--note-action-bg);
    color: var(--note-action-fg);
    line-height: 1;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.note-item-whatsapp:hover {
    background: var(--note-action-whatsapp-hover);
    border-color: var(--note-action-whatsapp-hover);
    color: #fff;
}

.share-popup {
    position: fixed;
    z-index: 1200;
    width: min(280px, calc(100vw - 16px));
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
    padding: 12px;
}

.share-popup-inner {
    display: grid;
    gap: 10px;
}

.share-popup-title {
    margin: 0;
    font-size: .9rem;
    font-weight: 700;
}

.share-popup-users {
    display: grid;
    gap: 6px;
    max-height: 160px;
    overflow: auto;
}

.share-popup-user {
    margin: 0;
}

.share-popup-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.highlight-popup {
    position: fixed;
    z-index: 1200;
    width: min(360px, calc(100vw - 16px));
    background: var(--surface, #fff);
    border: 1px solid var(--border, #dee2e6);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
    padding: 12px;
}

.highlight-popup-inner {
    display: grid;
    gap: 10px;
}

.highlight-popup-title {
    margin: 0;
    font-size: .95rem;
    font-weight: 700;
}

.highlight-popup-help {
    margin: 0;
    font-size: .8rem;
    color: var(--muted);
}

.highlight-popup-notes {
    display: grid;
    gap: 6px;
    max-height: 240px;
    overflow: auto;
}

.highlight-popup-note {
    display: grid;
    grid-template-columns: auto auto 1fr;
    align-items: start;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 8px;
    cursor: pointer;
    background: var(--surface-2, #fafbfc);
}

.highlight-popup-note:has(input:checked) {
    border-color: var(--patient-highlight-border, #228be6);
    background: color-mix(in srgb, var(--patient-highlight-border, #228be6) 8%, var(--surface, #fff));
}

.highlight-popup-note input {
    margin-top: 3px;
}

.highlight-popup-note-star {
    color: rgba(0, 0, 0, .25);
    font-size: 1rem;
    line-height: 1;
}

.highlight-popup-note:has(input:checked) .highlight-popup-note-star {
    color: var(--patient-highlight-border, #228be6);
}

.highlight-popup-note-body {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.highlight-popup-note-text {
    font-size: .88rem;
    line-height: 1.3;
    word-break: break-word;
}

.highlight-popup-note-meta {
    font-size: .72rem;
    color: var(--muted);
}

.highlight-popup-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

[data-theme="dark"] .highlight-popup {
    background: var(--surface);
    border-color: var(--border);
    box-shadow: 0 20px 50px rgba(0, 0, 0, .6);
}

/* =========================================================
   Tema chiaro / scuro
   - I token in :root usano light-dark() (macro tema)
   - Il blocco [data-theme="dark"] adatta le superfici "chrome"
     con colori esadecimali (che non reagiscono a light-dark()).
   - I post-it restano coloratissimi: cambiano solo gli sfondi UI.
   ========================================================= */

.theme-toggle {
    gap: 6px;
    min-width: 0;
    padding-left: 14px;
    padding-right: 14px;
    white-space: nowrap;
}

.theme-toggle-icon {
    font-size: 1rem;
    line-height: 1;
}

/* Testo sempre leggibile sui tag argomento, qualunque sia il colore */
@supports (color: contrast-color(white)) {
    .note-item-topic-tag {
        color: contrast-color(var(--topic-color, #ffe066));
    }
}

[data-theme="dark"] body {
    background: radial-gradient(1200px 600px at 50% -10%, #20242c, var(--bg));
    color: var(--ink);
}

/* Span nel chrome UI: ereditano il colore del contenitore (leggibile in scuro) */
[data-theme="dark"] :is(
    .topbar,
    .container,
    .settings-single,
    .login-page,
    .login-card,
    .dashboard,
    .archive-modal-dialog,
    .app-dialog-card,
    .share-popup-inner,
    .highlight-popup,
    .composer-bar,
    .field,
    .checkbox-field,
    .checkbox-inline
) span {
    color: inherit;
}

[data-theme="dark"] .field span,
[data-theme="dark"] .field-label {
    color: var(--muted);
}

[data-theme="dark"] .logo span {
    color: #f59f00;
}

[data-theme="dark"] .btn-secondary,
[data-theme="dark"] .btn-ghost,
[data-theme="dark"] .view-toggle-btn {
    color: var(--ink);
}

[data-theme="dark"] .view-toggle-btn.is-active {
    color: #fff;
}

[data-theme="dark"] .topbar {
    background: var(--glass);
    border-bottom-color: var(--glass-border);
}

[data-theme="dark"] .board-search-clear:hover,
[data-theme="dark"] .board-search-clear:focus-visible {
    background: rgba(255, 255, 255, .1);
    color: var(--ink);
}

[data-theme="dark"] .board-search {
    background: var(--surface);
    border-color: var(--border);
    box-shadow: none;
}

[data-theme="dark"] .card {
    background: var(--surface);
}

[data-theme="dark"] .view-toggle {
    background: var(--surface);
    border-color: var(--border);
}

[data-theme="dark"] .view-toggle-btn.is-active {
    background: #3a4150;
    color: #fff;
}

[data-theme="dark"] .view-toggle-btn:not(.is-active):hover {
    background: var(--surface-3);
}

[data-theme="dark"] .stale-notes-btn {
    background: var(--surface);
    border-color: var(--border);
    color: #6b7280;
}

[data-theme="dark"] .stale-notes-btn:not(:disabled) {
    color: #fbbf24;
    border-color: #b45309;
    background: rgba(217, 119, 6, .12);
}

[data-theme="dark"] .stale-notes-btn.is-open {
    background: #d97706;
    border-color: #d97706;
    color: #fff;
}

[data-theme="dark"] .stale-section-title {
    color: #fbbf24;
}

[data-theme="dark"] .composer-bar {
    background: #0f1115;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, .5);
}

[data-theme="dark"] .patient-suggestions {
    background: var(--surface-2);
    border-color: var(--border);
    box-shadow: 0 -6px 20px rgba(0, 0, 0, .35);
}

[data-theme="dark"] .patient-suggest-item:hover,
[data-theme="dark"] .patient-suggest-item.is-active {
    background: var(--surface-3);
}

[data-theme="dark"] .composer-bar input,
[data-theme="dark"] .composer-bar select,
[data-theme="dark"] #note-input,
[data-theme="dark"] .field input,
[data-theme="dark"] .field select,
[data-theme="dark"] .field textarea,
[data-theme="dark"] .settings-single .field textarea,
[data-theme="dark"] .note-body,
[data-theme="dark"] .note-select {
    background: var(--surface-2);
    border-color: var(--border);
    color: var(--ink);
}

[data-theme="dark"] .btn-secondary {
    background: var(--surface-2);
    border-color: var(--border-strong);
}
[data-theme="dark"] .btn-secondary:hover {
    background: var(--surface-3);
}

[data-theme="dark"] .btn-ghost {
    border-color: var(--border);
}
[data-theme="dark"] .btn-ghost:hover {
    background: var(--surface-3);
}

[data-theme="dark"] .btn-primary {
    background: #3a4150;
}
[data-theme="dark"] .btn-primary:hover {
    background: #4a5263;
}

[data-theme="dark"] .due-list-item {
    background: var(--surface);
    border-color: var(--border);
    box-shadow: 0 1px 4px rgba(0, 0, 0, .4);
}
[data-theme="dark"] .due-list-item.is-overdue {
    background: #2a1c1f;
}
[data-theme="dark"] .due-list-item.due-overdue {
    background: color-mix(in srgb, var(--badge-overdue) 22%, #1d2027);
}
[data-theme="dark"] .due-list-item.due-today {
    background: color-mix(in srgb, var(--badge-today) 22%, #1d2027);
}
[data-theme="dark"] .due-list-item .due-list-body,
[data-theme="dark"] .due-list-item .due-list-topic,
[data-theme="dark"] .due-list-item .note-item-topic,
[data-theme="dark"] .due-list-item .note-item-due-type,
[data-theme="dark"] .due-list-item .note-item-due {
    color: var(--ink);
}
[data-theme="dark"] .due-list-patient {
    background: var(--surface-2);
    color: var(--ink);
}
[data-theme="dark"] .due-list-patient:focus {
    background: var(--surface-3);
}
[data-theme="dark"] .due-list-item .due-list-topic,
[data-theme="dark"] .due-list-item .note-item-topic {
    background: var(--surface-2);
    border-color: var(--border);
}

/* Dashboard: note su sfondo scuro (non post-it cartaceo) */
[data-theme="dark"] .dashboard .note-item-body,
[data-theme="dark"] .dashboard .note-item-patient,
[data-theme="dark"] .dashboard .note-item-topic,
[data-theme="dark"] .dashboard .note-item-due-type,
[data-theme="dark"] .dashboard .note-item-due,
[data-theme="dark"] .dashboard .due-list-body,
[data-theme="dark"] .dashboard .due-list-patient,
[data-theme="dark"] .dashboard .due-list-topic,
[data-theme="dark"] .dashboard .note-created-date,
[data-theme="dark"] .dashboard .due-clear {
    color: var(--ink);
}

[data-theme="dark"] .dashboard .note-item-patient,
[data-theme="dark"] .dashboard .note-item-topic,
[data-theme="dark"] .dashboard .note-item-due-type,
[data-theme="dark"] .dashboard .note-item-due,
[data-theme="dark"] .dashboard .due-list-patient,
[data-theme="dark"] .dashboard .due-list-topic {
    background: var(--surface-2);
    border-color: var(--border);
}

[data-theme="dark"] .dashboard .note-item-patient::placeholder {
    color: var(--muted);
}

[data-theme="dark"] .dashboard .due-clear {
    background: var(--surface-3);
}
[data-theme="dark"] .dashboard .due-clear:hover {
    background: var(--border-strong);
}

[data-theme="dark"] .dashboard-patient-group-body .note-item {
    background: transparent;
    border: 0;
    border-bottom: 1px dashed var(--border);
    padding: 4px 2px;
    border-radius: 0;
}

[data-theme="dark"] .dashboard .note-shared-badge {
    background: rgba(77, 171, 247, .18);
    color: #74c0fc;
}

[data-theme="dark"] .color-popup,
[data-theme="dark"] .patient-popup,
[data-theme="dark"] .share-popup,
[data-theme="dark"] .archive-modal-dialog {
    background: var(--surface);
    border-color: var(--border);
    color: var(--ink);
    box-shadow: 0 20px 50px rgba(0, 0, 0, .6);
}

[data-theme="dark"] .color-popup-hex-input {
    background: var(--surface-2);
    border-color: var(--border);
    color: var(--ink);
}

[data-theme="dark"] .patient-popup-item.is-current {
    background: var(--surface-3);
}

[data-theme="dark"] .archive-modal-header,
[data-theme="dark"] .archive-modal-footer {
    border-color: var(--border);
}
[data-theme="dark"] .archive-modal-footer {
    background: #181b21;
}
[data-theme="dark"] .archive-modal-close:hover {
    background: var(--surface-3);
}
[data-theme="dark"] .archive-col-headers th {
    background: var(--surface-2);
    border-bottom-color: var(--border);
}
[data-theme="dark"] .archive-filters th {
    background: var(--surface);
    border-bottom-color: var(--border);
}
[data-theme="dark"] .archive-filter {
    background: var(--surface-2);
    border-color: var(--border-strong);
    color: var(--ink);
}
[data-theme="dark"] .archive-table tbody td {
    border-bottom-color: #262a32;
}
[data-theme="dark"] .archive-table tbody tr:hover td {
    background: var(--surface-2);
}
[data-theme="dark"] .archive-topic {
    background: color-mix(in srgb, var(--topic-color, #ffe066) 42%, #1d2027);
    color: var(--ink);
}

[data-theme="dark"] .app-dialog-card {
    background: var(--surface);
    border-color: var(--border);
    box-shadow: 0 26px 70px rgba(0, 0, 0, .6);
}
[data-theme="dark"] .app-dialog-input {
    background: var(--surface-2);
    border-color: var(--border-strong);
    color: var(--ink);
}
[data-theme="dark"] .app-dialog-btn-ghost {
    background: var(--surface-2);
    border-color: var(--border-strong);
}
[data-theme="dark"] .app-dialog-btn-ghost:hover {
    background: var(--surface-3);
}

[data-theme="dark"] .settings-users-form {
    border-bottom-color: var(--border);
}
[data-theme="dark"] .settings-users-row {
    background: var(--surface-2);
    border-color: var(--border);
}
[data-theme="dark"] .settings-card {
    background: var(--surface-2);
    border-color: var(--border);
}
[data-theme="dark"] .settings-item {
    background: var(--surface);
    border-color: var(--border);
}
[data-theme="dark"] .settings-item.is-inactive:hover {
    border-color: var(--border);
}
[data-theme="dark"] .postit-color-ref {
    background: var(--surface-2);
    border-color: var(--border);
}
[data-theme="dark"] .postit-color-swatch {
    background: var(--surface);
    border-color: var(--border);
}
[data-theme="dark"] .settings-list-empty {
    background: var(--surface-2);
    border-color: var(--border-strong);
}
[data-theme="dark"] .settings-tag {
    background: var(--surface-3);
    color: #c5ccd6;
}

[data-theme="dark"] .settings-divider,
[data-theme="dark"] .settings-group + .settings-group,
[data-theme="dark"] .settings-group-list,
[data-theme="dark"] .topic-form-panel .settings-group + .settings-group,
[data-theme="dark"] .patient-section-divider {
    border-top-color: var(--border-strong);
}

[data-theme="dark"] .topic-form-panel.is-editing {
    background: #10243a;
}

[data-theme="dark"] .login-page {
    background: linear-gradient(160deg, #15171c 0%, #0e0f13 100%);
}

/* ── Dashboard ── */
.logo-btn {
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    text-align: left;
    color: inherit;
    font: inherit;
}
.logo-btn:hover .logo,
.logo-link:hover .logo {
    opacity: .88;
}
.logo-link {
    text-decoration: none;
    color: inherit;
}

.dashboard {
    width: 100%;
    max-width: none;
    margin: 0;
    padding-bottom: 24px;
}

.board-area {
    width: 100%;
}

.dashboard-ptr {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 0 12px;
    color: var(--muted);
    font-size: .85rem;
    transition: opacity .2s ease;
}
.dashboard-ptr.is-ready {
    color: var(--accent, #228be6);
}
.dashboard-ptr-icon {
    width: 18px;
    height: 18px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: dashboard-ptr-spin .8s linear infinite;
}
.dashboard-ptr.is-ready .dashboard-ptr-icon {
    animation: none;
    border: none;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 10px solid currentColor;
}
@keyframes dashboard-ptr-spin {
    to { transform: rotate(360deg); }
}

.dashboard-skeleton {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    animation: dashboard-fade-in .3s ease;
}
.dashboard-skeleton-section {
    height: 64px;
    border-radius: 14px;
    background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
    background-size: 200% 100%;
    animation: dashboard-shimmer 1.2s ease-in-out infinite;
}
@keyframes dashboard-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.dashboard-sections {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    animation: dashboard-fade-in .4s ease;
}

.dashboard-search-results {
    animation: dashboard-fade-in .35s ease;
}

.dashboard-search-head {
    margin-bottom: 12px;
}

.dashboard-search-title {
    margin: 0;
    font-size: 1.12rem;
    font-weight: 700;
}

.dashboard-search-sub {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: .9rem;
}

.dashboard-search-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dashboard-search-list .due-list-item {
    border-radius: 12px;
}
@keyframes dashboard-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.dashboard-section {
    min-width: 0;
    align-self: start;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
    overflow: hidden;
    box-shadow: 0 1px 0 rgba(15, 23, 42, .04);
    transition: box-shadow .2s ease;
}
.dashboard-section.is-open {
    box-shadow: 0 8px 24px rgba(15, 23, 42, .06);
}
.dashboard-section.is-dragging {
    opacity: .55;
}
.dashboard-section-head {
    display: flex;
    align-items: stretch;
    border-left: 4px solid var(--section-accent, var(--accent));
}
.dashboard-section-drag {
    display: flex;
    align-items: center;
    padding: 0 8px 0 10px;
    color: var(--muted);
    cursor: grab;
    user-select: none;
    font-size: .9rem;
    letter-spacing: -2px;
}
.dashboard-section-toggle {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 52px;
    padding: 10px 14px 10px 0;
    border: 0;
    background: none;
    cursor: pointer;
    color: inherit;
    font: inherit;
    text-align: left;
}
.dashboard-section-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: color-mix(in srgb, var(--section-accent, #228be6) 14%, transparent);
    color: var(--section-accent, #228be6);
    flex-shrink: 0;
}
.dashboard-section-title {
    flex: 1;
    font-weight: 700;
    font-size: .98rem;
}
.dashboard-section-badge {
    min-width: 24px;
    height: 24px;
    padding: 0 7px;
    border-radius: 999px;
    background: var(--surface-3);
    color: var(--text);
    font-size: .78rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.dashboard-section-chevron {
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--muted);
    border-bottom: 2px solid var(--muted);
    transform: rotate(45deg);
    transition: transform .2s ease;
    flex-shrink: 0;
}
.dashboard-section.is-open .dashboard-section-chevron {
    transform: rotate(-135deg) translateY(-2px);
}
.dashboard-section-body {
    padding: 0 12px 14px;
    animation: dashboard-section-open .25s ease;
}
@keyframes dashboard-section-open {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}
.dashboard-section-body[hidden] {
    display: none !important;
}

.dashboard-empty {
    margin: 8px 4px;
    color: var(--muted);
    font-size: .9rem;
}

.dashboard-note-list,
.dashboard-patient-group-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dashboard .note-item {
    background: transparent;
    border: 0;
    border-bottom: 1px dashed var(--border);
    border-radius: 0;
    padding: 4px 2px;
}

.dashboard .note-item:last-child {
    border-bottom: 0;
}

.dashboard .note-item-body {
    font-family: var(--font-hand);
    font-size: .98rem;
    line-height: 1.25;
}

.dashboard-patient-groups {
    display: grid;
    gap: 10px;
}
.dashboard-patient-group {
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    background: color-mix(in srgb, var(--note-bg, #f3f4f6) 35%, var(--surface));
}
.dashboard-patient-group-head {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 14px;
    color: inherit;
    font: inherit;
    text-align: left;
}
.dashboard-patient-swatch {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    border: 1px solid rgba(15, 23, 42, .12);
    flex-shrink: 0;
}
.dashboard-patient-name {
    flex: 1;
    font-weight: 700;
    font-size: .95rem;
}
.dashboard-patient-count {
    font-size: .78rem;
    color: var(--muted);
}
.dashboard-patient-group-body {
    padding: 0 10px 10px;
    display: grid;
    gap: 8px;
}
.dashboard-patient-group-body[hidden] {
    display: none !important;
}
.dashboard-patient-group-body .note-item {
    border-radius: 0;
}

@media (min-width: 640px) {
    .dashboard-sections,
    .dashboard-skeleton {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .dashboard-sections,
    .dashboard-skeleton {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

[data-theme="dark"] .dashboard-section,
[data-theme="dark"] .dashboard-patient-group {
    background: var(--surface);
    border-color: var(--border-strong);
}
[data-theme="dark"] .dashboard-search-list .due-list-item {
    background: var(--surface);
    border-color: var(--border);
}
[data-theme="dark"] .dashboard-section-badge {
    background: var(--surface-3);
}
