.ofd-page {
  position: relative;
}
.ofd-page::after {
  content: '';
  position: absolute;
  left: 10%;
  right: 10%;
  bottom: -18px;
  height: 32px;
  pointer-events: none;
  border-radius: 50%;
  box-shadow: none;
  opacity: 0;
  z-index: 1;
}
@media print {
  @page {
    size: A4;
    margin: 10mm;
  }
  :root {
    --dock-offset: 0px !important;
  }
  body, html {
    background: #fff !important;
  }
  .toolbar, .splash, #splash, .status,
  .dock, #dock,
  .ctx-menu,
  .verify-dialog,
  .app-footer {
    display: none !important;
  }
  .toast {
    display: none !important;
  }
  .main, .viewer, #viewer, #pages {
    background: #fff !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
  }
  #pages {
    padding-left: 0 !important;
  }
  .ofd-page {
    display: block !important;
    box-shadow: none !important;
    border: none !important;
    margin: 0 auto 0 auto !important;
    break-after: page;
    page-break-after: always;
    background: #fff !important;
    padding: 0 !important;
    max-width: none !important;
    max-height: none !important;
  }
  /* 打印时由 JS 计算缩放/占位，避免超出纸张 */
  .ofd-page-inner {
    overflow: visible !important;
  }
}
.brand.page-brand {
  gap: 6px;
  align-items: center;
  margin-right: 10px;
}
.brand-logo-mini {
  width: 22px;
  height: 22px;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.page-brand-title {
  font-size: 16px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 0.5px;
  vertical-align: middle;
  text-shadow: none;
  filter: none;
}
.page-info {
  color: #fff;
  font-weight: 700;
  text-shadow: 0 2px 8px #222,0 0 4px #4da3ff,0 0 2px #fff;
  filter: brightness(1.2) drop-shadow(0 0 2px #4da3ff);
}
.page-icon {
  vertical-align: middle;
  margin-right: 2px;
}
:root {
  --bg: #808080;
  --panel: rgba(30, 30, 30, 0.92);
  --panel-border: rgba(255, 255, 255, 0.12);
  --text: #ffffff;
  --muted: rgba(255, 255, 255, 0.75);
  --btn: rgba(255, 255, 255, 0.10);
  --btn-hover: rgba(255, 255, 255, 0.16);
  --accent: #4da3ff;
  --dock-offset: 64px; /* 默认只给图标条留白；打开面板时由 JS 覆盖为更大值 */
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 9999;
  max-width: min(520px, calc(100vw - 32px));
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--panel-border);
  background: rgba(20, 20, 20, 0.92);
  color: #fff;
  box-shadow: 0 12px 34px rgba(0,0,0,0.35);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.ok {
  border-color: rgba(46, 204, 113, 0.55);
}

.toast.fail {
  border-color: rgba(231, 76, 60, 0.65);
}

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
  "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}

.app {
  height: 100vh;
  width: 100vw;
  display: flex;
  flex-direction: column;
}

.sidebar {
  width: 220px;
  background: var(--panel);
  color: var(--text);
  border-right: 1px solid var(--panel-border);
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  box-sizing: border-box;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--panel-border);
}

.brand img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.brand-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
}

.brand-sub {
  font-size: 12px;
  color: var(--muted);
}

.btn {
  appearance: none;
  border: 1px solid var(--panel-border);
  background: var(--btn);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  text-align: left;
}

.btn:hover {
  background: var(--btn-hover);
}

.btn.btn-convert {
  border-color: rgba(46, 204, 113, 0.55);
  background: linear-gradient(135deg, rgba(46, 204, 113, 0.92), rgba(16, 185, 129, 0.92));
  color: #ffffff;
  font-weight: 800;
  text-align: center;
  box-shadow: 0 10px 26px rgba(16, 185, 129, 0.25);
}

.btn.btn-convert:hover {
  filter: brightness(1.06);
}

.row {
  display: flex;
  gap: 8px;
}

.row .btn {
  flex: 1;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.label {
  font-size: 12px;
  color: var(--muted);
}

.input, .select {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--panel-border);
  color: #fff !important;
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
  appearance: none;
}

.select option {
  color: #222;
  background: #fff;
}

.status {
  color: var(--muted);
  font-size: 13px;
  margin-left: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #f5f6fa;
  position: relative;
  min-width: 0;
  overflow: auto;
  padding: 0;
  box-sizing: border-box;
}

/* 左侧贴边工具栏（dock） */
.dock {
  position: fixed;
  left: 0;
  top: 62px; /* 贴在 toolbar 下方 */
  bottom: 10px;
  z-index: 50;
  display: flex;
  align-items: stretch;
  pointer-events: none; /* 容器不挡住页面，内部再开启 */
}

.dock-bar {
  width: 46px;
  border-radius: 0 14px 14px 0;
  background: rgba(16, 16, 16, 0.82);
  border: 1px solid rgba(255,255,255,0.12);
  border-left: none;
  box-shadow: 0 18px 50px rgba(0,0,0,0.25);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 8px;
  pointer-events: auto;
}

.dock-btn {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform .12s ease, background .12s ease, border-color .12s ease;
}

.dock-btn:hover {
  background: rgba(255,255,255,0.10);
  transform: translateX(1px);
}

.dock-btn.active {
  border-color: rgba(77,163,255,0.55);
  background: linear-gradient(135deg, rgba(77,163,255,0.95), rgba(99,102,241,0.90));
  box-shadow: 0 10px 24px rgba(77,163,255,0.22);
}

.dock-ico {
  font-size: 14px;
  line-height: 1;
}

.dock-panel {
  width: 0;
  overflow: hidden;
  margin-left: 8px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(20, 20, 20, 0.88);
  backdrop-filter: blur(10px);
  box-shadow: 0 18px 50px rgba(0,0,0,0.25);
  transform: translateX(-6px);
  opacity: 0;
  transition: width .18s ease, transform .18s ease, opacity .18s ease;
  pointer-events: auto;
}

.dock-panel.open {
  width: 280px;
  transform: translateX(0);
  opacity: 1;
}

.dock-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}

.dock-title {
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.6px;
}

.dock-collapse {
  width: 28px;
  height: 28px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: #fff;
  cursor: pointer;
}

.dock-collapse:hover {
  background: rgba(255,255,255,0.10);
}

.dock-panel-body {
  padding: 10px;
  max-height: calc(100vh - 62px - 26px);
  overflow: auto;
}

.dock-empty {
  color: rgba(255,255,255,0.72);
  font-size: 13px;
  padding: 12px;
  border: 1px dashed rgba(255,255,255,0.18);
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
}

.dock-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dock-item {
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.05);
  border-radius: 12px;
  padding: 10px 10px;
  cursor: pointer;
  color: #fff;
  font-size: 13px;
  transition: background .12s ease, transform .12s ease, border-color .12s ease;
}

.dock-item:hover {
  background: rgba(255,255,255,0.09);
  transform: translateX(1px);
}

.dock-item.active {
  border-color: rgba(77,163,255,0.55);
  background: rgba(77,163,255,0.16);
}

.dock-item .sub {
  display: block;
  margin-top: 4px;
  color: rgba(255,255,255,0.70);
  font-size: 12px;
}

.dock-thumb {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 10px;
  align-items: center;
}

.dock-thumb img {
  width: 56px;
  height: auto;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.12);
}

.splash {
  height: calc(100% - 32px);
  display: grid;
  place-items: center;
}

.splash-card {
  width: min(520px, 92vw);
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 18px;
  padding: 28px 26px;
  text-align: center;
  backdrop-filter: blur(10px);
}

.splash-logo {
  width: 96px;
  height: 96px;
  object-fit: contain;
  margin-bottom: 14px;
}

.splash-title {
  color: #222;
  font-size: 24px;
  font-weight: 900;
  margin-bottom: 10px;
  text-shadow: 0 2px 8px #fff,0 0 4px #fff,0 0 2px #fff;
  letter-spacing: 2px;
}

.splash-desc {
  color: #444;
  font-size: 15px;
  line-height: 1.7;
  text-shadow: 0 2px 8px #fff,0 0 4px #fff,0 0 2px #fff;
  font-weight: 500;
  margin-top: 8px;
}

.viewer {
  display: none;
}

.viewer.active {
  display: block;
}

.page-host {
  display: flex;
  justify-content: center;
}

#pages {
  padding: 18px 0 28px 0;
  padding-left: var(--dock-offset);
}

.ofd-page {
  margin: 18px auto 24px auto;
  background: #fff;
  /* remove heavy shadows for a flatter, cleaner look */
  box-shadow: none;
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 8px;
  overflow: visible;
  padding: 0;
  position: relative;
  max-width: 100vw;
  width: fit-content;
  height: fit-content;
}

.ofd-page-inner {
  display: inline-block;
  vertical-align: top;
  transform-origin: 50% 50%;
}

/* 画布边框：更贴近真实纸张边界（后端固定 px 宽高） */
.ofd-page-canvas {
  outline: 1px solid rgba(0, 0, 0, 0.10);
  outline-offset: 0;
}

/* 阅读模式：由 JS 写入 #pages[data-mode] 控制显隐 */
#pages[data-mode="continuous"] .ofd-page {
  display: block;
}
#pages[data-mode="single"] .ofd-page {
  display: none;
}
#pages[data-mode="single"] .ofd-page.active {
  display: block;
}

.ofd-page-inner {
  transform-origin: center center;
}

/* 滚动页码提示 */
#scrollPageIndicator {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 9999;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  pointer-events: none;
  opacity: 0;
  transition: opacity 120ms linear;
}
#scrollPageIndicator.visible {
  opacity: 1;
}

.toolbar {
  width: 100%;
  background: var(--panel);
  color: var(--text);
  border-bottom: 1px solid var(--panel-border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  box-sizing: border-box;
  min-height: 54px;
  z-index: 10;
}

.toolbar-right {
  margin-left: auto;
}

.btn-download {
  background: linear-gradient(180deg, #28c76f, #20b34f);
  border: 1px solid rgba(0,0,0,0.08);
  color: #fff;
  box-shadow: 0 6px 18px rgba(32, 179, 79, 0.16);
}
.btn-download:hover {
  background: linear-gradient(180deg, #3ee07f, #28c76f);
  filter: none;
}
.btn-download:focus {
  outline: 2px solid rgba(62, 224, 127, 0.25);
  outline-offset: 2px;
}

.page-info {
  font-size: 15px;
  font-weight: 500;
  margin: 0 8px;
}

.input-page {
  width: 60px;
  text-align: center;
}

.app-footer {
  text-align: center;
  padding: 10px 0;
  font-size: 12px;
  color: #fff;
  background: transparent;
}

/* 页面右键菜单 */
.ctx-menu {
  position: fixed;
  z-index: 10000;
  min-width: 160px;
  padding: 6px;
  border-radius: 12px;
  background: rgba(18, 18, 18, 0.92);
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 18px 60px rgba(0,0,0,0.35);
  backdrop-filter: blur(10px);
}

.ctx-item {
  width: 100%;
  border: none;
  background: transparent;
  color: #fff;
  text-align: left;
  padding: 10px 10px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
}

.ctx-item:hover {
  background: rgba(255,255,255,0.10);
}

.ctx-sep {
  height: 1px;
  margin: 6px;
  background: rgba(255,255,255,0.12);
}

/* Preview pane removed - related styles deleted */

/* 验签结果弹层 */
.verify-dialog {
  position: fixed;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.verify-dialog.show {
  display: flex;
}

.verify-card {
  width: min(920px, 96vw);
  max-height: 86vh;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.verify-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid #e2e8f0;
}

.verify-title {
  font-weight: 600;
  color: #0f172a;
}

.verify-pre {
  margin: 0;
  padding: 12px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 13px;
  line-height: 1.65;
  color: #0f172a;
  text-align: left;
}

/* 验签弹窗使用行布局渲染，不依赖 pre 换行 */
.verify-pre.verify-lines {
  white-space: normal;
}

.verify-line {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 2px 0;
}

.verify-line.spacer {
  height: 8px;
}

.verify-line.plain {
  display: block;
  font-weight: 700;
  color: #0f172a;
}

.verify-key {
  flex: 0 0 auto;
  min-width: 110px;
  color: #334155;
  font-weight: 700;
}

.verify-value {
  flex: 1 1 auto;
  color: #0f172a;
}

.verify-value.ok {
  color: #16a34a;
  font-weight: 700;
}

.verify-value.fail {
  color: #dc2626;
  font-weight: 700;
}
