:root {
  --ink: #1b1f24;
  --ink-2: #3c424a;
  --muted: #5b626b;
  --line: rgba(16, 24, 40, 0.08);
  --line-2: rgba(16, 24, 40, 0.13);
  --hover: rgba(16, 24, 40, 0.045);
  --active: rgba(16, 24, 40, 0.07);
  --accent: #2f6fde;
  --accent-ink: #1f5bc4;
  --accent-soft: rgba(47, 111, 222, 0.1);
  --danger: #c4342b;
  --star: #f5a623;
  --ground: #f2f2f0;
  --sheet: #ffffff;
  /* profondità: un filo di luce in alto, bordo appena percepibile, ombre morbide a strati */
  --raise: inset 0 1px 0 rgba(255, 255, 255, 0.95), 0 0 0 1px rgba(16, 24, 40, 0.07), 0 1px 2px rgba(16, 24, 40, 0.06), 0 3px 8px -3px rgba(16, 24, 40, 0.08);
  --raise-hover: inset 0 1px 0 rgba(255, 255, 255, 0.95), 0 0 0 1px rgba(16, 24, 40, 0.09), 0 2px 4px rgba(16, 24, 40, 0.07), 0 8px 18px -6px rgba(16, 24, 40, 0.14);
  --raise-lg: 0 0 0 1px rgba(16, 24, 40, 0.05), 0 1px 2px rgba(16, 24, 40, 0.04), 0 10px 28px -8px rgba(16, 24, 40, 0.1), 0 28px 56px -20px rgba(16, 24, 40, 0.1);
  --float: 0 0 0 1px rgba(16, 24, 40, 0.06), 0 4px 10px rgba(16, 24, 40, 0.06), 0 20px 44px -10px rgba(16, 24, 40, 0.2);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Helvetica, Arial, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --tb-h: 54px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none;
  color: var(--ink); font-family: var(--font); font-size: 15px;
  -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent;
}
html {
  background:
    radial-gradient(1100px 520px at 18% -8%, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0) 70%),
    radial-gradient(900px 600px at 100% 110%, rgba(222, 228, 236, 0.7), rgba(222, 228, 236, 0) 70%),
    var(--ground);
  background-attachment: fixed;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
svg { display: block; }
svg:not([viewBox]) { width: 20px; height: 20px; }
svg use, .ib svg, .nav-item svg, .btn svg, .menu svg, .tool svg, .card svg {
  fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.ib svg, .tool svg { width: 22px; height: 22px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.logo { display: block; height: 34px; width: auto; user-select: none; -webkit-user-drag: none; }

/* ───────────── controlli comuni ───────────── */
.ib {
  width: 40px; height: 40px; flex: none;
  display: inline-grid; place-items: center;
  border: 0; border-radius: 10px; background: transparent; color: var(--ink-2);
  position: relative; touch-action: manipulation; transition: background .15s, box-shadow .15s;
}
.ib:hover { background: rgba(255, 255, 255, .8); box-shadow: var(--raise); }
.ib:active { background: #f4f4f4; box-shadow: inset 0 1px 2px rgba(16, 24, 40, .1); }
.ib:disabled { opacity: .3; pointer-events: none; }
.ib.sm { width: 34px; height: 34px; font-size: 20px; line-height: 1; }
.ib.sm svg { width: 20px; height: 20px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 15px; border-radius: 11px; border: 0;
  background: linear-gradient(#ffffff, #f8f8f7); box-shadow: var(--raise); color: var(--ink);
  font-weight: 500; white-space: nowrap; touch-action: manipulation;
  transition: box-shadow .15s, transform .08s, filter .15s;
}
.btn:hover { box-shadow: var(--raise-hover); }
.btn:active { transform: translateY(1px); box-shadow: inset 0 1px 2px rgba(16, 24, 40, .12), 0 0 0 1px rgba(16, 24, 40, .08); }
.btn svg { width: 18px; height: 18px; }
.btn.ghost { background: transparent; box-shadow: none; color: var(--ink-2); }
.btn.ghost:hover { background: rgba(255, 255, 255, .7); box-shadow: var(--raise); }
.btn.primary {
  color: #fff; background: linear-gradient(#3d7df0, #2a64d4);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28), 0 0 0 1px #2256bb, 0 1px 2px rgba(34, 86, 187, .35), 0 6px 14px -4px rgba(47, 111, 222, .45);
}
.btn.primary:hover { filter: brightness(1.05); }
.btn.primary:active { box-shadow: inset 0 2px 3px rgba(0, 0, 0, .2), 0 0 0 1px #2256bb; }
.btn.danger { color: #fff; background: linear-gradient(#d4473e, #bd3128); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 0 0 1px #a52a22, 0 4px 10px -4px rgba(196, 52, 43, .5); }
.btn.block { width: 100%; height: 46px; font-size: 16px; }
.btn:disabled { opacity: .5; pointer-events: none; }

.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 12px; background: rgba(16, 24, 40, .055); box-shadow: inset 0 1px 2px rgba(16, 24, 40, .07); flex: none; }
.seg button {
  border: 0; background: transparent; border-radius: 9px; padding: 6px 12px;
  font-size: 13.5px; font-weight: 500; color: var(--ink-2); touch-action: manipulation; transition: background .15s, box-shadow .15s;
}
.seg button.on { background: linear-gradient(#fff, #fbfbfb); color: var(--ink); box-shadow: var(--raise); }
.seg.full { display: flex; }
.seg.full button { flex: 1; }
.view-seg button { width: 42px; height: 32px; padding: 0; display: grid; place-items: center; }
.view-seg svg { width: 18px; height: 18px; }

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 13.5px; font-weight: 500; color: var(--ink-2); }
.field input, .field select, .field textarea {
  width: 100%; height: 44px; padding: 0 12px; border-radius: 11px; border: 0;
  background: #fff; font-size: 16px; outline: none;
  box-shadow: inset 0 1px 2px rgba(16, 24, 40, .06), 0 0 0 1px rgba(16, 24, 40, .12);
}
.field textarea { height: auto; padding: 10px 12px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { box-shadow: 0 0 0 1px var(--accent), 0 0 0 4px var(--accent-soft); }
.field small { color: var(--muted); font-size: 12.5px; }
.form-error { color: var(--danger); font-size: 14px; margin: -4px 0 12px; }

/* ───────────── accesso ───────────── */
#auth { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; overflow-y: auto; }
#auth { overflow: hidden auto; }
.auth-hero {
  position: fixed; left: 50%; top: 50%; width: min(1180px, 112vw); transform: translate(-50%, -54%);
  pointer-events: none; z-index: 0; opacity: .9;
}
.auth-hero svg { width: 100%; height: auto; display: block; overflow: visible; }
.auth-hero path { fill: #1b1f24; fill-opacity: 0; stroke: #1b1f24; stroke-width: .9; stroke-linecap: round; stroke-linejoin: round; }
.auth-card {
  position: relative; z-index: 1; width: min(420px, 100%); padding: 32px 30px 24px; border-radius: 26px;
  background: rgba(255, 255, 255, .74);
  -webkit-backdrop-filter: blur(22px) saturate(1.3); backdrop-filter: blur(22px) saturate(1.3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .9), 0 0 0 1px rgba(16, 24, 40, .06), 0 20px 50px -12px rgba(16, 24, 40, .25), 0 50px 100px -30px rgba(16, 24, 40, .2);
  animation: card-rise .6s cubic-bezier(.2, .8, .2, 1) both;
}
.auth-brand { margin-bottom: 22px; }
.auth-brand .logo { height: 46px; }
.auth-form { animation: form-in .35s cubic-bezier(.2, .8, .2, 1); }
.code-input { font-size: 28px !important; letter-spacing: .45em; text-align: center; font-variant-numeric: tabular-nums; height: 58px !important; }
.made-by {
  display: inline-flex; align-items: center; gap: 6px; color: #7a8089; font-size: 12px; text-decoration: none; letter-spacing: .01em;
}
.made-by img { height: 10px; width: auto; opacity: .7; }
.made-by:hover { color: var(--ink-2); }
.made-by:hover img { opacity: 1; }
#auth > .made-by { position: fixed; bottom: calc(var(--safe-b) + 18px); left: 50%; transform: translateX(-50%); z-index: 1; }
.made-by.side { order: 3; align-self: center; margin: 2px 0 4px; }
.sidebar .sb-user { order: 2; }
@keyframes card-rise { from { opacity: 0; transform: translateY(14px) scale(.98); } }
@keyframes form-in { from { opacity: 0; transform: translateY(6px); } }
.auth-card h1 { margin: 0 0 6px; font-size: 26px; letter-spacing: -.02em; }
.auth-card .sub { margin: 0 0 22px; color: var(--muted); line-height: 1.45; }
.switch { text-align: center; color: var(--muted); font-size: 14px; margin: 18px 0 0; }
.switch a { color: var(--accent-ink); font-weight: 500; text-decoration: none; }

/* ───────────── libreria ───────────── */
.window {
  position: fixed;
  inset: var(--safe-t) var(--safe-r) var(--safe-b) var(--safe-l);
  display: grid; grid-template-columns: 260px minmax(0, 1fr);
  padding: 10px 10px 10px 0;
}
.window.no-side { grid-template-columns: minmax(0, 1fr); padding-left: 10px; }
.window.no-side .sidebar { display: none; }
.panel { min-width: 0; min-height: 0; display: flex; flex-direction: column; }

/* barra laterale */
.sidebar { padding: 14px 10px 4px 12px; }
.sb-top { display: flex; align-items: center; justify-content: space-between; padding: 2px 2px 0 10px; margin-bottom: 18px; height: 40px; }
.sb-scroll { flex: 1; overflow-y: auto; margin: 0 -4px; padding: 0 4px 8px; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
.sb-group { display: grid; gap: 2px; margin-bottom: 18px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; width: 100%; height: 40px; padding: 0 10px;
  border: 0; border-radius: 11px; background: transparent; text-align: left;
  font-size: 15px; color: var(--ink); touch-action: manipulation; transition: background .15s, box-shadow .15s;
}
.nav-item > svg { width: 19px; height: 19px; color: var(--muted); flex: none; }
.nav-item span { flex: 0 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-item .count { font-style: normal; color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.nav-item:hover { background: rgba(255, 255, 255, .6); }
.nav-item:active, .cat-row:active { transform: scale(.985); }
.nav-item.on { background: linear-gradient(#fff, #fcfcfc); box-shadow: var(--raise); }
.nav-item.muted { color: var(--muted); }
svg.star { color: var(--star) !important; fill: var(--star); stroke: var(--star); }
.sb-label { font-size: 13px; color: var(--muted); margin: 6px 10px 6px; }

.tree { display: grid; gap: 2px; }
.cat-row { display: flex; align-items: center; gap: 4px; height: 40px; border-radius: 11px; padding: 0 6px 0 2px; transition: background .15s, box-shadow .15s; }
.cat-row:hover { background: rgba(255, 255, 255, .6); }
.cat-row.on { background: linear-gradient(#fff, #fcfcfc); box-shadow: var(--raise); }
.cat-row .twist { width: 26px; height: 30px; border: 0; background: none; display: grid; place-items: center; color: var(--muted); border-radius: 7px; flex: none; }
.cat-row .twist svg { width: 15px; height: 15px; transition: transform .15s; }
.cat-row.open .twist svg { transform: rotate(90deg); }
.cat-row .cat-main { flex: 1; min-width: 0; height: 100%; display: flex; align-items: center; gap: 10px; border: 0; background: none; text-align: left; font-size: 15px; padding: 0; }
.cat-row .cat-main span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-ic {
  width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; flex: none; color: #fff;
  background: linear-gradient(rgba(255, 255, 255, .18), rgba(255, 255, 255, 0)), var(--c);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 1px 2px rgba(16, 24, 40, .18);
}
.cat-ic svg { width: 14px; height: 14px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.cat-row .cat-n { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.tree-docs { display: grid; gap: 1px; margin: 1px 0 4px; }
.doc-row {
  display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 8px 0 40px;
  border: 0; border-radius: 10px; background: transparent; text-align: left; width: 100%;
  font-size: 14.5px; color: var(--ink);
}
.doc-row svg { width: 17px; height: 17px; color: var(--muted); flex: none; }
.doc-row span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-row svg.star { width: 15px; height: 15px; }
.doc-row:hover { background: rgba(255, 255, 255, .6); }
.tree-empty { padding: 4px 10px 8px 42px; color: var(--muted); font-size: 13.5px; }
.recent .doc-row { padding-left: 10px; }

.sb-user {
  display: flex; align-items: center; gap: 10px; margin: 8px 0 6px; padding: 8px;
  border: 0; border-radius: 14px; background: linear-gradient(#fff, #fbfbfa); box-shadow: var(--raise); text-align: left; width: 100%;
}
.sb-user:hover { box-shadow: var(--raise-hover); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 14px; flex: none;
  background: linear-gradient(#55657a, #34404e); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25);
}
.who { flex: 1; min-width: 0; display: grid; line-height: 1.25; }
.who b { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who small { font-size: 12.5px; color: var(--muted); }
.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: #34a853; flex: none; margin-right: 4px; box-shadow: 0 0 0 3px rgba(52, 168, 83, .15); }
.sync-dot[data-s="syncing"] { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); animation: pulse 1s ease-in-out infinite; }
.sync-dot[data-s="offline"] { background: #9aa0a6; box-shadow: none; }
.sync-dot[data-s="error"], .sync-dot[data-s="auth"] { background: var(--danger); box-shadow: 0 0 0 3px rgba(196, 52, 43, .15); }
@keyframes pulse { 50% { opacity: .35; } }

/* area principale */
.main { background: var(--sheet); border-radius: 20px; box-shadow: var(--raise-lg); overflow: hidden; }
.main-head { display: flex; align-items: center; gap: 10px; height: 66px; padding: 0 18px 0 30px; flex: none; }
.main-head h1 { font-size: 19px; font-weight: 600; margin: 0; letter-spacing: -.01em; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#sb-open { display: none; margin-left: -12px; }
.no-side #sb-open { display: inline-grid; }
.head-actions { display: flex; align-items: center; gap: 8px; }
.main-scroll { flex: 1; overflow-y: auto; padding: 2px 30px 48px; -webkit-overflow-scrolling: touch; }
.greeting { margin: 0 0 12px; color: var(--ink-2); font-size: 15.5px; }
.search { position: relative; display: block; margin-bottom: 28px; }
.search input {
  width: 100%; height: 54px; padding: 0 52px 0 20px; border-radius: 15px; border: 0;
  background: #fff; font-size: 18px; outline: none; -webkit-appearance: none; appearance: none;
  box-shadow: inset 0 1px 0 #fff, 0 0 0 1px rgba(16, 24, 40, .07), 0 2px 4px rgba(16, 24, 40, .04), 0 10px 24px -10px rgba(16, 24, 40, .12);
}
.search input::placeholder { color: #6e747c; }
.search input:focus { box-shadow: 0 0 0 1px rgba(47, 111, 222, .55), 0 0 0 5px var(--accent-soft), 0 10px 24px -10px rgba(16, 24, 40, .12); }
.search svg { position: absolute; right: 18px; top: 50%; transform: translateY(-50%); width: 21px; height: 21px; color: var(--muted); pointer-events: none; }

.section { margin-bottom: 32px; }
.sec-head { display: flex; align-items: center; gap: 12px; height: 46px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.sec-ring { width: 22px; height: 22px; border-radius: 50%; border: 2.2px solid var(--c); flex: none; box-shadow: 0 1px 2px rgba(16, 24, 40, .1); }
.sec-ring.dash { border-style: dashed; box-shadow: none; }
.sec-head h2 { font-size: 16.5px; font-weight: 500; margin: 0; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sec-head h2 small { color: var(--muted); font-weight: 400; font-size: 14px; margin-left: 6px; }
.sec-head .ib { color: var(--muted); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 16px; }
.card {
  position: relative; height: 296px; display: flex; flex-direction: column;
  background: #fff; border-radius: 13px; border: 0; overflow: hidden; text-align: left; padding: 0;
  box-shadow: inset 0 1px 0 #fff, 0 0 0 1px rgba(16, 24, 40, .07), 0 1px 2px rgba(16, 24, 40, .05), 0 6px 16px -8px rgba(16, 24, 40, .12);
  transition: transform .18s ease, box-shadow .18s ease; touch-action: manipulation;
}
.card::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--c, #c7ccd3); z-index: 1; }
.card:hover { transform: translateY(-2px); box-shadow: inset 0 1px 0 #fff, 0 0 0 1px rgba(16, 24, 40, .08), 0 4px 8px rgba(16, 24, 40, .05), 0 18px 34px -14px rgba(16, 24, 40, .22); }
.card:active { transform: translateY(0) scale(.99); }
.card-body { flex: 1; min-height: 0; padding: 24px 22px 0; position: relative; overflow: hidden; }
.card-body::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 56px; background: linear-gradient(rgba(255, 255, 255, 0), #fff); }
.card h3 { margin: 0 0 10px; font-size: 17px; font-weight: 600; line-height: 1.3; letter-spacing: -.01em; display: flex; gap: 8px; align-items: flex-start; }
.card h3 span { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card h3 svg.star { width: 16px; height: 16px; flex: none; margin-top: 3px; }
.card .pv { font-size: 12.8px; line-height: 1.4; color: var(--ink-2); }
.card .pv p { margin: 0 0 10px; }
.card .pv h4 { margin: 10px 0 4px; font-size: 13px; font-weight: 600; color: var(--ink); }
.card .pv ul { margin: 0 0 10px; padding-left: 18px; }
.card .pv li { margin: 1px 0; }
.card .pv .muted { color: var(--muted); }
.card-foot { display: flex; align-items: center; justify-content: space-between; height: 48px; padding: 0 8px 0 22px; color: var(--muted); font-size: 13.5px; flex: none; background: linear-gradient(#fbfbfb, #f7f7f6); box-shadow: inset 0 1px 0 rgba(16, 24, 40, .05); }
.card-foot .kind { display: inline-flex; align-items: center; gap: 6px; }
.card-foot .kind svg { width: 15px; height: 15px; }
.card-foot .ib { color: var(--muted); }
.card.new {
  background: rgba(250, 250, 249, .7); box-shadow: inset 0 1px 3px rgba(16, 24, 40, .05);
  outline: 1.5px dashed rgba(16, 24, 40, .18); outline-offset: -1.5px;
  display: grid; place-items: center; color: var(--ink-2); font-size: 15.5px;
}
.card.new::before { display: none; }
.card.new span { display: inline-flex; align-items: center; gap: 8px; }
.card.new svg { width: 18px; height: 18px; }
.card.new:hover { background: #fff; outline-color: rgba(47, 111, 222, .5); color: var(--accent-ink); box-shadow: var(--raise-hover); }
.card.trashed { opacity: .82; }

.rows { display: grid; gap: 2px; }
.row {
  display: grid; grid-template-columns: 24px minmax(0, 1fr) auto 120px 34px; align-items: center; gap: 12px;
  height: 52px; padding: 0 6px 0 12px; border-radius: 11px; border: 0; background: transparent; text-align: left; width: 100%;
  transition: background .15s, box-shadow .15s;
}
.row:hover { background: #fff; box-shadow: var(--raise); }
.row > svg { width: 19px; height: 19px; color: var(--muted); }
.row .r-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 8px; }
.row .r-name svg.star { width: 14px; height: 14px; flex: none; }
.row .r-cat { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; color: var(--ink-2); }
.row .r-cat i { width: 9px; height: 9px; border-radius: 3px; background: var(--c); }
.row .r-when { font-size: 13.5px; color: var(--muted); text-align: right; }

.empty { padding: 56px 20px; text-align: center; color: var(--muted); }
.empty h3 { color: var(--ink); font-size: 19px; margin: 0 0 6px; font-weight: 600; }
.empty p { margin: 0 auto 20px; max-width: 400px; line-height: 1.5; }
.empty .btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.trash-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-radius: 13px; background: #f6f6f5; box-shadow: inset 0 1px 2px rgba(16, 24, 40, .05); color: var(--ink-2); font-size: 14px; margin-bottom: 18px; }

.scrim { position: fixed; inset: 0; background: rgba(20, 24, 28, .25); z-index: 40; }

/* banner "installa l'app" */
.install-banner {
  position: fixed; z-index: 80; left: 50%; bottom: calc(var(--safe-b) + 18px); transform: translateX(-50%);
  width: min(620px, calc(100vw - 24px)); display: flex; align-items: center; gap: 14px; padding: 12px 10px 12px 12px;
  background: #fff; border-radius: 18px; box-shadow: var(--float); animation: rise .35s cubic-bezier(.2, .8, .2, 1);
}
.install-banner img { border-radius: 11px; box-shadow: 0 0 0 1px rgba(16, 24, 40, .08), 0 2px 6px rgba(16, 24, 40, .12); flex: none; }
.ib-text { flex: 1; min-width: 0; display: grid; gap: 2px; line-height: 1.35; }
.ib-text b { font-size: 15px; }
.ib-text span { font-size: 13.5px; color: var(--muted); }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 16px); } }

/* tutorial */
.tour { position: fixed; inset: 0; z-index: 85; }
.tour-hole {
  position: fixed; border-radius: 14px; pointer-events: none;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, .9), 0 0 0 9999px rgba(18, 22, 28, .48);
  transition: all .3s cubic-bezier(.2, .8, .2, 1);
}
.tour-hole.none { width: 0 !important; height: 0 !important; box-shadow: 0 0 0 9999px rgba(18, 22, 28, .48); }
.tour-card {
  position: fixed; width: min(360px, calc(100vw - 32px)); padding: 20px 20px 16px; border-radius: 18px;
  background: #fff; box-shadow: var(--float); transition: top .3s cubic-bezier(.2, .8, .2, 1), left .3s cubic-bezier(.2, .8, .2, 1);
}
.tour-step { font-size: 13px; color: var(--muted); margin-bottom: 6px; font-variant-numeric: tabular-nums; }
.tour-card h3 { margin: 0 0 6px; font-size: 19px; letter-spacing: -.01em; }
.tour-card p { margin: 0 0 16px; color: var(--ink-2); line-height: 1.5; font-size: 15px; }
.tour-actions { display: flex; align-items: center; gap: 8px; }
.tour-spacer { flex: 1; }

/* installazione: istruzioni per piattaforma */
.steps { margin: 0 0 6px; padding-left: 22px; line-height: 1.6; }
.steps li { margin: 4px 0; }
.kbd { display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; border-radius: 7px; background: #f4f4f3; box-shadow: var(--raise); font-weight: 500; font-size: 14px; white-space: nowrap; }
.kbd svg { width: 15px; height: 15px; display: inline-block; vertical-align: -2px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.plat-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 16px; }
.plat-tabs button { border: 0; border-radius: 999px; padding: 7px 13px; font-size: 13.5px; background: rgba(16, 24, 40, .05); color: var(--ink-2); }
.plat-tabs button.on { background: linear-gradient(#fff, #fbfbfb); color: var(--ink); box-shadow: var(--raise); font-weight: 500; }
.note-ok { padding: 12px 14px; border-radius: 12px; background: #eef7f0; color: #1f5f35; font-size: 14px; line-height: 1.45; margin-bottom: 12px; }

/* finestra stretta (iPad verticale, telefono) */
@media (max-width: 900px) {
  .window, .window.no-side { grid-template-columns: minmax(0, 1fr); padding: 8px; }
  .sidebar {
    position: fixed; z-index: 45; top: calc(var(--safe-t) + 12px); left: calc(var(--safe-l) + 12px); bottom: calc(var(--safe-b) + 12px);
    width: min(300px, calc(100vw - 24px)); background: #f7f7f6; border-radius: 20px; box-shadow: var(--float);
  }
  .window:not(.show-side) .sidebar { display: none; }
  .window.show-side .sidebar { display: flex; animation: drawer-in .3s cubic-bezier(.2, .8, .2, 1); }
  #sb-open { display: inline-grid; }
  .main-head { padding-left: 20px; }
  .main-scroll { padding: 2px 20px 36px; }
}
@media (max-width: 600px) {
  .window, .window.no-side { padding: calc(var(--safe-t) + 4px) 4px calc(var(--safe-b) + 4px); }
  .main { border-radius: 16px; }
  #btn-add span { display: none; }
  #btn-add { width: 40px; padding: 0; }
  .cards { grid-template-columns: 1fr 1fr; gap: 10px; }
  .card { height: 230px; }
  .card-body { padding: 18px 14px 0; }
  .card h3 { font-size: 15.5px; }
  .card .pv { font-size: 12px; }
  .card-foot { padding-left: 14px; }
  .row { grid-template-columns: 22px minmax(0, 1fr) auto 34px; }
  .row .r-cat { display: none; }
  .search input { font-size: 16px; height: 48px; }
  .install-banner { flex-wrap: wrap; }
  .install-banner .ib-text { flex-basis: calc(100% - 110px); }
  #install-how { flex: 1; }
}

/* ───────────── editor ───────────── */
#editor { position: fixed; inset: 0; background: #f8f8f7; }
#editor .toolbar {
  position: fixed; z-index: 20;
  top: calc(var(--safe-t) + 10px); left: calc(var(--safe-l) + 10px); right: calc(var(--safe-r) + 10px);
  height: var(--tb-h); padding: 0 8px;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px;
  border-radius: 17px; background: rgba(255, 255, 255, .94); border: 0;
  -webkit-backdrop-filter: blur(20px) saturate(1.4); backdrop-filter: blur(20px) saturate(1.4);
  box-shadow: 0 0 0 1px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .05), 0 6px 14px -8px rgba(16, 24, 40, .14);
  user-select: none; -webkit-user-select: none;
}
.tb-left, .tb-right { display: flex; align-items: center; gap: 2px; min-width: 0; }
.tb-right { justify-content: flex-end; }
.doc-title { display: flex; flex-direction: column; min-width: 0; margin-left: 6px; line-height: 1.2; }
#doc-name { font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#save-status { font-size: 12px; color: var(--muted); white-space: nowrap; }
#save-status[data-state="error"] { color: var(--danger); }
.tools { display: flex; gap: 2px; padding: 3px; border-radius: 13px; background: rgba(16, 24, 40, .055); box-shadow: inset 0 1px 2px rgba(16, 24, 40, .07); }
.tool {
  width: 44px; height: 40px; display: grid; place-items: center;
  border: 0; border-radius: 10px; background: transparent; color: var(--ink-2); touch-action: manipulation;
  transition: background .15s, color .15s;
}
.tool[aria-pressed="true"] { background: linear-gradient(#fff, #fbfbfb); color: var(--accent); box-shadow: var(--raise); }
.tool circle.ind { fill: currentColor; stroke: none; }
.tool path.ind { stroke: currentColor; }
#btn-save .dot { position: absolute; top: 8px; right: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); display: none; }
#btn-save.dirty .dot { display: block; }
@media (max-width: 1000px) { .doc-title { display: none; } }
@media (max-width: 760px) {
  #editor .toolbar { grid-template-columns: auto 1fr auto; gap: 4px; left: 6px; right: 6px; }
  .tools { overflow-x: auto; scrollbar-width: none; justify-self: center; max-width: 100%; }
  .tools::-webkit-scrollbar { display: none; }
  .tool { width: 40px; }
  #editor .ib { width: 36px; }
  #btn-toc, #btn-redo { display: none; }
}

.optbar {
  position: fixed; z-index: 21;
  top: calc(var(--safe-t) + var(--tb-h) + 18px); left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 4px;
  max-width: calc(100vw - 16px); overflow-x: auto; scrollbar-width: none;
  padding: 5px 8px; border-radius: 15px;
  background: rgba(255, 255, 255, .94); border: 0;
  -webkit-backdrop-filter: blur(24px) saturate(1.4); backdrop-filter: blur(24px) saturate(1.4);
  box-shadow: 0 0 0 1px rgba(16, 24, 40, .06), 0 2px 4px -2px rgba(16, 24, 40, .08), 0 10px 22px -12px rgba(16, 24, 40, .2); user-select: none; -webkit-user-select: none;
}
.optbar::-webkit-scrollbar { display: none; }
.optbar .sep { width: 1px; height: 24px; background: var(--line-2); margin: 0 4px; flex: none; }
.optbar .hint { font-size: 13px; color: var(--muted); padding: 0 6px; white-space: nowrap; }
.sw { width: 34px; height: 34px; flex: none; border: 0; border-radius: 50%; background: transparent; display: grid; place-items: center; position: relative; touch-action: manipulation; }
.sw::before { content: ""; width: 22px; height: 22px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15); }
.sw.on::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; box-shadow: 0 0 0 2px var(--accent); }
.sw.custom::before { background: conic-gradient(#ff5c5c, #ffd84d, #6be06b, #4dc3ff, #9b6bff, #ff5cc8, #ff5c5c); }
.sw.custom.on::before { background: var(--c); }
.sw.custom input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; border: 0; padding: 0; }
.sz { width: 36px; height: 34px; flex: none; border: 0; border-radius: 10px; background: transparent; display: grid; place-items: center; touch-action: manipulation; color: var(--ink); }
.sz i { display: block; border-radius: 50%; background: currentColor; }
.sz span { font-weight: 600; }
.sz.on { background: var(--accent-soft); color: var(--accent); }
.fmt { min-width: 38px; height: 34px; padding: 0 8px; flex: none; border: 0; border-radius: 9px; background: transparent; font-size: 15px; font-weight: 600; color: var(--ink-2); touch-action: manipulation; white-space: nowrap; }
.fmt:hover { background: var(--hover); }
.fmt.on { background: var(--accent-soft); color: var(--accent-ink); }

#scroller {
  position: fixed; left: 0; right: 0; bottom: 0;
  top: calc(var(--safe-t) + var(--tb-h) + 10px);
  overflow: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
}
#sizer { position: relative; }
#pinch { position: absolute; left: 0; top: 0; width: 100%; height: 100%; transform-origin: 0 0; }
#page {
  position: absolute; left: 0; top: 0; transform-origin: 0 0;
  touch-action: pan-x pan-y; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  border-radius: 4px;
}
.touch-draw #page { touch-action: none; }
#page > iframe { pointer-events: none; }
#page.writing > iframe { pointer-events: auto; }
#page[data-tool="pen"], #page[data-tool="marker"], #page[data-tool="lasso"] { cursor: crosshair; }
#page[data-tool="eraser"] { cursor: none; }
#page[data-tool="text"] { cursor: text; }
#page[data-tool="space"] { cursor: row-resize; }
#page[data-tool="hand"] { cursor: grab; }
#page.panning { cursor: grabbing; }
#svg-ui { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.lasso { fill: var(--accent-soft); stroke: var(--accent); stroke-width: calc(1.5px * var(--inv, 1)); stroke-dasharray: calc(5px * var(--inv, 1)) calc(4px * var(--inv, 1)); }
.er-cursor { fill: rgba(255, 255, 255, .35); stroke: rgba(0, 0, 0, .55); stroke-width: calc(1px * var(--inv, 1)); }
.page-loading { position: absolute; inset: 0; display: none; place-items: start center; padding-top: 120px; background: #fff; }
#page.loading .page-loading { display: grid; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid #e3e1db; border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.mg-tl { pointer-events: none; }
.mg-tb { outline: none; min-width: 40px; }
.mg-tb .tb-tx { outline: none; min-height: 1.4em; -webkit-user-select: text; user-select: text; }
.mg-tb .tb-grip { display: none; }
#page[data-tool="text"] .mg-tb { pointer-events: auto; box-shadow: 0 0 0 calc(1px * var(--inv, 1)) rgba(47, 111, 222, .35); border-radius: 3px; background: rgba(255, 255, 255, .5); }
#page[data-tool="text"] .mg-tb.editing { box-shadow: 0 0 0 calc(1.5px * var(--inv, 1)) var(--accent); background: rgba(255, 255, 255, .85); }
#page[data-tool="text"] .mg-tb .tb-grip {
  display: block; position: absolute;
  width: calc(26px * var(--inv, 1)); height: calc(26px * var(--inv, 1)); left: calc(-30px * var(--inv, 1)); top: 0;
  border-radius: 50%; background: var(--accent); cursor: move; touch-action: none; box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
}
#page[data-tool="text"] .mg-tb .tb-grip::before { content: ""; position: absolute; inset: 30%; background: radial-gradient(circle, #fff 1.2px, transparent 1.6px) 0 0 / 33% 33%; }

#ui-layer { position: absolute; top: 0; width: 0; height: 0; }
.sp-band { position: absolute; pointer-events: none; border: calc(1.5px * var(--inv, 1)) dashed var(--accent); border-radius: 6px; background: rgba(47, 111, 222, .05); }
.sp-del, .sp-grip { pointer-events: auto; position: absolute; touch-action: none; }
.sp-del {
  top: calc(6px * var(--inv, 1)); right: calc(6px * var(--inv, 1)); width: calc(30px * var(--inv, 1)); height: calc(30px * var(--inv, 1));
  border-radius: 50%; border: 0; background: var(--accent); color: #fff; font-size: calc(19px * var(--inv, 1)); line-height: 1; display: grid; place-items: center;
}
.sp-grip {
  left: 50%; bottom: calc(-15px * var(--inv, 1)); width: calc(64px * var(--inv, 1)); height: calc(30px * var(--inv, 1));
  transform: translateX(-50%); border-radius: 999px; background: var(--accent); cursor: row-resize; box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
}
.sp-grip::before {
  content: ""; position: absolute; left: 30%; right: 30%; top: 50%; height: calc(6px * var(--inv, 1)); transform: translateY(-50%);
  border-top: calc(1.5px * var(--inv, 1)) solid #fff; border-bottom: calc(1.5px * var(--inv, 1)) solid #fff;
}
#sel-box { position: absolute; border: calc(1.5px * var(--inv, 1)) dashed var(--accent); border-radius: 6px; background: rgba(47, 111, 222, .06); cursor: move; touch-action: none; }
.sel-menu {
  position: absolute; left: 0; bottom: 100%; transform-origin: 0 100%; transform: scale(var(--inv, 1)) translateY(-8px);
  display: flex; gap: 2px; padding: 4px; background: #1d2127; border-radius: 11px; box-shadow: 0 4px 14px rgba(0, 0, 0, .25); white-space: nowrap;
}
.sel-menu button { border: 0; background: transparent; color: #fff; padding: 8px 12px; border-radius: 8px; font-size: 14px; touch-action: manipulation; }
.sel-menu button:active { background: rgba(255, 255, 255, .15); }
.sel-menu .danger { color: #ff8a80; }

.zoom {
  position: fixed; z-index: 15; right: calc(var(--safe-r) + 14px); bottom: calc(var(--safe-b) + 14px);
  display: flex; align-items: center; gap: 2px; padding: 3px; border-radius: 14px;
  background: rgba(255, 255, 255, .94); border: 0;
  -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px); box-shadow: 0 0 0 1px rgba(16, 24, 40, .06), 0 2px 4px -2px rgba(16, 24, 40, .08), 0 10px 22px -12px rgba(16, 24, 40, .2);
  user-select: none; -webkit-user-select: none;
}
.zoom-label { border: 0; background: transparent; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; min-width: 54px; height: 34px; border-radius: 9px; touch-action: manipulation; }
.zoom-label.on { color: var(--accent); }

#toc {
  position: fixed; z-index: 22; top: calc(var(--safe-t) + var(--tb-h) + 18px); left: calc(var(--safe-l) + 10px); bottom: calc(var(--safe-b) + 10px);
  width: min(320px, calc(100vw - 20px)); display: flex; flex-direction: column;
  background: rgba(252, 252, 251, .97); border: 0; border-radius: 17px;
  -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px); box-shadow: 0 0 0 1px rgba(16, 24, 40, .06), 0 2px 4px -2px rgba(16, 24, 40, .08), 0 10px 22px -12px rgba(16, 24, 40, .2); overflow: hidden;
}
.toc-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 8px 8px 16px; border-bottom: 1px solid var(--line); }
.toc-list { overflow-y: auto; padding: 6px; -webkit-overflow-scrolling: touch; }
.toc-item { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 8px 10px; border-radius: 8px; font-size: 14px; line-height: 1.35; }
.toc-item:hover { background: var(--hover); }
.toc-item.lv1 { font-weight: 700; }
.toc-item.lv2 { font-weight: 600; }
.toc-item.lv3 { padding-left: 24px; color: var(--ink-2); font-size: 13.5px; }

/* ───────────── popover, menu, finestre ───────────── */
.pop {
  position: fixed; z-index: 60; width: 300px; padding: 14px;
  background: rgba(252, 252, 251, .97); border: 1px solid var(--line); border-radius: 15px;
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .06), 0 16px 40px rgba(0, 0, 0, .16);
  animation: pop-in .14s ease-out;
}
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.pop h4 { margin: 2px 0 10px; font-size: 13px; color: var(--muted); font-weight: 600; }
.pop h4:not(:first-child) { margin-top: 16px; }
.pop .hint { font-size: 12.5px; color: var(--muted); line-height: 1.45; margin: 12px 2px 0; }
.range { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 8px; margin-bottom: 10px; font-size: 14px; }
.range output { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.range input { grid-column: 1 / -1; width: 100%; accent-color: var(--accent); height: 28px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { border: 1px solid var(--line-2); background: transparent; border-radius: 999px; padding: 6px 12px; font-size: 13px; touch-action: manipulation; }
.menu { padding: 6px; width: 270px; }
.menu > button, .menu .toggle {
  display: flex; align-items: center; gap: 12px; width: 100%; border: 0; background: transparent;
  text-align: left; padding: 9px 10px; border-radius: 9px; touch-action: manipulation; font-size: 14.5px;
}
.menu > button:hover, .menu .toggle:hover { background: var(--hover); }
.menu > button > svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.menu span { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.menu b { font-weight: 500; font-size: 14.5px; }
.menu small { color: var(--muted); font-size: 12px; }
.menu .danger, .menu .danger svg { color: var(--danger); }
.menu .hint { margin: 6px 10px; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 5px 6px; }
.menu .menu-label { font-size: 12.5px; color: var(--muted); padding: 6px 10px 2px; }
.menu .cat-ic { width: 18px; height: 18px; border-radius: 5px; }
.menu .cat-ic svg { width: 11px; height: 11px; }
.menu > button.checked::after { content: "✓"; color: var(--accent); font-weight: 600; }
.toggle input { width: 20px; height: 20px; accent-color: var(--accent); }

.modal-wrap { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 20px; background: rgba(20, 24, 28, .28); animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal {
  width: min(460px, 100%); max-height: calc(100vh - 40px); overflow-y: auto;
  background: #fbfbfa; border-radius: 20px; padding: 24px; box-shadow: 0 30px 80px rgba(0, 0, 0, .25);
  animation: pop-in .16s ease-out;
}
.modal.wide { width: min(620px, 100%); }
.modal h2 { margin: 0 0 6px; font-size: 21px; letter-spacing: -.01em; }
.modal .sub { margin: 0 0 18px; color: var(--muted); line-height: 1.45; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.colors { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.colors button { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--c); position: relative; }
.colors button.on::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; box-shadow: 0 0 0 2px var(--c); }
.icons { display: grid; grid-template-columns: repeat(auto-fill, 40px); gap: 6px; margin-bottom: 4px; }
.icons button { width: 40px; height: 40px; border-radius: 10px; border: 0; background: var(--hover); display: grid; place-items: center; color: var(--ink-2); }
.icons button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icons button.on { background: var(--c); color: #fff; }
.tabs { display: flex; gap: 4px; margin: 0 0 18px; }
.set-section { margin-bottom: 22px; }
.set-section h3 { font-size: 15px; margin: 0 0 10px; }
.invite-list { display: grid; gap: 6px; margin-top: 10px; }
.invite { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px; background: #fff; border: 1px solid var(--line); }
.invite code { font-family: var(--font); font-weight: 600; font-size: 15px; letter-spacing: .04em; font-variant-numeric: tabular-nums; }
.invite small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.invite .acts { display: flex; gap: 2px; }
.invite.used { opacity: .7; }
.inline { display: flex; gap: 8px; align-items: flex-end; }
.inline .field { flex: 1; margin: 0; }
.bg-options { display: flex; gap: 8px; flex-wrap: wrap; }

#toast {
  position: fixed; z-index: 90; left: 50%; bottom: calc(var(--safe-b) + 24px);
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: #1d2127; color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .25); transition: opacity .2s, transform .2s;
  max-width: calc(100vw - 32px); text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ───────────── animazioni ───────────── */
@keyframes drawer-in { from { opacity: 0; transform: translateX(-16px); } }
@keyframes card-in { from { opacity: 0; transform: translateY(12px) scale(.985); } }
@keyframes swap-in { from { opacity: 0; transform: translateY(-5px) scale(.98); } }
@keyframes tool-pop { 0% { transform: scale(1); } 35% { transform: scale(.82) rotate(-8deg); } 70% { transform: scale(1.12) rotate(3deg); } 100% { transform: scale(1); } }
#sections.enter .card, #sections.enter .row, #sections.enter .sec-head { animation: card-in .45s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i, 0) * 35ms); }
.optbar.swap > * { animation: swap-in .28s cubic-bezier(.2, .8, .2, 1) both; }
.optbar.swap > *:nth-child(2) { animation-delay: .02s; } .optbar.swap > *:nth-child(3) { animation-delay: .04s; }
.optbar.swap > *:nth-child(4) { animation-delay: .06s; } .optbar.swap > *:nth-child(5) { animation-delay: .08s; }
.optbar.swap > *:nth-child(6) { animation-delay: .1s; } .optbar.swap > *:nth-child(n+7) { animation-delay: .12s; }
.tools { position: relative; }
.tool { position: relative; z-index: 1; transition: color .2s, transform .12s; }
.tool:active { transform: scale(.9); }
.tool[aria-pressed="true"] { background: transparent !important; box-shadow: none !important; }
.tool[aria-pressed="true"] svg { animation: tool-pop .45s cubic-bezier(.3, 1.4, .5, 1); }
.tool-ind {
  position: absolute; z-index: 0; top: 3px; left: 0; height: calc(100% - 6px); width: 44px; border-radius: 10px;
  background: linear-gradient(#fff, #fbfbfb); box-shadow: var(--raise); pointer-events: none;
  transition: transform .42s cubic-bezier(.3, 1.25, .4, 1), width .42s cubic-bezier(.3, 1.25, .4, 1), opacity .2s;
}
.tool-ind.instant { transition: none; }
.zoom-label { transition: color .2s; }
.star-pop { animation: tool-pop .45s; }

/* impostazioni: sezioni separate, piano e consumi */
.modal .set-section { margin: 0; padding: 20px 0; }
.modal .set-section + .set-section { border-top: 1px solid var(--line); }
.modal .set-section:first-of-type { padding-top: 6px; }
.modal .modal-actions { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 4px; }
.plan-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.plan-head h3 { margin: 0 !important; }
.plan-badge {
  font-size: 13px; font-weight: 600; color: var(--accent-ink); padding: 4px 11px; border-radius: 999px;
  background: linear-gradient(#f3f7ff, #e8f0ff); box-shadow: inset 0 1px 0 #fff, 0 0 0 1px rgba(47, 111, 222, .18);
}
.usage { display: grid; gap: 12px; }
.usage-row { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; font-size: 14px; }
.usage-row b { font-weight: 500; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.bar { grid-column: 1 / -1; height: 7px; border-radius: 999px; background: rgba(16, 24, 40, .07); box-shadow: inset 0 1px 1px rgba(16, 24, 40, .08); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(#5b93f5, #2f6fde); transition: width .5s cubic-bezier(.2, .8, .2, 1); }
.bar i.full { background: linear-gradient(#e86b62, #c4342b); }
.spam-hint { margin: -6px 0 14px; font-size: 13px; color: var(--muted); line-height: 1.45; }
