[hidden] { display: none !important; }

:root {
  --bg: #f6f3ee;
  --panel: #fffaf2;
  --ink: #28231d;
  --muted: #7b6f61;
  --brand: #dd4b39;
  --brand-dark: #b63325;
  --line: #e7ded1;
  --shadow: 0 12px 32px rgba(70, 46, 20, .12);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: linear-gradient(135deg, #fff8ee, #f3f0ea 45%, #fffdf8);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  height: 100vh;
  overflow: hidden;
}
header {
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: rgba(255,250,242,.88);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}
.logo { display: flex; align-items: baseline; gap: 12px; }
.logo b { font-size: 22px; letter-spacing: .3px; }
.logo span { color: var(--muted); font-size: 13px; }
.toolbar, .page-tools { display: flex; gap: 10px; align-items: center; }
button, .file-label {
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  background: var(--brand);
  color: white;
  cursor: pointer;
  font-weight: 600;
  box-shadow: 0 6px 16px rgba(221,75,57,.18);
}
button.secondary, .file-label.secondary { background: #3e3a35; box-shadow: none; }
button.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); box-shadow: none; }
button:disabled { opacity: .55; cursor: not-allowed; }
input[type=file] { display: none; }
main {
  height: calc(100vh - 62px);
  display: grid;
  grid-template-columns: 1fr 390px;
  gap: 14px;
  padding: 14px;
}
.viewer, .side {
  background: rgba(255,250,242,.92);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.viewer { display: flex; flex-direction: column; min-width: 0; }
.viewer-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  gap: 12px;
}
.doc-heading { min-width: 0; }
#docTitle {
  color: var(--ink);
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#docStats {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}
.page-tools {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}
.icon-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
  font-size: 18px;
  line-height: 1;
}
.page-input {
  width: 56px;
  height: 32px;
  padding: 5px 7px;
  border-radius: 8px;
  text-align: center;
}
#pageSep, #pageTotal, #zoomLevel {
  color: var(--muted);
  font-weight: 700;
}
#zoomLevel {
  min-width: 42px;
  text-align: center;
}
.tool-sep {
  width: 1px;
  height: 22px;
  background: var(--line);
}
.empty {
  flex: 1;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  padding: 40px;
}
.empty h1 { color: var(--ink); margin-bottom: 8px; }
.page-stage {
  flex: 1;
  overflow: auto;
  display: grid;
  place-items: start center;
  padding: 18px;
  background: #d9d4cc;
}
.page-wrap {
  position: relative;
  line-height: 0;
  box-shadow: 0 10px 24px rgba(0,0,0,.22);
  background: white;
}
#pageImage { display: block; max-width: none; }
.overlay { position: absolute; inset: 0; pointer-events: none; }
.mark {
  position: absolute;
  border: 2px solid #d82016;
  background: rgba(255, 52, 40, .13);
  box-shadow: 0 0 0 1px rgba(255,255,255,.7) inset;
  cursor: pointer;
  pointer-events: auto;
}
.active-mark {
  border-color: #0b6cff;
  background: rgba(11, 108, 255, .14);
}
.mark-label {
  position: absolute;
  top: -10px;
  right: -10px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--brand);
  color: white;
  border: 1px solid white;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}
.mark[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 0;
  bottom: calc(100% + 10px);
  width: max-content;
  max-width: 260px;
  padding: 7px 9px;
  border-radius: 8px;
  background: rgba(255,255,255,.96);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: 0 8px 20px rgba(0,0,0,.18);
  font-size: 12px;
  line-height: 1.4;
  white-space: normal;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .12s ease, transform .12s ease;
  pointer-events: none;
  z-index: 100;
}
.mark[data-tooltip]:hover::after {
  opacity: 1;
  transform: translateY(0);
}
.side { display: flex; flex-direction: column; min-width: 0; }
.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tab {
  flex: 1;
  padding: 12px;
  text-align: center;
  cursor: pointer;
  color: var(--muted);
  border-bottom: 3px solid transparent;
}
.tab.active { color: var(--brand); border-color: var(--brand); font-weight: 700; }
.pane { display: none; padding: 14px; overflow: auto; flex: 1; }
.pane.active { display: block; }
.status {
  margin-bottom: 12px;
  padding: 10px 12px;
  background: #fff3df;
  border: 1px solid #f0d8b8;
  border-radius: 12px;
  color: #735125;
  font-size: 13px;
  white-space: pre-wrap;
}
.progress-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  font-weight: 700;
}
.progress-bar-wrap {
  height: 8px;
  border-radius: 999px;
  background: #ead7ba;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
  transition: width .25s ease;
}
.progress-note {
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
}
.issue {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  margin-bottom: 10px;
  cursor: pointer;
}
.issue:hover, .issue.active { border-color: var(--brand); }
.issue .meta { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.issue .change { font-weight: 700; color: var(--brand-dark); }
.issue .explain { margin-top: 6px; color: #4b4338; font-size: 13px; line-height: 1.55; }
.paragraph {
  padding: 9px 10px;
  border-bottom: 1px dashed var(--line);
  font-size: 13px;
  color: #52493f;
  line-height: 1.5;
}
.form-row { margin-bottom: 12px; }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
input, select, textarea {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  color: var(--ink);
  font: inherit;
}
textarea { min-height: 260px; resize: vertical; line-height: 1.55; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.small { font-size: 12px; color: var(--muted); }

@media (max-width: 960px) {
  body { overflow: auto; height: auto; }
  header { height: auto; min-height: 62px; flex-wrap: wrap; gap: 10px; padding: 12px; }
  main { height: auto; grid-template-columns: 1fr; }
  .viewer { min-height: 70vh; }
}
