:root {
  --cork: #b4834f;
  --ink: #1f2638;
  --paper: #f3ecdc;
  --paper-edge: #d9ceb4;
  --string: #b8141c;
  --red: #b3261e;
  --ui: "Special Elite", "Courier New", monospace;
  --hand: "Caveat", "Segoe Print", "Bradley Hand", cursive;
  --news: "Old Standard TT", Georgia, "Times New Roman", serif;

  --stamp-hot: #c1121f;
  --stamp-check: #1d4e89;
  --stamp-wip: #23733a;
  --stamp-pause: #8c4506;
  --stamp-done: #5b2a86;
  --stamp-dead: #3d3a36;

  /* granuli scuri e chiari del sughero */
  --cork-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='a'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' seed='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .22 0 0 0 0 .12 0 0 0 0 .04 3.4 0 0 0 -1.75'/%3E%3C/filter%3E%3Cfilter id='b'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.6' numOctaves='2' seed='9' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .95 0 0 0 0 .78 0 0 0 0 .54 0 3.2 0 0 -1.78'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23a)'/%3E%3Crect width='240' height='240' filter='url(%23b)'/%3E%3C/svg%3E");
  /* macchie larghe */
  --cork-blotch: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='720' height='720'%3E%3Cfilter id='c'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.005' numOctaves='3' seed='5' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .2 0 0 0 0 .08 1.6 0 0 0 -.62'/%3E%3C/filter%3E%3Crect width='720' height='720' filter='url(%23c)'/%3E%3C/svg%3E");
  /* inchiostro dei timbri, consumato */
  --grunge: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' seed='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -2.6 0 0 0 2.15'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23g)'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #2a190c;
  color: var(--ink);
  font-family: var(--ui);
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { display: block; }
[hidden] { display: none !important; }

/* ---------- Sughero ---------- */

.viewport {
  --z: 1;
  --bx: 0px;
  --by: 0px;
  position: fixed;
  inset: 0;
  overflow: hidden;
  touch-action: none;
  background-color: var(--cork);
  background-image: var(--cork-grain), var(--cork-blotch);
  background-size: calc(240px * var(--z)) calc(240px * var(--z)), calc(720px * var(--z)) calc(720px * var(--z));
  background-position: var(--bx) var(--by);
}
body.panning .viewport { cursor: grabbing; }
body.stringing, body.stringing * { cursor: crosshair !important; }

.world {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;
}
.notes-layer { position: absolute; left: 0; top: 0; z-index: 0; }
.strings { position: absolute; overflow: visible; pointer-events: none; z-index: 1; }
.labels-layer { position: absolute; left: 0; top: 0; z-index: 2; }
.pins-layer { position: absolute; left: 0; top: 0; z-index: 3; }

/* cornice di legno + luce della lampada */
.frame {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  border: 14px solid #4b2f17;
  border-image: repeating-linear-gradient(115deg, #5a3a1d 0 6px, #4a2f16 6px 9px, #63401f 9px 15px, #44290f 15px 17px) 14;
  box-shadow:
    inset 0 0 0 1px rgba(255, 214, 160, .18),
    inset 0 3px 6px rgba(0, 0, 0, .55),
    inset 0 0 90px 10px rgba(30, 12, 0, .45);
}
.frame::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(130% 95% at 50% 30%, rgba(255, 225, 170, .08) 0, transparent 45%, rgba(25, 10, 0, .32) 100%);
}

/* ---------- Fogli ---------- */

.note {
  position: absolute;
  transform: rotate(var(--rot, 0deg));
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  transition: opacity .2s, filter .2s;
}
.note.dragging {
  cursor: grabbing;
  transform: rotate(var(--rot, 0deg)) scale(1.03);
}
.note.dim { opacity: .22; filter: saturate(.3); }

.paper {
  position: relative;
  min-height: 188px;
  padding: 32px 18px 24px;
  background-color: var(--bg);
  background-image: linear-gradient(165deg, rgba(255, 255, 255, .38), transparent 38%, rgba(0, 0, 0, .04) 100%);
  box-shadow:
    0 1px 1px rgba(0, 0, 0, .2),
    0 14px 18px -12px rgba(0, 0, 0, .6);
  transition: box-shadow .15s;
}
.note.dragging .paper {
  box-shadow: 0 2px 3px rgba(0, 0, 0, .2), 0 26px 30px -14px rgba(0, 0, 0, .6);
}
.note.selected .paper { outline: 2px dashed rgba(31, 38, 56, .6); outline-offset: 6px; }
.note.drop-target .paper { outline: 3px solid var(--string); outline-offset: 5px; }
.note.has-stamp .paper { padding-bottom: 46px; }

/* angolo sollevato dei post-it */
.note.postit .paper::after {
  content: "";
  position: absolute;
  z-index: -1;
  right: 8px;
  bottom: 10px;
  width: 55%;
  height: 22px;
  box-shadow: 4px 14px 12px rgba(0, 0, 0, .4);
  transform: rotate(4deg) skewX(12deg);
}

.k-yellow { --bg: #fce784; }
.k-pink   { --bg: #f8b9cc; }
.k-blue   { --bg: #b2daf0; }
.k-green  { --bg: #c6e6a3; }
.k-orange { --bg: #fbc38a; }
.k-card   { --bg: #fbfaf4; }
.k-clip   { --bg: #ece5d1; }

.note-title, .note-body {
  margin: 0;
  outline: none;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--ink);
}
.note-title {
  font: 700 29px/1 var(--hand);
  margin-bottom: 6px;
}
.note-body { font: 500 22px/1.12 var(--hand); }
.note-title:empty, .note.editing .note-title.is-empty { display: block; }
.note:not(.editing) .note-title:empty { display: none; }
.note.editing [contenteditable] { cursor: text; user-select: text; -webkit-user-select: text; }
.note.editing .is-empty::before {
  content: attr(data-ph);
  color: rgba(31, 38, 56, .38);
  pointer-events: none;
}
.note-body a {
  color: #1c3f94;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  cursor: pointer;
}

.note-meta {
  position: absolute;
  top: 9px;
  font: 11px/1 var(--ui);
  letter-spacing: .04em;
  color: rgba(31, 38, 56, .5);
  pointer-events: none;
}
.note-num { left: 13px; }
.note-date { right: 13px; }

/* scheda a righe, scritta a macchina */
.k-card .paper {
  padding: 28px 18px 24px;
  background-image: none;
}
.k-card .note-title {
  font: 15px/1.2 var(--ui);
  letter-spacing: .08em;
  text-transform: uppercase;
  padding-bottom: 7px;
  margin-bottom: 0;
  border-bottom: 1.5px solid #e08a8a;
}
.k-card .note-body {
  font: 14px/24px var(--ui);
  padding-top: 2px;
  background: repeating-linear-gradient(to bottom, transparent 0 23px, #bdd5ea 23px 24px);
}

/* legenda dei colori */
.legend-sw {
  display: inline-block;
  width: 15px;
  height: 15px;
  margin-right: 10px;
  vertical-align: -2px;
  background: var(--bg);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .35);
  transform: rotate(-5deg);
}
.legend-sw.k-card { outline: 1px solid rgba(31, 38, 56, .25); }
.legend-sw.k-clip { background-image: repeating-linear-gradient(to bottom, transparent 0 2px, rgba(29, 27, 23, .35) 2px 3px); }
.legend-blank {
  display: inline-block;
  width: 62%;
  height: 1em;
  vertical-align: -3px;
  border-bottom: 1.5px dotted rgba(31, 38, 56, .4);
}

/* ritaglio di giornale */
.note.clip { filter: drop-shadow(0 8px 7px rgba(0, 0, 0, .42)); }
.note.clip.dim { filter: drop-shadow(0 8px 7px rgba(0, 0, 0, .42)) saturate(.3); }
.k-clip .paper {
  padding: 30px 18px 24px;
  box-shadow: none;
  background-image:
    linear-gradient(180deg, rgba(120, 90, 40, .06), transparent 30%, rgba(120, 90, 40, .1)),
    var(--cork-grain);
  background-size: auto, 400px 400px;
  background-blend-mode: normal, soft-light;
}
.k-clip .note-title {
  font: 700 21px/1.08 var(--news);
  letter-spacing: -.01em;
  padding-bottom: 7px;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(29, 27, 23, .55);
  color: #1d1b17;
}
.k-clip .note-body {
  font: 14.5px/1.38 var(--news);
  text-align: justify;
  hyphens: auto;
  color: #26231d;
}
.k-clip .note-meta { font-family: var(--news); font-style: italic; }

/* timbri */
.stamp {
  position: absolute;
  right: 12px;
  bottom: 12px;
  padding: 4px 9px 2px;
  border: 2.5px solid currentColor;
  border-radius: 5px;
  font: 14px/1.1 var(--ui);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--sc);
  opacity: .85;
  transform: rotate(-8deg);
  mix-blend-mode: multiply;
  pointer-events: none;
  -webkit-mask-image: var(--grunge);
  mask-image: var(--grunge);
  -webkit-mask-size: 160px;
  mask-size: 160px;
}
.s-hot   { --sc: var(--stamp-hot); }
.s-check { --sc: var(--stamp-check); }
.s-wip   { --sc: var(--stamp-wip); }
.s-pause { --sc: var(--stamp-pause); }
.s-done  { --sc: var(--stamp-done); }
.s-dead  { --sc: var(--stamp-dead); }
.note.s-dead .paper > :not(.stamp) { opacity: .62; }
.note.s-dead .paper { filter: grayscale(.55); }

/* bigliettini: infilati sotto il bordo destro del foglio, uno sotto l'altro */
.tasks {
  position: absolute;
  z-index: -2;
  top: 22px;
  left: 100%;
  width: 186px;
  margin-left: -18px;
  display: flex;
  flex-direction: column;
}
.task {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: -4px;
  padding: 9px 8px 8px 26px;
  background-color: #fbf7ea;
  background-image: linear-gradient(172deg, rgba(255, 255, 255, .55), transparent 55%, rgba(120, 90, 40, .05));
  box-shadow: 0 1px 1px rgba(0, 0, 0, .18), 0 7px 8px -6px rgba(0, 0, 0, .55);
  font: 500 19px/1.05 var(--hand);
  transform: translateX(var(--tx, 0)) rotate(var(--tr, 0deg));
}
.task:first-child { margin-top: 0; }
.task-text {
  flex: 1;
  min-width: 0;
  padding-top: 1px;
  outline: none;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.task.done .task-text {
  color: rgba(31, 38, 56, .55);
  text-decoration: line-through;
  text-decoration-color: rgba(184, 20, 28, .8);
  text-decoration-thickness: 2px;
}
.task-check {
  flex: none;
  position: relative;
  width: 16px;
  height: 16px;
  margin-top: 2px;
  padding: 0;
  border: 1.6px solid rgba(31, 38, 56, .72);
  border-radius: 3px 2px 3px 2px;
  background: none;
  transform: rotate(-4deg);
}
.task-check svg {
  position: absolute;
  left: -1px;
  top: -6px;
  width: 21px;
  height: 21px;
  fill: none;
  stroke: var(--string);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  visibility: hidden;
}
.task.done .task-check svg { visibility: visible; }
.task-check:hover { background: rgba(31, 38, 56, .07); }
.task-del {
  flex: none;
  visibility: hidden;
  width: 20px;
  height: 20px;
  margin: -1px -2px 0 0;
  padding: 0;
  border: 0;
  background: none;
  color: rgba(31, 38, 56, .55);
  font: 18px/1 var(--ui);
}
.task-del:hover { color: var(--red); }
.task:hover .task-del { visibility: visible; }
.task.editing .task-del { visibility: hidden; }
@media (hover: none) {
  .note.selected .task-del { visibility: visible; }
}
.task.more {
  display: block;
  padding: 9px 10px 7px 26px;
  font: 12.5px/1.2 var(--ui);
  letter-spacing: .03em;
  color: rgba(31, 38, 56, .7);
  cursor: pointer;
}
.task.more:hover { color: var(--ink); background-color: #fffbef; }
.note.s-dead .tasks { filter: grayscale(.55); opacity: .75; }

/* ---------- Puntine ---------- */

.pin {
  position: absolute;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border-radius: 50%;
  cursor: crosshair;
  background:
    radial-gradient(circle at 34% 30%, rgba(255, 255, 255, .95) 0 1.6px, transparent 2.6px),
    radial-gradient(circle at 40% 36%, color-mix(in srgb, var(--pin) 55%, white) 0, var(--pin) 48%, color-mix(in srgb, var(--pin) 55%, black) 100%);
  box-shadow: 3px 5px 4px -1px rgba(0, 0, 0, .5), inset -1px -2px 3px rgba(0, 0, 0, .25);
  transition: transform .12s, opacity .2s;
}
.pin::after { content: ""; position: absolute; inset: -8px; border-radius: 50%; }
.pin:hover, .pin.active { transform: scale(1.22); }
.pin.dim { opacity: .25; }

/* ---------- Fili ---------- */

.string-line { fill: none; stroke: var(--string); stroke-width: 2.6; stroke-linecap: round; }
.string-twist { fill: none; stroke: rgba(255, 185, 185, .5); stroke-width: 1; stroke-dasharray: 1.5 3.5; stroke-linecap: round; }
.string-hit { fill: none; stroke: transparent; stroke-width: 14; pointer-events: stroke; cursor: pointer; }
.string.selected .string-line { stroke: #e3262f; stroke-width: 3.4; }
.string.dim { opacity: .15; }
.string.temp { opacity: .9; }
body.stringing .string-hit, body.stringing .string-label { pointer-events: none; }

.string-label {
  position: absolute;
  transform: translate(-50%, -50%) rotate(var(--r, -2deg));
  padding: 3px 8px 2px;
  background: var(--paper);
  border: 1px solid var(--paper-edge);
  font: 12px/1.2 var(--ui);
  white-space: nowrap;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .35);
  cursor: pointer;
  transition: opacity .2s;
}
.string-label.selected { border-color: var(--string); }
.string-label.dim { opacity: .2; }

/* ---------- Barra in alto ---------- */

.topbar {
  position: fixed;
  z-index: 10;
  top: 22px;
  left: 24px;
  right: 24px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }

.brand {
  position: relative;
  flex: none;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 14px 9px 18px;
  background: var(--paper);
  box-shadow: 0 1px 1px rgba(0, 0, 0, .2), 0 8px 12px -6px rgba(0, 0, 0, .55);
  transform: rotate(-1deg);
}
.brand::before {
  content: "";
  position: absolute;
  top: -9px;
  left: 50%;
  width: 84px;
  height: 20px;
  margin-left: -42px;
  background: rgba(238, 228, 196, .78);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .15);
  transform: rotate(2deg);
}
.brand h1 {
  margin: 0;
  font: 22px/1.1 var(--ui);
  letter-spacing: .06em;
  text-transform: uppercase;
}

/* il titolo è il nome della bacheca aperta: cliccandolo si apre l'elenco */
.board-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: min(380px, 62vw);
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  text-align: left;
}
#board-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-btn svg {
  flex: none;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.board-btn .chev { opacity: .75; transition: transform .15s; }
.board-btn[aria-expanded="true"] .chev { transform: rotate(180deg); }
.board-btn:hover .chev { opacity: 1; }
.board-btn .shared-mark { display: none; color: var(--stamp-check); }
.brand.is-shared .board-btn .shared-mark { display: block; }

.boards-pop {
  width: min(392px, calc(100vw - 32px)); /* tre azioni per riga, "Collega a Claude" e "Togli" insieme */
  max-height: min(70vh, 560px);
  overflow-y: auto;
  padding: 6px;
}
.boards-head {
  margin: 8px 8px 4px;
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(31, 38, 56, .72);
}
.boards-head:first-child { margin-top: 4px; }
.boards-head[hidden] { display: none; }
.boards-list { margin: 0; padding: 0; list-style: none; }
.board-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 38px;
  padding: 7px 10px 6px 12px;
  border: 0;
  border-left: 3px solid transparent;
  background: none;
  font-size: 14px;
  text-align: left;
}
.board-item:hover, .board-item:focus-visible { background: rgba(31, 38, 56, .08); outline: none; }
.board-item.current { border-left-color: var(--ink); background: rgba(31, 38, 56, .06); }
.board-item svg {
  flex: none;
  width: 15px;
  height: 15px;
  fill: none;
  stroke: var(--stamp-check);
  stroke-width: 2;
  stroke-linecap: round;
}
.board-item-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-item-count { font-size: 12.5px; color: rgba(31, 38, 56, .72); }
.boards-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--paper-edge);
}
.boards-actions [hidden] { display: none; }

/* lingua: due tasti come un timbro doppio, quello scelto è inchiostrato */
.lang {
  display: flex;
  flex: none;
  border: 1.5px solid var(--ink);
  border-radius: 3px;
  transform: rotate(2deg);
}
.lang button {
  min-width: 34px;
  height: 30px;
  padding: 2px 6px 0;
  border: 0;
  background: none;
  font-size: 13px;
  letter-spacing: .08em;
  color: rgba(31, 38, 56, .72);
}
.lang button + button { border-left: 1.5px solid var(--ink); }
.lang button:hover { background: rgba(31, 38, 56, .08); }
.lang button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.sub {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: rgba(31, 38, 56, .72);
  white-space: nowrap;
}
.sep { opacity: .5; }
.status::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 5px;
  border-radius: 50%;
  background: #6d8a5b;
  vertical-align: 1px;
}
.status[data-state="dirty"]::before, .status[data-state="saving"]::before, .status[data-state="opening"]::before { background: #c9962c; }
.status[data-state="error"]::before { background: var(--red); }
.status[data-state="local"]::before { background: #7a7a7a; }
.status[data-state="error"] { color: var(--red); }

.filters {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 6px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px 4px;
  border: 1px solid var(--paper-edge);
  background: var(--paper);
  font-size: 12.5px;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .35);
  transition: transform .12s, background .12s;
}
.chip:hover { transform: translateY(-1px); }
.chip b { font-weight: normal; opacity: .6; }
.chip i {
  width: 9px;
  height: 9px;
  border: 2px solid var(--sc, var(--ink));
  border-radius: 2px;
  transform: rotate(-8deg);
}
.chip.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip.active b { opacity: .8; }
.chip.active i { border-color: var(--paper); }
.chip.empty { opacity: .55; }

.tools {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.search {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 40px;
  padding: 0 11px;
  background: var(--paper);
  border: 1px solid var(--paper-edge);
  box-shadow: 0 2px 5px rgba(0, 0, 0, .35);
}
.search svg, .icon-btn svg, .add-btn svg, .tool-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-btn circle { fill: currentColor; stroke: none; }
.tool-btn circle { fill: none; }
.search svg { opacity: .6; flex: none; }
.search input {
  width: 170px;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 14px;
}
.search input::placeholder { color: rgba(31, 38, 56, .68); }
.search:focus-within { outline: 2px solid var(--ink); outline-offset: 1px; }
.match-count { font-size: 12px; opacity: .6; white-space: nowrap; }
.match-count:empty { display: none; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--paper-edge);
  background: var(--paper);
  box-shadow: 0 2px 5px rgba(0, 0, 0, .35);
}
.icon-btn:hover:not(:disabled) { background: #fff8e8; }
.icon-btn:disabled { opacity: .45; cursor: default; }

.add-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 46px;
  padding: 0 16px 0 13px;
  border: 0;
  background: #fce784;
  background-image: linear-gradient(165deg, rgba(255, 255, 255, .4), transparent 45%);
  font: 700 24px/1 var(--hand);
  box-shadow: 0 1px 1px rgba(0, 0, 0, .2), 0 10px 12px -7px rgba(0, 0, 0, .6);
  transform: rotate(1.5deg);
  transition: transform .12s;
}
.add-btn:hover { transform: rotate(0deg) translateY(-1px); }
.add-btn svg { width: 20px; height: 20px; stroke-width: 2.4; }

:is(button, input):focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.search input:focus-visible { outline: none; }

.icon-btn.danger:hover:not(:disabled) { color: var(--red); }

/* ---------- Conferma: un foglio battuto a macchina sopra la bacheca ---------- */

.confirm {
  width: min(420px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 1px 1px rgba(0, 0, 0, .2), 0 22px 40px -12px rgba(0, 0, 0, .7);
  transform: rotate(-.6deg);
}
.confirm.wide { width: min(540px, calc(100vw - 32px)); }
.claude-dlg { width: min(580px, calc(100vw - 32px)); transform: rotate(-.3deg); }
.claude-dlg p { margin-bottom: 14px; }
.copy-row { margin-bottom: 12px; }
.claude-dlg .copy-label { margin: 0 0 5px; font-size: 12.5px; line-height: 1.4; color: rgba(31, 38, 56, .8); }
.copy-field { display: flex; align-items: stretch; gap: 6px; }
.copy-text {
  flex: 1;
  min-width: 0;
  padding: 9px 10px 8px;
  border: 1px solid var(--paper-edge);
  background: #fffaf0;
  font: 12.5px/1.45 var(--ui);
  word-break: break-all;
  user-select: all;
}
.copy-field button {
  flex: none;
  align-self: flex-start;
  min-width: 82px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--ink);
  background: none;
  font-size: 13px;
}
.copy-field button:hover { background: rgba(31, 38, 56, .08); }
.copy-field button.done { background: var(--ink); color: var(--paper); }
.claude-dlg .copy-note { margin: -4px 0 14px; font-size: 12.5px; color: rgba(31, 38, 56, .8); }
.confirm::backdrop { background: rgba(20, 11, 4, .55); }
.confirm form { padding: 22px 22px 18px; }
.confirm h2 {
  margin: 0 0 10px;
  font: 20px/1.2 var(--ui);
  letter-spacing: .04em;
  text-transform: uppercase;
}
.confirm p { margin: 0 0 20px; font-size: 14.5px; line-height: 1.5; }
.confirm-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; }
.confirm-actions button {
  min-height: 40px;
  padding: 8px 14px 7px;
  border: 1px solid var(--paper-edge);
  background: #fffaf0;
  font-size: 14px;
}
.confirm-actions button:hover { background: #fff8e8; }
.confirm .confirm-ok { border-color: var(--red); background: var(--red); color: #fff; }
.confirm .confirm-ok:hover { background: #962019; }
.confirm .confirm-ok.primary { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.confirm .confirm-ok.primary:hover { background: #2d3750; }
.confirm .confirm-alt { border-color: var(--ink); }
.confirm .confirm-extra.danger { border-color: var(--red); color: var(--red); }
.confirm .confirm-extra.danger:hover { background: rgba(179, 38, 30, .08); }
.confirm.many .confirm-actions { display: grid; grid-template-columns: 1fr 1fr; }
/* quattro scelte: tutte uguali (come Nuova bacheca), solo Sovrascrivi in rosso */
.confirm.many .confirm-cancel,
.confirm.many .confirm-ok.primary { border-color: var(--ink); background: #fffaf0; color: var(--ink); }
.confirm.many .confirm-cancel:hover,
.confirm.many .confirm-ok.primary:hover { background: #fff8e8; }
@media (max-width: 520px) {
  .confirm.many .confirm-actions { grid-template-columns: 1fr; }
}
.confirm-actions button[hidden] { display: none; }
.confirm-input {
  display: block;
  width: 100%;
  height: 42px;
  margin: -6px 0 20px;
  padding: 0 11px;
  border: 1px solid var(--paper-edge);
  background: #fffaf0;
  font-size: 15px;
}
.confirm-input:read-only { font-size: 12.5px; color: rgba(31, 38, 56, .85); }
.confirm-input[hidden] { display: none; }
#confirm-body[hidden] { display: none; }

/* ---------- Zoom e suggerimenti ---------- */

.zoombar {
  position: fixed;
  z-index: 10;
  right: 26px;
  bottom: 26px;
  display: flex;
  gap: 6px;
}
.zoom-label {
  min-width: 62px;
  height: 40px;
  border: 1px solid var(--paper-edge);
  background: var(--paper);
  font-size: 13px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, .35);
}

/* angolo in basso a sinistra: suggerimenti e firma, uno sopra l'altro */
.corner {
  position: fixed;
  z-index: 10;
  left: 26px;
  bottom: 26px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  pointer-events: none;
}
.credit {
  margin: 0;
  padding: 5px 9px 4px;
  background: rgba(243, 236, 220, .92);
  font-size: 11.5px;
  line-height: 1.35;
  box-shadow: 0 2px 5px rgba(0, 0, 0, .3);
  transform: rotate(.5deg);
  pointer-events: auto;
}
.credit a { color: inherit; text-underline-offset: 2px; }
.hint {
  margin: 0;
  padding: 7px 11px 6px;
  background: rgba(243, 236, 220, .88);
  font-size: 12.5px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, .3);
  transform: rotate(-.6deg);
  pointer-events: none;
}

/* ---------- Pannelli flottanti ---------- */

.pop {
  position: fixed;
  z-index: 20;
  padding: 8px;
  background: var(--paper);
  border: 1px solid var(--paper-edge);
  box-shadow: 0 12px 26px rgba(0, 0, 0, .45);
}
.note-tools { display: flex; flex-direction: column; gap: 8px; max-width: calc(100vw - 24px); }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.divider { width: 1px; align-self: stretch; margin: 2px 2px; background: var(--paper-edge); }

.swatches { display: flex; gap: 5px; }
.sw {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid rgba(0, 0, 0, .18);
  background: var(--bg);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
}
.sw.k-card { background-image: repeating-linear-gradient(to bottom, transparent 0 5px, #bdd5ea 5px 6px); }
.sw.k-clip { background-image: repeating-linear-gradient(to bottom, transparent 0 3px, rgba(29, 27, 23, .35) 3px 4px); background-size: 70% 100%; background-position: center; background-repeat: no-repeat; }
.sw[aria-pressed="true"] { outline: 2px solid var(--ink); outline-offset: 2px; }

.tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  padding: 0 9px;
  border: 1px solid transparent;
  background: none;
  font-size: 13px;
}
.tool-btn:hover { background: rgba(31, 38, 56, .08); }
.tool-btn.danger { color: var(--red); }
.tool-btn svg { width: 16px; height: 16px; }

.stamps { flex-wrap: wrap; }
.stamp-opt {
  padding: 4px 7px 3px;
  border: 1.5px solid var(--sc, rgba(31, 38, 56, .35));
  border-radius: 4px;
  background: none;
  color: var(--sc, rgba(31, 38, 56, .7));
  font-size: 11.5px;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.stamp-opt:hover { background: rgba(31, 38, 56, .06); }
.stamp-opt[aria-pressed="true"] { background: var(--sc, var(--ink)); color: var(--paper); border-color: var(--sc, var(--ink)); }

.link-pop { display: flex; align-items: center; gap: 6px; }
.link-pop input {
  width: 210px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--paper-edge);
  background: #fffaf0;
  font-size: 13.5px;
}

.toast {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: 30px;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: calc(100vw - 32px);
  padding: 10px 14px 9px;
  background: var(--ink);
  color: var(--paper);
  font-size: 14px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .45);
  transform: translateX(-50%);
}
.toast button {
  padding: 4px 9px 3px;
  border: 1px solid rgba(243, 236, 220, .5);
  background: none;
  color: var(--paper);
  font-size: 13px;
}
.toast button:hover { background: rgba(243, 236, 220, .12); }

/* ---------- Schermi stretti ---------- */

@media (max-width: 1100px) {
  .topbar { flex-wrap: wrap; }
  .filters { order: 3; flex-basis: 100%; flex-wrap: nowrap; overflow-x: auto; padding: 2px 2px 8px; }
  .tools { margin-left: auto; }
}
@media (max-width: 720px) {
  .topbar { top: 18px; left: 18px; right: 18px; gap: 10px; }
  .brand h1 { font-size: 17px; }
  .search input { width: 110px; }
  .add-btn span, #redo, .hint { display: none; }
  .add-btn { padding: 0 12px; }
  .zoombar { right: 20px; bottom: 20px; }
  .corner { left: 20px; bottom: 20px; }
  .frame { border-width: 8px; }
}
@media (max-width: 520px) {
  .tools { margin-left: 0; width: 100%; }
  .search { flex: 1; }
  .search input { width: 100%; }
  .tools { gap: 6px; }
  .search { padding: 0 8px; gap: 5px; }
  .tools .icon-btn { width: 36px; }
  .add-btn { padding: 0 10px; }
  .credit { max-width: 140px; font-size: 11px; }
  .brand { width: 100%; }
  .brand-text { flex: 1; min-width: 0; }
  .sub { white-space: normal; }
  .zoombar { gap: 5px; }
  .zoombar .icon-btn { width: 36px; height: 36px; }
  .zoom-label { min-width: 50px; height: 36px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
