@font-face {
  font-family: FileLabSans;
  src: url("../vendor/fonts/Sans.ttf");
}
@font-face {
  font-family: FileLabSans;
  src: url("../vendor/fonts/Sans-Bold.ttf");
  font-weight: 700;
}
@font-face {
  font-family: FileLabSerif;
  src: url("../vendor/fonts/Serif.ttf");
}
@font-face {
  font-family: FileLabMono;
  src: url("../vendor/fonts/Mono.ttf");
}
:root {
  --bg: #151919;
  --surface: #1b2020;
  --panel: #1c2222;
  --line: #303838;
  --line-soft: #293131;
  --text: #e1e7e3;
  --muted: #94a39d;
  --green: #b2f2c3;
  --green-ink: #17382b;
  --workspace: #111616;
  --input: #151b1a;
  --hover: #2c3732;
  --danger: #ffa99c;
  --shadow: 0 12px 60px #0004;
  color-scheme: dark;
}
html[data-theme="light"] {
  --bg: #f1f4f1;
  --surface: #fff;
  --panel: #f9fbf9;
  --line: #d7e0d9;
  --line-soft: #e4e9e3;
  --text: #243b32;
  --muted: #657a6e;
  --green: #244f3e;
  --green-ink: #fff;
  --workspace: #e6ece7;
  --input: #fff;
  --hover: #e9f0e8;
  --danger: #b3261e;
  --shadow: 0 10px 40px #233d351a;
  color-scheme: light;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font:
    12px FileLabSans,
    system-ui,
    sans-serif;
  color: var(--text);
  background: var(--bg);
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
button,
input,
select,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
  color: inherit;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 6px;
  transition: background 0.12s;
}
button:hover:not(:disabled) {
  background: var(--hover);
}
button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}
a {
  color: inherit;
  text-decoration: none;
}
input,
select,
textarea {
  border: 1px solid var(--line);
  background: var(--input);
  color: var(--text);
  border-radius: 5px;
  padding: 8px;
  min-width: 0;
  max-width: 100%;
}
input[type="color"] {
  padding: 3px;
  width: 34px;
  height: 31px;
  cursor: pointer;
}
input[type="range"] {
  padding: 0;
  width: 100%;
  accent-color: var(--green);
}
textarea {
  resize: vertical;
  width: 100%;
  line-height: 1.6;
}
input:focus,
textarea:focus,
select:focus {
  outline: 1px solid var(--green);
}
.hidden {
  display: none !important;
}
.app-header {
  height: 76px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 28px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.sigil {
  width: 38px;
  height: 42px;
  display: grid;
  place-items: center;
  background: #263c30;
  border: 1px solid #47674e;
  border-radius: 8px;
  color: #bbf9b4;
  font-size: 31px;
}
.brand b {
  font-size: 19px;
  letter-spacing: -0.6px;
}
.brand b span {
  font-weight: 400;
}
.brand small {
  display: block;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 3.2px;
  margin-top: 5px;
}
.privacy {
  font-size: 11px;
  color: var(--muted);
  margin-left: auto;
}
.privacy i,
.right-note i {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--green);
  border-radius: 50%;
  margin-right: 7px;
}
.header-actions {
  display: flex;
  gap: 7px;
  align-items: center;
}
.button {
  border: 1px solid var(--line);
  padding: 10px 17px;
  font-weight: 700;
  background: var(--panel);
  white-space: nowrap;
}
.button.primary {
  background: var(--green);
  border-color: var(--green);
  color: var(--green-ink);
}
.button.primary:hover:not(:disabled) {
  filter: brightness(1.07);
  background: var(--green);
}
.button.primary span {
  margin-left: 12px;
}
.icon-button {
  width: 33px;
  height: 33px;
  font-size: 18px;
}
.mode-tabs {
  height: 51px;
  display: flex;
  align-items: stretch;
  flex-shrink: 0;
  padding-left: 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.mode {
  padding: 0 20px;
  border-radius: 0;
  color: var(--muted);
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
}
.mode > span {
  font-size: 20px;
}
.mode small {
  font-size: 8px;
  letter-spacing: 0.7px;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 3px 5px;
  border-radius: 3px;
}
.mode.active {
  color: var(--green);
  background: var(--hover);
}
.mode.active:after {
  content: "";
  position: absolute;
  height: 2px;
  bottom: -1px;
  left: 0;
  right: 0;
  background: var(--green);
}
.local-label {
  margin: auto 25px auto auto;
  font-size: 9px;
  letter-spacing: 1px;
  color: var(--muted);
}
.file-bar {
  height: 40px;
  flex-shrink: 0;
  display: flex;
  gap: 15px;
  align-items: center;
  padding: 0 23px;
  border-bottom: 1px solid var(--line);
}
#file-name {
  max-width: 35vw;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
#file-meta {
  color: var(--muted);
  font-size: 10px;
}
.history {
  display: flex;
  gap: 8px;
  margin-left: auto;
}
.history button {
  font-size: 18px;
  padding: 3px 10px;
}
.history span {
  font-size: 11px;
  vertical-align: middle;
}
.toolbar {
  min-height: 48px;
  flex-shrink: 0;
  padding: 6px 15px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  overflow-x: auto;
}
.toolset {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.toolset button {
  height: 33px;
  padding: 0 10px;
  font-size: 17px;
  display: flex;
  gap: 7px;
  align-items: center;
}
.toolset button span {
  font-size: 11px;
}
.toolset button.active {
  background: var(--hover);
  color: var(--green);
  border-color: var(--line);
}
.toolset > i {
  height: 23px;
  width: 1px;
  background: var(--line);
  margin: 0 9px;
}
.compact {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: var(--muted);
  margin-left: 7px;
}
.compact input[type="number"] {
  width: 45px;
  height: 31px;
  padding: 5px;
}
.workbench {
  display: grid;
  grid-template-columns: 185px minmax(0, 1fr) 270px;
  flex: 1;
  min-height: 0;
}
.left-panel,
.right-panel {
  background: var(--panel);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.left-panel {
  border-right: 1px solid var(--line);
}
.right-panel {
  border-left: 1px solid var(--line);
}
.panel-heading {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  letter-spacing: 1.3px;
  color: var(--muted);
  height: 47px;
  align-items: center;
  padding: 0 16px;
  border-bottom: 1px solid var(--line-soft);
  flex-shrink: 0;
}
.panel-heading span:last-child {
  font-size: 9px;
  letter-spacing: 0;
}
.page-actions {
  display: flex;
  justify-content: center;
  padding: 7px 5px;
  border-bottom: 1px solid var(--line-soft);
}
.page-actions button {
  font-size: 18px;
  width: 31px;
  height: 29px;
}
.side-list {
  flex: 1;
  overflow: auto;
  padding: 16px 13px;
}
.side-placeholder {
  color: var(--muted);
  line-height: 1.8;
  text-align: center;
  font-size: 10px;
  padding: 32px 0;
}
.side-bottom {
  border-top: 1px solid var(--line);
  padding: 9px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.side-bottom button {
  padding: 10px 7px;
  text-align: left;
  font-size: 10px;
}
.thumbnail {
  display: flex;
  width: 100%;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 10px;
  margin-bottom: 9px;
  border: 1px solid transparent;
  border-radius: 7px;
}
.thumbnail.active {
  border-color: var(--green);
  background: var(--hover);
}
.thumbnail canvas {
  background: white;
  box-shadow: 0 2px 8px #0004;
  width: 98px;
  max-height: 140px;
  object-fit: contain;
}
.thumbnail span {
  font-size: 10px;
  color: var(--muted);
}
.layer-row {
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  width: 100%;
  padding: 12px 9px;
  border: 1px solid var(--line);
  margin-bottom: 7px;
  overflow: hidden;
}
.layer-row.active {
  border-color: var(--green);
  color: var(--green);
  background: var(--hover);
}
.layer-row span:last-child {
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}
.workspace {
  min-width: 0;
  min-height: 0;
  background: var(--workspace);
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background-image: radial-gradient(var(--line-soft) 0.7px, transparent 0.7px);
  background-size: 17px 17px;
}
.workspace-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 40px;
  display: flex;
  justify-content: space-between;
  padding: 15px 20px;
  pointer-events: none;
  font-size: 9px;
  letter-spacing: 1px;
  color: var(--muted);
  z-index: 2;
}
.empty-state {
  margin: auto;
  text-align: center;
  padding: 45px 20px 35px;
  max-height: 100%;
  overflow: auto;
}
.empty-icon {
  font-size: 45px;
  width: 82px;
  height: 82px;
  display: grid;
  place-items: center;
  border: 1px solid #42574a;
  background: #24372c;
  color: #b2f2c3;
  border-radius: 21px;
  margin: 0 auto 25px;
  box-shadow: 0 0 0 8px #729c7910;
}
.eyebrow {
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--muted);
}
h1 {
  font-size: 31px;
  letter-spacing: -1.3px;
  font-weight: 400;
  margin: 15px 0;
}
.empty-state > p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.9;
  font-size: 12px;
}
.empty-state > .button {
  margin-top: 15px;
  padding: 12px 22px;
}
.drop-hint {
  display: block;
  color: var(--muted);
  font-size: 10px;
  margin-top: 11px;
}
.format-pills {
  display: flex;
  gap: 7px;
  justify-content: center;
  margin: 25px 0 12px;
}
.format-pills span {
  font-size: 8px;
  letter-spacing: 0.5px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 5px 9px;
}
.text-button {
  font-size: 10px;
  color: var(--green);
  padding: 8px;
}
.empty-note {
  margin-top: 28px;
  line-height: 1.8;
  color: var(--muted);
  font-size: 10px;
}
.empty-note > span {
  color: var(--green);
  padding-right: 5px;
}
.viewport {
  overflow: auto;
  flex: 1;
  padding: 55px 35px 75px;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  min-height: 0;
}
.pdf-sheet {
  position: relative;
  box-shadow: var(--shadow);
  background: #fff;
  flex-shrink: 0;
  margin: 0 auto;
  touch-action: none;
}
.pdf-sheet > canvas:first-child {
  display: block;
}
.pdf-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
}
.pdf-hit {
  position: absolute;
  border: 1px solid transparent;
  white-space: pre;
  overflow: hidden;
  color: transparent;
  line-height: 1;
  user-select: none;
  cursor: move;
}
.pdf-hit:hover {
  border-color: #46af95;
  background: #36ad8d10;
}
.pdf-hit.selected {
  border: 1.5px solid #239875;
  background: #36ad8d13;
}
.pdf-hit.copyable {
  user-select: text;
  cursor: text;
}
.pdf-hit::selection {
  background: #33d5ab66;
  color: transparent;
}
.resize-handle {
  position: absolute;
  width: 18px;
  height: 18px;
  background: #168c6a;
  border: 1px solid white;
  right: 0;
  bottom: 0;
  cursor: nwse-resize;
  z-index: 3;
  touch-action: none;
  border-radius: 3px;
}
.pdf-hit.selected {
  overflow: visible;
  z-index: 4 !important;
}
.pdf-hit.selected.copyable {
  overflow: hidden;
}
#draw-preview {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}
.drawing .pdf-hit {
  pointer-events: none;
}
.drawing .pdf-overlay {
  cursor: crosshair;
}
.image-canvas {
  box-shadow: var(--shadow);
  display: block;
  max-width: none;
  margin: 0 auto;
  flex-shrink: 0;
  touch-action: none;
  background-image:
    linear-gradient(45deg, #ccc 25%, transparent 25%),
    linear-gradient(-45deg, #ccc 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #ccc 75%),
    linear-gradient(-45deg, transparent 75%, #ccc 75%);
  background-size: 20px 20px;
  background-position:
    0 0,
    0 10px,
    10px -10px,
    -10px 0;
}
.docx-paper {
  box-shadow: var(--shadow);
  background: #fff;
  color: #1e2a25;
  width: 794px;
  min-height: 1080px;
  padding: 80px 76px;
  margin: 0 auto;
  flex-shrink: 0;
  font:
    14px FileLabSans,
    sans-serif;
  line-height: 1.6;
}
.doc-paragraph {
  min-height: 1.6em;
  margin: 0 0 10px;
  outline: none;
  word-break: break-word;
}
.doc-paragraph:focus {
  box-shadow: -3px 0 #37a786;
  padding-left: 8px;
}
.doc-paragraph img {
  max-width: 100%;
  object-fit: contain;
}
.doc-table {
  border-collapse: collapse;
  width: 100%;
  margin: 14px 0;
}
.doc-table td {
  border: 1px solid #b8c8c0;
  padding: 8px;
  min-width: 60px;
  vertical-align: top;
}
.doc-table .doc-paragraph {
  margin: 0;
}
.zoom-bar {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 7px;
  box-shadow: var(--shadow);
  padding: 4px;
  z-index: 5;
  white-space: nowrap;
}
.zoom-bar button {
  height: 28px;
  min-width: 29px;
  padding: 0 8px;
}
.zoom-bar span {
  font-size: 10px;
  min-width: 45px;
  text-align: center;
}
.inspector {
  padding: 17px;
  overflow: auto;
  flex: 1;
}
.inspector-empty {
  text-align: left;
  padding: 20px 0;
}
.inspector-empty > span {
  display: block;
  color: var(--muted);
  font-size: 28px;
  margin-bottom: 18px;
}
.inspector-empty h2 {
  font-weight: 400;
  font-size: 16px;
  line-height: 1.6;
  margin: 0 0 10px;
}
.inspector-empty p {
  font-size: 11px;
  line-height: 1.8;
  color: var(--muted);
}
.property-section {
  font-size: 9px;
  letter-spacing: 1px;
  margin: 20px 0 13px;
  color: var(--muted);
}
.property-section:first-child {
  margin-top: 0;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 13px;
}
.field > span {
  font-size: 10px;
  color: var(--muted);
}
.fields-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}
.inspector .button {
  width: 100%;
  font-size: 11px;
  padding: 10px 6px;
  margin-top: 7px;
}
.help-text {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.8;
}
.notice {
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--hover);
  line-height: 1.8;
  font-size: 10px;
  margin: 10px 0;
}
.danger {
  color: var(--danger);
}
.right-note {
  border-top: 1px solid var(--line);
  display: flex;
  gap: 4px;
  padding: 16px;
  flex-shrink: 0;
}
.right-note i {
  margin-top: 4px;
  flex-shrink: 0;
}
.right-note b {
  font-size: 10px;
  font-weight: 400;
}
.right-note p {
  margin: 5px 0 0;
  font-size: 9px;
  color: var(--muted);
  line-height: 1.7;
}
.statusbar {
  height: 29px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 9px;
  flex-shrink: 0;
}
.status-end {
  margin-left: auto;
  font-size: 8px;
  letter-spacing: 0.6px;
}
.status-end b {
  color: var(--green);
  font-size: 14px;
  margin-left: 7px;
}
#busy-label {
  color: var(--green);
}
dialog {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 23px;
  max-width: min(600px, 94vw);
  max-height: 90vh;
  width: 560px;
  box-shadow: var(--shadow);
}
dialog::backdrop {
  background: #0009;
  backdrop-filter: blur(3px);
}
.modal-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 17px;
}
.modal-heading h2 {
  font-weight: 400;
  font-size: 20px;
  margin: 0;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 23px;
}
#modal-body {
  line-height: 1.8;
  color: var(--muted);
  font-size: 12px;
}
#modal-body h3 {
  color: var(--text);
  font-size: 13px;
}
#modal-body a {
  color: var(--green);
  text-decoration: underline;
}
.drop-active:after {
  content: "Rilascia il file per aprirlo";
  position: absolute;
  inset: 8px;
  border: 2px dashed var(--green);
  background: var(--panel);
  display: grid;
  place-items: center;
  color: var(--green);
  font-size: 22px;
  z-index: 10;
  border-radius: 9px;
}
body.busy #busy-label:before {
  content: "●";
  display: inline-block;
  margin-right: 6px;
  animation: pulse 1s infinite;
}
body.busy #workspace {
  cursor: progress;
}
@keyframes pulse {
  50% {
    opacity: 0.3;
  }
}
.doc-info {
  line-height: 1.9;
  color: var(--muted);
}
.doc-info b {
  display: block;
  color: var(--text);
  font-size: 20px;
  font-weight: 400;
}
.size-inputs input {
  width: 100%;
}
@media (min-width: 1600px) {
  .workbench {
    grid-template-columns: 210px minmax(0, 1fr) 295px;
  }
  .app-header {
    padding: 0 29px;
  }
}
@media (max-width: 1120px) {
  .privacy,
  .local-label {
    display: none;
  }
  .app-header {
    height: 65px;
  }
  .header-actions {
    margin-left: auto;
  }
  .mode small {
    display: none;
  }
  .workbench {
    grid-template-columns: 140px minmax(0, 1fr) 235px;
  }
  .mode {
    padding: 0 17px;
  }
  .toolset button {
    padding: 0 7px;
  }
  .toolset button span {
    font-size: 10px;
  }
  .viewport {
    padding: 45px 15px 70px;
  }
}
@media (max-width: 800px) {
  .workbench {
    grid-template-columns: 105px minmax(0, 1fr) 210px;
  }
  .toolset {
    gap: 1px;
  }
  .toolset button span {
    display: none;
  }
  .brand b {
    font-size: 16px;
  }
  .app-header {
    padding: 0 12px;
    gap: 10px;
  }
  .header-actions {
    gap: 3px;
  }
  .button {
    padding: 9px 11px;
  }
  .thumbnail {
    padding: 5px;
  }
  .thumbnail canvas {
    width: 70px;
  }
  .side-bottom button {
    font-size: 9px;
  }
  .page-actions {
    flex-wrap: wrap;
  }
  .page-actions button {
    width: 28px;
  }
  .panel-heading {
    padding: 0 10px;
  }
  .inspector {
    padding: 12px;
  }
  .empty-state {
    padding: 50px 15px 25px;
  }
  h1 {
    font-size: 24px;
  }
  .empty-icon {
    width: 60px;
    height: 60px;
    font-size: 36px;
    margin-bottom: 16px;
  }
  .empty-note {
    margin-top: 14px;
  }
  .empty-state .eyebrow {
    font-size: 7px;
  }
  .format-pills {
    flex-wrap: wrap;
  }
  .history span {
    display: none;
  }
  .file-bar {
    padding: 0 12px;
  }
}
@media (max-width: 620px) {
  body {
    overflow: auto;
    min-height: 100dvh;
    height: auto;
  }
  .app-header {
    height: 62px;
  }
  .brand small {
    font-size: 7px;
  }
  .sigil {
    width: 29px;
    height: 34px;
    font-size: 26px;
  }
  .brand {
    gap: 7px;
  }
  .header-actions .icon-button {
    width: 25px;
  }
  #save {
    display: none;
  }
  .header-actions .button {
    font-size: 10px;
    padding: 8px;
  }
  .mode-tabs {
    padding-left: 4px;
    height: 45px;
  }
  .mode {
    padding: 0 13px;
    font-size: 11px;
  }
  .mode > span {
    font-size: 17px;
  }
  .file-bar {
    height: 37px;
  }
  #file-meta {
    font-size: 9px;
  }
  #file-name {
    max-width: 42vw;
    font-size: 10px;
  }
  .history button {
    padding: 2px 6px;
  }
  .toolbar {
    min-height: 44px;
  }
  .workbench {
    display: grid;
    grid-template-columns: 78px minmax(0, 1fr);
    grid-template-rows: minmax(410px, 60dvh) auto;
    flex: none;
    min-height: 70dvh;
  }
  .left-panel {
    grid-column: 1;
    grid-row: 1;
  }
  .workspace {
    grid-column: 2;
    grid-row: 1;
  }
  .right-panel {
    grid-column: 1/-1;
    grid-row: 2;
    border-top: 1px solid var(--line);
    border-left: 0;
    max-height: 580px;
    min-height: 140px;
  }
  .right-note {
    display: none;
  }
  .inspector-empty {
    padding: 0;
  }
  .inspector-empty > span {
    display: none;
  }
  .inspector-empty h2 {
    font-size: 13px;
  }
  .inspector-empty p {
    margin-bottom: 0;
  }
  .thumbnail canvas {
    width: 48px;
  }
  .thumbnail span {
    font-size: 8px;
  }
  .side-list {
    padding: 7px 4px;
  }
  .side-bottom {
    padding: 4px;
  }
  .side-bottom button {
    padding: 7px 2px;
    font-size: 8px;
  }
  .panel-heading {
    font-size: 8px;
    height: 36px;
    padding: 0 7px;
  }
  .page-actions button {
    font-size: 15px;
    width: 25px;
    height: 26px;
  }
  .workspace-top {
    padding: 10px;
    font-size: 7px;
  }
  .viewport {
    padding: 35px 10px 65px;
  }
  .empty-icon {
    width: 48px;
    height: 48px;
    font-size: 30px;
  }
  .empty-state {
    padding: 40px 14px 28px;
  }
  .empty-state .eyebrow {
    font-size: 7px;
    letter-spacing: 1px;
  }
  h1 {
    font-size: 21px;
  }
  .empty-state > p:not(.eyebrow) {
    font-size: 10px;
  }
  .empty-note {
    font-size: 8px;
  }
  .empty-state > .button {
    padding: 10px 15px;
    font-size: 11px;
  }
  .statusbar {
    height: 29px;
  }
  .status-end {
    display: none;
  }
  .zoom-bar {
    bottom: 12px;
  }
  .fields-row {
    grid-template-columns: 1fr 1fr;
  }
  .inspector {
    padding: 14px;
  }
  .property-section {
    margin: 13px 0 10px;
  }
  .right-panel .field {
    margin-bottom: 10px;
  }
  .format-pills {
    margin: 16px 0 6px;
  }
}
.sigil img {
  width: 38px;
  height: 42px;
  border-radius: 8px;
}
.empty-icon img {
  width: 82px;
  height: 82px;
  border-radius: 20px;
}
.status-end img {
  width: 17px;
  height: 17px;
  vertical-align: middle;
  margin-left: 7px;
}
.right-note p {
  white-space: pre-line;
}
@media (max-width: 800px) {
  .empty-icon img {
    width: 60px;
    height: 60px;
  }
}
@media (max-width: 620px) {
  .sigil img {
    width: 29px;
    height: 34px;
  }
  .empty-icon img {
    width: 48px;
    height: 48px;
  }
}
.doc-paragraph img:active {
  outline: 2px solid #28a882;
}

#draft-actions {
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--green);
  font-size: 10px;
}
#draft-actions .button {
  display: block;
  width: 100%;
  margin-top: 7px;
}
@media (max-width: 620px) {
  #save {
    display: block;
  }
  .brand small {
    letter-spacing: 1px;
    font-size: 6px;
  }
  .brand b {
    font-size: 13px;
  }
  .header-actions .button {
    padding: 7px 5px;
  }
}

/* V19: completion/signature tools and visible operation cancellation. */
.history #undo {
  background: var(--hover);
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--text);
}
.history #undo:disabled {
  opacity: 0.4;
}
.toolset #fill-sign {
  background: var(--hover);
  border: 1px solid var(--green);
  color: var(--green);
}
.toolset #fill-sign span {
  display: inline;
}
.tool-hint {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 16px;
  background: var(--hover);
  border-bottom: 1px solid var(--line);
  font-size: 11px;
}
.tool-hint button {
  border: 1px solid var(--line);
  padding: 5px 10px;
  white-space: nowrap;
  color: var(--text);
}
.fill-dialog {
  width: 620px;
  max-width: 94vw;
  max-height: 92dvh;
  overflow-y: auto;
  padding: 24px;
}
.fill-dialog [hidden] {
  display: none !important;
}
.fill-body {
  margin-top: 16px;
}
.fill-wide {
  width: 100%;
  margin: 12px 0 0;
}
.fill-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 18px 0;
}
.fill-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  white-space: normal;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  text-align: left;
}
.fill-card b {
  font: 26px/1 system-ui;
  color: var(--green);
}
.fill-card small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}
.fill-card:hover {
  background: var(--hover);
}
.signature-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.signature-tabs button {
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 5px;
}
.signature-tabs [aria-selected="true"] {
  background: var(--hover);
  color: var(--green);
  border-color: var(--green);
}
#signature-pad {
  display: block;
  width: 100%;
  height: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  touch-action: none;
  cursor: crosshair;
  margin: 10px 0;
}
#signature-type-preview {
  font:
    48px/1.7 "Google-Sacramento",
    cursive;
  min-height: 96px;
  display: flex;
  align-items: center;
  white-space: nowrap;
  overflow: auto;
  background: #fff;
  color: #183c60;
  padding: 8px 18px;
  border-radius: 6px;
}
.signature-label,
.signature-size-control > label {
  display: block;
  margin: 14px 0 8px;
  font-size: 12px;
  color: var(--muted);
}
.signature-styles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 8px 0 14px;
}
.signature-style {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  text-align: left;
}
.signature-style[aria-pressed="true"] {
  border-color: var(--green);
  box-shadow: inset 0 0 0 1px var(--green);
  background: var(--hover);
}
.signature-style-sample {
  font-size: 28px;
  line-height: 1.8;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  background: #fff;
  border-radius: 3px;
  padding: 0 4px;
}
.signature-style[data-font-loading="true"] .signature-style-sample {
  visibility: hidden;
}
.signature-style small {
  color: var(--muted);
  font:
    11px/1.5 system-ui,
    sans-serif;
}
.signature-size-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.signature-size-row input {
  width: 100%;
  min-width: 0;
  accent-color: var(--green);
  padding: 0;
  min-height: 32px;
}
#signature-size-value {
  display: block;
  text-align: right;
  font-size: 12px;
  color: var(--muted);
}
@media (max-width: 520px) {
  .signature-styles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .resize-handle {
    width: 24px;
    height: 24px;
  }
}
.pdf-tools-dialog {
  width: 660px;
}
.pdf-merge-current {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 12px;
  overflow-wrap: anywhere;
}
.pdf-file-picker {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  margin: 4px 0 10px;
  overflow: hidden;
}
.pdf-file-picker input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.pdf-merge-list {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: pdf-files;
  display: grid;
  gap: 6px;
}
.pdf-merge-list li {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  counter-increment: pdf-files;
}
.pdf-merge-list li:before {
  content: counter(pdf-files);
  color: var(--muted);
  font-size: 11px;
}
.pdf-merge-list li > span {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 12px;
}
.pdf-merge-list button {
  min-width: 34px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 4px;
}
#pdf-task-progress {
  width: 100%;
  height: 12px;
  accent-color: var(--green);
  margin-top: 18px;
}
#pdf-task-label {
  color: var(--muted);
  font-size: 12px;
}
#pdf-tools-error {
  color: var(--danger);
  font-size: 13px;
  line-height: 1.6;
}
#pdf-tools-error:empty {
  display: none;
}
#pdf-tools-result {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--green);
  background: var(--hover);
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.7;
}
.pdf-utility-tabs [role="tab"] {
  flex: 1;
}
.toolset #pdf-utilities span {
  display: inline !important;
}
#signature-upload-preview {
  max-width: 100%;
  max-height: 180px;
  object-fit: contain;
  background: #f7f7f7;
  border: 1px solid var(--line);
}
#fill-error {
  color: var(--danger);
  font-size: 12px;
  line-height: 1.6;
}
#fill-error:empty {
  display: none;
}
.initials-preview {
  background: var(--hover);
  border: 1px solid var(--line);
  padding: 14px;
  overflow-wrap: anywhere;
}
#fullscreen[aria-pressed="true"] {
  background: var(--hover);
  color: var(--green);
}
.editor-focus {
  height: 100dvh;
  overflow: hidden;
}
@media (max-width: 800px) {
  .history #undo span {
    display: inline;
  }
  .history #undo {
    font-size: 16px;
  }
  .history #undo span {
    font-size: 10px;
  }
  .tool-hint {
    font-size: 10px;
    padding: 5px 10px;
  }
}
@media (max-width: 620px) {
  .fill-dialog {
    padding: 16px;
  }
  .fill-card {
    padding: 12px;
  }
  .tool-hint {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .tool-hint > span {
    flex: 1 1 180px;
  }
  .header-actions #fullscreen {
    display: block;
    min-width: 28px;
  }
  .privacy {
    display: none;
  }
  .history {
    gap: 2px;
  }
  .file-bar {
    gap: 6px;
  }
  #file-name {
    max-width: 28vw;
  }
  .header-actions {
    gap: 2px;
  }
  .app-header {
    padding: 0 7px;
    gap: 4px;
  }
  .brand b {
    font-size: 12px;
  }
  .sigil {
    width: 22px;
  }
  .history #redo {
    padding: 2px 5px;
  }
}
@media (max-width: 620px) {
  .app-header {
    height: auto;
    min-height: 72px;
    flex-wrap: wrap;
    padding: 7px 10px;
    gap: 5px;
  }
  .app-header .brand {
    flex-basis: 100%;
  }
  .header-actions {
    width: 100%;
    margin-left: 0;
    justify-content: space-between;
  }
  .header-actions .button {
    padding: 7px 10px;
  }
  .header-actions .icon-button {
    min-height: 30px;
    min-width: 30px;
  }
}
/* Avoid double-tap zoom delaying the first action after drawing on touch. */
.fill-dialog button,
.fill-dialog input,
.fill-dialog select {
  touch-action: manipulation;
}

/* V20: shared, labelled fullscreen control remains outside scrolling tools. */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}
.toolbar-scroll {
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
}
.toolbar-fullscreen {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 33px;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--hover);
  color: var(--text);
  white-space: nowrap;
  touch-action: manipulation;
}
.toolbar-fullscreen [data-fullscreen-icon] {
  font: 18px/1 system-ui;
}
.toolbar-fullscreen [data-fullscreen-label] {
  font-size: 11px;
}
.toolbar-fullscreen[aria-pressed="true"] {
  border-color: var(--green);
  color: var(--green);
}
@media (max-width: 620px) {
  .toolbar {
    padding: 5px 8px;
    gap: 6px;
  }
  .toolbar-fullscreen {
    padding: 5px 8px;
  }
  .toolbar-fullscreen [data-fullscreen-label] {
    font-size: 10px;
  }
}

/* V21: opening feedback uses measured bytes/counts, never a simulated total. */
.open-progress {
  position: absolute;
  inset: 0;
  z-index: 15;
  display: grid;
  place-items: center;
  padding: 18px;
  background: color-mix(in srgb, var(--workspace) 90%, transparent);
  backdrop-filter: blur(3px);
  cursor: progress;
}
.open-progress-card {
  box-sizing: border-box;
  width: min(420px, 100%);
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 16px 50px #0003;
  text-align: left;
}
.open-kicker {
  margin: 0 0 12px;
  color: var(--green);
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
}
#open-stage {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.4;
}
.open-file-name {
  margin: 9px 0 20px;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}
#open-bar {
  appearance: none;
  display: block;
  width: 100%;
  height: 9px;
  border: 0;
  border-radius: 8px;
  overflow: hidden;
  background: var(--hover);
  accent-color: var(--green);
}
#open-bar::-webkit-progress-bar {
  background: var(--hover);
  border-radius: 8px;
}
#open-bar::-webkit-progress-value {
  background: var(--green);
  border-radius: 8px;
}
#open-bar::-moz-progress-bar {
  background: var(--green);
  border-radius: 8px;
}
#open-bar:indeterminate {
  background: linear-gradient(
    100deg,
    var(--hover) 15%,
    var(--green) 50%,
    var(--hover) 85%
  );
  background-size: 220% 100%;
  animation: filelab-opening 1.4s linear infinite;
}
#open-bar:indeterminate::-webkit-progress-bar {
  background: transparent;
}
#open-bar:indeterminate::-moz-progress-bar {
  background: transparent;
}
#open-detail {
  min-height: 20px;
  margin: 12px 0 18px;
  color: var(--text);
  font-size: 12px;
  line-height: 1.5;
}
#open-privacy {
  display: block;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}
@keyframes filelab-opening {
  from {
    background-position: 220% 0;
  }
  to {
    background-position: -220% 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  #open-bar:indeterminate {
    animation: none;
  }
}
@media (max-width: 620px) {
  .open-progress {
    padding: 10px;
  }
  .open-progress-card {
    padding: 18px;
  }
  #open-stage {
    font-size: 16px;
  }
}
