:root {
  --bg: #F6F5F1; --card: #FFFFFF; --ink: #1C1D21; --soft: #5B5D63; --soft2: #4A4C52; --line: #ECEAE4; --line2: #E4E2DC;
  --accent: #0F5F5C; --accent-soft: #E6EEEC; --work: #1F4E8C; --pers: #6B4AA0; --warn: #B4501A; --warn-soft: #FBEFE6; --ok: #1E7A46; --ok-soft: #E7F3EC;
  --chip: #EAE8E2; --danger: #B3261E;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: 'Instrument Sans', system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; }
a { color: var(--accent); text-decoration: none; }
button { font: inherit; color: inherit; }
#app { max-width: 600px; margin: 0 auto; padding: calc(20px + env(safe-area-inset-top)) 16px calc(96px + env(safe-area-inset-bottom)); }
h1 { margin: 0; font-weight: 500; letter-spacing: -0.015em; font-size: 30px; line-height: 1.1; }
h2 { margin: 0; font-size: 17px; font-weight: 600; }
.sub { font-size: 14px; color: var(--soft); font-weight: 500; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.card { background: var(--card); border-radius: 16px; padding: 14px; }
.list { background: var(--card); border-radius: 16px; padding: 0 14px; }
.list > * + * { border-top: 1px solid var(--line); }
.muted { color: var(--soft); font-size: 13px; }
.empty { background: var(--card); border-radius: 16px; padding: 16px; font-size: 14px; color: var(--soft2); }
.avatar { width: 44px; height: 44px; flex: none; border-radius: 999px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 600; border: 0; cursor: pointer; }

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.stat { background: var(--card); border-radius: 16px; padding: 12px; display: flex; flex-direction: column; gap: 2px; color: var(--ink); }
.stat b { font-size: 26px; font-weight: 700; }
.stat span { font-size: 13px; color: var(--soft); }
.pay { display: flex; align-items: center; gap: 12px; background: var(--warn-soft); border-radius: 16px; padding: 14px; color: var(--ink); }
.pill { min-width: 28px; height: 28px; padding: 0 8px; border-radius: 999px; background: var(--warn); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; }

.mailrow { display: flex; flex-direction: column; gap: 5px; padding: 13px 0; color: var(--ink); }
.mailrow .top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.mailrow .who { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mailrow .when { font-size: 12px; color: var(--soft); flex: none; }
.mailrow .subj { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mailrow .sum { font-size: 13px; color: var(--soft2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.tag.dark { background: var(--ink); color: #fff; }
.tag.warn { background: var(--warn-soft); color: #8A3B10; }
.tag.pers { background: #EFE9F7; color: var(--pers); }
.tag.ok { background: var(--ok-soft); color: var(--ok); }

.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid #DCD9D1; background: var(--card); cursor: pointer; font-size: 13px; font-weight: 600; }
.chip[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.search { width: 100%; height: 44px; border: 1px solid #DCD9D1; border-radius: 12px; padding: 0 14px; background: var(--card); font: 400 15px 'Instrument Sans', sans-serif; color: var(--ink); }

.ev { display: flex; gap: 14px; padding: 12px 0; }
.ev .t { font-size: 14px; font-weight: 600; width: 48px; flex: none; }
.ev .d { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ev .k { font-size: 12px; font-weight: 600; }

.back { width: 44px; height: 44px; margin-left: -10px; border: 0; background: transparent; cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--ink); }
.head { display: flex; align-items: center; gap: 6px; }
.head h1 { font-size: 24px; }
.mailhead { display: flex; flex-direction: column; gap: 6px; }
.mailhead .subj { font-size: 20px; font-weight: 500; letter-spacing: -0.01em; line-height: 1.25; }
.body { white-space: pre-wrap; font-size: 15px; line-height: 1.55; overflow-wrap: anywhere; }
.body.short { max-height: 260px; overflow: hidden; -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent); }
.linkbtn { border: 0; background: none; color: var(--accent); font-weight: 600; font-size: 14px; padding: 6px 0; cursor: pointer; }
.draft { background: var(--accent-soft); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.draft textarea { width: 100%; min-height: 220px; border: 1px solid #C9D9D6; border-radius: 12px; padding: 12px; font: 400 15px/1.5 'Instrument Sans', sans-serif; color: var(--ink); background: #fff; resize: vertical; }
.btns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.btn { height: 48px; border-radius: 14px; border: 1px solid #DCD9D1; background: #fff; cursor: pointer; font-weight: 600; font-size: 15px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 14px; }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.wide { grid-column: 1 / -1; }
.btn:disabled { opacity: .55; cursor: default; }
.notice { border-radius: 12px; padding: 10px 12px; font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.notice.ok { background: var(--ok-soft); color: var(--ok); }
.notice.warn { background: var(--warn-soft); color: #8A3B10; }

.todo { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 0; }
.check { width: 28px; height: 28px; flex: none; border-radius: 999px; border: 2px solid #C9C6BD; background: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; color: transparent; }
.check:hover, .check.done { border-color: var(--ok); color: var(--ok); }
.check.done { background: var(--ok); color: #fff; }
.todo .txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.todo .txt span:first-child { font-size: 15px; }
.addrow { display: flex; gap: 8px; }
.addrow input { flex: 1; min-width: 0; height: 48px; border: 1px solid #DCD9D1; border-radius: 14px; padding: 0 14px; background: #fff; font: 400 15px 'Instrument Sans', sans-serif; color: var(--ink); }
.addrow input[type=date] { flex: none; width: 150px; }

.daynav { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.iconbtn { width: 44px; height: 44px; border-radius: 12px; border: 1px solid #DCD9D1; background: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.dayhead { font-size: 13px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--soft2); margin: 4px 4px -6px; }
.dayhead.today { color: var(--accent); }
.past { filter: grayscale(1); opacity: .5; }
.dayhead.past { color: var(--soft2); }
.past .past { filter: none; opacity: 1; }

#nav { position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--line2); padding: 8px 6px calc(10px + env(safe-area-inset-bottom)); }
#nav .in { max-width: 600px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
#nav a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0; font-size: 11px; font-weight: 500; color: var(--soft); position: relative; }
#nav a[aria-current="page"] { color: var(--accent); font-weight: 600; }
#nav .badge { position: absolute; top: 0; left: 55%; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--warn); color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }

#toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(90px + env(safe-area-inset-bottom)); background: var(--ink); color: #fff; border-radius: 14px; padding: 12px 16px; font-size: 14px; display: flex; align-items: center; gap: 14px; max-width: calc(100vw - 32px); box-shadow: 0 6px 24px rgba(0,0,0,.18); z-index: 10; }
#toast button { border: 0; background: none; color: #7FD3C5; font-weight: 700; cursor: pointer; padding: 4px 0; }

.login { min-height: calc(100vh - 140px); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 26px; text-align: center; }
.login img { width: min(300px, 76vw); height: auto; }
.login p { margin: 0; font-size: 20px; line-height: 1.35; color: #3A3C42; }
.login small { font-size: 12px; color: var(--soft); line-height: 1.5; max-width: 320px; }
.login small a { color: var(--soft2); text-decoration: underline; }
.err { color: var(--danger); font-size: 14px; font-weight: 600; }
.spin { width: 28px; height: 28px; border-radius: 999px; border: 3px solid var(--line2); border-top-color: var(--accent); animation: s 0.8s linear infinite; margin: 40px auto; }
@keyframes s { to { transform: rotate(360deg); } }
@media (min-width: 700px) { #app { padding-top: 36px; } }
#toast[hidden], #nav[hidden] { display: none; }
.chat { display: flex; flex-direction: column; gap: 14px; }
.msgs { display: flex; flex-direction: column; gap: 10px; padding-bottom: 80px; }
.msg { display: flex; flex-direction: column; gap: 6px; max-width: 88%; }
.msg.me { align-self: flex-end; align-items: flex-end; }
.msg.her { align-self: flex-start; }
.bub { padding: 10px 14px; border-radius: 18px; font-size: 15px; line-height: 1.45; overflow-wrap: anywhere; }
.msg.me .bub { background: var(--accent); color: #fff; border-bottom-right-radius: 6px; }
.msg.her .bub { background: #fff; border-bottom-left-radius: 6px; }
.ccard { background: #fff; border-radius: 16px; padding: 12px 14px; border: 1px solid var(--line); width: min(420px, 82vw); }
.composer { position: fixed; left: 0; right: 0; bottom: calc(66px + env(safe-area-inset-bottom)); display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; padding: 10px 16px; background: var(--bg); max-width: 600px; margin: 0 auto; }
.composer textarea { flex: 1; min-width: 0; min-height: 48px; max-height: 140px; border: 1px solid #DCD9D1; border-radius: 16px; padding: 12px 14px; font: 400 16px/1.4 'Instrument Sans', sans-serif; color: var(--ink); background: #fff; resize: none; }
#mic.rec { background: #FDE8E7; border-color: #E9A39E; }
.frow { display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); }
.frow span { width: 76px; flex: none; font-size: 12px; font-weight: 600; color: var(--soft2); }
.frow input { flex: 1; min-width: 0; height: 40px; border: 0; background: transparent; font: 400 15px 'Instrument Sans', sans-serif; color: var(--ink); }
.ccard .notice { display: block; }
/* agenda: giorno / settimana / mese */
.seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); background: var(--chip); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { height: 38px; border: 0; border-radius: 9px; background: transparent; cursor: pointer; font-weight: 600; font-size: 14px; color: var(--soft2); }
.seg button[aria-selected="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.month { background: #fff; border-radius: 16px; padding: 8px; }
.mhead, .mgrid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.mhead span { text-align: center; font-size: 11px; font-weight: 600; color: var(--soft); padding: 6px 0; text-transform: uppercase; letter-spacing: .04em; }
.mcell { min-height: 56px; border: 0; border-radius: 10px; background: transparent; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 2px; font: inherit; color: var(--ink); }
.mcell:hover { background: var(--bg); }
.mcell.out { color: #B5B2AA; }
.mcell .n { font-size: 14px; font-weight: 600; width: 28px; height: 28px; border-radius: 999px; display: flex; align-items: center; justify-content: center; }
.mcell.today .n { background: var(--accent); color: #fff; }
.mcell .dots { display: flex; gap: 3px; } .mcell .dots i { width: 6px; height: 6px; border-radius: 99px; }
.mcell .evs { display: none; }
#nav .brand { display: none; }
/* scrivania: schermo intero */
@media (min-width: 1000px) {
  #nav { top: 0; bottom: 0; right: auto; width: 232px; border-top: 0; border-right: 1px solid var(--line2); padding: 24px 12px; }
  #nav .in { display: flex; flex-direction: column; gap: 4px; max-width: none; }
  #nav .brand { display: block; padding: 4px 12px 24px; } #nav .brand img { width: 140px; height: auto; }
  #nav a { flex-direction: row; justify-content: flex-start; gap: 12px; padding: 10px 14px; border-radius: 12px; font-size: 15px; }
  #nav a:not(.brand):hover { background: var(--bg); }
  #nav a[aria-current="page"] { background: var(--accent-soft); }
  #nav .badge { position: static; margin-left: auto; }
  #app { max-width: 1240px; margin: 0 0 0 232px; padding: 36px 40px 48px; }
  #app > .stack { max-width: 1100px; }
  .composer { left: 232px; max-width: none; bottom: 0; padding: 12px 40px 20px; }
  .msgs { padding-bottom: 100px; max-width: 900px; }
  #toast { bottom: 24px; left: calc(50% + 116px); }
  .split { display: grid; grid-template-columns: clamp(380px, 42%, 700px) minmax(0, 1fr); gap: 28px; align-items: start; }
  .split .pl { position: sticky; top: 24px; max-height: calc(100vh - 48px); overflow-y: auto; padding-right: 4px; }
  .split .pr { min-width: 0; }
  .split .pr .back { display: none; }
  .mailrow.active { background: var(--accent-soft); margin: 0 -14px; padding: 13px 14px; }
  .mcell { min-height: 112px; align-items: stretch; padding: 6px; }
  .mcell .n { align-self: flex-end; }
  .mcell .dots { display: none; }
  .mcell .evs { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
  .mev { font-size: 11.5px; line-height: 1.3; text-align: left; padding: 2px 6px; border-radius: 6px; background: color-mix(in srgb, var(--c) 12%, #fff); color: var(--c); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mcell .more { font-size: 11px; color: var(--soft); text-align: left; padding-left: 6px; }
  .week { display: grid !important; grid-template-columns: 220px minmax(0, 1fr); column-gap: 20px; row-gap: 12px !important; align-items: start; }
  .week .dayhead { margin: 14px 0 0; }
  .week > .muted { margin: 14px 0 0 !important; }
}
@media (min-width: 1000px) { .oggi-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 24px; align-items: start; } }
.aibox { background: #fff; border: 1px solid #C9D9D6; border-radius: 14px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.aibox[hidden] { display: none; }
.aibox textarea { width: 100%; border: 0; resize: vertical; min-height: 56px; font: 400 15px/1.45 'Instrument Sans', sans-serif; color: var(--ink); background: transparent; outline: none; }
.aibox .btn { height: 42px; }
#aimic.rec { background: #FDE8E7; border-color: #E9A39E; }
textarea.busy { opacity: .5; }
.aibox.wide { grid-column: 1 / -1; }
.selbox { display: none; }
.selecting .mailrow { position: relative; padding-left: 36px; }
.selecting .selbox { display: block; position: absolute; left: 0; top: 16px; width: 22px; height: 22px; border-radius: 6px; border: 2px solid #C9C6BD; background: #fff; }
.selecting .mailrow.sel .selbox { background: var(--accent); border-color: var(--accent); }
.selecting .mailrow.sel .selbox::after { content: ''; position: absolute; left: 6px; top: 2px; width: 5px; height: 10px; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }
.mailrow.gone { opacity: .3; pointer-events: none; }
.selbar { position: fixed; left: 0; right: 0; bottom: calc(66px + env(safe-area-inset-bottom)); z-index: 5; background: #fff; border-top: 1px solid var(--line2); padding: 10px 16px; display: flex; align-items: center; gap: 8px; box-shadow: 0 -4px 16px rgba(0,0,0,.06); }
.selbar[hidden] { display: none; }
.selbar .btn { height: 42px; }
.head .chip { height: 32px; padding: 0 12px; font-size: 12px; }
@media (min-width: 1000px) { .selbar { position: sticky; bottom: 0; left: auto; right: auto; border: 1px solid var(--line2); border-radius: 14px; } }
.selbar [hidden], .btn[hidden] { display: none !important; }
.mailrow .tags { align-items: center; }
.qa { margin-left: auto; display: inline-flex; gap: 4px; }
.qbtn { height: 30px; min-width: 30px; padding: 0 6px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; gap: 4px; color: var(--soft); font-size: 12px; font-weight: 600; cursor: pointer; border: 1px solid transparent; }
.qbtn:hover, .qbtn:focus-visible { background: #fff; border-color: var(--line2); color: var(--ink); }
.qbtn[data-qa="elimina"]:hover { color: var(--danger); }
.selecting .qa { display: none; }
@media (hover: hover) and (min-width: 1000px) { .mailrow .qa { opacity: 0; transition: opacity .15s; } .mailrow:hover .qa, .mailrow:focus-within .qa { opacity: 1; } }
/* profilo */
#nav a[data-nav="profilo"] { display: none; }
.prow { display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 9px 0; color: var(--ink); }
.prow .pi { width: 28px; text-align: center; font-size: 19px; flex: none; }
.prow .pt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 15px; }
.prow > svg { color: var(--soft); flex: none; }
.prow .dot { width: 9px; height: 9px; border-radius: 99px; flex: none; margin: 0 9px; }
h2.sec { font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--soft2); margin: 4px 4px 0; }
.sw { flex: none; width: 50px; height: 30px; border: 0; border-radius: 999px; padding: 3px; cursor: pointer; display: flex; background: #D5D2CA; transition: background .15s; }
.sw span { width: 24px; height: 24px; border-radius: 999px; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.sw[aria-checked="true"] { background: var(--accent); } .sw[aria-checked="true"] span { transform: translateX(20px); }
input.time { font: 600 13px 'Instrument Sans', sans-serif; color: var(--ink); border: 1px solid var(--line2); border-radius: 8px; padding: 2px 6px; background: #fff; }
a.avatar { text-decoration: none; }
@media (min-width: 1000px) {
  #nav a[data-nav="profilo"] { display: flex; margin-top: auto; }
  #nav .in { height: 100%; }
  .pgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 28px; align-items: start; }
}
.fl { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--soft2); }
.fl input, .fl select { height: 46px; border: 1px solid #D5D2CA; border-radius: 12px; padding: 0 12px; background: #fff; font: 400 15px 'Instrument Sans', sans-serif; color: var(--ink); width: 100%; }
.fl .muted { font-weight: 400; font-size: 12px; }
.notice[hidden], .err[hidden] { display: none; }
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(20,22,24,.42); display: flex; align-items: center; justify-content: center; padding: 16px; }
.mbox { background: #fff; border-radius: 20px; padding: 20px; width: min(440px, 100%); display: flex; flex-direction: column; gap: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.mbox h2 { font-size: 18px; overflow-wrap: anywhere; }
.mbox p { margin: 0; font-size: 14px; line-height: 1.5; color: var(--soft2); }
.btn.danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.prow .chip { flex: none; }
/* news */
#nav .in { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.nrow { display: flex; flex-direction: column; gap: 4px; padding: 13px 0; color: var(--ink); }
.nrow:hover .nt { color: var(--accent); }
.ntop { display: flex; gap: 8px; align-items: baseline; }
.nt { font-size: 15px; font-weight: 600; line-height: 1.35; }
.ns { font-size: 13.5px; color: var(--soft2); line-height: 1.45; }
.nd { width: 8px; height: 8px; border-radius: 99px; background: var(--work); flex: none; transform: translateY(-1px); }
.news { display: flex; flex-direction: column; gap: 18px; }
@media (min-width: 1000px) { .news { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; align-items: start; } }
.nsum { background: var(--accent-soft); border-radius: 14px; padding: 12px 14px; font-size: 14px; line-height: 1.5; color: var(--ink); }
.nsl { display: block; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--accent); margin-bottom: 4px; }
.star { margin-left: auto; flex: none; }
.nfoot { display: flex; justify-content: flex-end; margin-top: 2px; }
.nrow.gone { opacity: .3; pointer-events: none; }
.nfoot .qbtn { color: var(--accent); border-color: var(--line2); background: #fff; }
.seg4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.seg4 button { font-size: 13px; }
.nfoot { display: flex; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
.nbtn { height: 30px; padding: 0 10px; border-radius: 8px; display: inline-flex; align-items: center; font-size: 12px; font-weight: 600; cursor: pointer; border: 1px solid var(--line2); background: #fff; color: var(--soft2); }
.nbtn:hover { color: var(--ink); border-color: #CFCBC2; }
.nbtn.on { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.nbtn.imp.on { background: #FFF4D6; color: #8A5A00; }
.nrow.read .nt { color: var(--soft); font-weight: 500; }
.nrow.read .ns { color: var(--soft); }
.chips[hidden] { display: none; }
/* biglietti */
.vcard { border-radius: 20px; padding: 20px; min-height: 200px; display: flex; flex-direction: column; justify-content: space-between; gap: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.12); }
.vn { font-size: 22px; font-weight: 600; } .vr { font-size: 14px; opacity: .85; margin-top: 2px; }
.vl { display: flex; flex-direction: column; gap: 4px; font-size: 14px; overflow-wrap: anywhere; } .va { font-size: 13px; font-weight: 700; opacity: .9; }
.qr { width: 190px; height: 190px; } .qr svg { width: 100%; height: 100%; display: block; }
@media (min-width: 1000px) { .bgrid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 24px; align-items: start; } }
form[hidden] { display: none; }
/* note spese */
#nav a[data-nav="spese"] { display: none; }
.sgrid { display: flex; flex-direction: column; gap: 16px; }
@media (min-width: 1000px) { #nav a[data-nav="spese"] { display: flex; } .sgrid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 24px; align-items: start; } }
.cbar { display: grid; grid-template-columns: 130px minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 13px; }
.cbar .bar { height: 8px; background: var(--chip); border-radius: 99px; overflow: hidden; } .cbar .bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.srow { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 58px; padding: 8px 0; border: 0; background: none; cursor: pointer; text-align: left; font: inherit; color: var(--ink); }
.srow .si { width: 28px; text-align: center; font-size: 19px; flex: none; } .srow .pt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 15px; }
.sthumb { width: 36px; height: 36px; object-fit: cover; border-radius: 8px; flex: none; border: 1px solid var(--line2); } .sthumb.big { width: 100%; height: 180px; }
/* riepilogo */
.bl { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 5px; font-size: 14.5px; line-height: 1.45; }
.bsez { display: flex; flex-direction: column; gap: 12px; }
.brief-head { background: #FFF6E0; }
@media (min-width: 1000px) { .bsez { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; } }
#evmic.rec { background: #FDE8E7; border-color: #E9A39E; } #evbox[hidden] { display: none; }
.ev .t { display: flex; flex-direction: column; line-height: 1.2; }
.ev .t small { font-size: 14px; font-weight: 600; color: var(--accent); margin-top: 3px; }
.busy { background: var(--bg); border-radius: 12px; padding: 10px 12px; font-size: 13px; }
.busy:empty { display: none; }
.bslot { padding: 2px 0; } .bslot.clash { color: var(--danger); font-weight: 600; }
.rstar.on { background: #FFF4D6; color: #8A5A00; border-color: transparent; }
a.chip { display: inline-flex; align-items: center; text-decoration: none; } #rnew, #evnew { white-space: nowrap; flex: none; }
.drop { display: flex; align-items: center; justify-content: center; min-height: 96px; border: 2px dashed #DCD9D1; border-radius: 14px; padding: 14px; text-align: center; cursor: pointer; color: var(--soft2); font-size: 14px; background: #FBFAF7; }
.drop.over { border-color: var(--ok); background: #EEF6F4; color: var(--ink); }
[data-mrow] { flex-wrap: wrap; }
.macts { display: flex; gap: 6px; flex: none; }
@media (max-width: 640px) { [data-mrow] .pt { flex-basis: calc(100% - 40px); } .macts { margin-left: 40px; } .macts .chip { padding: 0 10px; } }
details summary { list-style-position: inside; }
code { background: var(--chip); border-radius: 6px; padding: 1px 5px; font-size: 13px; }
.mbox.wide { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; }
.mbox textarea, .segr textarea { width: 100%; border: 1px solid #DCD9D1; border-radius: 14px; padding: 10px 14px; font: 400 15px 'Instrument Sans', sans-serif; color: var(--ink); resize: vertical; }
.shift { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.shift .chip.on { background: var(--accent); color: #fff; }
.ev.evedit { cursor: pointer; align-items: center; border-radius: 10px; }
.ev.evedit .d { flex: 1; }
.evpen { flex: none; font-size: 12px; font-weight: 600; color: var(--soft2); border: 1px solid var(--line); border-radius: 99px; padding: 5px 10px; white-space: nowrap; }
.ev.evedit:hover .evpen, .ev.evedit:focus-visible .evpen { color: var(--ink); border-color: var(--ink); }
@media (max-width: 640px) { .evpen .lbl { display: none; } .evpen { padding: 5px 8px; } }
.mbox .ebtns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.drafta { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; }
.drafta span { width: auto; }
/* note e registrazioni */
.inp { height: 44px; border: 1px solid #DCD9D1; border-radius: 12px; padding: 0 12px; background: #fff; font: 400 15px 'Instrument Sans', sans-serif; color: var(--ink); min-width: 0; }
textarea.inp { height: auto; padding: 10px 12px; resize: vertical; width: 100%; line-height: 1.45; }
.titin { border: 0; background: transparent; font: 600 24px 'Instrument Sans', sans-serif; color: var(--ink); padding: 0; width: 100%; }
.titin:focus { outline: none; border-bottom: 1px dashed var(--line); }
.quick { display: flex; gap: 8px; } .quick .btn { flex: 1; height: 46px; }
ul.nl { margin: 0; padding: 12px 16px 12px 32px; background: #fff; border-radius: 16px; display: flex; flex-direction: column; gap: 6px; font-size: 15px; }
.recdot { width: 12px; height: 12px; border-radius: 99px; background: var(--danger); animation: recb 1.2s infinite; }
@keyframes recb { 50% { opacity: .25; } }
#recpill { position: fixed; top: calc(10px + env(safe-area-inset-top)); right: 12px; z-index: 60; background: var(--danger); color: #fff; font-weight: 700; font-size: 14px; padding: 7px 12px; border-radius: 99px; box-shadow: 0 6px 20px rgba(0,0,0,.2); font-variant-numeric: tabular-nums; }
#recpill.paused { background: var(--soft2); }
#nav .in { grid-template-columns: repeat(7, minmax(0, 1fr)); }
@media (max-width: 999px) { #nav a { font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } }
.liico { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 6px; background: #0A66C2; color: #fff; font-weight: 800; font-size: 13px; font-family: Arial, sans-serif; }
.liimgbox { display: flex; flex-direction: column; gap: 8px; }
.liimg { width: 100%; max-width: 420px; border-radius: 12px; border: 1px solid var(--line); display: block; }
.allrow { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.allrow > .prow { flex: 1; min-width: 0; }
.allrow .allsum { flex-basis: 100%; }
.allrow .allsum:empty { display: none; }
.todo .grip { flex: none; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; color: var(--soft2); cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; border-radius: 8px; }
.todo .grip:hover, .todo .grip:focus-visible { color: var(--ink); background: var(--bg); }
.todo.dragging { position: relative; z-index: 5; background: #fff; box-shadow: 0 8px 24px rgba(0,0,0,.14); border-radius: 12px; transition: none; }
.todo.dragging .grip { cursor: grabbing; }
@media (max-width: 640px) { #add { flex-wrap: wrap; } #add #tt { flex-basis: 100%; } #add #td { flex: 1; width: auto; } }
.nosel, .nosel * { user-select: none !important; -webkit-user-select: none !important; -webkit-touch-callout: none !important; }

.todomenu { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 0 10px 40px; }
.todomenu button { height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 99px; background: #fff; font: 600 13px 'Instrument Sans', sans-serif; color: var(--ink); cursor: pointer; }
.todo.moved { background: var(--accent-soft); border-radius: 12px; transition: background .6s; }

/* archivio link */
#nav a[data-nav="archivio"] { display: none; }
@media (min-width: 1000px) { #nav a[data-nav="archivio"] { display: flex; } }
.lcard { display: flex; gap: 12px; background: var(--card); border-radius: 16px; padding: 12px; align-items: flex-start; }
.lcard.visto { opacity: .65; }
.lthumb { flex: none; width: 112px; aspect-ratio: 16/10; border-radius: 10px; overflow: hidden; background: var(--accent-soft); }
.lthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lbody { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.ltit { font-weight: 600; font-size: 15px; color: var(--ink); overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lbody .muted { font-size: 12px; }
.lsum { font-size: 14px; line-height: 1.45; }
.lnota { font-size: 13px; background: #FBF7EC; border-radius: 8px; padding: 6px 8px; }
.lbody .chip { height: 30px; padding: 0 10px; font-size: 12px; }
.lbody .chip.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.lbody button.tag { border: 0; cursor: pointer; }
.ltag { background: #F1EFEA; color: var(--soft2); }
@media (max-width: 560px) { .lthumb { width: 84px; } }
.lcard { cursor: pointer; align-items: center; }
.lcard.open { align-items: flex-start; }
.lcard .lbody { gap: 4px; }
.lcard .ltit { -webkit-line-clamp: 2; }
.lcard.open .ltit { -webkit-line-clamp: unset; }
.ldet { display: flex; flex-direction: column; gap: 6px; margin-top: 2px; }
.ldet[hidden] { display: none; }
.lmeta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* scheda prima dell'appuntamento */
.scheda { display: flex; flex-direction: column; gap: 8px; }
.scheda .chip { align-self: flex-start; }
.schedabody { background: var(--bg); border: 1px solid var(--line2); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; line-height: 1.45; }
.schedabody[hidden] { display: none; }
.schedabody p { margin: 0; }
.schedabody h3 { margin: 6px 0 0; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--soft); font-weight: 700; }
.schedabody ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 3px; }
.schedabody .schedachi { font-weight: 600; }
.schedabody .schedafoot { font-size: 12px; }
.schedabody .linkbtn { border: 0; background: none; padding: 0; font: inherit; color: var(--soft2); text-decoration: underline; cursor: pointer; }
