@font-face { font-family: "DejaVu Sans"; src: url(/vendor/fonts/DejaVuSans.ttf); font-weight: normal; font-style: normal; }
@font-face { font-family: "DejaVu Sans"; src: url(/vendor/fonts/DejaVuSans-Bold.ttf); font-weight: bold; font-style: normal; }
@font-face { font-family: "DejaVu Sans"; src: url(/vendor/fonts/DejaVuSans-Oblique.ttf); font-weight: normal; font-style: italic; }
@font-face { font-family: "DejaVu Sans"; src: url(/vendor/fonts/DejaVuSans-BoldOblique.ttf); font-weight: bold; font-style: italic; }
@font-face { font-family: "DejaVu Serif"; src: url(/vendor/fonts/DejaVuSerif.ttf); font-weight: normal; font-style: normal; }
@font-face { font-family: "DejaVu Serif"; src: url(/vendor/fonts/DejaVuSerif-Bold.ttf); font-weight: bold; font-style: normal; }
@font-face { font-family: "DejaVu Serif"; src: url(/vendor/fonts/DejaVuSerif-Italic.ttf); font-weight: normal; font-style: italic; }
@font-face { font-family: "DejaVu Serif"; src: url(/vendor/fonts/DejaVuSerif-BoldItalic.ttf); font-weight: bold; font-style: italic; }
@font-face { font-family: "DejaVu Sans Mono"; src: url(/vendor/fonts/DejaVuSansMono.ttf); font-weight: normal; font-style: normal; }
@font-face { font-family: "DejaVu Sans Mono"; src: url(/vendor/fonts/DejaVuSansMono-Bold.ttf); font-weight: bold; font-style: normal; }
@font-face { font-family: "DejaVu Sans Mono"; src: url(/vendor/fonts/DejaVuSansMono-Oblique.ttf); font-weight: normal; font-style: italic; }
@font-face { font-family: "DejaVu Sans Mono"; src: url(/vendor/fonts/DejaVuSansMono-BoldOblique.ttf); font-weight: bold; font-style: italic; }
:root { --ribbon-bg: #f3f3f3; --ribbon-line: #cfcfcf; --accent: #e8a317; --file: #b8423f; --sel: #fde9a8; --ui: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; }
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; font-family: var(--ui); font-size: 13px; color: #222; background: #5a5a5a; }
.hidden { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }

/* login */
.login-body { display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #2c3e5a, #1b2433); }
.login-card { width: 340px; background: #fff; border-radius: 10px; padding: 28px; box-shadow: 0 20px 60px rgba(0,0,0,.4); display: flex; flex-direction: column; gap: 14px; }
.login-logo { font-size: 28px; text-align: center; letter-spacing: .5px; color: #2c3e5a; } .login-logo b { color: var(--file); }
.login-card [hidden] { display: none !important; }
.login-card label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: #555; }
.login-card input { font: inherit; font-size: 15px; padding: 9px 10px; border: 1px solid #bbb; border-radius: 6px; }
.login-card input:focus { outline: 2px solid #2c3e5a55; border-color: #2c3e5a; }
.login-card label.login-remember { flex-direction: row; align-items: flex-start; gap: 8px; font-size: 12px; line-height: 1.35; cursor: pointer; }
.login-card .login-remember input { width: 16px; height: 16px; padding: 0; margin: 1px 0 0; flex: none; }
.login-card button { padding: 10px; border: 0; border-radius: 6px; background: #2c3e5a; color: #fff; font-size: 15px; }
.login-card button:disabled { opacity: .6; }
.login-err { color: #b3261e; min-height: 18px; font-size: 12px; text-align: center; }

/* layout */
#app { display: flex; flex-direction: column; height: 100%; }
#tabs { display: flex; background: #e4e4e4; border-bottom: 1px solid var(--ribbon-line); padding: 0 0 0 0; flex: none; overflow-x: auto; }
#tabs button { border: 0; background: transparent; padding: 7px 14px; font-size: 14px; white-space: nowrap; border-top: 3px solid transparent; }
#tabs button:hover { background: #ececec; }
#tabs button.on { background: var(--ribbon-bg); border-top-color: var(--accent); }
#tabs button.file { background: var(--file); color: #fff; padding: 7px 22px; }
#tabs button.file:hover { background: #c9524f; }
#tabs .spacer { flex: 1; }
#tabs .who { padding: 8px 12px; color: #666; white-space: nowrap; }
#ribbon { background: var(--ribbon-bg); border-bottom: 1px solid var(--ribbon-line); display: flex; align-items: stretch; height: 128px; min-height: 128px; overflow-x: auto; overflow-y: hidden; flex: none; }
.grp { display: flex; flex-direction: column; border-right: 1px solid #d9d9d9; padding: 3px 4px 0; }
.grp .items { display: flex; align-items: flex-start; gap: 1px; flex: 1; }
.grp .name { text-align: center; font-size: 11px; color: #777; padding: 2px 0 3px; }
.stack { display: flex; flex-direction: column; justify-content: center; gap: 1px; align-self: stretch; }
.rb { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 2px; border: 1px solid transparent; background: transparent; border-radius: 3px; padding: 4px 6px; min-width: 52px; font-size: 12px; line-height: 1.15; text-align: center; }
.rb svg { width: 32px; height: 32px; flex: none; }
.rb:hover { background: #fff4d0; border-color: #e5c97a; }
.rb.on { background: var(--sel); border-color: #e0b24a; }
.rb:disabled { opacity: .4; cursor: default; }
.rb.sm { flex-direction: row; gap: 6px; padding: 2px 8px 2px 4px; min-width: 0; font-size: 12.5px; justify-content: flex-start; }
.rb.sm svg { width: 20px; height: 20px; }
.rb.ico { min-width: 0; padding: 3px; } .rb.ico svg { width: 22px; height: 22px; }
.ctl { display: flex; align-items: center; gap: 4px; padding: 2px 4px; }
.ctl input[type=text], .ctl input[type=number], .ctl select { font: inherit; padding: 3px 5px; border: 1px solid #bbb; border-radius: 3px; background: #fff; }
.ctl input.pg { width: 48px; text-align: right; }
.ctl input.zm { width: 74px; }
.ctl select { max-width: 140px; }
#doctabs { background: #3b3b3b; padding: 4px 6px 0; flex: none; display: flex; }
.doctab { background: linear-gradient(#ffeaa8, #fddb78); border: 1px solid #b6902e; border-bottom: 0; border-radius: 3px 3px 0 0; padding: 4px 12px; display: flex; gap: 12px; align-items: center; max-width: 60%; }
#docname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
#savestate { font-size: 11px; color: #6b5a1d; white-space: nowrap; }
#main { flex: 1; display: flex; min-height: 0; background: #7a7a7a; }
#side { width: 190px; background: #f7f7f7; display: flex; flex-direction: column; border-right: 1px solid #999; flex: none; }
#side.collapsed { display: none; }
#sidetabs { display: flex; border-bottom: 1px solid #ccc; flex: none; }
#sidetabs button { flex: 1; border: 0; background: #e6e6e6; padding: 6px 2px; font-size: 11px; border-bottom: 2px solid transparent; }
#sidetabs button.on { background: #fff; border-bottom-color: var(--accent); }
.sidepanel { flex: 1; overflow: auto; padding: 8px; }
.thumb { display: block; margin: 0 auto 10px; text-align: center; cursor: pointer; }
.thumb canvas { background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); border: 2px solid transparent; display: block; margin: 0 auto 3px; }
.thumb.cur canvas { border-color: var(--accent); }
.thumb span { font-size: 11px; color: #555; }
.ol { list-style: none; margin: 0; padding-left: 12px; } .ol.root { padding-left: 0; }
.ol a { display: block; padding: 3px 4px; color: #123; text-decoration: none; border-radius: 3px; cursor: pointer; font-size: 12.5px; }
.ol a:hover { background: #ffe9a8; }
.cm { border: 1px solid #ddd; border-left: 4px solid #ccc; background: #fff; border-radius: 3px; padding: 5px 7px; margin-bottom: 6px; cursor: pointer; font-size: 12px; }
.cm:hover, .cm.sel { background: #fff4d0; }
.cm small { color: #777; display: block; } .cm div { white-space: pre-wrap; word-break: break-word; max-height: 4.5em; overflow: hidden; }
.muted { color: #888; font-size: 12px; padding: 8px; }
#viewerWrap { flex: 1; position: relative; min-width: 0; }
#viewerContainer { position: absolute; inset: 0; overflow: auto; background: #7a7a7a; }
#viewerContainer.hand { cursor: grab; } #viewerContainer.hand.grabbing { cursor: grabbing; }
#viewerContainer.hand .textLayer, #viewerContainer.tool-draw .textLayer, #viewerContainer.tool-edit .textLayer { user-select: none; -webkit-user-select: none; pointer-events: none; }
#viewerContainer.tool-draw, #viewerContainer.tool-stamp, #viewerContainer.tool-note, #viewerContainer.tool-text { cursor: crosshair; }
#viewerContainer.tool-eraser { cursor: not-allowed; }
.pdfViewer .page { box-shadow: 0 2px 8px rgba(0,0,0,.5); background-clip: padding-box; }
#empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #ddd; font-size: 16px; }
#findbar { position: absolute; top: 8px; right: 24px; z-index: 30; background: #fff; border: 1px solid #aaa; border-radius: 6px; padding: 6px 8px; display: flex; gap: 6px; align-items: center; box-shadow: 0 4px 16px rgba(0,0,0,.35); }
#findbar input[type=text], #findbar input:not([type]) { width: 220px; padding: 4px 6px; border: 1px solid #aaa; border-radius: 3px; font: inherit; }
#findbar button { border: 1px solid #bbb; background: #f4f4f4; border-radius: 3px; padding: 2px 8px; }
#findbar label { display: flex; gap: 4px; align-items: center; font-size: 12px; } #findcount { font-size: 12px; color: #555; min-width: 60px; }
#props { width: 210px; background: #f7f7f7; border-left: 1px solid #999; padding: 8px; overflow: auto; flex: none; }
#props h4 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; color: #666; letter-spacing: .4px; }
#props .row { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 8px; }
#props .row input[type=range] { width: 110px; } #props .row input[type=number] { width: 60px; }
#props .sw { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 8px; }
#props .sw i { width: 20px; height: 20px; border-radius: 3px; border: 1px solid #0003; cursor: pointer; display: block; }
#props .sw i.on { outline: 2px solid #222; }
#statusbar { background: #e4e4e4; border-top: 1px solid #aaa; padding: 3px 10px; display: flex; gap: 20px; font-size: 12px; color: #444; flex: none; }
#st-msg { flex: 1; } 

/* annotation layer */
.annot-layer { position: absolute; left: 0; top: 0; width: 100%; height: 100%; z-index: 5; pointer-events: none; overflow: visible; }
.annot-layer g.ann.clk, .annot-layer g.ann.hit { pointer-events: all; cursor: pointer; }
.annot-layer g.ann.hit.ed { cursor: move; }
.annot-layer .ui * { pointer-events: none; }
.annot-layer .ui .handle { pointer-events: all; }
.annot-layer.annot-hl { z-index: 4; mix-blend-mode: multiply; pointer-events: none; }
.annot-layer.annot-hl * { pointer-events: none; }
.annot-layer text { white-space: pre; }
.hidden-annots .annot-layer { display: none; }
.txt-edit { position: absolute; z-index: 25; margin: 0; outline: 1px dashed #2b6cb0; background: rgba(255,255,255,.88); }
.txt-ed, .annot-layer text { font-synthesis: none; }
.txt-ed { display: block; outline: none; margin: 0; line-height: 1.2; white-space: pre; min-width: 40px; cursor: text; overflow: hidden; }
.txt-edit.wrap .txt-ed { white-space: pre-wrap; overflow-wrap: break-word; }
.txt-ed sup, .txt-ed sub { font-size: 65%; line-height: 0; vertical-align: baseline; position: relative; }
.txt-ed sup { top: -.5em; } .txt-ed sub { top: .2em; }
.txt-grip { position: absolute; left: 0; top: -16px; height: 16px; padding: 0 8px; background: #2b6cb0; color: #fff; font: 11px/16px var(--ui); border-radius: 4px 4px 0 0; cursor: move; user-select: none; -webkit-user-select: none; white-space: nowrap; touch-action: none; }
.annot-layer g.ann.hit.tx { cursor: text; }

/* barra di formattazione del testo */
#fmtbar, #shapebar { flex: none; display: flex; align-items: center; gap: 4px; padding: 4px 8px; background: #fbfbfb; border-bottom: 1px solid var(--ribbon-line); min-height: 36px; overflow-x: auto; }
#fmtbar .fb-title { font-weight: 600; color: #555; margin-right: 4px; }
#shapebar .fb-title { font-weight: 600; color: #555; margin-right: 4px; }
#fmtbar select.fb-font { max-width: 190px; }
#fmtbar select, #fmtbar input.fb-size { font: inherit; padding: 3px 5px; border: 1px solid #bbb; border-radius: 3px; background: #fff; height: 26px; }
#shapebar select, #shapebar input.fb-size { font: inherit; padding: 3px 5px; border: 1px solid #bbb; border-radius: 3px; background: #fff; height: 26px; }
#fmtbar input.fb-size { width: 44px; text-align: right; border-right: 0; border-radius: 3px 0 0 3px; }
#shapebar input.fb-size { width: 44px; text-align: right; border-right: 0; border-radius: 3px 0 0 3px; }
#fmtbar .fb-sizebox { display: inline-flex; }
#shapebar .fb-sizebox { display: inline-flex; }
#fmtbar .fb-sizebtn { height: 26px; width: 22px; padding: 0; border: 1px solid #bbb; border-radius: 0 3px 3px 0; background: #fff; }
#shapebar .fb-sizebtn { height: 26px; width: 22px; padding: 0; border: 1px solid #bbb; border-radius: 0 3px 3px 0; background: #fff; }
#fmtbar .fb-sizebtn:hover { background: #fff0c4; }
#shapebar .fb-sizebtn:hover { background: #fff0c4; }
#fmtbar .fb { min-width: 28px; height: 26px; padding: 0 6px; border: 1px solid transparent; background: transparent; border-radius: 3px; display: inline-flex; align-items: center; justify-content: center; gap: 1px; position: relative; font-size: 14px; }
#shapebar .fb { min-width: 28px; height: 26px; padding: 0 6px; border: 1px solid transparent; background: transparent; border-radius: 3px; display: inline-flex; align-items: center; justify-content: center; gap: 1px; position: relative; font-size: 14px; }
#fmtbar .fb:hover:not(:disabled) { background: #fff4d0; border-color: #e5c97a; } #fmtbar .fb.on { background: var(--sel); border-color: #e0b24a; }
#shapebar .fb:hover:not(:disabled) { background: #fff4d0; border-color: #e5c97a; } #shapebar .fb.on { background: var(--sel); border-color: #e0b24a; }
#fmtbar .fb:disabled { opacity: .35; cursor: default; }
#shapebar .fb:disabled { opacity: .35; cursor: default; }
#fmtbar .fb .a { font-weight: 700; font-size: 15px; } #fmtbar .fb .a.hl { font-size: 12px; background: #ffeb3b; padding: 0 2px; border-radius: 2px; }
#shapebar .fb .a { font-weight: 700; font-size: 15px; } #shapebar .fb .a.hl { font-size: 12px; background: #ffeb3b; padding: 0 2px; border-radius: 2px; }
#fmtbar .fb .bar { position: absolute; left: 5px; right: 14px; bottom: 2px; height: 3px; border-radius: 1px; border: 1px solid #0002; }
#shapebar .fb .bar { position: absolute; left: 5px; right: 14px; bottom: 2px; height: 3px; border-radius: 1px; border: 1px solid #0002; }
#fmtbar .fb .car { font-size: 9px; margin-left: 2px; color: #666; }
#shapebar .fb .car { font-size: 9px; margin-left: 2px; color: #666; }
#fmtbar .fb-sep { width: 1px; height: 20px; background: #d5d5d5; margin: 0 4px; }
#shapebar .fb-sep { width: 1px; height: 20px; background: #d5d5d5; margin: 0 4px; }
#fmtbar .fb-hint { color: #888; font-size: 12px; margin-left: 10px; white-space: nowrap; }
#shapebar .fb-hint { color: #888; font-size: 12px; margin-left: 10px; white-space: nowrap; }
.menu .swgrid { display: grid; grid-template-columns: repeat(7, 22px); gap: 4px; padding: 4px 12px 8px; }
.menu .swb { width: 22px; height: 22px; padding: 0; border: 1px solid #0003; border-radius: 3px; cursor: pointer; display: block; }
.menu .swb:hover { outline: 2px solid #222; }
.menu .swcustom { display: flex; align-items: center; gap: 6px; padding: 6px 14px; font-size: 12px; color: #444; }

/* popups */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 100; display: flex; align-items: center; justify-content: center; }
.box { background: #fff; border-radius: 8px; box-shadow: 0 20px 60px rgba(0,0,0,.45); max-width: 94vw; max-height: 90vh; overflow: auto; }
.box h3 { margin: 0; padding: 14px 18px; border-bottom: 1px solid #e3e3e3; font-size: 16px; display: flex; justify-content: space-between; align-items: center; }
.box .body { padding: 14px 18px; } .box .foot { padding: 10px 18px 14px; display: flex; gap: 8px; justify-content: flex-end; }
.btn { border: 1px solid #b5b5b5; background: #f4f4f4; border-radius: 5px; padding: 6px 14px; } .btn:hover { background: #fff4d0; }
.btn.primary { background: #2c3e5a; color: #fff; border-color: #2c3e5a; } .btn.danger { color: #b3261e; }
.lib { width: 760px; }
.lib .drop { border: 2px dashed #aaa; border-radius: 8px; padding: 18px; text-align: center; color: #666; margin-bottom: 12px; }
.lib .drop.over { background: #fff4d0; border-color: var(--accent); }
.lib table { width: 100%; border-collapse: collapse; } .lib td, .lib th { padding: 7px 8px; border-bottom: 1px solid #eee; text-align: left; }
.lib tr:hover td { background: #fafafa; } .lib td.n { cursor: pointer; color: #1a4d8f; word-break: break-word; } .lib td.a { white-space: nowrap; text-align: right; }
.lib td.a button { border: 0; background: transparent; padding: 3px 6px; border-radius: 3px; } .lib td.a button:hover { background: #eee; }
.menu { position: fixed; z-index: 90; background: #fff; border: 1px solid #aaa; border-radius: 4px; box-shadow: 0 6px 20px rgba(0,0,0,.35); padding: 4px 0; min-width: 190px; max-height: 70vh; overflow: auto; }
.menu button { display: flex; width: 100%; align-items: center; gap: 8px; border: 0; background: transparent; text-align: left; padding: 6px 14px; }
.menu button:hover { background: #fff0c4; } .menu hr { border: 0; border-top: 1px solid #e3e3e3; margin: 4px 0; }
.menu .lbl { padding: 4px 14px; font-size: 11px; color: #777; text-transform: uppercase; letter-spacing: .4px; }
.menu .stamps { display: grid; grid-template-columns: repeat(2, 150px); gap: 8px; padding: 6px 10px; }
.menu .stamp { position: relative; border: 1px solid #ddd; background: #fff; border-radius: 4px; padding: 4px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: #555; }
.menu .stamp:hover { background: #fff4d0; border-color: #e0b24a; } .menu .stamp img { max-width: 100%; max-height: 52px; }
.menu .stamp .x { position: absolute; right: 2px; top: 0; color: #b3261e; display: none; } .menu .stamp:hover .x { display: block; }
.notepop { position: fixed; z-index: 80; width: 260px; background: #fffbe0; border: 1px solid #b6902e; border-radius: 6px; box-shadow: 0 6px 20px rgba(0,0,0,.35); padding: 8px; }
.notepop textarea { width: 100%; height: 110px; font: inherit; border: 1px solid #d9c06a; background: #fff; border-radius: 4px; padding: 5px; resize: vertical; }
.notepop .r { display: flex; gap: 6px; justify-content: space-between; margin-top: 6px; }
.sigpad { border: 1px solid #aaa; border-radius: 4px; background: #fff; touch-action: none; cursor: crosshair; display: block; }
#toast { position: fixed; bottom: 34px; left: 50%; transform: translateX(-50%); background: #222; color: #fff; padding: 9px 16px; border-radius: 6px; z-index: 200; box-shadow: 0 4px 14px rgba(0,0,0,.4); max-width: 80vw; }
#toast.err { background: #b3261e; }

#shapebar .fb-dash { min-width: 70px; } #shapebar .dv { display: inline-flex; }
.menu .dashopt { display: flex; align-items: center; gap: 8px; }
.menu .dashopt svg { flex: none; }
