:root {
  --bg: #f3f5f9;
  --panel: #ffffff;
  --panel-2: #eef1f6;
  --line: #d7dde8;
  --text: #1b2330;
  --muted: #64748b;
  --accent: #3b82f6;
  --accent-2: #2563eb;
  --danger: #dc2626;
  --danger-border: rgba(220, 38, 38, .4);
  --ok: #16a34a;
  --hover: #e6eaf1;
  --hover-border: #c3ccda;
  --input-bg: #ffffff;
  --stage-bg: #e9edf3;
  --thumb-bg: #e9edf3;
  --region-active-bg: #dbeafe;
  --scroll-thumb: #c3ccda;
  --shadow: 0 6px 24px rgba(20, 30, 50, .12);
  --select: #111827;
  --drop-bg: rgba(255, 255, 255, .85);
  --toolbar-h: 52px;
  --status-h: 28px;
  --filterbar-h: 34px;
}

[data-theme="dark"] {
  --bg: #10131a;
  --panel: #171b24;
  --panel-2: #1e2430;
  --line: #2a3140;
  --text: #e7ecf3;
  --muted: #8b96a8;
  --accent: #4f8cff;
  --accent-2: #2f6fe0;
  --danger: #e5484d;
  --danger-border: rgba(229, 72, 77, .45);
  --ok: #37c07a;
  --hover: #262e3c;
  --hover-border: #3a4459;
  --input-bg: #0d1017;
  --stage-bg: #0b0e14;
  --thumb-bg: #0b0e14;
  --region-active-bg: #1b2740;
  --scroll-thumb: #2c3446;
  --shadow: 0 6px 30px rgba(0, 0, 0, .5);
  --select: #ffffff;
  --drop-bg: rgba(16, 19, 26, .82);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Be Vietnam Pro", "Noto Sans", system-ui, -apple-system, sans-serif;
  font-size: 13px;
  overflow: hidden;
}

button, select, input, textarea {
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
}

button, select {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 6px 10px;
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
button:hover, select:hover { background: var(--hover); border-color: var(--hover-border); }
button:active { transform: translateY(1px); }
button.primary { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }
button.primary:hover { background: var(--accent); }
button.danger { color: var(--danger); border-color: var(--danger-border); }
button:disabled { opacity: .5; cursor: not-allowed; }

input[type="text"], input[type="number"], select, textarea {
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 6px 8px;
  width: 100%;
}
textarea { resize: vertical; min-height: 64px; line-height: 1.45; }
input[type="range"] { width: 90px; accent-color: var(--accent); vertical-align: middle; }
input[type="color"] { padding: 0; height: 28px; width: 40px; background: none; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }

.toolbar {
  height: var(--toolbar-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 30;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
}
.toolbar > * { flex: 0 0 auto; }
.toolbar .brand { font-weight: 700; letter-spacing: .3px; white-space: nowrap; }
.toolbar .project-name {
  width: 140px; flex: 0 0 140px; padding: 5px 9px; background: var(--input-bg);
  border: 1px solid var(--line); border-radius: 7px;
}
select.compact { max-width: 110px; padding: 6px 6px; }
.menu-btn { font-size: 18px; line-height: 1; padding: 1px 11px 4px; }

.menu {
  position: fixed; z-index: 200; width: 280px; max-width: 92vw;
  max-height: min(82vh, calc(100vh - 70px)); overflow-y: auto; overscroll-behavior: contain;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow); padding: 6px; display: flex; flex-direction: column; gap: 1px;
}
.menu select, .menu input { max-width: 100%; min-width: 0; }
.menu select,
.menu input:not([type="checkbox"]):not([type="radio"]) { width: 100%; }
.menu input[type="checkbox"], .menu input[type="radio"] { width: auto; max-width: none; flex: 0 0 auto; margin: 0; }
.menu button svg, .toolbar button svg { width: 15px; height: 15px; vertical-align: -3px; margin-right: 5px; flex: 0 0 auto; }
.menu-btn svg { margin-right: 0; }
.menu-group-label svg { width: 13px; height: 13px; vertical-align: -2px; margin-right: 4px; }
.menu.hidden { display: none; }
.menu button {
  text-align: left; background: transparent; border: none; border-radius: 7px;
  padding: 8px 10px; font-size: 13px;
}
.menu button:hover { background: var(--hover); }
.menu button.primary { background: var(--accent-2); color: #fff; }
.menu-sep { height: 1px; background: var(--line); margin: 5px 2px; }
.kbd {
  float: right; margin-left: 12px; padding: 1px 6px; border-radius: 5px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--muted);
  font-size: 11px; font-variant-numeric: tabular-nums;
}
.menu button .kbd { color: var(--muted); }
.menu-hint { padding: 4px 10px 8px; color: var(--muted); font-size: 11px; line-height: 1.7; }
.menu-hint b { color: var(--text); font-weight: 600; }
.menu-group-label {
  padding: 7px 10px 3px; font-size: 10px; text-transform: uppercase; letter-spacing: .6px;
  color: var(--muted); font-weight: 600;
}
.menu-details { margin: 4px 2px 2px; }
.menu-details > summary {
  cursor: pointer; padding: 6px 10px; border-radius: 7px; color: var(--muted);
  text-transform: uppercase; font-size: 10px; letter-spacing: .6px; list-style: none;
}
.menu-details > summary::-webkit-details-marker { display: none; }
.menu-details > summary::before { content: "▸ "; }
.menu-details[open] > summary::before { content: "▾ "; }
.menu-details > summary:hover { background: var(--hover); }
.menu-inline { display: flex; flex-direction: column; gap: 5px; padding: 7px 10px; color: var(--muted); font-size: 11px; }
.menu-inline b { color: var(--text); }
.menu-inline input[type="range"] { width: 100%; }
.menu-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.menu-grid label { display: flex; flex-direction: column; gap: 3px; font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
.menu-grid input { padding: 4px 6px; font-size: 12px; }
.menu-note { color: var(--danger); }
.menu-row { display: flex; align-items: center; gap: 8px; padding: 7px 10px; margin: 0; color: var(--text); font-size: 12px; text-transform: none; cursor: pointer; }
.toolbar .group { display: flex; align-items: center; gap: 8px; position: relative; }
.toolbar .group::before {
  content: ""; position: absolute; left: -6px; top: 8px; bottom: 8px; width: 1px; background: var(--line);
}
.toolbar .group:first-of-type::before { display: none; }
.toolbar .group.right { margin-left: auto; }
.toolbar .auto-group {
  padding: 3px; border-radius: 9px; background: rgba(59, 130, 246, 0.14);
}
.toolbar .manual-group {
  padding: 3px 6px; border-radius: 9px; background: var(--panel-2);
}
.toolbar .inline { display: flex; align-items: center; gap: 6px; color: var(--muted); white-space: nowrap; }

.layout {
  height: calc(100vh - var(--toolbar-h) - var(--status-h));
  display: grid;
  grid-template-columns: 132px 1fr 320px;
}

aside.pages, aside.inspector {
  background: var(--panel);
  border-right: 1px solid var(--line);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
aside.inspector { border-right: none; border-left: 1px solid var(--line); }
.aside-title {
  height: var(--filterbar-h); box-sizing: border-box;
  display: flex; align-items: center;
  padding: 0 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: .6px;
  border-bottom: 1px solid var(--line);
}

.pages-list { flex: 1; min-height: 0; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.page-thumb {
  position: relative;
  flex: 0 0 auto;
  border: 2px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  background: var(--thumb-bg);
}
.page-thumb img { display: block; width: 100%; height: auto; }
.page-thumb.active { border-color: var(--accent); }
.page-thumb .num {
  position: absolute; top: 4px; left: 4px;
  background: rgba(0,0,0,.65); color: #fff;
  font-size: 10px; padding: 1px 5px; border-radius: 5px;
}
.page-thumb .num.empty { background: #6b7280; }
.page-thumb .num.none { background: #dc2626; }
.page-thumb .num.partial { background: #d97706; }
.page-thumb .num.done { background: #16a34a; }
.page-thumb .del {
  position: absolute; top: 3px; right: 3px;
  background: rgba(0,0,0,.6); color: #fff; border: none; padding: 1px 6px; border-radius: 5px;
  opacity: 0; font-size: 12px; line-height: 1.4;
}
.page-thumb:hover .del { opacity: 1; }
.page-thumb .restore {
  position: absolute; top: 3px; right: 26px;
  background: rgba(124,58,237,.85); color: #fff; border: none; padding: 1px 6px; border-radius: 5px;
  opacity: 0; font-size: 12px; line-height: 1.4;
}
.page-thumb:hover .restore { opacity: 1; }
.page-thumb .badge {
  position: absolute; bottom: 4px; right: 4px; color: #fff;
  background: var(--accent-2); font-size: 10px; padding: 1px 5px; border-radius: 5px;
}
.page-thumb .badge.ai {
  bottom: 4px; left: 4px; right: auto; background: #7c3aed; font-weight: 700;
}

.stage-wrap { position: relative; overflow: hidden; display: flex; flex-direction: column; background: var(--stage-bg); }
.panes { flex: 1; display: flex; overflow: hidden; min-height: 0; }
.pane { position: relative; flex: 1 1 0; min-width: 0; display: flex; overflow: hidden; }
.pane.hidden { display: none; }
.pane + .pane { border-left: 2px solid var(--line); }
.pane-label {
  position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,.6); color: #fff; font-size: 11px; padding: 2px 9px;
  border-radius: 6px; pointer-events: none; z-index: 6; letter-spacing: .3px;
  display: none;
}
.panes.comparing .pane-label { display: block; }
#resultCanvas { display: block; user-select: none; }
.stage-scroll { flex: 1; overflow: auto; display: flex; padding: 18px; }
.stage { position: relative; line-height: 0; margin: auto; box-shadow: var(--shadow); }
.stage img { display: block; user-select: none; max-width: none; }

.overlay { position: absolute; inset: 0; }
.overlay.hidden { display: none; }
.overlay.brushing { cursor: crosshair; }
.brush-layer { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 4; }

.brush-bar {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 20;
  display: flex; align-items: center; gap: 10px; padding: 6px 10px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow);
  white-space: nowrap;
}
.brush-bar.hidden { display: none; }
.brush-bar .brush-title { font-weight: 700; color: var(--accent-2); }
.brush-bar input[type="range"] { width: 110px; }
.brush-bar button { padding: 4px 10px; }

.box {
  position: absolute;
  border: 1.5px solid rgba(59,130,246,.9);
  background: rgba(59,130,246,.12);
  cursor: move;
  border-radius: 3px;
}
.box.text_free { border-color: rgba(217,119,6,.95); background: rgba(217,119,6,.14); }
.box.manual { border-color: rgba(22,163,74,.95); background: rgba(22,163,74,.14); }
.box.keep { border-color: rgba(120,120,132,.95); border-style: dashed; background: rgba(120,120,132,.10); }
.box.filled { background: rgba(255,255,255,0); }
.box.selected { border-color: var(--select); box-shadow: 0 0 0 2px rgba(59,130,246,.45); z-index: 5; }
.box .tag {
  position: absolute; top: -18px; left: -1px;
  font-size: 10px; background: rgba(0,0,0,.72); color: #fff;
  padding: 0 5px; border-radius: 4px 4px 0 0; white-space: nowrap;
  pointer-events: none;
  line-height: 16px;
}
.box.selected .tag { display: block; }
.box.keep .tag { display: block; }
.box .handle {
  position: absolute; width: 9px; height: 9px; background: #fff;
  border: 1px solid var(--accent); border-radius: 2px; display: none;
}
.box.selected .handle { display: block; }
.handle.nw { left: -5px; top: -5px; cursor: nwse-resize; }
.handle.ne { right: -5px; top: -5px; cursor: nesw-resize; }
.handle.sw { left: -5px; bottom: -5px; cursor: nesw-resize; }
.handle.se { right: -5px; bottom: -5px; cursor: nwse-resize; }
.handle.n { left: 50%; top: -5px; transform: translateX(-50%); cursor: ns-resize; }
.handle.s { left: 50%; bottom: -5px; transform: translateX(-50%); cursor: ns-resize; }
.handle.w { left: -5px; top: 50%; transform: translateY(-50%); cursor: ew-resize; }
.handle.e { right: -5px; top: 50%; transform: translateY(-50%); cursor: ew-resize; }
.handle.rot {
  left: 50%; top: -26px; transform: translateX(-50%);
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent); border: 2px solid #fff; cursor: grab;
}
.quad-handle { fill: #ffffff; stroke: var(--accent); }
.quad-poly.selected { fill: rgba(59, 130, 246, 0.22); }

.empty-hint {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; color: var(--muted);
  pointer-events: none; padding: 20px;
}
.empty-hint h2 { color: var(--text); font-weight: 600; margin: 0 0 8px; }
.empty-hint.hidden { display: none; }
.empty-hint .steps {
  text-align: left; display: inline-block; margin: 16px auto 0; padding-left: 22px;
  line-height: 1.95; color: var(--text); font-size: 12.5px;
}
.empty-hint .steps b { color: var(--accent-2); }

.zoombar {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px;
  padding: 6px 12px; border-top: 1px solid var(--line); background: var(--panel);
}
.zoombar .zone { display: flex; align-items: center; gap: 8px; }
.zoombar .zone.left { justify-self: start; }
.zoombar .zone.center { justify-self: center; }
.zoombar .zone.right { justify-self: end; }
.zoombar .inline { display: flex; align-items: center; gap: 6px; color: var(--muted); white-space: nowrap; cursor: pointer; }
.zoombar button { padding: 4px 10px; }
.zoombar .zoom-select { width: auto; min-width: 104px; padding: 4px 6px; }

.region-list { max-height: 34%; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 5px; border-bottom: 1px solid var(--line); }
.region-item {
  flex: 0 0 auto;
  padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; cursor: pointer;
  background: var(--panel-2); display: flex; flex-direction: column; gap: 2px;
}
.region-item:hover { border-color: var(--hover-border); }
.region-item.active { border-color: var(--accent); background: var(--region-active-bg); }
.region-item .src { color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.region-item .dst { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.region-item.keep .dst { color: var(--muted); font-style: italic; }

.global-style { border-bottom: 1px solid var(--line); }
.global-style > summary {
  cursor: pointer; padding: 9px 12px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; font-size: 11px; letter-spacing: .6px; list-style: none;
}
.global-style > summary::-webkit-details-marker { display: none; }
.global-style > summary::before { content: "▸ "; }
.global-style[open] > summary::before { content: "▾ "; }
.global-style #globalFields { max-height: 42vh; overflow-y: auto; padding: 10px 12px; }
.fields input:disabled, .fields select:disabled { opacity: .55; }
.custom-row { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.custom-row label { margin: 0; text-transform: none; color: var(--text); font-size: 12px; display: flex; align-items: center; gap: 6px; }
.custom-row button { padding: 3px 8px; font-size: 11px; }

.fields { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }.fields label { display: block; color: var(--muted); font-size: 11px; margin-bottom: 4px; text-transform: uppercase; letter-spacing: .4px; }
.fields .row { display: flex; gap: 8px; }
.fields .row > * { flex: 1; }
.fields .grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.fields .muted { color: var(--muted); }
.region-actions { display: flex; gap: 8px; margin-top: 4px; }

.inline-title { display: flex; align-items: center; justify-content: space-between; }
.inline-title .cls { font-size: 10px; color: var(--muted); }

.statusbar {
  height: var(--status-h); display: flex; align-items: center; gap: 12px;
  padding: 0 12px; background: var(--panel); border-top: 1px solid var(--line);
  color: var(--muted); font-size: 12px;
  flex-wrap: nowrap; overflow: hidden;
}
.statusbar #status {
  flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.filterbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: nowrap;
  height: var(--filterbar-h); padding: 0 12px; box-sizing: border-box;
  background: var(--panel); border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.filterbar-label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; flex: 0 0 auto; }
.filterbar .legend { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; }
.filterbar .legend-count { color: var(--text); font-weight: 600; }
.legend-item {
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  background: none; border: 1px solid transparent; border-radius: 6px;
  color: inherit; font: inherit; padding: 2px 6px; cursor: pointer;
}
.legend-item:hover { background: var(--panel-2); }
.legend-item.active { border-color: var(--accent); background: var(--panel-2); color: var(--text); font-weight: 600; }
.legend-item .dot { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.dot.empty { background: #6b7280; }
.dot.none { background: #dc2626; }
.dot.partial { background: #d97706; }
.dot.done { background: #16a34a; }
.dot.ai { background: #7c3aed; }
.legend-count { color: var(--muted); font-variant-numeric: tabular-nums; }
.legend-item.active .legend-count { color: inherit; }
.statusbar #pageInfo { margin-left: 14px; white-space: nowrap; flex: 0 0 auto; }
.queue-info { display: inline-flex; align-items: center; gap: 8px; color: var(--text); min-width: 0; flex: 0 1 auto; }
.queue-info.hidden { display: none; }
.queue-info #queueText { min-width: 0; max-width: 34vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue-info .qbar {
  width: 90px; height: 6px; border-radius: 4px; background: var(--panel-2); overflow: hidden; display: inline-block;
}
.queue-info .qbar > i { display: block; height: 100%; width: 0; background: var(--accent-2); transition: width .2s; }
.queue-info button { padding: 1px 8px; font-size: 11px; }
.queue-info .spinner { margin-right: 0; }
.statusbar .version { margin-left: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.menu-version { padding: 6px 10px; margin-top: 4px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }

.dropzone {
  position: fixed; inset: 0; display: none; align-items: center; justify-content: center;
  background: var(--drop-bg); border: 3px dashed var(--accent); z-index: 100;
}
.dropzone.active { display: flex; }
.dropzone-inner { font-size: 20px; font-weight: 600; color: var(--text); }

.modal {
  position: fixed; inset: 0; z-index: 120; display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, .45); padding: 20px;
}
.modal.hidden { display: none; }
.modal-box {
  width: min(620px, 100%); background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px;
}
.modal-title { font-weight: 700; font-size: 15px; }
.modal-box p { margin: 0; font-size: 12px; line-height: 1.5; }
.modal-box textarea { min-height: 160px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.modal-inline { color: var(--text); text-transform: none; font-size: 12px; }
.modal-key { display: flex; flex-direction: column; gap: 4px; }
.modal-key span { color: var(--muted); font-size: 11px; }
.modal-key input { width: 100%; }
.modal-status { min-height: 16px; font-size: 12px; color: var(--muted); white-space: pre-wrap; }
.glossary-rows { max-height: 42vh; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.glossary-row { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 6px; }
.glossary-row input { width: 100%; }
.glossary-row button { padding: 4px 9px; }
.gloss-paste { margin-top: 4px; }
.gloss-paste > summary { cursor: pointer; color: var(--muted); font-size: 12px; }
.gloss-paste textarea { min-height: 90px; margin-top: 6px; }
.help-body { max-height: 62vh; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.modal-box .steps { display: block; text-align: left; margin: 6px 0 10px; padding-left: 22px; line-height: 1.9; color: var(--text); font-size: 13px; }
.modal-box .steps b { color: var(--accent-2); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.tabs .tab {
  background: transparent; border: none; border-bottom: 2px solid transparent; border-radius: 0;
  padding: 7px 10px; color: var(--muted);
}
.tabs .tab.active { color: var(--text); border-bottom-color: var(--accent); }
.tab-pane { display: flex; flex-direction: column; gap: 10px; }
.tab-pane.hidden { display: none; }
.tm-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tm-controls .inline { display: flex; align-items: center; gap: 5px; color: var(--text); }
.tm-controls #tmSearch { flex: 1; min-width: 120px; }
.tm-list { max-height: 44vh; overflow-y: auto; display: flex; flex-direction: column; gap: 5px; }
.tm-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; }
.tm-row input { width: 100%; }
.modal-status.error { color: var(--danger); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }

.page-thumb .copy {
  position: absolute; bottom: 3px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,.6); color: #fff; border: none; padding: 1px 6px; border-radius: 5px;
  opacity: 0; font-size: 11px; line-height: 1.5;
}
.page-thumb:hover .copy { opacity: 1; }

.spinner {
  display: inline-block; width: 12px; height: 12px; border: 2px solid var(--line);
  border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; margin-right: 6px;
  vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 6px; border: 2px solid var(--panel); }
::-webkit-scrollbar-track { background: transparent; }

/* Responsive: ẩn bớt phần phụ để thanh trên/dưới gọn theo bề rộng */
@media (max-width: 1460px) {
  .toolbar .brand { display: none; }
}
@media (max-width: 1140px) {
  .filterbar .legend-item { font-size: 11px; padding: 2px 6px; }
}
@media (max-width: 980px) {
  .toolbar .project-name { width: 96px; flex: 0 0 96px; }
  select.compact { max-width: 96px; }
}
@media (max-width: 820px) {
  .toolbar .project-name { display: none; }
  .statusbar .version { display: none; }
}

/* Kiểu chữ nhanh (preset) */
.preset-row { margin-bottom: 6px; }
.preset-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.preset-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--panel); color: var(--text); border: 1px solid var(--line);
  border-radius: 6px; padding: 3px 7px; font-size: 12px; cursor: pointer;
}
.preset-chip:hover { border-color: var(--accent); }
.preset-chip.add { border-style: dashed; color: var(--muted); }
.preset-chip .preset-del {
  display: inline-flex; align-items: center; justify-content: center;
  width: 15px; height: 15px; border-radius: 50%; background: rgba(127,127,127,.25);
  font-size: 11px; line-height: 1;
}
.preset-chip .preset-del:hover { background: var(--danger); color: #fff; }
.preset-chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.preset-chip.active .preset-del { background: rgba(255,255,255,.3); }
.preset-chip.active .preset-del:hover { background: var(--danger); color: #fff; }
