:root {
  color-scheme: light;
  --ink: #17191c;
  --muted: #72777e;
  --line: #dfe2e5;
  --panel: #ffffff;
  --workspace: #eceeef;
  --dark: #111315;
  --accent: #f4c95d;
  --accent-strong: #e8b92e;
  --focus: #2f6fed;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-width: 320px; height: 100%; overflow: hidden; background: var(--workspace); color: var(--ink); }
button, select, input { font: inherit; }
button { color: inherit; }
button:focus-visible, select:focus-visible, .crop-frame:focus-visible { outline: 3px solid color-mix(in srgb, var(--focus) 55%, transparent); outline-offset: 2px; }
.app-shell { display: grid; grid-template-rows: 64px minmax(0, 1fr); height: 100dvh; }
.topbar { display: grid; grid-template-columns: 230px minmax(0, 1fr) auto; align-items: center; gap: 20px; padding: 0 20px; color: #f8f8f6; background: var(--dark); border-bottom: 1px solid #292c30; }
.brand { display: flex; align-items: center; gap: 11px; font-size: 18px; font-weight: 750; letter-spacing: -.02em; }
.brand-mark { width: 25px; height: 25px; position: relative; border: 2px solid var(--accent); border-right: 0; border-top: 0; border-radius: 2px; transform: rotate(90deg); }
.brand-mark::after { content: ""; position: absolute; width: 14px; height: 14px; right: -8px; bottom: -8px; border: 2px solid var(--accent); border-left: 0; border-bottom: 0; }
.document-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #c9cdd1; font-size: 14px; text-align: center; }
.top-actions { display: flex; gap: 9px; }
.button { min-height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 7px; padding: 0 14px; font-size: 14px; font-weight: 650; cursor: pointer; transition: background .15s, border-color .15s, transform .15s; }
.button:active { transform: translateY(1px); }
.button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.button.secondary { color: #f5f5f3; background: #25282c; border-color: #393d42; }
.button.secondary:hover { background: #30343a; }
.button.primary { color: #171717; background: var(--accent); }
.button.primary:hover { background: #ffd66c; }
.button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.workspace { display: grid; grid-template-columns: 220px minmax(320px, 1fr) 262px; min-height: 0; }
.sidebar, .inspector { background: var(--panel); min-height: 0; z-index: 2; }
.sidebar { display: grid; grid-template-rows: 52px minmax(0, 1fr); border-right: 1px solid var(--line); }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 0 18px; border-bottom: 1px solid var(--line); font-size: 14px; font-weight: 700; }
.page-count { min-width: 28px; padding: 3px 7px; border-radius: 20px; background: #eff1f2; color: var(--muted); font-size: 12px; text-align: center; }
.thumbnail-list { overflow-y: auto; padding: 14px 14px 28px; scrollbar-width: thin; }
.thumbnail { width: 100%; padding: 7px; margin: 0 0 10px; display: grid; grid-template-columns: 1fr; gap: 7px; background: transparent; border: 1px solid transparent; border-radius: 7px; cursor: pointer; }
.thumbnail:hover { background: #f5f6f6; }
.thumbnail.active { background: #fff9e8; border-color: #e4bd4e; }
.thumb-paper { min-height: 148px; display: grid; place-items: center; overflow: hidden; position: relative; background: #f1f2f3; border: 1px solid #d6dadd; border-radius: 2px; box-shadow: 0 2px 5px rgba(20, 22, 24, .08); }
.thumb-paper canvas { display: block; max-width: 100%; height: auto; }
.thumb-override { position: absolute; right: 5px; top: 5px; min-width: 22px; height: 22px; display: none; place-items: center; padding: 0 5px; border-radius: 11px; background: #202328; color: #fff; font-size: 10px; font-weight: 800; }
.thumbnail.has-override .thumb-override { display: grid; }
.thumbnail.is-omitted .thumb-paper { opacity: .48; }
.thumbnail.is-omitted .thumb-override { background: #7b3030; }
.thumb-number { color: #6c7177; font-size: 12px; text-align: center; }
.loading-state { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 30px 4px; color: var(--muted); font-size: 13px; }
.spinner { width: 15px; height: 15px; border: 2px solid #d9dcdf; border-top-color: #454a50; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.stage-panel { display: grid; grid-template-rows: 52px minmax(0, 1fr); min-width: 0; min-height: 0; }
.stage-toolbar { display: flex; align-items: center; justify-content: space-between; padding: 0 14px; background: #fafafa; border-bottom: 1px solid var(--line); }
.tool-group, .zoom-controls { display: flex; align-items: center; gap: 7px; }
.tool-label { margin-left: 5px; color: #62676e; font-size: 13px; }
.icon-button, .fit-button { height: 32px; min-width: 32px; display: grid; place-items: center; border: 1px solid #d8dbde; border-radius: 6px; background: #fff; cursor: pointer; }
.icon-button:hover, .fit-button:hover { background: #f1f2f3; }
.icon-button:disabled { opacity: .36; cursor: not-allowed; }
.icon-button.active { background: var(--dark); border-color: var(--dark); color: white; }
.icon-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.fit-button { padding: 0 10px; font-size: 12px; }
#zoomLabel { width: 45px; color: #62676e; font-size: 12px; text-align: center; }
.toolbar-divider { width: 1px; height: 22px; margin: 0 3px; background: #d7dade; }
.canvas-scroll { position: relative; min-height: 0; overflow: auto; display: grid; place-items: center; padding: 42px; background-color: var(--workspace); background-image: radial-gradient(#d3d6d8 .65px, transparent .65px); background-size: 14px 14px; }
.page-stage { position: relative; flex: none; background: white; box-shadow: 0 9px 34px rgba(30, 35, 40, .18); user-select: none; touch-action: none; }
#pageCanvas { display: block; }
.crop-layer { position: absolute; inset: 0; cursor: default; }
.shade-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.crop-frame { position: absolute; border: 2px solid var(--accent); cursor: move; }
.crop-frame:not(.selected) { border-color: #f7e4a3; }
.crop-frame.selected { z-index: 2; }
.crop-frame.dragging { z-index: 10; }
.crop-frame::after { content: ""; position: absolute; inset: 0; box-shadow: 0 0 0 1px rgba(0,0,0,.18) inset; pointer-events: none; }
.frame-badge { position: absolute; left: 8px; top: 8px; min-width: 25px; height: 25px; display: grid; place-items: center; border-radius: 50%; background: var(--accent); border: 2px solid #222; color: #171717; font-size: 12px; font-weight: 800; pointer-events: none; }
.handle { position: absolute; width: 12px; height: 12px; background: var(--accent); border: 2px solid #222; border-radius: 50%; z-index: 2; }
.handle.nw { left: -7px; top: -7px; cursor: nwse-resize; }.handle.n { left: 50%; top: -7px; transform: translateX(-50%); cursor: ns-resize; }.handle.ne { right: -7px; top: -7px; cursor: nesw-resize; }
.handle.e { right: -7px; top: 50%; transform: translateY(-50%); cursor: ew-resize; }.handle.se { right: -7px; bottom: -7px; cursor: nwse-resize; }.handle.s { left: 50%; bottom: -7px; transform: translateX(-50%); cursor: ns-resize; }
.handle.sw { left: -7px; bottom: -7px; cursor: nesw-resize; }.handle.w { left: -7px; top: 50%; transform: translateY(-50%); cursor: ew-resize; }
.size-chip { position: absolute; left: 50%; top: -34px; transform: translateX(-50%); padding: 5px 8px; border-radius: 5px; background: #202328; color: white; font-size: 11px; white-space: nowrap; opacity: 0; transition: opacity .15s; pointer-events: none; }
.crop-frame:hover .size-chip, .crop-frame.dragging .size-chip { opacity: 1; }
.inspector { display: flex; flex-direction: column; overflow-y: auto; border-left: 1px solid var(--line); }
.inspector-section { padding: 20px; border-bottom: 1px solid var(--line); }
.inspector h2 { margin: 0 0 7px; font-size: 18px; letter-spacing: -.01em; }
.inspector h3 { margin: 0; font-size: 14px; }
.hint, .scope-note { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.field-label { display: block; margin-bottom: 8px; font-size: 13px; font-weight: 700; }
.scope-note { margin-top: 10px; }
.scope-switch { display: grid; grid-template-columns: 1fr 1fr; padding: 3px; border-radius: 8px; background: #eceeef; }
.scope-button { min-height: 34px; padding: 0 8px; border: 0; border-radius: 6px; background: transparent; color: #656b72; font-size: 13px; font-weight: 700; cursor: pointer; }
.scope-button.active { background: #fff; color: #1d2024; box-shadow: 0 1px 3px rgba(20,22,24,.14); }
.inherit-button { margin-top: 12px; padding: 0; border: 0; background: transparent; color: #856400; font-size: 12px; font-weight: 750; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.inherit-button.hidden { display: none; }
.section-title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.text-button { padding: 0; border: 0; background: transparent; color: #565c63; font-size: 12px; font-weight: 650; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.value-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.value-grid label { display: flex; align-items: center; justify-content: space-between; padding: 9px 10px; border-radius: 6px; background: #f4f5f5; color: #666c72; font-size: 12px; }
.value-grid span { color: #25282c; font-variant-numeric: tabular-nums; font-weight: 700; }
.frame-count { min-width: 25px; padding: 3px 7px; border-radius: 20px; background: #eff1f2; color: #666c73; font-size: 12px; font-weight: 800; text-align: center; }
.split-section .hint { margin-bottom: 13px; }
.frame-list { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 12px; }
.frame-pill { min-width: 36px; height: 32px; display: inline-grid; place-items: center; border: 1px solid #d5d8db; border-radius: 6px; background: #fff; color: #5e646b; font-size: 12px; font-weight: 750; cursor: pointer; }
.frame-pill.active { color: #171717; background: #fff7dc; border-color: #d6aa2e; }
.frame-pill-remove { min-width: 32px; color: #8a3a36; }
.frame-empty { width: 100%; padding: 10px 11px; border: 1px dashed #c8cbd0; border-radius: 6px; background: #f4f5f5; color: #6b7076; font-size: 12px; font-weight: 700; text-align: center; }
.split-actions { display: grid; gap: 7px; }
.action-button { min-height: 38px; display: flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid #d3d7da; border-radius: 7px; background: #fff; font-size: 13px; font-weight: 700; cursor: pointer; }
.action-button:hover { background: #f4f5f5; }
.action-button:disabled { opacity: .42; cursor: not-allowed; }
.action-button:disabled:hover { background: #fff; }
.action-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.accent-action { border-color: #d8b13a; background: #fff8df; }
.full-page-action { justify-content: space-between; padding: 0 10px 0 13px; background: #202328; border-color: #202328; color: white; }
.full-page-action:hover { background: #30343a; }
.full-page-action kbd { min-width: 42px; padding: 3px 6px; border: 1px solid #666b71; border-radius: 4px; background: #383c41; color: #e8eaec; font-family: inherit; font-size: 10px; }
.inspector-footer { margin-top: auto; padding: 18px 20px; }
.privacy-note { display: flex; gap: 10px; align-items: flex-start; color: #697078; }
.privacy-note svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; }
.privacy-note div { display: grid; gap: 3px; }
.privacy-note strong { color: #454a50; font-size: 12px; }.privacy-note span { font-size: 11px; }
.empty-state { text-align: center; padding: 48px; }
.empty-state.hidden, .page-stage.hidden { display: none; }
.empty-icon { width: 66px; height: 82px; margin: 0 auto 18px; border: 2px solid #aaaeb3; border-radius: 3px; position: relative; background: white; }
.empty-icon span { position: absolute; left: 12px; right: 12px; top: 20px; height: 2px; background: #d4d6d8; box-shadow: 0 11px #d4d6d8, 0 22px #d4d6d8; }
.empty-state h1 { font-size: 20px; }.empty-state p { color: var(--muted); }
.drop-overlay { position: fixed; inset: 14px; z-index: 20; display: none; place-items: center; border: 3px dashed var(--accent); border-radius: 14px; background: rgba(17, 19, 21, .92); color: white; }
.drop-overlay.visible { display: grid; }
.drop-overlay div { display: grid; gap: 7px; text-align: center; }.drop-overlay strong { font-size: 22px; }.drop-overlay span { color: #bec3c8; }
.toast-region { position: fixed; right: 18px; bottom: 18px; z-index: 30; display: grid; gap: 9px; }
.toast { padding: 12px 15px; border-radius: 8px; background: #202328; color: white; box-shadow: 0 8px 25px rgba(0,0,0,.22); font-size: 13px; animation: toast-in .22s ease-out; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@media (max-width: 960px) {
  .workspace { grid-template-columns: 168px minmax(320px, 1fr); }
  .inspector { position: fixed; right: 0; top: 64px; bottom: 0; width: 250px; transform: translateX(calc(100% - 5px)); transition: transform .2s; box-shadow: -8px 0 25px rgba(0,0,0,.12); }
  .inspector:hover, .inspector:focus-within { transform: translateX(0); }
  .topbar { grid-template-columns: 170px 1fr auto; }
  .document-title { display: none; }
  .tool-label { display: none; }
}
@media (max-width: 650px) {
  .app-shell { grid-template-rows: auto minmax(0, 1fr); }
  .topbar { grid-template-columns: 1fr auto; padding: 10px 12px; gap: 10px; }
  .brand { font-size: 16px; }.brand-mark { width: 22px; height: 22px; }
  .top-actions .button { width: 40px; padding: 0; font-size: 0; }.top-actions .button svg { width: 19px; }
  .workspace { grid-template-columns: 1fr; }.sidebar { display: none; }
  .stage-toolbar { padding: 0 8px; }.canvas-scroll { padding: 26px 18px; }
  .inspector { top: 59px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
