/* ================= Figma-class light theme tokens ================= */
:root {
  --fig-blue: #0d99ff;
  --fig-blue-hover: #0b87e0;
  --fig-brand: #18a0fb;
  --bg-canvas: #e5e5e5;
  --bg-panel: #ffffff;
  --bg-hover: #f0f0f0;
  --bg-active-row: #e5f4ff;      /* hmm: keep close to figma tint */
  --border: #e6e6e6;
  --border-strong: #d9d9d9;
  --text-primary: #333333;
  --text-secondary: #888888;
  --text-tertiary: #b3b3b3;
  --icon: #333333;
  --danger: #f24822;
  --guide-pink: #f24822;
  --selection-outline: #0d99ff;
  --hover-outline: #0d99ff;
  --focus-ring: 0 0 0 2px #ffffff, 0 0 0 4px var(--fig-blue);
  --font-ui: "Inter", "Inter Variable", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --toolbar-h: 48px;
  --panel-w: 240px;
  --radius-ui: 2px;
}
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font-ui);
  color: var(--text-primary);
  background: var(--bg-panel);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}
#app { height: 100%; display: flex; flex-direction: column; position: relative; }
#editor-chrome { display: flex; flex-direction: column; min-height: 0; flex: 1; }
#workspaceline { display: flex; flex: 1; min-height: 0; }

button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* ================= Top toolbar ================= */
#topbar {
  height: var(--toolbar-h);
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  gap: 8px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  z-index: 30;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}
#topbar::-webkit-scrollbar { display: none; }
.tb-cluster { flex: none; }
.tb-cluster { display: flex; align-items: center; gap: 2px; min-width: 0; }
.tb-center-wrap { flex: 1; display: flex; justify-content: center; }
.icon-btn {
  width: 32px; height: 32px;
  border-radius: 6px;
  border: none; background: transparent;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--icon); padding: 0;
  position: relative;
}
.icon-btn:hover { background: var(--bg-hover); }
.icon-btn:active { background: #e4e4e4; }
.icon-btn.active-tool { background: var(--fig-blue); color: #fff; }
.icon-btn.active-tool:hover { background: var(--fig-blue-hover); }
.icon-btn.disabled { opacity: .35; pointer-events: none; }
.icon-btn svg { width: 18px; height: 18px; display: block; }
.tool-sep { width: 1px; height: 20px; margin: 0 6px; background: var(--border); }
.shape-group-btn { width: auto; min-width: 34px; gap: 1px; padding: 0 7px; }
.shape-group-btn svg.wedge { width: 8px; opacity: .55; margin-left: 2px; }

.file-title {
  display: flex; align-items: center; gap: 8px; max-width: 30vw; overflow: hidden;
  font-size: 12px; line-height: 1; white-space: nowrap;
}
.doc-name { color: var(--text-primary); }
.zoom-chip {
  height: 28px; border: none; background: transparent; border-radius: 6px;
  padding: 0 8px; font-size: 12px; color: var(--text-primary);
  display: inline-flex; align-items: center; gap: 4px;
  font-variant-numeric: tabular-nums;
}
.zoom-chip:hover { background: var(--bg-hover); }
.zoom-chip svg { width: 10px; opacity: .5; }

/* ================= Panels ================= */
#left-panel, #right-panel {
  width: var(--panel-w);
  flex: none;
  background: var(--bg-panel);
  display: flex; flex-direction: column;
  min-height: 0;
  z-index: 20;
}
#left-panel { border-right: 1px solid var(--border); }
#right-panel { border-left: 1px solid var(--border); overflow-y: auto; overflow-x: hidden; }

.panel-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; min-height: 0; scrollbar-width: thin; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #cccccc; border-radius: 4px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #aaaaaa; background-clip: content-box; }

.section-label {
  font-size: 11px; font-weight: 600; letter-spacing: 0.01em;
  color: var(--text-primary);
  padding: 10px 16px 4px;
  display: flex; align-items: center; gap: 6px;
}

/* Pages */
.pages-head { display: flex; align-items: center; justify-content: space-between; padding-right: 10px; }
.add-page-btn { width: 22px; height: 22px; border: none; background: transparent; border-radius: 4px; color: var(--text-primary); display: inline-flex; align-items: center; justify-content: center; }
.add-page-btn:hover { background: var(--bg-hover); }
.page-row {
  display: flex; align-items: center; height: 28px; padding: 0 10px 0 24px;
  font-size: 12px; cursor: default; position: relative;
}
.page-row:hover { background: var(--bg-hover); }
.page-row.current { color: var(--fig-blue); }
.page-row:not(.current) { color: var(--text-primary); }

/* Layers */
.layer-row {
  display: flex; align-items: center; height: 26px; padding-left: 0;
  font-size: 11.5px; color: var(--text-primary);
  position: relative; cursor: default; white-space: nowrap; outline: none;
}
.layer-row:hover { background: var(--bg-hover); }
.layer-row.selected { background: var(--bg-active-row); }
.layer-row.selected .layer-name { color: #0d66c2; }
.layer-row.selected-hybrid .layer-icon svg,
.layer-row.selected .layer-icon svg { }
.layer-row.target-parent::after {
  content: ""; position: absolute; inset: 0 0 0 0; background: rgba(13,153,255,.14);
  pointer-events: none;
}
.drag-indicator { position: absolute; left: 8px; right: 8px; height: 2px; background: var(--fig-blue); border-radius: 1px; pointer-events: none; }
.drag-indicator.inside { top: 50%; height: calc(100% - 4px); left: 8px; right: 2px; background: rgba(13,153,255,.18); border-radius: 4px; }
.layer-caret {
  width: 16px; height: 100%; border: none; background: transparent; color: var(--text-primary);
  display: inline-flex; align-items: center; justify-content: center; flex: none; padding: 0;
}
.layer-caret svg { transition: transform 120ms ease; }
.layer-caret.open svg { transform: rotate(90deg); }
.layer-caret.leaf { visibility: hidden; }
.layer-icon { width: 18px; height: 18px; flex: none; display: inline-flex; align-items: center; justify-content: center; color: var(--text-primary); }
.layer-icon svg { width: 12px; height: 12px; }
.layer-name { overflow: hidden; text-overflow: ellipsis; flex: 1; padding: 0 6px; }
.layer-actions { display: none; align-items: center; margin-right: 10px; gap: 0; flex: none; }
.layer-row:hover .layer-actions, .layer-row.selected .layer-actions { display: inline-flex; }
.layer-tiny-btn { width: 20px; height: 22px; border: none; background: transparent; border-radius: 4px; color: var(--text-primary); display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.layer-tiny-btn:hover { background: #dedede; }
.layer-tiny-btn.locked-slot { display: inline-flex; }
.layer-row.hidden-layer > *:not(.layer-actions):not(.drag-indicator):not(.rename-input) { opacity: 1; color: var(--text-tertiary); }
.layer-row.hidden-layer .layer-icon svg { color: var(--text-tertiary); }
.rename-input {
  flex: 1; min-width: 0; font-size: 11.5px; padding: 2px 4px; margin: 0 8px 0 6px;
  border: 1px solid var(--fig-blue); border-radius: 2px; outline: none;
  box-shadow: var(--focus-ring); user-select: text; -webkit-user-select: text;
}

/* ================= Canvas region ================= */
#canvas-region { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; background: var(--bg-canvas); }
#ruler-strip { height: 0; }
#viewport {
  position: absolute; inset: 20px 0 0 20px; overflow: hidden; outline: none;
  touch-action: none; cursor: default;
}
#viewport.rulers-off { inset: 0 0 0 0; }
#scene-canvas, #overlay-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#overlay-canvas { pointer-events: none; }
#text-editor {
  position: absolute; display: none; transform-origin: 0 0;
  background: transparent; border: none; outline: none; resize: none;
  margin: 0; padding: 0; overflow: hidden;
  caret-color: #000000;
  user-select: text; -webkit-user-select: text;
  white-space: pre; line-height: normal;
}

/* Rulers */
.ruler { position: absolute; background: var(--bg-panel); z-index: 25; display: block; }
#ruler-top { top: 0; left: 20px; right: 0; height: 20px; border-bottom: 1px solid var(--border); }
#ruler-left { top: 20px; left: 0; bottom: 0; width: 20px; border-right: 1px solid var(--border); }
#ruler-corner { position: absolute; top: 0; left: 0; width: 20px; height: 20px; background: var(--bg-panel); border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); z-index: 26; }
.viewport-hidden-rulers #ruler-top, .viewport-hidden-rulers #ruler-left, .viewport-hidden-rulers #ruler-corner { display: none; }

/* Dimension / measurement chips drawn on overlay canvas, not DOM */

/* Hint card (first-run) */
.hint-card {
  position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%);
  background: #1e1e1e; color: #fff; border-radius: 8px; padding: 10px 12px;
  font-size: 11.5px; line-height: 1.65; z-index: 40; box-shadow: 0 6px 20px rgba(0,0,0,.28);
  display: flex; align-items: flex-start; gap: 14px; max-width: 92%;
}
.hint-card kbd {
  background: #333; border: 1px solid #444; border-bottom-color: #222; border-radius: 3px;
  padding: 1px 5px; font-family: inherit; font-size: 10.5px; margin-right: 2px;
}
.hint-card .hint-item { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.hint-col { display: flex; flex-direction: column; gap: 3px; }
.hint-close { border: none; background: #333; color: #ccc; width: 20px; height: 20px; border-radius: 4px; flex: none; }
.hint-close:hover { background: #444; color: #fff; }

/* Toast */
.toast {
  position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: #1e1e1e; color: #fff; border-radius: 6px; padding: 8px 14px;
  font-size: 12px; z-index: 60; animation: toast-in 160ms ease;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 6px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ================= Inspector ================= */
.insp-empty { padding: 16px; color: var(--text-tertiary); font-size: 11.5px; text-align: center; padding-top: 40px; line-height: 1.6; }
.align-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px 8px 16px;
}
.align-grid { display: grid; grid-template-columns: repeat(7, 24px); gap: 2px; }
.align-btn { width: 24px; height: 24px; border: none; background: transparent; border-radius: 4px; color: var(--icon); display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.align-btn svg { width: 14px; height: 14px; }
.align-btn:hover { background: var(--bg-hover); }
.align-btn.disabled { opacity: .3; pointer-events: none; }

.xform-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  padding: 2px 14px 12px 16px;
}
.field-cell { display: flex; align-items: center; border: 1px solid transparent; border-radius: var(--radius-ui); min-width: 0; }
.field-cell:focus-within { border-color: var(--fig-blue); }
.field-icon { width: 18px; flex: none; display: inline-flex; justify-content: center; color: var(--text-primary); cursor: ew-resize; touch-action: none; }
.field-icon svg { width: 13px; height: 13px; }
.field-input {
  flex: 1; min-width: 0; width: 100%; border: none; outline: none; background: transparent;
  font-size: 11.5px; padding: 5px 4px 5px 2px; color: var(--text-primary);
  font-variant-numeric: tabular-nums; user-select: text; -webkit-user-select: text;
}
.field-input.inactive-editor { color: var(--text-tertiary); }
.field-input.mixed { color: var(--text-tertiary); font-style: italic; }
.field-input.zw { width: 2ch; }
.xform-subgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.insp-section { border-bottom: 1px solid var(--border); padding-bottom: 10px; }
.insp-section.collapsed .insp-section-body { display: none; }
.insp-section-header {
  display: flex; align-items: center; height: 36px; padding: 0 8px 0 10px;
  gap: 2px; cursor: default;
}
.insp-section-title { font-size: 11px; font-weight: 600; flex: 1; display: flex; align-items: center; gap: 4px; min-width: 0; }
.collapse-caret { width: 20px; height: 20px; border: none; background: transparent; color: var(--icon); border-radius: 4px; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.collapse-caret svg { transition: transform 120ms ease; }
.insp-section.collapsed .collapse-caret svg { transform: rotate(-90deg); }
.header-right-tools { display: flex; align-items: center; gap: 2px; }
.mini-select {
  appearance: none; -webkit-appearance: none; border: 1px solid var(--border-strong); border-radius: 3px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='6'%3E%3Cpath d='M1 1l3 3 3-3' stroke='%23333' fill='none' stroke-width='1.2'/%3E%3C/svg%3E") no-repeat right 5px center;
  font-size: 10.5px; color: var(--text-primary); height: 22px; padding: 0 16px 0 6px;
}
.mini-num {
  width: 38px; height: 22px; border: 1px solid var(--border-strong); border-radius: 3px;
  font-size: 10.5px; text-align: left; padding: 0 4px 0 4px; outline: none;
  font-variant-numeric: tabular-nums; user-select: text; -webkit-user-select: text;
}
.mini-num:focus-within { border-color: var(--fig-blue); }
.plus-btn { width: 24px; height: 24px; border: none; background: transparent; border-radius: 4px; color: var(--text-primary); display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.plus-btn:hover { background: var(--bg-hover); }
.plus-btn.disabled { opacity: .3; pointer-events: none; }
.eye-trash-gap { width: 6px; }

.paint-row { display: flex; align-items: center; padding: 2px 8px 2px 10px; gap: 2px; border-radius: 3px; }
.paint-row.selected-paint { background: rgba(13,153,255,.1); }
.swatch {
  width: 16px; height: 16px; border-radius: 3px; border: 1px solid rgba(0,0,0,.12);
  flex: none; padding: 0; position: relative; overflow: hidden;
  background-image:
    linear-gradient(45deg, #ddd 25%, transparent 25%, transparent 75%, #ddd 75%),
    linear-gradient(45deg, #ddd 25%, transparent 25%, transparent 75%, #ddd 75%);
  background-size: 8px 8px; background-position: 0 0, 4px 4px; background-color: #fff;
}
.swatch > i { position: absolute; inset: 0; }
.stroke-inline { display: flex; align-items: center; padding: 2px 8px 2px 10px; gap: 6px; }
.num-w { width: 42px; }
.label-mini { font-size: 10.5px; color: var(--text-tertiary); text-align: center; }

.typo-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; padding: 0 14px 6px 16px; align-items: start; }
.typo-field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.typo-line { display: flex; align-items: center; border: 1px solid var(--border-strong); border-radius: 3px; }
.typo-line:focus-within { border-color: var(--fig-blue); }
.typo-suffix { font-size: 9px; color: var(--text-tertiary); padding-right: 4px; align-self: center; }
.font-select-row { display: flex; padding: 6px 14px 6px 16px; gap: 4px; }
.font-select {
  flex: 1; min-width: 0; appearance: none; -webkit-appearance: none;
  border: 1px solid var(--border-strong); border-radius: 3px; height: 24px;
  font-size: 11px; padding: 0 18px 0 7px; color: var(--text-primary); outline: none;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='6'%3E%3Cpath d='M1 1l3 3 3-3' stroke='%23333' fill='none' stroke-width='1.2'/%3E%3C/svg%3E") no-repeat right 6px center;
  text-overflow: ellipsis;
}
.text-align-row { display: flex; align-items: center; justify-content: space-between; padding: 2px 14px 8px 16px; }
.seg-group { display: flex; border: 1px solid var(--border-strong); border-radius: 4px; overflow: hidden; }
.seg-btn { width: 26px; height: 22px; border: none; background: transparent; color: var(--text-primary); display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.seg-btn + .seg-btn { border-left: 1px solid var(--border); }
.seg-btn:hover { background: var(--bg-hover); }
.seg-btn.on { background: var(--bg-active-row); color: #0d66c2; }
.seg-btn svg { width: 13px; height: 13px; }
.frame-checks { display: flex; gap: 14px; padding: 0 14px 10px 16px; font-size: 11px; color: var(--text-primary); }
.check-item { display: flex; align-items: center; gap: 6px; cursor: default; }
.check-item input[type="checkbox"] { accent-color: var(--fig-blue); width: 13px; height: 13px; margin: 0; }

.effect-row { display: flex; align-items: center; padding: 2px 8px 2px 10px; gap: 4px; }
.effect-grid { display: grid; grid-template-columns: 38px 38px 38px 1fr; gap: 4px; padding: 0 14px 6px 34px; }
.blend-opacity-row { display: flex; align-items: center; gap: 6px; padding: 2px 14px 8px 16px; }
.blend-select { flex: 1; min-width: 0; }
.op-input-wrap { display: flex; align-items: center; border: 1px solid var(--border-strong); border-radius: 3px; width: 52px; height: 22px; }
.op-input-wrap:focus-within { border-color: var(--fig-blue); }
.op-suffix { font-size: 9px; color: var(--text-tertiary); padding-right: 4px; }

.empty-section-note { font-size: 10.5px; color: var(--text-tertiary); padding: 0 16px 6px 16px; line-height: 1.5; }

/* ================= Menus / popovers ================= */
.menu-popover {
  position: fixed; z-index: 300; min-width: 210px;
  background: var(--bg-panel); border-radius: 8px;
  box-shadow: 0 5px 17px rgba(0,0,0,.15), 0 0 0 1px rgba(0,0,0,.05), 0 12px 34px rgba(0,0,0,.09);
  padding: 6px; font-size: 12px; color: var(--text-primary);
  max-height: 78vh; overflow-y: auto;
}
.menu-item {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  height: 30px; padding: 0 10px; border-radius: 5px; white-space: nowrap;
}
.menu-item:hover:not(.disabled) { background: var(--fig-blue); color: #fff !important; }
.menu-item:hover:not(.disabled) .menu-kbd { color: rgba(255,255,255,.65); }
.menu-item.disabled { color: var(--text-tertiary); pointer-events: none; }
.menu-sep { height: 1px; background: var(--border); margin: 6px 4px; }
.menu-kbd { font-size: 10.5px; color: var(--text-tertiary); letter-spacing: .04em; }
.menu-note { font-size: 10px; color: var(--text-tertiary); padding: 4px 10px 2px; }

.color-popover {
  position: fixed; z-index: 310; width: 232px;
  background: var(--bg-panel); border-radius: 10px;
  box-shadow: 0 5px 17px rgba(0,0,0,.2), 0 0 0 1px rgba(0,0,0,.06);
  padding: 12px; user-select: none;
}
.cp-mode-tabs { display: flex; gap: 2px; background: #f0f0f0; border-radius: 6px; padding: 2px; margin-bottom: 10px; }
.cp-tab { flex: 1; height: 22px; border: none; background: transparent; border-radius: 4px; font-size: 10.5px; color: var(--text-secondary); }
.cp-tab.on { background: #fff; color: var(--text-primary); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.cp-area { width: 100%; height: 116px; border-radius: 5px; position: relative; touch-action: none; cursor: crosshair; margin-bottom: 10px; }
.cp-area canvas { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 5px; }
.cp-knob { position: absolute; width: 10px; height: 10px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.25), inset 0 0 2px rgba(0,0,0,.3); transform: translate(-50%, -50%); pointer-events: none; }
.cp-slider { position: relative; height: 12px; border-radius: 6px; touch-action: none; margin-bottom: 6px; cursor: ew-resize; }
.cp-knob-sm { position: absolute; top: 50%; width: 12px; height: 12px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.25); transform: translate(-50%, -50%); pointer-events: none; }
.cp-hex-row { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.cp-preview-box { width: 34px; height: 24px; border-radius: 4px; border: 1px solid rgba(0,0,0,.1); position: relative; overflow: hidden;
  background-image: linear-gradient(45deg,#ddd 25%,transparent 25%,transparent 75%,#ddd 75%),linear-gradient(45deg,#ddd 25%,transparent 25%,transparent 75%,#ddd 75%);
  background-size: 8px 8px; background-position: 0 0,4px 4px; }
.cp-preview-box > i { position: absolute; inset: 0; }
.hexwrap { display: flex; align-items: center; border: 1px solid var(--border-strong); border-radius: 4px; flex: 1; height: 24px; padding: 0 0 0 6px; }
.hexwrap:focus-within { border-color: var(--fig-blue); }
.hashmark { color: var(--text-tertiary); font-size: 11px; }
.hex-input { border: none; outline: none; font-size: 11px; width: 100%; text-transform: uppercase; user-select: text; -webkit-user-select: text; }
.cp-swatch-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 10px; }
.cp-swatch { width: 100%; aspect-ratio: 1; border-radius: 4px; border: 1px solid rgba(0,0,0,.08); padding: 0; }
.cp-swatch:hover { transform: scale(1.12); }
.grad-angle-row { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.grad-stopbar { height: 14px; border-radius: 7px; margin: 10px 0 2px; position: relative; touch-action: none;
  border: 1px solid rgba(0,0,0,.12); }
.stop-knob { position: absolute; top: 50%; width: 12px; height: 16px; border-radius: 3px; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.3); transform: translate(-50%, -50%); }
.stop-knob.sel { border-color: var(--fig-blue); }

/* tooltip */
.ui-tooltip {
  position: fixed; z-index: 400; background: #1e1e1e; color: #fff; font-size: 11px;
  padding: 5px 8px; border-radius: 5px; pointer-events: none; white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0,0,0,.25);
}
.ui-tooltip .tip-kbd { opacity: .6; margin-left: 8px; }

/* context menu shares menu-popover style */
.ctx-menu .menu-item svg { width: 14px; height: 14px; opacity: .85; }

/* shortcuts modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 500; display: flex; align-items: center; justify-content: center; }
.modal {
  background: var(--bg-panel); border-radius: 12px; width: 560px; max-width: calc(100vw - 40px);
  max-height: calc(100vh - 80px); display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 8px; font-size: 14px; font-weight: 600; }
.modal-body { padding: 8px 20px 20px; overflow-y: auto; }
.sc-group-title { font-size: 11px; font-weight: 600; color: var(--text-secondary); margin: 14px 0 6px; text-transform: uppercase; letter-spacing: .04em; }
.sc-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.sc-table td { padding: 4px 0; border-bottom: 1px solid #f3f3f3; }
.sc-keys { text-align: right; white-space: nowrap; }
.modal kbd { background: #f0f0f0; border: 1px solid #e0e0e0; border-bottom-color: #d0d0d0; border-radius: 4px; padding: 1px 6px; font-family: inherit; font-size: 10.5px; margin-left: 4px; }
.modal-close { width: 28px; height: 28px; border: none; border-radius: 6px; background: transparent; color: var(--text-primary); }
.modal-close:hover { background: var(--bg-hover); }

/* narrow viewport (intentional compact adaptation of a desktop-first tool) */
.topbar-only-toggle { display: none; }
@media (max-width: 900px) {
  :root { --panel-w: 200px; }
}
@media (max-width: 720px) {
  :root { --panel-w: 260px; }
  #left-panel, #right-panel {
    position: absolute; top: var(--toolbar-h); bottom: 0; z-index: 45;
    box-shadow: 0 8px 30px rgba(0,0,0,.18); display: none;
  }
  #left-panel.drawer-open, #right-panel.drawer-open { display: flex; }
  #left-panel { left: 0; } #right-panel { right: 0; }
  .tb-drawer-toggle { display: inline-flex; }
  .file-title .doc-name { display: none; }
  .hint-card { display: none !important; }
  .zoom-chip, #topbar .tool-sep { display: none; }
}
