/* VIJA Note – vzhľad */
:root {
  --bg: #faf6ee;
  --surface: #ffffff;
  --ink: #2a1626;
  --muted: #7a6b75;
  --line: #eadfd9;
  --primary: #b02a6b;
  --primary-ink: #ffffff;
  --primary-soft: #fbe6ef;
  --danger: #b4372f;
  --radius: 12px;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.06), 0 4px 16px rgb(0 0 0 / 0.06);
  --topbar-h: 52px;
  --c-yellow: #fdf0a0;
  --c-green: #c5ebc3;
  --c-blue: #bfdff9;
  --c-pink: #f8c8dc;
  --c-orange: #fdd6b3;
  --c-purple: #dccff6;
  font-family: var(--ui-font, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif);
  color: var(--ink);
  background: var(--bg);
  background-image: var(--tex, none);
  background-blend-mode: var(--tex-blend, normal);
  -webkit-tap-highlight-color: transparent;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { min-height: 100dvh; }
a { color: var(--primary); }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
[hidden] { display: none !important; }

.c-yellow { --c: var(--c-yellow); }
.c-green { --c: var(--c-green); }
.c-blue { --c: var(--c-blue); }
.c-pink { --c: var(--c-pink); }
.c-orange { --c: var(--c-orange); }
.c-purple { --c: var(--c-purple); }

/* ---------- tlačidlá a formuláre ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 0 14px; border-radius: calc(var(--radius) * 0.8);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: #c9c3b6; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { filter: brightness(1.08); border-color: var(--primary); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost-danger { background: transparent; border-color: transparent; color: var(--danger); }
.btn-block { width: 100%; }
.btn-small { min-height: 32px; padding: 0 10px; font-size: 0.875rem; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; position: relative;
  min-width: 40px; height: 40px; padding: 0 8px; border-radius: calc(var(--radius) * 0.8); border: 0;
  background: transparent; color: var(--ink); font-size: 1.2rem; cursor: pointer; text-decoration: none;
}
.icon-btn:hover { background: rgb(0 0 0 / 0.05); }
input, select, textarea {
  font: inherit; color: inherit; width: 100%;
  border: 1px solid var(--line); border-radius: calc(var(--radius) * 0.8); background: var(--surface);
  padding: 9px 11px; min-height: 42px;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, .icon-btn:focus-visible {
  outline: 2px solid var(--primary); outline-offset: 1px;
}
label { display: grid; gap: 5px; font-size: 0.875rem; color: var(--muted); }
label > input, label > select, label > textarea { color: var(--ink); font-size: 1rem; }
.form-error { color: var(--danger); font-size: 0.9rem; }

/* ---------- horná lišta ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  height: calc(var(--topbar-h) + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 12px 0;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.topbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; background: linear-gradient(90deg, #ff9a3c, #ff4f7b 38%, #a63fd1 70%, #3a78d1); pointer-events: none; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--ink); text-decoration: none; }
.brand img { height: 28px; width: auto; }
.mainnav { display: flex; gap: 4px; margin-left: 8px; }
.mainnav a { padding: 8px 12px; border-radius: calc(var(--radius) * 0.8); color: var(--muted); text-decoration: none; font-weight: 500; }
.mainnav a.active { background: var(--primary-soft); color: var(--primary); }
.viewer-title { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .timer-wrap { margin-left: auto; position: relative; }
.usermenu { margin-left: 0; position: relative; }
.usermenu summary {
  list-style: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: var(--primary); color: #fff; font-weight: 700; cursor: pointer;
}
.usermenu summary::-webkit-details-marker { display: none; }
.usermenu-pop {
  position: absolute; right: 0; top: 44px; min-width: 220px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  display: grid;
}
.usermenu-pop a, .usermenu-pop button {
  display: block; text-align: left; padding: 10px 12px; border-radius: calc(var(--radius) * 0.8); border: 0; background: none;
  font: inherit; color: var(--ink); text-decoration: none; cursor: pointer; width: 100%;
}
.usermenu-pop a:hover, .usermenu-pop button:hover { background: var(--bg); }
.usermenu-name { padding: 8px 12px; color: var(--muted); font-size: 0.875rem; border-bottom: 1px solid var(--line); margin-bottom: 4px; }

.flash { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 50; display: grid; gap: 6px; }
.flash > div { background: var(--surface); border: 1px solid var(--line); padding: 10px 16px; border-radius: calc(var(--radius) * 0.8); box-shadow: var(--shadow); }
.flash-error { border-color: var(--danger) !important; color: var(--danger); }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  background: #233; color: #fff; padding: 11px 18px; border-radius: calc(var(--radius) * 0.8); opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; z-index: 100; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast-error { background: var(--danger); }
.toast-ok { background: var(--primary); }

/* ---------- dialóg ---------- */
.dlg {
  border: 0; border-radius: calc(var(--radius) * 1.4); padding: 0; width: min(460px, calc(100vw - 24px));
  box-shadow: 0 10px 40px rgb(0 0 0 / 0.25); color: var(--ink);
}
.dlg::backdrop { background: rgb(20 30 28 / 0.35); }
.dlg form { display: grid; gap: 14px; padding: 20px; }
.dlg h2 { margin: 0; font-size: 1.15rem; word-break: break-word; }
.dlg-body { margin: 0; color: var(--muted); font-style: italic; max-height: 30vh; overflow: auto; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.dlg-extra { margin-right: auto; }

/* ---------- prihlásenie ---------- */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.page-plain .auth, body:not(.page-library) .auth { min-height: calc(100dvh - var(--topbar-h)); }
.auth-card {
  width: min(380px, 100%); background: var(--surface); border-radius: calc(var(--radius) * 1.4); padding: 28px;
  box-shadow: var(--shadow); display: grid; gap: 14px;
}
.auth-card h1 { margin: 0; text-align: center; }
.auth-card p { margin: 0; text-align: center; }
.auth-logo { display: block; margin: 0 auto 6px; max-width: 70%; height: auto; }

/* ---------- knižnica ---------- */
.library { display: grid; grid-template-columns: 260px 1fr; min-height: calc(100dvh - var(--topbar-h)); }
.sidebar { background-color: var(--side-bg, var(--surface)); background-image: var(--side-tex, none); background-blend-mode: var(--side-blend, normal); border-right: 1px solid var(--line); padding: 12px 8px; overflow: auto; }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 0 8px 8px; color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: .04em; }
.tree { display: grid; gap: 1px; }
.tree-row { display: flex; align-items: center; padding-left: calc(var(--depth, 0) * 16px); border-radius: calc(var(--radius) * 0.8); }
.tree-row.active, .tree > a.tree-item.active { background: var(--primary-soft); }
.tree-item { flex: 1; display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 10px; border-radius: calc(var(--radius) * 0.8); color: var(--ink); text-decoration: none; min-width: 0; }
.tree-row:hover, .tree > a.tree-item:hover { background: var(--bg); }
.tree-row.active:hover { background: var(--primary-soft); }
.tree-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-more { border: 0; background: none; width: 34px; height: 34px; border-radius: calc(var(--radius) * 0.8); cursor: pointer; color: var(--muted); font-size: 1.1rem; opacity: .6; }
.tree-row:hover .tree-more, .tree-row.active .tree-more { opacity: 1; }
.lib-main { padding: 16px 20px 40px; min-width: 0; position: relative; }
.lib-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.crumbs { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 1.1rem; flex: 1; min-width: 160px; flex-wrap: wrap; }
.crumbs a { color: var(--ink); text-decoration: none; }
.crumbs a:last-child { color: var(--primary); }
.crumbs .sep { color: var(--muted); }
.search { max-width: 260px; }
.upload-btn { cursor: pointer; }
.only-mobile { display: none; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin-bottom: 18px; }
.tile {
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center;
  text-align: left; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  font: inherit; color: var(--ink); cursor: pointer; min-height: 62px;
}
.tile:hover { border-color: var(--primary); }
.tile-icon { grid-row: span 2; font-size: 1.5rem; }
.tile-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-meta { color: var(--muted); font-size: 0.8rem; }
.tile-new { border-style: dashed; color: var(--muted); background: transparent; grid-template-rows: auto; }
.tile-new .tile-icon { grid-row: auto; }
.tile-new .tile-name { font-weight: 500; }
.doclist { display: grid; gap: 8px; }
.doc { display: flex; align-items: center; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding-right: 6px; }
.doc:hover { border-color: #c9c3b6; }
.doc-main { flex: 1; display: flex; align-items: center; gap: 12px; padding: 12px 14px; color: var(--ink); text-decoration: none; min-width: 0; }
.doc-icon { font-size: 1.6rem; }
.doc-text { display: grid; min-width: 0; }
.doc-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-meta { color: var(--muted); font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { padding: 28px; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }
.empty.small { padding: 16px; font-size: 0.9rem; }
.uploads { display: grid; gap: 8px; margin-bottom: 12px; }
.upload { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: calc(var(--radius) * 0.8); }
.upload progress { grid-column: 1 / -1; width: 100%; height: 6px; accent-color: var(--primary); }
.upload-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-status { color: var(--muted); font-size: 0.85rem; }
.upload-error { border-color: var(--danger); }
.upload-error .upload-status { color: var(--danger); }
.drop-hint { display: none; position: fixed; inset: 12px; border: 3px dashed var(--primary); border-radius: calc(var(--radius) * 1.4); background: rgb(227 239 237 / 0.85); z-index: 40; place-items: center; font-size: 1.4rem; font-weight: 600; color: var(--primary); pointer-events: none; }
body.dragging .drop-hint { display: grid; }

@media (max-width: 760px) {
  .library { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 35; top: var(--topbar-h); bottom: 0; left: 0; width: 82vw; max-width: 320px; transform: translateX(-105%); transition: transform .2s; box-shadow: var(--shadow); }
  body.sidebar-open .sidebar { transform: none; }
  .only-mobile { display: inline-flex; }
  .lib-main { padding: 12px; }
  .search { max-width: none; order: 5; flex-basis: 100%; }
  .mainnav { margin-left: 0; }
  .brand span { display: none; }
}

/* ---------- prehliadač ---------- */
body.page-viewer { overflow: hidden; }
.page-viewer .mainnav { display: none; }
.vtoolbar {
  position: fixed; z-index: 25; left: 0; right: 0; top: calc(var(--topbar-h) + env(safe-area-inset-top));
  display: flex; align-items: center; gap: 6px; padding: 6px 10px; min-height: 54px;
  background: var(--surface); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none;
}
.tool-group { display: flex; gap: 2px; background: var(--bg); padding: 3px; border-radius: var(--radius); }
.tool {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border: 0; border-radius: calc(var(--radius) * 0.8);
  background: transparent; font: inherit; color: var(--muted); cursor: pointer; white-space: nowrap;
}
.tool.active { background: var(--surface); color: var(--primary); box-shadow: 0 1px 3px rgb(0 0 0 / 0.12); font-weight: 600; }
.tool-ico { font-size: 1.05rem; }
.color-group { display: flex; gap: 4px; padding: 0 4px; }
.spacer { flex: 1; }
.pageind { min-width: 84px; height: 36px; border: 1px solid var(--line); background: var(--surface); border-radius: calc(var(--radius) * 0.8); font: inherit; cursor: pointer; font-variant-numeric: tabular-nums; }
.badge { position: absolute; top: 2px; right: 0; min-width: 18px; padding: 0 5px; border-radius: calc(var(--radius) * 0.8); background: var(--primary); color: #fff; font-size: 0.7rem; line-height: 18px; }
.badge:empty { display: none; }
.cdot {
  width: 30px; height: 30px; border-radius: 50%; border: 2px solid #fff; background: var(--c); cursor: pointer;
  box-shadow: 0 0 0 1px var(--line); flex: none; padding: 0;
}
.cdot.active { box-shadow: 0 0 0 2px var(--ink); }
.viewer-wrap { position: fixed; left: 0; right: 0; bottom: 0; top: calc(var(--topbar-h) + var(--vtb-h, 54px) + env(safe-area-inset-top)); display: flex; }
.viewer-container { position: absolute; inset: 0; overflow: auto; background: #e9e6df; touch-action: pan-x pan-y; }
body.panel-open .viewer-container { right: 340px; }
.pdfViewer { transform-origin: top center; }
.pdfViewer .page { box-shadow: 0 1px 4px rgb(0 0 0 / 0.15); }
body[data-tool="marker"] .viewer-container { touch-action: none; cursor: crosshair; }
body[data-tool="marker"] .textLayer span { cursor: crosshair; }
body[data-tool="note"] .viewer-container .page { cursor: copy; }
body.marking .textLayer ::selection { background: color-mix(in srgb, var(--mark-color) 85%, transparent); }

.vija-layer { position: absolute; inset: 0; pointer-events: none; z-index: 4; mix-blend-mode: multiply; }
.hl { position: absolute; border-radius: 2px; }
.hl.highlight { background: var(--c); }
.hl.underline { border-bottom: 2.5px solid var(--c); filter: saturate(3) brightness(0.8); }
.hl.flash, .note-pin.flash { animation: flash 1.2s ease 2; }
@keyframes flash { 50% { opacity: 1; box-shadow: 0 0 0 4px var(--c); } }
.comment-dot { position: absolute; transform: translate(-30%, -70%); font-size: 13px; filter: drop-shadow(0 1px 1px rgb(0 0 0 / 0.3)); }
.note-pin {
  position: absolute; pointer-events: auto; transform: translate(-50%, -50%);
  width: 34px; height: 34px; border-radius: calc(var(--radius) * 0.8); border: 0; background: var(--c); cursor: pointer;
  box-shadow: 0 2px 6px rgb(0 0 0 / 0.3); font-size: 16px; display: grid; place-items: center; padding: 0;
}

.seltools {
  position: fixed; z-index: 45; display: flex; align-items: center; gap: 6px; padding: 6px 8px;
  background: var(--surface); border-radius: var(--radius); box-shadow: 0 6px 24px rgb(0 0 0 / 0.22);
}
.seltools-colors { display: flex; gap: 5px; }
.seltool { width: 36px; height: 36px; border: 0; border-radius: calc(var(--radius) * 0.8); background: var(--bg); cursor: pointer; font-size: 1rem; }

.anpanel {
  position: absolute; top: 0; right: 0; bottom: 0; width: 340px; background: var(--surface); border-left: 1px solid var(--line);
  display: flex; flex-direction: column; transform: translateX(100%); transition: transform .2s; z-index: 20;
}
body.panel-open .anpanel { transform: none; }
.anpanel-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.anpanel-head strong { flex: 1; }
.anlist { overflow: auto; padding: 8px 12px 40px; display: grid; gap: 8px; align-content: start; }
.anlist-page { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-top: 8px; }
.ancard { position: relative; padding: 10px 34px 10px 12px; border-radius: calc(var(--radius) * 0.8); background: var(--bg); border-left: 5px solid var(--c); cursor: pointer; }
.ancard:hover { background: #efece5; }
.ancard-quote { font-size: 0.92rem; line-height: 1.4; }
.ancard-kind { font-weight: 600; font-size: 0.9rem; }
.ancard-comment { margin-top: 6px; font-size: 0.9rem; color: var(--primary); }
.ancard-edit { position: absolute; top: 6px; right: 4px; border: 0; background: none; width: 30px; height: 30px; cursor: pointer; color: var(--muted); border-radius: calc(var(--radius) * 0.8); }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.chip { font-size: 0.78rem; padding: 2px 8px; border-radius: calc(var(--radius) * 1.4); background: var(--primary-soft); color: var(--primary); text-decoration: none; }
.loading { position: fixed; inset: 0; display: grid; place-items: center; color: var(--muted); pointer-events: none; z-index: 15; top: 120px; }

@media (max-width: 900px) {
  body.panel-open .viewer-container { right: 0; }
  .anpanel { width: min(360px, 92vw); box-shadow: var(--shadow); }
  .tool-label { display: none; }
  .tool { padding: 0 10px; }
}
@media (max-width: 520px) {
  .color-group .cdot { width: 26px; height: 26px; }
  .pageind { min-width: 70px; }
  .brand span { display: none; }
}

/* ---------- súhrn ---------- */
.summary { max-width: 900px; margin: 0 auto; padding: 18px 16px 60px; }
.sum-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: space-between; }
.sum-head h1 { margin: 0; font-size: 1.5rem; }
.sum-export { display: flex; gap: 8px; flex-wrap: wrap; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin: 16px 0 10px; padding: 14px; background: var(--surface); border-radius: var(--radius); border: 1px solid var(--line); align-items: end; }
.filter-colors { display: flex; gap: 6px; align-items: center; min-height: 42px; }
.seg { display: inline-flex; background: var(--bg); padding: 3px; border-radius: var(--radius); min-height: 42px; }
.seg button { white-space: nowrap; flex: 1; border: 0; background: none; border-radius: calc(var(--radius) * 0.8); font: inherit; color: var(--muted); cursor: pointer; padding: 0 10px; }
.seg button.active { background: var(--surface); color: var(--primary); font-weight: 600; box-shadow: 0 1px 3px rgb(0 0 0 / 0.12); }
.sumlist { display: grid; gap: 18px; margin-top: 10px; }
.sum-doc h2 { font-size: 1.2rem; margin: 6px 0 4px; }
.sum-doc h2 a { color: var(--ink); text-decoration: none; }
.sum-page { font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 14px 0 6px; }
.sum-item { background: var(--surface); border: 1px solid var(--line); border-left: 6px solid var(--c); border-radius: calc(var(--radius) * 0.8); padding: 12px 14px; margin-bottom: 8px; break-inside: avoid; }
.sum-quote { margin: 0; line-height: 1.55; font-size: 1rem; }
.sum-quote.faded { color: var(--muted); font-size: 0.9rem; margin-top: 6px; }
.sum-quote mark { background: var(--c); padding: 0 1px; border-radius: 2px; color: inherit; }
.sum-comment { margin: 8px 0 0; color: var(--primary); font-weight: 500; }
.sum-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.sum-open { margin-left: auto; font-size: 0.85rem; }

@media print {
  .topbar, .filters, .sum-export, .sum-open, .toast { display: none !important; }
  body { background: #fff; }
  .sum-item { border-color: #ccc; }
}

/* ---------- ručné písmo na lístky (písma: fonts.css) ---------- */

/* ---------- pero ---------- */
.ink-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.ink-svg path.flash { animation: flash-ink 1.2s ease 2; }
@keyframes flash-ink { 50% { opacity: .3; } }
.pen-options { display: flex; align-items: center; gap: 6px; }
.seg-small { min-height: 36px; }
.seg-small button { padding: 0 9px; display: grid; place-items: center; }
.wdot { display: block; width: var(--s); height: var(--s); border-radius: 50%; background: currentColor; }
.toggle-btn { opacity: .55; }
.toggle-btn.active { opacity: 1; background: var(--primary-soft); color: var(--primary); }
body[data-tool="pen"] .viewer-container, body[data-tool="eraser"] .viewer-container { touch-action: none; }
body[data-tool="pen"] .textLayer, body[data-tool="eraser"] .textLayer { pointer-events: none; }
body[data-tool="pen"] .viewer-container .page { cursor: crosshair; }
body[data-tool="eraser"] .viewer-container .page { cursor: cell; }
.cdot.small { width: 26px; height: 26px; }
.ink-count { margin-top: 10px; }

/* ---------- lepiace lístky ---------- */
.vija-notes { position: absolute; inset: 0; pointer-events: none; z-index: 6; }
body.hide-notes .vija-notes { display: none; }
.sticky {
  position: relative; width: 160px; aspect-ratio: 1; container-type: inline-size; isolation: isolate;
  transform: rotate(var(--rot, 0deg)); transform-origin: 50% 40%;
  filter: drop-shadow(0 1px 1.5px rgb(0 0 0 / 0.22)) drop-shadow(0 3px 6px rgb(0 0 0 / 0.10));
  --curl: 13%; --lift: 1; --flap: #e9d777; --paper: #fdf0a0; --note-ink: #2a2a2a;
}
.sticky.on-page { position: absolute; width: 20%; pointer-events: auto; cursor: grab; touch-action: none; }
.sticky.on-page.dragging { cursor: grabbing; z-index: 10; filter: drop-shadow(0 6px 10px rgb(0 0 0 / 0.3)); }
.sticky-paper {
  position: absolute; inset: 0; background: var(--paper); overflow: hidden;
  /* papier s jemným tieňovaním hore (lepiaci pásik) */
  box-shadow: inset 0 11cqw 9cqw -10cqw rgb(0 0 0 / 0.07);
}
.sticky.side-r .sticky-paper {
  -webkit-mask: linear-gradient(to top left, transparent calc(var(--curl) / 2), #000 calc(var(--curl) / 2));
  mask: linear-gradient(to top left, transparent calc(var(--curl) / 2), #000 calc(var(--curl) / 2));
}
.sticky.side-l .sticky-paper {
  -webkit-mask: linear-gradient(to top right, transparent calc(var(--curl) / 2), #000 calc(var(--curl) / 2));
  mask: linear-gradient(to top right, transparent calc(var(--curl) / 2), #000 calc(var(--curl) / 2));
}
.sticky-flap { position: absolute; bottom: 0; width: var(--curl); height: var(--curl); z-index: 2; }
.sticky.side-r .sticky-flap {
  right: 0;
  background: linear-gradient(to bottom right, color-mix(in srgb, var(--flap) 82%, #000) 0%, var(--flap) 28%, color-mix(in srgb, var(--flap) 55%, #fff) 49%, transparent 50%);
  filter: drop-shadow(-0.5cqw -0.5cqw 0.6cqw rgb(0 0 0 / 0.18));
}
.sticky.side-l .sticky-flap {
  left: 0;
  background: linear-gradient(to bottom left, color-mix(in srgb, var(--flap) 82%, #000) 0%, var(--flap) 28%, color-mix(in srgb, var(--flap) 55%, #fff) 49%, transparent 50%);
  filter: drop-shadow(0.5cqw -0.5cqw 0.6cqw rgb(0 0 0 / 0.18));
}
/* tieň pod nadvihnutým rohom */
.sticky-lift {
  position: absolute; bottom: 5%; width: 42%; height: 10%; z-index: -1;
  box-shadow: 0 calc(2.2cqw * var(--lift)) calc(3.2cqw * var(--lift)) rgb(0 0 0 / 0.28);
}
.sticky.side-r .sticky-lift { right: 4%; transform: rotate(calc(3deg * var(--lift))) skewX(25deg); }
.sticky.side-l .sticky-lift { left: 4%; transform: rotate(calc(-3deg * var(--lift))) skewX(-25deg); }
.sticky-text {
  position: absolute; inset: 9cqw 8cqw 10cqw 9cqw; margin: 0; padding: 0; border: 0; background: transparent;
  font-family: var(--hand-font, "Caveat"), "Segoe Print", "Bradley Hand", cursive; font-weight: var(--hand-weight, 500); font-size: calc(11cqw * var(--hand-scale, 1)); line-height: 1.05;
  color: var(--note-ink); white-space: pre-wrap; overflow: hidden; overflow-wrap: anywhere; resize: none; outline: none;
  min-height: 0; width: auto; border-radius: 0;
}
textarea.sticky-text:focus { outline: none; }
.sticky-ink { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.sticky.drawing .sticky-ink { pointer-events: auto; touch-action: none; cursor: crosshair; }
.sticky.drawing textarea.sticky-text { pointer-events: none; }

/* editor lístka */
.note-editor { width: min(440px, calc(100vw - 16px)); }
.note-editor { padding: 18px; }
.note-editor > * + * { margin-top: 12px; }
.ne-stage { display: grid; place-items: center; padding: 8px 0 14px; background: radial-gradient(circle at 50% 40%, #faf8f3, #ece8df); border-radius: var(--radius); }
.sticky.big { width: min(300px, 74vw); }
.ne-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ne-pens { display: flex; align-items: center; gap: 6px; }
.ne-label { font-size: 0.875rem; color: var(--muted); }
.ne-bgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 6px; max-height: 128px; overflow: auto; padding: 2px; }
.bg-swatch {
  aspect-ratio: 1; border-radius: calc(var(--radius) * 0.8); border: 1px solid var(--line); cursor: pointer; padding: 0;
  background: var(--paper); container-type: inline-size;
}
.bg-swatch.active { outline: 3px solid var(--primary); outline-offset: 1px; }

/* lístok v súhrne */
.sum-sticky { display: flex; gap: 16px; align-items: flex-start; }
.sum-sticky .sticky { width: 150px; flex: none; margin: 4px 6px 10px; }
.sum-sticky .sum-quote { flex: 1; }
@media (max-width: 520px) { .sum-sticky { flex-direction: column; } }

/* ---------- nastavenia ---------- */
.settings { max-width: 860px; margin: 0 auto; padding: 18px 16px 60px; }
.settings h1 { margin: 0 0 6px; font-size: 1.5rem; }
.set-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-top: 16px; }
.set-card h2 { margin: 0 0 4px; font-size: 1.1rem; }
.set-card p { margin: 0 0 12px; }
.swatch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.swatch {
  display: grid; gap: 4px; justify-items: center; padding: 8px 4px; border: 1px solid var(--line); border-radius: calc(var(--radius) * 0.8);
  background: var(--surface); cursor: pointer; font: inherit; font-size: 0.8rem; color: var(--ink); position: relative;
}
.swatch .chip-c { width: 34px; height: 34px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.08); }
.swatch.on { border-color: var(--primary); background: var(--primary-soft); }
.swatch.on::after { content: "✓"; position: absolute; top: 4px; right: 7px; color: var(--primary); font-weight: 700; }
.swatch .rm { position: absolute; top: 2px; left: 4px; border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 0.9rem; }
.custom-row { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.custom-row input[type="color"] { width: 52px; height: 42px; padding: 3px; }
.order-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 12px; min-height: 36px; }
.bg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 12px; }
.bg-item { display: grid; gap: 6px; justify-items: center; padding: 10px 6px 8px; border: 1px solid var(--line); border-radius: var(--radius); background: #faf8f3; cursor: pointer; font: inherit; font-size: 0.85rem; color: var(--ink); position: relative; }
.bg-item .sticky { width: 84px; }
.bg-item.on { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary); }
.bg-item .rm { position: absolute; top: 4px; right: 6px; border: 0; background: rgb(255 255 255 / 0.85); border-radius: 6px; cursor: pointer; color: var(--danger); }
.set-saved { color: var(--primary); font-size: 0.875rem; margin-left: 8px; }

/* ---------- vložky medzi riadky ---------- */
.vija-open { position: absolute; left: 0; width: 100%; z-index: 7; background: #fff; }
.vija-seg { position: absolute; left: 0; width: 100%; overflow: hidden; pointer-events: none; }
.vija-seg-mirror { position: absolute; left: 0; }
.vija-seg-mirror .vija-layer, .vija-seg-mirror .vija-notes { pointer-events: none !important; }
.vija-seg-mirror .sticky { pointer-events: none !important; }
.ins-strip {
  position: absolute; left: 0; width: 100%; z-index: 2;
  box-shadow: inset 0 6px 6px -6px rgb(0 0 0 / 0.35), inset 0 -6px 6px -6px rgb(0 0 0 / 0.35);
  border-left: 4px solid #e8771a;
}
.ins-paper, .ins-preview .ins-paper {
  position: absolute; inset: 0;
  background:
    repeating-linear-gradient(to bottom, transparent 0 calc(var(--lh) - 1px), #b9cfe8 calc(var(--lh) - 1px) var(--lh)),
    #fffdf3;
}
.ins-ink { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.ins-text {
  position: absolute; inset: 0 70px 0 3%; margin: 0; padding: 0; border: 0; background: transparent;
  font: inherit; font-family: var(--hand-font, "Caveat"), "Segoe Print", cursive; font-weight: var(--hand-weight, 500);
  font-size: calc(var(--lh) * 0.62 * var(--hand-scale, 1)); line-height: var(--lh); color: #1d2f4f;
  white-space: pre-wrap; overflow: hidden; pointer-events: none; resize: none; min-height: 0; width: auto; border-radius: 0;
}
textarea.ins-text.editing { pointer-events: auto; z-index: 3; outline: 2px solid rgb(232 119 26 / 0.5); outline-offset: -2px; }
.ins-tools { position: absolute; top: 2px; right: 4px; display: flex; gap: 2px; z-index: 4; }
.ins-btn {
  min-width: 28px; height: 26px; border: 1px solid var(--line); border-radius: 7px; background: rgb(255 255 255 / 0.92);
  cursor: pointer; font-size: 14px; padding: 0 5px; color: var(--ink); line-height: 1;
}
.ins-btn.danger { color: var(--danger); }
.ins-add { position: absolute; right: 4px; bottom: 3px; z-index: 4; font-weight: 700; color: #e8771a; }
.ins-dot {
  position: absolute; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; padding: 0;
  background: #e8771a; border: 2px solid #fff; box-shadow: 0 1px 3px rgb(0 0 0 / 0.35);
  pointer-events: auto; cursor: pointer; z-index: 8;
}
.ins-dot::after { content: ""; position: absolute; inset: -9px; } /* väčšia plocha na ťuknutie */
.ins-dot.flash { animation: flash 1.2s ease 2; }
.ins-preview { position: relative; container-type: inline-size; margin-top: 6px; max-width: 760px; border-left: 3px solid #e8771a; border-radius: 4px; overflow: hidden; }
.ins-preview > * { --lh: 3.4cqw; }
.ins-preview .ins-text { inset: 0 6px 0 3%; }
.ins-preview .ins-ink { pointer-events: none; }
.sum-insert { margin-top: 8px; }
.sum-ink-title { display: block; margin-bottom: 6px; }
.sum-ink-box { background: #fffef9; border: 1px dashed var(--line); border-radius: calc(var(--radius) * 0.8); padding: 6px; }
.sum-ink { display: block; max-height: 260px; }

/* ---------- strom z poznámok ---------- */
.view-seg { min-height: 40px; }
body.view-tree .summary { max-width: 1200px; }
.tree-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.tree-toolbar select { width: auto; min-width: 200px; max-width: 100%; }
.tree-toolbar .spacer { flex: 1; }
.tree-help { margin: 10px 0 6px; }
.tree-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.tree-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 10px; min-height: 240px; }
.tree-box.drop-root { outline: 2px dashed var(--primary); outline-offset: -4px; }
.tree-ul { list-style: none; margin: 0; padding: 0 0 0 22px; position: relative; }
.tree-ul.root { padding-left: 0; }
.tree-ul:not(.root)::before { content: ""; position: absolute; left: 11px; top: 0; bottom: 14px; border-left: 2px solid #ddd6c8; }
.tn { position: relative; }
.tree-ul:not(.root) > .tn::before { content: ""; position: absolute; left: -11px; top: 19px; width: 10px; border-top: 2px solid #ddd6c8; }
.tn-row {
  display: flex; align-items: flex-start; gap: 4px; padding: 6px 6px 6px 2px; margin: 2px 0; border-radius: calc(var(--radius) * 0.8);
  border: 1px solid transparent; border-left: 4px solid var(--c, transparent); cursor: pointer; background: var(--surface);
}
.tn-row:hover { background: var(--bg); }
.tn-row.selected { border-color: var(--primary); background: var(--primary-soft); }
.tn-row.is-topic { border-left-color: var(--primary); }
.tn-row.drop-before { box-shadow: 0 -3px 0 var(--primary); }
.tn-row.drop-after { box-shadow: 0 3px 0 var(--primary); }
.tn-row.drop-inside { outline: 2px solid var(--primary); background: var(--primary-soft); }
.tn-toggle { width: 26px; height: 26px; flex: none; border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 0.9rem; }
.tn-toggle.leaf { cursor: default; opacity: .5; }
.tn-handle { flex: none; width: 22px; height: 26px; display: grid; place-items: center; color: var(--muted); cursor: grab; touch-action: none; user-select: none; }
.tn-body { flex: 1; min-width: 0; padding-top: 3px; line-height: 1.4; }
.tn-topic { font-weight: 700; font-size: 1.02rem; }
.tn-count { color: var(--muted); font-weight: 400; font-size: 0.85rem; }
.tn-icon { margin-right: 4px; }
.tn-comment { color: var(--primary); }
.tn-src { color: var(--muted); font-size: 0.8rem; }
.tn-missing { color: var(--muted); font-style: italic; }
.tn-actions { display: flex; gap: 2px; flex: none; opacity: .35; }
.tn-row:hover .tn-actions, .tn-row.selected .tn-actions { opacity: 1; }
.tn-btn { min-width: 28px; height: 28px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); cursor: pointer; font-size: 0.9rem; padding: 0 4px; }
.tn-btn.danger { color: var(--danger); }
.tn.collapsed > .tn-row .tn-topic::after { content: " …"; color: var(--muted); }
.tn-ghost { position: fixed; z-index: 200; pointer-events: none; max-width: 280px; padding: 8px 12px; border-radius: calc(var(--radius) * 0.8); background: var(--primary); color: #fff; font-size: 0.85rem; box-shadow: var(--shadow); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tree-tray-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; position: sticky; top: 64px; max-height: calc(100dvh - 80px); overflow: auto; }
.tray-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tree-tray-wrap p { margin: 4px 0 8px; }
.tree-tray { display: grid; gap: 6px; }
.tray-item { display: flex; align-items: flex-start; gap: 4px; padding: 6px; border-radius: calc(var(--radius) * 0.8); background: var(--bg); border-left: 4px solid var(--c); font-size: 0.88rem; }
@media (max-width: 860px) {
  .tree-layout { grid-template-columns: 1fr; }
  .tree-tray-wrap { position: static; max-height: none; }
  .tn-actions { opacity: 1; flex-wrap: wrap; max-width: 96px; justify-content: flex-end; }
}
@media print {
  .view-seg, .tree-toolbar, .tree-help, .tree-tray-wrap, .tn-actions, .tn-handle { display: none !important; }
  .tree-layout { display: block; }
  .tree-box { border: 0; padding: 0; }
  .tn-row { border-color: transparent !important; background: none !important; }
}

.seg { min-width: max-content; }
.filters-wrap > summary { display: none; }
body.view-tree #fContext, body.view-tree .sum-export { display: none; }
@media (max-width: 700px) {
  .filters-wrap > summary { display: list-item; cursor: pointer; font-weight: 600; padding: 10px 14px; margin-top: 12px;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
  .filters-wrap[open] > summary { border-radius: var(--radius) var(--radius) 0 0; }
  .filters-wrap[open] .filters { margin-top: 0; border-top: 0; border-radius: 0 0 var(--radius) var(--radius); }
}
@media print { .filters-wrap { display: none !important; } }
.g-box { display: grid; gap: 10px; }
.g-box p { margin: 0; }

/* ---------- pozvánky a profil ---------- */
.prof-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.inv-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; align-items: end; }
.inv-warn { border-color: #e8b04a; background: #fff8e6; display: grid; gap: 4px; }
.inv-result { margin-top: 16px; padding: 14px; background: var(--primary-soft); border-radius: var(--radius); display: grid; gap: 10px; }
.inv-note { margin: 0; }
.inv-note.ok { color: var(--primary); font-weight: 600; }
.inv-note.err { color: var(--danger); }
.inv-preview pre { white-space: pre-wrap; font: inherit; font-size: 0.9rem; background: var(--surface); padding: 10px; border-radius: calc(var(--radius) * 0.8); }
.inv-list { display: grid; gap: 8px; }
.inv-item { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; padding: 10px 12px; background: var(--bg); border-radius: calc(var(--radius) * 0.8); }
.inv-main { flex: 1 1 220px; min-width: 0; word-break: break-word; }
.inv-acts { display: flex; gap: 6px; }
.chip-ok { background: #dff3e1; color: #1d6b2c; }
.chip-off { background: #eee; color: #777; }

/* ---------- verejné stránky ---------- */
.legal { max-width: 760px; margin: 0 auto; padding: 28px 18px 70px; line-height: 1.6; }
.legal h1 { margin: 10px 0 4px; }
.legal h2 { margin: 28px 0 6px; font-size: 1.15rem; }
.legal .lead { font-size: 1.1rem; color: var(--muted); }
.legal-logo { display: block; }
.legal code { background: #ece8df; padding: 1px 6px; border-radius: 5px; font-size: 0.9em; word-break: break-all; }
.legal ul { padding-left: 22px; }
.legal li { margin: 4px 0; }
.legal-links { text-align: center; font-size: 0.85rem; margin: 4px 0 0; }
.legal-links a { color: var(--muted); }

/* ---------- vlastné dokumenty: text a tabuľka ---------- */
.editor-wrap { position: fixed; left: 0; right: 0; bottom: 0; top: calc(var(--topbar-h) + var(--vtb-h, 54px) + env(safe-area-inset-top)); overflow: auto; background: var(--bg); padding: 12px; }
.text-wrap { position: relative; width: min(100%, 860px); margin: 0 auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.text-editor, .text-mirror {
  margin: 0; padding: 28px 32px; border: 0; border-radius: var(--radius);
  font: 1.05rem/1.7 Georgia, "Times New Roman", serif; white-space: pre-wrap; overflow-wrap: break-word; word-break: normal;
  letter-spacing: normal; tab-size: 4;
}
/* textarea sa roztiahne podľa textu (posúva sa celá strana), aby zvýraznenie pod ním sedelo na riadky */
.text-editor { position: relative; z-index: 1; display: block; width: 100%; min-height: calc(100vh - 160px); background: transparent; color: var(--ink); resize: none; overflow: hidden; }
.text-mirror { position: absolute; inset: 0; z-index: 0; overflow: hidden; color: transparent; pointer-events: none; }
.text-mirror mark { color: transparent; background: var(--c); border-radius: 3px; }
.hl-group { display: flex; align-items: center; gap: 4px; background: var(--bg); padding: 2px 6px; border-radius: var(--radius); }
.hl-label { font-size: 1.05rem; }
.text-editor:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
.table-scroll { overflow: auto; max-height: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.grid-table { border-collapse: separate; border-spacing: 0; font-size: 0.95rem; }
.grid-table th { position: sticky; top: 0; z-index: 1; background: #efece4; color: var(--muted); font-weight: 600; padding: 4px 8px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); min-width: 34px; }
.grid-table tbody th { position: sticky; left: 0; top: auto; z-index: 1; }
.grid-table th.corner { left: 0; z-index: 2; }
.grid-table td { padding: 0; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); }
.grid-table td input { width: 150px; min-width: 100%; padding: 8px 8px; border: 0; background: transparent; font: inherit; color: var(--ink); }
.grid-table td input:focus { outline: 2px solid var(--primary); outline-offset: -2px; background: var(--primary-soft); }
.save-state { font-size: 0.85rem; color: var(--muted); padding: 0 8px; }
.save-state.bad { color: var(--danger); font-weight: 600; }
.new-menu { display: grid; gap: 8px; }

/* ---------- tvary a pravítko ---------- */
.shape-options { position: relative; }
.shape-ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; vertical-align: -4px; margin-right: 4px; }
.shape-pop {
  position: fixed; z-index: 40; top: calc(var(--topbar-h) + var(--vtb-h, 54px) + 4px + env(safe-area-inset-top)); left: 12px; max-width: calc(100vw - 24px);
  display: grid; grid-template-columns: repeat(4, 86px); gap: 6px; padding: 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.shape-pop button {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; border: 1px solid var(--line);
  border-radius: calc(var(--radius) * 0.8); background: var(--surface); font: inherit; font-size: 0.72rem; color: var(--ink); cursor: pointer;
}
.shape-pop button.active { background: var(--primary-soft); border-color: var(--primary); font-weight: 600; }
.shape-pop .shape-ico { width: 30px; height: 30px; margin: 0; }
body[data-tool="shape"] .viewer-container { touch-action: none; cursor: crosshair; }
.ruler {
  position: fixed; z-index: 30; width: 440px; height: 66px; border-radius: 6px; touch-action: none; cursor: grab;
  background: linear-gradient(180deg, rgb(180 215 235 / 0.55), rgb(200 228 245 / 0.45));
  border: 1px solid rgb(60 110 150 / 0.55); box-shadow: 0 2px 8px rgb(0 0 0 / 0.15);
  background-image:
    repeating-linear-gradient(90deg, rgb(30 60 90 / 0.7) 0 1px, transparent 1px 18.9px),
    repeating-linear-gradient(90deg, rgb(30 60 90 / 0.7) 0 1px, transparent 1px 18.9px);
  background-size: 100% 9px, 100% 9px; background-position: 0 0, 0 100%; background-repeat: no-repeat;
}
.ruler[hidden] { display: none; }
.ruler::after { content: ""; position: absolute; inset: 0; border-radius: 6px; pointer-events: none;
  background: repeating-linear-gradient(90deg, rgb(30 60 90 / 0.8) 0 1.5px, transparent 1.5px 37.8px); background-size: 100% 16px; background-repeat: no-repeat; }
.ruler-rot, .ruler-close {
  position: absolute; width: 34px; height: 34px; border-radius: 50%; border: 1px solid rgb(60 110 150 / 0.7);
  background: #fff; color: #1f4f6f; font-size: 1.1rem; display: grid; place-items: center; cursor: pointer; padding: 0; touch-action: none;
}
.ruler-rot { right: 8px; top: 16px; cursor: grab; }
.ruler-close { left: 8px; top: 16px; }

/* ---------- horná lišta na tablete a telefóne: dva riadky, farby pod tlačidlom ---------- */
.tb-break, #colorBtn { display: none; }
.cdot.cur { width: 22px; height: 22px; margin-right: 4px; pointer-events: none; }
@media (max-width: 1100px) {
  .vtoolbar { flex-wrap: wrap; overflow: visible; row-gap: 2px; padding: 4px 8px; }
  .tb-break { display: block; flex-basis: 100%; height: 0; }
  .vtoolbar .spacer { flex: 1 1 8px; }
  #colorBtn:not([hidden]) { display: inline-flex; align-items: center; width: auto; padding: 0 8px; }
  #markerColors, #penOptions { display: none !important; }
  body.colors-open #markerColors:not([hidden]), body.colors-open #penOptions:not([hidden]) {
    display: flex !important; flex-wrap: wrap; align-items: center; gap: 8px; position: fixed; z-index: 40; left: 8px; right: 8px;
    top: calc(var(--topbar-h) + var(--vtb-h, 96px) + 4px + env(safe-area-inset-top));
    padding: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  }
  body.colors-open #markerColors:not([hidden]) .cdot, body.colors-open #penColors .cdot { width: 34px; height: 34px; }
  #shapeBtnName { display: none; }
}
@media (max-width: 520px) {
  .vtoolbar .icon-btn { width: 32px; min-width: 0; padding: 0; white-space: nowrap; font-size: 1rem; }
  .vtoolbar { gap: 1px; padding: 4px 6px; }
  .vtoolbar .pageind { min-width: 54px; height: 32px; padding: 0 4px; font-size: 0.85rem; }
  .vtoolbar .spacer { flex: 0 0 0; }
  #addPage { font-size: 0.8rem !important; }
  #colorBtn:not([hidden]) { width: auto; padding: 0 6px; }
  #zoomOut, #zoomIn { display: none; }
}

/* ---------- skener ---------- */
body.scanning { overflow: hidden; }
.scanner { position: fixed; inset: 0; z-index: 100; background: #111; color: #fff; display: flex; flex-direction: column; }
.scan-screen { position: absolute; inset: 0; display: flex; flex-direction: column; background: #111; }
.scan-screen.flash::after { content: ""; position: absolute; inset: 0; background: #fff; opacity: 0.7; pointer-events: none; }
.scan-top, .scan-bottom { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top)); }
.scan-bottom { padding-bottom: calc(14px + env(safe-area-inset-bottom)); padding-top: 12px; background: #111; }
.scan-video { background: #000; }
.scan-shutter { width: 68px; height: 68px; border-radius: 50%; border: 4px solid #fff; background: #fff; box-shadow: inset 0 0 0 4px #111; cursor: pointer; flex: none; }
.scan-shutter:active { transform: scale(0.94); }
.scan-count { font-weight: 600; min-width: 50px; text-align: right; }
.scan-msg { position: absolute; inset: 70px 20px auto; text-align: center; background: rgb(0 0 0 / 0.7); padding: 16px; border-radius: var(--radius); }
.btn-ghost-light { background: rgb(255 255 255 / 0.12); color: #fff; border: 1px solid rgb(255 255 255 / 0.25); }
.scan-review { background: var(--bg); color: var(--ink); }
.scan-review .scan-top { background: #111; color: #fff; }
.scan-form { display: grid; gap: 8px; padding: 10px 14px; background: var(--surface); border-bottom: 1px solid var(--line); }
.scan-form input[type=text], .scan-form select { width: 100%; max-width: 560px; }
.scan-ocr { font-size: 0.9rem; color: var(--muted); }
.scan-grid { flex: 1; overflow: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; padding: 12px; align-content: start; }
.scan-card { background: var(--surface); border: 1px solid var(--line); border-radius: calc(var(--radius) * 0.8); overflow: hidden; }
.scan-thumb { aspect-ratio: 3 / 4; display: grid; place-items: center; background: #e9e6df; overflow: hidden; }
.scan-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; transition: transform 0.15s; }
.scan-card-bar { display: flex; align-items: center; justify-content: space-between; padding: 2px 6px; font-weight: 600; }
.scan-review .scan-bottom { background: var(--surface); border-top: 1px solid var(--line); }
.scan-review .btn-ghost-light { background: var(--surface); color: var(--ink); border-color: var(--line); }
.scan-ocr { display: flex; align-items: flex-start; gap: 8px; }
.scan-ocr input[type=checkbox] { width: 20px; height: 20px; flex: none; margin-top: 2px; }
.scan-form label { display: flex; flex-direction: column; gap: 4px; font-size: 0.9rem; }
.scan-ocr { flex-direction: row !important; }
.scan-bottom { flex-wrap: wrap; justify-content: center; }
.scan-bottom .btn { padding-left: 10px; padding-right: 10px; }
.scan-ocr input[type=checkbox] { appearance: auto; -webkit-appearance: checkbox; accent-color: var(--primary); }

/* skener: živé zameranie a úprava rohov */
.scan-stage { position: relative; flex: 1; min-height: 0; background: #000; }
.scan-stage .scan-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.scan-overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.scan-hint { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); padding: 6px 14px; border-radius: calc(var(--radius) * 1.4); background: rgb(0 0 0 / 0.6); font-size: 0.9rem; white-space: nowrap; pointer-events: none; }
.scan-auto.on { background: #2e8b57; border-color: #2e8b57; }
.scan-crop { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; background: #111; }
.crop-stage { flex: 1; min-height: 0; display: grid; place-items: center; padding: 20px; overflow: hidden; }
.crop-wrap { position: relative; display: inline-block; touch-action: none; }
.crop-wrap img { display: block; max-width: calc(100vw - 40px); max-height: calc(100vh - 220px); user-select: none; -webkit-user-drag: none; }
.crop-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.crop-svg polygon { fill: rgb(60 160 255 / 0.18); stroke: #59a8ff; stroke-width: 3; vector-effect: non-scaling-stroke; }
.crop-handle { position: absolute; width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%; background: rgb(89 168 255 / 0.35); border: 3px solid #59a8ff; touch-action: none; cursor: grab; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* páska na samoskúšanie */
.tape { position: absolute; background: var(--c); border-radius: 5px; box-shadow: 0 1px 3px rgb(0 0 0 / 0.25); display: grid; place-items: center; color: rgb(0 0 0 / 0.35); font-weight: 700; pointer-events: auto; cursor: pointer; transition: opacity 0.2s; z-index: 3; }
.tape.revealed { opacity: 0.1; }
.tape.live { opacity: 0.6; pointer-events: none; }
body[data-tool="tape"] .viewer-container { touch-action: none; cursor: crosshair; }

/* panel dokumentu: záložky, osnova, miniatúry */
.pan-tabs { display: flex; gap: 4px; padding: 6px 10px 0; border-bottom: 1px solid var(--line); }
.pan-tab { flex: 1; padding: 7px 4px; border: 0; background: transparent; font: inherit; font-size: 0.88rem; color: var(--muted); border-bottom: 2px solid transparent; cursor: pointer; }
.pan-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.outline { gap: 0; padding: 6px 0 40px; }
.ol-item { display: flex; justify-content: space-between; gap: 8px; width: 100%; padding: 7px 12px; border: 0; background: transparent; font: inherit; font-size: 0.9rem; text-align: left; color: var(--ink); cursor: pointer; }
.ol-item:hover:not(:disabled) { background: var(--primary-soft); }
.ol-item:disabled { color: var(--muted); cursor: default; }
.ol-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ol-p { color: var(--muted); font-variant-numeric: tabular-nums; flex: none; }
.thumbs { overflow: auto; padding: 10px; display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; align-content: start; }
.thumb { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px; border: 2px solid transparent; border-radius: calc(var(--radius) * 0.8); background: transparent; font: inherit; font-size: 0.78rem; color: var(--muted); cursor: pointer; }
.thumb canvas { max-width: 100%; height: auto; background: #fff; box-shadow: 0 1px 4px rgb(0 0 0 / 0.2); }
.thumb.current { border-color: var(--primary); color: var(--primary); font-weight: 600; }
.anpanel { display: flex; flex-direction: column; }
.anpanel .anlist, .anpanel .thumbs { flex: 1; min-height: 0; }
.anlist[hidden], .thumbs[hidden] { display: none; }

/* pracovisko: karty a dva dokumenty */
html.embed { --topbar-h: 0px; }
html.embed .topbar, html.embed .vtoolbar > a[href="/"] { display: none; }
.ws { position: fixed; left: 0; right: 0; bottom: 0; top: calc(var(--topbar-h) + env(safe-area-inset-top)); display: flex; flex-direction: column; }
.ws-bar { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: var(--surface); border-bottom: 1px solid var(--line); }
.ws-tabs { flex: 1; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.ws-tab { display: flex; align-items: center; max-width: 240px; flex: none; border: 1px solid var(--line); border-radius: calc(var(--radius) * 0.8) 10px 0 0; background: var(--bg); }
.ws-tab.active { background: var(--surface); border-color: var(--primary); border-bottom-color: var(--surface); box-shadow: inset 0 3px 0 var(--primary); }
.ws-tab.second { box-shadow: inset 0 3px 0 #a63fd1; }
.ws-tab button { border: 0; background: transparent; font: inherit; cursor: pointer; color: var(--ink); padding: 8px 6px; }
.ws-tab-main { max-width: 190px; padding-left: 12px !important; }
.ws-tab-t { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-tab-x, .ws-tab-side { color: var(--muted) !important; }
.ws-panes { flex: 1; min-height: 0; display: grid; position: relative; background: #e9e6df; }
.ws-panes[data-layout="one"] { grid-template-columns: 1fr; }
.ws-panes[data-layout="cols"] { grid-template-columns: 1fr 1fr; gap: 3px; }
.ws-panes[data-layout="rows"] { grid-template-rows: 1fr 1fr; gap: 3px; }
.ws-panes[data-layout="cols3"] { grid-template-columns: 1fr 1fr 1fr; gap: 3px; }
.ws-panes[data-layout="grid4"] { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 3px; }
.ws-panes[data-layout="main3"] { grid-template-columns: 1.5fr 1fr; grid-template-rows: 1fr 1fr; gap: 3px; }
.ws-panes[data-layout="main3"] [data-slot="0"] { grid-row: 1 / span 2; grid-column: 1; }
.ws-panes[data-layout="main3"] [data-slot="1"] { grid-row: 1; grid-column: 2; }
.ws-panes[data-layout="main3"] [data-slot="2"] { grid-row: 2; grid-column: 2; }
.ws-panes [data-slot="0"] { order: 0; } .ws-panes [data-slot="1"] { order: 1; } .ws-panes [data-slot="2"] { order: 2; } .ws-panes [data-slot="3"] { order: 3; }
.ws-frame.focus { outline: 3px solid var(--primary); outline-offset: -3px; }
.ws-slot-empty { display: grid; place-items: center; text-align: center; padding: 20px; color: var(--muted); background: var(--bg); border: 2px dashed var(--line); cursor: pointer; }
.ws-slot-n { display: inline-grid; place-items: center; width: 18px; height: 18px; margin-right: 6px; border-radius: 50%; background: var(--primary); color: var(--primary-ink); font-size: 0.72rem; font-weight: 700; flex: none; }
.ws-tab-main { display: flex !important; align-items: center; }
.ws-frame { width: 100%; height: 100%; border: 0; background: var(--bg); }
.ws-frame[hidden] { display: none; }
.ws-empty { align-self: center; justify-self: center; max-width: 420px; text-align: center; }
.ws-layout button:disabled { opacity: 0.35; }

/* široký okraj strany na poznámky */
.vija-margin { position: absolute; top: 0; left: 100%; height: 100%; background: #fffdf6; border-left: 2px dashed #d9c9a3; box-shadow: 2px 2px 6px rgb(0 0 0 / 0.15); z-index: 2; touch-action: none; }

/* ---------- tmavý režim a režim pre oči ---------- */
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #17121b; --surface: #231c29; --ink: #f3ebf1; --muted: #b8aab6; --line: #3c3243;
  --primary: #f070a8; --primary-ink: #1b0f18; --primary-soft: #43243a; --danger: #ff7b72;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.5), 0 4px 16px rgb(0 0 0 / 0.4);
}
html[data-theme="dark"] .viewer-container, html[data-theme="dark"] .ws-panes, html[data-theme="dark"] .scan-thumb, html[data-theme="dark"] .editor-wrap { background: #100c13; }
html[data-theme="dark"] .vija-margin { background: #2b2331; border-left-color: #6a5873; }
html[data-theme="dark"] .text-mirror mark { background: color-mix(in srgb, var(--c) 45%, transparent); }
html[data-theme="dark"] .grid-table td[style] input { color: #1d1d1f; }
html[data-theme="dark"] .grid-table th { background: #2d2533; }
html[data-theme="dark"] .toast { background: #f3ebf1; color: #1d1d1f; }
html[data-theme="dark"] .auth-logo { background: #fff; border-radius: var(--radius); padding: 8px; }
html[data-theme="dark"] .ruler { filter: brightness(0.85); }
html[data-eye="1"]::after {
  content: ""; position: fixed; inset: 0; z-index: 9999; pointer-events: none;
  background: rgb(255 150 50 / 0.17); mix-blend-mode: multiply;
}

/* časovač */
.timer-btn { height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: calc(var(--radius) * 1.4); background: var(--surface); font: inherit; color: var(--ink); cursor: pointer; white-space: nowrap; font-variant-numeric: tabular-nums; }
.timer-btn.running { background: #ff9a3c; border-color: #ff9a3c; color: #2a1626; font-weight: 700; }
.timer-pop { position: absolute; right: 0; top: 44px; z-index: 60; width: 270px; padding: 14px; display: grid; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); text-align: center; }
.timer-pop[hidden] { display: none; }
.timer-disp { font-size: 2.6rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--primary); }
.timer-label { color: var(--muted); font-size: 0.9rem; }
.timer-presets { display: grid; gap: 6px; }
.timer-custom { display: flex; gap: 6px; }
.timer-custom input { min-height: 34px; padding: 5px 9px; }
.timer-hist { font-size: 0.82rem; color: var(--muted); }
@media (max-width: 520px) { .timer-btn { padding: 0 9px; } .brand span { display: none; } }

/* nastavenia vzhľadu */
.ui-presets { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 14px; }
.preset { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border: 2px solid var(--line); border-radius: 999px; background: var(--b); color: #2a2a2a; font: inherit; font-size: 0.9rem; cursor: pointer; }
.preset.on { border-color: var(--a); font-weight: 700; }
.preset-dot { width: 18px; height: 18px; border-radius: 50%; background: var(--a); }
.ui-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 12px; }
.ui-grid label, .ui-lbl { font-size: 0.85rem; color: var(--muted); display: block; }
.ui-lbl { margin-bottom: 5px; }
.ui-grid input[type=color] { display: block; width: 100%; height: 44px; padding: 3px; margin-top: 4px; cursor: pointer; }
.ui-grid .seg { flex-wrap: wrap; }
.ui-chk { display: flex; align-items: center; gap: 8px; margin: 6px 0 12px; font-size: 0.9rem; }
.ui-chk input { width: 20px; height: 20px; min-height: 0; flex: none; appearance: auto; accent-color: var(--primary); }
.hand-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; margin-top: 10px; }
.hand-opt { display: grid; gap: 4px; text-align: left; padding: 10px 12px; border: 2px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); font: inherit; cursor: pointer; }
.hand-opt.on { border-color: var(--primary); background: var(--primary-soft); }
.hand-name { font-size: 0.78rem; color: var(--muted); }
.hand-sample { line-height: 1.15; color: var(--ink); }
.font-sel { width: auto; min-height: 36px; max-width: 190px; padding: 4px 8px; }

/* kartičky */
.cards-page { max-width: 960px; margin: 0 auto; padding: 18px 16px 60px; }
.cards-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.cards-head h1, .cards-head h2 { margin: 0; }
.cards-actions { display: flex; gap: 8px; }
.decks { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin: 16px 0; }
.deck { display: grid; gap: 8px; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: calc(var(--radius) * 1.4); box-shadow: var(--shadow); }
.deck-name { font-weight: 700; font-size: 1.05rem; }
.deck-counts { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 0.85rem; color: var(--muted); }
.deck-counts .due.on { color: var(--primary); font-weight: 700; }
.deck-btns { display: flex; gap: 6px; align-items: center; }
.deck-view { margin-top: 20px; display: grid; gap: 8px; }
.cardrow { display: grid; grid-template-columns: auto 1fr auto auto; gap: 10px; align-items: center; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.cardrow-img { width: 90px; max-height: 70px; object-fit: cover; border-radius: 6px; grid-column: 1; }
.cardrow-t { grid-column: 2; min-width: 0; } .cardrow:not(:has(.cardrow-img)) .cardrow-t { grid-column: 1 / 3; }
.cardrow-front { font-weight: 600; } .cardrow-back { color: var(--muted); font-size: 0.9rem; white-space: pre-wrap; }
.cardrow-meta { font-size: 0.78rem; color: var(--muted); display: grid; gap: 2px; }
.cardrow-btns { display: flex; }
.review { position: fixed; inset: 0; z-index: 90; background: var(--bg); display: flex; flex-direction: column; }
.review[hidden] { display: none; }
.review-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top)); background: #17131a; color: #fff; }
.review-card { flex: 1; overflow: auto; display: grid; align-content: center; justify-items: center; gap: 18px; padding: 24px 18px; text-align: center; }
.review-front { font-size: 1.5rem; font-weight: 600; max-width: 720px; white-space: pre-wrap; }
.review-answer { font-size: 1.15rem; max-width: 720px; white-space: pre-wrap; padding: 16px 20px; border-radius: var(--radius); background: var(--primary-soft); text-align: left; }
.review-img { max-width: min(100%, 760px); max-height: 46vh; border-radius: 8px; background: #fff; box-shadow: var(--shadow); }
.review-bottom { padding: 12px 14px calc(14px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); display: grid; }
.review-flip { min-height: 52px; font-size: 1.05rem; }
.review-grades { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.grade { flex-direction: column; min-height: 58px; gap: 0; }
.grade small { opacity: 0.6; }
.grade.g0 { border-color: #d9534f; color: #b4372f; } .grade.g1 { border-color: #e8a13a; } .grade.g2 { border-color: #3a9a5a; } .grade.g3 { border-color: #3a78d1; }
.review-card.done { align-content: center; }
.card-dlg { max-width: 520px; } .card-dlg textarea { min-height: 80px; } .card-dlg-img { max-width: 100%; max-height: 180px; border-radius: 8px; display: block; margin: 0 auto 10px; }
.ancard-card { position: absolute; right: 34px; top: 8px; border: 0; background: transparent; cursor: pointer; font-size: 1rem; }
.clip-frame { position: absolute; border: 2px dashed var(--c); background: color-mix(in srgb, var(--c) 18%, transparent); border-radius: 4px; pointer-events: auto; cursor: pointer; z-index: 3; }
.clip-frame::after { content: "▭ výrez"; position: absolute; left: 0; top: -1.4em; font-size: 0.7rem; background: var(--c); color: #2a1626; padding: 0 6px; border-radius: 4px 4px 0 0; }
.clip-frame.live { pointer-events: none; opacity: 0.8; }
.ancard-clip { max-width: 100%; max-height: 120px; border-radius: 6px; background: #fff; display: block; margin-bottom: 4px; }
body[data-tool="clip"] .viewer-container { touch-action: none; cursor: crosshair; }
.sum-clip { max-width: 100%; max-height: 320px; border-radius: 8px; background: #fff; display: block; box-shadow: var(--shadow); }
.sum-card-btn { margin-left: auto; margin-right: 8px; }

/* výber papiera: dlaždice s náhľadom */
.paper-dlg { max-width: 660px; width: calc(100vw - 24px); padding: 18px 20px; }
.paper-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px; margin: 6px 0 12px; max-height: 58vh; overflow: auto; padding: 4px; }
.paper-tile { display: grid; gap: 6px; justify-items: center; align-content: start; padding: 8px 6px; border: 2px solid var(--line); border-radius: calc(var(--radius) * 0.7); background: var(--surface); color: var(--ink); font: inherit; font-size: 0.82rem; cursor: pointer; }
.paper-tile img { width: 100%; aspect-ratio: 397 / 562; object-fit: cover; border: 1px solid var(--line); border-radius: 4px; background: #fff; box-shadow: 0 1px 4px rgb(0 0 0 / 0.12); }
.paper-tile.on { border-color: var(--primary); background: var(--primary-soft); font-weight: 700; }
.paper-tile:hover:not(.on) { border-color: var(--muted); }
.clip-comment { position: absolute; z-index: 4; padding: 5px 8px; border-left: 4px solid var(--c); border-radius: 0 6px 6px 0; background: color-mix(in srgb, var(--c) 28%, #fff); color: #2a1626; font-size: calc(10px * var(--scale-factor, 1.3)); line-height: 1.25; white-space: pre-wrap; overflow-wrap: anywhere; pointer-events: auto; cursor: pointer; box-shadow: 0 1px 4px rgb(0 0 0 / 0.2); }

/* pierka, puzdro, nastavenia nástrojov */
.pen-pop { position: fixed; z-index: 45; top: calc(var(--topbar-h) + var(--vtb-h, 54px) + 4px + env(safe-area-inset-top)); left: 12px; width: min(360px, calc(100vw - 24px)); padding: 12px; display: grid; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: calc(var(--radius) * 1.4); box-shadow: var(--shadow); }
.pen-pop[hidden] { display: none; }
.pp-types { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.pp-type { display: grid; justify-items: center; gap: 2px; padding: 8px 2px; border: 2px solid var(--line); border-radius: calc(var(--radius) * 0.8); background: var(--surface); font: inherit; font-size: 0.74rem; color: var(--ink); cursor: pointer; text-align: center; }
.pp-type.on { border-color: var(--primary); background: var(--primary-soft); font-weight: 700; }
.pp-ico { font-size: 1.4rem; }
.pen-preview { width: 100%; height: 64px; background: #fff; border: 1px solid var(--line); border-radius: calc(var(--radius) * 0.7); }
.pp-row { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: 8px; align-items: center; font-size: 0.86rem; }
.pp-row input[type=range] { min-height: 0; padding: 0; width: 100%; accent-color: var(--primary); }
.pp-val { min-width: 46px; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.pp-sub { font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.pp-sets { display: flex; flex-wrap: wrap; gap: 6px; }
.pp-set { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--bg); }
.pp-set button { border: 0; background: transparent; font: inherit; font-size: 0.82rem; color: var(--ink); cursor: pointer; padding: 5px 9px; display: inline-flex; gap: 6px; align-items: center; }
.pp-set-x { color: var(--muted) !important; padding-left: 2px !important; }
.pp-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 1px var(--line); }
.tool-dlg { max-width: 520px; }
.tg-card { background: var(--bg); border-radius: calc(var(--radius) * 1.2); padding: 4px 14px; margin: 8px 0; }
.tg { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.tg:last-child { border-bottom: 0; }
.tg-t { display: grid; gap: 3px; } .tg-t small { color: var(--muted); font-size: 0.8rem; font-weight: 400; }
.tg-sw { position: relative; flex: none; width: 48px; height: 28px; }
.tg-sw input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; min-height: 0; }
.tg-sw i { position: absolute; inset: 0; border-radius: 999px; background: var(--line); transition: background .15s; pointer-events: none; }
.tg-sw i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / 0.3); transition: transform .15s; }
.tg-sw input:checked + i { background: var(--primary); }
.tg-sw input:checked + i::after { transform: translateX(20px); }
.tg-slider { display: grid; grid-template-columns: 1fr 1.3fr; gap: 10px; align-items: center; padding: 12px 0; }
.tg-slider input[type=range] { padding: 0; min-height: 0; accent-color: var(--primary); }
.tg-slider select { min-height: 36px; }

/* ---------- dvojriadková lišta v štýle StarNote: hore akcie, dole nástroje (len ikony) ---------- */
.vtoolbar { flex-direction: column; align-items: stretch; gap: 0; padding: 0; height: auto; min-height: 0; overflow: visible; }
.vrow { display: flex; align-items: center; gap: 6px; padding: 4px 10px; overflow-x: auto; scrollbar-width: none; min-height: 46px; }
.vrow-top { border-bottom: 1px solid var(--line); }
.vtoolbar .tool-label { display: none; }
.vtoolbar .tool { width: 42px; height: 40px; padding: 0; justify-content: center; border-radius: calc(var(--radius) * 0.9); }
.vtoolbar .tool-ico { font-size: 1.3rem; }
.vtoolbar .tool.active { background: var(--primary-soft); color: var(--primary); box-shadow: none; }
.vtoolbar .tool[data-tool="pen"].active { position: relative; }
.vtoolbar .tool[data-tool="pen"].active::after { content: ""; position: absolute; right: 5px; bottom: 5px; border: 4px solid transparent; border-top-color: currentColor; border-bottom: 0; }
.vtoolbar .tool-group { background: transparent; padding: 0; gap: 2px; }
@media (max-width: 1100px) {
  .vtoolbar { flex-wrap: nowrap; padding: 0; row-gap: 0; }
  .vtoolbar .vrow { padding: 3px 8px; min-height: 44px; }
}
@media (max-width: 520px) {
  .vtoolbar .tool { width: 38px; }
}

/* farba papiera: strana má farebné pozadie, PDF sa prekrýva násobením */
body.tinted .pdfViewer .page { background-color: var(--page-bg); }
body.tinted .pdfViewer .page .canvasWrapper { background: var(--page-bg); }
body.tinted .pdfViewer .page canvas { mix-blend-mode: multiply; }
.pc-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 12px; }
.pc-sw { width: 38px; height: 38px; border-radius: 50%; border: 2px solid var(--line); background: var(--c); cursor: pointer; padding: 0; }
.pc-sw.on { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.ne-label { font-size: 0.82rem; color: var(--muted); margin: 8px 0 4px; }

/* výber ťahov lasom */
body[data-tool="lasso"] .viewer-container { touch-action: none; cursor: crosshair; }
.lasso-box { position: absolute; z-index: 6; border: 2px dashed #3b82f6; background: rgb(59 130 246 / 0.08); border-radius: 4px; pointer-events: auto; cursor: move; touch-action: none; }
.lasso-bar { position: fixed; z-index: 35; left: 50%; transform: translateX(-50%); bottom: calc(18px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow); }
.lasso-bar[hidden] { display: none; }

/* knižnica: mriežka obálok a farba predmetu */
.tile[style*="--fc"] { border-left: 6px solid var(--fc); }
.doc-grid { display: grid !important; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.cover { position: relative; }
.cover-main { display: grid; gap: 4px; color: var(--ink); text-decoration: none; }
.cover-art { aspect-ratio: 3 / 4; display: grid; place-items: center; border-radius: calc(var(--radius) * 0.9); background: linear-gradient(160deg, color-mix(in srgb, var(--fc) 70%, #fff), var(--fc)); box-shadow: var(--shadow); border-left: 8px solid color-mix(in srgb, var(--fc) 60%, #000); }
.cover-ico { font-size: 3rem; filter: drop-shadow(0 2px 3px rgb(0 0 0 / 0.2)); }
.cover-title { font-weight: 600; font-size: 0.92rem; line-height: 1.2; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.cover-meta { font-size: 0.75rem; color: var(--muted); }
.cover-more { position: absolute; top: 4px; right: 4px; background: rgb(255 255 255 / 0.75); }
.tg-hint { display: block; color: var(--muted); font-size: 0.78rem; font-weight: 400; }

/* sprievodca */
.guide { max-width: 760px; margin: 0 auto; padding: 18px 14px 70px; }
.guide-head { text-align: center; margin-bottom: 18px; }
.guide-head h1 { margin: 8px 0 4px; }
.g-ch { position: relative; overflow: hidden; margin: 14px 0; padding: 18px 20px 16px; border-radius: calc(var(--radius) * 1.6); background: var(--tone); color: #2a1626; }
.g-ch h2 { position: relative; margin: 0 0 8px; font-size: 1.25rem; }
.g-ch p { position: relative; margin: 6px 0; line-height: 1.5; }
.g-num { position: absolute; right: 12px; top: -22px; font-size: 7.5rem; font-weight: 800; color: rgb(255 255 255 / 0.55); line-height: 1; pointer-events: none; }
.guide-end { text-align: center; margin-top: 22px; }
html[data-theme="dark"] .g-ch { color: #2a1626; }
.guide-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 12px; border-radius: var(--radius); background: var(--primary-soft); }
.guide-bar span { flex: 1; }

/* textové pole na strane */
.tbox { position: absolute; pointer-events: none; min-width: 6%; }
body[data-tool="textbox"] .tbox { pointer-events: auto; outline: 1px dashed color-mix(in srgb, var(--primary) 55%, transparent); border-radius: 4px; }
.tbox-text { padding: 2px 4px; line-height: 1.3; outline: none; white-space: pre-wrap; word-break: break-word; min-height: 1.3em; cursor: text; }
.tbox-bar, .tbox-resize { display: none; }
body[data-tool="textbox"] .tbox:focus-within .tbox-bar, body[data-tool="textbox"] .tbox:hover .tbox-bar { display: flex; }
.tbox-bar { position: absolute; left: 0; top: calc(100% + 8px); /* pod poľom – ponuka systému (Vystrihnúť, Skopírovať) sa ukazuje nad označeným textom */ gap: 2px; padding: 2px; background: var(--surface, #fff); border: 1px solid var(--border, #ccc); border-radius: 8px; box-shadow: 0 2px 8px rgb(0 0 0 / .18); z-index: 12; }
.tbox-bar button { border: 0; background: transparent; padding: 4px 7px; border-radius: 6px; font-size: 13px; cursor: pointer; }
.tbox-bar button:hover { background: color-mix(in srgb, var(--primary) 15%, transparent); }
.tbox-grip { cursor: grab; padding: 4px 6px; touch-action: none; user-select: none; }
body[data-tool="textbox"] .tbox .tbox-resize { display: block; position: absolute; right: 1px; bottom: 1px; width: 22px; height: 22px; border-radius: 50%; background: var(--primary); border: 3px solid #fff; box-shadow: 0 1px 4px rgb(0 0 0 / .35); cursor: ew-resize; touch-action: none; z-index: 13; }
.tbox-resize::after { content: ""; position: absolute; inset: -12px; }

/* ikony – čiarový štýl */
.ico-w { display: inline-flex; align-items: center; justify-content: center; vertical-align: -0.28em; line-height: 1; }
.ico { width: 1.3em; height: 1.3em; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.tool-ico .ico, .vtoolbar .tool-ico .ico { width: 24px; height: 24px; stroke-width: 1.5; }
.vtoolbar .icon-btn .ico { width: 22px; height: 22px; stroke-width: 1.5; }
.vtoolbar .icon-btn, .vtoolbar .tool { color: color-mix(in srgb, var(--text, #1d2a33) 78%, transparent); }
.vtoolbar .tool.active { background: var(--primary-soft); color: var(--primary); border-radius: 14px; }
.vtoolbar .tool.active .ico { stroke-width: 1.7; }
.ico-w:has(.ico) { min-width: 1em; }

/* pomoc a ukážky */
.help-btn { font-weight: 700; font-size: 1.05rem; }
.help-dlg { width: min(720px, 94vw); max-height: 88vh; padding: 0; border: 0; border-radius: var(--radius); box-shadow: 0 12px 40px rgb(0 0 0 / .3); background: var(--surface, #fff); color: var(--text); }
.help-dlg::backdrop { background: rgb(20 25 30 / .45); }
.help-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border, #dde); position: sticky; top: 0; background: inherit; z-index: 1; }
.help-head h2 { margin: 0; font-size: 1.15rem; }
.help-list { overflow-y: auto; max-height: calc(88vh - 130px); padding: 6px 18px; }
.help-item { display: grid; grid-template-columns: 210px 1fr; gap: 16px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--border, #e6e9ee); }
.help-item:last-child { border-bottom: 0; }
.help-item h3 { margin: 0 0 4px; font-size: 1rem; }
.help-item p { margin: 4px 0; font-size: .92rem; line-height: 1.45; }
.help-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 18px; border-top: 1px solid var(--border, #dde); font-size: .88rem; }
.help-demo { background: var(--primary-soft); border-radius: 14px; padding: 6px; overflow: hidden; }
.help-demo .dm { width: 100%; height: auto; display: block; }
.guide-demo { max-width: 260px; margin: 6px 0 10px; }
@media (max-width: 560px) { .help-item { grid-template-columns: 1fr; } .help-demo { max-width: 260px; } }
.tool-tip { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 60; width: min(440px, 94vw); display: grid; grid-template-columns: 150px 1fr; gap: 10px 12px; align-items: center; padding: 12px; border-radius: 18px; background: var(--surface, #fff); box-shadow: 0 8px 30px rgb(0 0 0 / .28); border: 1px solid var(--border, #dde); transition: opacity .8s; }
.tool-tip.fade { opacity: 0; }
.tool-tip h3 { margin: 0 0 2px; font-size: .98rem; } .tool-tip p { margin: 0; font-size: .86rem; line-height: 1.4; }
.tip-actions { grid-column: 1 / -1; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
/* animácie ukážok */
.dm path, .dm rect, .dm circle, .dm ellipse, .dm g { transform-box: fill-box; transform-origin: center; }
@keyframes dm-draw { 0% { stroke-dashoffset: 1; } 55%, 100% { stroke-dashoffset: 0; } }
.dm-draw { stroke-dasharray: 1; animation: dm-draw 3.2s ease-in-out infinite; }
@keyframes dm-fade { 0%, 15% { opacity: 0; transform: translateY(6px); } 35%, 100% { opacity: 1; transform: none; } }
.dm-fade1 { animation: dm-fade 3.6s infinite; } .dm-fade2 { animation: dm-fade 3.6s .5s infinite backwards; } .dm-fade3 { animation: dm-fade 3.6s 1s infinite backwards; }
@keyframes dm-drop { 0% { transform: translateY(-4px); opacity: 0; } 40%, 70% { transform: translateY(44px); opacity: 1; } 100% { transform: translateY(44px); opacity: 0; } }
.dm-drop { animation: dm-drop 3s ease-in infinite; }
@keyframes dm-corners { 0%, 20% { transform: scale(1.25); } 60%, 100% { transform: scale(1); } }
.dm-corners { animation: dm-corners 3s ease-in-out infinite; }
@keyframes dm-sweep { 0% { transform: scaleX(0); transform-origin: left; } 50%, 100% { transform: scaleX(1); transform-origin: left; } }
.dm-sweep { animation: dm-sweep 3s ease-out infinite; } .dm-s2 { animation-delay: .9s; animation-fill-mode: backwards; }
@keyframes dm-pop { 0%, 45% { transform: scale(0); opacity: 0; } 65%, 100% { transform: scale(1); opacity: 1; } }
.dm-pop { animation: dm-pop 3s infinite; }
@keyframes dm-wob { 0%, 40% { opacity: 1; } 55%, 100% { opacity: 0; } }
@keyframes dm-per { 0%, 40% { opacity: 0; } 55%, 100% { opacity: 1; } }
.dm-wobble { animation: dm-wob 3.4s infinite; } .dm-perfect { animation: dm-per 3.4s infinite; }
@keyframes dm-loop { 0% { stroke-dashoffset: 1; } 45%, 100% { stroke-dashoffset: 0; } }
.dm-loop { stroke-dasharray: 1 0; animation: dm-loop 3.4s infinite; }
@keyframes dm-lasso { 0%, 55% { transform: none; } 80%, 100% { transform: translate(18px, 6px); } }
.dm-lassomove { animation: dm-lasso 3.4s infinite; }
@keyframes dm-erase { 0%, 30% { opacity: 1; } 60%, 100% { opacity: 0; } }
.dm-erased { animation: dm-erase 3.2s infinite; }
@keyframes dm-era { 0% { transform: translate(52px, 62px); } 100% { transform: translate(150px, 58px); } }
.dm-eramove { animation: dm-era 3.2s ease-in-out infinite; }
@keyframes dm-tape { 0%, 30% { opacity: 1; } 55%, 100% { opacity: 0; } } .dm-tape, .dm-q { animation: dm-tape 3.2s infinite; }
@keyframes dm-frame { 0% { transform: scale(.2); opacity: 0; } 40%, 100% { transform: scale(1); opacity: 1; } } .dm-frame { animation: dm-frame 3s infinite; } .dm-card { animation: dm-pop 3s infinite; }
@keyframes dm-open { 0%, 30% { transform: none; } 60%, 100% { transform: translateY(-4px); } } .dm-open { animation: dm-open 3s infinite; }
@keyframes dm-gap { 0%, 30% { opacity: 0; } 60%, 100% { opacity: 1; } } .dm-gap { animation: dm-gap 3s infinite; }
@keyframes dm-caret { 50% { opacity: 0; } } .dm-caret { animation: dm-caret 1s steps(2) infinite; }
@keyframes dm-spread { 0% { transform: scale(.45); } 60%, 100% { transform: scale(1.5); } } .dm-spread { animation: dm-spread 3s ease-in-out infinite; }
@keyframes dm-tap { 0%, 40% { transform: scale(1); } 50% { transform: scale(.7); } 60%, 100% { transform: scale(1); } } .dm-tap { animation: dm-tap 2.4s infinite; }
@keyframes dm-flip { 0%, 30% { transform: rotateY(0); } 50%, 80% { transform: rotateY(180deg); } 100% { transform: rotateY(360deg); } } .dm-flip { animation: dm-flip 4s ease-in-out infinite; }
@keyframes dm-up { 0% { transform: translateY(14px); opacity: 0; } 50%, 100% { transform: none; opacity: 1; } } .dm-up { animation: dm-up 2.6s infinite; }
@keyframes dm-theme { 0%, 100% { fill: #fde6ef; } 33% { fill: #d6ecff; } 66% { fill: #e4f4d9; } } .dm-theme { animation: dm-theme 5s infinite; }
@media (prefers-reduced-motion: reduce) { .dm * { animation: none !important; } }
.help-tips { display: flex; align-items: center; gap: 8px; }
.help-tips input { width: 18px; height: 18px; padding: 0; flex: none; }
.tool-tip { bottom: 84px; }

#markerWidths { display: none; margin-left: 6px; }
body[data-tool="marker"] #markerWidths { display: inline-flex; }
.wbar { display: block; width: 22px; height: var(--s); border-radius: 3px; background: currentColor; opacity: .75; }
#markerWidths button.on { background: var(--primary-soft); color: var(--primary); }

/* obrázok na strane */
.pimg { position: absolute; pointer-events: none; }
.pimg img { width: 100%; height: 100%; display: block; object-fit: fill; user-select: none; -webkit-user-drag: none; }
.pimg-del, .pimg-rz { display: none; }
body[data-tool="image"] .pimg { pointer-events: auto; cursor: move; outline: 1.5px dashed var(--primary); touch-action: none; }
body[data-tool="image"] .pimg-del { display: grid; place-items: center; position: absolute; top: -12px; right: -12px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: var(--primary); color: #fff; cursor: pointer; }
body[data-tool="image"] .pimg-rz { display: block; position: absolute; right: -8px; bottom: -8px; width: 18px; height: 18px; border-radius: 50%; background: var(--primary); cursor: nwse-resize; touch-action: none; }

.lasso-rz { position: absolute; right: -9px; bottom: -9px; width: 18px; height: 18px; border-radius: 50%; background: #3b82f6; border: 2px solid #fff; cursor: nwse-resize; touch-action: none; }
.lasso-rot { position: absolute; left: calc(50% - 9px); top: -30px; width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 2px solid #3b82f6; cursor: grab; touch-action: none; }
.lasso-rot::after { content: ""; position: absolute; left: 6px; top: 16px; width: 2px; height: 12px; background: #3b82f6; }

.ui-tex { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0 14px; }
.tex-opt { display: grid; gap: 6px; justify-items: center; padding: 6px; width: 92px; border: 2px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); font: inherit; font-size: 0.85rem; cursor: pointer; }
.tex-opt.on { border-color: var(--primary); font-weight: 700; }
.tex-sw { width: 100%; height: 56px; border-radius: calc(var(--radius) * 0.6); border: 1px solid var(--line); background-color: var(--bg); background-blend-mode: multiply; }

#refreshBtn.spin svg { animation: vija-spin 0.8s linear infinite; }
@keyframes vija-spin { to { transform: rotate(360deg); } }
.ui-grid > div { min-width: 0; }
.ui-grid .seg { min-width: 0; max-width: 100%; flex-wrap: wrap; }
.ui-grid .seg button { flex: 1 1 auto; padding: 8px 10px; }
.set-done { display: flex; justify-content: flex-end; margin: 8px 0 14px; }

/* povrchy priečinkov */
.fin-matte .cover-art, .cover-main.fin-matte .cover-art { background: var(--fc); box-shadow: none; }
.fin-pastel .cover-art { background: var(--fc); border-left-color: color-mix(in srgb, var(--fc) 80%, #000); }
.fin-gloss .cover-art { background: linear-gradient(155deg, rgb(255 255 255 / 0.55) 0%, rgb(255 255 255 / 0) 38%), linear-gradient(160deg, color-mix(in srgb, var(--fc) 80%, #fff), var(--fc)); box-shadow: var(--shadow), inset 0 1px 2px rgb(255 255 255 / 0.7); }
.fin-lacquer .cover-art { background: linear-gradient(170deg, rgb(255 255 255 / 0.5) 0%, rgb(255 255 255 / 0.05) 34%, rgb(0 0 0 / 0) 35%), linear-gradient(180deg, var(--fc), color-mix(in srgb, var(--fc) 75%, #000)); box-shadow: var(--shadow), inset 0 2px 3px rgb(255 255 255 / 0.55), inset 0 -3px 6px rgb(0 0 0 / 0.25); }
.fin-metal .cover-art { background: linear-gradient(120deg, color-mix(in srgb, var(--fc) 55%, #fff) 0%, var(--fc) 22%, color-mix(in srgb, var(--fc) 70%, #000) 48%, color-mix(in srgb, var(--fc) 60%, #fff) 70%, var(--fc) 100%); box-shadow: var(--shadow), inset 0 0 0 1px rgb(255 255 255 / 0.35); }
.tile.fin-lacquer, .tile.fin-gloss { box-shadow: inset 0 1px 2px rgb(255 255 255 / 0.7); }
.fp-dlg { width: min(460px, 94vw); }
.fp-prev { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: var(--radius); background: var(--bg); margin-bottom: 8px; }
.fp-prev-art { width: 54px; height: 72px; display: grid; place-items: center; border-radius: 8px; border-left: 6px solid color-mix(in srgb, var(--fc, #d9d4c4) 60%, #000); background: linear-gradient(160deg, color-mix(in srgb, var(--fc, #d9d4c4) 70%, #fff), var(--fc, #d9d4c4)); font-size: 1.5rem; }
.fp-prev.fin-matte .fp-prev-art, .fp-prev.fin-pastel .fp-prev-art { background: var(--fc); }
.fp-prev.fin-gloss .fp-prev-art { background: linear-gradient(155deg, rgb(255 255 255 / 0.55), rgb(255 255 255 / 0) 38%), linear-gradient(160deg, color-mix(in srgb, var(--fc) 80%, #fff), var(--fc)); }
.fp-prev.fin-lacquer .fp-prev-art { background: linear-gradient(170deg, rgb(255 255 255 / 0.5), rgb(255 255 255 / 0.05) 34%, rgb(0 0 0 / 0) 35%), linear-gradient(180deg, var(--fc), color-mix(in srgb, var(--fc) 75%, #000)); }
.fp-prev.fin-metal .fp-prev-art { background: linear-gradient(120deg, color-mix(in srgb, var(--fc) 55%, #fff), var(--fc) 22%, color-mix(in srgb, var(--fc) 70%, #000) 48%, color-mix(in srgb, var(--fc) 60%, #fff) 70%, var(--fc)); }
.fp-prev-name { font-weight: 600; }
.fp-lbl { font-size: 0.82rem; color: var(--muted); margin: 12px 0 6px; }
.fp-row, .fp-grid, .fp-fin { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.fp-sw { display: grid; justify-items: center; gap: 3px; padding: 4px; min-width: 64px; border: 2px solid transparent; border-radius: var(--radius); background: none; font: inherit; font-size: 0.78rem; color: var(--ink); cursor: pointer; }
.fp-sw.on, .fp-fbtn.on { border-color: var(--primary); }
.fp-dot { width: 34px; height: 34px; border-radius: 50%; border: 1px solid rgb(0 0 0 / 0.18); display: grid; place-items: center; color: var(--muted); }
.fp-custom { width: 64px; height: 40px; padding: 2px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; }
.fp-fbtn { display: grid; justify-items: center; gap: 4px; padding: 5px 7px; min-width: 62px; border: 2px solid transparent; border-radius: var(--radius); background: none; font: inherit; font-size: 0.78rem; color: var(--ink); cursor: pointer; }
.fp-fsw { width: 38px; height: 26px; border-radius: 7px; background: var(--fc, #ccc); border: 1px solid rgb(0 0 0 / 0.15); }
.fp-fsw.fin-gloss { background: linear-gradient(155deg, rgb(255 255 255 / 0.6), rgb(255 255 255 / 0) 45%), var(--fc); }
.fp-fsw.fin-lacquer { background: linear-gradient(170deg, rgb(255 255 255 / 0.55), rgb(255 255 255 / 0) 40%), linear-gradient(180deg, var(--fc), color-mix(in srgb, var(--fc) 75%, #000)); }
.fp-fsw.fin-metal { background: linear-gradient(120deg, color-mix(in srgb, var(--fc) 55%, #fff), var(--fc) 30%, color-mix(in srgb, var(--fc) 70%, #000) 55%, color-mix(in srgb, var(--fc) 60%, #fff)); }
.fq-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0 12px; }
.fq-color { width: 56px; height: 44px; padding: 3px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; }
.tbox-font { max-width: 150px; font-size: 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); padding: 2px; }
.tbox-bar button[data-on] { background: color-mix(in srgb, var(--primary) 25%, transparent); }
.tbox { z-index: 3; }
.pg-patch { position: absolute; pointer-events: none; }
.cut-frame { position: absolute; pointer-events: none; background: rgb(59 130 246 / 0.2); outline: 2px dashed #3b82f6; z-index: 3; }
.vija-patches { position: absolute; inset: 0; pointer-events: none; z-index: 3; }

/* druhy označenia priečinka */
.tile.mk-stripe[style*="--fc"] { border-left: 6px solid var(--fc); }
.tile.mk-top[style*="--fc"] { border-left: 1px solid var(--line); border-top: 6px solid var(--fc); }
.tile.mk-frame[style*="--fc"] { border: 2px solid var(--fc); }
.tile.mk-full[style*="--fc"] { background: color-mix(in srgb, var(--fc) 38%, var(--surface)); }
.tile.mk-dot[style*="--fc"] { border-left: 1px solid var(--line); }
.tile.mk-dot[style*="--fc"] .tile-name::before { content: ""; display: inline-block; width: 0.65em; height: 0.65em; border-radius: 50%; background: var(--fc); margin-right: 6px; }
.tile.mk-badge[style*="--fc"] { border-left: 1px solid var(--line); }
.tile.mk-badge[style*="--fc"] .tile-icon { width: 2.1rem; height: 2.1rem; display: grid; place-items: center; border-radius: 50%; background: var(--fc); }
.tile-icon .ico, .tree-icon .ico { width: 1.25em; height: 1.25em; }
.fp-msw { width: 38px; height: 26px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); position: relative; display: block; }
.fp-msw.mk-stripe { border-left: 6px solid var(--fc, #888); }
.fp-msw.mk-top { border-top: 6px solid var(--fc, #888); }
.fp-msw.mk-frame { border: 2px solid var(--fc, #888); }
.fp-msw.mk-full { background: color-mix(in srgb, var(--fc, #888) 40%, #fff); }
.fp-msw.mk-dot::after { content: ""; position: absolute; left: 6px; top: 8px; width: 9px; height: 9px; border-radius: 50%; background: var(--fc, #888); }
.fp-msw.mk-badge::after { content: ""; position: absolute; left: 5px; top: 4px; width: 16px; height: 16px; border-radius: 50%; background: var(--fc, #888); }
.fp-ic { width: 42px; height: 42px; display: grid; place-items: center; border: 2px solid transparent; border-radius: var(--radius); background: var(--surface); color: var(--ink); cursor: pointer; }
.fp-ic.on { border-color: var(--primary); }
.fp-ic .ico { width: 24px; height: 24px; }
.tbox-bar button[title^="Nový riadok"] { font-weight: 700; background: color-mix(in srgb, var(--primary) 14%, transparent); min-width: 34px; }

/* tlačidlo farby ostane viditeľné aj v úzkom okne (pracovisko), lišta sa dá posúvať */
.vrow #colorBtn:not([hidden]) { position: sticky; right: 0; z-index: 3; background: var(--surface); box-shadow: -8px 0 8px -4px var(--surface); }

/* skener: náhľad poslednej strany, zoom, lupa pri ťahaní rohov */
.scan-count { border: 2px solid #fff6; border-radius: 8px; color: #fff; font: inherit; font-weight: 700; padding: 6px 10px; min-width: 64px; background-size: cover; background-position: center; cursor: pointer; }
.scan-count[hidden] { display: none; }
.scan-top .btn[aria-pressed="true"] { background: #ffd54a; color: #222; }
.scan-stage { position: relative; }
.scan-zoom { position: absolute; left: 16px; right: 16px; bottom: 10px; width: auto; accent-color: #fff; opacity: .85; }
.crop-stage { position: relative; }
.crop-loupe { position: absolute; top: 8px; width: 120px; height: 120px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 2px 12px #0008; pointer-events: none; z-index: 5; background: #000; }

/* správa strán */
.pm-open { margin: 8px 10px 0; align-self: flex-start; }
.pm-dlg { width: min(900px, 96vw); max-height: 92vh; border: 0; border-radius: var(--radius); padding: 0; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.pm-dlg[open] { display: flex; flex-direction: column; }
.pm-dlg::backdrop { background: rgb(0 0 0 / 0.45); }
.pm-hint { margin: 4px 16px 0; }
.pm-grid { flex: 1; overflow: auto; padding: 12px 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; align-content: start; }
.pm-card { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px; border: 2px solid var(--line); border-radius: calc(var(--radius) * 0.8); background: var(--bg); cursor: grab; }
.pm-card.cur { border-color: var(--primary); }
.pm-card.over { border-color: var(--primary); background: var(--primary-soft); }
.pm-card.del { opacity: 0.45; }
.pm-thumb { width: 100%; aspect-ratio: 3 / 4; display: grid; place-items: center; overflow: hidden; }
.pm-thumb canvas { max-width: 100%; max-height: 100%; background: #fff; box-shadow: 0 1px 4px rgb(0 0 0 / 0.25); transform: rotate(var(--r, 0deg)); transition: transform 0.15s; }
.pm-thumb[style*="90deg"] canvas, .pm-thumb[style*="270deg"] canvas { max-width: 75%; max-height: 75%; }
.pm-blank { width: 70%; aspect-ratio: 3 / 4; display: grid; place-items: center; text-align: center; font-size: 0.75rem; color: var(--muted); background: #fff; border: 1px dashed var(--line); }
.pm-n { font-size: 0.78rem; color: var(--muted); }
.pm-bar { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; }
.pm-bar .icon-btn { width: 30px; height: 30px; min-width: 0; padding: 0; font-size: 0.85rem; }
.pm-info { flex: 1; color: var(--muted); font-size: 0.85rem; }

/* ---------- offline režim ---------- */
.sync-chip {
  position: fixed; left: 12px; bottom: 12px; z-index: 9999;
  border: 0; border-radius: 999px; padding: 6px 14px; font: inherit; font-size: .85rem; cursor: pointer;
  background: #b02a6b; color: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.sync-chip.is-offline { background: #5b5560; }
.sync-chip[hidden] { display: none; }
.doc-pending { opacity: .75; }
.doc-pending .doc-main { cursor: default; }

/* ---------- grafy ---------- */
.chart-wrap { display: grid; grid-template-columns: minmax(300px, 440px) 1fr; gap: 14px; padding: 12px; align-items: start; }
.chart-side { display: grid; gap: 12px; min-width: 0; }
.chart-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; min-width: 0; }
.chart-box h3 { margin: 0 0 8px; font-size: 1rem; }
.chart-hint { margin: 0 0 8px; font-size: 0.85rem; color: var(--muted); }
.chart-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chart-grid-scroll { max-height: 340px; }
.grid-table td input.hdr { font-weight: 700; background: #f3f0e8; }
.type-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.type-btn { display: grid; gap: 2px; place-items: center; text-align: center; padding: 8px 4px; min-height: 64px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); font: inherit; font-size: 0.78rem; color: var(--ink); cursor: pointer; }
.type-btn.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.type-ico { font-size: 1.3rem; line-height: 1; }
.opt-form { display: grid; gap: 8px; }
.opt { display: grid; gap: 3px; font-size: 0.85rem; color: var(--muted); }
.opt input[type=text], .opt select { padding: 8px; border: 1px solid var(--line); border-radius: 8px; font: inherit; color: var(--ink); background: var(--surface); min-height: 40px; }
.opt.chk { display: flex; align-items: center; gap: 8px; color: var(--ink); min-height: 36px; }
.opt-checks { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.series-colors { display: grid; gap: 6px; }
.series-row { display: flex; align-items: center; gap: 10px; }
.series-row input[type=color] { width: 40px; height: 32px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: none; }
.chart-main { display: grid; gap: 10px; min-width: 0; position: sticky; top: 0; }
.chart-preview { background: repeating-conic-gradient(#f0f0f0 0 25%, #fff 0 50%) 0 0 / 16px 16px; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; overflow: auto; max-height: calc(100vh - 230px); }
@media (max-width: 900px) { .chart-wrap { grid-template-columns: 1fr; } .chart-main { position: static; order: -1; } .chart-preview { max-height: none; } }
.charts-page { max-width: 1100px; margin: 0 auto; padding: 16px; }
.chart-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; margin-top: 12px; }
.chart-tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; display: grid; gap: 8px; }
.chart-thumb { display: grid; place-items: center; min-height: 130px; background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; text-decoration: none; font-size: 2rem; }
.chart-name { font-weight: 600; color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.chart-tile-actions { display: flex; gap: 6px; }
