.toolbar {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding-right: 6px;
  border-right: 1px solid var(--line);
}

.btn,
.tool-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 6px;
  height: 32px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-icon-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-icon-label img {
  width: 14px;
  height: 14px;
  display: block;
}

.outline-ref-control {
  position: relative;
  display: inline-flex;
}

.outline-ref-control::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 8px;
}

.outline-ref-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 150px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 14px 28px rgba(10, 20, 30, 0.22);
  padding: 6px;
  display: none;
  z-index: 1600;
}

.outline-ref-control:hover .outline-ref-menu,
.outline-ref-control:focus-within .outline-ref-menu {
  display: block;
}

.outline-ref-menu-item {
  width: 100%;
  height: 28px;
  border: 1px solid #d9e2e8;
  border-radius: 6px;
  background: #fbfeff;
  text-align: left;
  padding: 0 8px;
  font-size: 12px;
  color: #1b2636;
}

.outline-ref-menu-item:hover {
  border-color: #95acbc;
  background: #f3faf6;
}

.outline-ref-menu-item:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.icon-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 6px;
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-btn img {
  width: 18px;
  height: 18px;
  display: block;
}

.dims-text {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
}

.ref-upload {
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tool-btn {
  min-width: 34px;
  font-size: 12px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tool-icon {
  width: 18px;
  height: 18px;
  display: block;
  pointer-events: none;
}

.btn:hover,
.tool-btn:hover,
.icon-btn:hover {
  border-color: #9eb1bf;
}

.btn:disabled,
.tool-btn:disabled,
.icon-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.align-menu-btn {
  margin-left: 4px;
}

.align-menu {
  position: fixed;
  z-index: 1800;
  width: 240px;
  max-height: 420px;
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 14px 34px rgba(10, 20, 30, 0.22);
  padding: 8px;
  display: grid;
  gap: 8px;
}

.align-menu[hidden] {
  display: none !important;
}

.align-menu-section {
  border: 1px solid #e4edf2;
  border-radius: 8px;
  padding: 8px;
}

.align-menu-section h4 {
  margin: 0 0 6px;
  font-size: 12px;
  color: var(--muted);
}

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

.align-menu-item {
  border: 1px solid #d9e2e8;
  background: #fbfeff;
  color: #1b2636;
  border-radius: 6px;
  height: 28px;
  padding: 0 8px;
  text-align: left;
  font-size: 12px;
}

.align-menu-item:hover {
  border-color: #95acbc;
  background: #f3faf6;
}

.toolbar-option-btn.is-active {
  border-color: var(--accent);
  background: #ebf7f2;
  color: #0c8a62;
}

.icon-btn.is-active {
  border-color: var(--accent);
  background: #ebf7f2;
}

.tool-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
}

.shape-library-menu {
  position: fixed;
  z-index: 1800;
  width: 220px;
  max-height: 280px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 14px 34px rgba(10, 20, 30, 0.22);
  padding: 8px;
}

.shape-library-menu[hidden] {
  display: none !important;
}

.shape-library-list {
  display: grid;
  gap: 6px;
  max-height: 262px;
  overflow-y: auto;
  padding-right: 2px;
}

.shape-library-option {
  border: 1px solid #d9e2e8;
  background: #fbfeff;
  border-radius: 8px;
  height: 52px;
  padding: 6px 8px;
  display: grid;
  grid-template-columns: 52px 1fr;
  align-items: center;
  gap: 8px;
  text-align: left;
  font-size: 12px;
  color: #1b2636;
}

.shape-library-option:hover {
  border-color: #95acbc;
  background: #f3faf6;
}

.shape-library-option-upload {
  border-style: dashed;
  background: #e9f4ff;
  border-color: #9dc3e9;
}

.shape-library-option-upload:hover {
  background: #dfefff;
  border-color: #7aa9d8;
}

.shape-library-option svg {
  width: 48px;
  height: 48px;
  display: block;
}

.shape-library-preview {
  width: 48px;
  height: 48px;
  display: block;
  object-fit: contain;
}

.shape-library-option path {
  fill: none;
  stroke: #1f2d3a;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

.footer-btn {
  height: 24px;
  padding: 0 8px;
  font-size: 12px;
}

.footer-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-file {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-file input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.path-table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.inspector-section {
  margin: 0 0 8px;
  border: 1px solid #dbe6ed;
  border-radius: 8px;
  background: #fff;
}

.inspector-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 34px;
  padding: 6px 8px;
  cursor: pointer;
  user-select: none;
}

.inspector-section-header:hover {
  background: #f7fbfe;
}

.inspector-section-main {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.inspector-section-chevron {
  width: 12px;
  height: 12px;
  color: var(--muted);
  flex-shrink: 0;
  transform: rotate(0deg);
  transition: transform 0.12s ease;
}

.inspector-section.is-expanded .inspector-section-chevron {
  transform: rotate(90deg);
}

.inspector-section-title {
  font-size: 12px;
}

.inspector-section-summary {
  font-size: 12px;
  color: var(--muted);
  font-family: var(--font-mono);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inspector-section-content {
  border-top: 1px solid #e7eef3;
  padding: 8px;
}

.path-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.path-list-header h3 {
  margin: 12px 0 6px;
}

.path-optimize-btn {
  margin-top: 6px;
  width: 28px;
  height: 28px;
}

.path-optimize-btn img {
  width: 16px;
  height: 16px;
}

.path-optimize-control {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.path-optimize-control::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 8px;
}

.path-optimize-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 250px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 14px 30px rgba(10, 20, 30, 0.22);
  padding: 6px;
  display: none;
  z-index: 1700;
}

.path-optimize-control:hover .path-optimize-menu,
.path-optimize-control:focus-within .path-optimize-menu {
  display: block;
}

.path-optimize-menu-item {
  width: 100%;
  border: 1px solid #d9e2e8;
  border-radius: 6px;
  background: #fbfeff;
  color: #1b2636;
  text-align: left;
  padding: 8px;
  display: grid;
  gap: 4px;
  font-size: 12px;
}

.path-optimize-menu-item:hover {
  border-color: #95acbc;
  background: #f3faf6;
}

.path-optimize-menu-item:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.path-optimize-menu-item strong {
  font-size: 12px;
  font-weight: 600;
}

.path-optimize-menu-item span {
  font-size: 11px;
  color: #4e6170;
  line-height: 1.35;
}

.path-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 12px;
}

.path-table thead th {
  background: #f6fbfe;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-weight: 600;
  text-align: left;
  padding: 6px 8px;
}

.path-table tbody td {
  border-bottom: 1px solid #edf2f6;
  padding: 8px;
}

.path-table tbody tr:last-child td {
  border-bottom: none;
}

.path-table tbody tr {
  cursor: pointer;
}

.path-table tbody tr.is-selected {
  background: #ebf7f2;
}

.path-table tbody tr.is-dragging {
  opacity: 0.4;
}

.path-table th.col-entry,
.path-table td.col-entry {
  width: 100%;
}

.path-table tfoot td {
  background: #f6fbfe;
  border-top: 1px solid var(--line);
  padding: 6px 8px;
}

.path-total-label {
  text-align: left;
  color: var(--muted);
  font-weight: 600;
}

.path-total-value {
  font-weight: 700;
  color: var(--ink);
  font-family: var(--font-mono);
}

.path-entry-line1 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.path-entry-left {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.path-entry-name {
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.path-entry-name-input {
  min-width: 110px;
  max-width: 100%;
  border: 1px solid #9eb1bf;
  border-radius: 4px;
  padding: 2px 6px;
  font: inherit;
  font-weight: 600;
}

.path-entry-actions {
  flex-shrink: 0;
}

.path-entry-line2 {
  margin-top: 2px;
  color: var(--muted);
  font-family: var(--font-mono);
}

.drag-handle {
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 2px;
  width: 14px;
  height: 16px;
  padding: 0;
  line-height: 1;
  cursor: grab;
}

.drag-handle:hover {
  color: var(--ink);
  background: #edf3f7;
}

.path-actions {
  display: inline-flex;
  gap: 4px;
}

.path-actions .btn {
  height: 22px;
  min-width: 22px;
  padding: 0 6px;
  font-size: 12px;
}

.kv {
  margin: 6px 0;
  font-size: 13px;
}

.kv code {
  font-family: var(--font-mono);
}

.error {
  color: var(--danger);
  font-size: 12px;
  margin-top: 4px;
}

.warning {
  color: #9c6a00;
  font-size: 12px;
  margin-top: 4px;
}

.issue-actions {
  display: flex;
  gap: 6px;
  margin: 4px 0 8px;
}

.issue-actions .btn {
  height: 28px;
  padding: 0 8px;
  font-size: 12px;
}

.issue-row {
  padding: 8px 0;
  border-top: 1px solid var(--line);
}

.settings-form {
  display: grid;
  gap: 10px;
}

.settings-row {
  display: grid;
  gap: 6px;
}

.outline-settings-form {
  gap: 12px;
}

.settings-group {
  border: 1px solid #dde6ec;
  border-radius: 8px;
  padding: 10px;
  display: grid;
  gap: 8px;
}

.settings-group-title {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.settings-group-body {
  display: grid;
  gap: 8px;
}

.settings-inline-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.settings-inline-field {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
}

.settings-inline-field label {
  margin: 0;
}

.settings-input-compact {
  width: 92px;
}

.settings-inline-toggle label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.settings-toolbar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.settings-inline-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.settings-inline-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.settings-inline-suffix {
  color: var(--muted);
}

.settings-path-color-row {
  display: inline-flex;
  align-items: center;
}

.settings-path-direction-row {
  margin-top: 2px;
}

.settings-input-color {
  width: 56px;
  height: 32px;
  padding: 2px;
}

.settings-input-range {
  width: 180px;
}

.settings-inline-actions {
  display: inline-flex;
  gap: 6px;
}

.settings-inline-actions .btn {
  height: 28px;
  padding: 0 10px;
}

.settings-preset-active {
  border-color: var(--accent);
  background: #ebf7f2;
  color: #0c8a62;
}

.settings-row label {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
}

.app-context-menu {
  position: fixed;
  z-index: 1900;
  min-width: 140px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 12px 24px rgba(8, 20, 30, 0.2);
  padding: 4px;
}

.app-context-menu-item {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  text-align: left;
  font-size: 12px;
  padding: 6px 8px;
}

.app-context-menu-item:hover {
  border-color: #d4e1e8;
  background: #f4faf6;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 17, 24, 0.5);
  display: grid;
  place-items: center;
  z-index: 2000;
}

.modal-panel {
  width: min(760px, calc(100vw - 40px));
  max-height: calc(100vh - 80px);
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.25);
}

.modal-header {
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
}

.modal-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.modal-body {
  padding: 12px 16px;
}

.modal-body p {
  margin: 0 0 8px;
}

.modal-actions {
  padding: 12px 16px 16px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.modal-panel-wide {
  width: min(1100px, calc(100vw - 40px));
}

.help-fab {
  position: fixed;
  right: 18px;
  bottom: 54px;
  z-index: 2400;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid #6b8798;
  background: #f8fdff;
  color: #204255;
  font-size: 20px;
  line-height: 1;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(10, 20, 30, 0.24);
}

.help-fab:hover {
  border-color: #2f617d;
  background: #edf7fd;
}

.help-modal-body {
  padding-top: 10px;
}

.help-modal-close-btn {
  min-width: 30px;
  height: 30px;
  font-size: 16px;
}

.help-modal-layout {
  display: grid;
  gap: 10px;
}

.help-search-row input {
  width: 100%;
  height: 34px;
  border: 1px solid #c0d2dc;
  border-radius: 8px;
  padding: 0 10px;
  font-size: 13px;
}

.help-main-row {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 10px;
  min-height: min(62vh, 620px);
}

.help-toc {
  border: 1px solid #d8e4ea;
  border-radius: 10px;
  padding: 8px;
  overflow: auto;
  background: #fafdff;
}

.help-toc-section {
  margin-bottom: 8px;
}

.help-toc-section h4 {
  margin: 0 0 6px;
  font-size: 12px;
  color: #566573;
}

.help-toc-item {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #1b2636;
  text-align: left;
  font-size: 12px;
  padding: 6px 7px;
}

.help-toc-item:hover {
  background: #eef7fb;
  border-color: #cadbe5;
}

.help-toc-item.is-active {
  background: #ebf7f2;
  border-color: #bfe4d6;
  color: #0c8a62;
  font-weight: 600;
}

.help-content-panel {
  border: 1px solid #d8e4ea;
  border-radius: 10px;
  padding: 10px;
  background: #ffffff;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 8px;
}

.help-content-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.help-content-header h2 {
  margin: 0;
  font-size: 18px;
}

.help-content {
  overflow: auto;
  border: 1px solid #e7eef3;
  border-radius: 8px;
  padding: 10px 12px;
  background: #fcfeff;
}

.help-markdown h1,
.help-markdown h2,
.help-markdown h3,
.help-markdown h4 {
  margin: 0 0 8px;
}

.help-markdown p,
.help-markdown ul,
.help-markdown blockquote {
  margin: 0 0 8px;
  font-size: 13px;
  line-height: 1.45;
}

.help-markdown ul {
  padding-left: 20px;
}

.help-markdown code {
  background: #eff4f8;
  border-radius: 4px;
  padding: 1px 4px;
  font-size: 12px;
}

.help-markdown a {
  color: #125c89;
}

.help-markdown blockquote {
  padding: 8px 10px;
  border-left: 3px solid #9ec9de;
  background: #f0f8fd;
}

.help-search-state,
.help-loading {
  font-size: 12px;
  color: #5d7181;
  margin: 0;
}

.help-glossary-term {
  border: none;
  background: transparent;
  color: #0e5f8b;
  text-decoration: underline dotted;
  text-underline-offset: 2px;
  padding: 0;
  font: inherit;
  position: relative;
  cursor: pointer;
}

.help-glossary-term::after {
  content: attr(data-definition);
  position: absolute;
  left: 0;
  bottom: calc(100% + 6px);
  width: 220px;
  border: 1px solid #c8d7df;
  border-radius: 8px;
  background: #ffffff;
  color: #15232d;
  font-size: 11px;
  line-height: 1.35;
  padding: 6px 8px;
  box-shadow: 0 10px 24px rgba(8, 20, 30, 0.2);
  opacity: 0;
  transform: translateY(4px);
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 20;
}

.help-glossary-term:hover::after,
.help-glossary-term:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

.help-zoom-highlight {
  box-shadow: 0 0 0 3px #0c8a62, 0 0 0 8px rgba(12, 138, 98, 0.22);
  border-radius: 8px;
  animation: help-zoom-pulse 0.9s ease-in-out 2;
}

@keyframes help-zoom-pulse {
  0% { box-shadow: 0 0 0 2px rgba(12, 138, 98, 0.9), 0 0 0 6px rgba(12, 138, 98, 0.3); }
  100% { box-shadow: 0 0 0 5px rgba(12, 138, 98, 0.9), 0 0 0 11px rgba(12, 138, 98, 0.08); }
}

@media (max-width: 900px) {
  .help-main-row {
    grid-template-columns: 1fr;
    min-height: min(62vh, 700px);
  }

  .help-toc {
    max-height: 180px;
  }
}

.tutorial-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: rgba(6, 17, 24, 0.56);
}

.tutorial-panel {
  position: fixed;
  width: min(360px, calc(100vw - 24px));
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.28);
  padding: 12px;
}

.tutorial-title {
  margin: 4px 0 6px;
  font-size: 16px;
}

.tutorial-copy {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--muted);
}

.tutorial-progress {
  font-size: 11px;
  color: var(--muted);
  font-family: var(--font-mono);
}

.tutorial-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.tutorial-highlight-target {
  position: relative;
  z-index: 3001;
  border-radius: 8px;
  box-shadow: 0 0 0 3px #0c8a62, 0 0 0 6px rgba(12, 138, 98, 0.2);
}

.inspector,
.align-menu,
.shape-library-list,
.modal-panel {
  scrollbar-color: #b4c3cc #ecf2f5;
  scrollbar-width: thin;
}

.inspector::-webkit-scrollbar,
.align-menu::-webkit-scrollbar,
.shape-library-list::-webkit-scrollbar,
.modal-panel::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.inspector::-webkit-scrollbar-track,
.align-menu::-webkit-scrollbar-track,
.shape-library-list::-webkit-scrollbar-track,
.modal-panel::-webkit-scrollbar-track {
  background: #ecf2f5;
}

.inspector::-webkit-scrollbar-thumb,
.align-menu::-webkit-scrollbar-thumb,
.shape-library-list::-webkit-scrollbar-thumb,
.modal-panel::-webkit-scrollbar-thumb {
  background: #b4c3cc;
  border-radius: 8px;
  border: 2px solid #ecf2f5;
}

.inspector::-webkit-scrollbar-thumb:hover,
.align-menu::-webkit-scrollbar-thumb:hover,
.shape-library-list::-webkit-scrollbar-thumb:hover,
.modal-panel::-webkit-scrollbar-thumb:hover {
  background: #94a8b4;
}
