:root {
  /* Fluent accent — Chilean flag red (#D52B1E) */
  --accent: #d52b1e;
  --accent-hover: #b8241a;
  --accent-pressed: #991b13;
  --accent-light: #f7d4d0;
  --accent-lighter: #fdf3f2;
  --onedrive: #a01e14;
  --select: #d52b1e;
  --brand-primary: #0b6e88;
  --brand-primary-light: #dff4f3;
  --workspace-bg: #e8edf1;
  --workspace-panel: #f8fafb;
  --workspace-line: #d8e0e5;
  --suite-header: #ffffff;

  --warn: #a4262c;
  --warn-bg: #fde7e9;
  --highlight: #ffd23f;

  /* Fluent neutrals */
  --bg: #faf9f8;
  --surface: #ffffff;
  --neutral-lighter: #f3f2f1;
  --neutral-light: #edebe9;
  --neutral-quaternary: #e1dfdd;
  --neutral-tertiary: #d2d0ce;
  --ink: #323130;
  --ink-secondary: #605e5c;
  --ink-tertiary: #797775;

  /* Shape (Fluent is near-square) */
  --radius-card: 4px;
  --radius: 2px;

  /* Fluent depth */
  --depth-4: 0 1.6px 3.6px rgba(0, 0, 0, 0.13), 0 0.3px 0.9px rgba(0, 0, 0, 0.11);
  --depth-8: 0 3.2px 7.2px rgba(0, 0, 0, 0.13), 0 0.6px 1.8px rgba(0, 0, 0, 0.11);
  --depth-16: 0 6.4px 14.4px rgba(0, 0, 0, 0.13), 0 1.2px 3.6px rgba(0, 0, 0, 0.11);
  --depth-64: 0 25.6px 57.6px rgba(0, 0, 0, 0.22), 0 4.8px 14.4px rgba(0, 0, 0, 0.18);

  --ease: cubic-bezier(0.33, 0, 0.67, 1);
  --speed: 120ms;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--workspace-bg);
  color: var(--ink);
  font-family: "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, system-ui, "Helvetica Neue", Arial, sans-serif;
  font-size: 13px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-radius: var(--radius);
}

.icon {
  width: 18px;
  height: 18px;
  flex: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.app {
  display: flex;
  height: 100%;
  flex-direction: column;
  background: var(--workspace-bg);
  overflow: hidden;
}

/* ---------- Command bar (topbar) ---------- */
.topbar {
  display: flex;
  min-height: 59px;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  border-top: 0;
  border-bottom: 1px solid var(--workspace-line);
  background: var(--suite-header);
  box-shadow: 0 2px 9px rgba(30, 48, 60, 0.05);
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 200px;
  min-width: 172px;
  color: inherit;
  padding-right: 6px;
  text-decoration: none;
}

.brand-mark {
  width: 50px;
  height: 44px;
  flex: none;
  object-fit: contain;
}

.brand-text {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.brand-text strong {
  color: var(--brand-primary);
  font-family: "Arial Black", "Liberation Sans", "Arial Nova", "Segoe UI", Arial, sans-serif;
  font-size: 20px;
  font-style: normal;
  font-weight: 900;
  line-height: 1;
}

.brand-wordmark {
  display: inline-flex;
  align-items: baseline;
  letter-spacing: 0;
}

.brand-segment {
  --stripe-color: var(--brand-primary);
  display: inline-block;
  color: var(--stripe-color);
}

.brand-a {
  position: relative;
}

.brand-a::after {
  content: "";
  position: absolute;
  top: 52%;
  left: 50%;
  width: 0.46em;
  aspect-ratio: 1;
  background: #fff;
  clip-path: polygon(50% 0%, 61% 34%, 98% 35%, 68% 56%, 79% 92%, 50% 70%, 21% 92%, 32% 56%, 2% 35%, 39% 34%);
  transform: translate(-50%, -50%);
}

.brand-pdf {
  --stripe-color: var(--accent);
  margin-left: 0.04em;
}

.brand-suffix {
  margin-left: 0.52em;
  color: #53616b;
  font-family: "Segoe UI Variable Text", "Segoe UI", sans-serif;
  font-size: 0.62em;
  font-weight: 700;
  -webkit-text-fill-color: #53616b;
}

@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .brand-segment {
    background-image: repeating-linear-gradient(
      to bottom,
      var(--stripe-color) 0,
      var(--stripe-color) 0.105em,
      transparent 0.105em,
      transparent 0.16em
    );
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
  }
}

@media (forced-colors: active) {
  .brand-segment {
    background: none;
    color: CanvasText;
    -webkit-text-fill-color: CanvasText;
  }

  .brand-a::after {
    background: Canvas;
  }
}

.brand-text #docName {
  overflow: hidden;
  color: var(--ink-secondary);
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.suite-back {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--ink-secondary);
  font-size: 12.5px;
  font-weight: 650;
  padding: 0 10px;
  white-space: nowrap;
}

.suite-back:hover {
  border-color: var(--accent-light);
  background: var(--accent-lighter);
  color: var(--accent-pressed);
}

.control-group {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.toolbar-break {
  display: none;
}

.button,
.icon-button,
.tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--neutral-quaternary);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: background var(--speed) var(--ease), border-color var(--speed) var(--ease),
    color var(--speed) var(--ease);
}

.button {
  min-height: 36px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.button.primary:hover:not(:disabled) {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
  color: #fff;
}

.button.primary:active:not(:disabled) {
  background: var(--accent-pressed);
}

.icon-button {
  width: 36px;
  height: 36px;
  border-color: transparent;
  background: transparent;
  color: var(--ink-secondary);
}

.icon-button .icon {
  width: 18px;
  height: 18px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.divider {
  width: 1px;
  height: 24px;
  background: var(--neutral-light);
}

.spacer {
  flex: 1;
}

.counter,
.status {
  min-width: 54px;
  color: var(--ink-secondary);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.status {
  min-width: 170px;
  overflow: hidden;
  border: 1px solid var(--workspace-line);
  border-radius: 5px;
  background: var(--workspace-panel);
  color: #605e5c;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 10px;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Workspace shell ---------- */
.workspace {
  display: grid;
  min-height: 0;
  flex: 1;
  background: var(--workspace-bg);
  grid-template-columns: 212px minmax(0, 1fr) 48px;
  transition: grid-template-columns 180ms var(--ease);
}

.workspace.inspector-open {
  grid-template-columns: 212px minmax(0, 1fr) 324px;
}

.sidebar,
.inspector {
  min-height: 0;
  overflow: auto;
  border-right: 1px solid var(--workspace-line);
  background: #fff;
  box-shadow: none;
  padding: 14px 12px;
}

.inspector {
  border-right: 0;
  border-left: 1px solid var(--workspace-line);
  background: #fff;
  transition: background var(--speed) var(--ease), box-shadow var(--speed) var(--ease);
}

.workspace:not(.inspector-open) .inspector {
  overflow: hidden;
  padding: 0;
  background: var(--workspace-panel);
}

.inspector-content {
  display: block;
}

.workspace:not(.inspector-open) .inspector-content {
  display: none;
}

.inspector-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.inspector-header h2 {
  margin: 0;
}

.inspector-rail {
  display: none;
}

.workspace:not(.inspector-open) .inspector-rail {
  display: flex;
  width: 100%;
  height: 100%;
  min-height: 0;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 0;
  background: var(--workspace-panel);
  color: var(--accent);
  cursor: pointer;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transition: background var(--speed) var(--ease), color var(--speed) var(--ease);
}

.workspace:not(.inspector-open) .inspector-rail:hover {
  background: var(--accent-lighter);
  color: var(--accent-pressed);
}

.workspace:not(.inspector-open) .inspector-rail .icon {
  transform: rotate(90deg);
}

.workspace:not(.inspector-open) .inspector-rail span {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0;
}

.sidebar-heading {
  margin: 0 0 8px;
  padding: 0 4px;
  color: var(--ink-tertiary);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sidebar-heading:not(:first-child) {
  margin-top: 22px;
}

.tool {
  position: relative;
  width: 100%;
  min-height: 38px;
  margin-bottom: 3px;
  padding: 0 12px;
  justify-content: flex-start;
  border-color: transparent;
  font-weight: 600;
  color: var(--ink);
}

.tool .icon {
  color: var(--ink-secondary);
  transition: color var(--speed) var(--ease);
}

.tool:hover {
  background: #f6f6f6;
}

.tool.active {
  background: var(--accent-lighter);
  color: var(--accent-pressed);
}

.tool.active::before {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 0;
  width: 3px;
  border-radius: 0 2px 2px 0;
  background: var(--accent);
}

.tool.active .icon {
  color: var(--accent);
}

.button:hover:not(:disabled),
.icon-button:hover:not(:disabled) {
  background: var(--neutral-lighter);
}

.icon-button:hover:not(:disabled) {
  color: var(--ink);
}

.field {
  display: grid;
  gap: 5px;
  margin: 16px 0 4px;
  color: var(--ink-secondary);
  font-size: 12px;
  font-weight: 600;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--neutral-tertiary);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-weight: 400;
  transition: border-color var(--speed) var(--ease), box-shadow var(--speed) var(--ease);
}

.field input,
.field select {
  height: 34px;
  padding: 0 9px;
}

.field input[type="color"] {
  padding: 3px;
  cursor: pointer;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: inset 0 -2px 0 -1px var(--accent);
}

.field textarea {
  min-height: 132px;
  padding: 8px 9px;
  line-height: 1.5;
  resize: vertical;
}

.toggle-row {
  display: flex;
  gap: 6px;
  margin-top: 12px;
}

.button.toggle {
  width: 38px;
  min-width: 38px;
  padding: 0;
  font-size: 15px;
  color: var(--ink-secondary);
}

.button.toggle strong {
  font-weight: 800;
}

.button.toggle.active {
  border-color: var(--accent);
  background: var(--accent-lighter);
  color: var(--accent-pressed);
}

.button.danger-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--warn);
}

.button.danger-ghost:hover:not(:disabled) {
  background: var(--warn-bg);
  color: var(--warn);
}

/* ---------- Stage / canvas ---------- */
.stage-shell {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 30px;
  background: var(--workspace-bg);
}

.stage-shell.document-open {
  padding: 12px 30px 30px;
}

.stage-shell:not(.document-open) {
  display: grid;
  place-items: center;
}

.empty-state {
  display: grid;
  width: min(520px, calc(100% - 40px));
  min-height: 320px;
  height: auto;
  place-content: center;
  justify-items: center;
  gap: 10px;
  border: 1px solid var(--workspace-line);
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(30, 48, 60, 0.08);
  padding: 34px;
  text-align: center;
  color: var(--ink-secondary);
}

.empty-icon {
  display: inline-flex;
  margin-bottom: 4px;
  padding: 18px;
  border: 1px solid var(--accent-light);
  border-radius: 8px;
  background: var(--accent-lighter);
  color: var(--accent);
  box-shadow: none;
}

.empty-icon svg {
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.empty-state strong {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}

.empty-state span {
  max-width: 330px;
  font-size: 12.5px;
}

.stage {
  position: relative;
  margin: 0 auto;
  border: 1px solid rgba(0, 0, 0, 0.18);
  background: #fff;
  box-shadow: 0 12px 28px rgba(30, 48, 60, 0.2);
}

.stage-shell.document-open .stage {
  margin-top: 0;
}

.page-image {
  position: absolute;
  inset: 0;
  display: block;
  user-select: none;
}

.overlay {
  position: absolute;
  inset: 0;
  touch-action: none;
}

/* ---------- Overlay editing primitives ---------- */
.text-target,
.image-target,
.text-original-mask,
.image-original-mask,
.operation-box,
.drag-box {
  position: absolute;
  border: 1px solid rgba(213, 43, 30, 0.42);
  background: rgba(213, 43, 30, 0.08);
  cursor: text;
}

.image-target {
  padding: 0;
  border: 1.5px solid rgba(37, 99, 235, 0.42);
  border-radius: var(--radius);
  background: rgba(37, 99, 235, 0.05);
  cursor: grab;
  transition: background var(--speed) var(--ease), border-color var(--speed) var(--ease), box-shadow var(--speed) var(--ease);
}

.image-target:hover {
  border-color: var(--select);
  background: rgba(37, 99, 235, 0.14);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.20);
}

.image-target:active {
  cursor: grabbing;
}

.text-target {
  padding: 0;
  border-style: dashed;
  border-radius: var(--radius);
  border-color: rgba(213, 43, 30, 0.34);
  background: rgba(213, 43, 30, 0.05);
  color: transparent;
  cursor: grab;
  transition: background var(--speed) var(--ease), border-color var(--speed) var(--ease);
}

.text-target.flow {
  border-color: rgba(160, 30, 20, 0.42);
  background: rgba(160, 30, 20, 0.09);
}

.text-target.line {
  border-color: rgba(213, 43, 30, 0.36);
  background: rgba(213, 43, 30, 0.07);
}

.text-target.word {
  border-color: rgba(202, 80, 16, 0.42);
  background: rgba(255, 185, 0, 0.16);
}

.text-target.ocr {
  border-color: rgba(164, 38, 44, 0.44);
  background: rgba(164, 38, 44, 0.10);
}

.text-target.low-confidence {
  border-style: dotted;
}

.text-target:hover {
  border-color: var(--accent);
  background: rgba(213, 43, 30, 0.16);
}

.text-target:active {
  cursor: grabbing;
}

.text-target.selected {
  border-style: solid;
  border-color: var(--select);
  background: rgba(213, 43, 30, 0.12);
  box-shadow: 0 0 0 2px var(--select);
}

.text-original-mask {
  border: 0;
  cursor: default;
  pointer-events: none;
}

.image-original-mask {
  z-index: 8;
  border: 0;
  background: #fff;
  box-shadow: none;
  cursor: default;
  pointer-events: none;
}

.operation-box {
  padding: 0;
  overflow: visible;
  border-color: rgba(213, 43, 30, 0.55);
  background: rgba(255, 255, 255, 0.95);
  color: #111827;
  cursor: pointer;
  white-space: pre-wrap;
}

.operation-box.replace_text {
  border-color: transparent;
  box-shadow: none;
  cursor: grab;
}

.operation-box.replace_text:hover {
  outline: 1px dashed rgba(213, 43, 30, 0.6);
}

.operation-box.replace_text:active {
  cursor: grabbing;
}

.operation-box.move_image {
  z-index: 12;
  overflow: visible;
  border-color: rgba(37, 99, 235, 0.62);
  background: rgba(255, 255, 255, 0.02);
  cursor: grab;
}

.operation-box.move_image:hover {
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.18);
}

.operation-box.move_image:active {
  cursor: grabbing;
}

.operation-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
  user-select: none;
}

.operation-text {
  position: absolute;
  inset: 1px 2px;
  overflow: hidden;
  text-align: left;
  pointer-events: none;
}

.inline-editor {
  position: absolute;
  z-index: 20;
  min-width: 22px;
  min-height: 28px;
  padding: 4px 6px;
  overflow: auto;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  outline: 2px solid rgba(213, 43, 30, 0.25);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--depth-16);
  caret-color: var(--accent-pressed);
  resize: none;
  white-space: pre-wrap;
}

.operation-box.selected {
  border-color: var(--select);
  box-shadow: 0 0 0 2px var(--select);
}

.resize-handle {
  position: absolute;
  z-index: 35;
  width: 10px;
  height: 10px;
  border: 1.5px solid #fff;
  border-radius: 50%;
  background: var(--select);
  box-shadow: var(--depth-4);
}

.resize-handle.nw {
  top: -5px;
  left: -5px;
  cursor: nwse-resize;
}

.resize-handle.n {
  top: -5px;
  left: calc(50% - 5px);
  cursor: ns-resize;
}

.resize-handle.ne {
  top: -5px;
  right: -5px;
  cursor: nesw-resize;
}

.resize-handle.e {
  top: calc(50% - 5px);
  right: -5px;
  cursor: ew-resize;
}

.resize-handle.se {
  right: -5px;
  bottom: -5px;
  cursor: nwse-resize;
}

.resize-handle.s {
  bottom: -5px;
  left: calc(50% - 5px);
  cursor: ns-resize;
}

.resize-handle.sw {
  bottom: -5px;
  left: -5px;
  cursor: nesw-resize;
}

.resize-handle.w {
  top: calc(50% - 5px);
  left: -5px;
  cursor: ew-resize;
}

.operation-box.redact {
  background: #050505;
}

.operation-box.highlight {
  border-color: rgba(255, 185, 0, 0.7);
  background: rgba(255, 210, 63, 0.42);
}

.operation-box.rect {
  background: transparent;
}

.drag-box {
  border-color: var(--accent);
  background: rgba(213, 43, 30, 0.12);
}

.drag-box.highlight {
  border-color: rgba(255, 185, 0, 0.8);
  background: rgba(255, 210, 63, 0.4);
}

.drag-box.redact {
  border-color: #201f1e;
  background: rgba(32, 31, 30, 0.32);
}

.drag-box.rect {
  border-style: dashed;
  background: rgba(213, 43, 30, 0.07);
}

/* ---------- Page list ---------- */
.page-list {
  display: grid;
  gap: 4px;
}

.page-button {
  position: relative;
  width: 100%;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background var(--speed) var(--ease);
}

.page-button:hover {
  background: var(--neutral-lighter);
}

.page-button.active {
  background: var(--accent-lighter);
  color: var(--accent-pressed);
}

.page-button.active::before {
  content: "";
  position: absolute;
  top: 7px;
  bottom: 7px;
  left: 0;
  width: 3px;
  border-radius: 0 2px 2px 0;
  background: var(--accent);
}

/* ---------- Inspector ---------- */
.inspector h2,
.inspector h3 {
  margin: 0 0 12px;
  font-weight: 600;
}

.inspector h2 {
  font-size: 16px;
  color: var(--ink);
}

.inspector h3 {
  font-size: 13.5px;
}

.panel {
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid #edebe9;
  border-radius: 0;
  background: var(--surface);
  box-shadow: none;
}

.panel.muted,
.inspector > .muted {
  box-shadow: none;
}

.muted {
  color: var(--ink-secondary);
  font-size: 12.5px;
  line-height: 1.5;
}

.diagnostics {
  display: grid;
  gap: 9px;
}

.diagnostic-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  border: 1px solid var(--neutral-quaternary);
  border-radius: 0;
  padding: 0 10px;
  background: var(--neutral-lighter);
  color: var(--ink-secondary);
  font-size: 11px;
  font-weight: 600;
}

.badge.ok {
  border-color: var(--accent-light);
  background: var(--accent-lighter);
  color: var(--accent-pressed);
}

.badge.warn {
  border-color: #f3d6d8;
  background: var(--warn-bg);
  color: var(--warn);
}

.metric-row {
  display: flex;
  min-height: 26px;
  align-items: center;
  justify-content: space-between;
  color: var(--ink-secondary);
  font-size: 12px;
}

.metric-row strong {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.warning-list {
  display: grid;
  gap: 5px;
  padding: 9px 11px;
  border-radius: var(--radius);
  background: var(--warn-bg);
  color: var(--warn);
  font-size: 11.5px;
  line-height: 1.4;
}

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

.inspector-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.operation-list {
  display: grid;
  gap: 6px;
}

.operation-item {
  display: grid;
  gap: 3px;
  padding: 9px 11px;
  border: 1px solid var(--neutral-light);
  border-radius: 0;
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  transition: background var(--speed) var(--ease), border-color var(--speed) var(--ease);
}

.operation-item:hover {
  background: var(--neutral-lighter);
}

.operation-item.active {
  border-color: var(--accent);
  background: var(--accent-lighter);
}

.operation-item strong {
  font-size: 12px;
  font-weight: 600;
}

.operation-item span {
  overflow: hidden;
  color: var(--ink-secondary);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Scrollbars ---------- */
.sidebar,
.inspector,
.stage-shell {
  scrollbar-width: thin;
  scrollbar-color: var(--neutral-tertiary) transparent;
}

.sidebar::-webkit-scrollbar,
.inspector::-webkit-scrollbar,
.stage-shell::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

.sidebar::-webkit-scrollbar-thumb,
.inspector::-webkit-scrollbar-thumb,
.stage-shell::-webkit-scrollbar-thumb {
  border: 4px solid transparent;
  border-radius: 999px;
  background-clip: padding-box;
  background-color: var(--neutral-tertiary);
}

.sidebar::-webkit-scrollbar-thumb:hover,
.inspector::-webkit-scrollbar-thumb:hover,
.stage-shell::-webkit-scrollbar-thumb:hover {
  background-color: #b3b0ad;
}

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .workspace {
    grid-template-columns: 180px minmax(0, 1fr) 44px;
  }

  .workspace.inspector-open {
    grid-template-columns: 180px minmax(0, 1fr) min(300px, 38vw);
  }

  .workspace:not(.inspector-open) .inspector-rail span {
    font-size: 10px;
  }

  .brand {
    width: 50px;
    min-width: 50px;
    flex: none;
    gap: 0;
    padding-right: 0;
  }

  .brand-text {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}

@media (max-width: 760px) {
  .topbar {
    min-height: auto;
    flex-wrap: wrap;
    gap: 6px;
    padding: 7px 10px;
  }

  .topbar .brand,
  .topbar .button.primary,
  .topbar #exportButton,
  .topbar .spacer,
  .topbar .share-button {
    order: 1;
  }

  .topbar .brand {
    width: 48px;
    min-width: 48px;
  }

  .topbar .brand-mark {
    width: 48px;
    height: 43px;
  }

  .suite-back,
  .topbar > .divider,
  .topbar .status {
    display: none;
  }

  .topbar .button.primary {
    min-height: 36px;
    padding: 0 12px;
  }

  .topbar #exportButton {
    width: 36px;
    min-width: 36px;
    padding: 0;
    font-size: 0;
  }

  .topbar .spacer {
    display: block;
    min-width: 0;
  }

  .toolbar-break {
    display: block;
    order: 2;
    width: 100%;
    height: 0;
    flex-basis: 100%;
  }

  .topbar .page-controls,
  .topbar .zoom-controls {
    order: 3;
  }

  .topbar .page-controls {
    margin-left: auto;
  }

  .topbar .zoom-controls {
    margin-right: auto;
  }

  .topbar .counter {
    min-width: 48px;
  }

  .workspace,
  .workspace.inspector-open {
    position: relative;
    overflow: hidden;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 56px minmax(0, 1fr);
  }

  .sidebar {
    position: relative;
    z-index: 3;
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
    overflow-y: hidden;
    border-right: 0;
    border-bottom: 1px solid var(--workspace-line);
    padding: 7px 8px;
    scrollbar-width: thin;
  }

  .sidebar-heading,
  .sidebar .page-list {
    display: none;
  }

  .sidebar .tool {
    width: auto;
    min-width: max-content;
    min-height: 40px;
    flex: none;
    margin: 0;
    padding: 0 11px;
  }

  .sidebar .tool.active::before {
    top: auto;
    right: 9px;
    bottom: 0;
    left: 9px;
    width: auto;
    height: 3px;
    border-radius: 2px 2px 0 0;
  }

  .sidebar > .field {
    min-width: 126px;
    flex: 0 0 126px;
    margin: 0 4px;
  }

  .sidebar > .field > span {
    display: none;
  }

  .sidebar > .field select {
    height: 40px;
  }

  .stage-shell {
    grid-row: 2;
    padding: 16px 48px 16px 16px;
  }

  .stage-shell.document-open {
    padding: 8px 48px 16px 8px;
  }

  .empty-state {
    width: min(520px, 100%);
    min-height: 300px;
    padding: 26px 20px;
  }

  .inspector,
  .workspace:not(.inspector-open) .inspector {
    position: absolute;
    z-index: 6;
    top: 56px;
    right: 0;
    bottom: 0;
    width: 42px;
    min-height: 0;
    border-left: 1px solid var(--workspace-line);
    padding: 0;
  }

  .workspace.inspector-open .inspector {
    width: min(320px, calc(100vw - 24px));
    padding: 14px 12px;
    box-shadow: -10px 0 28px rgba(30, 48, 60, 0.13);
  }

  .workspace:not(.inspector-open) .inspector-rail span {
    font-size: 10px;
  }
}
