/* Scribus – stile dell'interfaccia */
:root {
  --brand: #2557d6;
  --brand-dark: #1a3fa3;
  --brand-soft: #e8efff;
  --ink: #1f2328;
  --ink-2: #444a52;
  --muted: #687079;
  --line: #dfe3e8;
  --line-2: #eceff3;
  --bg: #f6f7f9;
  --surface: #fff;
  --danger: #c62828;
  --danger-soft: #fdecea;
  --ok: #1b7a3d;
  --ok-soft: #e6f4ea;
  --warn: #8a5300;
  --warn-soft: #fff4e0;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .1);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .18), 0 2px 6px rgba(16, 24, 40, .08);
  --chrome: #f9fbfd;
  --hover: rgba(60, 64, 67, .08);
  --hover-2: #f1f3f6;
  --soft: #eef1f5;
  --soft-2: #f8f9fb;
  --paper-bg: #eceef1;
  --share-bg: #c2e7ff;
  --share-hover: #b0dcfa;
  --share-ink: #001d35;
  --input-border: #cfd5dc;
  --line-strong: #b8c3d4;
  --muted-2: #c4cad3;
  --highlight: #fff6cc;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 15px/1.5 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 26px; line-height: 1.25; margin: 0 0 6px; letter-spacing: -.01em; }
h2 { font-size: 18px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 18px 0 8px; color: var(--ink-2); }
code { background: var(--line-2); padding: 1px 6px; border-radius: 4px; font-size: .92em; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 14px; }
.right { text-align: right; }
.ic { fill: currentColor; flex: none; vertical-align: middle; }
[hidden] { display: none !important; }

/* ---------- Pulsanti ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: 500 14px var(--font); cursor: pointer;
  text-decoration: none !important; white-space: nowrap; transition: background .15s, border-color .15s, box-shadow .15s;
}
.btn:hover { background: var(--hover-2); }
.btn:focus-visible, .icon-btn:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-danger { color: var(--danger); border-color: #f1c4c0; }
.btn-danger:hover { background: var(--danger-soft); }
.btn-block { width: 100%; height: 44px; font-size: 15px; }
.btn-small { height: 32px; padding: 0 12px; font-size: 13px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px;
  border: 0; border-radius: 50%; background: transparent; color: var(--ink-2); cursor: pointer; flex: none;
}
.icon-btn:hover { background: var(--hover); }
.link-btn { background: none; border: 0; padding: 0; color: var(--brand); font: inherit; cursor: pointer; text-decoration: underline; }

/* ---------- Form ---------- */
.form { display: grid; gap: 14px; }
.form label, .form .label { display: grid; gap: 6px; font-size: 14px; font-weight: 500; color: var(--ink-2); }
.form small { font-weight: 400; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=number], input:not([type]), select, textarea {
  width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--input-border); border-radius: 8px;
  font: 15px var(--font); color: var(--ink); background: var(--surface); transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; padding: 10px 12px; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 87, 214, .15); outline: none; }
.form label.check { display: flex; align-items: flex-start; gap: 10px; font-weight: 400; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--brand); flex: none; }
label.check { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px 18px; margin: 0; display: grid; gap: 14px; }
legend { font-weight: 600; padding: 0 6px; }
.hp { position: absolute !important; left: -9999px !important; height: 1px; overflow: hidden; }
textarea.code { font: 13px/1.5 ui-monospace, Menlo, Consolas, monospace; }

.alert { padding: 12px 14px; border-radius: 8px; margin: 0 0 14px; font-size: 14px; border: 1px solid transparent; }
.alert-ok { background: var(--ok-soft); color: var(--ok); border-color: #c4e5cf; }
.alert-err { background: var(--danger-soft); color: var(--danger); border-color: #f6c9c4; }
.alert-warn { background: var(--warn-soft); color: var(--warn); border-color: #f5dcae; }
.alert .pw { display: inline-block; margin: 6px 0; font-size: 16px; padding: 4px 10px; background: var(--surface); color: var(--ink); user-select: all; }

/* ---------- Pagine di accesso ---------- */
.auth-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 32px 16px;
  background: radial-gradient(1200px 600px at 10% -10%, #e3ebff 0, transparent 60%), radial-gradient(900px 500px at 110% 110%, #e6f4ff 0, transparent 60%), var(--bg);
}
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 32px 32px 28px; }
.auth-card.wide { max-width: 620px; }
.auth-card h1 { margin-top: 18px; }
.auth-card > .muted { margin: 0 0 20px; }
.auth-logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 20px; letter-spacing: -.01em; }
.auth-alt { text-align: center; margin: 20px 0 0; font-size: 14px; color: var(--muted); }
.reqs { list-style: none; padding: 12px 16px; margin: 0 0 18px; background: var(--bg); border-radius: 8px; font-size: 14px; display: grid; gap: 4px; }
.reqs li span { display: inline-block; width: 18px; font-weight: 700; }
.reqs .ok span { color: var(--ok); }
.reqs .ko span { color: var(--danger); }
.reqs small { display: block; margin-left: 22px; color: var(--muted); }
.auth-card form .right { margin: -6px 0 0; font-size: 14px; }

/* ---------- Barra superiore ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 16px;
  height: 64px; padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 20px; font-weight: 600; min-width: 220px; text-decoration: none !important; }
.spacer { flex: 1; }
.search {
  flex: 1; max-width: 720px; display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 16px;
  background: var(--soft); border-radius: 24px; color: var(--muted); transition: background .15s, box-shadow .15s;
}
.search:focus-within { background: var(--surface); box-shadow: var(--shadow); }
.search input { border: 0; background: transparent; height: 100%; padding: 0; box-shadow: none !important; font-size: 16px; }
.user-menu { position: relative; margin-left: auto; }
.avatar-btn { border: 0; background: none; padding: 4px; border-radius: 50%; cursor: pointer; display: flex; }
.avatar-btn:hover { background: var(--hover); }
.avatar {
  display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: #fff;
  font-weight: 600; flex: none; user-select: none; letter-spacing: .02em;
}

/* Menu a tendina */
.menu {
  display: none; position: absolute; right: 0; top: calc(100% + 6px); z-index: 100; min-width: 230px;
  background: var(--surface); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 6px; border: 1px solid var(--line-2);
}
.menu.open { display: block; animation: pop .12s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } }
.menu a, .menu button {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 12px; border: 0; background: none;
  font: 14px var(--font); color: var(--ink); text-align: left; border-radius: 6px; cursor: pointer; text-decoration: none !important;
}
.menu a:hover, .menu button:hover { background: var(--hover-2); }
.menu .ic { color: var(--muted); }
.menu .danger, .menu .danger .ic { color: var(--danger); }
.menu form { margin: 0; }
.menu-head { display: flex; gap: 12px; align-items: center; padding: 10px 12px 12px; border-bottom: 1px solid var(--line-2); margin-bottom: 6px; }
.menu-head small { display: block; color: var(--muted); font-size: 13px; }

/* ---------- Dashboard ---------- */
.dash-layout { display: grid; grid-template-columns: 256px 1fr; min-height: calc(100vh - 64px); }
.sidebar { padding: 16px 12px; position: sticky; top: 64px; height: calc(100vh - 64px); overflow: auto; }
.btn-new { height: 52px; padding: 0 22px 0 16px; border-radius: 16px; font-size: 15px; box-shadow: var(--shadow); margin: 0 0 16px 4px; }
.sidebar nav { display: grid; gap: 2px; }
.sidebar nav a, .side-action {
  display: flex; align-items: center; gap: 14px; height: 40px; padding: 0 16px; border-radius: 20px; color: var(--ink-2);
  font: 14px var(--font); text-decoration: none !important; border: 0; background: none; cursor: pointer; width: 100%; text-align: left;
}
.sidebar nav a:hover, .side-action:hover { background: var(--hover-2); }
.sidebar nav a.active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }
.sidebar nav a em { margin-left: auto; font-style: normal; font-size: 12px; color: var(--muted); }
.side-sep { height: 1px; background: var(--line); margin: 14px 8px; }
.dash-main { padding: 20px 28px 60px; min-width: 0; }

.templates { background: var(--soft); margin: -20px -28px 24px; padding: 20px 28px 22px; }
.templates h2 { font-size: 15px; font-weight: 500; color: var(--ink-2); }
.tpl-row { display: flex; gap: 18px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: thin; }
.tpl { border: 0; background: none; padding: 0; cursor: pointer; text-align: left; flex: none; font: inherit; color: inherit; }
.tpl-page {
  display: block; width: 144px; height: 186px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px;
  overflow: hidden; position: relative; transition: border-color .15s, box-shadow .15s;
}
.tpl:hover .tpl-page, .tpl:focus-visible .tpl-page { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.tpl-inner {
  display: block; position: absolute; top: 0; left: 0; width: 720px; padding: 60px 64px; transform: scale(.2); transform-origin: 0 0;
  font: 11pt/1.4 Arial, sans-serif; color: #202124; pointer-events: none;
}
.tpl-inner h1 { font-size: 22pt; } .tpl-inner h2 { font-size: 16pt; } .tpl-inner h3 { font-size: 13pt; }
.tpl-inner table { width: 100%; border-collapse: collapse; } .tpl-inner td, .tpl-inner th { border: 1px solid #999; padding: 6px; }
.tpl-plus { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; transform: scale(5); transform-origin: 0 0; width: 144px; height: 186px; }
.tpl-plus .ic { fill: var(--brand); width: 64px; height: 64px; }
.tpl-name { display: block; font-size: 14px; font-weight: 500; margin-top: 8px; }

.docs-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.docs-head h2 { margin: 0; flex: 1; font-size: 16px; }
.docs-tools { display: flex; align-items: center; gap: 6px; }
.sort { display: flex; align-items: center; gap: 4px; color: var(--muted); }
.sort select { height: 34px; border: 0; background: transparent; padding: 0 4px; width: auto; font-size: 14px; color: var(--ink-2); cursor: pointer; }
.sort select:focus { box-shadow: none; }
.v-list { display: none; }
.view-list .v-grid { display: none; } .view-list .v-list { display: inline; }

.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 20px; }
.doc-card { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; transition: border-color .15s, box-shadow .15s; }
.doc-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.doc-thumb, .doc-title { text-decoration: none !important; }
.doc-thumb { display: block; height: 220px; background: var(--soft-2); border-bottom: 1px solid var(--line); border-radius: 8px 8px 0 0; overflow: hidden; padding: 14px 18px 0; cursor: pointer; }
.mini-page {
  display: block; height: 100%; background: var(--surface); box-shadow: 0 0 0 1px var(--line-2); padding: 14px 14px;
  font: 7px/1.45 Arial, sans-serif; color: #5f6368; overflow: hidden; word-break: break-word;
}
.doc-info { display: flex; align-items: center; gap: 8px; padding: 10px 6px 12px 12px; }
.doc-icon { color: var(--brand); display: flex; }
.doc-text { flex: 1; min-width: 0; display: grid; }
.doc-title { color: var(--ink); font-weight: 500; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.doc-meta { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 4px; white-space: nowrap; overflow: hidden; }
.doc-owner, .doc-date { display: none; }
.shared-pill { display: inline-flex; color: var(--muted); }
.star-btn { color: #9aa0a6; width: 34px; height: 34px; border: 0; background: none; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.star-btn:hover { background: var(--hover); }
.star-btn.on { color: #f4b400; }
.doc-card .star-btn { position: absolute; top: 8px; right: 8px; background: var(--surface); box-shadow: var(--shadow); }
.doc-card .star-btn:not(.on) { opacity: 0; }
.doc-card:hover .star-btn, .doc-card .star-btn:focus-visible { opacity: 1; }
.view-list .doc-card .star-btn { position: static; box-shadow: none; background: none; }
.doc-card .more { width: 34px; height: 34px; }
.doc-menu { top: auto; bottom: 52px; right: 6px; }

/* Vista elenco */
.view-list .doc-grid { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.view-list .doc-card { border: 0; border-bottom: 1px solid var(--line-2); border-radius: 0; box-shadow: none; }
.view-list .doc-card:last-child { border-bottom: 0; }
.view-list .doc-card:hover { background: var(--hover-2); }
.view-list .doc-thumb { display: none; }
.view-list .doc-info { padding: 6px 6px 6px 16px; }
.view-list .doc-text { grid-template-columns: minmax(0, 1fr) 160px 110px; align-items: center; gap: 16px; }
.view-list .doc-meta { display: none; }
.view-list .doc-owner, .view-list .doc-date { display: block; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.view-list .doc-menu { bottom: auto; top: 44px; }

.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty .ic { fill: var(--muted-2); }
.empty p { max-width: 380px; margin: 12px auto 0; }

/* ---------- Profilo e admin ---------- */
.narrow { max-width: 680px; margin: 0 auto; padding: 24px 16px 60px; }
.wide-main { max-width: 1180px; margin: 0 auto; padding: 24px 20px 60px; }
.back { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 22px 24px; margin: 18px 0; }
.card.danger { border-color: #f3cdc9; }
.card-head { display: flex; align-items: center; gap: 16px; justify-content: space-between; margin-bottom: 8px; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.mini-search input { height: 36px; width: 260px; }
.profile-head { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.colors { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.swatch { position: relative; cursor: pointer; display: block !important; }
.swatch input { position: absolute; opacity: 0; }
.swatch span { display: block; width: 30px; height: 30px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px transparent; }
.swatch input:checked + span { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--c); }
.swatch input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 4px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin: 18px 0; }
.stats div { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; }
.stats strong { display: block; font-size: 26px; letter-spacing: -.02em; }
.stats span { color: var(--muted); font-size: 13px; }
.form-inline { grid-template-columns: 1fr 1fr; align-items: end; }
.form-inline .check, .form-inline button { justify-self: start; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 500; color: var(--muted); font-size: 13px; padding: 10px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px 10px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table .who { display: flex; align-items: center; gap: 10px; }
.table .who small { display: block; color: var(--muted); }
.table .actions { text-align: right; }
.table .actions div { display: inline-flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.table .actions form { margin: 0; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; background: var(--brand-soft); color: var(--brand-dark); font-size: 12px; font-weight: 600; }

/* ---------- Modali e notifiche ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 2000; background: rgba(32, 33, 36, .45); display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade .12s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); width: 100%; max-width: 520px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; }
.modal.wide { max-width: 1060px; height: calc(100vh - 64px); }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 16px 16px 8px 24px; }
.modal-head h2 { flex: 1; margin: 0; font-size: 19px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.modal-body { padding: 8px 24px 22px; overflow: auto; flex: 1; min-height: 0; }
.modal-body p { margin: 0 0 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.modal-actions.stack { flex-wrap: wrap; }
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 3000; transform: translate(-50%, 30px); opacity: 0; pointer-events: none;
  background: #202124; color: #fff; padding: 12px 20px; border-radius: 8px; font-size: 14px; max-width: calc(100vw - 32px);
  box-shadow: var(--shadow-lg); transition: transform .2s, opacity .2s;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast.err { background: #b3261e; }

/* Condivisione */
.share-add { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; margin-bottom: 8px; }
.share-add select { width: auto; }
.people { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.people li { display: flex; align-items: center; gap: 12px; padding: 6px 0; }
.people li > div { flex: 1; min-width: 0; }
.people small { display: block; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.people select { width: auto; height: 36px; font-size: 13px; }
.linkbox { display: flex; gap: 8px; margin-top: 10px; }
.linkbox input { font-size: 13px; color: var(--muted); }

/* Cronologia versioni */
.history { display: grid; grid-template-columns: 280px 1fr; gap: 18px; height: 100%; min-height: 380px; }
.hist-list { overflow: auto; border-right: 1px solid var(--line); padding-right: 10px; display: flex; flex-direction: column; gap: 2px; }
.hist-save { margin-bottom: 8px; align-self: flex-start; }
.hist-item { display: grid; text-align: left; gap: 2px; padding: 9px 12px; border: 0; border-radius: 8px; background: none; cursor: pointer; font: 14px var(--font); color: var(--ink); }
.hist-item:hover { background: var(--hover-2); }
.hist-item.active { background: var(--brand-soft); }
.hist-label { color: var(--brand-dark); font-size: 13px; }
.hist-who { font-size: 13px; color: var(--muted); }
.hist-preview { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.hist-preview iframe { flex: 1; width: 100%; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); min-height: 300px; }
.hist-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; }

/* ---------- Editor ---------- */
.editor-page { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; background: var(--chrome); }
.ed-top { display: flex; align-items: center; gap: 10px; padding: 8px 14px 4px; background: var(--chrome); flex: none; }
.ed-logo { display: flex; padding: 2px; border-radius: 8px; }
.ed-titlebox { flex: 1; min-width: 0; }
.ed-titleline { display: flex; align-items: center; gap: 2px; }
.ed-title {
  border: 1px solid transparent !important; background: transparent !important; height: 32px !important; padding: 0 6px !important;
  font-size: 18px !important; width: auto !important; min-width: 120px; max-width: 520px; flex: 0 1 auto; border-radius: 4px !important;
  field-sizing: content;
}
.ed-title:hover { border-color: var(--line) !important; }
.ed-title:focus { border-color: var(--brand) !important; background: var(--surface) !important; box-shadow: none !important; }
.save-status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-left: 8px; white-space: nowrap; }
.save-status.saving .ic, .save-status.dirty .ic { animation: spin 1.2s linear infinite; }
.save-status.error { color: var(--danger); }
@keyframes spin { to { transform: rotate(-360deg); } }
.ed-sub { font-size: 13px; padding-left: 7px; min-height: 0; }
.ed-right { display: flex; align-items: center; gap: 6px; }
.presence { display: flex; }
.presence .avatar { box-shadow: 0 0 0 2px var(--chrome); margin-left: -6px; }
.presence .avatar.more { background: #80868b; width: 30px; height: 30px; font-size: 12px; }
.btn-share { background: var(--share-bg); border-color: var(--share-bg); color: var(--share-ink); border-radius: 20px; height: 40px; padding: 0 18px 0 14px; }
.btn-share:hover { background: var(--share-hover); }
.banner { display: flex; align-items: center; gap: 12px; padding: 8px 16px; font-size: 14px; background: var(--brand-soft); color: var(--brand-dark); flex: none; }
.banner span { flex: 1; }
.banner.warn { background: var(--warn-soft); color: var(--warn); }
.banner.err { background: var(--danger-soft); color: var(--danger); }
.banner a, .banner .link-btn { color: inherit; font-weight: 600; text-decoration: underline; }
.banner .icon-btn { width: 30px; height: 30px; color: inherit; }
.ed-body { flex: 1; display: flex; min-height: 0; }
.ed-main { flex: 1; min-width: 0; position: relative; display: flex; flex-direction: column; }
.ed-main .tox-tinymce { border: 0 !important; border-radius: 0 !important; flex: 1; }
.ed-main .tox .tox-editor-header { box-shadow: none !important; border-bottom: 1px solid var(--line) !important; padding: 0 !important; background: var(--chrome); }
.ed-main .tox .tox-menubar { background: var(--chrome) !important; padding: 0 6px; }
.ed-main .tox .tox-toolbar-overlord, .ed-main .tox .tox-toolbar__primary { background: var(--soft) !important; }
.ed-main .tox .tox-toolbar-overlord { margin: 0 10px 8px; border-radius: 20px; padding: 2px 8px; }
.ed-main .tox .tox-toolbar__primary { background: transparent !important; }
.ed-main .tox .tox-statusbar { border-top: 1px solid var(--line) !important; }
.ed-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--muted); background: var(--paper-bg); }
#editor { visibility: hidden; }
.spinner { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin2 .8s linear infinite; }
@keyframes spin2 { to { transform: rotate(360deg); } }

.outline { display: none; width: 240px; flex: none; border-right: 1px solid var(--line); background: var(--chrome); overflow: auto; }
.show-outline .outline { display: block; }
.outline-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 6px 4px 18px; font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.outline-head .icon-btn { width: 30px; height: 30px; }
.outline-list { padding: 4px 8px 20px; display: grid; }
.outline-list button { border: 0; background: none; text-align: left; font: 14px var(--font); color: var(--ink-2); padding: 6px 10px; border-radius: 6px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.outline-list button:hover { background: var(--hover-2); color: var(--ink); }
.outline-list .ol-h1 { font-weight: 600; color: var(--ink); }
.outline-list .ol-h2 { padding-left: 22px; }
.outline-list .ol-h3 { padding-left: 34px; font-size: 13px; }
.outline-list .ol-h4 { padding-left: 46px; font-size: 13px; color: var(--muted); }
.outline-empty { font-size: 13px; color: var(--muted); padding: 6px 10px; margin: 0; }

/* ---------- Vista di lettura ---------- */
.view-page { background: var(--paper-bg); }
.view-top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.view-title { flex: 1; min-width: 0; display: grid; }
.view-title strong { font-size: 17px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.view-title small { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.view-actions { display: flex; gap: 8px; }
.print-hint { max-width: 760px; margin: 16px auto 0; padding: 10px 16px; background: var(--warn-soft); color: var(--warn); border-radius: 8px; font-size: 14px; }
.view-wrap { padding: 28px 16px 60px; overflow-x: auto; }
.view-wrap .page { margin: 0 auto; background: var(--surface); box-shadow: 0 1px 3px rgba(60, 64, 67, .3), 0 4px 8px 3px rgba(60, 64, 67, .12); box-sizing: border-box; }

.view-wrap .page-break { border-top: 2px dashed #d6d9de; margin: 28px 0; }

@media print {
  .view-wrap .page-break { border: 0; margin: 0; }
  .no-print, .toast { display: none !important; }
  .view-page { background: var(--surface); }
  .view-wrap { padding: 0; overflow: visible; }
  .view-wrap .page { width: auto !important; min-height: 0 !important; padding: 0 !important; box-shadow: none; margin: 0; }
}

/* ---------- Schermi piccoli ---------- */
@media (max-width: 900px) {
  .brand { min-width: 0; }
  .brand span { display: none; }
  .dash-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; padding: 12px 12px 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
  .sidebar nav { display: flex; gap: 6px; overflow-x: auto; width: 100%; order: 3; padding-bottom: 4px; }
  .sidebar nav a { flex: none; width: auto; height: 36px; padding: 0 14px; border: 1px solid var(--line); background: var(--surface); }
  .sidebar nav a span { white-space: nowrap; }
  .btn-new { margin: 0; height: 44px; }
  .side-sep { display: none; }
  .side-action { width: auto; }
  .side-action span { display: none; }
  .dash-main { padding: 16px 12px 60px; }
  .templates { margin: 0 -12px 20px; padding: 16px 12px; }
  .doc-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .doc-thumb { height: 160px; }
  .view-list .doc-text { grid-template-columns: 1fr; gap: 0; }
  .view-list .doc-owner { display: none; }
  .doc-card .star-btn:not(.on) { opacity: 1; }
  .doc-card .star-btn { top: 6px; right: 6px; width: 30px; height: 30px; }
  .row2, .form-inline { grid-template-columns: 1fr; }
  .history { grid-template-columns: 1fr; grid-template-rows: 180px 1fr; }
  .hist-list { border-right: 0; border-bottom: 1px solid var(--line); padding: 0 0 8px; }
  .share-add { grid-template-columns: 1fr; }
  .outline { position: absolute; z-index: 20; top: 0; bottom: 0; left: 0; box-shadow: var(--shadow-lg); background: var(--surface); }
  .ed-body { position: relative; }
  .btn-share span, .view-actions .btn span { display: none; }
  .btn-share { padding: 0 12px; }
  .view-actions .btn { padding: 0 10px; }
  .save-status span { display: none; }
  .ed-title { max-width: 46vw; font-size: 16px !important; }
  .auth-card { padding: 26px 20px; }
  .mini-search input { width: 100%; }
}
@media (max-width: 560px) {
  .search { height: 42px; }
  #historyBtn, .presence { display: none; }
  .ed-logo svg { width: 30px; height: 30px; }
}

/* =====================================================================
   Versione 1.1 – commenti, notifiche, cartelle, modelli, temi
   ===================================================================== */

/* ---------- Tema scuro ---------- */
:root[data-theme="dark"] {
  --brand: #5b8cff; --brand-dark: #7ea5ff; --brand-soft: rgba(91, 140, 255, .18);
  --ink: #e6e8eb; --ink-2: #c4c9d0; --muted: #9aa3ad; --muted-2: #4a5059;
  --line: #34383e; --line-2: #2a2d32; --line-strong: #4a5059;
  --bg: #16181b; --surface: #1f2226; --chrome: #1a1c20; --paper-bg: #121315;
  --hover: rgba(255, 255, 255, .07); --hover-2: #2a2e34; --soft: #24272c; --soft-2: #1b1d21;
  --share-bg: #21406a; --share-hover: #2a4f80; --share-ink: #dbe8ff;
  --input-border: #3c4148; --highlight: rgba(255, 213, 79, .16);
  --danger: #ff8a80; --danger-soft: rgba(255, 82, 82, .12);
  --ok: #81c995; --ok-soft: rgba(129, 201, 149, .12);
  --warn: #f2c26b; --warn-soft: rgba(242, 194, 107, .12);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 1px 3px rgba(0, 0, 0, .5);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, .55), 0 2px 6px rgba(0, 0, 0, .4);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --brand: #5b8cff; --brand-dark: #7ea5ff; --brand-soft: rgba(91, 140, 255, .18);
    --ink: #e6e8eb; --ink-2: #c4c9d0; --muted: #9aa3ad; --muted-2: #4a5059;
    --line: #34383e; --line-2: #2a2d32; --line-strong: #4a5059;
    --bg: #16181b; --surface: #1f2226; --chrome: #1a1c20; --paper-bg: #121315;
    --hover: rgba(255, 255, 255, .07); --hover-2: #2a2e34; --soft: #24272c; --soft-2: #1b1d21;
    --share-bg: #21406a; --share-hover: #2a4f80; --share-ink: #dbe8ff;
    --input-border: #3c4148; --highlight: rgba(255, 213, 79, .16);
    --danger: #ff8a80; --danger-soft: rgba(255, 82, 82, .12);
    --ok: #81c995; --ok-soft: rgba(129, 201, 149, .12);
    --warn: #f2c26b; --warn-soft: rgba(242, 194, 107, .12);
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 1px 3px rgba(0, 0, 0, .5);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, .55), 0 2px 6px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}
/* I fogli dei documenti restano bianchi come la carta */
.mini-page, .tpl-page, .view-wrap .page { background: #fff !important; color: #202124; }
.btn-primary, .btn-primary:hover { color: #fff; }
:root[data-theme="dark"] .btn-primary { background: #3f6fe0; border-color: #3f6fe0; }
:root[data-theme="dark"] .auth-page { background: var(--bg); }
:root[data-theme="dark"] .alert { border-color: transparent; }
:root[data-theme="dark"] .toast { background: #e6e8eb; color: #16181b; }
:root[data-theme="dark"] .tox-tinymce { border-color: var(--line) !important; }
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] .btn-primary { background: #3f6fe0; border-color: #3f6fe0; }
  :root[data-theme="auto"] .auth-page { background: var(--bg); }
  :root[data-theme="auto"] .alert { border-color: transparent; }
  :root[data-theme="auto"] .toast { background: #e6e8eb; color: #16181b; }
}
.ed-main .tox .tox-editor-header, .ed-main .tox .tox-menubar { background: var(--chrome) !important; }
.ed-main .tox .tox-toolbar-overlord { background: var(--soft) !important; }
.ed-main .tox .tox-statusbar { background: var(--chrome) !important; }

/* Selettore del tema nel menu dell'account e nel profilo */
.menu-theme { display: flex; align-items: center; gap: 12px; padding: 8px 12px; color: var(--muted); }
.seg { display: flex; flex: 1; background: var(--soft); border-radius: 8px; padding: 2px; }
.menu .seg button { flex: 1; justify-content: center; padding: 5px 4px; font-size: 13px; border-radius: 6px; color: var(--ink-2); }
.menu .seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); font-weight: 600; }
.theme-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 6px; }
.theme-opt { display: grid !important; gap: 8px; justify-items: center; cursor: pointer; font-weight: 400 !important; }
.theme-opt input { position: absolute; opacity: 0; }
.theme-opt .prev { width: 100%; height: 64px; border-radius: 10px; border: 2px solid var(--line); background: linear-gradient(135deg, #f6f7f9 50%, #fff 50%); }
.theme-opt.t-dark .prev { background: linear-gradient(135deg, #16181b 50%, #1f2226 50%); }
.theme-opt.t-auto .prev { background: linear-gradient(135deg, #f6f7f9 50%, #16181b 50%); }
.theme-opt input:checked + .prev { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.theme-opt input:focus-visible + .prev { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- Notifiche ---------- */
.notif { position: relative; }
.notif-btn { position: relative; }
.notif-count, .cmt-count {
  position: absolute; top: 3px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: #d93025; color: #fff; font: 600 11px/18px var(--font); text-align: center; box-shadow: 0 0 0 2px var(--surface);
}
.cmt-count { background: #f2b600; color: #3a2a00; }
.notif-menu { width: 380px; max-width: calc(100vw - 24px); padding: 0; right: -8px; }
.notif-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line-2); }
.notif-head .link-btn { font-size: 13px; text-decoration: none; }
.notif-list { max-height: 420px; overflow: auto; padding: 6px; }
.notif-empty { color: var(--muted); text-align: center; padding: 26px 10px; margin: 0; font-size: 14px; }
.menu .notif-item { align-items: flex-start; gap: 12px; padding: 10px; line-height: 1.4; white-space: normal; }
.notif-item.unread { background: var(--brand-soft); }
.notif-item.unread:hover { background: var(--brand-soft); filter: brightness(.97); }
.notif-text { flex: 1; min-width: 0; font-size: 14px; color: var(--ink); overflow-wrap: anywhere; }
.notif-text small { display: flex; align-items: center; gap: 4px; margin-top: 3px; color: var(--muted); font-size: 12px; }

/* ---------- Commenti ---------- */
.cmt-btn { position: relative; }
.cpanel { display: none; width: 340px; flex: none; border-left: 1px solid var(--line); background: var(--chrome); flex-direction: column; min-height: 0; }
.show-comments .cpanel { display: flex; }
.cpanel-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 8px 8px 14px; border-bottom: 1px solid var(--line-2); }
.ctabs { display: flex; gap: 4px; background: var(--soft); padding: 3px; border-radius: 10px; }
.ctabs button { border: 0; background: none; padding: 6px 12px; border-radius: 8px; font: 500 13px var(--font); color: var(--ink-2); cursor: pointer; }
.ctabs button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.ctabs em { font-style: normal; color: var(--brand); margin-left: 2px; }
.cpanel-list { flex: 1; overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 12px; }
.c-empty { text-align: center; color: var(--muted); padding: 30px 10px; font-size: 14px; line-height: 1.6; }
.c-thread { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 12px 10px; cursor: pointer; transition: box-shadow .15s, border-color .15s; }
.c-thread:hover { border-color: var(--line-strong); }
.c-thread.active { border-color: #f2b600; box-shadow: 0 0 0 1px #f2b600, var(--shadow); cursor: default; }
.c-thread.resolved { opacity: .85; }
.c-new { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); cursor: default; }
.c-quote { font-size: 13px; color: var(--muted); border-left: 3px solid #f2c200; padding: 1px 0 1px 8px; margin-bottom: 10px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.c-quote.orphan { border-left-color: var(--muted-2); text-decoration: line-through; }
.c-resolved-by { font-size: 12px; color: var(--ok); margin: -4px 0 8px; font-weight: 600; }
.c-item + .c-item { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line-2); }
.c-head { display: flex; align-items: center; gap: 8px; }
.c-who { flex: 1; min-width: 0; display: grid; line-height: 1.25; }
.c-who strong { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-who small { font-size: 12px; color: var(--muted); }
.c-head .icon-btn { width: 30px; height: 30px; }
.c-resolve { color: var(--brand); }
.c-menu-wrap { position: relative; }
.c-menu { min-width: 180px; top: 32px; }
.c-body { font-size: 14px; margin-top: 6px; color: var(--ink); overflow-wrap: anywhere; line-height: 1.5; }
.mention { color: var(--brand); background: var(--brand-soft); border-radius: 4px; padding: 0 3px; font-weight: 500; }
.c-compose { margin-top: 10px; }
.c-compose textarea { width: 100%; resize: none; min-height: 36px; font: 14px/1.45 var(--font); padding: 8px 10px; border-radius: 8px; background: var(--surface); color: var(--ink); border: 1px solid var(--input-border); }
.c-compose .c-actions { display: none; justify-content: flex-end; gap: 6px; margin-top: 8px; }
.c-compose.focused .c-actions, .c-new .c-actions { display: flex; }
.c-reply textarea { min-height: 36px; }
.mention-box { position: fixed; z-index: 3000; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 4px; width: 260px; }
.mention-box button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 8px; border: 0; background: none; border-radius: 6px; text-align: left; cursor: pointer; color: var(--ink); font: 14px var(--font); }
.mention-box button.sel, .mention-box button:hover { background: var(--hover-2); }
.mention-box small { display: block; color: var(--muted); font-size: 12px; }
.page-count { margin-right: 12px; color: var(--muted); }

/* ---------- Modalità concentrazione ---------- */
.focus-exit { display: none; }
.focus-mode .ed-top, .focus-mode .banner, .focus-mode .outline, .focus-mode .cpanel,
.focus-mode .ed-main .tox .tox-editor-header, .focus-mode .ed-main .tox .tox-statusbar { display: none !important; }
.focus-mode .focus-exit {
  display: inline-flex; align-items: center; gap: 6px; position: fixed; top: 12px; right: 16px; z-index: 50;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); border-radius: 20px; padding: 7px 14px;
  font: 13px var(--font); cursor: pointer; opacity: .35; transition: opacity .2s; box-shadow: var(--shadow);
}
.focus-mode .focus-exit:hover, .focus-mode .focus-exit:focus-visible { opacity: 1; }

/* ---------- Cartelle ---------- */
.side-folders { margin-top: 14px; }
.side-title { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 2px 16px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.side-title .icon-btn { width: 32px; height: 32px; }
.side-folder { display: flex; align-items: center; gap: 12px; height: 36px; padding: 0 16px; border-radius: 18px; color: var(--ink-2); font-size: 14px; text-decoration: none !important; }
.side-folder:hover { background: var(--hover-2); }
.side-folder.active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }
.side-folder .nm { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-folder em { font-style: normal; font-size: 12px; color: var(--muted); }
.side-hint { font-size: 13px; color: var(--muted); padding: 2px 16px; margin: 4px 0; line-height: 1.45; }
.folders { margin-bottom: 26px; }
.folders h2 { font-size: 16px; }
.folder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.folder-tile { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); text-decoration: none !important; transition: border-color .15s, box-shadow .15s; }
.folder-tile:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.folder-tile .nm { flex: 1; font-weight: 500; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.folder-tile small { color: var(--muted); font-size: 12px; }
.folder-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
.folder-bar > a { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); padding: 4px 8px 4px 0; border-radius: 6px; }
.folder-bar h1 { flex: 1; display: flex; align-items: center; gap: 10px; font-size: 22px; margin: 0; min-width: 200px; }
.drop-over { outline: 2px dashed var(--brand) !important; outline-offset: -2px; background: var(--brand-soft) !important; }
.is-dragging [data-drop-folder] { transition: none; }
.doc-card.dragging { opacity: .45; }
.cmt-pill, .folder-pill { display: inline-flex; align-items: center; gap: 3px; margin-left: 6px; color: var(--muted); }
.cmt-pill { color: #b78a00; }
.move-list { display: grid; gap: 4px; }
.move-opt { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 0; background: none; border-radius: 8px; font: 14px var(--font); color: var(--ink); cursor: pointer; text-align: left; }
.move-opt:hover { background: var(--hover-2); }
.move-opt.current { background: var(--brand-soft); font-weight: 600; }
.move-opt.current::after { content: '(qui)'; margin-left: auto; font-weight: 400; color: var(--muted); font-size: 13px; }

/* ---------- Modelli personali ---------- */
.tpl-sep { flex: none; width: 1px; background: var(--line); margin: 0 4px 34px; }
.user-tpl { position: relative; }
.tpl-open { border: 0; background: none; padding: 0; cursor: pointer; display: block; }
.tpl-open:hover .tpl-page, .tpl-open:focus-visible .tpl-page { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.user-tpl .tpl-name { display: flex; align-items: center; gap: 6px; width: 144px; }
.tpl-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tpl-badge { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--ok); background: var(--ok-soft); border-radius: 4px; padding: 1px 5px; flex: none; }
.tpl-badge.mine { color: var(--brand-dark); background: var(--brand-soft); }
.tpl-more { width: 26px; height: 26px; margin-right: -6px; }
.tpl-menu { top: auto; bottom: 30px; left: 0; right: auto; }
.tpl-tip { font-size: 13px; color: var(--muted); margin: 10px 0 0; }
.tpl-inner img { max-width: 100%; }

@media (max-width: 900px) {
  .cpanel { position: absolute; z-index: 20; top: 0; bottom: 0; right: 0; width: min(360px, 100vw); box-shadow: var(--shadow-lg); }
  .side-folders { width: 100%; order: 4; margin-top: 4px; display: flex; gap: 6px; overflow-x: auto; align-items: center; }
  .side-title { padding: 0; }
  .side-title span, .side-hint { display: none; }
  .side-folder { flex: none; border: 1px solid var(--line); height: 34px; }
  .notif-menu { position: fixed; top: 60px; right: 8px; left: 8px; width: auto; }
  #focusBtn { display: none; }
}
@media (max-width: 560px) {
  #commentsBtn .ic { width: 20px; }
}

/* Ritocchi */
.topbar .notif { margin-left: auto; }
.topbar .notif + .user-menu { margin-left: 4px; }
.ed-right .notif + .btn-share { margin-left: 4px; }
.card .form > .btn { justify-self: start; }
:root[data-theme="dark"] .ed-main .tox .tox-mbtn:not(:hover):not(:focus):not(.tox-mbtn--active),
:root[data-theme="dark"] .ed-main .tox .tox-tbtn:not(:hover):not(:focus):not(.tox-tbtn--enabled),
:root[data-theme="dark"] .ed-main .tox .tox-split-button:not(:hover):not(:focus),
:root[data-theme="dark"] .ed-main .tox .tox-toolbar, :root[data-theme="dark"] .ed-main .tox .tox-toolbar__primary,
:root[data-theme="dark"] .ed-main .tox .tox-toolbar__overflow { background: transparent !important; }
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] .ed-main .tox .tox-mbtn:not(:hover):not(:focus):not(.tox-mbtn--active),
  :root[data-theme="auto"] .ed-main .tox .tox-tbtn:not(:hover):not(:focus):not(.tox-tbtn--enabled),
  :root[data-theme="auto"] .ed-main .tox .tox-split-button:not(:hover):not(:focus),
  :root[data-theme="auto"] .ed-main .tox .tox-toolbar, :root[data-theme="auto"] .ed-main .tox .tox-toolbar__primary,
  :root[data-theme="auto"] .ed-main .tox .tox-toolbar__overflow { background: transparent !important; }
}
.ed-titlebox { overflow: hidden; }
.ed-titleline { min-width: 0; }
@media (max-width: 560px) {
  .ed-top { gap: 4px; padding: 6px 8px 2px; }
  .ed-title { min-width: 60px; max-width: 40vw; }
  .ed-top #starBtn, .ed-right .notif { display: none; }
  .ed-right { gap: 2px; }
  .ed-right .icon-btn { width: 34px; height: 34px; }
}

/* =====================================================================
   Versione 1.2 – interfaccia stile Microsoft Word
   ===================================================================== */
:root {
  --wd-blue: #185abd; --wd-blue-2: #124ca1; --wd-on-blue: #fff;
  --rb-bg: #f3f2f1; --rb-panel: #f9f9f9; --rb-line: #d6d4d2; --rb-ink: #252423; --rb-muted: #605e5c;
  --rb-hover: #e1dfdd; --rb-press: #c8c6c4; --rb-on: #cfe0f7; --rb-on-ink: #0f4a99;
  --sb-bg: #f3f2f1; --page-bg: #e6e6e6;
}
:root[data-theme="dark"] {
  --wd-blue: #1f1f1f; --wd-blue-2: #2b2b2b; --wd-on-blue: #f3f3f3;
  --rb-bg: #292929; --rb-panel: #2e2e2e; --rb-line: #474747; --rb-ink: #f0f0f0; --rb-muted: #b3b3b3;
  --rb-hover: #3d3d3d; --rb-press: #4a4a4a; --rb-on: #26466f; --rb-on-ink: #cfe2ff;
  --sb-bg: #262626; --page-bg: #1b1c1f;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --wd-blue: #1f1f1f; --wd-blue-2: #2b2b2b; --wd-on-blue: #f3f3f3;
    --rb-bg: #292929; --rb-panel: #2e2e2e; --rb-line: #474747; --rb-ink: #f0f0f0; --rb-muted: #b3b3b3;
    --rb-hover: #3d3d3d; --rb-press: #4a4a4a; --rb-on: #26466f; --rb-on-ink: #cfe2ff;
    --sb-bg: #262626; --page-bg: #1b1c1f;
  }
}
.rb-ic { fill: currentColor; flex: none; display: block; }
.rb-caret { display: inline-block; width: 0; height: 0; border-left: 3.5px solid transparent; border-right: 3.5px solid transparent; border-top: 4px solid currentColor; opacity: .75; vertical-align: middle; }

/* Barra del titolo */
.editor-page { background: var(--page-bg); }
.wd-title { background: var(--wd-blue); color: var(--wd-on-blue); padding: 4px 10px; gap: 8px; height: 46px; align-items: center; }
.wd-title .ed-logo { background: #fff; border-radius: 6px; padding: 3px; }
.wd-title .icon-btn, .wd-title .save-status, .wd-title .star-btn { color: var(--wd-on-blue); }
.wd-title .icon-btn:hover { background: rgba(255, 255, 255, .16); }
.wd-title .star-btn:not(.on) { color: rgba(255, 255, 255, .8); }
.wd-title .star-btn.on { color: #ffd34d; }
.wd-title .presence .avatar { box-shadow: 0 0 0 2px var(--wd-blue); }
.wd-title .save-status { opacity: .9; margin-left: 2px; }
.wd-title .save-status.error { color: #ffd0cc; }
.qat { display: flex; align-items: center; gap: 0; padding-right: 6px; border-right: 1px solid rgba(255, 255, 255, .25); }
.qat .rb-btn { color: var(--wd-on-blue); width: 30px; height: 30px; }
.qat .rb-btn:hover { background: rgba(255, 255, 255, .16); }
.qat .rb-btn:disabled { opacity: .45; }
.wd-name { flex: 0 1 auto; display: flex; align-items: center; gap: 2px; min-width: 0; overflow: visible; }
.wd-title .ed-title { color: var(--wd-on-blue) !important; font-size: 15px !important; height: 30px !important; max-width: 340px; }
.wd-title .ed-title:hover { border-color: rgba(255, 255, 255, .45) !important; }
.wd-title .ed-title:focus { background: #fff !important; color: #1f2328 !important; }
.wd-search { position: relative; flex: 1; max-width: 460px; margin: 0 auto; display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px; border-radius: 6px; background: rgba(255, 255, 255, .18); color: var(--wd-on-blue); }
.wd-search:focus-within { background: #fff; color: #444; box-shadow: var(--shadow); }
.wd-search input { flex: 1; min-width: 0; border: 0 !important; background: transparent !important; height: 30px !important; padding: 0 !important; color: inherit; font-size: 14px; box-shadow: none !important; }
.wd-search input::placeholder { color: rgba(255, 255, 255, .85); }
.wd-search:focus-within input { color: #252423; }
.wd-search:focus-within input::placeholder { color: #8a8886; }
.rb-search-res { position: absolute; top: 36px; left: 0; right: 0; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow-lg); padding: 4px; z-index: 60; }
.rb-search-res .rb-mi.sel { background: var(--rb-on); color: var(--rb-on-ink); }
.wd-title .btn-share { height: 32px; border-radius: 6px; background: rgba(255, 255, 255, .95); border-color: transparent; color: #185abd; }
:root[data-theme="dark"] .wd-title .btn-share { background: #3a3a3a; color: #f3f3f3; }
.wd-title .notif-count, .wd-title .cmt-count { box-shadow: 0 0 0 2px var(--wd-blue); }
.wd-title .avatar-btn:hover { background: rgba(255, 255, 255, .16); }

/* Barra multifunzione */
.ribbon { background: var(--rb-bg); color: var(--rb-ink); border-bottom: 1px solid var(--rb-line); flex: none; position: relative; z-index: 30; user-select: none; }
.rb-tabs { display: flex; align-items: stretch; gap: 2px; padding: 0 8px; height: 34px; overflow-x: auto; scrollbar-width: none; }
.rb-tabs::-webkit-scrollbar { display: none; }
.rb-tab { position: relative; border: 0; background: none; color: var(--rb-ink); font: 13.5px var(--font); padding: 0 12px; cursor: pointer; white-space: nowrap; border-radius: 4px 4px 0 0; }
.rb-tab:hover { background: var(--rb-hover); }
.rb-tab.on { font-weight: 600; color: var(--wd-blue); }
:root[data-theme="dark"] .rb-tab.on { color: #8ab4ff; }
.rb-tab.on::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: 2px; height: 3px; border-radius: 2px; background: #185abd; }
.rb-tab.rb-file { background: #185abd; color: #fff; font-weight: 600; margin-right: 4px; border-radius: 4px; margin-top: 3px; margin-bottom: 3px; }
.rb-tab.rb-file:hover { background: #124ca1; }
.rb-tab.ctx { color: #8a3ab9; }
.rb-tab.ctx.on::after { background: #8a3ab9; }
.rb-tspacer { flex: 1; }
.rb-trackbadge { align-self: center; display: inline-flex; align-items: center; gap: 4px; border: 1px solid #f0b2a8; background: #fdecea; color: #a4262c; border-radius: 12px; padding: 2px 10px; font: 12px var(--font); cursor: pointer; white-space: nowrap; }
.rb-trackbadge[hidden] { display: none; }
.rb-collapse { align-self: center; border: 0; background: none; color: var(--rb-muted); width: 28px; height: 28px; border-radius: 4px; cursor: pointer; display: grid; place-items: center; }
.rb-collapse:hover { background: var(--rb-hover); }
.rb-panels { background: var(--rb-panel); border-top: 1px solid var(--rb-line); }
.rb-panel-tab { display: flex; align-items: stretch; height: 96px; padding: 4px 4px 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.rb-panel-tab[hidden] { display: none; }
.rb-collapsed:not(.rb-peek) .rb-panels { display: none; }
.rb-peek .rb-panels { position: absolute; left: 0; right: 0; top: 34px; box-shadow: var(--shadow-lg); }
.rb-group { display: flex; flex-direction: column; padding: 0 6px; border-right: 1px solid var(--rb-line); flex: none; }
.rb-gbody { flex: 1; display: flex; align-items: flex-start; gap: 2px; }
.rb-glabel { position: relative; height: 18px; display: flex; align-items: center; justify-content: center; font-size: 11.5px; color: var(--rb-muted); white-space: nowrap; padding: 0 16px; }
.rb-launch { position: absolute; right: -2px; bottom: 2px; width: 16px; height: 16px; border: 0; background: none; color: var(--rb-muted); border-radius: 3px; padding: 2px; cursor: pointer; }
.rb-launch:hover { background: var(--rb-hover); color: var(--rb-ink); }
.rb-big { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 2px; min-width: 52px; max-width: 86px; height: 72px; padding: 4px 6px; border: 1px solid transparent; border-radius: 4px; background: none; color: var(--rb-ink); font: 12px/1.15 var(--font); cursor: pointer; text-align: center; }
.rb-big span { display: block; white-space: normal; }
.rb-big .rb-ic { margin: 2px 0 2px; color: #185abd; }
:root[data-theme="dark"] .rb-big .rb-ic { color: #8ab4ff; }
.rb-stack { display: flex; flex-direction: column; justify-content: flex-start; gap: 1px; padding-top: 1px; }
.rb-row { display: flex; align-items: center; gap: 1px; height: 24px; }
.rb-btn { display: inline-flex; align-items: center; justify-content: center; gap: 5px; height: 24px; min-width: 26px; padding: 0 4px; border: 1px solid transparent; border-radius: 3px; background: none; color: var(--rb-ink); font: 12.5px var(--font); cursor: pointer; white-space: nowrap; }
.rb-btn-label { justify-content: flex-start; padding: 0 6px 0 4px; }
.rb-btn .rb-caret { margin-left: 1px; }
.rb-big:hover, .rb-btn:hover, .rb-arrow:hover { background: var(--rb-hover); }
.rb-big:active, .rb-btn:active, .rb-arrow:active, .rb-open { background: var(--rb-press) !important; }
.rb-big.on, .rb-btn.on { background: var(--rb-on); border-color: #a6c4ec; color: var(--rb-on-ink); }
:root[data-theme="dark"] .rb-big.on, :root[data-theme="dark"] .rb-btn.on { border-color: #3d6aa3; }
.rb-big:disabled, .rb-btn:disabled, .rb-arrow:disabled { opacity: .4; cursor: default; background: none !important; }
.rb-split { display: inline-flex; align-items: stretch; border-radius: 3px; }
.rb-split:hover { box-shadow: inset 0 0 0 1px var(--rb-press); }
.rb-split .rb-btn { border-radius: 3px 0 0 3px; }
.rb-arrow { border: 1px solid transparent; background: none; color: var(--rb-ink); width: 14px; padding: 0; border-radius: 0 3px 3px 0; cursor: pointer; display: grid; place-items: center; }
.rb-split.big { flex-direction: column; }
.rb-split.big .rb-big { height: 54px; border-radius: 3px 3px 0 0; }
.rb-split.big .rb-arrow { width: auto; height: 18px; border-radius: 0 0 3px 3px; }
.rb-color .rb-btn { position: relative; padding-bottom: 4px; }
.rb-colorbar { position: absolute; left: 5px; right: 5px; bottom: 2px; height: 4px; border-radius: 1px; }
.rb-vsep { width: 1px; height: 18px; background: var(--rb-line); margin: 0 3px; }
.rb-font { height: 24px !important; width: 140px !important; padding: 0 6px !important; font-size: 13px !important; border-radius: 3px !important; border-color: var(--rb-line) !important; background: var(--surface) !important; color: var(--ink) !important; margin-right: 3px; }
.rb-size { display: inline-flex; align-items: stretch; height: 24px; border: 1px solid var(--rb-line); border-radius: 3px; background: var(--surface); margin-right: 3px; }
.rb-size input { width: 38px; height: 22px !important; border: 0 !important; padding: 0 4px !important; font-size: 13px !important; box-shadow: none !important; background: transparent !important; color: var(--ink); }
.rb-size .rb-arrow { width: 16px; border-radius: 0 3px 3px 0; }
.rb-check { display: flex !important; align-items: center; gap: 6px; height: 24px; font: 12.5px var(--font); padding: 0 6px; cursor: pointer; white-space: nowrap; }
.rb-check input { width: 14px; height: 14px; margin: 0; accent-color: #185abd; }
.rb-num { display: grid; grid-template-columns: 74px 54px auto 18px 18px; align-items: center; gap: 2px; height: 24px; font: 12px var(--font); color: var(--rb-ink); margin: 1px 6px 6px 2px; }
.rb-num input { height: 22px !important; padding: 0 4px !important; font-size: 12.5px !important; border-radius: 3px !important; border-color: var(--rb-line) !important; text-align: right; }
.rb-num em { font-style: normal; color: var(--rb-muted); padding: 0 2px; }
.rb-spin { width: 18px; height: 20px; border: 1px solid var(--rb-line); background: var(--surface); color: var(--rb-ink); border-radius: 3px; cursor: pointer; font: 13px/1 var(--font); padding: 0; }
.rb-spin:hover { background: var(--rb-hover); }
.rb-numcol { display: none; }
/* Galleria stili */
.rb-gallery { display: flex; align-items: stretch; height: 72px; border: 1px solid var(--rb-line); border-radius: 4px; background: var(--surface); overflow: hidden; }
.rb-gitems { display: flex; flex-wrap: wrap; align-content: flex-start; gap: 20px 2px; padding: 3px; overflow: hidden; height: 70px; max-width: clamp(176px, calc(100vw - 920px), 600px); }
.rb-style { height: 64px; }
.rb-style { display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; width: 82px; flex: none; padding: 6px 7px 4px; border: 1px solid transparent; border-radius: 3px; background: #fff; color: #000; cursor: pointer; text-align: left; }
.rb-style:hover { border-color: #a6c4ec; background: #f3f8fe; }
.rb-style.on { border-color: #185abd; box-shadow: inset 0 0 0 1px #185abd; }
.rb-sprev { display: block; width: 100%; white-space: nowrap; overflow: hidden; text-overflow: clip; line-height: 1.25; }
.rb-sname { font: 11px var(--font); color: #605e5c; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%; }
.rb-gmore { width: 18px; border: 0; border-left: 1px solid var(--rb-line); background: var(--rb-panel); color: var(--rb-ink); cursor: pointer; display: grid; place-items: center; }
.rb-gmore:hover { background: var(--rb-hover); }

/* Menu e pannelli a comparsa */
.rb-pop { position: fixed; z-index: 2500; background: var(--surface); color: var(--ink); border: 1px solid var(--rb-line); border-radius: 6px; box-shadow: 0 6px 18px rgba(0, 0, 0, .18); padding: 4px; max-height: calc(100vh - 20px); overflow: auto; animation: pop .1s ease-out; }
.rb-menu { min-width: 190px; display: flex; flex-direction: column; }
.rb-mi { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 10px 6px 8px; border: 0; background: none; border-radius: 4px; color: var(--ink); font: 13px var(--font); text-align: left; cursor: pointer; }
.rb-mi:hover { background: var(--rb-hover); }
.rb-mi.on { background: var(--rb-on); color: var(--rb-on-ink); }
.rb-mi:disabled { opacity: .45; cursor: default; }
.rb-mi .rb-ic { color: var(--rb-muted); }
.rb-mi-check { width: 18px; text-align: center; color: #185abd; font-weight: 700; flex: none; }
.rb-mi-t { flex: 1; min-width: 0; display: grid; }
.rb-mi-t small { color: var(--muted); font-size: 11.5px; }
.rb-mi kbd { font: 11.5px var(--font); color: var(--muted); }
.rb-mswatch { width: 16px; height: 16px; border-radius: 3px; border: 1px solid rgba(0, 0, 0, .2); flex: none; }
.rb-mswatch.none { background: linear-gradient(135deg, #fff 45%, #d13438 45%, #d13438 55%, #fff 55%); }
.rb-sep { height: 1px; background: var(--rb-line); margin: 4px 2px; }
.rb-mhead { font: 600 11.5px var(--font); color: var(--muted); padding: 6px 10px 4px; text-transform: uppercase; letter-spacing: .03em; }
.rb-colors { width: 232px; padding: 4px; }
.rb-chead { font: 600 12px var(--font); color: var(--rb-muted); margin: 8px 2px 4px; }
.rb-grid { display: grid; grid-template-columns: repeat(10, 18px); gap: 4px 4px; }
.rb-grid.hl { grid-template-columns: repeat(5, 30px); gap: 6px; margin: 4px 2px 8px; }
.rb-sw { width: 18px; height: 18px; border: 1px solid rgba(0, 0, 0, .18); border-radius: 2px; padding: 0; cursor: pointer; }
.rb-sw.big { width: 30px; height: 22px; }
.rb-sw:hover { outline: 2px solid #185abd; outline-offset: 1px; }
.rb-auto { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: none; padding: 6px 4px; font: 13px var(--font); color: var(--ink); border-radius: 4px; cursor: pointer; }
.rb-auto:hover, .rb-more:hover { background: var(--rb-hover); }
.rb-more { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; padding: 6px 4px; font: 13px var(--font); border-radius: 4px; cursor: pointer; }
.rb-more input { width: 28px; height: 22px; padding: 0; border: 0; background: none; }
.rb-tablegrid { padding: 6px; }
.rb-tg { display: grid; grid-template-columns: repeat(10, 18px); gap: 3px; margin: 4px 0 6px; }
.rb-tg span { width: 18px; height: 18px; border: 1px solid #c8c6c4; background: #fff; border-radius: 1px; cursor: pointer; }
.rb-tg span.on { border-color: #185abd; background: #cfe0f7; }

/* Righello */
.ruler { position: relative; height: 22px; flex: none; background: var(--page-bg); border-bottom: 1px solid var(--rb-line); overflow: hidden; user-select: none; }
.rl-track { position: absolute; inset: 0; }
.rl-page { position: absolute; top: 3px; bottom: 3px; background: #fff; border: 1px solid #c8c6c4; border-radius: 1px; }
.rl-marg { position: absolute; top: 0; bottom: 0; background: #d2d0ce; }
.rl-marg.l { left: 0; } .rl-marg.r { right: 0; }
.rl-ticks { position: absolute; inset: 0; pointer-events: none; }
.rl-t { position: absolute; bottom: 5px; width: 1px; height: 3px; background: #605e5c; }
.rl-t.half { height: 6px; bottom: 4px; }
.rl-n { position: absolute; top: 1px; transform: translateX(-50%); font: 9.5px/14px Arial, sans-serif; color: #444; }
.rl-h { position: absolute; width: 0; height: 0; transform: translateX(-5px); cursor: ew-resize; z-index: 2; }
.rl-h::before { content: ''; position: absolute; }
.rl-first { top: -1px; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 7px solid #5c6670; }
.rl-hang { top: 7px; border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 7px solid #5c6670; }
.rl-left { top: 14px; width: 10px; height: 5px; background: #5c6670; transform: translateX(-5px); }
.rl-right { top: 7px; border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 7px solid #5c6670; }
.rl-h:hover { filter: brightness(1.5); }
.rl-edge { position: absolute; top: 0; bottom: 0; width: 8px; cursor: col-resize; z-index: 1; }
.rl-guide { position: fixed; top: 0; bottom: 0; width: 0; border-left: 1px dashed #185abd; z-index: 2000; pointer-events: none; }
.rl-tip { position: fixed; z-index: 2001; background: #252423; color: #fff; font: 12px var(--font); padding: 3px 8px; border-radius: 4px; pointer-events: none; white-space: nowrap; }
.rl-dragging, .rl-dragging * { cursor: ew-resize !important; }
.rl-dragging iframe { pointer-events: none; }

/* Barra di stato */
.statusbar { display: flex; align-items: center; gap: 2px; height: 26px; padding: 0 8px; background: var(--sb-bg); color: var(--rb-muted); border-top: 1px solid var(--rb-line); font: 12px var(--font); flex: none; user-select: none; }
.sb-item { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border: 0; background: none; color: inherit; font: inherit; border-radius: 3px; cursor: pointer; white-space: nowrap; }
.sb-item:hover { background: var(--rb-hover); color: var(--rb-ink); }
.sb-item.on { color: #a4262c; font-weight: 600; }
.sb-static { cursor: default; }
.sb-static:hover { background: none; color: inherit; }
.sb-fill { flex: 1; }
.sb-icon { display: grid; place-items: center; width: 26px; height: 22px; border: 0; background: none; color: inherit; border-radius: 3px; cursor: pointer; font: 15px/1 var(--font); }
.sb-icon:hover { background: var(--rb-hover); color: var(--rb-ink); }
.sb-icon.on { background: var(--rb-on); color: var(--rb-on-ink); }
.sb-zoom { display: inline-flex; align-items: center; gap: 2px; margin-left: 8px; }
.sb-zoom input[type=range] { width: 110px; height: 4px; padding: 0; accent-color: #605e5c; border: 0; background: none; }
.sb-zv { min-width: 46px; justify-content: flex-end; }

/* Menu File (backstage) */
.bs { position: fixed; inset: 0; z-index: 2200; display: flex; background: var(--surface); color: var(--ink); animation: fade .12s; }
.bs-nav { width: 220px; flex: none; display: flex; flex-direction: column; background: #185abd; color: #fff; padding: 8px 0; overflow: auto; }
:root[data-theme="dark"] .bs-nav { background: #1f1f1f; }
.bs-back { border: 0; background: none; color: #fff; width: 44px; height: 44px; margin: 0 0 8px 8px; border-radius: 50%; cursor: pointer; display: grid; place-items: center; }
.bs-back:hover { background: rgba(255, 255, 255, .15); }
.bs-item { display: flex; align-items: center; gap: 12px; border: 0; background: none; color: #fff; font: 14px var(--font); text-align: left; padding: 10px 22px; cursor: pointer; text-decoration: none !important; }
.bs-item:hover { background: rgba(255, 255, 255, .14); }
.bs-item.on { background: rgba(255, 255, 255, .22); font-weight: 600; }
.bs-fill { flex: 1; }
.bs-main { flex: 1; overflow: auto; padding: 36px 48px 60px; }
.bs-main h1 { font-size: 34px; font-weight: 400; margin-bottom: 18px; }
.bs-doc { font-size: 18px; font-weight: 500; color: var(--muted); margin: -8px 0 24px; }
.bs-cols { display: grid; grid-template-columns: minmax(280px, 520px) minmax(260px, 380px); gap: 40px; align-items: start; }
.bs-actions, .bs-list { display: grid; gap: 10px; max-width: 560px; }
.bs-card { display: flex; align-items: center; gap: 16px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); text-align: left; cursor: pointer; font: inherit; }
.bs-card:hover { background: var(--rb-hover); border-color: var(--line-strong); }
.bs-card .rb-ic { color: #185abd; }
.bs-card span { display: grid; gap: 2px; }
.bs-card small { color: var(--muted); font-size: 13px; }
.bs-props h3 { margin-top: 0; }
.bs-props table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.bs-props td { padding: 6px 0; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.bs-props td:first-child { color: var(--muted); width: 46%; padding-right: 12px; }
.bs-tpls { display: flex; flex-wrap: wrap; gap: 20px; }
.bs-tpl { border: 0; background: none; padding: 0; cursor: pointer; display: grid; gap: 8px; color: var(--ink); font: 13.5px var(--font); text-align: left; }
.bs-tpage { width: 150px; height: 194px; border: 1px solid var(--line); background: #fff; border-radius: 4px; overflow: hidden; position: relative; display: grid; place-items: center; }
.bs-tpage .rb-ic { color: #185abd; }
.bs-tpl:hover .bs-tpage { border-color: #185abd; box-shadow: 0 0 0 1px #185abd; }
.bs-tin { position: absolute; top: 0; left: 0; width: 720px; padding: 60px 64px; transform: scale(.208); transform-origin: 0 0; font: 11pt/1.4 Arial, sans-serif; color: #202124; text-align: left; pointer-events: none; }
.bs-recent { display: grid; gap: 4px; max-width: 640px; }
.bs-rec { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 6px; color: var(--ink); text-decoration: none !important; }
.bs-rec:hover { background: var(--rb-hover); }
.bs-rec .rb-ic { color: #185abd; }
.bs-rec span { display: grid; }
.bs-rec small { color: var(--muted); }
.wc-table { width: 100%; border-collapse: collapse; font-size: 14px; margin-bottom: 8px; }
.wc-table td { padding: 6px 0; border-bottom: 1px solid var(--line-2); }
.wc-table td:last-child { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

/* Layout e modalità */
.ed-main { display: flex; flex-direction: column; }
.focus-mode .ribbon, .focus-mode .statusbar, .focus-mode .ruler { display: none !important; }
.layout-web .ruler { display: none !important; }
.editor-page .outline, .editor-page .cpanel { background: var(--rb-panel); }

@media (max-width: 900px) {
  .wd-search { display: none; }
  .qat { border-right: 0; }
  .qat .rb-btn:first-child { display: none; }
  .rb-panel-tab { height: 92px; }
  .rb-gitems { max-width: 260px; }
  .sb-zoom input[type=range], [data-sb=read], [data-sb=web], [data-sb=focus], .sb-static { display: none; }
  .bs-nav { width: 64px; }
  .bs-item span { display: none; }
  .bs-main { padding: 24px 16px; }
  .bs-cols { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .wd-title { padding: 4px 6px; gap: 4px; }
  .wd-title .ed-title { max-width: 32vw; }
  .wd-title .save-status, #historyBtn, #focusBtn { display: none; }
  [data-sb=track] { display: none; }
}

/* Filigrana nella vista di lettura e in stampa */
.view-wrap { position: relative; }
.watermark { position: absolute; top: 50vh; left: 50%; transform: translate(-50%, -50%) rotate(-40deg); font: 700 96px/1 Arial, sans-serif; letter-spacing: .06em; color: rgba(128, 128, 128, .16); white-space: nowrap; pointer-events: none; user-select: none; z-index: 1; }
@media print {
  .watermark { position: fixed; top: 50%; color: rgba(128, 128, 128, .18); -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* =====================================================================
   Versione 1.3 – Google Drive e OneDrive
   ===================================================================== */
.cl-logo { flex: none; display: block; }
.cloud-btn { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border: 0; border-radius: 15px; background: rgba(255, 255, 255, .92); color: #252423; font: 12.5px var(--font); cursor: pointer; white-space: nowrap; max-width: 260px; }
.cloud-btn span { overflow: hidden; text-overflow: ellipsis; }
.cloud-btn:hover { background: #fff; }
.cloud-btn.pending span, .cloud-btn.auth span { color: #8a5300; }
.cloud-btn.syncing .cl-logo { animation: pulse 1s ease-in-out infinite; }
.cloud-btn.error span { color: #a4262c; }
.cloud-btn.synced::after { content: '✓'; color: #107c10; font-weight: 700; }
@keyframes pulse { 50% { opacity: .35; } }
:root[data-theme="dark"] .cloud-btn { background: #3a3a3a; color: #f3f3f3; }
.bs-card.off { opacity: .6; cursor: default; }
.bs-card.off:hover { background: var(--surface); border-color: var(--line); }
.bs-card .cl-logo { margin: 0 2px; }
.bs-card small a { color: var(--brand); }
.bs-linked { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; max-width: 560px; padding: 14px 16px; margin-bottom: 18px; border-radius: 8px; background: var(--ok-soft); border: 1px solid #c4e5cf; }
.bs-linked > div { flex: 1; min-width: 200px; display: grid; }
.bs-linked small { color: var(--muted); }
.bs-note { max-width: 560px; font-size: 13px; margin-top: 14px; }
.bs-cloudopen { margin-bottom: 18px; }
.side-logo { display: inline-flex; width: 20px; justify-content: center; }
.side-action[data-off] { opacity: .6; }
.cloud-pill { display: inline-flex; align-items: center; margin-left: 4px; }
.cloud-pill .cl-logo { width: 13px; height: 13px; }
/* Finestra OneDrive */
.cb-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-bottom: 8px; font-size: 14px; }
.cb-crumbs button { border: 0; background: none; color: var(--brand); padding: 2px 4px; border-radius: 4px; cursor: pointer; font: inherit; }
.cb-crumbs button:last-child { color: var(--ink); font-weight: 600; }
.cb-crumbs span { color: var(--muted); }
.cb-list { border: 1px solid var(--line); border-radius: 8px; height: 300px; overflow: auto; padding: 4px; }
.cb-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: 6px; font: 14px var(--font); color: var(--ink); text-align: left; cursor: pointer; }
.cb-item:hover { background: var(--hover-2); }
.cb-item .cb-n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cb-item small { color: var(--muted); font-size: 12px; }
.cb-empty { padding: 20px; text-align: center; }
.cb-actions { align-items: center; flex-wrap: wrap; }
.cb-newname { width: 160px !important; height: 36px !important; }
.cb-fill { flex: 1; }
.cb-acc { font-size: 12px; margin: 8px 0 0; }
/* Pannello amministrazione */
.cloud-state { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 14px; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 13px; background: var(--soft); color: var(--muted); }
.pill.on { background: var(--ok-soft); color: var(--ok); font-weight: 600; }
details.guide { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; background: var(--soft-2); }
details.guide summary { cursor: pointer; font-weight: 600; font-size: 14px; }
details.guide ol { margin: 10px 0 2px; padding-left: 20px; font-size: 14px; display: grid; gap: 6px; }
details.guide code { word-break: break-all; }
@media (max-width: 560px) { .cloud-btn span { display: none; } .cloud-btn { padding: 0 8px; } }

.modal-wrap { z-index: 2300; }

/* ===== 1.4: formati di esportazione, amici e chat ===== */
.fmt-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.fmt-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 8px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--ink); font: 14px var(--font); cursor: pointer;
}
.fmt-btn:hover { border-color: var(--brand); background: var(--brand-soft); }
.fmt-btn small { color: var(--muted); font-size: 12px; }
.fmt-ext { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 52px; border-radius: 4px 12px 4px 4px; color: #fff; font: 700 11px var(--font); letter-spacing: .03em; background: #687079; margin-bottom: 4px; }
.fmt-docx { background: #185abd; } .fmt-pdf { background: #d93025; } .fmt-odt { background: #2a7ab0; } .fmt-rtf { background: #5f6368; }
.fmt-md { background: #24292f; } .fmt-epub { background: #7cb342; } .fmt-html { background: #e37400; } .fmt-txt { background: #80868b; }
@media (max-width: 560px) { .fmt-grid { grid-template-columns: repeat(2, 1fr); } }
.bs-fmt { display: flex; align-items: center; gap: 12px; margin: 0 0 14px; font-weight: 600; }
.bs-fmt select { height: 36px; border: 1px solid var(--input-border); border-radius: 6px; padding: 0 10px; font: 14px var(--font); background: var(--surface); color: var(--ink); min-width: 220px; }
.share-friends { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: -4px 0 14px; }
.share-friends small { color: var(--muted); margin-right: 2px; }
.chip { border: 1px solid var(--line); background: var(--soft-2); color: var(--ink); border-radius: 16px; padding: 3px 12px; font: 13px var(--font); cursor: pointer; }
.chip:hover { border-color: var(--brand); color: var(--brand); }

/* Pulsante della chat */
.chat-btn.on { background: var(--hover); }
.chat-btn.pulse { animation: chatPulse .9s ease-out 2; }
@keyframes chatPulse { 40% { transform: scale(1.18); } }

/* Pannello */
.chat-panel {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 1900; width: 400px; max-width: 100vw; display: flex; flex-direction: column;
  background: var(--surface); color: var(--ink); border-left: 1px solid var(--line); box-shadow: var(--shadow-lg);
  transform: translateX(105%); transition: transform .18s ease-out; visibility: hidden;
}
.chat-panel.open { transform: none; visibility: visible; }
.cp-head { display: flex; align-items: center; gap: 4px; padding: 10px 8px 10px 14px; border-bottom: 1px solid var(--line-2); min-height: 60px; }
.cp-head .icon-btn { width: 38px; height: 38px; color: var(--ink-2); flex: none; }
.cp-title { flex: 1; min-width: 0; padding-left: 4px; }
.cp-title strong { display: block; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cp-title small { display: block; color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cp-tabs { display: flex; border-bottom: 1px solid var(--line-2); padding: 0 8px; }
.cp-tabs button { flex: 1; border: 0; background: none; padding: 10px 6px 9px; font: 600 14px var(--font); color: var(--muted); border-bottom: 3px solid transparent; cursor: pointer; }
.cp-tabs button.on { color: var(--brand); border-bottom-color: var(--brand); }
.cp-tab-badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; line-height: 18px; margin-left: 4px; }
.cp-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 8px 0; }
.cp-empty { color: var(--muted); text-align: center; padding: 24px 16px; margin: 0; }
.cp-hint { color: var(--muted); font-size: 13.5px; padding: 4px 16px; margin: 6px 0; }
.cp-actions { display: flex; gap: 8px; padding: 6px 14px 10px; }
.cp-actions .btn { flex: 1; justify-content: center; gap: 6px; }
.cp-hello { text-align: center; padding: 24px 28px; color: var(--muted); }
.cp-hello .ic { color: var(--brand); }
.cp-hello p { margin: 6px 0; } .cp-hello strong { color: var(--ink); }
.cp-hello .btn { margin-top: 10px; }
.cp-list, .cp-people, .cp-pick, .cp-docs { list-style: none; margin: 0; padding: 0; }
.cp-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 16px; border: 0; background: none; text-align: left; font: 14px var(--font); color: var(--ink); cursor: pointer; }
.cp-row:hover { background: var(--hover-2); }
.cp-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cp-row-top, .cp-row-sub { display: flex; align-items: center; gap: 8px; }
.cp-row-top strong { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.cp-row-top small { color: var(--muted); font-size: 12px; flex: none; }
.cp-row-sub span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); font-size: 13px; }
.cp-row.unread strong, .cp-row.unread .cp-row-sub span { font-weight: 700; color: var(--ink); }
.cp-unread { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--brand); color: #fff; font: 700 11.5px/20px var(--font); text-align: center; }
.cp-av { position: relative; flex: none; display: inline-flex; }
.cp-on { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border-radius: 50%; background: #1e8e3e; border: 2px solid var(--surface); }
.cp-av2 { position: relative; display: inline-block; }
.cp-av2 .avatar { position: absolute; border: 2px solid var(--surface); box-sizing: content-box; }
.cp-av2 .avatar:first-child { left: 0; top: 0; } .cp-av2 .avatar:last-child { right: -2px; bottom: -2px; }
.cp-search { display: flex; align-items: center; gap: 8px; margin: 4px 14px 8px; padding: 0 12px; border: 1px solid var(--input-border); border-radius: 22px; background: var(--soft-2); color: var(--muted); }
.cp-search input { flex: 1; border: 0; background: none; height: 38px; font: 14px var(--font); color: var(--ink); outline: none; }
.cp-search input:focus-visible { outline: none; }
.cp-search:focus-within { border-color: var(--brand); background: var(--surface); }
.cp-body h4 { margin: 14px 16px 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.cp-person { display: flex; align-items: center; gap: 12px; padding: 7px 14px 7px 16px; }
.cp-person:hover { background: var(--soft-2); }
.cp-person .cp-row-main strong { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cp-person .cp-row-main small { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cp-person-act { display: flex; align-items: center; gap: 6px; flex: none; }
.cp-person-act .icon-btn { width: 32px; height: 32px; }
.cp-person-act .btn .ic { margin-right: 2px; }
.cp-tag { font-size: 12px; color: var(--muted); background: var(--soft); border-radius: 12px; padding: 3px 9px; white-space: nowrap; }
.cp-pop { position: fixed; z-index: 2400; right: auto; top: 0; }

/* Conversazione */
.cp-msgs { padding: 4px 12px 10px; display: flex; flex-direction: column; }
.cm-day { text-align: center; margin: 12px 0 6px; }
.cm-day span { font-size: 12px; color: var(--muted); background: var(--soft); border-radius: 10px; padding: 3px 10px; }
.cm-sys { align-self: center; text-align: center; font-size: 12.5px; color: var(--muted); margin: 6px 20px; }
.cm { display: flex; align-items: flex-end; gap: 6px; margin-top: 8px; max-width: 100%; position: relative; }
.cm.cm-cont { margin-top: 2px; }
.cm-mine { flex-direction: row-reverse; }
.cm .avatar, .cm-avsp { flex: none; width: 28px; }
.cm-bubble { max-width: 78%; padding: 7px 11px 5px; border-radius: 16px; background: var(--soft); color: var(--ink); overflow-wrap: anywhere; position: relative; }
.cm-mine .cm-bubble { background: var(--brand); color: #fff; border-bottom-right-radius: 5px; }
.cm-other .cm-bubble { border-bottom-left-radius: 5px; }
.cm-mine.cm-cont .cm-bubble { border-top-right-radius: 5px; }
.cm-other.cm-cont .cm-bubble { border-top-left-radius: 5px; }
.cm-name { font-size: 12px; font-weight: 700; margin-bottom: 1px; }
.cm-text { font-size: 14.5px; line-height: 1.4; white-space: normal; }
.cm-mine .cm-text a { color: #fff; text-decoration: underline; }
.cm-deleted { font-style: italic; opacity: .75; }
.cm-time { display: block; text-align: right; font-size: 11px; opacity: .7; margin-top: 1px; }
.cm-tools { display: none; gap: 2px; align-self: center; }
.cm:hover .cm-tools, .cm:focus-within .cm-tools { display: flex; }
.cm-tools button { border: 0; background: none; color: var(--muted); width: 26px; height: 26px; border-radius: 13px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.cm-tools button:hover { background: var(--hover); color: var(--ink); }
.cm-seen { align-self: flex-end; font-size: 11.5px; color: var(--muted); margin: 2px 4px 0; }
.cm-doc { display: flex; align-items: center; gap: 10px; background: var(--surface); color: var(--ink); border-radius: 10px; padding: 9px 10px; margin: 3px 0 2px; min-width: 230px; border: 1px solid var(--line-2); }
.cm-doc > .ic { color: #185abd; flex: none; }
.cm-doc-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cm-doc .cp-tag { flex: none; }
.cm-doc strong { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cm-doc small { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 3px; }
.cm-doc .btn { flex: none; }
.cm-doc.off { opacity: .7; }
.cp-typing { padding: 4px 18px; font-size: 12.5px; color: var(--muted); font-style: italic; min-height: 24px; }
.cp-typing.cp-blocked { font-style: normal; background: var(--warn-soft); color: var(--warn); padding: 8px 16px; }
.cp-compose { display: flex; align-items: flex-end; gap: 4px; padding: 8px 8px 10px; border-top: 1px solid var(--line-2); }
.cp-compose textarea {
  flex: 1; resize: none; border: 1px solid var(--input-border); border-radius: 20px; padding: 9px 14px; font: 14.5px/1.35 var(--font);
  background: var(--soft-2); color: var(--ink); max-height: 140px; min-height: 40px; outline: none;
}
.cp-compose textarea:focus, .cp-compose textarea:focus-visible { border-color: var(--brand); background: var(--surface); outline: none; }
.cp-compose .icon-btn { width: 40px; height: 40px; color: var(--muted); flex: none; }
.cp-compose .cp-send { color: var(--brand); }
.cp-pick li label { display: flex; align-items: center; gap: 10px; padding: 7px 4px; border-radius: 8px; cursor: pointer; }
.cp-pick li label:hover { background: var(--hover-2); }
.cp-pick li span { flex: 1; display: flex; flex-direction: column; }
.cp-pick small, .cp-docs small { color: var(--muted); font-size: 12.5px; }
.cp-pick { max-height: 46vh; overflow: auto; margin: 8px 0; }
.cp-filter, .cp-gname input, .cp-grant select {
  width: 100%; height: 38px; border: 1px solid var(--input-border); border-radius: 8px; padding: 0 10px; font: 14px var(--font); background: var(--surface); color: var(--ink);
}
.cp-gname, .cp-grant { display: block; font-size: 13.5px; font-weight: 600; margin: 4px 0 10px; }
.cp-gname input, .cp-grant select { margin-top: 4px; font-weight: 400; }
.cp-grant.off { opacity: .55; }
.cp-docs { max-height: 40vh; overflow: auto; margin: 0 0 12px; border: 1px solid var(--line-2); border-radius: 10px; }
.cp-docs label { display: flex; align-items: center; gap: 10px; padding: 9px 12px; cursor: pointer; border-bottom: 1px solid var(--line-2); }
.cp-docs li:last-child label { border-bottom: 0; }
.cp-docs label:hover { background: var(--hover-2); }
.cp-docs .ic { color: #185abd; flex: none; }
.cp-docs span { display: flex; flex-direction: column; min-width: 0; }
.cp-docs strong { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 560px) {
  .chat-panel { width: 100vw; border-left: 0; }
  .cm-bubble { max-width: 85%; }
}
@media print { .chat-panel { display: none !important; } }

/* Piè di pagina con autore */
.app-footer { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; padding: 18px 16px 22px; color: var(--muted); font-size: 12.5px; border-top: 1px solid var(--line-2); background: var(--bg); }
.app-footer strong { color: var(--ink-2); }
.auth-page { flex-direction: column; }
.auth-page .app-footer { border-top: 0; background: none; padding: 14px 16px 0; }
.sb-credit { color: var(--rb-muted); opacity: .85; }
@media (max-width: 900px) { .sb-credit { display: none; } }
@media print { .app-footer { display: none !important; } }

/* ===== 1.5: pagine di accesso ===== */
.auth-page { display: block; padding: 0; min-height: 100vh; }
.auth-shell { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); min-height: 100vh; }
.auth-side { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 24px 16px; }
.auth-side .auth-card { box-shadow: 0 20px 60px rgba(16, 24, 40, .12), 0 2px 8px rgba(16, 24, 40, .06); animation: cardIn .5s cubic-bezier(.2, .8, .2, 1); }
@keyframes cardIn { from { opacity: 0; transform: translateY(14px) scale(.985); } }
.auth-card h1 { font-size: 28px; letter-spacing: -.02em; margin-bottom: 4px; }

/* Pannello stellato */
.auth-hero {
  position: relative; overflow: hidden; color: #fff; display: flex; align-items: center; padding: 56px clamp(28px, 5vw, 72px);
  background: radial-gradient(1200px 700px at 15% 0%, #3b2a8f 0%, transparent 55%), radial-gradient(900px 600px at 100% 100%, #0f6bff 0%, transparent 55%),
    linear-gradient(160deg, #070b1f 0%, #10164a 45%, #1d0f45 100%);
}
.ah-stars, .ah-stars2 {
  position: absolute; inset: -50%; background-repeat: repeat; pointer-events: none;
  background-image: radial-gradient(1.2px 1.2px at 20px 30px, #fff 50%, transparent 51%), radial-gradient(1px 1px at 120px 80px, rgba(255,255,255,.8) 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 200px 150px, #cfe0ff 50%, transparent 51%), radial-gradient(1px 1px at 60px 190px, rgba(255,255,255,.7) 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 260px 40px, #fff 50%, transparent 51%), radial-gradient(.8px .8px at 160px 230px, rgba(255,255,255,.6) 50%, transparent 51%);
  background-size: 300px 260px; animation: drift 120s linear infinite; opacity: .9;
}
.ah-stars2 { background-size: 420px 380px; animation-duration: 200s; animation-direction: reverse; opacity: .55; filter: blur(.3px); }
@keyframes drift { to { transform: translate3d(300px, 260px, 0); } }
.ah-orb { position: absolute; width: 520px; height: 520px; right: -180px; top: -160px; border-radius: 50%; filter: blur(10px);
  background: radial-gradient(circle at 35% 35%, rgba(124, 77, 255, .85), rgba(37, 87, 214, .35) 45%, transparent 70%); animation: orb 14s ease-in-out infinite alternate; }
.ah-orb2 { width: 380px; height: 380px; left: -140px; bottom: -150px; right: auto; top: auto;
  background: radial-gradient(circle at 60% 40%, rgba(0, 200, 255, .55), rgba(37, 87, 214, .25) 50%, transparent 72%); animation-duration: 18s; }
@keyframes orb { to { transform: translate(-40px, 30px) scale(1.08); } }
.ah-content { position: relative; z-index: 1; max-width: 560px; }
.ah-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 20px; letter-spacing: .01em; margin-bottom: 34px; }
.ah-brand svg rect:first-child { fill: #fff; } .ah-brand svg path { fill: #c9d6ff; } .ah-brand svg rect:not(:first-child) { fill: #2557d6; }
.auth-hero h2 { font-size: clamp(32px, 3.6vw, 50px); line-height: 1.06; letter-spacing: -.03em; margin: 0 0 16px; font-weight: 800; }
.auth-hero h2 span { background: linear-gradient(90deg, #8fb4ff, #c49bff 50%, #7ee0ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-hero > .ah-content > p { font-size: 16.5px; line-height: 1.55; color: rgba(255, 255, 255, .78); margin: 0 0 30px; max-width: 470px; }
.ah-stage { position: relative; height: 270px; margin: 0 0 26px; }
.ah-page { position: absolute; left: 4%; top: 6px; width: 62%; height: 250px; background: #fff; border-radius: 10px; padding: 22px 22px; box-shadow: 0 30px 80px rgba(0, 0, 0, .45);
  transform: rotate(-4deg); animation: floaty 7s ease-in-out infinite; }
@keyframes floaty { 50% { transform: rotate(-3deg) translateY(-8px); } }
.ah-h { height: 14px; width: 55%; border-radius: 4px; background: #1f2328; margin-bottom: 16px; }
.ah-l { height: 8px; border-radius: 4px; background: #e3e7ee; margin: 0 0 11px; width: var(--w); }
.ah-typing { background: linear-gradient(90deg, #c8d6ff, #c8d6ff) no-repeat, #e3e7ee; background-size: 0 100%; animation: typing 4.5s steps(24) infinite; }
@keyframes typing { 0% { background-size: 0 100%; } 60%, 100% { background-size: 100% 100%; } }
.ah-cursor { position: absolute; left: 63%; top: 86px; animation: cursorMove 4.5s steps(24) infinite; }
.ah-cursor i { display: block; width: 2px; height: 16px; background: #e8453c; animation: blink 1s step-end infinite; }
.ah-cursor b { position: absolute; left: 0; top: -17px; background: #e8453c; color: #fff; font: 600 10px/1 var(--font); padding: 3px 5px; border-radius: 3px 3px 3px 0; }
@keyframes cursorMove { 0% { transform: translateX(-120px); } 60%, 100% { transform: translateX(0); } }
@keyframes blink { 50% { opacity: 0; } }
.ah-squiggle { position: absolute; left: 22px; top: 162px; width: 70px; height: 6px;
  background: radial-gradient(circle at 3px -1px, transparent 3px, #e8453c 3.5px, transparent 4px) 0 0 / 6px 6px repeat-x; opacity: .9; }
.ah-bubble { position: absolute; right: 2%; top: 26px; max-width: 220px; background: linear-gradient(135deg, #2557d6, #7c4dff); color: #fff; font-size: 13.5px;
  padding: 10px 14px; border-radius: 16px 16px 4px 16px; box-shadow: 0 14px 34px rgba(0, 0, 0, .35); animation: pop2 7s ease-in-out infinite; }
@keyframes pop2 { 0%, 8% { opacity: 0; transform: translateY(10px) scale(.95); } 14%, 80% { opacity: 1; transform: none; } 92%, 100% { opacity: 0; transform: translateY(-6px); } }
.ah-chip { position: absolute; background: rgba(16, 20, 58, .62); border: 1px solid rgba(255, 255, 255, .22); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  color: #fff; font-size: 12.5px; padding: 7px 12px; border-radius: 20px; white-space: nowrap; display: inline-flex; align-items: center; gap: 7px; }
.ah-chip1 { right: 8%; top: 118px; animation: floaty2 8s ease-in-out infinite; }
.ah-chip2 { right: 0; top: 172px; animation: floaty2 9s ease-in-out -2s infinite; }
.ah-chip3 { left: 0; bottom: -6px; animation: floaty2 7.5s ease-in-out -4s infinite; }
@keyframes floaty2 { 50% { transform: translateY(-7px); } }
.ah-dot { width: 8px; height: 8px; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 0 rgba(52, 211, 153, .6); animation: ping 1.8s infinite; }
@keyframes ping { 70% { box-shadow: 0 0 0 8px rgba(52, 211, 153, 0); } 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); } }
.ah-feats { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; color: rgba(255, 255, 255, .85); font-size: 14.5px; }
.ah-feats li { display: flex; align-items: center; gap: 10px; }
.ah-feats li::before { content: "✓"; display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: rgba(126, 224, 255, .18); color: #7ee0ff; font-size: 12px; font-weight: 700; flex: none; }
@media (prefers-reduced-motion: reduce) { .auth-hero *, .auth-side .auth-card { animation: none !important; } }
@media (max-width: 960px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-hero { padding: 26px 22px 24px; min-height: 0; }
  .ah-stage, .ah-feats, .auth-hero > .ah-content > p { display: none; }
  .ah-brand { margin: 0 0 8px; }
  .auth-hero h2 { font-size: 26px; margin: 0; }
  .auth-hero h2 br { display: none; }
  .auth-side { padding: 22px 14px 10px; justify-content: flex-start; }
}

/* Moduli di accesso */
.social { display: grid; gap: 10px; margin: 4px 0 0; }
.social.busy { opacity: .6; pointer-events: none; }
.social-btn { height: 44px; justify-content: center; gap: 10px; font-weight: 600; font-size: 14.5px; border-radius: 10px; width: 100%; }
.g-holder { display: flex; justify-content: center; min-height: 44px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; margin: 18px 0 6px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 44px !important; width: 100%; }
.pw-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border: 0; background: none; color: var(--muted); border-radius: 8px; cursor: pointer; display: grid; place-items: center; }
.pw-eye:hover { background: var(--hover); color: var(--ink); }
.pw-eye.on { color: var(--brand); }
.pw-meter { display: block; margin-top: 6px; }
.pw-meter i { display: block; height: 4px; width: 0; border-radius: 2px; background: #d93025; transition: width .25s, background .25s; }
.pw-meter small { display: block; margin-top: 4px; color: var(--muted); font-weight: 400; }
.pw-meter.s1 i { background: #e8710a; } .pw-meter.s2 i { background: #f9ab00; } .pw-meter.s3 i { background: #34a853; } .pw-meter.s4 i { background: linear-gradient(90deg, #34a853, #00bfa5); }
.caps { display: block; color: var(--warn); font-weight: 500; margin-top: 4px; }
.form-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 14px; margin: -2px 0 4px; }
.form-row .check { margin: 0; }
.code-input { font: 600 24px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace !important; letter-spacing: .18em; text-align: center; height: 56px !important; }
.btn.busy { position: relative; color: transparent !important; }
.btn.busy::after { content: ""; position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px; border: 2px solid rgba(255, 255, 255, .5); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.sent-art { display: grid; place-items: center; margin: 6px 0 14px; }
.sent-art span { width: 68px; height: 68px; border-radius: 50%; display: grid; place-items: center; font-size: 30px; color: #fff; background: linear-gradient(135deg, #2557d6, #7c4dff); box-shadow: 0 10px 30px rgba(37, 87, 214, .35); animation: floaty2 3s ease-in-out infinite; }
.link-btn { border: 0; background: none; color: var(--brand); font: inherit; cursor: pointer; padding: 0; }
.auth-page .app-footer { padding: 18px 16px 6px; }
.auth-page > .auth-card { margin: 48px auto 16px; }
@media (max-width: 960px) { .auth-shell .auth-card .auth-logo { display: none; } .auth-shell .auth-card h1 { margin-top: 0; } }

/* Profilo: sicurezza e dizionario */
.sec-row { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.sec-row form { margin: 0; flex: none; }
.sec-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--soft); color: var(--muted); flex: none; font-size: 18px; }
.sec-ic.ok { background: var(--ok-soft); color: var(--ok); } .sec-ic.warn { background: var(--warn-soft); color: var(--warn); }
.sec-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sec-main small { color: var(--muted); font-size: 13px; }
#sicurezza h3 { margin: 22px 0 4px; font-size: 15px; }
.totp-setup { display: grid; grid-template-columns: 190px 1fr; gap: 6px 22px; align-items: start; background: var(--soft-2); border: 1px solid var(--line-2); border-radius: 12px; padding: 16px 18px; margin: 10px 0; }
.totp-setup ol { grid-column: 1 / -1; margin: 0 0 8px; padding-left: 20px; font-size: 14px; line-height: 1.6; }
.totp-qr { grid-row: span 2; background: #fff; border-radius: 10px; padding: 6px; width: 180px; height: 180px; }
.totp-qr svg { width: 100%; height: 100%; display: block; }
.totp-key { font-size: 13px; letter-spacing: .06em; background: var(--surface); border: 1px dashed var(--line-strong); border-radius: 8px; padding: 8px 10px; word-break: break-all; }
.totp-form { margin: 0; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.codes-box { background: var(--warn-soft); border: 1px solid rgba(138, 83, 0, .25); border-radius: 12px; padding: 14px 18px; margin: 10px 0; }
.codes-box p { margin: 6px 0 10px; font-size: 14px; }
.codes { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; margin-bottom: 12px; }
.codes code { background: var(--surface); border-radius: 6px; padding: 6px 10px; font-size: 14.5px; text-align: center; letter-spacing: .05em; }
.sec-more { margin: 8px 0 0; font-size: 14px; }
.sec-more summary { cursor: pointer; color: var(--brand); }
.inline-form { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; margin: 10px 0 0; }
.inline-form label { margin: 0; flex: 1; min-width: 160px; }
.link-social { max-width: 340px; margin: 10px 0 0; }
.link-social .or { display: none; }
.devices { list-style: none; margin: 4px 0 12px; padding: 0; }
.devices li { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line-2); }
.devices li > span:nth-child(2) { flex: 1; display: flex; flex-direction: column; }
.devices small { color: var(--muted); }
.devices form { margin: 0; }
.dev-ic { width: 34px; height: 34px; border-radius: 10px; background: var(--soft); display: grid; place-items: center; color: var(--muted); }
.pill { font-style: normal; font-size: 11px; background: var(--brand-soft); color: var(--brand); border-radius: 10px; padding: 1px 7px; margin-left: 4px; }
.dict-add { display: flex; gap: 8px; margin: 10px 0 12px; max-width: 420px; }
.dict-add input { flex: 1; height: 34px; border: 1px solid var(--input-border); border-radius: 8px; padding: 0 10px; font: 14px var(--font); background: var(--surface); color: var(--ink); }
.dict-words { display: flex; flex-wrap: wrap; gap: 6px; }
.dict-w { display: inline-flex; align-items: center; gap: 4px; background: var(--soft); border-radius: 14px; padding: 3px 4px 3px 11px; font-size: 13.5px; }
.dict-w button { border: 0; background: none; width: 20px; height: 20px; border-radius: 10px; cursor: pointer; color: var(--muted); font-size: 15px; line-height: 1; }
.dict-w button:hover { background: var(--hover); color: var(--danger); }
@media (max-width: 600px) { .totp-setup { grid-template-columns: 1fr; } .totp-qr { grid-row: auto; margin: 0 auto; } .sec-row { flex-wrap: wrap; } }
.row3 { display: grid; grid-template-columns: 2fr 1fr 1.4fr; gap: 12px; }
@media (max-width: 700px) { .row3 { grid-template-columns: 1fr; } }
.presets { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 6px; font-size: 13.5px; color: var(--muted); }
.small-note { font-size: 12.5px; margin-top: 10px; }
.warn-t { color: var(--warn); font-weight: 600; }

/* Correttore: pannello «Editor» e indicatore nella barra di stato */
.sb-proof.sb-bad { color: #c5221f; }
.sb-proof.sb-good { color: #188038; }
.sp-pane {
  position: fixed; right: 14px; top: 150px; bottom: 40px; width: 340px; max-width: calc(100vw - 28px); z-index: 1500; display: flex; flex-direction: column; gap: 12px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 14px 16px; overflow: auto;
  animation: spIn .18s ease-out;
}
@keyframes spIn { from { opacity: 0; transform: translateX(16px); } }
.sp-head { display: flex; align-items: center; justify-content: space-between; }
.sp-head strong { font-size: 17px; }
.sp-head .icon-btn { width: 32px; height: 32px; font-size: 15px; color: var(--muted); }
.sp-score { display: flex; align-items: center; gap: 12px; background: var(--soft-2); border-radius: 12px; padding: 10px 12px; }
.sp-score strong { display: block; } .sp-score small { color: var(--muted); font-size: 12.5px; }
.sp-ring { --p: 100; width: 52px; height: 52px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: conic-gradient(var(--brand) calc(var(--p) * 1%), var(--line-2) 0); }
.sp-ring span { width: 40px; height: 40px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font: 700 15px var(--font); }
.sp-lang { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted); }
.sp-lang select { flex: 1; height: 32px; border: 1px solid var(--input-border); border-radius: 6px; background: var(--surface); color: var(--ink); font: 13.5px var(--font); padding: 0 6px; }
.sp-card { border: 1px solid var(--line-2); border-left: 4px solid #e8453c; border-radius: 10px; padding: 10px 12px; }
.sp-card.sp-grammar { border-left-color: #1a73e8; } .sp-card.sp-style { border-left-color: #9334e6; }
.sp-kind { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.sp-ctx { font-size: 14.5px; line-height: 1.5; margin: 8px 0; }
.sp-ctx mark { background: rgba(232, 69, 60, .16); color: inherit; border-bottom: 2px solid #e8453c; padding: 0 1px; border-radius: 2px; }
.sp-grammar .sp-ctx mark { background: rgba(26, 115, 232, .14); border-bottom-color: #1a73e8; }
.sp-style .sp-ctx mark { background: rgba(147, 52, 230, .12); border-bottom-color: #9334e6; }
.sp-msg { font-size: 13.5px; color: var(--ink-2); margin: 0 0 8px; }
.sp-sugs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.sp-sug { border: 1px solid var(--brand); background: var(--brand-soft); color: var(--brand); border-radius: 8px; padding: 5px 12px; font: 600 14px var(--font); cursor: pointer; }
.sp-sug:hover { background: var(--brand); color: #fff; }
.sp-sug-all { border: 0; background: none; color: var(--muted); font-size: 12px; cursor: pointer; margin-left: -4px; text-decoration: underline; }
.sp-acts, .sp-nav { display: flex; flex-wrap: wrap; gap: 6px; }
.sp-nav { justify-content: space-between; }
.sp-done { text-align: center; padding: 14px 0; }
.sp-done p { margin: 4px 0; }
.sp-check { width: 54px; height: 54px; margin: 0 auto 8px; border-radius: 50%; display: grid; place-items: center; font-size: 26px; color: #fff; background: linear-gradient(135deg, #34a853, #00bfa5); box-shadow: 0 8px 20px rgba(52, 168, 83, .3); }
.sp-stats { border-top: 1px solid var(--line-2); padding-top: 10px; font-size: 13.5px; }
.sp-stats h4 { margin: 0 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.sp-stats p { margin: 6px 0 0; }
.sp-meter { height: 8px; border-radius: 4px; background: var(--line-2); overflow: hidden; }
.sp-meter span { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, #e8453c, #f9ab00 40%, #34a853 75%); }
.sp-legend { font-size: 12px; color: var(--muted); margin: auto 0 0; }
.lg { display: inline-block; width: 16px; height: 0; border-bottom: 2px solid; vertical-align: middle; margin: 0 2px 0 6px; }
.lg-s { border-color: #e8453c; border-bottom-style: dotted; } .lg-g { border-color: #1a73e8; border-bottom-style: double; border-bottom-width: 3px; } .lg-y { border-color: #9334e6; border-bottom-style: dotted; }
@media (max-width: 760px) { .sp-pane { top: auto; bottom: 0; right: 0; left: 0; width: auto; max-width: none; max-height: 70vh; border-radius: 16px 16px 0 0; } }
@media print { .sp-pane { display: none !important; } }
.sp-pane[hidden] { display: none; }
.mail-methods { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 8px; }
.mm-opt { display: flex !important; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; margin: 0 !important; font-weight: 400 !important; }
.mm-opt:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.mm-opt input { margin-top: 3px; }
.mm-opt span { display: flex; flex-direction: column; } .mm-opt small { color: var(--muted); font-size: 12.5px; line-height: 1.4; }
.mm-panel[hidden], .guide[hidden] { display: none !important; }
@media (max-width: 700px) { .mail-methods { grid-template-columns: 1fr; } }

/* ===== 1.6: voce ===== */
.voice-bar { position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%); z-index: 1600; display: flex; align-items: center; gap: 10px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 30px; box-shadow: var(--shadow-lg); padding: 8px 10px 8px 8px;
  max-width: calc(100vw - 24px); animation: vbIn .2s ease-out; }
.voice-bar[hidden] { display: none; }
@keyframes vbIn { from { opacity: 0; transform: translate(-50%, 12px); } }
.vb-mic { position: relative; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, #e8453c, #c5221f); flex: none; }
.vb-mic svg { position: relative; z-index: 1; }
.vb-mic i { position: absolute; inset: 0; border-radius: 50%; background: rgba(232, 69, 60, .45); animation: vbPulse 1.4s ease-out infinite; }
.voice-bar.paused .vb-mic i { animation: none; opacity: 0; }
.voice-bar.paused .vb-mic { background: #9aa0a6; }
.vb-spk { background: linear-gradient(135deg, #2557d6, #7c4dff); }
@keyframes vbPulse { 0% { transform: scale(1); opacity: .8; } 100% { transform: scale(1.9); opacity: 0; } }
.vb-main { display: flex; flex-direction: column; min-width: 180px; max-width: 420px; overflow: hidden; }
.vb-main strong { font-size: 14px; }
.vb-live { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-style: italic; }
.vb-help { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); background: var(--soft-2); color: var(--muted); font-weight: 700; cursor: pointer; }
.voice-bar select { height: 32px; border: 1px solid var(--input-border); border-radius: 8px; background: var(--surface); color: var(--ink); font: 13px var(--font); max-width: 150px; }
.voice-bar select[hidden] { display: none; }
.vcmd td { padding: 5px 10px; } .vcmd td:last-child { font-weight: 600; }
@media (max-width: 600px) { .vb-main { min-width: 0; max-width: 40vw; } .voice-bar .vb-voice { display: none; } .voice-bar { bottom: 12px; } }
@media print { .voice-bar { display: none !important; } }

/* Attività del documento */
.act-people { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.act-person { display: inline-flex; align-items: center; gap: 6px; background: var(--soft); border-radius: 18px; padding: 3px 10px 3px 3px; font-size: 13.5px; }
.act-person small { color: var(--muted); }
.act-list { list-style: none; margin: 0; padding: 0; max-height: 58vh; overflow: auto; }
.act-day { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 12px 0 6px; }
.act-item { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line-2); font-size: 14px; }
.act-ic { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--soft); color: var(--muted); flex: none; }
.act-edit .act-ic { background: var(--brand-soft); color: var(--brand); } .act-comment .act-ic { background: #fff4d6; color: #b06000; }
.act-share .act-ic { background: var(--ok-soft); color: var(--ok); } .act-restore .act-ic, .act-version .act-ic { background: #f3e8fd; color: #9334e6; }
.act-text { flex: 1; min-width: 0; } .act-text em { color: var(--ink-2); }
.act-item time { color: var(--muted); font-size: 12.5px; }
.act-foot { margin-top: 10px; font-size: 13px; }
.hist-diffbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 6px 2px 8px; font-size: 13.5px; }
.hist-diffbar .check { margin: 0; }
.hist-stats { color: var(--muted); } .st-add { color: #188038; font-weight: 600; } .st-del { color: #c5221f; font-weight: 600; }
.cm-reacts { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 1px; }
.cm-react { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 12px; padding: 1px 7px; font: 13px var(--font); cursor: pointer; line-height: 20px; }
.cm-react b { font-size: 11.5px; }
.cm-react.on { border-color: var(--brand); background: var(--brand-soft); }
.cm-mine .cm-react { border-color: rgba(255, 255, 255, .5); }
.cp-emoji { position: fixed; z-index: 2450; display: flex; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 4px 6px; box-shadow: var(--shadow-lg); animation: pop .12s ease-out; }
.cp-emoji button { border: 0; background: none; font-size: 21px; width: 36px; height: 36px; border-radius: 50%; cursor: pointer; transition: transform .1s; }
.cp-emoji button:hover { background: var(--hover); transform: scale(1.25); }

/* App installabile e notifiche */
.install-banner { display: flex; align-items: center; gap: 12px; background: linear-gradient(135deg, #eef3ff, #f4ecff); border: 1px solid #d6e0ff; border-radius: 14px; padding: 10px 12px; margin: 0 0 18px; }
.install-banner[hidden] { display: none; }
.install-banner img { border-radius: 10px; flex: none; }
.install-banner div { flex: 1; display: flex; flex-direction: column; } .install-banner small { color: var(--muted); }
:root[data-theme="dark"] .install-banner { background: linear-gradient(135deg, #1d2645, #2a1f45); border-color: #33406b; }
.notif-desk { display: block; width: 100%; border: 0; border-top: 1px solid var(--line-2); background: var(--soft-2); color: var(--brand); font: 600 13.5px var(--font); padding: 11px; cursor: pointer; border-radius: 0 0 10px 10px; }
.notif-desk:hover { background: var(--hover-2); }
.notif-desk[hidden] { display: none; }
.ios-steps { line-height: 1.8; padding-left: 20px; } .ios-share { display: inline-block; border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; }
#installApp[hidden] { display: none; }

/* Statistiche, backup, privacy */
.stats { flex-wrap: wrap; }
.charts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 22px; }
.charts figure { margin: 0; } .charts figure.wide { grid-column: 1 / -1; }
.charts figcaption { font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
svg.chart { width: 100%; height: auto; display: block; }
svg.chart text { font: 10px var(--font); fill: var(--muted); } svg.chart .grid { stroke: var(--line-2); stroke-dasharray: 3 3; } svg.chart .max { font-weight: 600; }
.top-users { list-style: none; padding: 0; margin: 6px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.top-users li { display: flex; align-items: center; gap: 8px; background: var(--soft); border-radius: 18px; padding: 3px 12px 3px 3px; font-size: 14px; }
.top-users small { color: var(--muted); }
.danger-zone { margin-top: 14px; } .danger-zone summary { color: var(--danger); }
@media (max-width: 760px) { .charts { grid-template-columns: 1fr; } }
.app-footer a { color: var(--muted); text-decoration: underline; }
.cookie-note { position: fixed; left: 16px; bottom: 16px; z-index: 1700; max-width: 420px; display: flex; align-items: center; gap: 12px; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 12px 14px; font-size: 13.5px; animation: vbIn .3s ease-out; }
@media (max-width: 500px) { .cookie-note { left: 8px; right: 8px; bottom: 8px; max-width: none; } }
.legal h2 { font-size: 17px; margin: 20px 0 6px; } .legal .card { line-height: 1.6; }
.plain-page main.narrow { padding-top: 24px; }
