/* =========================================================
   Agenda – sito personale
   Foglio di stile condiviso fra tutte le pagine template.
   Pensato per essere riusato come stile globale del tema WP.
   ========================================================= */

/* ---------- Reset minimale ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

/* ---------- Variabili tema ---------- */
:root {
  --bg:        #1e2230;   /* sfondo principale (blu-grigio scuro) */
  --bg-2:      #191c27;   /* sidebar / superfici più scure */
  --surface:   #262b3c;   /* card */
  --surface-2: #2e3447;   /* card attiva / hover */
  --inset:     #1e2230;   /* input dentro card */
  --line:      rgba(240,236,228,0.06);
  --line-2:    rgba(240,236,228,0.18);
  --text:      #f0ece4;
  --text-soft: rgba(240,236,228,0.75);
  --text-mute: rgba(240,236,228,0.5);
  --text-dim:  rgba(240,236,228,0.35);
  --accent:    #d4b483;   /* oro tenue */
  --accent-2:  #7fa098;   /* verde-grigio */
  --on-accent: #1e2230;

  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 14px;

  --font-display: "Playfair Display", Georgia, "Times New Roman", serif;
  --font-sans:    "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono:    ui-monospace, "DM Mono", Menlo, Consolas, monospace;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

::placeholder { color: var(--text-dim); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(240,236,228,0.12); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: rgba(240,236,228,0.2); }

/* =========================================================
   LAYOUT APPLICATIVO (sidebar + main)
   ========================================================= */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 260px;
  flex: none;
  background: var(--bg-2);
  border-right: 1px solid var(--line);
  padding: 28px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar__brand {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 30px;
  line-height: 1;
  letter-spacing: -0.01em;
  color: #f5f1e8;
  padding: 0 8px 28px;
}
.sidebar__group { margin-bottom: 22px; }
.sidebar__group-label {
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 0 8px 8px;
}
.sidebar__item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  border-radius: 7px;
  color: var(--text-soft);
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 2px;
  transition: background .12s, color .12s;
}
.sidebar__item:hover { background: rgba(240,236,228,0.05); }
.sidebar__item--active {
  background: rgba(240,236,228,0.08);
  color: #f5f1e8;
}
.sidebar__dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(240,236,228,0.25);
  flex: none;
}
.sidebar__item--active .sidebar__dot { background: var(--accent); }

.sidebar__user {
  position: absolute;
  bottom: 24px; left: 18px; right: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px;
}
.sidebar__avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: #3a4055;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
}
.sidebar__user-name { font-size: 13px; font-weight: 500; }
.sidebar__user-role { font-size: 11px; color: var(--text-dim); }
.sidebar__logout {
  background: transparent; border: none;
  color: var(--text-dim); padding: 6px;
}
.sidebar__logout:hover { color: #f5f1e8; }

.main {
  flex: 1;
  min-width: 0;
  padding: 44px 56px 80px;
  max-width: 1180px;
}

/* =========================================================
   PAGE HEADER (eyebrow + titolo display + sottotitolo + CTA)
   ========================================================= */
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(240,236,228,0.08);
  margin-bottom: 32px;
}
.page-header__eyebrow {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin-bottom: 10px;
}
.page-header__title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 52px;
  line-height: 1;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}
.page-header__subtitle { font-size: 14px; color: var(--text-mute); }

/* =========================================================
   BOTTONI
   ========================================================= */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: #f5f1e8; color: var(--on-accent);
  border: none; border-radius: 8px;
  padding: 11px 18px;
  font-size: 13.5px; font-weight: 600;
  transition: background .15s, transform .12s;
  white-space: nowrap;
}
.btn:hover { background: #ffffff; }
.btn:active { transform: scale(.97); }

.btn--ghost {
  background: rgba(240,236,228,0.06);
  color: var(--text-soft);
  border: 1px dashed rgba(240,236,228,0.18);
}
.btn--ghost:hover { background: rgba(240,236,228,0.1); }

.btn--link {
  background: transparent;
  color: var(--text-mute);
  border: none;
  padding: 6px 10px;
}

/* =========================================================
   CARD GENERICA
   ========================================================= */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: border-color .15s, transform .15s;
}
.card:hover { border-color: rgba(240,236,228,0.18); }

/* =========================================================
   TAG / CHIP
   ========================================================= */
.chip {
  display: inline-block;
  font-size: 11px;
  padding: 3px 8px;
  background: rgba(240,236,228,0.08);
  border-radius: 4px;
  color: var(--text-soft);
}
.chip--pill {
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 12px;
}
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-row--lg { gap: 10px; }

/* =========================================================
   FORM
   ========================================================= */
.field { margin-bottom: 14px; }
.field__label {
  display: block;
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin-bottom: 6px;
}
.input, .textarea, .select {
  width: 100%;
  background: var(--inset);
  border: 1px solid rgba(240,236,228,0.08);
  border-radius: 7px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
  transition: border-color .15s;
}
.input:focus, .textarea:focus, .select:focus {
  border-color: rgba(240,236,228,0.35);
}
.textarea { min-height: 70px; line-height: 1.5; resize: vertical; }
.input--mono { font-family: var(--font-mono); }

.input-prefix {
  display: flex; align-items: center; gap: 8px;
  background: var(--inset);
  border: 1px solid rgba(240,236,228,0.08);
  border-radius: 7px;
  padding: 0 12px;
}
.input-prefix > span { color: var(--text-mute); }
.input-prefix > input {
  flex: 1; background: transparent; border: none;
  padding: 10px 0; font-size: 14px; outline: none;
}

/* =========================================================
   LOGIN (index.html)
   ========================================================= */
.login {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
}
.login__logo {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 128px;
  line-height: 1;
  letter-spacing: -0.02em;
  color: #f5f1e8;
  text-align: center;
}
.login__tagline {
  margin-top: 18px;
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-mute);
  text-align: center;
}
.fab {
  position: fixed;
  right: 36px; bottom: 36px;
  width: 68px; height: 68px;
  border-radius: 50%;
  border: none;
  background: #f5f1e8;
  color: var(--on-accent);
  box-shadow: 0 12px 30px rgba(0,0,0,0.35);
  display: flex; align-items: center; justify-content: center;
  transition: transform .18s, box-shadow .18s;
}
.fab:hover { transform: translateY(-2px); box-shadow: 0 16px 38px rgba(0,0,0,0.45); }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(10,12,18,0.6);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center; justify-content: center;
  z-index: 100;
}
.modal-overlay.is-open { display: flex; animation: overlayIn .18s ease-out; }
.modal {
  width: 380px;
  background: var(--surface);
  border: 1px solid rgba(240,236,228,0.08);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.5);
  animation: modalIn .22s cubic-bezier(.2,.9,.3,1);
}
.modal__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 24px;
  margin: 0 0 4px;
}
.modal__subtitle { font-size: 13px; color: var(--text-mute); margin-bottom: 24px; }
.modal .btn { width: 100%; padding: 13px; }
.modal .btn--link { width: 100%; margin-top: 8px; font-size: 13px; }

/* Variante "lettore": più larga, scrollabile, testo allineato a sinistra. */
.modal--reader {
  position: relative;
  width: min(680px, calc(100vw - 32px));
  max-height: 85vh; overflow-y: auto;
  text-align: left; padding: 30px 34px;
}
.modal--reader .btn--link { width: auto; margin-top: 0; }
.modal__close {
  position: absolute; top: 12px; right: 14px;
  background: none; border: none; cursor: pointer;
  font-size: 26px; line-height: 1; padding: 4px 8px; color: var(--text-dim);
}
.modal__close:hover { color: var(--text); }
.post-read__title {
  font-family: var(--font-display); font-weight: 700;
  font-size: 26px; line-height: 1.22; margin: 6px 0 16px; color: var(--text);
}
.post-read__body {
  font-size: 15px; line-height: 1.65; color: var(--text-soft);
  overflow-wrap: anywhere;
}

@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn   { from { opacity: 0; transform: translateY(20px) scale(.96); } to { opacity: 1; transform: none; } }

/* =========================================================
   AGENDA – POST
   ========================================================= */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}
.post__date {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin-bottom: 10px;
}
.post__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  line-height: 1.2;
  margin: 0 0 6px;
}
.post__subtitle { font-size: 14px; color: var(--text-mute); margin-bottom: 14px; }
.post__body { font-size: 14px; line-height: 1.55; color: var(--text-soft); margin: 0 0 16px; }

/* =========================================================
   AGENDA – PORTACHIAVI
   ========================================================= */
.keychain-layout { display: flex; gap: 28px; align-items: flex-start; }
.keychain-list { width: 260px; flex: none; }
.keychain-list__item {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 8px;
  transition: all .15s;
}
.keychain-list__item--active {
  background: var(--surface-2);
  border-color: rgba(240,236,228,0.25);
}
.keychain-list__name { font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.keychain-list__meta { font-size: 12px; color: var(--text-mute); }

.keychain-detail { flex: 1; min-width: 0; }
.keychain-detail__header {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 24px;
}
.keychain-detail__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 26px;
  margin: 0;
}
.keychain-detail__created { font-size: 12px; color: var(--text-mute); }

.keychain-entry {
  background: var(--inset);
  border: 1px solid rgba(240,236,228,0.05);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 12px;
}
.keychain-entry__head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.keychain-entry__title { font-size: 13px; font-weight: 600; color: var(--text); }
/* accordion voci */
.keychain-entry__head { margin-bottom: 0; }
.keychain-entry__chevron {
  background: none; border: 0; color: var(--text-soft); cursor: pointer;
  font-size: 12px; line-height: 1; padding: 4px 6px; flex-shrink: 0;
  transition: transform .15s ease;
}
.keychain-entry.is-open .keychain-entry__chevron { transform: rotate(90deg); color: var(--accent); }
.keychain-entry__body { display: none; margin-top: 14px; }
.keychain-entry.is-open .keychain-entry__body { display: block; }
.keychain-entry__textarea {
  width: 100%;
  min-height: 150px;
  resize: vertical;
  background: transparent;
  border: 1px solid rgba(240,236,228,0.08);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
  outline: none;
  font-family: var(--font-mono);
  color: var(--text);
}

/* =========================================================
   AGENDA – APPUNTAMENTI
   ========================================================= */
.appt-list { display: flex; flex-direction: column; gap: 16px; }
.appt {
  display: grid;
  grid-template-columns: 120px 1fr 280px;
  gap: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px;
}
.appt__date {
  text-align: center;
  padding: 8px 0;
  border-right: 1px solid rgba(240,236,228,0.08);
}
.appt__month { font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-mute); }
.appt__day { font-family: var(--font-display); font-weight: 700; font-size: 42px; line-height: 1; margin: 4px 0; }
.appt__time { font-size: 12px; color: var(--text-soft); }
.appt__body { display: flex; flex-direction: column; justify-content: center; }
.appt__title { font-family: var(--font-display); font-weight: 700; font-size: 22px; margin: 0 0 6px; }
.appt__place { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-mute); margin-bottom: 10px; }
.appt__notes { font-size: 13px; line-height: 1.5; color: var(--text-soft); margin: 0; }
.appt__map {
  border-radius: 8px;
  overflow: hidden;
  background: #1a1d28;
  border: 1px solid rgba(240,236,228,0.05);
  position: relative;
  min-height: 140px;
}
.map-stub { position: relative; width: 100%; height: 100%; min-height: 140px; }
.map-stub__svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.map-stub__pin { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -100%); }
.map-stub__coords {
  position: absolute; bottom: 8px; left: 10px;
  font-size: 10px; font-family: var(--font-mono);
  color: var(--text-mute);
  background: rgba(0,0,0,0.4);
  padding: 3px 7px; border-radius: 3px;
}

/* =========================================================
   DIARIO
   ========================================================= */
.diary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 22px;
}
.diary-card { overflow: hidden; padding: 0; }
.diary-card:hover { transform: translateY(-3px); border-color: rgba(240,236,228,0.2); }
.diary-card__media {
  aspect-ratio: 16/10;
  position: relative;
  display: flex; align-items: flex-end;
  padding: 14px;
}
.diary-card__media--photo-1 { background: linear-gradient(135deg, oklch(0.35 0.04 200), oklch(0.5 0.06 230)); }
.diary-card__media--video-1 { background: linear-gradient(135deg, oklch(0.35 0.04 280), oklch(0.5 0.06 310)); }
.diary-card__media--photo-2 { background: linear-gradient(135deg, oklch(0.35 0.04 60),  oklch(0.5 0.06 90)); }
.diary-card__media--photo-3 { background: linear-gradient(135deg, oklch(0.35 0.04 20),  oklch(0.5 0.06 50)); }

.diary-card__badge {
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.85);
  background: rgba(0,0,0,0.4);
  padding: 4px 8px;
  border-radius: 4px;
  backdrop-filter: blur(4px);
}
.diary-card__body { padding: 22px; }

/* =========================================================
   PRODUTTIVITÀ – DAILY
   ========================================================= */
.month-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin: 0 0 36px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.stat__label {
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin-bottom: 8px;
}
.stat__value { font-family: var(--font-display); font-size: 28px; font-weight: 700; }
.stat__sub { font-size: 12px; color: var(--text-mute); margin-top: 2px; }

.day-list { display: flex; flex-direction: column; gap: 18px; }
.day { padding: 24px; }
.day__header {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.day__title  { font-family: var(--font-display); font-weight: 700; font-size: 24px; line-height: 1.1; }
.day__sub    { font-size: 13px; color: var(--text-mute); margin-top: 4px; }
.day__total-label {
  font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-mute); text-align: right;
}
.day__total {
  font-family: var(--font-display); font-size: 30px; font-weight: 700;
  line-height: 1; margin-top: 4px; text-align: right;
}

.project-entry {
  background: var(--inset);
  border: 1px solid rgba(240,236,228,0.05);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}
.project-entry__head {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 12px;
}
.project-entry__label {
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-mute);
}
.project-entry__select {
  flex: 1;
  background: var(--surface);
  border: 1px solid rgba(240,236,228,0.08);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 13.5px;
  font-weight: 500;
  display: flex; align-items: center; gap: 10px;
}
.project-entry__color { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.project-entry__subtotal { font-size: 13px; color: var(--text-mute); }

.slot {
  display: grid;
  grid-template-columns: 90px 90px 1fr 28px;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}
.slot .input { background: var(--surface); padding: 8px 10px; font-size: 13px; }
.slot__remove {
  background: transparent; border: none; color: var(--text-dim);
}
.slot__remove:hover { color: #f5f1e8; }

.btn-add-row {
  background: transparent;
  border: 1px dashed rgba(240,236,228,0.15);
  color: var(--text-mute);
  border-radius: var(--radius-sm);
  padding: 7px;
  width: 100%;
  font-size: 12px;
  margin-top: 4px;
}
.btn-add-block {
  background: rgba(240,236,228,0.05);
  border: 1px dashed rgba(240,236,228,0.15);
  color: var(--text-soft);
  border-radius: 8px;
  padding: 10px;
  width: 100%;
  font-size: 13px;
}
.btn-add-block:hover { background: rgba(240,236,228,0.1); }

/* =========================================================
   PRODUTTIVITÀ – PROGETTI
   ========================================================= */
.project { padding: 26px; }
.project__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 18px;
}
.project__status-row { display: flex; gap: 8px; }
.status {
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
}
.status--active     { background: rgba(127,160,152,0.18);  color: #a8c5be; }
.status--recurring  { background: rgba(212,180,131,0.18);  color: #e3c79a; }
.status--paused     { background: rgba(240,236,228,0.08);  color: var(--text-soft); }

.project__meta {
  flex: 1;
  background: var(--inset);
  border: 1px solid rgba(240,236,228,0.08);
  border-radius: 7px;
  padding: 9px 12px;
  font-size: 13px;
  color: var(--text-soft);
}
.project__meta strong { color: #f5f1e8; font-weight: 600; }

.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--inset);
  border: 1px solid rgba(240,236,228,0.08);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 13px;
}
.file-chip svg { opacity: 0.5; }

/* =========================================================
   BARRA DI RICERCA (sezioni)
   ========================================================= */
.searchbar { display: flex; gap: 8px; align-items: center; margin-bottom: 28px; }
.searchbar .input { flex: 1; }
.searchbar .btn { white-space: nowrap; }

/* =========================================================
   AGENDA – COLLEGAMENTI
   ========================================================= */
.link-list { display: flex; flex-direction: column; }
.link-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
}
.link-list .link-row:first-child { border-top: none; }
.link-row__main { min-width: 0; flex: 1; }
.link-row__title {
  font-size: 15px; font-weight: 600; color: var(--text);
  display: inline-block; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  vertical-align: bottom;
}
.link-row__title:hover { color: var(--accent); }
.link-row__host {
  font-size: 12px; color: var(--text-mute); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.link-row__actions { flex: none; display: flex; gap: 4px; align-items: center; }

/* =========================================================
   AGENDA – DA FARE
   ========================================================= */
.dafare-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.dafare-title { font-size: 16px; font-weight: 600; color: var(--text); }
.dafare-progress {
  font-size: 12px; color: var(--text-mute);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.dafare-head__spacer { flex: 1; }

.dafare-bar { height: 4px; border-radius: 3px; background: var(--line); overflow: hidden; margin-bottom: 6px; }
.dafare-bar__fill { height: 100%; background: var(--accent-2); transition: width .2s ease; }

.dafare-list { display: flex; flex-direction: column; }
.dafare-row {
  display: flex; align-items: flex-start; gap: 6px;
  border-top: 1px solid var(--line);
}
.dafare-list .dafare-row:first-child { border-top: none; }
.dafare-row__toggle { flex: 1; min-width: 0; margin: 0; }

.dafare-grip {
  flex: none; display: flex; align-items: center;
  align-self: stretch; padding: 0 4px;
  color: var(--text-dim); cursor: grab; touch-action: none;
  -webkit-user-select: none; user-select: none;
}
.dafare-grip:hover { color: var(--text-mute); }
.dafare-row.dragging {
  opacity: .65; background: var(--surface-2); border-radius: 6px;
  cursor: grabbing; -webkit-user-select: none; user-select: none;
}
.dafare-row.dragging .dafare-grip { cursor: grabbing; }

.dafare-check {
  display: flex; align-items: flex-start; gap: 11px; width: 100%;
  background: none; border: none; padding: 10px 0; text-align: left; color: var(--text);
}
.dafare-check__box {
  flex: none; width: 18px; height: 18px; margin-top: 1px;
  border: 1.5px solid var(--line-2); border-radius: 5px;
  position: relative; transition: border-color .12s ease, background .12s ease;
}
.dafare-check:hover .dafare-check__box { border-color: var(--accent); }
.dafare-check__text { font-size: 15px; line-height: 1.45; }

.dafare-row.is-done .dafare-check__box { background: var(--accent); border-color: var(--accent); }
.dafare-row.is-done .dafare-check__box::after {
  content: ""; position: absolute; left: 5px; top: 1px;
  width: 5px; height: 9px;
  border: solid var(--on-accent); border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.dafare-row.is-done .dafare-check__text { color: var(--text-mute); text-decoration: line-through; }

.dafare-row__del { flex: none; margin: 0; display: flex; align-items: center; }
.dafare-row__del button {
  background: none; border: none; padding: 10px 6px;
  font-size: 20px; line-height: 1; color: var(--text-dim);
}
.dafare-row__del button:hover { color: #e0857d; }

.dafare-add { display: flex; gap: 8px; margin-top: 14px; }
.dafare-add .input { flex: 1; }

.hide-done .dafare-row.is-done { display: none; }

/* Copia il testo di una voce (solo con JS attivo: senza JS non farebbe nulla). */
.dafare-copy {
  flex: none; display: none; align-items: center;
  background: none; border: none; padding: 10px 6px;
  line-height: 1; color: var(--text-dim); cursor: pointer;
}
.has-js .dafare-copy { display: flex; }
.dafare-copy:hover { color: var(--text-mute); }
.dafare-copy.is-copied { color: var(--accent-2); }

/* Maniglia e trascinamento dell'intera lista (card). */
.dafare-grip--card { align-self: center; padding: 2px 2px; }
.dafare-card.dragging { opacity: .65; cursor: grabbing; }
.dafare-card.dragging .dafare-grip--card { cursor: grabbing; }

/* =========================================================
   ASSISTENTE (chat)
   ========================================================= */
.assistant__log {
  display: flex; flex-direction: column; gap: 12px;
  max-height: 55vh; overflow-y: auto; padding: 4px 2px 8px;
}
.assistant__msg { display: flex; }
.assistant__msg--me  { justify-content: flex-end; }
.assistant__msg--bot { justify-content: flex-start; }
.assistant__bubble {
  max-width: 78%; padding: 11px 14px; border-radius: 14px;
  font-size: 14px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere;
}
.assistant__msg--me .assistant__bubble {
  background: var(--accent); color: var(--on-accent); border-bottom-right-radius: 4px;
}
.assistant__msg--bot .assistant__bubble {
  background: var(--surface-2); color: var(--text-soft); border-bottom-left-radius: 4px;
}
.assistant__bubble.is-pending { color: var(--text-mute); font-style: italic; }
.assistant__bubble.is-error   { background: rgba(224,133,125,0.14); color: #e0857d; }

.assistant__form { display: flex; gap: 8px; margin-top: 14px; align-items: flex-end; }
.assistant__form .textarea { flex: 1; resize: vertical; }

/* =========================================================
   UTILITIES
   ========================================================= */
.stack > * + * { margin-top: 16px; }
.row { display: flex; align-items: center; gap: 8px; }
.text-mute { color: var(--text-mute); }
.font-display { font-family: var(--font-display); }
.icon { width: 16px; height: 16px; flex: none; }

/* =========================================================
   TOP BAR MOBILE + DRAWER  (nascosti su desktop)
   ========================================================= */
.topbar { display: none; }
.sidebar-overlay { display: none; }

/* =========================================================
   RESPONSIVE — tablet / telefono
   ========================================================= */
@media (max-width: 860px) {
  /* Layout: da flex (sidebar+main) a blocco impilato */
  .app { display: block; }

  /* Barra superiore con hamburger */
  .topbar {
    display: flex;
    align-items: center;
    gap: 14px;
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--bg-2);
    border-bottom: 1px solid var(--line);
    padding: 12px 16px;
  }
  .topbar__burger {
    background: transparent; border: none; color: var(--text);
    display: flex; align-items: center; padding: 4px;
  }
  .topbar__brand {
    font-family: var(--font-display); font-weight: 900; font-size: 22px;
    line-height: 1; color: #f5f1e8;
  }

  /* Sidebar come drawer a scomparsa */
  .sidebar {
    position: fixed; top: 0; left: 0;
    width: 78%; max-width: 300px; height: 100vh;
    transform: translateX(-100%);
    transition: transform .22s ease;
    z-index: 60;
    box-shadow: 0 0 40px rgba(0,0,0,.5);
  }
  body.nav-open .sidebar { transform: translateX(0); }

  /* Velo dietro il drawer */
  .sidebar-overlay {
    display: block;
    position: fixed; inset: 0;
    background: rgba(10,12,18,.55);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    z-index: 55;
    opacity: 0; pointer-events: none;
    transition: opacity .2s ease;
  }
  body.nav-open .sidebar-overlay { opacity: 1; pointer-events: auto; }

  /* Contenuto a tutta larghezza */
  .main { max-width: none; padding: 20px 16px 64px; }

  /* Intestazioni più contenute */
  .page-header { flex-wrap: wrap; align-items: flex-start; gap: 14px; }
  .page-header__title { font-size: 34px; }

  /* Griglie → una o due colonne */
  .posts-grid, .diary-grid { grid-template-columns: 1fr; }
  .month-stats { grid-template-columns: repeat(2, 1fr); }
  .project__grid { grid-template-columns: 1fr; }
  .project-entry__head { flex-wrap: wrap; }

  /* Appuntamenti: impila data / testo / mappa */
  .appt { grid-template-columns: 1fr; gap: 16px; }
  .appt__date {
    border-right: none;
    border-bottom: 1px solid rgba(240,236,228,0.08);
    padding: 0 0 12px; text-align: left;
    display: flex; align-items: baseline; gap: 10px;
  }
  .appt__day { font-size: 30px; margin: 0; }

  /* Portachiavi: impila lista e dettaglio */
  .keychain-layout { flex-direction: column; }
  .keychain-list { width: 100%; }

  /* Diario di lavoro: fasce orarie più strette */
  .slot { grid-template-columns: 60px 60px 1fr 24px; gap: 8px; }

  /* Login / modale */
  .login__logo { font-size: 84px; }
  .modal { width: min(380px, calc(100vw - 32px)); padding: 26px; }
}

@media (max-width: 420px) {
  .month-stats { grid-template-columns: 1fr; }
  .page-header__title { font-size: 30px; }
}
