:root {
  color-scheme: light;
  --paper-blue: #4a6fa5;
  --paper-blue-light: #7ba3c9;
  --paper-blue-dark: #2e4a6f;
  --ink-blue: #163a5c;
  --warm-paper: #faf8f3;
  --cream: #f5f1e8;
  --soft-gray: #e8e4dc;
  --card: #ffffff;
  --card-warm: #fffdf8;
  --border: #e0ded8;
  --border-strong: #cbc7bd;
  --text: #1a1a1a;
  --text-secondary: #4a4a4a;
  --text-tertiary: #8a8a8a;
  --success: #5a9a6e;
  --warning: #d4a03d;
  --danger: #c45b4a;
  --info: #6b9bcf;
  --teal: #2c8993;
  --purple: #7762c8;
  --shadow-sm: 0 1px 3px rgb(0 0 0 / 0.06);
  --shadow-md: 0 4px 12px rgb(29 43 58 / 0.08);
  --shadow-lg: 0 12px 32px rgb(29 43 58 / 0.12);
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --focus-ring: 0 0 0 3px rgb(74 111 165 / 0.18);
  --font-ui: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #f7f6f2;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: var(--font-ui);
  color: var(--text);
  background: #f7f6f2;
}

body::before {
  content: none;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

button:not(:disabled) {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

#app {
  min-height: 100vh;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 22px;
  height: 100vh;
  padding: 34px 22px;
  background: #fbfaf7;
  border-right: 1px solid rgb(224 222 216 / 0.72);
  box-shadow: 1px 0 0 rgb(255 255 255 / 0.6);
}

.brand-lockup,
.mobile-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-lockup strong,
.mobile-brand strong {
  display: block;
  color: var(--ink-blue);
  font-size: 21px;
  font-weight: 720;
}

.brand-lockup span,
.mobile-brand span {
  display: block;
  margin-top: 2px;
  color: var(--text-tertiary);
  font-size: 12px;
}

.brand-lockup.small strong {
  font-size: 16px;
}

.brand-mark {
  position: relative;
  display: inline-grid;
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  place-items: center;
  overflow: hidden;
  background: linear-gradient(145deg, #6ea4c5, #1f7182);
  border: 1px solid rgb(255 255 255 / 0.68);
  border-radius: 8px;
  box-shadow: 0 10px 22px rgb(31 113 130 / 0.18);
}

.brand-mark.small {
  width: 34px;
  height: 34px;
}

.brand-mark span,
.brand-mark::before,
.brand-mark::after {
  position: absolute;
  display: block;
  width: 22px;
  height: 30px;
  content: "";
  background: linear-gradient(160deg, #fdfcf8 0%, #d9e6ef 55%, #f8f5ed 100%);
  box-shadow: 0 3px 8px rgb(0 0 0 / 0.12);
  transform: skewY(-18deg) rotate(9deg);
}

.brand-mark span {
  left: 12px;
  top: 8px;
}

.brand-mark::before {
  left: 17px;
  top: 12px;
  opacity: 0.78;
}

.brand-mark::after {
  left: 7px;
  top: 16px;
  opacity: 0.62;
}

.sidebar nav {
  display: grid;
  gap: 8px;
}

.side-link {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  color: var(--text-secondary);
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  text-align: left;
}

.side-link svg {
  width: 22px;
  height: 22px;
}

.side-link:hover,
.side-link.active {
  color: var(--teal);
  background: rgb(44 137 147 / 0.1);
}

.settings-link {
  margin-top: auto;
}

.sidebar-card {
  padding: 16px;
  color: var(--ink-blue);
  background: rgb(255 255 255 / 0.76);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.sidebar-card p {
  margin: 0 0 8px;
  color: var(--text-tertiary);
  font-size: 12px;
}

.sidebar-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 15px;
}

.sidebar-card span {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
}

.home-main,
.settings-main {
  min-width: 0;
  padding: 32px 40px 56px;
}

.home-topbar,
.template-top,
.editor-topbar,
.pdf-topbar {
  display: flex;
  align-items: center;
  gap: 20px;
}

.home-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 16px 0 22px;
  background: rgb(247 246 242 / 0.94);
  backdrop-filter: blur(16px);
}

.mobile-brand {
  display: none;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 14px;
  color: var(--text-tertiary);
  background: rgb(255 255 255 / 0.78);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.7);
}

.search-field input {
  width: 100%;
  min-width: 0;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: 0;
}

.search-field kbd {
  min-width: max-content;
  color: var(--text-tertiary);
  font-size: 12px;
  font-family: var(--font-ui);
}

.hero-search {
  flex: 1;
  max-width: 720px;
  margin-inline: auto;
}

.topbar-actions,
.editor-actions,
.pdf-actions,
.toolbar-row,
.doc-actions,
.modal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.button,
.icon-button,
.text-button,
.chip,
.segmented button,
.select,
.tool-button {
  border-radius: var(--radius-sm);
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid transparent;
  font-weight: 680;
  white-space: nowrap;
}

.button.primary {
  color: #fff;
  background: linear-gradient(135deg, var(--paper-blue), #2d8794);
  box-shadow: 0 10px 22px rgb(44 137 147 / 0.22);
}

.button.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgb(44 137 147 / 0.26);
}

.button:active,
.icon-button:active,
.tool-button:active,
.chip:active {
  transform: translateY(1px);
}

.button.secondary {
  color: var(--ink-blue);
  background: rgb(255 255 255 / 0.82);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}

.button.secondary:hover,
.button.ghost:hover {
  border-color: rgb(74 111 165 / 0.42);
  background: #fff;
}

.button.ghost {
  color: var(--text-secondary);
  background: transparent;
  border-color: var(--border);
}

.button.danger {
  color: #fff;
  background: var(--danger);
}

.button.wide {
  width: 100%;
}

.button.mini {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 640;
}

.button:disabled {
  color: var(--text-tertiary);
  background: #e5e3de;
  box-shadow: none;
}

.button.loading::before {
  width: 14px;
  height: 14px;
  content: "";
  border: 2px solid rgb(255 255 255 / 0.5);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.icon-button {
  display: inline-grid;
  width: 44px;
  height: 44px;
  place-items: center;
  color: var(--ink-blue);
  background: rgb(255 255 255 / 0.84);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.icon-button:hover,
.icon-button.active,
.icon-button.subtle.active {
  color: var(--teal);
  border-color: rgb(44 137 147 / 0.38);
  background: rgb(44 137 147 / 0.1);
}

.icon-button.subtle {
  width: 34px;
  height: 34px;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.avatar-button {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  color: #fff;
  background:
    linear-gradient(135deg, rgb(46 74 111 / 0.1), transparent),
    linear-gradient(145deg, #d5b195, #3f6f7c);
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: var(--shadow-md);
}

.workspace-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin: 10px 0 34px;
  padding: 24px;
  background: #fffdfa;
  border: 1px solid rgb(224 222 216 / 0.76);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.quick-grid button {
  display: grid;
  gap: 6px;
  min-height: 112px;
  padding: 16px;
  color: var(--text-secondary);
  background: rgb(255 255 255 / 0.76);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  text-align: left;
}

.quick-grid button:hover,
.quick-grid button.active {
  color: var(--ink-blue);
  border-color: rgb(44 137 147 / 0.38);
  background: linear-gradient(145deg, #fff, rgb(44 137 147 / 0.08));
  box-shadow: var(--shadow-md);
}

.quick-grid span {
  font-size: 13px;
  font-weight: 680;
}

.quick-grid strong {
  color: var(--ink-blue);
  font-size: 30px;
  line-height: 1;
}

.quick-grid small {
  color: var(--text-tertiary);
  line-height: 1.4;
}

.workspace-header h1,
.template-title h1,
.settings-header h1 {
  max-width: 760px;
  margin: 0;
  color: var(--ink-blue);
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.12;
}

.workspace-header p,
.settings-header p {
  max-width: 700px;
  margin: 10px 0 0;
  color: var(--text-secondary);
  line-height: 1.7;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--paper-blue);
  font-size: 12px;
  font-weight: 760;
  text-transform: uppercase;
}

.status-stack {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.sync-badge,
.mini-stat,
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 9px;
  font-size: 12px;
  border-radius: var(--radius-xs);
}

.sync-badge svg {
  width: 16px;
  height: 16px;
}

.sync-badge.success {
  color: #287348;
  background: rgb(90 154 110 / 0.12);
}

.sync-badge.info {
  color: #2f6fa4;
  background: rgb(107 155 207 / 0.14);
}

.sync-badge.warning {
  color: #8c670c;
  background: rgb(212 160 61 / 0.16);
}

.sync-badge.danger {
  color: #973829;
  background: rgb(196 91 74 / 0.14);
}

.mini-stat,
.tag {
  color: var(--text-secondary);
  background: rgb(232 228 220 / 0.68);
}

.section-block {
  margin-top: 32px;
}

.section-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.section-title h2 {
  margin: 0;
  color: var(--text);
  font-size: 24px;
}

.text-button {
  min-height: 36px;
  padding: 0 10px;
  color: var(--paper-blue);
  background: transparent;
  border: 0;
}

.text-button:hover {
  background: rgb(74 111 165 / 0.08);
}

.recent-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 18px;
}

.document-collection {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 18px;
}

.document-collection.list-mode {
  display: grid;
  grid-template-columns: 1fr;
}

.document-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  background: rgb(255 255 255 / 0.88);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.document-card:hover {
  transform: translateY(-2px);
  border-color: rgb(74 111 165 / 0.3);
  box-shadow: var(--shadow-md);
}

.document-card.is-trashed {
  background: rgb(255 255 255 / 0.72);
}

.document-card.is-trashed .doc-thumb,
.document-card.is-trashed .doc-card-body {
  opacity: 0.72;
}

.document-card:focus-visible,
.template-card:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring), var(--shadow-md);
}

.document-row {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  min-height: 178px;
}

.doc-cover-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.doc-thumb {
  position: relative;
  min-height: 164px;
  margin: 10px 10px 0;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgb(255 255 255 / 0.75), rgb(245 241 232 / 0.78)),
    linear-gradient(90deg, rgb(46 74 111 / 0.05) 1px, transparent 1px),
    linear-gradient(rgb(46 74 111 / 0.04) 1px, transparent 1px);
  background-size: auto, 18px 18px, 18px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
}

.document-row .doc-thumb {
  min-height: auto;
  margin: 10px;
}

.doc-thumb b,
.doc-thumb span,
.doc-thumb em,
.doc-thumb i {
  position: absolute;
}

.doc-thumb b {
  left: 18px;
  top: 18px;
  color: var(--ink-blue);
  font-size: 18px;
}

.doc-thumb > span {
  left: 18px;
  bottom: 18px;
  color: var(--text-secondary);
  font-size: 13px;
}

.paper-lines,
.grid-lines,
.note-list,
.matrix,
.pdf-page,
.week-grid,
.sketch-wire,
.book-sketch {
  position: absolute;
  inset: 42px 18px 24px;
  opacity: 0.9;
}

.paper-lines {
  background: repeating-linear-gradient(to bottom, transparent 0 15px, rgb(74 111 165 / 0.16) 16px 17px);
}

.grid-lines,
.week-grid,
.matrix {
  background:
    linear-gradient(90deg, rgb(74 111 165 / 0.14) 1px, transparent 1px),
    linear-gradient(rgb(74 111 165 / 0.14) 1px, transparent 1px);
  background-size: 18px 18px;
}

.note-list {
  background:
    radial-gradient(circle, var(--paper-blue) 0 3px, transparent 4px) 0 0 / 100% 22px,
    repeating-linear-gradient(to bottom, transparent 0 20px, rgb(74 111 165 / 0.12) 21px 22px);
}

.book-sketch::before {
  position: absolute;
  inset: 8px 40px 20px 56px;
  content: "";
  border: 1px solid rgb(46 74 111 / 0.22);
  border-radius: 50%;
}

.book-sketch::after {
  position: absolute;
  inset: 22px 12px 14px 120px;
  content: "";
  border-left: 2px solid rgb(46 74 111 / 0.24);
  border-radius: 50%;
  transform: rotate(18deg);
}

.chart-bars {
  position: absolute;
  right: 18px;
  bottom: 24px;
  display: flex;
  align-items: end;
  gap: 8px;
  height: 72px;
}

.chart-bars i {
  position: static;
  width: 18px;
  background: linear-gradient(180deg, var(--paper-blue-light), var(--paper-blue));
  border-radius: 4px 4px 0 0;
}

.chart-bars i:nth-child(1) { height: 34px; }
.chart-bars i:nth-child(2) { height: 48px; }
.chart-bars i:nth-child(3) { height: 62px; }
.chart-bars i:nth-child(4) { height: 76px; }

.highlight-line {
  width: 130px;
  height: 12px;
  background: rgb(246 200 76 / 0.5);
  border-radius: 2px;
}

.pdf-page {
  border: 1px solid rgb(46 74 111 / 0.18);
  background: repeating-linear-gradient(to bottom, transparent 0 12px, rgb(0 0 0 / 0.08) 13px 14px);
}

.sketch-wire::before,
.sketch-wire::after {
  position: absolute;
  content: "";
  border: 2px solid rgb(35 111 203 / 0.35);
  border-radius: 45%;
}

.sketch-wire::before {
  width: 110px;
  height: 58px;
  left: 12px;
  top: 12px;
}

.sketch-wire::after {
  width: 82px;
  height: 48px;
  right: 10px;
  bottom: 14px;
}

.doc-card-body {
  display: grid;
  gap: 10px;
  padding: 14px 16px 16px;
}

.doc-title-line {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 8px;
}

.doc-title-line h3,
.template-card h3 {
  margin: 0;
  min-width: 0;
  color: var(--text);
  font-size: 17px;
  line-height: 1.35;
}

.doc-title-line h3 {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.doc-card-body p,
.template-card p,
.template-preview-panel p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.doc-meta,
.doc-footer,
.tag-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.doc-meta {
  color: var(--text-tertiary);
  font-size: 12px;
}

.type-badge {
  min-height: 22px;
  padding: 2px 7px;
  color: var(--teal);
  background: rgb(44 137 147 / 0.1);
  border-radius: var(--radius-xs);
}

.type-badge.pdf {
  color: #1264d8;
  background: rgb(18 100 216 / 0.1);
}

.doc-footer {
  justify-content: space-between;
}

.floating-menu {
  position: absolute;
  z-index: 40;
  display: grid;
  min-width: 168px;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
}

.card-menu {
  right: 14px;
  bottom: 54px;
}

.floating-menu button,
.compact-modal > button {
  min-height: 38px;
  padding: 0 12px;
  color: var(--text-secondary);
  background: transparent;
  border: 0;
  border-radius: var(--radius-xs);
  text-align: left;
}

.floating-menu button:hover,
.compact-modal > button:hover {
  color: var(--ink-blue);
  background: rgb(74 111 165 / 0.08);
}

.danger-text {
  color: var(--danger) !important;
}

.tag-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.filter-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  margin: -4px 0 16px;
  padding: 0 12px;
  color: var(--text-secondary);
  background: rgb(255 255 255 / 0.66);
  border: 1px solid rgb(224 222 216 / 0.72);
  border-radius: var(--radius-sm);
}

.filter-summary span {
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip {
  min-height: 36px;
  padding: 0 13px;
  color: var(--text-secondary);
  background: rgb(255 255 255 / 0.68);
  border: 1px solid var(--border);
}

.chip:hover,
.chip.active {
  color: #fff;
  background: linear-gradient(135deg, var(--paper-blue), #2d8794);
  border-color: transparent;
}

.segmented {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  background: rgb(255 255 255 / 0.76);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.segmented button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 12px;
  color: var(--text-secondary);
  background: transparent;
  border: 0;
}

.segmented button.active {
  color: var(--teal);
  background: rgb(44 137 147 / 0.12);
}

.segmented.wide {
  width: 100%;
}

.segmented.wide button {
  flex: 1;
}

.select {
  min-height: 44px;
  padding: 0 36px 0 13px;
  color: var(--text-secondary);
  background: rgb(255 255 255 / 0.82);
  border: 1px solid var(--border);
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 280px;
  padding: 32px;
  text-align: center;
  background: rgb(255 255 255 / 0.66);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
}

.empty-state h3 {
  margin: 12px 0 6px;
}

.empty-state p {
  max-width: 380px;
  margin: 0 0 18px;
  color: var(--text-secondary);
}

.empty-illustration {
  position: relative;
  width: 104px;
  height: 84px;
}

.empty-illustration span {
  position: absolute;
  width: 54px;
  height: 70px;
  background: linear-gradient(145deg, #fff, #eef4f7);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  box-shadow: var(--shadow-sm);
  transform: rotate(-8deg);
}

.empty-illustration span:nth-child(2) {
  left: 24px;
  top: 4px;
  transform: rotate(4deg);
}

.empty-illustration span:nth-child(3) {
  left: 46px;
  top: 10px;
  transform: rotate(13deg);
}

/* Templates */
.template-page {
  min-height: 100vh;
  padding: 32px clamp(20px, 4vw, 58px) 52px;
  background: #f7f6f2;
}

.template-top {
  align-items: start;
  justify-content: space-between;
}

.template-title {
  text-align: center;
}

.template-title span {
  display: block;
  margin-top: 6px;
  color: var(--text-tertiary);
}

.template-search {
  width: min(340px, 28vw);
}

.category-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin: 28px 0;
}

.category-tabs button {
  min-width: 88px;
  min-height: 36px;
  color: var(--text-secondary);
  background: rgb(255 255 255 / 0.68);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.category-tabs button.active,
.category-tabs button:hover {
  color: #fff;
  background: linear-gradient(135deg, #4f9aa4, #2d8794);
  border-color: transparent;
}

.template-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 22px;
  align-items: start;
}

.template-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(190px, 1fr));
  gap: 18px;
}

.template-card,
.template-preview-panel,
.settings-card {
  background: rgb(255 255 255 / 0.86);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

.template-card {
  padding: 8px;
}

.template-card:hover,
.template-card.selected {
  border-color: var(--teal);
  box-shadow: 0 0 0 2px rgb(44 137 147 / 0.12), var(--shadow-md);
}

.template-preview {
  position: relative;
  height: 150px;
  overflow: hidden;
  background: #fffefa;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
}

.template-preview.large {
  height: 230px;
}

.template-preview::before {
  position: absolute;
  inset: 0;
  content: "";
  background:
    linear-gradient(90deg, rgb(46 74 111 / 0.025) 1px, transparent 1px),
    linear-gradient(rgb(46 74 111 / 0.02) 1px, transparent 1px);
  background-size: 22px 22px;
}

.template-preview.lined::before {
  background: repeating-linear-gradient(to bottom, transparent 0 17px, rgb(74 111 165 / 0.18) 18px 19px);
}

.template-preview.grid::before,
.mini-grid,
.week-mini,
.quad-mini {
  background:
    linear-gradient(90deg, rgb(46 74 111 / 0.12) 1px, transparent 1px),
    linear-gradient(rgb(46 74 111 / 0.12) 1px, transparent 1px);
  background-size: 18px 18px;
}

.template-preview.dot::before,
.mini-dot {
  background-image: radial-gradient(circle, rgb(46 74 111 / 0.35) 1px, transparent 1.5px);
  background-size: 18px 18px;
}

.template-preview b,
.template-preview i,
.template-preview span,
.template-preview div {
  position: absolute;
}

.template-preview b {
  left: 18px;
  top: 16px;
  z-index: 1;
  color: var(--ink-blue);
}

.template-preview i {
  left: 18px;
  right: 18px;
  height: 1px;
  background: rgb(46 74 111 / 0.22);
}

.template-preview i:nth-of-type(1) { top: 48px; }
.template-preview i:nth-of-type(2) { top: 76px; }
.template-preview i:nth-of-type(3) { top: 104px; }

.cornell-left {
  left: 0;
  top: 0;
  width: 32%;
  height: 74%;
  border-right: 1px solid rgb(46 74 111 / 0.22);
  border-bottom: 1px solid rgb(46 74 111 / 0.22);
}

.cornell-main {
  right: 0;
  top: 0;
  width: 68%;
  height: 74%;
  border-bottom: 1px solid rgb(46 74 111 / 0.22);
}

.cornell-bottom {
  inset: 74% 0 0;
}

.mini-table,
.check-lines,
.week-mini,
.quad-mini,
.flow-mini,
.quote-box {
  left: 18px;
  right: 18px;
  bottom: 18px;
  height: 54px;
  border: 1px solid rgb(46 74 111 / 0.2);
}

.flow-mini {
  border: 0;
  background: linear-gradient(90deg, rgb(74 111 165 / 0.18), rgb(44 137 147 / 0.18));
  clip-path: polygon(0 35%, 38% 35%, 38% 10%, 100% 50%, 38% 90%, 38% 65%, 0 65%);
}

.template-card-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 8px 6px;
}

.template-card-footer span {
  display: block;
  margin-top: 8px;
  color: var(--text-tertiary);
  font-size: 12px;
}

.template-preview-panel {
  position: sticky;
  top: 24px;
  display: grid;
  gap: 16px;
  padding: 16px;
}

.panel-title {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.panel-title h2 {
  margin: 0;
  color: var(--ink-blue);
}

.detail-list {
  display: grid;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 13px;
}

.detail-list span {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

/* Editor */
.editor-shell,
.pdf-shell {
  min-height: 100vh;
  background: #f3f2ee;
}

.editor-design-shell {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  min-height: 100vh;
  height: 100vh;
  overflow: hidden;
  color: #1f2429;
  background: #f4f5f6;
}

.design-editor-top {
  display: grid;
  grid-template-columns: minmax(290px, 1fr) auto minmax(360px, 1fr);
  align-items: center;
  min-height: 96px;
  padding: 0 28px;
  background: #fff;
  border-bottom: 1px solid #dfe3e8;
  box-shadow: 0 1px 10px rgb(0 0 0 / 0.06);
}

.design-status {
  position: absolute;
  top: 11px;
  left: 44px;
  display: flex;
  gap: 12px;
  color: #101418;
  font-size: 15px;
  font-weight: 560;
}

.design-editor-top::after {
  position: absolute;
  top: 12px;
  right: 24px;
  color: #111;
  content: "⌁ 100% ▰";
  font-size: 15px;
  letter-spacing: 1px;
}

.design-doc-title,
.design-actions,
.design-page-control,
.design-mode-switch {
  display: flex;
  align-items: center;
}

.design-doc-title {
  gap: 20px;
  min-width: 0;
  padding-top: 16px;
}

.design-doc-title strong {
  max-width: 310px;
  overflow: hidden;
  font-size: 20px;
  font-weight: 720;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.design-doc-title span {
  display: block;
  max-width: 310px;
  margin-top: 3px;
  overflow: hidden;
  color: #66707c;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inline-chevron {
  margin-left: 6px;
  color: #111;
  background: transparent;
  border: 0;
  font-size: 19px;
}

.design-icon-button {
  display: inline-grid;
  width: 44px;
  height: 44px;
  place-items: center;
  color: #111;
  background: #fff;
  border: 0;
  border-radius: 12px;
}

.design-icon-button:hover,
.design-action-button:hover,
.design-page-control button:hover {
  background: #f4f6f8;
}

.design-page-control {
  justify-self: center;
  height: 45px;
  overflow: hidden;
  background: #fff;
  border: 1px solid #dfe3e8;
  border-radius: 999px;
}

.design-page-control button,
.design-page-control strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 104px;
  height: 100%;
  padding: 0 16px;
  background: transparent;
  border: 0;
  border-right: 1px solid #dfe3e8;
  font-size: 16px;
  font-weight: 560;
  white-space: nowrap;
}

.design-page-control button:last-child {
  border-right: 0;
}

.design-page-control button:last-child svg {
  transform: rotate(180deg);
}

.design-page-control button:disabled,
.pdf-pager button:disabled {
  color: #a0a8b1;
  cursor: not-allowed;
  background: #f5f6f7;
}

.design-page-control strong {
  min-width: 96px;
  color: #111;
  background: #fbfbfc;
}

.design-actions {
  justify-self: end;
  gap: 14px;
  padding-top: 16px;
}

.design-mode-switch {
  height: 45px;
  overflow: hidden;
  border: 1px solid #dfe3e8;
  border-radius: 8px;
}

.design-mode-switch button {
  min-width: 90px;
  height: 100%;
  background: #fff;
  border: 0;
  border-right: 1px solid #dfe3e8;
  font-size: 16px;
}

.design-mode-switch button:last-child {
  border-right: 0;
}

.design-mode-switch button.active {
  color: #fff;
  background: #1264f5;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.18);
}

.design-action-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 10px;
  background: #fff;
  border: 0;
  border-radius: 10px;
  font-size: 16px;
}

@media (pointer: coarse) {
  .button,
  .icon-button,
  .design-icon-button,
  .design-action-button,
  .design-tool,
  .side-link,
  .chip,
  .template-card,
  .document-card,
  .design-page-thumb {
    min-height: 48px;
  }

  .design-color,
  .design-rainbow,
  .color-dot {
    width: 38px;
    height: 38px;
  }
}

.design-annotation-toolbar {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 58px;
  padding: 0 28px;
  color: #fff;
  background: linear-gradient(180deg, #34383d 0%, #252a2f 100%);
  box-shadow: 0 2px 12px rgb(0 0 0 / 0.14);
}

.toolbar-close {
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: #fff;
  background: transparent;
  border: 0;
  border-radius: 10px;
}

.design-tool {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 0 14px;
  color: rgb(255 255 255 / 0.9);
  background: transparent;
  border: 0;
  border-radius: 999px;
  font-size: 15px;
  white-space: nowrap;
}

.design-tool svg {
  width: 24px;
  height: 24px;
}

.design-tool.active {
  color: #fff;
  background: rgb(255 255 255 / 0.16);
}

.design-tool:focus-visible,
.design-page-thumb:focus-visible,
.design-action-button:focus-visible,
.design-icon-button:focus-visible,
.design-page-control button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgb(18 100 245 / 0.24);
}

.design-tool.active svg {
  color: #ffd21e;
}

.design-tool small {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 30px;
  margin-left: 4px;
  border-left: 1px solid rgb(255 255 255 / 0.22);
  font-size: 14px;
}

.design-editor-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  min-height: 0;
  background: #f4f5f6;
}

.design-document-area {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr) 150px;
  min-width: 0;
  overflow: hidden;
  padding: 0 18px 0;
}

.design-tool-popover {
  position: absolute;
  left: 138px;
  top: 0;
  z-index: 35;
  width: 230px;
  padding: 18px 16px 14px;
  background: #fff;
  border: 1px solid #e0e4e8;
  border-radius: 0 0 10px 10px;
  box-shadow: 0 10px 24px rgb(0 0 0 / 0.12);
}

.design-tool-popover::before {
  position: absolute;
  top: -8px;
  left: 78px;
  width: 16px;
  height: 16px;
  content: "";
  background: #fff;
  transform: rotate(45deg);
}

.tool-popover-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.tool-popover-heading strong,
.design-tool-popover > strong {
  color: #20262d;
  font-size: 15px;
}

.tool-popover-heading span,
.design-tool-popover > span {
  display: block;
  color: #66707c;
  font-size: 12px;
  line-height: 1.45;
}

.design-tool-popover.read-panel,
.design-tool-popover.text-panel {
  display: grid;
  gap: 12px;
  width: 250px;
}

.compact-action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.compact-action-row button {
  min-height: 36px;
  color: #1f2933;
  background: #f5f7f9;
  border: 1px solid #dfe3e8;
  border-radius: 7px;
}

.design-color-row {
  display: grid;
  grid-template-columns: repeat(4, 38px);
  gap: 16px 18px;
}

.design-color-row.compact {
  grid-template-columns: repeat(4, 34px);
  gap: 10px;
}

.design-color,
.design-rainbow {
  width: 34px;
  height: 34px;
  background: var(--swatch);
  border: 2px solid transparent;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgb(0 0 0 / 0.08);
}

.design-rainbow {
  background: conic-gradient(#f04444, #ffb020, #35c759, #2f80ed, #9b51e0, #f04444);
}

.design-color.active {
  border-color: #fff;
  box-shadow: 0 0 0 3px #1264f5;
}

.design-weight-label {
  margin-top: 18px;
  padding-top: 14px;
  color: #333;
  border-top: 1px solid #e5e7eb;
  font-size: 13px;
}

.design-weight-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-top: 12px;
}

.design-weight-row button {
  display: grid;
  height: 34px;
  place-items: center;
  background: #fff;
  border: 1px solid transparent;
  border-radius: 7px;
}

.design-weight-row button.active {
  border-color: #1264f5;
}

.design-weight-row span {
  display: block;
  width: 31px;
  background: #2b2e31;
  border-radius: 999px;
}

.text-size-row button {
  color: #20262d;
  font-size: 13px;
}

.design-pdf-page {
  position: relative;
  align-self: stretch;
  width: min(100%, 1178px);
  height: 100%;
  min-height: 0;
  margin: 0 auto;
  padding: 50px 80px;
  overflow: hidden;
  background: #fff;
  border: 1px solid #d8dde2;
  box-shadow: 0 2px 10px rgb(0 0 0 / 0.06);
}

.design-pdf-page h1 {
  margin: 0 0 18px 300px;
  font-size: 27px;
  line-height: 1.25;
}

.design-pdf-page > p {
  margin: 0 0 34px 300px;
  color: #3a3d40;
  font-size: 16px;
}

.design-pdf-page .pdf-principle {
  width: 660px;
  margin: 32px 0 0 300px;
  padding-left: 52px;
}

.design-pdf-page .pdf-principle b {
  width: 34px;
  height: 34px;
  background: #1264b8;
  font-size: 18px;
}

.design-pdf-page .pdf-principle h2 {
  margin-bottom: 14px;
  font-size: 26px;
}

.design-pdf-page .pdf-principle p {
  color: #333;
  font-size: 16px;
  line-height: 1.85;
}

.design-pdf-page .red-circle {
  left: 365px;
  top: 190px;
  width: 660px;
  height: 176px;
  border-width: 3px;
}

.design-pdf-page .pdf-hand-note {
  left: 52px;
  top: 245px;
  color: #1264ff;
  font-size: 34px;
  line-height: 1.34;
}

.pdf-arrow-note {
  position: absolute;
  left: 250px;
  top: 320px;
  width: 110px;
  height: 60px;
  border-top: 3px solid #1264ff;
  border-radius: 50%;
  transform: rotate(-24deg);
}

.pdf-arrow-note::after {
  position: absolute;
  right: -5px;
  top: -8px;
  width: 16px;
  height: 16px;
  content: "";
  border-right: 3px solid #1264ff;
  border-top: 3px solid #1264ff;
  transform: rotate(44deg);
}

.design-pdf-page .pdf-star {
  right: 128px;
  top: 278px;
  color: #ff1e2d;
  font-size: 48px;
}

.design-pdf-page .pdf-watermark {
  left: 68px;
  bottom: 38px;
  color: #8c939b;
  font-size: 13px;
  letter-spacing: 0.02em;
}

.design-pdf-page.note-document {
  background:
    linear-gradient(180deg, rgb(255 255 255 / 0.98), rgb(255 253 248 / 0.98)),
    repeating-linear-gradient(to bottom, transparent 0 31px, rgb(74 111 165 / 0.12) 32px 33px);
}

.design-pdf-page.note-document h1,
.design-pdf-page.note-document > p {
  margin-left: 0;
}

.design-pdf-page.note-document .pdf-principle {
  width: min(720px, 100%);
  margin-left: 0;
}

.formula-board,
.meeting-agenda {
  display: grid;
  gap: 8px;
  width: min(720px, 100%);
  margin: 24px 0 8px;
  padding: 16px 18px;
  color: #203142;
  background: rgb(74 111 165 / 0.08);
  border: 1px solid rgb(74 111 165 / 0.18);
  border-radius: 10px;
}

.formula-board strong {
  font-size: 24px;
}

.formula-board span {
  color: #52606d;
  line-height: 1.6;
}

.meeting-agenda {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.meeting-agenda span {
  min-height: 46px;
  padding: 12px;
  color: #24505a;
  background: rgb(44 137 147 / 0.1);
  border-radius: 8px;
}

.read-mode .design-tool-popover,
.read-mode .design-annotation-card {
  opacity: 0.78;
}

.design-page-number {
  position: absolute;
  right: 48px;
  bottom: 36px;
  color: #59606a;
  font-size: 14px;
}

.design-bottom-strip {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  min-height: 150px;
  padding: 12px 0 22px;
  background: #f4f5f6;
}

.thumb-grid-button {
  display: grid;
  width: 50px;
  height: 94px;
  place-items: center;
  color: #20262d;
  background: #fff;
  border: 1px solid #dde3e8;
  border-radius: 8px;
}

.design-thumb-scroll {
  display: flex;
  gap: 12px;
  min-width: 0;
  overflow-x: auto;
  padding: 2px 0;
}

.design-page-thumb {
  display: grid;
  flex: 0 0 74px;
  gap: 7px;
  padding: 0;
  color: #272b30;
  background: transparent;
  border: 0;
  text-align: center;
}

.design-page-thumb span {
  position: relative;
  display: block;
  height: 94px;
  overflow: hidden;
  background: #fff;
  border: 1px solid #dce2e8;
  border-radius: 6px;
}

.design-page-thumb.active span {
  border: 2px solid #1264ff;
  box-shadow: 0 0 0 2px rgb(18 100 255 / 0.12);
}

.design-page-thumb b,
.design-page-thumb u,
.design-page-thumb i,
.design-page-thumb em {
  position: absolute;
  left: 10px;
  right: 10px;
  display: block;
  content: "";
}

.design-page-thumb b {
  top: 14px;
  height: 7px;
  background: #cfd6dd;
}

.design-page-thumb u {
  top: 30px;
  height: 28px;
  background: repeating-linear-gradient(to bottom, #e6ebef 0 2px, transparent 2px 7px);
  text-decoration: none;
}

.design-page-thumb i {
  top: 10px;
  right: 12px;
  left: auto;
  width: 10px;
  height: 10px;
  background: #ffd21e;
  border-radius: 50%;
}

.design-page-thumb em {
  right: 12px;
  bottom: 18px;
  left: auto;
  width: 10px;
  height: 10px;
  background: #ff3344;
  border-radius: 50%;
}

.design-page-thumb strong {
  color: #30343a;
  font-size: 13px;
  font-weight: 520;
}

.design-page-thumb.active strong {
  color: #1264ff;
}

.design-annotation-panel {
  min-width: 0;
  padding: 26px 16px;
  overflow-y: auto;
  background: #fff;
  border-left: 1px solid #dfe3e8;
}

.design-panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.design-panel-title strong {
  font-size: 16px;
}

.design-panel-title button,
.design-annotation-card button {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  color: #20262d;
  background: transparent;
  border: 0;
  border-radius: 6px;
}

.design-panel-title button:hover,
.design-annotation-card button:hover {
  background: #eef2f6;
}

.annotation-context {
  display: grid;
  gap: 4px;
  margin-bottom: 16px;
  padding: 12px;
  color: #66707c;
  background: #f7f9fb;
  border: 1px solid #e2e6eb;
  border-radius: 8px;
}

.annotation-context strong {
  color: #20262d;
}

.annotation-context small {
  color: #8a939d;
}

.design-annotation-list {
  display: grid;
  gap: 14px;
}

.design-annotation-card {
  padding: 14px 12px 14px 16px;
  background: #fbfcfe;
  border: 1px solid #e2e6eb;
  border-left: 4px solid #ffd21e;
  border-radius: 8px;
}

.design-annotation-card.red {
  border-left-color: #ff3344;
}

.design-annotation-card.blue,
.design-annotation-card.voice {
  border-left-color: #2f80ed;
}

.design-annotation-card.gray {
  border-left-color: #9aa2ad;
}

.design-annotation-card > div {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto 24px;
  gap: 8px;
  align-items: center;
}

.design-annotation-card svg {
  width: 22px;
  height: 22px;
}

.design-annotation-card.yellow svg {
  color: #ffcc00;
}

.design-annotation-card.red svg {
  color: #ff3344;
}

.design-annotation-card.blue svg,
.design-annotation-card.voice svg {
  color: #2f80ed;
}

.design-annotation-card strong {
  min-width: 0;
  overflow: hidden;
  color: #31363c;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.design-annotation-card time {
  color: #9aa2ad;
  font-size: 12px;
}

.design-annotation-card p {
  margin: 10px 0 0 32px;
  color: #30343a;
  font-size: 13px;
  line-height: 1.55;
}

.design-annotation-card.voice p::before {
  display: inline-grid;
  width: 34px;
  height: 34px;
  margin-right: 10px;
  place-items: center;
  color: #fff;
  content: "▶";
  background: #6b7178;
  border-radius: 50%;
}

.editor-topbar,
.pdf-topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  min-height: 78px;
  padding: 14px 24px;
  background: rgb(255 255 255 / 0.86);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 12px rgb(0 0 0 / 0.04);
  backdrop-filter: blur(18px);
}

.editor-title-group,
.pdf-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.editor-title-group > div,
.pdf-title > div {
  min-width: 0;
}

.editor-doc-title {
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: min(44vw, 460px);
  overflow: hidden;
  color: var(--text);
  font-size: 18px;
  font-weight: 720;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-title-group span,
.pdf-title span {
  display: block;
  margin-top: 3px;
  color: var(--text-tertiary);
  font-size: 12px;
}

.inline-icon {
  display: inline-grid;
  width: 24px;
  height: 24px;
  place-items: center;
  color: var(--text-tertiary);
  background: transparent;
  border: 0;
}

.inline-icon svg {
  width: 15px;
  height: 15px;
}

.editor-center-actions {
  display: flex;
  gap: 8px;
}

.editor-body {
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr) 286px;
  min-height: calc(100vh - 78px);
}

.editor-body.thumbs-collapsed {
  grid-template-columns: 54px minmax(0, 1fr) 286px;
}

.thumbnail-rail {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 14px;
  padding: 18px 14px;
  background: rgb(255 255 255 / 0.58);
  border-right: 1px solid var(--border);
}

.rail-toggle {
  min-height: 34px;
  color: var(--teal);
  background: rgb(44 137 147 / 0.08);
  border: 1px solid rgb(44 137 147 / 0.14);
  border-radius: var(--radius-xs);
}

.thumb-scroll {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

.page-thumb {
  display: grid;
  gap: 6px;
  padding: 6px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
}

.page-thumb.active {
  color: var(--teal);
  background: rgb(44 137 147 / 0.08);
  border-color: var(--teal);
}

.page-thumb strong {
  font-size: 12px;
}

.mini-page {
  position: relative;
  display: block;
  height: 96px;
  overflow: hidden;
  background: #fffefa;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  box-shadow: var(--shadow-sm);
}

.mini-page.grid,
.note-page.grid {
  background-color: #fffefa;
  background-image:
    linear-gradient(90deg, rgb(46 74 111 / 0.08) 1px, transparent 1px),
    linear-gradient(rgb(46 74 111 / 0.08) 1px, transparent 1px);
  background-size: 22px 22px;
}

.mini-page.dot,
.note-page.dot {
  background-color: #fffefa;
  background-image: radial-gradient(circle, rgb(46 74 111 / 0.2) 1px, transparent 1.5px);
  background-size: 20px 20px;
}

.mini-page.lined,
.note-page.lined {
  background-color: #fffefa;
  background-image: repeating-linear-gradient(to bottom, transparent 0 27px, rgb(74 111 165 / 0.14) 28px 29px);
}

.mini-page.cornell,
.note-page.cornell {
  background:
    linear-gradient(90deg, transparent 0 30%, rgb(74 111 165 / 0.16) 30% calc(30% + 1px), transparent calc(30% + 1px)),
    linear-gradient(180deg, transparent 0 75%, rgb(74 111 165 / 0.16) 75% calc(75% + 1px), transparent calc(75% + 1px)),
    #fffefa;
}

.mini-page b,
.mini-page i,
.mini-page span {
  position: absolute;
}

.mini-page b {
  left: 12px;
  right: 12px;
  top: 12px;
  height: 8px;
  background: rgb(46 74 111 / 0.28);
}

.mini-page i {
  left: 12px;
  right: 12px;
  top: 30px;
  height: 4px;
  background: rgb(46 74 111 / 0.12);
}

.mini-bars {
  left: 16px;
  right: 16px;
  bottom: 16px;
  height: 42px;
  background: linear-gradient(90deg, var(--paper-blue-light) 0 15%, transparent 15% 24%, var(--paper-blue) 24% 44%, transparent 44% 54%, var(--teal) 54% 72%, transparent 72% 80%, var(--warning) 80%);
  clip-path: polygon(0 70%, 15% 70%, 15% 100%, 24% 100%, 24% 44%, 44% 44%, 44% 100%, 54% 100%, 54% 20%, 72% 20%, 72% 100%, 80% 100%, 80% 8%, 100% 8%, 100% 100%, 0 100%);
}

.mini-flow,
.mini-stickies,
.mini-table-dense {
  left: 14px;
  right: 14px;
  bottom: 14px;
  height: 42px;
  border: 1px solid rgb(46 74 111 / 0.18);
}

.rail-actions {
  display: grid;
  gap: 8px;
}

.rail-actions .button {
  min-height: 38px;
  padding: 0 8px;
  font-size: 12px;
}

.thumbs-collapsed .thumbnail-rail {
  padding: 18px 8px;
}

.thumbs-collapsed .page-thumb,
.thumbs-collapsed .rail-actions {
  display: none;
}

.thumbs-collapsed .rail-toggle {
  writing-mode: vertical-rl;
}

.canvas-stage {
  position: relative;
  min-width: 0;
  min-height: calc(100vh - 78px);
  padding: 18px 26px 132px;
  overflow: hidden;
}

.canvas-modebar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.mobile-editor-note {
  display: none;
  margin-bottom: 12px;
  padding: 12px 14px;
  color: var(--ink-blue);
  background: rgb(255 255 255 / 0.84);
  border: 1px solid var(--border);
  border-left: 4px solid var(--info);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  line-height: 1.6;
}

.editor-context-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.editor-context-bar span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 10px;
  color: var(--text-secondary);
  background: rgb(255 255 255 / 0.74);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
}

.editor-context-bar strong {
  color: var(--teal);
}

.editor-context-bar i {
  width: 14px;
  height: 14px;
  background: var(--swatch);
  border: 1px solid rgb(0 0 0 / 0.12);
  border-radius: 50%;
}

.page-template-switch {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  color: var(--text-tertiary);
  font-size: 12px;
}

.page-template-switch button {
  min-height: 30px;
  padding: 0 9px;
  color: var(--text-secondary);
  background: rgb(255 255 255 / 0.75);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
}

.page-template-switch button.active {
  color: var(--teal);
  border-color: var(--teal);
  background: rgb(44 137 147 / 0.1);
}

.paper-canvas {
  display: grid;
  justify-items: center;
  gap: 22px;
  height: calc(100vh - 248px);
  min-height: 560px;
  overflow: auto;
  padding: 12px 0 160px;
}

.paper-canvas.continuous {
  align-content: start;
}

.note-page {
  position: relative;
  width: min(760px, 92%);
  min-height: 980px;
  padding: 62px 72px;
  transform: scale(var(--zoom));
  transform-origin: top center;
  background-color: #fffefa;
  border: 1px solid rgb(224 222 216 / 0.9);
  border-radius: var(--radius-xs);
  box-shadow: 0 18px 45px rgb(29 43 58 / 0.14);
}

.note-page.blank {
  background:
    linear-gradient(90deg, rgb(46 74 111 / 0.018) 1px, transparent 1px),
    linear-gradient(rgb(46 74 111 / 0.015) 1px, transparent 1px),
    #fffefa;
  background-size: 34px 34px;
}

.page-heading {
  display: grid;
  gap: 10px;
  margin-bottom: 44px;
}

.page-heading.compact {
  margin-bottom: 26px;
}

.page-heading span {
  color: var(--paper-blue);
  font-weight: 700;
}

.page-heading h2 {
  max-width: 620px;
  margin: 0;
  color: var(--ink-blue);
  font-size: 34px;
  line-height: 1.2;
}

.page-heading p {
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.7;
}

.handwriting {
  max-width: 360px;
  margin: 28px 0;
  color: #234f8f;
  font-size: 24px;
  line-height: 1.5;
  font-family: "Bradley Hand", "Kaiti SC", cursive;
  transform: rotate(-2deg);
}

.handwriting.blue {
  color: #236fcb;
}

.paper-note {
  width: 250px;
  padding: 18px;
  color: var(--text-secondary);
  background: #fff8d7;
  border: 1px solid rgb(212 160 61 / 0.28);
  border-radius: var(--radius-xs);
  box-shadow: var(--shadow-sm);
  transform: rotate(1deg);
}

.page-footer {
  position: absolute;
  left: 72px;
  bottom: 38px;
  color: var(--text-tertiary);
  font-size: 12px;
}

.checked-list {
  display: grid;
  gap: 14px;
  padding: 0;
  margin: 0 0 34px;
  list-style: none;
}

.checked-list li {
  position: relative;
  padding-left: 34px;
  color: var(--text-secondary);
  font-size: 18px;
}

.checked-list li::before {
  position: absolute;
  left: 0;
  top: 2px;
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  color: #fff;
  content: "✓";
  background: var(--success);
  border-radius: 50%;
}

.bar-chart {
  display: flex;
  align-items: end;
  gap: 18px;
  width: 420px;
  height: 180px;
  padding: 18px;
  border: 1px solid rgb(46 74 111 / 0.14);
  background: rgb(255 255 255 / 0.66);
}

.bar-chart i {
  flex: 1;
  background: linear-gradient(180deg, #8bbdcb, #4a6fa5);
  border-radius: 6px 6px 0 0;
}

.bar-chart i:nth-child(1) { height: 52%; }
.bar-chart i:nth-child(2) { height: 64%; }
.bar-chart i:nth-child(3) { height: 80%; }
.bar-chart i:nth-child(4) { height: 44%; }
.bar-chart i:nth-child(5) { height: 92%; }

.flow-board {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin: 40px 0;
}

.flow-board span {
  display: grid;
  min-height: 68px;
  place-items: center;
  color: var(--ink-blue);
  background: rgb(255 255 255 / 0.82);
  border: 1px solid rgb(74 111 165 / 0.24);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

.annotation.highlight {
  display: inline;
  padding: 2px 5px;
  background: rgb(246 200 76 / 0.48);
}

.sticky-wall {
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 1fr));
  gap: 18px;
  margin-top: 40px;
}

.sticky-wall span {
  min-height: 110px;
  padding: 18px;
  background: #fff8d7;
  border: 1px solid rgb(212 160 61 / 0.28);
  border-radius: var(--radius-xs);
  box-shadow: var(--shadow-sm);
}

.sticky-wall span:nth-child(2) {
  background: #e8f2ea;
}

.sticky-wall span:nth-child(3) {
  background: #eef4fb;
}

.sticky-wall span:nth-child(4) {
  background: #f7ece7;
}

.lasso-mark {
  position: absolute;
  right: 120px;
  bottom: 210px;
  width: 180px;
  height: 100px;
  border: 2px dashed rgb(35 111 203 / 0.5);
  border-radius: 48%;
  transform: rotate(-12deg);
}

.paper-table {
  width: 100%;
  border-collapse: collapse;
  background: rgb(255 255 255 / 0.6);
}

.paper-table th,
.paper-table td {
  padding: 14px;
  border: 1px solid rgb(46 74 111 / 0.16);
  text-align: left;
}

.empty-writing-zone {
  display: grid;
  min-height: 360px;
  place-items: center;
  color: var(--text-tertiary);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
}

.formula-block {
  display: grid;
  gap: 10px;
  max-width: 520px;
  padding: 18px;
  color: var(--ink-blue);
  background: rgb(255 255 255 / 0.72);
  border: 1px solid rgb(74 111 165 / 0.18);
  border-radius: var(--radius-sm);
}

.formula-block strong {
  font-size: 24px;
}

.formula-block span,
.math-steps p {
  color: var(--text-secondary);
}

.math-steps {
  display: grid;
  gap: 12px;
  max-width: 540px;
  margin: 24px 0;
}

.math-steps p {
  margin: 0;
  padding: 10px 12px;
  background: rgb(255 255 255 / 0.54);
  border-left: 3px solid var(--paper-blue-light);
}

.side-callout {
  width: min(240px, 100%);
  margin: 22px 0;
  padding: 14px;
  color: #8c670c;
  background: rgb(246 200 76 / 0.18);
  border: 1px solid rgb(212 160 61 / 0.25);
  border-radius: var(--radius-xs);
}

.reading-quote {
  margin: 0 0 24px;
  padding: 18px 22px;
  color: var(--ink-blue);
  background: rgb(255 255 255 / 0.72);
  border-left: 4px solid var(--paper-blue);
  border-radius: var(--radius-xs);
  line-height: 1.8;
}

.keyword-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 22px 0;
}

.keyword-row span {
  padding: 8px 12px;
  color: var(--teal);
  background: rgb(44 137 147 / 0.1);
  border-radius: 999px;
}

.product-wireframe {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin: 30px 0;
}

.product-wireframe span {
  display: grid;
  min-height: 86px;
  place-items: center;
  color: var(--ink-blue);
  background: rgb(255 255 255 / 0.72);
  border: 1px solid rgb(74 111 165 / 0.22);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

.sticky-wall.compact {
  grid-template-columns: repeat(4, minmax(110px, 1fr));
}

.sticky-wall.compact span {
  min-height: 88px;
}

.tool-panel {
  position: absolute;
  left: 50%;
  bottom: 116px;
  z-index: 45;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
  width: min(900px, calc(100% - 64px));
  min-height: 94px;
  padding: 16px 20px;
  background: rgb(255 255 255 / 0.94);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  transform: translateX(-50%);
  backdrop-filter: blur(18px);
}

.tool-section {
  display: grid;
  gap: 8px;
  min-width: 160px;
  color: var(--text-secondary);
  font-size: 12px;
}

.color-row,
.size-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.color-dot {
  width: 32px;
  height: 32px;
  background: var(--swatch);
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgb(0 0 0 / 0.12), var(--shadow-sm);
}

.color-dot.active {
  box-shadow: 0 0 0 3px rgb(35 111 203 / 0.28), var(--shadow-sm);
}

.size-row button,
.tool-grid-actions button,
.presets button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 12px;
  color: var(--text-secondary);
  background: rgb(250 248 243 / 0.8);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
}

.size-row button.active,
.tool-grid-actions button.active,
.tool-grid-actions button:hover,
.presets button:hover {
  color: var(--teal);
  border-color: var(--teal);
  background: rgb(44 137 147 / 0.08);
}

.size-row i {
  display: inline-block;
  width: 28px;
  background: currentColor;
  border-radius: 999px;
}

.opacity-section {
  grid-template-columns: auto minmax(120px, 1fr) auto;
  align-items: center;
}

.opacity-section input {
  accent-color: var(--teal);
}

.tool-grid-actions {
  display: grid;
  grid-template-columns: repeat(5, minmax(90px, 1fr));
  gap: 8px;
  width: 100%;
}

.toggle-line {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-secondary);
}

.toggle-line input {
  accent-color: var(--teal);
}

.record-panel,
.panel-copy {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0;
  color: var(--text-secondary);
}

.record-panel strong {
  color: var(--danger);
  font-size: 24px;
}

.main-toolbar {
  position: absolute;
  left: 50%;
  bottom: 24px;
  z-index: 50;
  display: flex;
  max-width: min(860px, calc(100% - 64px));
  padding: 8px;
  overflow-x: auto;
  background: rgb(255 255 255 / 0.96);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  transform: translateX(-50%);
}

.tool-button {
  display: grid;
  flex: 0 0 72px;
  min-height: 72px;
  place-items: center;
  gap: 4px;
  color: var(--text-secondary);
  background: transparent;
  border: 0;
}

.tool-button span {
  font-size: 12px;
}

.tool-button:hover,
.tool-button.active {
  color: var(--teal);
  background: rgb(44 137 147 / 0.11);
}

.zoom-control {
  position: absolute;
  right: 24px;
  bottom: 24px;
  z-index: 51;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: rgb(255 255 255 / 0.94);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}

.zoom-control .icon-button {
  width: 34px;
  height: 34px;
}

.page-indicator {
  position: absolute;
  left: 50%;
  bottom: 204px;
  z-index: 30;
  padding: 8px 16px;
  color: var(--text-secondary);
  background: rgb(255 255 255 / 0.9);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  transform: translateX(-50%);
}

.right-panel {
  padding: 18px;
  background: rgb(255 255 255 / 0.66);
  border-left: 1px solid var(--border);
}

.panel-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 22px;
}

.panel-tabs button {
  min-height: 38px;
  color: var(--text-secondary);
  background: transparent;
  border: 0;
  border-radius: var(--radius-xs);
}

.panel-tabs button.active {
  color: var(--teal);
  background: rgb(44 137 147 / 0.1);
}

.outline-panel h3 {
  margin: 0 0 18px;
  color: var(--ink-blue);
}

.outline-panel,
.bookmark-list,
.asset-list {
  display: grid;
  gap: 8px;
}

.outline-panel button,
.bookmark-list button,
.asset-list button {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 0 12px;
  color: var(--text-secondary);
  background: rgb(255 255 255 / 0.62);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  text-align: left;
}

.outline-panel button strong {
  color: var(--teal);
}

.outline-panel button span {
  margin-left: auto;
  color: var(--text-tertiary);
}

/* PDF */
.pdf-shell {
  background: #f4f5f3;
}

.pdf-toolbar {
  position: sticky;
  top: 78px;
  z-index: 55;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 58px;
  padding: 8px 22px;
  overflow-x: auto;
  color: #fff;
  background: linear-gradient(90deg, #252c33, #343a40);
}

.pdf-toolbar button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  color: rgb(255 255 255 / 0.86);
  background: transparent;
  border: 0;
  border-radius: var(--radius-xs);
  white-space: nowrap;
}

.pdf-toolbar button.active,
.pdf-toolbar button:hover {
  color: #fff;
  background: rgb(255 255 255 / 0.12);
}

.pdf-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 1;
}

.pdf-pager button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 12px;
  color: var(--text-secondary);
  background: rgb(255 255 255 / 0.7);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.pdf-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  min-height: calc(100vh - 136px);
}

.pdf-canvas {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  padding: 26px;
  overflow: auto;
}

.pdf-mode-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: min(860px, 100%);
  margin: 0 auto 14px;
  padding: 12px 14px;
  color: var(--text-secondary);
  background: rgb(255 255 255 / 0.8);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

.pdf-mode-banner strong {
  color: #1264d8;
}

.pdf-page-sheet {
  position: relative;
  width: min(860px, 100%);
  min-height: 930px;
  margin: 0 auto;
  padding: 72px 88px;
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: 0 10px 32px rgb(29 43 58 / 0.14);
}

.pdf-page-sheet h1 {
  margin: 0 0 24px;
  font-size: 28px;
}

.pdf-page-sheet p {
  color: var(--text-secondary);
  line-height: 1.8;
}

.pdf-watermark {
  position: absolute;
  left: 72px;
  bottom: 42px;
  color: var(--text-tertiary);
  font-size: 12px;
}

.pdf-principle {
  position: relative;
  margin: 36px 0;
  padding-left: 54px;
}

.pdf-principle b {
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  color: #fff;
  background: #1d64b7;
  border-radius: 50%;
}

.pdf-principle h2 {
  margin: 0 0 12px;
}

mark {
  padding: 0 4px;
  background: rgb(246 200 76 / 0.52);
}

.red-circle {
  position: absolute;
  left: 165px;
  top: 252px;
  width: 560px;
  height: 170px;
  border: 4px solid #f03030;
  border-radius: 50%;
  transform: rotate(-4deg);
}

.pdf-hand-note {
  position: absolute;
  left: 40px;
  top: 360px;
  color: #236fcb;
  font-family: "Bradley Hand", "Kaiti SC", cursive;
  font-size: 26px;
  line-height: 1.5;
  transform: rotate(-5deg);
}

.pdf-star {
  position: absolute;
  right: 130px;
  top: 420px;
  color: #f03030;
  font-size: 44px;
}

.pdf-side-note {
  position: absolute;
  right: 64px;
  bottom: 128px;
  width: 190px;
  padding: 12px;
  color: var(--text-secondary);
  background: #fff8d7;
  border: 1px solid rgb(212 160 61 / 0.3);
  border-radius: var(--radius-xs);
}

.pdf-side-note.typed {
  right: 52px;
  bottom: 235px;
  background: #eef4fb;
  border-color: rgb(35 111 203 / 0.18);
}

.pdf-pen-stroke {
  position: absolute;
  left: 345px;
  top: 565px;
  width: 330px;
  height: 88px;
  border: 4px solid #236fcb;
  border-top-color: transparent;
  border-left-color: transparent;
  border-radius: 50%;
  transform: rotate(-6deg);
}

.pdf-bottom-thumbs {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  padding: 12px;
  overflow-x: auto;
  background: rgb(255 255 255 / 0.7);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.pdf-bottom-thumbs button {
  display: grid;
  gap: 5px;
  min-width: 70px;
  padding: 5px;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-xs);
}

.pdf-bottom-thumbs button.active {
  color: #1264d8;
  border-color: #1264d8;
  background: rgb(18 100 216 / 0.08);
}

.pdf-bottom-thumbs span {
  display: block;
  height: 72px;
  background:
    repeating-linear-gradient(to bottom, transparent 0 10px, rgb(0 0 0 / 0.08) 11px 12px),
    #fff;
  border: 1px solid var(--border);
  border-radius: 4px;
}

.annotation-panel {
  padding: 22px;
  background: rgb(255 255 255 / 0.86);
  border-left: 1px solid var(--border);
}

.annotation-composer {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  padding: 14px;
  background: rgb(44 137 147 / 0.08);
  border: 1px solid rgb(44 137 147 / 0.16);
  border-radius: var(--radius-sm);
}

.annotation-composer strong {
  color: var(--ink-blue);
}

.annotation-composer p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
}

.annotation-item {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--warning);
  border-radius: var(--radius-sm);
  background: #fff;
}

.annotation-item.blue {
  border-left-color: #236fcb;
}

.annotation-item strong {
  color: var(--ink-blue);
}

.annotation-item span {
  float: right;
  color: var(--text-tertiary);
  font-size: 12px;
}

.annotation-item p {
  margin: 10px 0 0;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Settings and modal */
.settings-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 18px;
}

.settings-card {
  display: grid;
  gap: 14px;
  padding: 22px;
}

.settings-card h2 {
  margin: 0;
  color: var(--ink-blue);
}

.settings-card p {
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.7;
}

.storage-bar {
  height: 12px;
  overflow: hidden;
  background: var(--soft-gray);
  border-radius: 999px;
}

.storage-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--paper-blue), var(--teal));
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  background: rgb(26 26 26 / 0.24);
  backdrop-filter: blur(12px);
}

.modal-card {
  position: relative;
  width: min(760px, 100%);
  max-height: calc(100dvh - 48px);
  overflow: auto;
  padding: 26px;
  background: rgb(255 255 255 / 0.96);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}

.modal-card h2 {
  margin: 0 0 10px;
  color: var(--ink-blue);
  font-size: 28px;
}

.modal-card p {
  color: var(--text-secondary);
  line-height: 1.7;
}

.modal-close {
  position: absolute;
  right: 18px;
  top: 18px;
}

.detail-modal {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 24px;
}

.detail-cover {
  min-height: 360px;
  margin: 0;
}

.detail-content {
  display: grid;
  align-content: start;
  gap: 14px;
}

.upload-zone {
  display: grid;
  place-items: center;
  gap: 10px;
  min-height: 180px;
  margin: 18px 0;
  color: var(--text-secondary);
  background: var(--warm-paper);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
}

.upload-zone svg {
  width: 42px;
  height: 42px;
  color: var(--paper-blue);
}

.upload-zone.success {
  color: var(--success);
  border-color: rgb(90 154 110 / 0.45);
  background: rgb(90 154 110 / 0.08);
}

.upload-zone.error {
  color: var(--danger);
  border-color: rgb(196 91 74 / 0.42);
  background: rgb(196 91 74 / 0.08);
}

.upload-zone.idle:hover {
  border-color: rgb(74 111 165 / 0.4);
  background: rgb(74 111 165 / 0.06);
}

.progress {
  height: 10px;
  overflow: hidden;
  background: var(--soft-gray);
  border-radius: 999px;
}

.progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--paper-blue), var(--teal));
  transition: width 0.2s ease;
}

.search-results,
.export-options {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.search-results button,
.export-options button {
  display: grid;
  gap: 4px;
  min-height: 58px;
  padding: 12px 14px;
  color: var(--text-secondary);
  background: var(--warm-paper);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: left;
}

.export-options button strong {
  color: var(--ink-blue);
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 120;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(420px, calc(100vw - 32px));
  min-height: 48px;
  padding: 0 16px;
  color: var(--ink-blue);
  background: rgb(255 255 255 / 0.96);
  border: 1px solid var(--border);
  border-left: 4px solid var(--success);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
}

.toast.warning {
  border-left-color: var(--warning);
}

.toast.danger {
  border-left-color: var(--danger);
}

.toast.info {
  border-left-color: var(--info);
}

.toast svg {
  color: var(--success);
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .home-main,
  .settings-main {
    padding: 24px 24px 48px;
  }

  .recent-strip {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .quick-grid {
    grid-template-columns: repeat(3, minmax(160px, 1fr));
  }

  .template-layout {
    grid-template-columns: 1fr;
  }

  .template-preview-panel {
    position: static;
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }

  .template-preview-panel .button,
  .template-preview-panel .detail-list {
    grid-column: span 2;
  }

  .editor-body {
    grid-template-columns: 142px minmax(0, 1fr);
  }

  .right-panel {
    display: none;
  }

  .note-page {
    width: min(720px, 96%);
  }

  .pdf-workspace {
    grid-template-columns: 1fr;
  }

  .annotation-panel {
    display: none;
  }

  .design-editor-top {
    grid-template-columns: minmax(240px, 1fr) auto minmax(260px, 0.9fr);
    min-height: 88px;
    padding: 0 16px;
  }

  .design-status {
    left: 22px;
  }

  .design-doc-title {
    gap: 12px;
  }

  .design-doc-title strong {
    max-width: 240px;
    font-size: 18px;
  }

  .design-page-control {
    height: 42px;
  }

  .design-page-control button,
  .design-page-control strong {
    min-width: 82px;
    padding: 0 10px;
    font-size: 14px;
  }

  .design-actions {
    gap: 8px;
  }

  .design-mode-switch button {
    min-width: 68px;
    font-size: 14px;
  }

  .design-action-button {
    padding: 0 8px;
    font-size: 14px;
  }

  .design-annotation-toolbar {
    gap: 8px;
    min-height: 56px;
    padding: 0 12px;
    overflow-x: auto;
  }

  .design-tool {
    flex: 0 0 auto;
    padding: 0 12px;
    font-size: 14px;
  }

  .design-editor-workspace {
    grid-template-columns: minmax(0, 1fr) 292px;
  }

  .design-document-area {
    grid-template-rows: minmax(0, 1fr) 128px;
    padding: 0 12px;
  }

  .design-bottom-strip {
    min-height: 128px;
  }

  .design-pdf-page {
    padding: 42px 50px;
  }

  .design-pdf-page h1,
  .design-pdf-page > p {
    margin-left: 240px;
  }

  .design-pdf-page .pdf-principle {
    width: min(610px, calc(100% - 260px));
    margin-left: 240px;
  }

  .design-pdf-page .red-circle {
    left: 300px;
    width: min(580px, 58vw);
  }

  .design-pdf-page .pdf-star {
    right: 72px;
  }

  .design-tool-popover,
  .design-color-popover {
    left: 100px;
  }
}

@media (max-width: 900px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    display: none;
  }

  .mobile-brand {
    display: flex;
  }

  .home-topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .hero-search,
  .template-search {
    width: 100%;
    max-width: none;
  }

  .topbar-actions,
  .toolbar-row,
  .section-title,
  .workspace-header,
  .settings-header {
    align-items: stretch;
    flex-direction: column;
  }

  .status-stack {
    justify-content: flex-start;
  }

  .template-top {
    display: grid;
    grid-template-columns: auto 1fr;
  }

  .template-title,
  .template-search {
    grid-column: 1 / -1;
    text-align: left;
  }

  .template-grid {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }

  .quick-grid {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }

  .template-preview-panel {
    grid-template-columns: 1fr;
  }

  .template-preview-panel .button,
  .template-preview-panel .detail-list {
    grid-column: auto;
  }

  .editor-topbar,
  .pdf-topbar {
    flex-wrap: wrap;
    min-height: auto;
  }

  .editor-title-group,
  .pdf-title {
    flex-basis: 100%;
  }

  .editor-body {
    grid-template-columns: 1fr;
  }

  .thumbnail-rail {
    display: none;
  }

  .canvas-stage {
    min-height: calc(100vh - 118px);
    padding: 14px 12px 132px;
  }

  .mobile-editor-note {
    display: block;
  }

  .paper-canvas {
    min-height: 520px;
  }

  .note-page {
    width: 100%;
    min-height: 760px;
    padding: 42px 34px;
  }

  .tool-panel {
    bottom: 108px;
    width: calc(100% - 24px);
    max-height: 230px;
    overflow: auto;
  }

  .main-toolbar {
    width: calc(100% - 24px);
    max-width: none;
  }

  .zoom-control {
    display: none;
  }

  .page-indicator {
    bottom: 188px;
  }

  .pdf-toolbar {
    top: 116px;
  }

  .design-editor-top {
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: 8px;
    min-height: auto;
    padding: 14px 12px 10px;
  }

  .design-status,
  .design-editor-top::after {
    display: none;
  }

  .design-doc-title {
    grid-column: 1;
    padding-top: 0;
  }

  .design-doc-title strong {
    max-width: 260px;
  }

  .design-actions {
    grid-column: 2;
    justify-self: end;
    padding-top: 0;
  }

  .design-page-control {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: center;
  }

  .design-mode-switch {
    display: none;
  }

  .design-annotation-toolbar {
    min-height: 56px;
    padding: 0 10px;
  }

  .design-editor-workspace {
    grid-template-columns: 1fr;
  }

  .design-annotation-panel {
    display: none;
  }

  .design-document-area {
    grid-template-rows: minmax(0, 1fr) 118px;
    padding: 0 10px;
  }

  .design-bottom-strip {
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 10px;
    min-height: 118px;
    padding-bottom: 12px;
  }

  .thumb-grid-button {
    width: 46px;
    height: 86px;
  }

  .design-page-thumb {
    flex-basis: 66px;
  }

  .design-page-thumb span {
    height: 84px;
  }

  .design-tool-popover,
  .design-color-popover {
    left: 56px;
    width: 220px;
  }

  .design-pdf-page {
    padding: 36px 34px;
  }

  .design-pdf-page h1,
  .design-pdf-page > p {
    margin-left: 178px;
  }

  .design-pdf-page .pdf-principle {
    width: calc(100% - 190px);
    margin-top: 24px;
    margin-left: 178px;
  }

  .design-pdf-page .pdf-principle h2 {
    font-size: 22px;
  }

  .design-pdf-page .pdf-principle p {
    font-size: 14px;
    line-height: 1.7;
  }

  .design-pdf-page .red-circle {
    left: 224px;
    top: 162px;
    width: min(500px, 62vw);
    height: 150px;
  }

  .design-pdf-page .pdf-hand-note {
    left: 32px;
    top: 228px;
    font-size: 28px;
  }

  .pdf-arrow-note {
    left: 185px;
    top: 300px;
  }

  .design-pdf-page .pdf-star {
    right: 42px;
    top: 250px;
  }

  .meeting-agenda {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .home-main,
  .settings-main,
  .template-page {
    padding: 18px 14px 38px;
  }

  .workspace-header {
    padding: 18px;
  }

  .workspace-header h1,
  .template-title h1,
  .settings-header h1 {
    font-size: 30px;
  }

  .recent-strip,
  .document-collection,
  .template-grid,
  .settings-grid,
  .quick-grid {
    grid-template-columns: 1fr;
  }

  .document-row {
    display: flex;
  }

  .doc-thumb {
    min-height: 138px;
  }

  .editor-actions .button,
  .pdf-actions .button {
    padding: 0 12px;
  }

  .editor-center-actions {
    order: 3;
  }

  .canvas-modebar {
    display: none;
  }

  .editor-context-bar {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 2px;
  }

  .paper-canvas {
    height: calc(100vh - 236px);
  }

  .note-page {
    min-height: 620px;
    padding: 34px 22px;
  }

  .page-heading h2 {
    font-size: 24px;
  }

  .flow-board,
  .sticky-wall {
    grid-template-columns: 1fr;
  }

  .tool-button {
    flex-basis: 64px;
  }

  .tool-grid-actions {
    grid-template-columns: repeat(2, minmax(110px, 1fr));
  }

  .detail-modal {
    grid-template-columns: 1fr;
  }

  .detail-cover {
    min-height: 220px;
  }

  .pdf-canvas {
    padding: 12px;
  }

  .pdf-page-sheet {
    min-height: 720px;
    padding: 42px 24px;
  }

  .red-circle,
  .pdf-hand-note,
  .pdf-star,
  .pdf-side-note,
  .pdf-pen-stroke {
    display: none;
  }

  .pdf-mode-banner {
    align-items: start;
    flex-direction: column;
  }

  .toast {
    right: 16px;
    bottom: 16px;
  }

  .design-editor-top {
    padding: 10px;
  }

  .design-doc-title {
    gap: 8px;
  }

  .design-doc-title strong {
    max-width: 190px;
    font-size: 16px;
  }

  .design-icon-button {
    width: 40px;
    height: 40px;
  }

  .design-action-button {
    min-height: 40px;
    padding: 0 7px;
    font-size: 13px;
  }

  .design-page-control {
    width: 100%;
  }

  .design-page-control button,
  .design-page-control strong {
    flex: 1;
    min-width: 0;
    padding: 0 6px;
    font-size: 13px;
  }

  .design-annotation-toolbar {
    gap: 6px;
    min-height: 52px;
  }

  .design-tool {
    min-height: 40px;
    padding: 0 10px;
    font-size: 13px;
  }

  .design-tool svg {
    width: 20px;
    height: 20px;
  }

  .design-tool-popover,
  .design-color-popover {
    display: none;
  }

  .design-document-area {
    grid-template-rows: minmax(0, 1fr) 100px;
    padding: 0 8px;
  }

  .design-pdf-page {
    padding: 28px 18px;
  }

  .design-pdf-page h1,
  .design-pdf-page > p,
  .design-pdf-page .pdf-principle {
    width: auto;
    margin-left: 0;
  }

  .formula-board,
  .meeting-agenda {
    display: none;
  }

  .design-pdf-page .pdf-principle {
    padding-left: 44px;
  }

  .design-pdf-page .pdf-principle:nth-of-type(n + 3) {
    display: none;
  }

  .design-pdf-page .red-circle {
    left: 28px;
    top: 148px;
    width: calc(100% - 56px);
    height: 128px;
  }

  .design-pdf-page .pdf-hand-note,
  .pdf-arrow-note,
  .design-pdf-page .pdf-star {
    display: none;
  }

  .design-bottom-strip {
    grid-template-columns: 42px minmax(0, 1fr);
    min-height: 100px;
  }

  .thumb-grid-button {
    width: 40px;
    height: 72px;
  }

  .design-page-thumb {
    flex-basis: 56px;
  }

  .design-page-thumb span {
    height: 70px;
  }
}

@media (min-width: 621px) and (max-width: 900px) {
  .app-shell {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr);
  }

  .sidebar {
    position: sticky;
    top: 0;
    display: flex;
    height: 100vh;
    padding: 18px 10px;
  }

  .brand-lockup {
    justify-content: center;
  }

  .brand-lockup > div,
  .side-link span,
  .sidebar-card,
  .settings-link span {
    display: none;
  }

  .side-link {
    justify-content: center;
    min-height: 54px;
    padding: 0;
  }

  .side-link svg {
    width: 24px;
    height: 24px;
  }

  .settings-link {
    margin-top: auto;
  }

  .home-main,
  .settings-main {
    padding: 22px 24px 42px;
  }

  .mobile-brand {
    display: none;
  }

  .home-topbar {
    align-items: center;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .hero-search {
    order: 2;
    flex-basis: 100%;
  }

  .topbar-actions {
    align-items: center;
    flex-direction: row;
    margin-left: auto;
  }
}

/* ===== 手写画布编辑器 ===== */
.handwriting-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 100vh;
  height: 100vh;
  overflow: hidden;
  background: #ecebe6;
}

.hw-topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 22px;
  background: #fff;
  border-bottom: 1px solid #dfe3e8;
  box-shadow: 0 1px 8px rgb(0 0 0 / 0.05);
}

.hw-doc-title {
  display: grid;
  gap: 2px;
  min-width: 0;
  margin-right: auto;
  padding: 4px 8px;
  border-radius: 8px;
  cursor: text;
}

.hw-doc-title:hover {
  background: #f2f4f6;
}

.rename-input {
  width: 100%;
  margin: 14px 0 4px;
  padding: 12px 14px;
  font-size: 16px;
  color: #1f2429;
  background: #faf9f6;
  border: 1px solid var(--border, #e0e4e8);
  border-radius: 10px;
}

.rename-input:focus {
  outline: none;
  border-color: var(--paper-blue);
  box-shadow: 0 0 0 3px rgb(35 111 203 / 0.15);
}

.paper-options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.paper-opt {
  display: grid;
  gap: 6px;
  justify-items: center;
  padding: 8px;
  color: var(--text-secondary, #66707c);
  font-size: 13px;
  background: #faf9f6;
  border: 1px solid var(--border, #e0e4e8);
  border-radius: 10px;
}

.paper-opt.active {
  color: var(--paper-blue);
  border-color: var(--paper-blue);
  background: #f0f5fb;
}

.paper-prev {
  width: 100%;
  height: 48px;
  background: #fff;
  border: 1px solid #e3e6ea;
  border-radius: 6px;
}

.paper-prev.dot {
  background-image: radial-gradient(#c9ced4 1px, transparent 1.2px);
  background-size: 9px 9px;
}

.paper-prev.grid {
  background-image: linear-gradient(#e0e3e7 1px, transparent 1px), linear-gradient(90deg, #e0e3e7 1px, transparent 1px);
  background-size: 10px 10px;
}

.paper-prev.lined {
  background-image: linear-gradient(#e0e3e7 1px, transparent 1px);
  background-size: 100% 11px;
}

.folder-options {
  display: grid;
  gap: 8px;
  margin: 14px 0 4px;
  max-height: 200px;
  overflow-y: auto;
}

.folder-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  color: #3a4047;
  font-size: 14px;
  text-align: left;
  background: #faf9f6;
  border: 1px solid var(--border, #e0e4e8);
  border-radius: 10px;
}

.folder-opt svg {
  width: 18px;
  height: 18px;
}

.folder-opt.active {
  color: var(--paper-blue);
  border-color: var(--paper-blue);
  background: #f0f5fb;
}

.side-section {
  margin: 14px 8px 4px;
  color: var(--text-secondary, #98a0aa);
  font-size: 12px;
  letter-spacing: 0.04em;
}

.side-folder span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hw-doc-title strong {
  font-size: 17px;
  color: #1f2429;
}

.hw-doc-title span {
  font-size: 12px;
  color: #7a828c;
}

.hw-top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hw-pager {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  margin-right: 14px;
  background: #f4f5f6;
  border: 1px solid #e3e6ea;
  border-radius: 999px;
}

.hw-pager .icon-button.subtle[disabled] {
  opacity: 0.35;
  pointer-events: none;
}

.hw-pager .page-next svg {
  transform: rotate(180deg);
}

.hw-page-label {
  min-width: 86px;
  color: #4a5159;
  font-size: 13px;
  font-weight: 560;
  text-align: center;
}

.hw-hint {
  margin-right: 4px;
  color: #7a828c;
  font-size: 12px;
}

.button.ghost.mini {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 12px;
}

.button.ghost.mini svg {
  width: 18px;
  height: 18px;
}

.button.ghost.mini[disabled] {
  opacity: 0.4;
  pointer-events: none;
}

.hw-body {
  display: flex;
  min-height: 0;
}

.hw-thumbs {
  flex: 0 0 168px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 168px;
  padding: 14px 12px 24px;
  overflow-y: auto;
  background: #fff;
  border-right: 1px solid #e3e6ea;
}

.hw-thumb {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
  padding: 0;
  background: none;
  border: 0;
  cursor: pointer;
}

.hw-thumb-frame {
  display: block;
  overflow: hidden;
  background: #fff;
  border: 1px solid #d8dde2;
  border-radius: 4px;
  box-shadow: 0 1px 4px rgb(0 0 0 / 0.06);
}

.hw-thumb-frame.dot {
  background-image: radial-gradient(#dadfe4 1px, transparent 1.1px);
  background-size: 11px 11px;
}

.hw-thumb-frame.grid {
  background-image: linear-gradient(#e6e9ed 1px, transparent 1px),
    linear-gradient(90deg, #e6e9ed 1px, transparent 1px);
  background-size: 12px 12px;
}

.hw-thumb-frame.lined {
  background-image: linear-gradient(#e6e9ed 1px, transparent 1px);
  background-size: 100% 14px;
}

.hw-thumb.active .hw-thumb-frame {
  border-color: var(--paper-blue);
  box-shadow: 0 0 0 2px rgb(35 111 203 / 0.3);
}

.hw-thumb {
  cursor: grab;
}

.hw-thumb.dragging {
  opacity: 0.4;
}

.hw-thumb.drop-target .hw-thumb-frame {
  border-color: var(--teal, #2c8993);
  box-shadow: 0 0 0 2px rgb(44 137 147 / 0.4);
}

.hw-thumb-canvas {
  display: block;
}

.hw-thumb small {
  color: #7a828c;
  font-size: 11px;
}

.hw-thumb.active small {
  color: var(--paper-blue);
  font-weight: 600;
}

.hw-thumb-add {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 40px;
  color: #6b727a;
  background: #fafafa;
  border: 1px dashed #c4cad1;
  border-radius: 6px;
}

.hw-thumb-add svg {
  width: 18px;
  height: 18px;
}

.hw-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: #ecebe6;
}

.hw-sheet {
  position: relative;
  width: min(100%, 1100px);
  height: 100%;
  background: #fff;
  border: 1px solid #d8dde2;
  border-radius: 6px;
  box-shadow: 0 6px 22px rgb(0 0 0 / 0.1);
  overflow: hidden;
}

/* 纸纹现由画布绘制（随缩放变化），主画布不再用 CSS 背景 */

.hw-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
}

.hw-sel-bar {
  position: absolute;
  top: 16px;
  left: 50%;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid #dfe3e8;
  border-radius: 999px;
  box-shadow: 0 6px 20px rgb(0 0 0 / 0.16);
  transform: translateX(-50%);
}

.hw-sel-bar span {
  color: #4a5159;
  font-size: 13px;
}

.hw-sel-bar button {
  min-height: 30px;
  padding: 0 12px;
  color: var(--paper-blue);
  font-size: 13px;
  background: #f4f7fb;
  border: 1px solid #d8e1ee;
  border-radius: 8px;
}

.hw-sel-bar button.danger-text {
  color: var(--danger, #d43a32);
  background: #fdf1f0;
  border-color: #f3d3d0;
}

.hw-zoom {
  position: absolute;
  right: 22px;
  bottom: 138px;
  z-index: 55;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  background: rgb(255 255 255 / 0.96);
  border: 1px solid var(--border, #e0e4e8);
  border-radius: 999px;
  box-shadow: var(--shadow-lg, 0 8px 24px rgb(0 0 0 / 0.12));
}

.hw-zoom button {
  min-width: 34px;
  height: 32px;
  padding: 0 6px;
  color: #4a5159;
  font-size: 16px;
  background: transparent;
  border: 0;
  border-radius: 999px;
}

.hw-zoom button:hover {
  background: #f0f2f5;
}

.hw-zoom .hw-zoom-label {
  min-width: 52px;
  font-size: 13px;
  font-weight: 560;
}

.transcribe-modal textarea {
  width: 100%;
  margin-top: 12px;
  padding: 12px 14px;
  font: inherit;
  font-size: 15px;
  color: #1f2429;
  background: #faf9f6;
  border: 1px solid var(--border, #e0e4e8);
  border-radius: 10px;
  resize: vertical;
}

.transcribe-modal textarea:focus {
  outline: none;
  border-color: var(--paper-blue);
  box-shadow: 0 0 0 3px rgb(35 111 203 / 0.15);
}

.text-prop-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.text-prop-row > span {
  flex: 0 0 36px;
  color: var(--text-secondary, #66707c);
  font-size: 13px;
}

.text-prop-row .seg {
  display: flex;
  gap: 6px;
}

.text-prop-row .seg button {
  min-height: 32px;
  padding: 0 12px;
  color: var(--text-secondary, #66707c);
  background: #faf9f6;
  border: 1px solid var(--border, #e0e4e8);
  border-radius: 8px;
  font-size: 13px;
}

.text-prop-row .seg button.active {
  color: var(--paper-blue);
  background: #f0f5fb;
  border-color: var(--paper-blue);
}

/* ===== 新建流程（仿 Goodnotes）===== */
.create-wrap {
  position: relative;
}

.create-trigger.open {
  box-shadow: var(--focus-ring);
}

.create-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
}

.create-menu {
  position: absolute;
  z-index: 61;
  top: calc(100% + 10px);
  right: 0;
  width: 320px;
  padding: 12px;
  display: grid;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  animation: create-pop 0.16s ease;
}

@keyframes create-pop {
  from { opacity: 0; transform: translateY(-6px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.create-menu::before {
  content: "";
  position: absolute;
  top: -7px;
  right: 26px;
  width: 12px;
  height: 12px;
  background: #fff;
  border-left: 1px solid var(--border);
  border-top: 1px solid var(--border);
  transform: rotate(45deg);
}

.create-tiles {
  display: grid;
  gap: 10px;
}

.create-tiles.three { grid-template-columns: repeat(3, 1fr); }
.create-tiles.two { grid-template-columns: repeat(2, 1fr); }

.create-tile {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 16px 8px 12px;
  color: var(--ink-blue);
  font-size: 13px;
  font-weight: 600;
  background: #f6f8fb;
  border: 1px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.create-tiles.two .create-tile {
  grid-auto-flow: column;
  justify-items: start;
  align-items: center;
  padding: 12px 14px;
}

.create-tile:hover {
  background: #eef3fb;
  border-color: var(--paper-blue-light);
}

.create-tile:active { transform: scale(0.97); }

.create-tile svg {
  width: 24px;
  height: 24px;
  stroke: var(--paper-blue);
  fill: none;
  stroke-width: 1.8;
}

.create-tile .tile-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  padding: 1px 6px;
  font-size: 10px;
  font-style: normal;
  font-weight: 600;
  color: var(--success);
  background: rgb(90 154 110 / 0.14);
  border-radius: 999px;
}

.create-list {
  display: grid;
  gap: 2px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.create-list button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 40px;
  padding: 0 8px;
  color: var(--ink-blue);
  font-size: 14px;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.create-list button:hover { background: rgb(74 111 165 / 0.08); }

.create-list button svg {
  width: 20px;
  height: 20px;
  stroke: var(--text-secondary);
  fill: none;
  stroke-width: 1.7;
}

.create-list button .row-lock {
  margin-left: auto;
  display: inline-flex;
}

.create-list button .row-lock svg {
  width: 15px;
  height: 15px;
  stroke: var(--text-tertiary);
}

/* ===== 文稿封面（Goodnotes 风格书脊）===== */
.cover-thumb {
  position: relative;
  display: grid;
  place-items: center;
  padding: 0;
  overflow: hidden;
  background:
    linear-gradient(160deg, color-mix(in srgb, var(--cover) 88%, #fff 12%), var(--cover));
}

.cover-thumb .cover-spine {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 14%;
  background: rgb(0 0 0 / 0.16);
  box-shadow: inset -2px 0 4px rgb(0 0 0 / 0.18);
}

.cover-thumb b {
  position: relative;
  z-index: 1;
  max-width: 78%;
  margin-left: 8%;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  text-shadow: 0 1px 2px rgb(0 0 0 / 0.22);
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  display: -webkit-box;
  overflow: hidden;
}

.cover-thumb.dark b { color: #f2f4f7; }

/* ===== 新建笔记本面板 ===== */
.nb-backdrop {
  place-items: start center;
  padding-top: 4vh;
}

.nb-modal {
  width: min(1080px, 100%);
  max-height: calc(100dvh - 60px);
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #f3f4f6;
}

.nb-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 14px 18px;
  background: #f7f8fa;
  border-bottom: 1px solid var(--border);
}

.nb-bar strong {
  font-size: 17px;
  color: var(--ink-blue);
}

.nb-text-btn {
  justify-self: start;
  padding: 6px 6px;
  font-size: 16px;
  color: var(--paper-blue);
  background: transparent;
  border: 0;
  cursor: pointer;
}

.nb-text-btn.primary {
  justify-self: end;
  padding: 8px 20px;
  font-weight: 600;
  color: #fff;
  background: var(--paper-blue);
  border-radius: 999px;
}

.nb-text-btn.primary:hover { background: var(--paper-blue-dark); }

.nb-hero {
  display: grid;
  grid-template-columns: 200px 200px minmax(0, 1fr);
  gap: 18px;
  padding: 22px 22px 18px;
  background: #fff;
  border-bottom: 1px solid var(--border);
}

.nb-preview-col {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 8px;
  padding: 14px;
  background: #f7f8fa;
  border: 1px solid var(--border);
  border-radius: 14px;
}

.nb-preview-col.no-cover .nb-cover { opacity: 0.28; }

.nb-cap {
  justify-self: center;
  font-size: 13px;
  color: var(--text-tertiary);
}

.nb-preview-col small {
  font-size: 13px;
  color: var(--text-secondary);
}

.nb-preview-col small.active-cap {
  position: relative;
  color: var(--paper-blue);
  font-weight: 600;
}

.nb-preview-col small.active-cap::after {
  content: "";
  display: block;
  height: 2px;
  margin-top: 3px;
  background: var(--paper-blue);
  border-radius: 2px;
}

.nb-cover {
  position: relative;
  width: 116px;
  height: 152px;
  border-radius: 4px 9px 9px 4px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--cover) 88%, #fff 12%), var(--cover));
  box-shadow: 0 6px 16px rgb(29 43 58 / 0.18);
}

.nb-cover .cover-spine {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 13px;
  border-radius: 4px 0 0 4px;
  background: rgb(0 0 0 / 0.16);
}

.nb-paper-sheet {
  width: 116px;
  height: 152px;
  border: 1px solid #e0e3e7;
  border-radius: 6px;
  box-shadow: 0 6px 16px rgb(29 43 58 / 0.12);
}

.nb-paper-sheet.dot { background-image: radial-gradient(#c9ced4 1px, transparent 1.3px); background-size: 12px 12px; }
.nb-paper-sheet.grid { background-image: linear-gradient(#dfe3e7 1px, transparent 1px), linear-gradient(90deg, #dfe3e7 1px, transparent 1px); background-size: 12px 12px; }
.nb-paper-sheet.lined { background-image: linear-gradient(#dfe3e7 1px, transparent 1px); background-size: 100% 14px; }
.nb-paper-sheet.on-dark.dot { background-image: radial-gradient(rgb(255 255 255 / 0.28) 1px, transparent 1.3px); }
.nb-paper-sheet.on-dark.grid { background-image: linear-gradient(rgb(255 255 255 / 0.2) 1px, transparent 1px), linear-gradient(90deg, rgb(255 255 255 / 0.2) 1px, transparent 1px); }
.nb-paper-sheet.on-dark.lined { background-image: linear-gradient(rgb(255 255 255 / 0.2) 1px, transparent 1px); }

.nb-form {
  display: grid;
  align-content: start;
  gap: 2px;
  padding: 6px 8px;
  background: #f7f8fa;
  border: 1px solid var(--border);
  border-radius: 14px;
}

.nb-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 0 12px;
  border-bottom: 1px solid var(--border);
}

.nb-form .nb-field:last-child { border-bottom: 0; }

.nb-field > span {
  color: var(--ink-blue);
  font-size: 15px;
}

.nb-field input {
  flex: 1;
  min-width: 0;
  text-align: right;
  font-size: 15px;
  color: var(--ink-blue);
  background: transparent;
  border: 0;
  outline: none;
}

.nb-field input::placeholder { color: var(--text-tertiary); }

.nb-value {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 500;
}

.nb-value i { font-style: normal; color: var(--text-tertiary); }

.nb-row-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 12px;
  padding: 0;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.nb-row-btn > span { color: var(--ink-blue); font-size: 15px; }

.nb-subcap {
  margin: 8px 12px 2px;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
}

.nb-switch {
  width: 46px;
  height: 28px;
  padding: 3px;
  background: #cfd4da;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.18s;
}

.nb-switch i {
  display: block;
  width: 22px;
  height: 22px;
  background: #fff;
  border-radius: 999px;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.25);
  transition: transform 0.18s;
}

.nb-switch.on { background: var(--success); }
.nb-switch.on i { transform: translateX(18px); }

.nb-color-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.nb-dot {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--dot);
  border: 1px solid rgb(0 0 0 / 0.12);
  cursor: pointer;
  transition: transform 0.12s;
}

.nb-dot.active {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--paper-blue);
}

.nb-dot:active { transform: scale(0.9); }

.nb-templates {
  padding: 18px 22px 24px;
  overflow-y: auto;
}

.nb-tpl-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.nb-tpl-head h3 {
  margin: 0;
  font-size: 18px;
  color: var(--ink-blue);
}

.nb-group {
  margin: 16px 0 10px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-blue);
}

.nb-tpl-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
}

.nb-tpl {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 6px;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.nb-tpl-prev {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  background: #fff;
  border: 1px solid #e0e3e7;
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s, border-color 0.15s;
}

.nb-tpl-prev.dot { background-image: radial-gradient(#c9ced4 1px, transparent 1.3px); background-size: 10px 10px; }
.nb-tpl-prev.grid { background-image: linear-gradient(#dfe3e7 1px, transparent 1px), linear-gradient(90deg, #dfe3e7 1px, transparent 1px); background-size: 10px 10px; }
.nb-tpl-prev.lined { background-image: linear-gradient(#dfe3e7 1px, transparent 1px); background-size: 100% 12px; }
.nb-tpl-prev.on-dark.dot { background-image: radial-gradient(rgb(255 255 255 / 0.28) 1px, transparent 1.3px); }
.nb-tpl-prev.on-dark.grid { background-image: linear-gradient(rgb(255 255 255 / 0.2) 1px, transparent 1px), linear-gradient(90deg, rgb(255 255 255 / 0.2) 1px, transparent 1px); }
.nb-tpl-prev.on-dark.lined { background-image: linear-gradient(rgb(255 255 255 / 0.2) 1px, transparent 1px); }

.nb-tpl.active .nb-tpl-prev {
  border-color: var(--paper-blue);
  box-shadow: 0 0 0 2px var(--paper-blue);
}

.nb-check {
  position: absolute;
  left: 50%;
  bottom: -9px;
  transform: translateX(-50%);
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  background: var(--paper-blue);
  border: 2px solid #fff;
  border-radius: 999px;
}

.nb-check svg {
  width: 12px;
  height: 12px;
  stroke: #fff;
  fill: none;
  stroke-width: 2.6;
}

.nb-tpl strong {
  margin-top: 4px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.nb-tpl.active strong { color: var(--ink-blue); }

.nb-tpl-colors {
  display: inline-flex;
  gap: 6px;
}

.nb-tpl-colors .nb-dot {
  width: 13px;
  height: 13px;
}

.nb-tpl-colors .nb-dot.active {
  box-shadow: 0 0 0 1.5px #fff, 0 0 0 3px var(--paper-blue);
}

@media (max-width: 760px) {
  .nb-hero {
    grid-template-columns: 1fr 1fr;
  }
  .nb-form { grid-column: 1 / -1; }
  .nb-tpl-grid { grid-template-columns: repeat(3, 1fr); }
  .create-menu { width: min(320px, calc(100vw - 32px)); }
}

/* ============================================================
   Goodnotes 式编辑器（gn-*）：双行深蓝顶栏 + 青色二级工具栏 + 浮层
   ============================================================ */
.gn-shell {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
  background: #e7e6e1;
  --gn-blue: #3f72b8;
  --gn-blue-d: #335f9e;
  --gn-cyan: #2fc6ee;
  --gn-cyan-d: #18b6e6;
}

/* ---------- 顶栏 ---------- */
.gn-header {
  background: linear-gradient(180deg, var(--gn-blue), var(--gn-blue-d));
  color: #fff;
  box-shadow: 0 1px 0 rgb(0 0 0 / 0.08);
  user-select: none;
}

.gn-docbar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 42px;
  padding: 0 14px;
}

.gn-home {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  color: #fff;
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}
.gn-home:hover { background: rgb(255 255 255 / 0.16); }
.gn-home svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.gn-doctab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 240px;
  height: 30px;
  padding: 0 10px;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  background: rgb(255 255 255 / 0.12);
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}
.gn-doctab:hover { background: rgb(255 255 255 / 0.2); }
.gn-doctab-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gn-caret { display: inline-flex; opacity: 0.85; }
.gn-caret svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }

.gn-doctype {
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  color: rgb(255 255 255 / 0.92);
  background: rgb(255 255 255 / 0.16);
  border-radius: 6px;
}

.gn-save {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: rgb(255 255 255 / 0.82);
}
.gn-save svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

.gn-tooltab {
  position: absolute;
  left: 50%;
  bottom: -1px;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 5px 16px;
  font-size: 13px;
  font-weight: 600;
  color: #2c3a4c;
  background: #f4f6f8;
  border-radius: 10px 10px 0 0;
  box-shadow: 0 -1px 4px rgb(0 0 0 / 0.08);
}
.gn-tooltab i { font-style: normal; font-size: 11px; color: #9099a4; }

.gn-docbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.gn-collab {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 30px;
  padding: 0 8px;
  color: #fff;
  background: rgb(255 255 255 / 0.12);
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}
.gn-collab:hover { background: rgb(255 255 255 / 0.2); }
.gn-collab svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.gn-collab em svg { width: 13px; height: 13px; stroke-width: 2; }

/* ---------- 工具行 ---------- */
.gn-toolbar {
  display: flex;
  align-items: center;
  height: 50px;
  padding: 0 14px 6px;
  gap: 12px;
}
.gn-tool-left, .gn-tool-right { display: flex; align-items: center; gap: 4px; }
.gn-tool-right { margin-left: auto; }

.gn-util {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  color: #fff;
  background: transparent;
  border: 0;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.15s;
}
.gn-util:hover { background: rgb(255 255 255 / 0.16); }
.gn-util.on { background: rgb(255 255 255 / 0.22); }
.gn-util[disabled] { opacity: 0.38; pointer-events: none; }
.gn-util svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.gn-tools {
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 0 auto;
  padding: 3px;
  background: rgb(255 255 255 / 0.1);
  border-radius: 13px;
}
.gn-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 38px;
  color: #fff;
  background: transparent;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.12s;
}
.gn-tool:hover { background: rgb(255 255 255 / 0.16); }
.gn-tool:active { transform: scale(0.94); }
.gn-tool.active {
  color: #2f6fc0;
  background: #fff;
  box-shadow: 0 2px 6px rgb(0 0 0 / 0.16);
}
.gn-tool svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- 二级工具栏（青色条 + 白色胶囊） ---------- */
.gn-subbar {
  position: relative;
  display: flex;
  justify-content: center;
  height: 60px;
  background: linear-gradient(180deg, var(--gn-cyan), var(--gn-cyan-d));
}
.gn-subbar::after {
  content: "";
  position: absolute;
  right: 38px;
  top: 0;
  width: 30px;
  height: 100%;
  background: rgb(0 0 0 / 0.08);
}
.gn-subbar-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  margin-top: 8px;
  padding: 0 12px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 3px 12px rgb(0 0 0 / 0.18);
}
.gn-sep { width: 1px; height: 22px; background: #e3e6ea; }

.gn-pen-types, .gn-shape-types, .gn-thick-group, .gn-eraser-sizes, .gn-text-style, .gn-color-group { display: flex; align-items: center; gap: 4px; }

.gn-pentype {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  color: #4a5159;
  background: transparent;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.gn-pentype:hover { background: #f0f2f5; }
.gn-pentype.active { color: #1f2429; background: #eef1f5; box-shadow: inset 0 0 0 1px #dadfe5; }
.gn-pentype svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.gn-thick {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: transparent;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
}
.gn-thick:hover { background: #f0f2f5; }
.gn-thick.active { background: #e7eaee; box-shadow: inset 0 0 0 1px #d6dbe1; }
.gn-thick i { display: block; width: 22px; border-radius: 999px; background: #2c333b; }

.gn-color-dot {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--c);
  border: 2px solid #fff;
  border-radius: 999px;
  box-shadow: 0 0 0 1px #d3d8de;
  cursor: pointer;
}
.gn-color-dot.active { box-shadow: 0 0 0 2px #2f6fc0; }
.gn-color-dot.current { width: 30px; height: 30px; }
.gn-color-dot.current svg { width: 13px; height: 13px; fill: none; stroke: #fff; stroke-width: 2.4; }
.gn-color-dot.current.open { box-shadow: 0 0 0 2px #2f6fc0; }
.gn-color-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  color: #aab1ba;
  background: transparent;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}
.gn-color-add:hover { color: #6b727a; background: #f0f2f5; }
.gn-color-add svg, .gn-color-add.big svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.gn-color-add.big { width: 34px; height: 34px; }

.gn-mode-select, .gn-pill-select {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 34px;
  padding: 0 10px;
  color: #2c333b;
  font-size: 13px;
  font-weight: 600;
  background: #f3f5f7;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
}
.gn-mode-select:hover, .gn-pill-select:hover { background: #e9edf1; }
.gn-mode-select svg, .gn-pill-select svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.gn-mode-select svg:first-child { width: 18px; height: 18px; }

.gn-eraser-size {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: transparent;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
}
.gn-eraser-size:hover { background: #f0f2f5; }
.gn-eraser-size.active { background: #e0f4fb; box-shadow: inset 0 0 0 1.5px #4dc4e8; }
.gn-eraser-size i { display: block; border-radius: 999px; border: 1.5px solid #6b727a; }

.gn-text-style .gn-style-btn {
  width: 32px;
  height: 34px;
  color: #2c333b;
  font-size: 16px;
  background: transparent;
  border: 0;
  border-radius: 9px;
  cursor: pointer;
}
.gn-text-style .gn-style-btn:hover { background: #f0f2f5; }

.gn-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  color: #2c333b;
  font-size: 13px;
  font-weight: 600;
  background: #f3f5f7;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
}
.gn-pill-btn:hover { background: #e9edf1; }
.gn-pill-btn.active { color: #1573a8; background: #e0f4fb; }
.gn-pill-btn.danger { color: var(--danger); background: #fdf1f0; }
.gn-pill-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.gn-pill-hint { padding: 0 6px; color: #7a828c; font-size: 12.5px; display: inline-flex; align-items: center; gap: 6px; }
.gn-pill-hint svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.6; }

/* ---------- 浮层（颜色 / 素材） ---------- */
.gn-popover {
  position: absolute;
  top: 56px;
  z-index: 70;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 16px 44px rgb(0 0 0 / 0.22), 0 0 0 1px rgb(0 0 0 / 0.04);
  animation: gnPop 0.16s ease;
}
@keyframes gnPop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
.gn-popover::before {
  content: "";
  position: absolute;
  top: -7px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 3px;
}

.gn-color-pop { left: 50%; transform: translateX(-50%); width: 320px; padding: 16px 18px 18px; }
.gn-pop-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.gn-pop-head.center { justify-content: center; position: relative; }
.gn-pop-head strong { flex: 1; text-align: center; font-size: 15px; color: #1f2429; }
.gn-pop-icon { width: 28px; height: 28px; color: #2f6fc0; background: transparent; border: 0; border-radius: 8px; cursor: pointer; }
.gn-pop-icon.right { position: absolute; right: 0; color: #6b727a; }
.gn-pop-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.gn-pop-edit { color: #2f6fc0; font-size: 14px; background: transparent; border: 0; cursor: pointer; }

.gn-pop-tabs { display: flex; gap: 4px; padding: 3px; margin-bottom: 14px; background: #eef0f3; border-radius: 10px; }
.gn-pop-tabs button { flex: 1; height: 30px; color: #6b727a; font-size: 13px; font-weight: 600; background: transparent; border: 0; border-radius: 8px; cursor: pointer; }
.gn-pop-tabs button.active { color: #1f2429; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / 0.12); }

.gn-pop-body { display: grid; gap: 14px; }
.gn-swatch-row { display: flex; justify-content: space-between; align-items: center; }
.gn-swatch-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 12px; }
.gn-swatch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--c);
  border: 0;
  border-radius: 999px;
  box-shadow: 0 0 0 1px rgb(0 0 0 / 0.08);
  cursor: pointer;
  transition: transform 0.12s;
}
.gn-swatch:hover { transform: scale(1.12); }
.gn-swatch.active { box-shadow: 0 0 0 2px #fff, 0 0 0 4px #2f6fc0; }
.gn-swatch svg { width: 14px; height: 14px; fill: none; stroke: #fff; stroke-width: 2.6; }
.gn-swatch[style*="FFFFFF"] svg, .gn-swatch[style*="ffffff"] svg { stroke: #2c333b; }
.gn-custom-color { display: grid; gap: 14px; }
.gn-color-input { display: flex; align-items: center; justify-content: space-between; font-size: 13px; color: #4a5159; }
.gn-color-input input { width: 48px; height: 32px; border: 1px solid #dadfe5; border-radius: 8px; background: none; cursor: pointer; }

/* 素材面板 */
.gn-sticker-pop { left: 50%; transform: translateX(-50%); width: 360px; padding: 16px 18px 14px; }
.gn-seg2 { display: flex; gap: 4px; padding: 3px; margin-bottom: 12px; background: #eef0f3; border-radius: 10px; }
.gn-seg2 button { flex: 1; height: 32px; color: #6b727a; font-size: 14px; font-weight: 600; background: transparent; border: 0; border-radius: 8px; cursor: pointer; }
.gn-seg2 button.active { color: #1f2429; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / 0.12); }
.gn-sticker-packhead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.gn-sticker-packhead span { font-size: 14px; font-weight: 600; color: #3a4047; }
.gn-sticker-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.gn-sticker-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 0.92;
  font-size: 40px;
  line-height: 1;
  background: #f6f7f9;
  border: 1px solid #eceef1;
  border-radius: 14px;
  cursor: pointer;
  transition: transform 0.12s, background 0.15s;
}
.gn-sticker-cell:hover { background: #eef1f4; transform: translateY(-2px); }
.gn-sticker-cell:active { transform: scale(0.94); }
.gn-sticker-cats { display: flex; gap: 6px; margin-top: 12px; padding-top: 12px; border-top: 1px solid #eceef1; }
.gn-sticker-cats button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  font-size: 18px;
  color: #6b727a;
  background: #f3f5f7;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}
.gn-sticker-cats button.active { background: #2f6fc0; box-shadow: 0 2px 6px rgb(47 111 192 / 0.4); }
.gn-sticker-cats button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; }

/* ---------- 主体 ---------- */
.gn-body { display: flex; min-height: 0; }
.gn-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  justify-content: center;
  padding-top: 16px;
  overflow: hidden;
  background: #e7e6e1;
}
.gn-shell .hw-canvas {
  position: relative;
  inset: auto;
  width: min(820px, 92%);
  height: 100%;
  background: #fff;
  border-radius: 6px 6px 0 0;
  box-shadow: 0 8px 30px rgb(0 0 0 / 0.14);
  cursor: crosshair;
  touch-action: none;
}
.gn-shell[data-tool="hand"] .hw-canvas { cursor: grab; }
.gn-shell[data-tool="lasso"] .hw-canvas { cursor: cell; }
.gn-shell[data-tool="text"] .hw-canvas { cursor: text; }
.gn-shell[data-tool="sticker"] .hw-canvas { cursor: copy; }

/* 缩略图栏头部 + 收起 */
.gn-shell .hw-thumbs { flex: 0 0 176px; width: 176px; padding: 0; gap: 0; }
.hw-thumbs-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  font-size: 12px;
  font-weight: 600;
  color: #7a828c;
  background: #fff;
  border-bottom: 1px solid #eceef1;
}
.hw-thumbs-collapse, .hw-thumbs-stub {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  color: #6b727a;
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}
.hw-thumbs-collapse:hover { background: #f0f2f5; }
.hw-thumbs-collapse svg, .hw-thumbs-stub svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.hw-thumbs-list { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 16px 18px 28px; overflow-y: auto; }
.gn-shell .hw-thumb-add { gap: 6px; font-size: 12.5px; }
.gn-shell .hw-thumb-add span { font-weight: 500; }
.hw-thumbs-stub {
  flex: 0 0 48px;
  width: 48px;
  align-self: stretch;
  height: auto;
  border-radius: 0;
  background: #fff;
  border-right: 1px solid #e3e6ea;
}

/* ---------- 底部控制条 ---------- */
.gn-bottombar {
  position: absolute;
  left: 50%;
  bottom: 18px;
  z-index: 55;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 5px 8px;
  background: rgb(255 255 255 / 0.94);
  backdrop-filter: blur(8px);
  border: 1px solid #e3e6ea;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.14);
  opacity: 0.85;
  transition: opacity 0.15s;
}
.gn-bottombar:hover { opacity: 1; }
.gn-bottombar button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 30px;
  padding: 0 6px;
  color: #4a5159;
  font-size: 15px;
  background: transparent;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}
.gn-bottombar button:hover { background: #f0f2f5; }
.gn-bottombar button[disabled] { opacity: 0.35; pointer-events: none; }
.gn-bottombar button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.gn-bottombar .gn-next svg { transform: rotate(180deg); }
.gn-page-label { font-size: 13px; font-weight: 600; min-width: 48px; }
.gn-zoom-label { min-width: 50px; font-size: 13px; font-weight: 600; }
.gn-bottom-sep { width: 1px; height: 18px; margin: 0 6px; background: #e0e4e8; }

/* ---------- 响应式：窄屏把顶栏工具压缩 ---------- */
@media (max-width: 1024px) {
  .gn-shell .hw-thumbs { flex-basis: 150px; width: 150px; }
}
@media (max-width: 820px) {
  .gn-tool { width: 36px; height: 36px; }
  .gn-tool svg { width: 20px; height: 20px; }
  .gn-tool-left .gn-util:nth-child(n+3) { display: none; }
  .gn-subbar-pill { max-width: calc(100vw - 24px); overflow-x: auto; }
  .gn-shell .hw-canvas { width: 96%; }
}
@media (max-width: 560px) {
  .gn-doctype, .gn-save, .gn-tooltab { display: none; }
  .gn-tools { gap: 0; }
  .gn-tool { width: 32px; }
  .gn-shell .hw-thumbs { display: none; }
  .gn-color-pop, .gn-sticker-pop { width: min(340px, calc(100vw - 20px)); }
}
