:root {
  --bg: #f7f6f2;
  --bg-2: #ffffff;
  --bg-3: #f5f4ef;
  --border: #dddcd4;
  --text: #242c29;
  --muted: #66716b;
  --accent: #d75438;
  --accent-2: #b83f26;
  --success: #315c4d;
  --danger: #b33432;
  --sel: #d75438;
  --shadow: 0 10px 30px rgba(35, 45, 38, 0.15);
  --radius: 8px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif;
  font-size: 13px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

[hidden], .hidden { display: none !important; }
.grow { flex: 1; }
.muted { color: var(--muted); }

/* ---------- Toolbar ---------- */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  user-select: none;
}
.group { display: flex; align-items: center; gap: 6px; }
.brand { gap: 8px; margin-right: 6px; }
.logo { font-size: 18px; }
.brand-name { font-weight: 600; letter-spacing: 0.2px; }

.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--bg-3);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1.1;
  transition: background 0.12s, border-color 0.12s, transform 0.05s;
}
.btn:hover { background: #eeeee7; border-color: #b3b9b1; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); }
.btn.success { background: var(--success); border-color: var(--success); color: #fff; }
.btn.success:hover { filter: brightness(1.08); }
.btn.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn.danger:hover { background: rgba(229, 83, 75, 0.12); }
.btn.icon { padding: 6px 9px; min-width: 32px; justify-content: center; font-size: 15px; }
.btn.tool.active, .btn.toggle.active { background: rgba(215, 84, 56, 0.09); border-color: var(--accent); color: #ad3e26; }
.ico { font-size: 14px; width: 16px; text-align: center; font-weight: 700; }

select, input[type="number"], input[type="text"] {
  background: var(--bg-3);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  font: inherit;
  min-width: 0;
}
input[type="color"] {
  width: 36px; height: 30px; padding: 2px;
  border: 1px solid var(--border); border-radius: 6px; background: var(--bg-3); cursor: pointer;
}
input[type="range"] { width: 100%; accent-color: var(--accent); }
input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; }

#page-indicator { color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- Workspace ---------- */
.workspace { flex: 1; display: flex; min-height: 0; }

.viewer {
  flex: 1;
  overflow: auto;
  position: relative;
  background: #eeeee8;
  outline: none;
}
.viewer.drop-active::after {
  content: "Drop PDF to open";
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 600;
  background: rgba(215, 84, 56, 0.09);
  border: 3px dashed var(--accent);
  pointer-events: none;
}

.empty-state {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
}
.empty-card {
  text-align: center; padding: 40px 48px;
  background: var(--bg-2); border: 1px dashed var(--border); border-radius: 16px;
  max-width: 460px;
}
.empty-icon { font-size: 52px; }
.empty-card h1 { font-size: 20px; margin: 10px 0 6px; }
.empty-card p { margin: 6px 0; }
.empty-card .btn { margin-top: 14px; }

.pages {
  display: flex; flex-direction: column; align-items: center;
  gap: 24px; padding: 24px;
}

.page {
  position: relative;
  background: #fff;
  box-shadow: 0 2px 12px rgba(35, 45, 38, 0.18);
  flex: none;
}
.page canvas.pdf-canvas { display: block; width: 100%; height: 100%; }
.page .page-num {
  position: absolute; left: 0; top: -20px; color: var(--muted); font-size: 12px;
}
.page .layer {
  position: absolute; inset: 0;
  overflow: visible;
}
.viewer[data-tool="text"] .layer,
.viewer[data-tool="place"] .layer { cursor: crosshair; }

/* ---------- Elements ---------- */
.el {
  position: absolute;
  transform-origin: center center;
  touch-action: none;
}
.el.el-text {
  white-space: pre;
  line-height: 1.2;
  cursor: move;
  min-width: 4px;
}
.el.el-text .text-content {
  white-space: pre;
  outline: none;
  min-width: 1ch;
  min-height: 1em;
}
.el.el-text.editing { cursor: text; }
.el.el-text.editing .text-content { cursor: text; }
.el.el-image { cursor: move; }
.el.el-image img { display: block; width: 100%; height: 100%; pointer-events: none; user-select: none; -webkit-user-drag: none; }
.el.el-image.grayscale img { filter: grayscale(1); }

.el:hover:not(.selected) { outline: 1px dashed rgba(79, 140, 255, 0.7); outline-offset: 2px; }
.el.selected { outline: 1.5px solid var(--sel); outline-offset: 2px; }

.handle {
  position: absolute; width: 10px; height: 10px;
  background: #fff; border: 1.5px solid var(--sel); border-radius: 2px;
  z-index: 5;
}
.handle.nw { left: -7px; top: -7px; cursor: nwse-resize; }
.handle.ne { right: -7px; top: -7px; cursor: nesw-resize; }
.handle.sw { left: -7px; bottom: -7px; cursor: nesw-resize; }
.handle.se { right: -7px; bottom: -7px; cursor: nwse-resize; }
.handle.n { left: calc(50% - 5px); top: -7px; cursor: ns-resize; }
.handle.s { left: calc(50% - 5px); bottom: -7px; cursor: ns-resize; }
.handle.w { left: -7px; top: calc(50% - 5px); cursor: ew-resize; }
.handle.e { right: -7px; top: calc(50% - 5px); cursor: ew-resize; }
.handle.rot {
  left: calc(50% - 6px); top: -30px; width: 12px; height: 12px; border-radius: 50%;
  cursor: grab;
}
.handle.rot::before {
  content: ""; position: absolute; left: 4px; top: 11px; width: 2px; height: 14px; background: var(--sel);
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: 280px; flex: none;
  background: var(--bg-2); border-left: 1px solid var(--border);
  overflow-y: auto; padding: 14px;
}
.panel h2 { font-size: 14px; margin: 0 0 12px; }
.panel h3 { font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted); margin: 16px 0 8px; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; flex: 1; }
.field > span { color: var(--muted); font-size: 12px; display: flex; justify-content: space-between; }
.field.inline { flex-direction: row; align-items: center; gap: 8px; }
.row { display: flex; gap: 8px; align-items: center; }
.row.tight { gap: 6px; }
.check { display: flex; align-items: center; gap: 8px; margin: 6px 0 10px; cursor: pointer; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.shortcuts { padding-left: 0; list-style: none; color: var(--muted); }
.shortcuts li { margin: 6px 0; line-height: 1.5; }
kbd {
  background: var(--bg-3); border: 1px solid var(--border); border-bottom-width: 2px;
  border-radius: 4px; padding: 1px 5px; font-size: 11px; font-family: inherit; color: var(--text);
}

/* ---------- Status bar ---------- */
.statusbar {
  display: flex; gap: 12px; padding: 5px 12px;
  background: var(--bg-2); border-top: 1px solid var(--border);
  color: var(--muted); font-size: 12px;
}

/* ---------- Modal ---------- */
.modal {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(35, 45, 38, 0.18);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-card {
  width: min(720px, 100%);
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  max-height: 100%;
}
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 8px; }
.modal-header h2 { margin: 0; font-size: 16px; }
.modal-footer { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); }
.tabs { display: flex; gap: 4px; padding: 0 16px; border-bottom: 1px solid var(--border); }
.tab {
  background: none; border: none; color: var(--muted); padding: 8px 12px; cursor: pointer; font: inherit;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.tab-pane { padding: 16px; overflow: auto; }
.badge { background: var(--bg-3); border-radius: 10px; padding: 0 6px; font-size: 11px; }

.pad-wrap { position: relative; border-radius: 8px; overflow: hidden; background: #fff; margin-bottom: 10px; }
#sig-pad { display: block; width: 100%; height: auto; touch-action: none; cursor: crosshair; }
.pad-hint {
  position: absolute; left: 0; right: 0; bottom: 8px; text-align: center; color: #999; font-size: 12px; pointer-events: none;
}
.type-preview { background: #fff; border-radius: 8px; overflow: hidden; }
#sig-type-preview { display: block; width: 100%; height: auto; }
.upload-preview { margin-top: 12px; background: repeating-conic-gradient(#eee 0 25%, #fff 0 50%) 0 0 / 16px 16px; border-radius: 8px; min-height: 80px; display: flex; align-items: center; justify-content: center; }
.upload-preview img { max-width: 100%; max-height: 220px; }
.saved-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.saved-item {
  position: relative; background: #fff; border-radius: 8px; padding: 8px; cursor: pointer;
  border: 2px solid transparent; height: 90px; display: flex; align-items: center; justify-content: center;
}
.saved-item.active { border-color: var(--accent); }
.saved-item img { max-width: 100%; max-height: 100%; }
.saved-item .del {
  position: absolute; top: 4px; right: 4px; background: var(--danger); color: #fff; border: none;
  border-radius: 50%; width: 20px; height: 20px; cursor: pointer; font-size: 11px; line-height: 20px; padding: 0;
}

/* ---------- Misc ---------- */
.toast {
  position: fixed; left: 50%; bottom: 44px; transform: translateX(-50%);
  background: #111; color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 60;
  box-shadow: var(--shadow); max-width: 80vw;
}
.toast.error { background: var(--danger); }
.ghost {
  position: fixed; pointer-events: none; z-index: 40; opacity: 0.6;
  outline: 1px dashed var(--accent);
}
.ghost img { display: block; width: 100%; height: 100%; }

@media (max-width: 900px) {
  .sidebar { width: 230px; }
  .brand-name { display: none; }
}

/* ---------- Dropdown menus ---------- */
.dropdown { position: relative; }
.menu {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 30; min-width: 180px;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); padding: 4px;
}
.menu button {
  display: block; width: 100%; text-align: left; background: none; border: none; color: var(--text);
  padding: 8px 10px; border-radius: 6px; cursor: pointer; font: inherit;
}
.menu button:hover, .menu button.active { background: rgba(215, 84, 56, 0.09); }
.btn.small { padding: 4px 8px; font-size: 12px; }
.mini {
  background: var(--bg-3); border: 1px solid var(--border); color: var(--text); border-radius: 4px;
  padding: 1px 6px; cursor: pointer; font-size: 11px; line-height: 1.4;
}
.mini:hover { border-color: var(--accent); }
.error { color: var(--danger); }
.row.end { justify-content: flex-end; margin-top: 10px; }
.row.indent { margin-left: 26px; }
h4 { margin: 12px 0 6px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }

/* ---------- Shapes ---------- */
.el.el-shape { cursor: move; }
.el.el-shape svg { display: block; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.el.el-shape.blend-multiply { mix-blend-mode: multiply; }
.viewer[data-tool="rect"] .layer, .viewer[data-tool="ellipse"] .layer, .viewer[data-tool="line"] .layer,
.viewer[data-tool="arrow"] .layer, .viewer[data-tool="highlight"] .layer, .viewer[data-tool="whiteout"] .layer,
.viewer[data-tool="crop"] .layer { cursor: crosshair; }
.viewer[data-tool="pen"] .layer { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20'%3E%3Ccircle cx='4' cy='16' r='3' fill='%23111'/%3E%3C/svg%3E") 4 16, crosshair; }
.viewer[data-tool="pen"] .el, .viewer[data-tool="highlight"] .el, .viewer[data-tool="rect"] .el, .viewer[data-tool="ellipse"] .el,
.viewer[data-tool="line"] .el, .viewer[data-tool="arrow"] .el, .viewer[data-tool="whiteout"] .el, .viewer[data-tool="crop"] .el { pointer-events: none; }

/* ---------- Form fields layer ---------- */
.forms-layer { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.forms-layer.hidden { display: none; }
.form-field {
  position: absolute; pointer-events: auto; box-sizing: border-box;
  background: rgba(79, 140, 255, 0.12); border: 1px solid rgba(79, 140, 255, 0.55); border-radius: 2px;
  color: #000; font-family: Helvetica, Arial, sans-serif; padding: 0 3px; margin: 0; outline: none; min-width: 0;
}
.form-field:focus { background: rgba(79, 140, 255, 0.2); border-color: var(--accent); box-shadow: 0 0 0 2px rgba(79, 140, 255, 0.3); }
.form-field[type="checkbox"], .form-field[type="radio"] { appearance: auto; accent-color: #1d4ed8; padding: 0; }
textarea.form-field { resize: none; line-height: 1.2; }
select.form-field { color: #000; background-color: rgba(220, 232, 255, 0.9); }
.form-sig { border: 1px dashed rgba(229, 83, 75, 0.7); background: rgba(229, 83, 75, 0.06); pointer-events: none !important; }
.layer.forms-on .el { z-index: 4; }

/* ---------- Page bar ---------- */
.pagebar {
  width: 200px; flex: none; background: var(--bg-2); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; min-height: 0;
}
.pagebar-head { display: flex; align-items: center; gap: 8px; padding: 10px 10px 4px; }
.pagebar-actions { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px 10px; }
.pagebar-hint { font-size: 11px; margin: 4px 10px 6px; }
.thumbs { overflow-y: auto; padding: 6px 10px 14px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.thumb { border: 2px solid transparent; border-radius: 8px; padding: 6px; background: var(--bg-3); cursor: pointer; position: relative; user-select: none; }
.thumb:hover { border-color: #b3b9b1; }
.thumb.current { box-shadow: inset 0 0 0 1px var(--accent); }
.thumb.selected { border-color: var(--accent); background: rgba(79, 140, 255, 0.15); }
.thumb.dragging { opacity: 0.4; }
.thumb.drop-before::before, .thumb.drop-after::after {
  content: ""; position: absolute; left: 4px; right: 4px; height: 3px; background: var(--accent); border-radius: 2px;
}
.thumb.drop-before::before { top: -7px; }
.thumb.drop-after::after { bottom: -7px; }
.thumb-canvas { background: #fff; margin: 0 auto; box-shadow: 0 1px 4px rgba(0,0,0,0.5); }
.thumb-canvas canvas { display: block; width: 100%; height: 100%; }
.thumb-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; font-size: 12px; color: var(--muted); }
.thumb-tools { display: none; gap: 3px; }
.thumb:hover .thumb-tools, .thumb.selected .thumb-tools { display: inline-flex; }

/* ---------- Crop ---------- */
.cropbar {
  position: sticky; top: 8px; z-index: 20; margin: 8px auto 0; width: max-content; max-width: calc(100% - 32px);
  display: flex; gap: 8px; align-items: center; padding: 8px 12px;
  background: var(--bg-2); border: 1px solid var(--accent); border-radius: 10px; box-shadow: var(--shadow);
}
.crop-rect { position: absolute; border: 2px dashed var(--accent); background: rgba(79, 140, 255, 0.12); pointer-events: none; z-index: 6; box-shadow: 0 0 0 9999px rgba(0,0,0,0.35); }

/* ---------- Tools hub ---------- */
.tools-card { width: min(900px, 100%); max-height: min(90vh, 900px); }
.tools-body { overflow: auto; padding: 4px 18px 18px; }
.tools-group { font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted); margin: 16px 0 8px; }
.tools-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.tool-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left;
  background: var(--bg-3); border: 1px solid var(--border); border-radius: 10px; padding: 12px; cursor: pointer; color: var(--text); font: inherit;
  transition: border-color 0.12s, transform 0.08s;
}
.tool-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.tool-card[data-disabled] { opacity: 0.45; cursor: not-allowed; }
.tool-icon { font-size: 22px; }
.tool-title { font-weight: 600; }
.tool-desc { color: var(--muted); font-size: 12px; line-height: 1.35; }
.tool-form { padding-top: 10px; }
.tool-form input[type="file"] { display: block; margin: 8px 0; }
.tool-form .field input[type="text"], .tool-form .field input[type="password"], .tool-form .field input[type="number"], .tool-form .field select { width: 100%; }
.file-list { margin: 8px 0; padding-left: 20px; }
.file-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 4px 0; border-bottom: 1px dashed var(--border); }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 0 12px; }
.tool-progress { display: flex; align-items: center; gap: 10px; padding: 12px 0; color: var(--muted); }
.spinner { width: 16px; height: 16px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.tool-result { padding: 10px 12px; margin-top: 10px; background: var(--bg-3); border-radius: 8px; }
.text-out { width: 100%; min-height: 160px; max-height: 320px; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 8px; font: 12px/1.4 ui-monospace, Menlo, Consolas, monospace; resize: vertical; }
.modal-card.small { width: min(440px, 100%); }

/* PDFOnHand workspace: keep the document front and center. */
button, a, input, select, textarea, summary { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 3px solid #d75438; outline-offset: 3px; }
a { color: inherit; }
.ui-icon { width: 18px; height: 18px; flex: none; display: block; }
.editor-header { position: relative; z-index: 31; background: #fff; flex: none; }
.appbar { min-height: 74px; display: flex; align-items: center; gap: 24px; padding: 15px 24px; border-bottom: 1px solid #e8e8e0; }
.brand { text-decoration: none; display: inline-flex; align-items: center; gap: 10px; flex: none; margin: 0; }
.logo { width: 35px; height: 38px; border-radius: 10px; display: grid; place-items: center; color: #fff; background: #d75438; transform: rotate(-4deg); }
.logo .ui-icon { width: 21px; height: 23px; }
.brand-name { font-size: 19px; font-weight: 780; letter-spacing: -.9px; }
.brand-name span { font-weight: 480; }
.document-heading { min-width: 0; flex: 1; padding-left: 23px; border-left: 1px solid var(--border); display: flex; flex-direction: column; gap: 3px; }
.workspace-label { font-size: 10px; color: var(--muted); font-weight: 650; letter-spacing: 1.2px; text-transform: uppercase; }
#doc-name { font-size: 13px; font-weight: 580; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.local-badge { display: flex; align-items: center; gap: 6px; color: #426955; font-size: 11px; white-space: nowrap; }
.local-badge .ui-icon { width: 14px; height: 14px; }
.toolbar { min-height: 58px; gap: 14px; padding: 10px 20px; flex-wrap: nowrap; }
.toolbar .group { gap: 4px; }
.toolbar .tools { border-left: 1px solid var(--border); border-right: 1px solid var(--border); padding: 0 10px; flex: 1; }
.toolbar .history-group { gap: 1px; }
.toolbar .btn { background: transparent; border-color: transparent; padding: 8px 9px; font-size: 12px; }
.toolbar .btn:hover { background: var(--bg-3); }
.toolbar .btn.tool.active { background: #fae9e1; border-color: #fae9e1; color: #963d26; }
.btn { min-height: 35px; padding: 9px 13px; border-radius: 7px; font-weight: 550; }
.btn:disabled { opacity: .42; }
.btn.success { background: var(--accent); border-color: var(--accent); }
.btn.success:hover { background: var(--accent-2); filter: none; }
.btn.icon { min-width: 32px; }
.text-icon { width: 18px; text-align: center; font: 700 20px Georgia, serif; line-height: 18px; }
.toolbar select { font-size: 12px; background: #fff; border-color: transparent; max-width: 102px; }
.menu { padding: 6px; border-radius: 11px; min-width: 210px; }
.menu button { padding: 10px; }
.menu small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.viewer { background-color: #eeeee8; background-image: radial-gradient(#dcded5 .65px, transparent .65px); background-size: 16px 16px; }
.viewer.drop-active::after { z-index: 45; background: #fff6eff2; }
.empty-state { position: relative; min-height: 100%; padding: 38px 28px; }
.empty-card { text-align: center; padding: 0; background: none; border: none; border-radius: 0; max-width: 630px; width: 100%; }
.eyebrow { display: block; font-size: 10px; letter-spacing: 1.7px; text-transform: uppercase; color: #596d5f; font-weight: 700; }
.empty-icon { position: relative; width: 68px; height: 77px; margin: 28px auto 24px; display: grid; place-items: center; color: #b5452d; background: #fff; border-radius: 13px; box-shadow: 0 6px 16px #20352610; transform: rotate(-7deg); }
.empty-icon > .ui-icon { width: 39px; height: 44px; stroke-width: 1.2; }
.empty-plus { position: absolute; right: -10px; bottom: -8px; background: #345f4e; color: white; border: 4px solid #eeeee8; border-radius: 50%; width: 34px; height: 34px; font: 22px/25px Arial; }
.empty-card h1 { font-family: Georgia, 'Times New Roman', serif; font-weight: 500; font-size: clamp(30px, 3.7vw, 48px); letter-spacing: -1.8px; line-height: 1.14; margin: 0 0 15px; }
.empty-card p { color: var(--muted); line-height: 1.65; font-size: 14px; }
.empty-actions { display: flex; justify-content: center; gap: 10px; margin-top: 23px; }
.empty-actions .btn { margin: 0; min-height: 47px; padding: 13px 19px; font-size: 13px; border-radius: 8px; }
.empty-actions .btn:not(.primary) { background: #fff; }
.empty-card .drop-hint { font-size: 11px; color: #818982; margin: 9px 0 21px; }
.privacy-note { display: flex; align-items: center; justify-content: center; gap: 6px; color: #456b57; font-size: 11px; }
.privacy-note .ui-icon { width: 13px; height: 13px; }
.quick-tasks { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 34px 0 20px; }
.quick-tasks button { padding: 14px 12px; border: 1px solid #dcdfd6; border-radius: 8px; background: #ffffff9e; color: #3e4e43; text-align: left; cursor: pointer; font: inherit; font-size: 11px; font-weight: 500; line-height: 1.5; }
.quick-tasks button:hover { border-color: #ce7059; background: #fff; }
.quick-tasks button span { margin-left: 6px; color: #829186; }
.subtle-link { font-size: 11px; color: #64746a; text-decoration: none; }
.subtle-link:hover { color: var(--accent); }
.pages { padding: 32px 24px; }
.page { box-shadow: 0 3px 16px #24372819; }
.sidebar { width: 252px; padding: 27px 22px; background: #fbfbf8; }
.sidebar .eyebrow { font-size: 9px; letter-spacing: 1.4px; margin-bottom: 12px; }
.panel h2 { font-size: 18px; letter-spacing: -.4px; margin-bottom: 12px; font-weight: 650; }
.panel > p { font-size: 12px; line-height: 1.7; }
.workspace-tip { margin: 25px 0 20px; padding: 15px; background: #eaf0e8; border-radius: 9px; color: #4a6251; font-size: 11px; }
.workspace-tip strong { font-weight: 650; }
.workspace-tip p { line-height: 1.6; margin: 7px 0 0; }
#btn-paste-empty { font-size: 11px; width: 100%; justify-content: center; background: none; }
.shortcut-details { margin-top: 27px; border-top: 1px solid var(--border); padding-top: 16px; }
.shortcut-details summary { font-size: 11px; color: var(--muted); cursor: pointer; }
.shortcuts { font-size: 11px; }
.field > span { color: #57665c; }
.statusbar { padding: 9px 19px; gap: 8px; align-items: center; min-height: 35px; font-size: 10px; background: #fff; }
.statusbar #status { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.statusbar a { color: #68796d; text-decoration: none; margin-left: 9px; }
.status-dot { background: #699076; border-radius: 50%; width: 5px; height: 5px; flex: none; }
#page-indicator { white-space: nowrap; }
.modal { background: #17271e69; backdrop-filter: blur(3px); }
.modal-card { border: 0; border-radius: 16px; box-shadow: 0 20px 90px #112a273d; }
.modal-header { padding: 22px 24px 16px; border-bottom: 1px solid #eaece5; }
.modal-header h2 { font-size: 21px; letter-spacing: -.7px; }
.modal-footer { padding: 16px 22px; }
.modal-footer .check { margin: 0; font-size: 11px; }
.signature-note { color: var(--muted); font-size: 11px; line-height: 1.5; margin: 14px 22px; }
.tools-body { padding: 5px 24px 24px; }
.tools-group { margin-top: 24px; font-size: 10px; font-weight: 650; letter-spacing: 1.4px; }
.tools-grid { gap: 11px; }
.tool-card { background: #fbfbf8; padding: 17px; gap: 8px; border-radius: 11px; min-height: 155px; }
.tool-icon { display: grid; place-items: center; color: #a3462f; background: #f7e9e1; width: 36px; height: 36px; border-radius: 9px; margin-bottom: 3px; }
.tool-icon .ui-icon { width: 21px; height: 21px; }
.tool-title { font-size: 13px; }
.tool-desc { line-height: 1.5; font-size: 11px; }
.tool-form { font-size: 13px; line-height: 1.6; }
.tool-form .check { align-items: flex-start; }
.tool-form input[type=checkbox], .tool-form input[type=radio] { margin-top: 3px; flex: none; }
.tool-form input[type=file] { max-width: 100%; padding: 16px; border: 1px dashed var(--border); background: #f8f8f4; border-radius: 9px; width: 100%; }
input::file-selector-button { background: #fff; border: 1px solid var(--border); padding: 8px 12px; border-radius: 6px; margin-right: 12px; cursor: pointer; color: var(--text); font: inherit; }
.tool-summary { margin: 0 0 18px; padding: 11px 14px; background: #edf1e9; border-radius: 7px; color: #4b6655; font-size: 12px; }
.tool-result { background: #edf2e9; }
.tool-progress { font-size: 12px; }
.properties-toggle, .sidebar-close { display: none; }
@media (max-width: 1220px) {
  .toolbar { gap: 6px; padding: 10px 14px; }
  .toolbar .btn { padding: 8px; }
  .toolbar .tools { padding: 0 7px; }
  .toolbar .btn.tool .lbl { display: none; }
  .local-badge { display: none; }
  .toolbar .zoom { margin-left: auto; }
  .brand-name { display: inline; }
  .sidebar { width: 235px; padding: 25px 19px; }
}
@media (max-width: 900px) {
  .appbar { padding: 13px 16px; gap: 16px; min-height: 68px; }
  .document-heading { padding-left: 16px; }
  .brand-name { display: inline; font-size: 17px; }
  .sidebar { display: none; }
  .sidebar.open { display: block; position: fixed; top: 123px; right: 0; bottom: 35px; z-index: 30; width: min(300px, 90vw); box-shadow: -12px 12px 36px #18342622; }
  .sidebar-close { display: inline-flex; margin-bottom: 22px; }
  .properties-toggle { display: inline-flex; }
  .toolbar .pages-label { display: none; }
  .toolbar .zoom .btn { display: none; }
  .quick-tasks { margin-top: 28px; }
}
@media (max-width: 660px) {
  .appbar { padding: 11px 12px; gap: 12px; min-height: 65px; }
  .appbar .logo { width: 30px; height: 33px; border-radius: 8px; }
  .appbar .brand-name { font-size: 16px; }
  .document-heading { display: none; }
  .export-group { margin-left: auto; gap: 5px; }
  .preview-label { display: none; }
  .export-group .btn { padding: 9px; font-size: 11px; }
  .export-group .btn.success .ui-icon { display: none; }
  .toolbar { display: flex; flex-wrap: wrap; padding: 6px 9px; gap: 3px 6px; }
  .toolbar .file-actions { flex: 1; }
  .toolbar .history-group { order: 2; }
  .toolbar .zoom { order: 3; margin-left: 0; }
  .toolbar .tools { order: 4; flex: 1; border: none; padding: 4px 0; }
  .toolbar .tools .btn { min-width: 35px; }
  .toolbar .properties-toggle { order: 5; font-size: 10px; }
  .toolbar .btn { font-size: 11px; min-height: 34px; padding: 7px; }
  .toolbar .ui-icon { width: 16px; height: 16px; }
  .toolbar .file-actions .ui-icon { display: none; }
  .toolbar .zoom select { font-size: 11px; padding: 6px 2px; max-width: 79px; }
  .sidebar.open { top: 152px; }
  .empty-state { padding: 28px 20px; align-items: flex-start; }
  .empty-icon { margin: 20px auto; width: 52px; height: 62px; }
  .empty-icon > .ui-icon { width: 31px; height: 36px; }
  .empty-card h1 { font-size: 35px; letter-spacing: -1.5px; }
  .empty-card p { font-size: 12px; }
  .empty-card p br { display: none; }
  .empty-actions { flex-direction: column; max-width: 280px; margin: 21px auto 0; gap: 8px; }
  .empty-actions .btn { justify-content: center; min-height: 43px; padding: 11px; font-size: 12px; }
  .empty-card .drop-hint { margin: 9px 0 17px; }
  .quick-tasks { grid-template-columns: 1fr 1fr; gap: 7px; margin: 25px 0 18px; }
  .quick-tasks button { padding: 12px; font-size: 11px; }
  .statusbar { padding: 8px 12px; font-size: 9px; }
  .statusbar a { display: none; }
  .pagebar { width: 145px; }
  .pagebar-actions .btn { padding: 4px 6px; font-size: 10px; }
  .modal { padding: 10px; }
  .modal-header { padding: 15px; gap: 9px; }
  .modal-header h2 { font-size: 18px; }
  .modal-header .btn { padding: 7px; font-size: 11px; }
  .tools-body { padding: 0 15px 20px; }
  .tools-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .tool-card { padding: 12px; min-height: 170px; }
  .tool-form .row { flex-wrap: wrap; }
  .tool-form .row .field { min-width: 120px; }
  .cropbar { flex-wrap: wrap; width: auto; font-size: 11px; }
  .modal-footer { padding: 12px; flex-wrap: wrap; }
  .modal-footer .check { flex: 1 0 100%; margin-bottom: 4px; }
  .signature-note { margin: 12px 16px; }
  .tabs { padding: 0 12px; }
  .tab { padding: 10px; font-size: 12px; }
  .toast { font-size: 12px; width: max-content; max-width: calc(100vw - 24px); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation-duration: .01ms !important; } }
