/* Plico — stile condiviso. Stessa grammatica visiva del prototipo. */

@font-face { font-family: 'Geist'; src: url('fonts/geist.woff2') format('woff2'); font-weight: 100 900; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Geist'; src: url('fonts/geist-ext.woff2') format('woff2'); font-weight: 100 900; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Geist Mono'; src: url('fonts/geist-mono.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }

:root {
  --bg: #EEF0F3; --surface: #FFFFFF; --sunken: #F6F7F9; --field: #F1F2F5;
  --ink: #14161B; --ink-2: #2A2E37; --ink-3: #3A3F4A; --muted: #5B616E;
  --line: #E3E6EB; --line-2: #ECEEF1; --line-strong: #D4D8DE;
  --accent: #3D35C8; --accent-hover: #3129B0; --accent-soft: #EEEDFC; --accent-ring: #DCD9FA;
  --ok: #17663A; --ok-bg: #E6F4EC; --err: #A3341C; --err-bg: #FBE9E5; --warn: #7A5200; --warn-bg: #FFF2CF;
  --radius: 12px; --radius-lg: 18px;
  --mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --shadow-pop: 0 2px 6px rgba(20,22,27,.08), 0 16px 40px rgba(20,22,27,.14);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: 'Geist', ui-sans-serif, system-ui, -apple-system, sans-serif; color: var(--ink); background: var(--bg);
  font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; letter-spacing: -0.02em; }
.ico { flex: none; display: block; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Pulsanti e campi ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 14px;
  border: 1px solid #DDE1E7; border-radius: 10px; background: var(--surface); font-size: 13px; font-weight: 500;
  color: var(--ink); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: #F4F5F7; color: var(--ink); }
.btn-primary { border: 0; background: var(--accent); color: #fff; font-weight: 600; font-size: 14px; min-height: 44px; padding: 0 18px; }
.btn-primary:hover { background: var(--accent-hover); color: #fff; }
.btn-primary:disabled { opacity: .6; cursor: progress; }
.btn-lg { min-height: 52px; border-radius: 13px; font-size: 15px; width: 100%; }
.btn-ghost { border: 0; background: transparent; color: var(--accent); font-weight: 500; min-height: 44px; }
.btn-ghost:hover { background: var(--accent-soft); }
.btn-danger { color: var(--err); }
.btn-danger:hover { background: var(--err-bg); color: var(--err); }
.btn-sm { min-height: 34px; padding: 0 12px; }
.ib { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border: 0; padding: 0;
  background: transparent; border-radius: 10px; color: var(--ink-3); cursor: pointer; text-decoration: none; flex: none; }
.ib:hover { background: var(--bg); color: var(--ink); }
.ib.on { color: var(--accent); }
.kbd { font-family: var(--mono); font-size: 11px; padding: 1px 6px; border: 1px solid var(--line-strong); border-radius: 6px; color: var(--muted); }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; color: var(--ink-2); min-width: 0; }
.field input, .field select, .field textarea, .input { min-height: 44px; padding: 0 13px; border: 1px solid var(--line-strong);
  border-radius: 11px; font-size: 15px; color: var(--ink); background: var(--surface); outline: none; min-width: 0; width: 100%; }
.field textarea { padding: 10px 13px; min-height: 90px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.field .hint { font-weight: 400; font-size: 12px; color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.grid-server { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 1fr) minmax(0, 1.4fr); gap: 12px; }
@media (max-width: 600px) { .grid-server { grid-template-columns: minmax(0,1fr) minmax(0,1fr); } .grid-server > :first-child { grid-column: 1 / -1; } }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ink-2); min-height: 32px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--field); }
.seg button, .seg a { border: 0; font-size: 13px; padding: 0 12px; min-height: 30px; border-radius: 8px; cursor: pointer;
  background: transparent; color: var(--ink); display: inline-flex; align-items: center; text-decoration: none; }
.seg .on { background: var(--surface); font-weight: 600; box-shadow: 0 1px 2px rgba(20,22,27,.06); }

.tag { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; border-radius: 7px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.tag-ok { background: var(--ok-bg); color: var(--ok); }
.tag-err { background: var(--err-bg); color: var(--err); }
.tag-alias { background: var(--accent-soft); color: var(--accent); font-size: 11px; padding: 2px 7px; }
.tag-grey { background: var(--field); color: var(--ink-3); }
.dot { width: 10px; height: 10px; border-radius: 3px; flex: none; display: inline-block; }

.flash { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: 12px; font-size: 14px; line-height: 1.5; }
.flash-ok { background: var(--ok-bg); color: var(--ok); }
.flash-error { background: var(--err-bg); color: var(--err); }
.flash-warn { background: var(--warn-bg); color: var(--warn); }

.card { background: var(--surface); border-radius: var(--radius-lg); padding: 24px; }
.card h2 { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.card .sub { margin: 4px 0 0; font-size: 14px; color: var(--muted); line-height: 1.5; }
.row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 14px 0; border-top: 1px solid var(--line-2); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.between { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* ---------- Layout autenticazione ---------- */
.auth { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); min-height: 100vh; }
.auth-brand { display: flex; flex-direction: column; justify-content: space-between; gap: 40px; padding: 48px 56px; margin: 12px;
  border-radius: 22px; background: #14161B; color: #F3F4F6; }
.auth-brand h1 { font-size: clamp(36px, 4.4vw, 52px); line-height: 1.05; font-weight: 650; letter-spacing: -0.035em; }
.auth-brand h1 span { color: #A9A3F7; }
.auth-brand p { margin: 0; font-size: 17px; line-height: 1.6; color: #C2C6CF; max-width: 480px; }
.auth-facts { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; font-size: 13px; color: #C2C6CF; }
.auth-facts b { display: block; color: #F3F4F6; font-weight: 600; margin-bottom: 4px; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px 20px; }
.auth-card { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 24px; padding: 40px 36px; border-radius: 22px; background: var(--surface); }
.auth-card h2 { font-size: 26px; font-weight: 650; }
.auth-card p { margin: 0; font-size: 15px; line-height: 1.55; color: var(--muted); }
.badge-ico { width: 64px; height: 64px; border-radius: 18px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.auth-foot { display: flex; align-items: center; gap: 8px; padding-top: 18px; border-top: 1px solid var(--line-2); font-size: 12px; color: var(--muted); }
.otp { display: flex; gap: 8px; justify-content: space-between; }
.otp input { width: 48px; height: 56px; border: 1px solid var(--line-strong); border-radius: 12px; text-align: center; font-family: var(--mono); font-size: 22px; outline: none; padding: 0; }
.otp input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.err-msg { color: var(--err); font-size: 14px; min-height: 1em; }
.logo { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 700; letter-spacing: -0.02em; text-decoration: none; color: inherit; }
.qr { align-self: center; padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: 14px; line-height: 0; }
.qr svg { width: 200px; height: 200px; }
.codes { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; padding: 16px; border-radius: 12px; background: var(--sunken);
  font-family: var(--mono); font-size: 15px; text-align: center; }
@media (max-width: 900px) { .auth { grid-template-columns: minmax(0,1fr); } .auth-brand { display: none; } }

/* ---------- App posta ---------- */
.app { display: grid; grid-template-columns: 248px 392px minmax(0, 1fr); gap: 12px; padding: 12px; height: 100vh; height: 100dvh; }
.sidebar { display: flex; flex-direction: column; gap: 18px; padding: 8px 4px; min-height: 0; overflow-y: auto; }
.compose-btn { display: flex; align-items: center; justify-content: space-between; min-height: 46px; padding: 0 16px; border-radius: 12px;
  background: var(--accent); color: #fff; border: 0; font-weight: 600; font-size: 15px; cursor: pointer; }
.compose-btn:hover { background: var(--accent-hover); }
.compose-btn .kbd { color: #fff; border-color: rgba(255,255,255,.3); background: rgba(255,255,255,.12); }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-label { padding: 0 12px 6px; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.nav { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 0 12px; border: 0; border-radius: 10px;
  background: transparent; font-size: 14px; color: var(--ink-2); cursor: pointer; text-align: left; text-decoration: none; }
.nav:hover { background: #E3E6EB; color: var(--ink); }
.nav.on { background: #E3E6EB; font-weight: 600; color: var(--ink); }
.nav .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav .count { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.nav .count.hot { color: var(--accent); font-weight: 500; }
.nav.sub { min-height: 34px; font-size: 13px; }
.nav .warn { color: var(--err); }
.acc-folders { display: flex; flex-direction: column; gap: 1px; margin: 2px 0 6px; }
.toggle-folders { width: 26px; height: 26px; margin-right: -6px; border: 0; background: transparent; border-radius: 7px; color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; transition: transform .15s; }
.toggle-folders:hover { background: rgba(0,0,0,.06); }
.toggle-folders.open { transform: rotate(90deg); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.secure { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 12px; background: var(--surface); }
.secure .badge { width: 32px; height: 32px; border-radius: 9px; background: var(--ok-bg); color: var(--ok); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.secure b { display: block; font-size: 13px; }
.secure span { font-size: 12px; color: var(--muted); }

.panel { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--surface); border-radius: var(--radius-lg); overflow: hidden; }
.list-head { display: flex; flex-direction: column; gap: 12px; padding: 18px 18px 12px; }
.list-head h1 { font-size: 22px; font-weight: 650; }
.search { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 0 12px; border-radius: 11px; background: var(--field); color: var(--muted); }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; font-size: 14px; color: var(--ink); outline: none; }
.list { flex: 1; min-height: 0; overflow-y: auto; padding: 0 8px 8px; display: flex; flex-direction: column; gap: 2px; }
.msg { display: flex; gap: 12px; width: 100%; padding: 13px 14px; border: 0; border-radius: 12px; background: transparent; text-align: left; cursor: pointer; color: inherit; }
.msg:hover { background: #F4F5F7; }
.msg.sel { background: var(--accent-soft); }
.msg.checked { background: #E6E4FA; }
.avatar { position: relative; flex: none; width: 38px; height: 38px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; color: var(--ink); }
.avatar .acc { position: absolute; right: -2px; bottom: -2px; width: 12px; height: 12px; border-radius: 4px; border: 2px solid var(--surface); }
.msg-body { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.msg-line { display: flex; align-items: center; gap: 8px; min-width: 0; }
.msg .from, .msg .subj, .msg .snip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg .from { flex: 1; min-width: 0; font-size: 14px; }
.msg .subj { font-size: 14px; }
.msg .snip { flex: 1; min-width: 0; font-size: 13px; color: var(--muted); }
.msg .time { font-family: var(--mono); font-size: 12px; color: var(--muted); flex: none; }
.msg.unread .from, .msg.unread .subj { font-weight: 600; }
.unread-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }
.msg .flag { color: #C98A12; }
.list-empty { padding: 56px 24px; text-align: center; color: var(--muted); font-size: 14px; line-height: 1.6; }
.list-more { margin: 8px auto 16px; }
.bulk { display: flex; align-items: center; gap: 4px; padding: 6px 12px; border-bottom: 1px solid var(--line-2); background: var(--accent-soft); }
.bulk span { flex: 1; font-size: 13px; font-weight: 600; color: var(--accent); }

.reader-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding: 10px 14px; border-bottom: 1px solid var(--line-2); }
.reader-bar .grp { display: flex; gap: 2px; align-items: center; }
.pill { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 14px; border: 1px solid #DDE1E7; border-radius: 10px;
  background: var(--surface); font-size: 13px; color: var(--ink-2); cursor: pointer; }
.pill:hover { background: #F4F5F7; }
.reader-head { padding: 26px 32px 16px; display: flex; flex-direction: column; gap: 14px; max-width: 860px; width: 100%; margin: 0 auto; }
.recv { display: inline-flex; align-self: flex-start; align-items: center; gap: 8px; padding: 5px 10px 5px 8px; border-radius: 8px; background: var(--field); font-size: 12px; color: var(--ink-3); }
.reader-head h2 { font-size: 26px; line-height: 1.2; font-weight: 650; letter-spacing: -0.025em; text-wrap: balance; word-break: break-word; }
.sender { display: flex; align-items: center; gap: 14px; }
.sender .avatar { width: 44px; height: 44px; font-size: 15px; }
.sender .who { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.sender .who b { font-size: 15px; }
.sender .who .addr { font-weight: 400; color: var(--muted); font-size: 13px; }
.sender .who .to { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.atts { display: flex; flex-wrap: wrap; gap: 8px; }
.att { display: inline-flex; align-items: center; gap: 10px; padding: 8px 12px 8px 8px; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--ink); max-width: 280px; }
.att:hover { background: var(--sunken); color: var(--ink); }
.att .ext { width: 36px; height: 36px; border-radius: 9px; background: var(--err-bg); color: var(--err); display: inline-flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 10px; font-weight: 500; flex: none; text-transform: uppercase; }
.att .meta { display: flex; flex-direction: column; min-width: 0; }
.att .meta b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att .meta span { font-size: 12px; color: var(--muted); }
.notice { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; border-radius: 10px; background: var(--sunken); font-size: 13px; color: var(--ink-3); flex-wrap: wrap; }
.body-frame { flex: 1; min-height: 0; border: 0; width: 100%; background: #fff; }
.reader-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--muted); padding: 40px; text-align: center; }
.quick { padding: 12px 20px 16px; border-top: 1px solid var(--line-2); }
.quick-box { max-width: 820px; margin: 0 auto; display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border: 1px solid #DDE1E7; border-radius: 14px; }
.quick-box .from-line { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.quick-box .chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; border-radius: 7px; background: var(--field); color: var(--ink); }
.quick-row { display: flex; align-items: flex-end; gap: 10px; }
.quick-row textarea { flex: 1; min-width: 0; border: 0; resize: none; font-size: 14px; outline: none; background: transparent; min-height: 40px; max-height: 200px; }
.send-ib { width: 40px; height: 40px; border: 0; border-radius: 11px; background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex: none; }
.send-ib:hover { background: var(--accent-hover); }
.back-btn { display: none; }

@media (min-width: 981px) and (max-width: 1240px) { .app { grid-template-columns: 216px 330px minmax(0,1fr); } }
@media (max-width: 980px) {
  .app { grid-template-columns: minmax(0,1fr); padding: 8px; }
  .app .sidebar, .app .listpanel, .app .reader { display: none; }
  .app[data-pane="side"] .sidebar, .app[data-pane="list"] .listpanel, .app[data-pane="reader"] .reader { display: flex; }
  .back-btn { display: inline-flex; }
  .reader-head { padding: 18px 18px 12px; }
}

/* ---------- Composizione ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(20,22,27,.35); display: flex; align-items: flex-start; justify-content: center; padding: 4vh 16px; overflow-y: auto; }
.composer { width: 100%; max-width: 920px; display: flex; flex-direction: column; background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-pop); }
.composer-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px 12px 24px; border-bottom: 1px solid var(--line-2); }
.composer-head h2 { font-size: 17px; font-weight: 600; }
.cline { position: relative; display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 6px 24px; border-bottom: 1px solid var(--line-2); font-size: 14px; flex-wrap: wrap; }
.cline > .lbl { width: 60px; flex: none; color: var(--muted); }
.cline input.bare { flex: 1; min-width: 140px; border: 0; font-size: 15px; outline: none; background: transparent; min-height: 36px; }
.from-btn { display: inline-flex; align-items: center; gap: 10px; min-height: 38px; padding: 0 10px 0 12px; border: 1px solid #DDE1E7; border-radius: 10px;
  background: var(--surface); font-size: 14px; cursor: pointer; min-width: 0; max-width: 100%; }
.from-btn .addr { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu { position: absolute; z-index: 60; min-width: 260px; max-width: calc(100vw - 32px); max-height: 60vh; overflow-y: auto; padding: 6px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-pop); }
.menu .group { display: flex; align-items: center; gap: 8px; padding: 10px 12px 4px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.menu .opt { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 4px 12px; border: 0; border-radius: 10px; background: transparent; font-size: 14px; cursor: pointer; text-align: left; color: var(--ink); text-decoration: none; }
.menu .opt.indent { padding-left: 30px; }
.menu .opt:hover, .menu .opt.active { background: var(--field); }
.menu .opt.sel { background: var(--accent-soft); }
.menu .opt .t { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.menu .opt .t small { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; align-items: center; min-width: 0; }
.rchip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 4px 4px 10px; border-radius: 8px; background: var(--field); font-size: 14px; max-width: 100%; }
.rchip.bad { background: var(--err-bg); color: var(--err); }
.rchip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rchip button { width: 22px; height: 22px; border: 0; border-radius: 6px; background: transparent; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; color: inherit; }
.rchip button:hover { background: rgba(0,0,0,.07); }
.ccbtn { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 13px; padding: 4px 6px; border-radius: 6px; }
.ccbtn:hover { background: var(--field); color: var(--ink); }
.toolbar { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; padding: 6px 18px; border-bottom: 1px solid var(--line-2); }
.toolbar .sep { width: 1px; height: 20px; background: var(--line); margin: 0 6px; }
.toolbar .ib { width: 34px; height: 34px; font-size: 15px; }
.editor { min-height: 260px; max-height: 56vh; overflow-y: auto; padding: 20px 24px; font-family: Arial, Helvetica, sans-serif; font-size: 15px; line-height: 1.6; outline: none; word-wrap: break-word; }
.editor blockquote { margin: 8px 0; padding-left: 12px; border-left: 3px solid var(--line-strong); color: var(--ink-3); }
.editor img { max-width: 100%; height: auto; }
.editor .plico-sig { margin-top: 18px; color: var(--ink-3); }
.editor .plico-sig::before { content: '-- '; display: block; color: var(--muted); }
.editor:empty::before { content: attr(data-placeholder); color: var(--muted); }
.c-atts { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 24px 14px; }
.c-atts .att { padding-right: 4px; }
.composer-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 18px 12px 24px; border-top: 1px solid var(--line-2); }
.composer-foot .via { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.composer.drag { outline: 3px dashed var(--accent); outline-offset: -8px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 80; display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-radius: 12px; background: #14161B; color: #fff; font-size: 14px; box-shadow: var(--shadow-pop); max-width: calc(100vw - 32px); }
.toast.err { background: var(--err); }
.toast button { border: 0; background: transparent; color: #A9A3F7; font-weight: 600; cursor: pointer; }

/* ---------- Impostazioni ---------- */
.settings { max-width: 1240px; margin: 0 auto; display: flex; flex-wrap: wrap; gap: 24px; padding: 24px; }
.settings-nav { flex: 1 1 220px; max-width: 260px; display: flex; flex-direction: column; gap: 2px; }
.settings-nav h1 { margin: 8px 0 12px; padding: 0 12px; font-size: 24px; font-weight: 650; }
.settings-main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
@media (max-width: 700px) { .settings { padding: 12px; } .settings-nav { max-width: none; } }
.acc-icon { width: 40px; height: 40px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.acc-icon .dot { width: 14px; height: 14px; border-radius: 4px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.tile { display: flex; flex-direction: column; gap: 8px; padding: 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); text-decoration: none; color: var(--ink); min-height: 110px; }
.tile:hover { background: var(--sunken); color: var(--ink); }
.tile.on { border: 2px solid var(--accent); background: #F7F6FF; padding: 15px; }
.tile b { font-size: 15px; }
.tile span { font-size: 12px; color: var(--muted); line-height: 1.4; }
.box { padding: 22px; border-radius: 14px; background: var(--sunken); }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches label { position: relative; cursor: pointer; }
.swatches input { position: absolute; opacity: 0; inset: 0; }
.swatches span { display: block; width: 30px; height: 30px; border-radius: 9px; border: 3px solid transparent; box-shadow: inset 0 0 0 2px #fff; }
.swatches input:checked + span { border-color: var(--ink); }
.swatches input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.ident { border: 1px solid var(--line); border-radius: 16px; padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.sig-wrap { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
.sig-editor { display: flex; flex-direction: column; border: 1px solid #DDE1E7; border-radius: 14px; overflow: hidden; min-width: 0; }
.sig-editor .bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding: 6px 8px; border-bottom: 1px solid var(--line-2); background: #FAFAFB; }
.sig-editor .bar .tools { display: flex; gap: 2px; }
.sig-editor .bar .ib { width: 32px; height: 32px; font-size: 14px; }
.sig-visual { min-height: 170px; padding: 16px 18px; outline: none; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 1.5; overflow-x: auto; }
.sig-visual img { max-width: 100%; height: auto; }
.sig-visual:empty::before { content: 'Scrivi la firma: nome, ruolo, contatti. Puoi inserire un logo.'; color: var(--muted); }
.sig-html { border: 0; min-height: 170px; padding: 14px 16px; font-family: var(--mono); font-size: 12px; line-height: 1.7; resize: vertical; outline: none; width: 100%; }
.sig-note { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-top: 1px solid var(--line-2); font-size: 12px; color: var(--muted); }
.preview { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.preview .lbl { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.preview .pv { flex: 1; padding: 20px; border-radius: 14px; background: var(--sunken); display: flex; flex-direction: column; gap: 12px; }
.preview .mail { padding: 18px; border-radius: 10px; background: #fff; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 1.6; color: #23262E; overflow-x: auto; }
.preview .mail img { max-width: 100%; height: auto; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-family: var(--mono); font-size: 12px; word-break: break-all; }
table.plain { width: 100%; border-collapse: collapse; font-size: 13px; }
table.plain td, table.plain th { text-align: left; padding: 10px 8px; border-top: 1px solid var(--line-2); vertical-align: top; }
table.plain th { font-weight: 600; color: var(--muted); font-size: 12px; border-top: 0; }
.danger-zone { border: 1px solid #F1D3CB; }
.card > .between:first-child { margin-bottom: 10px; }

/* ---------- 0.2: conversazioni, coda di uscita, bozze ---------- */
.conv-toggle { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--surface); font-size: 12px; color: var(--muted); cursor: pointer; }
.conv-toggle.on { border-color: var(--accent-ring); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.search-status { font-size: 12px; color: var(--muted); padding: 0 2px; }
.tcount { flex: none; font-family: var(--mono); font-size: 11px; color: var(--muted); border: 1px solid var(--line-strong); border-radius: 6px; padding: 0 5px; line-height: 16px; }
.draft-tag { color: var(--err); font-weight: 600; margin-right: 6px; }
.err-text { color: var(--err); }

.orow { display: flex; gap: 12px; padding: 13px 14px; border-radius: 12px; border-bottom: 1px solid var(--line-2); }
.orow .avatar { color: var(--ink-3); }
.orow.failed .avatar { background: var(--err-bg) !important; color: var(--err); }
.orow .from, .orow .subj, .orow .snip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.orow .from { flex: 1; min-width: 0; font-size: 14px; }
.orow .subj { font-size: 14px; font-weight: 600; }
.orow .snip { font-size: 13px; color: var(--muted); }
.orow .snip.err-text { color: var(--err); white-space: normal; }
.orow .time { font-family: var(--mono); font-size: 12px; color: var(--muted); flex: none; }
.orow-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

.reader-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.reader-scroll .reader-head { padding-bottom: 8px; }
.conv { max-width: 860px; margin: 0 auto; padding: 0 20px 24px; display: flex; flex-direction: column; gap: 8px; }
.mcard { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); overflow: hidden; }
.mcard.open { box-shadow: 0 1px 2px rgba(20,22,27,.04); }
.mcard-head { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border: 0; background: transparent; text-align: left; cursor: pointer; color: inherit; }
.mcard-head:hover { background: var(--sunken); }
.mcard-head .avatar { width: 34px; height: 34px; font-size: 12px; }
.mcard-who { display: flex; align-items: baseline; gap: 10px; flex: 1; min-width: 0; }
.mcard-who b { font-size: 14px; white-space: nowrap; }
.mcard-snip { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.mcard.open .mcard-snip { display: none; }
.mcard-date { font-size: 12px; flex: none; }
.mcard-body { display: none; padding: 0 14px 12px; }
.mcard.open .mcard-body { display: flex; flex-direction: column; gap: 10px; }
.mcard-meta { display: flex; flex-direction: column; gap: 3px; font-size: 13px; padding-left: 46px; }
.mcard-meta .to { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-3); }
.mcard-meta .recv { align-self: flex-start; margin-top: 4px; }
.mcard-actions { display: flex; gap: 2px; padding-left: 40px; }
.mcard .atts { padding-left: 46px; }
.mcard .notice { margin-left: 46px; }
.mcard .body-frame { flex: none; height: 320px; border: 0; width: 100%; background: #fff; }
.mcard .body-frame.sized { transition: height .15s ease; }
@media (max-width: 980px) {
  .conv { padding: 0 8px 16px; }
  .mcard-meta, .mcard .atts { padding-left: 0; }
  .mcard-actions { padding-left: 0; }
  .mcard .notice { margin-left: 0; }
}

.send-group { display: inline-flex; border-radius: 12px; overflow: hidden; }
.send-group .btn { border-radius: 0; }
.send-group .send-sched { width: 44px; padding: 0; border-left: 1px solid #5A53D6; }
.sched-custom { display: flex; gap: 8px; align-items: center; padding: 8px 12px 6px; border-top: 1px solid var(--line-2); margin-top: 4px; }
.save-status { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.att.bad { border-color: #F1D3CB; background: var(--err-bg); }
