:root {
  color-scheme: light;
  --bg: #eef2f6;
  --panel: #f8fafc;
  --panel-strong: #ffffff;
  --line: #d5dce5;
  --text: #17212b;
  --muted: #617080;
  --accent: #087f7b;
  --accent-strong: #056a67;
  --accent-soft: #d9f1ef;
  --accent-detail: var(--accent);
  --file-icon: var(--accent);
  --on-accent: #ffffff;
  --warn: #b6533e;
  --on-warn: #ffffff;
  --shadow: 0 18px 48px rgba(34, 53, 70, 0.13);
  --nav-panel-bg: rgba(255, 255, 255, 0.9);
  --nav-controls-bg: rgba(255, 255, 255, 0.92);
  --nav-button-bg: rgba(241, 245, 249, 0.94);
  --nav-button-text: #17212b;
  --nav-button-active-bg: #d9f1ef;
  --nav-slider-track: rgba(97, 112, 128, 0.26);
  --nav-slider-thumb: #087f7b;
  --minimap-canvas-bg: #f8fafc;
  --minimap-canvas-frame: rgba(23, 33, 43, 0.16);
  --minimap-canvas-shape: rgba(8, 127, 123, 0.5);
  --minimap-canvas-arrow: rgba(23, 33, 43, 0.44);
  --minimap-viewport-border: rgba(8, 127, 123, 0.68);
  --minimap-viewport-fill: rgba(8, 127, 123, 0.1);
  --color-popover-bg: rgba(255, 255, 255, 0.97);
  --color-popover-text: #17212b;
  --color-popover-border: rgba(23, 33, 43, 0.13);
  --color-popover-shadow: 0 18px 45px rgba(34, 53, 70, 0.16);
  --color-popover-presets-bg: rgba(241, 245, 249, 0.9);
  --color-popover-presets-border: rgba(23, 33, 43, 0.12);
  --color-popover-preset-border: rgba(23, 33, 43, 0.2);
  --color-popover-native-border: rgba(23, 33, 43, 0.2);
  --color-popover-input-bg: rgba(255, 255, 255, 0.94);
  --color-popover-input-border: rgba(23, 33, 43, 0.2);
  --color-popover-input-text: #17212b;
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

.hidden {
  display: none !important;
}

body {
  margin: 0;
  min-width: 1080px;
  min-height: 100vh;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  -webkit-appearance: none;
  appearance: none;
  border: 0;
  background-clip: padding-box;
  cursor: pointer;
}

.app-shell {
  width: 100vw;
  height: 100vh;
  background: var(--bg);
  color: var(--text);
}

.app-shell[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121217;
  --panel: #16161b;
  --panel-strong: #1c1c22;
  --line: #2d2e34;
  --text: #f2f2f4;
  --muted: #9d9da6;
  --accent: #46c993;
  --accent-strong: #75ddb1;
  --accent-soft: #19231f;
  --accent-detail: #359970;
  --file-icon: #359970;
  --on-accent: #07130e;
  --warn: #f08c75;
  --on-warn: #24100b;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.52), 0 1px 0 rgba(255, 255, 255, 0.03);
  --nav-panel-bg: rgba(22, 22, 27, 0.96);
  --nav-controls-bg: rgba(28, 28, 34, 0.97);
  --nav-button-bg: rgba(11, 11, 14, 0.86);
  --nav-button-text: #f2f2f4;
  --nav-button-active-bg: #20231f;
  --nav-slider-track: rgba(242, 242, 244, 0.17);
  --nav-slider-thumb: #46c993;
  --minimap-canvas-bg: #121217;
  --minimap-canvas-frame: rgba(242, 242, 244, 0.11);
  --minimap-canvas-shape: rgba(70, 201, 147, 0.48);
  --minimap-canvas-arrow: rgba(242, 242, 244, 0.4);
  --minimap-viewport-border: rgba(117, 221, 177, 0.7);
  --minimap-viewport-fill: rgba(70, 201, 147, 0.09);
  --color-popover-bg: rgba(26, 25, 30, 0.985);
  --color-popover-text: #f2f2f4;
  --color-popover-border: rgba(242, 242, 244, 0.12);
  --color-popover-shadow: 0 20px 48px rgba(0, 0, 0, 0.54);
  --color-popover-presets-bg: rgba(12, 12, 15, 0.88);
  --color-popover-presets-border: rgba(242, 242, 244, 0.1);
  --color-popover-preset-border: rgba(242, 242, 244, 0.21);
  --color-popover-native-border: rgba(242, 242, 244, 0.16);
  --color-popover-input-bg: rgba(242, 242, 244, 0.06);
  --color-popover-input-border: rgba(242, 242, 244, 0.17);
  --color-popover-input-text: #f2f2f4;
}

.top-bar {
  position: fixed;
  inset: 16px 18px auto 18px;
  z-index: 40;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  pointer-events: none;
}

.brand,
.toolbar,
.top-actions {
  pointer-events: auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: max-content;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  cursor: pointer;
}

.brand-mark {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: var(--on-accent);
}

.brand-logo {
  width: 21px;
  height: 21px;
  fill: currentColor;
}

.brand strong {
  display: flex;
  align-items: center;
  align-self: stretch;
  font-size: 14px;
}

.toolbar {
  display: flex;
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.account-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.account-button.signed-in {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.share-command-button,
.share-status-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 11px;
  border-radius: 7px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 12px;
  font-weight: 700;
}

.share-command-button:hover {
  background: var(--accent-strong);
}

.share-command-button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.share-status-button {
  gap: 5px;
  padding: 0 8px 0 10px;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.share-status-button span:last-child {
  display: grid;
  min-width: 19px;
  height: 19px;
  place-items: center;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--panel);
  font-size: 10px;
}

.tool-button,
.icon-button {
  display: inline-grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
}

.tool-button:hover,
.icon-button:hover,
.tool-button.active {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.tool-button span {
  line-height: 1;
}

.toolbar-tool-icon {
  width: 16px;
  height: 16px;
  color: currentColor;
}

.toolbar-text-icon {
  width: 16px;
  height: 16px;
  color: currentColor;
  pointer-events: none;
}

.toolbar-search-button {
  margin-left: 2px;
}

.toolbar-align-icon {
  width: 14px;
  height: 14px;
}

.search-icon {
  width: 16px;
  height: 16px;
  color: currentColor;
}

#toggleTheme {
  font-size: 20px;
}

.top-actions {
  justify-self: end;
  display: flex;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.workspace {
  display: grid;
  grid-template-columns: 270px minmax(360px, 1fr) 330px;
  width: 100vw;
  height: 100vh;
  transition: grid-template-columns 180ms ease;
}

.workspace.library-closed {
  grid-template-columns: 270px minmax(360px, 1fr) 0;
}

.workspace.left-closed {
  grid-template-columns: 0 minmax(360px, 1fr) 330px;
}

.workspace.left-closed.library-closed {
  grid-template-columns: 0 minmax(360px, 1fr) 0;
}

.left-panel,
.library-panel {
  z-index: 20;
  overflow: auto;
  border-color: var(--line);
  background: var(--panel);
}

.left-panel {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
  overflow: hidden;
  padding: 98px 14px 18px;
  border-right: 1px solid var(--line);
  transform: translateX(0);
  transition:
    transform 180ms ease,
    opacity 180ms ease,
    width 180ms ease,
    padding 180ms ease;
}

.left-panel:not(.open) {
  width: 0;
  padding-right: 0;
  padding-left: 0;
  opacity: 0;
  transform: translateX(-28px);
  pointer-events: none;
}

.library-panel {
  padding: 92px 14px 18px;
  border-left: 1px solid var(--line);
  transform: translateX(0);
  transition:
    transform 180ms ease,
    opacity 180ms ease,
    width 180ms ease;
}

.library-panel:not(.open) {
  width: 0;
  padding-right: 0;
  padding-left: 0;
  opacity: 0;
  transform: translateX(28px);
  pointer-events: none;
}

.panel-section {
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-strong);
}

.left-panel > .panel-section {
  min-height: 0;
  margin-bottom: 0;
}

.left-tab-section {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  min-height: 0;
}

.left-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.left-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.share-connection-label {
  padding-left: 6px;
  border-left: 1px solid color-mix(in srgb, currentColor 26%, transparent);
  font-size: 10px;
  font-weight: 600;
}

.share-status-button[data-sync-status="offline"] .share-connection-label,
.share-status-button[data-sync-status="reconnecting"] .share-connection-label {
  color: var(--warn);
}

.app-shell[data-theme="dark"] .left-tab:not(.active) {
  border-color: var(--line);
  background: var(--panel-strong);
  color: var(--text);
}

.app-shell[data-theme="dark"] .left-tab:not(.active):hover {
  background: color-mix(in srgb, var(--panel-strong) 82%, var(--text));
}

.left-tab-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}

.left-tab.active {
  border-color: color-mix(in srgb, var(--accent-detail) 28%, transparent);
  background: var(--accent-soft);
  color: var(--accent);
}

.left-tab-panel {
  display: none;
}

.left-tab-panel.active {
  display: block;
}

.left-tab-panel[data-left-panel="projects"].active {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
}

.section-title {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  color: var(--text);
  outline: none;
}

input,
select {
  height: 34px;
  padding: 0 10px;
}

textarea {
  min-height: 86px;
  padding: 9px 10px;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent-detail);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-detail) 18%, transparent);
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

.primary-button,
.ghost-button,
.wide-button,
.small-button {
  isolation: isolate;
  overflow: hidden;
  height: 34px;
  border-radius: 7px;
  background-clip: padding-box;
  font-size: 13px;
}

.primary-button {
  background: var(--accent);
  color: var(--on-accent);
}

.ghost-button,
.wide-button,
.small-button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
}

.wide-button {
  width: 100%;
}

.project-export-button {
  margin-top: 8px;
}

#projectFileInput {
  display: none;
}

.recent-list,
.library-list,
.global-results {
  display: grid;
  gap: 8px;
}

.project-search,
.library-search {
  margin-bottom: 10px;
}

.project-search input,
.library-search input {
  height: 40px;
  border-radius: var(--radius);
  font-size: 13px;
}

.search-input-shell {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: var(--panel);
}

.search-input-shell:focus-within {
  border-color: var(--accent-detail);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-detail) 16%, transparent);
}

.search-input-shell .search-icon,
.search-box-icon .search-icon {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.search-input-shell input {
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.search-input-shell input:focus {
  box-shadow: none;
}

.project-list {
  max-height: none;
  min-height: 0;
  align-content: start;
  grid-auto-rows: max-content;
  overflow: auto;
  padding-right: 2px;
}

.recent-item,
.library-item,
.result-item {
  position: relative;
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.recent-item:focus-visible,
.library-item:focus-visible,
.result-item:focus-visible {
  outline: 2px solid var(--accent-detail);
  outline-offset: 2px;
}

.recent-item,
.library-item,
.result-item {
  cursor: grab;
}

.recent-item {
  position: relative;
  min-height: 72px;
  padding-right: 10px;
  align-content: center;
  cursor: pointer;
}

.recent-item .item-title {
  position: relative;
  padding-right: 56px;
}

.recent-item.shared-project-item .item-title {
  padding-right: 94px;
}

.recent-item:hover,
.library-item:hover,
.result-item:hover {
  border-color: var(--accent-detail);
}

.recent-item.active,
.library-item.active {
  border-color: var(--accent-detail);
  background: var(--accent-soft);
}

.item-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
}

.library-name-label {
  display: inline-grid;
  grid-template-columns: 16px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1 1 auto;
}

.library-item .library-item-type-icon {
  width: 16px;
  height: 16px;
  color: var(--file-icon);
}

.item-name-ellipsis,
.recent-name,
.library-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-meta {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-item .item-meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow: visible;
}

.project-file-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.project-file-meta time {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-source-tag {
  display: inline-flex;
  align-items: center;
  height: 20px;
  flex: 0 0 auto;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.project-source-tag-cloud {
  border-color: color-mix(in srgb, var(--accent-detail) 58%, var(--line));
  color: var(--accent-strong);
}

.share-context-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  padding: 10px 11px;
  border: 1px solid color-mix(in srgb, var(--accent-detail) 38%, var(--line));
  border-radius: 7px;
  background: var(--accent-soft);
}

.share-context-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.share-context-notice strong {
  color: var(--accent-strong);
  font-size: 12px;
}

.share-context-copy > span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.share-exit-button {
  width: auto;
  min-width: 86px;
  height: 32px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 9px;
  border: 1px solid color-mix(in srgb, var(--accent-detail) 46%, var(--line));
  border-radius: 6px;
  background: color-mix(in srgb, var(--panel) 78%, transparent);
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 700;
}

.share-exit-button:hover {
  border-color: var(--accent-detail);
  background: var(--panel);
}

.share-exit-button svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.project-source-tag-shared {
  border-color: color-mix(in srgb, var(--accent-detail) 58%, var(--line));
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.project-share-tags {
  display: inline-flex;
  flex-wrap: wrap;
  justify-self: start;
  gap: 4px;
}

.project-share-entry {
  appearance: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 10px;
  font-weight: 700;
  line-height: 18px;
}

.project-share-entry:hover,
.project-share-entry:focus-visible {
  border-color: var(--accent);
  color: var(--accent-strong);
  outline: none;
}

.recent-item.shared-document-item {
  cursor: default;
}

.empty-hint {
  color: var(--muted);
  font-size: 13px;
}

.style-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.style-grid .field.full {
  grid-column: 1 / -1;
}

.style-grid .shape-paint-row {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.style-grid .shape-paint-row.no-fill {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.shape-paint-row .field {
  min-width: 0;
  margin-bottom: 0;
}

.style-button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.style-button-row button {
  min-width: 48px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  color: var(--text);
  font-size: 13px;
}

.style-button-row .style-icon-button {
  display: grid;
  min-width: 36px;
  width: 36px;
  padding: 0;
  place-items: center;
}

.style-button-row.text-style-button-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
}

.style-button-row.text-style-button-row button,
.style-button-row.text-style-button-row .style-icon-button {
  width: 100%;
  min-width: 0;
  padding: 0;
}

.style-button-row button:hover,
.style-button-row button.active {
  border-color: var(--accent-detail);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.rect-corner-controls {
  margin-top: 4px;
}

.corner-radius-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 10px;
}

.corner-radius-grid label {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-width: 0;
  height: 44px;
  padding: 0 12px;
  border-radius: 7px;
  background: color-mix(in srgb, var(--line) 36%, var(--panel));
}

.corner-radius-grid input {
  height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--text);
  font-size: 16px;
  text-align: left;
  appearance: textfield;
}

.corner-radius-grid input:focus {
  border-color: transparent;
  box-shadow: none;
}

.corner-radius-grid input::-webkit-outer-spin-button,
.corner-radius-grid input::-webkit-inner-spin-button {
  margin: 0;
  appearance: none;
}

.corner-glyph {
  width: 17px;
  height: 17px;
  border-color: var(--muted);
  border-style: solid;
  opacity: 0.85;
}

.corner-glyph-tl {
  border-width: 2px 0 0 2px;
  border-radius: 7px 0 0 0;
}

.corner-glyph-tr {
  border-width: 2px 2px 0 0;
  border-radius: 0 7px 0 0;
}

.corner-glyph-bl {
  border-width: 0 0 2px 2px;
  border-radius: 0 0 0 7px;
}

.corner-glyph-br {
  border-width: 0 2px 2px 0;
  border-radius: 0 0 7px 0;
}

.color-row {
  display: flex;
  gap: 8px;
}

.color-row input[type="color"] {
  width: 44px;
  height: 34px;
  padding: 2px;
}

.canvas-stage {
  position: relative;
  z-index: 1;
  overflow: hidden;
  background:
    radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--line) 64%, transparent) 1px, transparent 0)
      0 0 / 24px 24px,
    var(--bg);
}

.canvas-grid {
  position: absolute;
  inset: 0;
  transform-origin: 0 0;
}

.canvas-content {
  position: absolute;
  left: 0;
  top: 0;
  width: 1px;
  height: 1px;
  transform-origin: 0 0;
}

.canvas-element {
  position: absolute;
  display: grid;
  min-width: 24px;
  min-height: 24px;
  place-items: center;
  border-style: solid;
  border-width: 2px;
  user-select: none;
  touch-action: none;
  transform-origin: center center;
}

.canvas-element.rect,
.canvas-element.circle {
  border-width: 0;
  background: transparent;
}

.shape-surface {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.canvas-element.rect,
.canvas-element.text,
.canvas-element.icon {
  border-radius: 6px;
}

.canvas-element.circle,
.canvas-element.icon {
  border-radius: 50%;
}

.canvas-element.circle.selected,
.canvas-element.icon.selected {
  outline: 1px solid var(--accent-detail);
  outline-offset: -1px;
}

.shape-text-content {
  box-sizing: border-box;
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  padding: 6px;
  overflow: hidden;
  line-height: 1.35;
  text-align: inherit;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.shape-text-content.shape-text-vertical {
  width: auto;
  max-width: 100%;
  max-height: 100%;
  padding: 0;
  writing-mode: vertical-rl;
  text-orientation: upright;
  text-align: left;
  overflow-wrap: normal;
}

.canvas-element.text {
  display: block;
  align-items: start;
  justify-items: start;
  padding: 8px;
  line-height: 1.35;
  white-space: pre-wrap;
  overflow-wrap: normal;
  word-break: break-all;
}

.canvas-element.text.vertical-text {
  display: flex;
  align-items: flex-start;
  overflow-wrap: normal;
  word-break: normal;
}

textarea[data-prop="text"] {
  white-space: pre-wrap;
  overflow-wrap: normal;
  word-break: break-all;
}

.canvas-element.text.vertical-text.align-left {
  justify-content: flex-start;
}

.canvas-element.text.vertical-text.align-center {
  justify-content: center;
}

.canvas-element.text.vertical-text.align-right {
  justify-content: flex-end;
}

.canvas-element.text.vertical-text.editing {
  display: block;
  writing-mode: horizontal-tb;
  text-orientation: mixed;
}

.canvas-element.text.vertical-text .vertical-text-content {
  display: inline-block;
  writing-mode: vertical-rl;
  text-orientation: upright;
  white-space: pre-wrap;
  text-align: left;
}

.canvas-element.editing {
  cursor: text;
  user-select: text;
  outline: 1px dashed color-mix(in srgb, var(--accent-detail) 70%, white);
  outline-offset: 4px;
}

.canvas-element[contenteditable="true"] {
  -webkit-user-modify: read-write-plaintext-only;
}

.canvas-element.arrow {
  min-width: 40px;
  min-height: 28px;
  border-width: 0;
  background: transparent;
}

.canvas-element.image {
  overflow: hidden;
  border-radius: 6px;
  background-position: center;
  background-size: contain;
  background-repeat: no-repeat;
}

.canvas-element.icon {
  overflow: hidden;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

.arrow svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.selection-box {
  position: absolute;
  z-index: 15;
  --selection-ui-scale: 1;
  border: calc(1px * var(--selection-ui-scale)) solid var(--accent-detail);
  border-radius: 0;
  box-shadow: none;
  pointer-events: none;
  transform-origin: center center;
}

.selection-box.hidden {
  display: none;
}

.hover-box {
  position: absolute;
  z-index: 14;
  --selection-ui-scale: 1;
  border: calc(2px * var(--selection-ui-scale)) solid var(--accent-detail);
  border-radius: 0;
  box-shadow: none;
  pointer-events: none;
  transform-origin: center center;
}

.hover-box.rounded-hover {
  border-radius: 6px;
}

.hover-box.circle-hover {
  border-radius: 50%;
}

.hover-box.hidden {
  display: none;
}

.snap-guides {
  position: absolute;
  inset: 0;
  z-index: 14;
  pointer-events: none;
}

.snap-guides.hidden {
  display: none;
}

.snap-guide {
  position: absolute;
  display: block;
  background: var(--accent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent-detail) 18%, transparent);
}

.snap-guide-spacing {
  background: var(--accent);
}

.snap-guide-spacing::before,
.snap-guide-spacing::after {
  content: "";
  position: absolute;
  display: block;
  background: var(--accent);
}

.snap-guide-spacing-x {
  height: 1px;
}

.snap-guide-spacing-x::before,
.snap-guide-spacing-x::after {
  top: -4px;
  width: 1px;
  height: 9px;
}

.snap-guide-spacing-x::before {
  left: 0;
}

.snap-guide-spacing-x::after {
  right: 0;
}

.snap-guide-spacing-y {
  width: 1px;
}

.snap-guide-spacing-y::before,
.snap-guide-spacing-y::after {
  left: -4px;
  width: 9px;
  height: 1px;
}

.snap-guide-spacing-y::before {
  top: 0;
}

.snap-guide-spacing-y::after {
  bottom: 0;
}

.snap-guide-label {
  position: absolute;
  display: inline-grid;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  place-items: center;
  border-radius: 9px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 11px;
  line-height: 1;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.snap-guide-label-x {
  transform: translate(-50%, calc(-100% - 6px));
}

.snap-guide-label-y {
  transform: translate(8px, -50%);
}

.snap-guide-vertical {
  width: 1px;
}

.snap-guide-horizontal {
  height: 1px;
}

.selection-resize-handle {
  position: absolute;
  width: calc(12px * var(--selection-ui-scale));
  height: calc(12px * var(--selection-ui-scale));
  border: calc(2px * var(--selection-ui-scale)) solid var(--accent-detail);
  border-radius: calc(4px * var(--selection-ui-scale));
  background: var(--panel-strong);
}

.selection-edge-handle {
  position: absolute;
  display: none;
  pointer-events: auto;
  background: transparent;
}

.selection-resize-handle-nw {
  top: calc(-7px * var(--selection-ui-scale));
  left: calc(-7px * var(--selection-ui-scale));
  pointer-events: auto;
  cursor: nwse-resize;
}

.selection-resize-handle-ne {
  top: calc(-7px * var(--selection-ui-scale));
  right: calc(-7px * var(--selection-ui-scale));
  pointer-events: auto;
  cursor: nesw-resize;
}

.selection-resize-handle-sw {
  bottom: calc(-7px * var(--selection-ui-scale));
  left: calc(-7px * var(--selection-ui-scale));
  pointer-events: auto;
  cursor: nesw-resize;
}

.selection-resize-handle-se {
  right: calc(-7px * var(--selection-ui-scale));
  bottom: calc(-7px * var(--selection-ui-scale));
  pointer-events: auto;
  cursor: nwse-resize;
}

.selection-box.text-selection .selection-edge-handle,
.selection-box.shape-selection .selection-edge-handle {
  display: block;
}

.selection-box.arrow-selection .selection-edge-handle {
  display: none;
}

.selection-edge-handle-n,
.selection-edge-handle-s {
  left: calc(14px * var(--selection-ui-scale));
  right: calc(14px * var(--selection-ui-scale));
  height: calc(12px * var(--selection-ui-scale));
  cursor: ns-resize;
}

.selection-edge-handle-n {
  top: calc(-6px * var(--selection-ui-scale));
}

.selection-edge-handle-s {
  bottom: calc(-6px * var(--selection-ui-scale));
}

.selection-edge-handle-e,
.selection-edge-handle-w {
  top: calc(14px * var(--selection-ui-scale));
  bottom: calc(14px * var(--selection-ui-scale));
  width: calc(12px * var(--selection-ui-scale));
  cursor: ew-resize;
}

.selection-edge-handle-e {
  right: calc(-6px * var(--selection-ui-scale));
}

.selection-edge-handle-w {
  left: calc(-6px * var(--selection-ui-scale));
}

.corner-radius-handle {
  position: absolute;
  display: none;
  width: calc(10px * var(--selection-ui-scale));
  height: calc(10px * var(--selection-ui-scale));
  border: calc(2px * var(--selection-ui-scale)) solid var(--accent-detail);
  border-radius: 999px;
  background: var(--panel-strong);
  pointer-events: auto;
  cursor: grab;
  transform: translate(-50%, -50%);
}

.corner-radius-handle::before {
  position: absolute;
  inset: calc(-10px * var(--selection-ui-scale));
  border-radius: 999px;
  content: "";
}

.corner-radius-handle:active {
  cursor: grabbing;
}

.selection-box.rect-radius-selection .corner-radius-handle {
  display: block;
}

.corner-radius-handle-tl,
.corner-radius-handle-bl {
  left: var(--corner-radius-left, calc(16px * var(--selection-ui-scale)));
}

.corner-radius-handle-tr,
.corner-radius-handle-br {
  right: var(--corner-radius-right, calc(16px * var(--selection-ui-scale)));
  transform: translate(50%, -50%);
}

.corner-radius-handle-tl,
.corner-radius-handle-tr {
  top: var(--corner-radius-top, calc(16px * var(--selection-ui-scale)));
}

.corner-radius-handle-bl,
.corner-radius-handle-br {
  bottom: var(--corner-radius-bottom, calc(16px * var(--selection-ui-scale)));
  transform: translate(-50%, 50%);
}

.corner-radius-handle-br {
  transform: translate(50%, 50%);
}

.selection-rotate-handle {
  position: absolute;
  bottom: calc(-34px * var(--selection-ui-scale));
  left: 50%;
  width: calc(14px * var(--selection-ui-scale));
  height: calc(14px * var(--selection-ui-scale));
  border: calc(2px * var(--selection-ui-scale)) solid var(--accent-detail);
  border-radius: 999px;
  background: var(--panel-strong);
  cursor: grab;
  pointer-events: auto;
  transform: translateX(-50%);
}

.selection-rotate-handle::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: calc(12px * var(--selection-ui-scale));
  width: calc(1px * var(--selection-ui-scale));
  height: calc(20px * var(--selection-ui-scale));
  background: var(--accent);
  transform: translateX(-50%);
}

.arrow-anchor {
  position: absolute;
  display: none;
  width: calc(14px * var(--selection-ui-scale));
  height: calc(14px * var(--selection-ui-scale));
  border: calc(2px * var(--selection-ui-scale)) solid var(--accent-detail);
  border-radius: calc(4px * var(--selection-ui-scale));
  background: var(--panel-strong);
  cursor: move;
  pointer-events: auto;
  transform: translate(-50%, -50%);
}

.selection-box.arrow-selection {
  border-color: transparent;
}

.selection-box.arrow-selection .selection-resize-handle,
.selection-box.arrow-selection .selection-rotate-handle {
  display: none;
}

.selection-box.arrow-selection .arrow-anchor {
  display: block;
}

.marquee-box {
  position: absolute;
  z-index: 30;
  border: 1px solid var(--accent-detail);
  background: color-mix(in srgb, var(--accent-detail) 12%, transparent);
  pointer-events: none;
}

.marquee-box.hidden {
  display: none;
}

.selection-toolbar {
  position: fixed;
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel-strong) 96%, transparent);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.selection-toolbar:has(.toolbar-color-popover) {
  border-radius: 26px;
}

.selection-toolbar.hidden {
  display: none;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 5px;
}

.toolbar-group.image-toolbar-group {
  justify-content: center;
}

.toolbar-divider {
  flex: 0 0 1px;
  width: 1px;
  height: 28px;
  min-width: 1px;
  align-self: center;
  background: var(--line);
}

.selection-toolbar button,
.selection-toolbar input,
.selection-toolbar select {
  width: 34px;
  height: 34px;
  min-width: 34px;
  padding: 0;
  display: grid;
  place-items: center;
  background: var(--panel);
  color: var(--text);
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 13px;
}

.selection-toolbar .wide-tool {
  width: 44px;
  min-width: 44px;
}

.selection-toolbar input[type="color"] {
  padding: 3px;
}

.selection-toolbar .color-swatch-control {
  position: relative;
  display: grid;
  place-items: center;
  padding: 0;
  overflow: visible;
}

.color-swatch-fill {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--text) 18%, transparent);
  border-radius: 3px;
  background: var(--swatch-color);
  color: var(--panel-strong);
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
}

.color-swatch-control.is-transparent .color-swatch-fill {
  background:
    linear-gradient(45deg, transparent 46%, #c84b42 47%, #c84b42 53%, transparent 54%),
    #ffffff;
}

.color-swatch-control.is-mixed .color-swatch-fill {
  border-color: color-mix(in srgb, var(--text) 26%, transparent);
  background: #777d7a;
  color: #ffffff;
}

.toolbar-color-popover {
  position: absolute;
  left: 8px;
  top: calc(100% + 8px);
  display: grid;
  grid-template-columns: 61px 336px;
  gap: 11px;
  padding: 13px;
  border: 1px solid var(--color-popover-border);
  border-radius: 19px;
  background: var(--color-popover-bg);
  color: var(--color-popover-text);
  box-shadow: var(--color-popover-shadow);
  backdrop-filter: blur(18px);
}

.color-popover-presets {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border: 1px solid var(--color-popover-presets-border);
  border-radius: 18px;
  background: var(--color-popover-presets-bg);
}

.selection-toolbar .color-preset {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border: 1px solid var(--color-popover-preset-border);
  border-radius: 999px;
  background: var(--preset-color);
}

.selection-toolbar .color-preset-none {
  background:
    linear-gradient(45deg, transparent 46%, #8e8e8e 47%, #8e8e8e 53%, transparent 54%),
    #ffffff;
}

.color-popover-main {
  display: grid;
  gap: 16px;
  align-content: start;
}

.selection-toolbar .color-native-input {
  width: 336px;
  height: 256px;
  min-width: 336px;
  padding: 0;
  border: 1px solid var(--color-popover-native-border);
  border-radius: 0;
  background: transparent;
}

.color-rgb-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  justify-items: center;
  gap: 44px;
  padding: 0 18px;
}

.color-rgb-row label {
  display: grid;
  gap: 5px;
  justify-items: center;
  text-align: center;
  color: var(--color-popover-text);
  font-size: 12px;
}

.selection-toolbar .color-rgb-row input {
  width: 64px;
  min-width: 64px;
  height: 42px;
  border: 1px solid var(--color-popover-input-border);
  border-radius: 5px;
  background: var(--color-popover-input-bg);
  color: var(--color-popover-input-text);
  font-size: 16px;
  text-align: center;
}

.selection-toolbar .color-rgb-row input::-webkit-outer-spin-button,
.selection-toolbar .color-rgb-row input::-webkit-inner-spin-button {
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
}

.selection-toolbar .color-rgb-row input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

.selection-toolbar input[type="number"] {
  width: 54px;
  min-width: 54px;
  padding: 0 6px;
  text-align: center;
}

.selection-toolbar .mixed-value-input {
  width: 54px;
  min-width: 54px;
  padding: 0 6px;
  text-align: center;
  color: var(--muted);
  font-weight: 700;
}

.selection-toolbar .color-rgb-row input[type="number"] {
  width: 64px;
  min-width: 64px;
}

.selection-toolbar button:hover,
.selection-toolbar button.active {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.zoom-chip,
.hint-chip {
  position: absolute;
  z-index: 10;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  color: var(--muted);
  font-size: 12px;
  backdrop-filter: blur(14px);
}

.zoom-chip {
  right: 16px;
  bottom: 58px;
  padding: 7px 10px;
}

.hint-chip {
  right: 16px;
  bottom: 22px;
  padding: 7px 12px;
}

.nav-widget {
  position: absolute;
  left: 18px;
  bottom: 22px;
  z-index: 28;
  display: grid;
  gap: 8px;
  color: var(--nav-button-text);
}

.minimap-panel {
  position: relative;
  width: 300px;
  height: 184px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  border-radius: 16px;
  background: var(--nav-panel-bg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.minimap-panel:not(.open) {
  display: none;
}

#minimapCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

.minimap-viewport {
  position: absolute;
  border: 1px solid var(--minimap-viewport-border);
  background: var(--minimap-viewport-fill);
  pointer-events: none;
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  width: max-content;
  padding: 8px;
  border: 1px solid color-mix(in srgb, var(--line) 62%, transparent);
  border-radius: 18px;
  background: var(--nav-controls-bg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.nav-button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 12px;
  background: var(--nav-button-bg);
  color: var(--nav-button-text);
  font-size: 20px;
}

.nav-tool-icon {
  width: 18px;
  height: 18px;
  color: currentColor;
  fill: currentColor;
}

.nav-button:hover,
.nav-button.active {
  background: var(--nav-button-active-bg);
  color: var(--accent-strong);
}

.zoom-slider {
  width: 122px;
  min-width: 122px;
  height: 20px;
  accent-color: var(--nav-slider-thumb);
  background: transparent;
  appearance: none;
}

.zoom-slider::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: var(--nav-slider-track);
}

.zoom-slider::-webkit-slider-thumb {
  width: 20px;
  height: 20px;
  margin-top: -7px;
  border: 3px solid var(--nav-controls-bg);
  border-radius: 999px;
  background: var(--nav-slider-thumb);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.22);
  appearance: none;
}

.zoom-slider::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: var(--nav-slider-track);
}

.zoom-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 3px solid var(--nav-controls-bg);
  border-radius: 999px;
  background: var(--nav-slider-thumb);
}

.library-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.library-header strong,
.library-header span {
  display: block;
}

.library-header span {
  color: var(--muted);
  font-size: 12px;
}

.library-scope-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 10px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-strong);
}

.library-scope-button {
  height: 34px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.library-scope-button.active {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.library-source-badge {
  display: inline-flex;
  align-items: center;
  height: 18px;
  margin-left: 4px;
  padding: 0 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.library-readonly-hint {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
}

.library-login-empty {
  display: grid;
  gap: 8px;
  padding: 16px 10px;
  color: var(--muted);
  text-align: center;
}

.library-login-empty button {
  height: 32px;
  border-radius: 7px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 700;
}

.library-panel.login-required .library-scope-switch,
.library-panel.login-required .tabs,
.library-panel.login-required .library-search,
.library-panel.login-required .library-folders-shell,
.library-panel.login-required .icon-creator {
  display: none;
}

.library-panel.login-required .library-list {
  align-content: start;
}

.account-dialog {
  width: min(440px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow);
}

.account-dialog::backdrop {
  background: rgba(8, 15, 22, 0.46);
  backdrop-filter: blur(2px);
}

.account-dialog > form {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 48px);
}

.account-dialog-header {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.account-dialog-header h2 {
  margin: 0;
  color: var(--accent-strong);
  font-size: 22px;
}

.account-dialog-header .icon-button {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 22px;
}

.account-dialog button:focus-visible {
  outline: 2px solid var(--accent-detail);
  outline-offset: 2px;
}

.account-dialog-body {
  display: grid;
  gap: 16px;
  overflow: auto;
  padding: 18px;
}

.account-dialog-body p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.account-dialog .field {
  gap: 7px;
  margin: 0;
}

.account-dialog .field > span {
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.account-dialog .field input {
  height: 42px;
  padding: 0 12px;
}

.account-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  width: max-content;
  margin-top: -2px;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}

.account-remember input {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  margin: 0;
  padding: 0;
  accent-color: var(--accent);
  box-shadow: none;
}

.account-error {
  padding: 9px 12px;
  color: #8a3f2b;
  background: color-mix(in srgb, var(--warn) 10%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--warn) 58%, var(--line));
  border-radius: 7px;
  font-size: 12px;
}

.account-profile {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px 15px;
  border: 1px solid color-mix(in srgb, var(--accent-detail) 22%, var(--line));
  border-radius: 7px;
  background: var(--accent-soft);
}

.account-profile-avatar {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 16px;
  font-weight: 800;
}

.account-profile-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.account-profile-copy strong,
.account-profile-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-profile-copy span {
  color: var(--muted);
  font-size: 12px;
}

.account-status-badge {
  padding: 5px 8px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--accent) 14%, var(--panel));
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 700;
}

.account-session-note {
  display: grid;
  gap: 6px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: color-mix(in srgb, var(--panel) 88%, var(--bg));
}

.account-session-note > strong {
  font-size: 12px;
}

.account-dialog-footer {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 18px;
  background: color-mix(in srgb, var(--panel) 92%, var(--bg));
  border-top: 1px solid var(--line);
}

.account-dialog-footer button {
  width: 138px;
  height: 42px;
  font-weight: 700;
}

.account-dialog .hidden {
  display: none !important;
}

.app-prompt-dialog[data-mode="decision"] {
  width: min(560px, calc(100vw - 48px));
}

.app-prompt-body {
  gap: 14px;
}

.app-prompt-message {
  white-space: pre-line;
}

.app-prompt-message:empty {
  display: none;
}

.app-prompt-error {
  color: var(--warn);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.45;
}

.app-prompt-footer {
  flex-wrap: nowrap;
}

.app-prompt-footer button {
  width: auto;
  min-width: 128px;
  padding: 0 18px;
}

.app-prompt-dialog[data-mode="decision"] .app-prompt-footer button {
  min-width: 0;
  flex: 1 1 0;
}

.app-prompt-confirm-danger {
  background: var(--warn);
  color: var(--on-warn);
}

.app-prompt-confirm-danger:hover {
  background: color-mix(in srgb, var(--warn) 86%, var(--text));
}

@media (max-width: 560px) {
  .app-prompt-dialog[data-mode="decision"] .app-prompt-footer {
    flex-wrap: wrap;
  }

  .app-prompt-dialog[data-mode="decision"] .app-prompt-footer button {
    flex-basis: calc(50% - 5px);
  }

  .app-prompt-dialog[data-mode="decision"] .app-prompt-confirm {
    flex-basis: 100%;
    order: -1;
  }
}

.share-dialog {
  width: min(560px, calc(100vw - 48px));
}

.share-dialog-body {
  gap: 14px;
}

.share-option-group {
  display: grid;
  gap: 8px;
}

.share-option-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.share-option-heading strong {
  color: var(--text);
  font-size: 12px;
}

.share-option-heading span {
  color: var(--muted);
  font-size: 11px;
}

.share-stage-options {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.share-enabled-summary {
  min-height: 30px;
  display: flex;
  align-items: center;
  width: fit-content;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: color-mix(in srgb, var(--panel) 88%, var(--bg));
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.share-enabled-summary.has-shares {
  border-color: color-mix(in srgb, var(--accent-detail) 40%, var(--line));
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.share-mode-options {
  display: grid;
  gap: 8px;
}

.share-mode-option {
  min-width: 0;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: flex-start;
  gap: 9px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: color-mix(in srgb, var(--panel) 92%, var(--bg));
  cursor: pointer;
}

.share-mode-option:has(input:checked) {
  border-color: var(--accent-detail);
  background: var(--accent-soft);
}

.share-mode-option input {
  width: 15px;
  height: 15px;
  margin: 2px 0 0;
  accent-color: var(--accent);
}

.share-mode-option > span {
  display: grid;
  gap: 4px;
}

.share-mode-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.share-mode-status {
  min-height: 20px;
  display: inline-flex;
  align-items: center;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted);
  background: var(--panel);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.share-mode-option.has-share .share-mode-status {
  border-color: color-mix(in srgb, var(--accent-detail) 46%, var(--line));
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.share-mode-option strong {
  font-size: 13px;
}

.share-mode-option small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.share-link-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
  padding-top: 4px;
}

.share-link-section .field {
  min-width: 0;
  margin-bottom: 0;
}

.share-link-section > button {
  width: auto;
  min-width: 138px;
  height: 42px;
  padding: 0 16px;
  white-space: nowrap;
}

.share-dialog-footer button {
  width: 138px;
}

.share-person-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.share-person-actions button {
  min-width: 138px;
}

@media (max-width: 560px) {
  .share-stage-options {
    grid-template-columns: minmax(0, 1fr);
  }

  .share-link-section {
    grid-template-columns: minmax(0, 1fr);
  }

  .share-link-section > button {
    width: 100%;
  }
}

.review-lock-overlay {
  position: absolute;
  inset: 0;
  z-index: 13;
  cursor: not-allowed;
  background: transparent;
}

.app-shell.review-stage-locked .canvas-stage::after {
  content: "评审进行中 · 画布只读";
  position: absolute;
  top: 18px;
  left: 50%;
  z-index: 14;
  transform: translateX(-50%);
  padding: 7px 11px;
  border: 1px solid color-mix(in srgb, var(--accent-detail) 44%, var(--line));
  border-radius: 6px;
  background: color-mix(in srgb, var(--panel-strong) 94%, transparent);
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 700;
  pointer-events: none;
  box-shadow: var(--shadow-soft);
}

.share-activity-dialog {
  width: min(600px, calc(100vw - 48px));
}

.share-activity-body {
  gap: 14px;
}

.share-activity-modes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: color-mix(in srgb, var(--panel) 86%, var(--bg));
}

.share-activity-modes button {
  min-width: 0;
  height: 32px;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.share-activity-modes button.active {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

@media (max-width: 560px) {
  .share-activity-modes {
    grid-template-columns: minmax(0, 1fr);
  }
}

.share-access-summary {
  display: grid;
  gap: 5px;
  padding: 13px 14px;
  border: 1px solid color-mix(in srgb, var(--accent-detail) 24%, var(--line));
  border-radius: 7px;
  background: var(--accent-soft);
  font-size: 12px;
}

.share-access-summary strong {
  color: var(--accent-strong);
  font-size: 14px;
}

.share-access-summary span {
  color: var(--muted);
}

.share-record-section {
  display: grid;
  gap: 8px;
}

.share-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
}

.share-section-title strong {
  color: var(--text);
}

.share-record-list {
  display: grid;
  gap: 7px;
}

.share-record-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: color-mix(in srgb, var(--panel) 94%, var(--bg));
}

.share-record-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.share-record-copy strong,
.share-record-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.share-record-copy strong {
  font-size: 12px;
}

.share-record-copy span {
  color: var(--muted);
  font-size: 11px;
}

.share-record-actions {
  display: flex;
  gap: 5px;
}

.share-record-actions button {
  min-width: 58px;
  height: 36px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  font-size: 12px;
}

.share-record-actions button.primary {
  border-color: var(--accent-detail);
  background: var(--accent);
  color: var(--on-accent);
}

.tabs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-bottom: 10px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-strong);
}

.tab {
  display: inline-grid;
  align-items: center;
  align-content: center;
  justify-content: center;
  gap: 4px;
  min-height: 58px;
  min-width: 0;
  padding: 6px 4px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.resource-type-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  color: currentColor;
}

.tab-type-icon {
  width: 22px;
  height: 22px;
  justify-self: center;
}

.tab span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tab.active {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent-detail) 18%, transparent);
  color: var(--accent-strong);
}

.library-folders-shell {
  position: relative;
  margin-bottom: 10px;
}

.library-folders {
  display: grid;
  align-content: start;
  gap: 4px;
  height: 170px;
  overflow: auto;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--panel-strong) 86%, transparent);
}

.library-folders-resize-handle {
  position: absolute;
  z-index: 2;
  right: 0;
  bottom: -5px;
  left: 0;
  height: 10px;
  cursor: ns-resize;
  touch-action: none;
}

.library-folders-resize-handle::after {
  position: absolute;
  right: 36%;
  bottom: 3px;
  left: 36%;
  height: 2px;
  border-radius: 1px;
  background: color-mix(in srgb, var(--muted) 58%, transparent);
  content: "";
  opacity: 0.42;
  transition: opacity 120ms ease, background 120ms ease;
}

.library-folders-resize-handle:hover::after,
.library-folders-resize-handle:focus-visible::after,
.library-folders-resize-handle.dragging::after {
  background: var(--accent-detail);
  opacity: 1;
}

.library-folders-resize-handle:focus-visible {
  outline: 2px solid var(--accent-detail);
  outline-offset: 1px;
}

body.library-folders-resizing {
  cursor: ns-resize;
  user-select: none;
}

.library-folder-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px;
  align-items: center;
  gap: 6px;
  padding: 0 2px 2px;
  color: var(--muted);
  font-size: 12.8px;
  font-weight: 700;
}

.library-folder-create,
.library-folder-delete {
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}

.library-folder-create {
  width: 28px;
  height: 26px;
  font-size: 18px;
  line-height: 1;
}

.library-folder-create:hover,
.library-folder-delete:hover {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.library-folder {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 0 8px;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.library-folder.orderable,
.library-item.orderable {
  cursor: grab;
}

.library-folder.dragging,
.library-item.dragging {
  opacity: 0.48;
}

.library-folder.drop-before::before,
.library-folder.drop-after::after,
.library-item.drop-before::before,
.library-item.drop-after::after {
  position: absolute;
  z-index: 3;
  right: 5px;
  left: 5px;
  height: 2px;
  border-radius: 1px;
  background: var(--accent-detail);
  content: "";
  pointer-events: none;
}

.library-folder.drop-before::before,
.library-item.drop-before::before {
  top: -3px;
}

.library-folder.drop-after::after,
.library-item.drop-after::after {
  bottom: -3px;
}

.library-folder:hover,
.library-folder.active {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.library-folder-label {
  display: inline-grid;
  grid-template-columns: 16px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.library-folder-icon {
  width: 16px;
  height: 16px;
  color: var(--file-icon);
}

.library-folder-name {
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-folder-count {
  color: var(--muted);
  font-size: 12px;
}

.library-folder-delete {
  width: 24px;
  height: 24px;
  font-size: 16px;
}

.library-folder-rename {
  width: 100%;
}

.library-preview {
  position: fixed;
  z-index: 130;
  width: max-content;
  max-width: 280px;
  padding: 10px;
  border: 1px solid var(--accent-detail);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--panel-strong) 96%, transparent);
  box-shadow: var(--shadow);
  pointer-events: none;
  backdrop-filter: blur(16px);
}

.library-preview.hidden {
  display: none;
}

.library-preview-title {
  max-width: 240px;
  margin-bottom: 8px;
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-preview-template {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: color-mix(in srgb, var(--panel) 90%, white);
}

.library-preview-template-item {
  position: absolute;
  display: block;
  overflow: hidden;
  padding: 2px;
  line-height: 1.25;
  transform-origin: center;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.library-preview-arrow {
  padding: 0;
  overflow: visible;
}

.library-preview-arrow svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.library-preview-template-image {
  padding: 0;
  border: 0;
  background-position: center;
  background-size: contain;
  background-repeat: no-repeat;
}

.library-preview-image {
  display: block;
  width: auto;
  max-width: 240px;
  max-height: 170px;
  border-radius: 6px;
  object-fit: contain;
  background: color-mix(in srgb, var(--panel) 80%, white);
}

.library-preview-icon {
  display: grid;
  width: 88px;
  height: 88px;
  place-items: center;
  border: 0;
  border-radius: 999px;
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
}

.library-preview-icon-image {
  background-position: center;
  background-size: contain;
  background-repeat: no-repeat;
}

.library-preview-text,
.library-preview-empty {
  width: 240px;
  max-height: 150px;
  overflow: hidden;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: color-mix(in srgb, var(--panel) 86%, white);
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.library-preview-text-vertical {
  display: flex;
  align-items: flex-start;
}

.library-preview-text-vertical.align-center {
  justify-content: center;
}

.library-preview-text-vertical.align-right {
  justify-content: flex-end;
}

.library-preview-text-vertical span {
  writing-mode: vertical-rl;
  text-orientation: upright;
}

.library-preview-empty {
  color: var(--muted);
  text-align: center;
}

.icon-creator {
  display: grid;
  grid-template-columns: 1fr 64px;
  gap: 8px;
  margin-bottom: 10px;
}

.icon-creator.hidden {
  display: none;
}

.item-actions {
  display: flex;
  gap: 4px;
}

.library-folder-name mark {
  border-radius: 2px;
  background: color-mix(in srgb, var(--accent-detail) 26%, transparent);
  color: inherit;
}

.library-folder.search-match:not(.active) {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent-detail) 42%, transparent);
}

.project-item-actions {
  position: absolute;
  top: 50%;
  right: 0;
  display: flex;
  transform: translateY(-50%);
}

.item-action-icons {
  display: flex;
  gap: 4px;
}

.item-actions button {
  width: 24px;
  height: 24px;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
}

.item-actions button:hover {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.recent-open-button {
  width: auto !important;
  height: 20px !important;
  padding: 0 6px;
  border: 1px solid var(--line) !important;
  border-radius: 5px !important;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
}

.recent-open-button:hover {
  border-color: var(--accent-detail) !important;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.item-actions .remove-shared-button {
  width: auto;
  min-width: 82px;
  padding: 0 7px;
  border: 1px solid var(--line);
  font-size: 10px;
  font-weight: 700;
}

.item-actions .remove-shared-button:hover {
  border-color: var(--accent-detail);
}

.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: start center;
  padding-top: 12vh;
  background: rgba(8, 15, 22, 0.32);
}

.search-overlay.hidden {
  display: none;
}

.search-dialog {
  width: min(760px, calc(100vw - 48px));
  max-height: 76vh;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-strong);
  box-shadow: var(--shadow);
}

.search-box {
  display: grid;
  grid-template-columns: 30px 1fr 36px;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}

.search-box-icon {
  display: grid;
  place-items: center;
  color: var(--muted);
}

.search-box-icon .search-icon {
  width: 18px;
  height: 18px;
}

.search-box input {
  height: 42px;
  border: 0;
  background: transparent;
  font-size: 17px;
}

.search-filters {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
}

.search-filters label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.search-filters input {
  width: 15px;
  height: 15px;
  accent-color: var(--accent-strong);
}

.toast {
  position: fixed;
  inset: auto auto 28px 50%;
  z-index: 120;
  margin: 0;
  border: 0;
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--text);
  color: var(--panel);
  font-size: 13px;
  transform: translateX(-50%);
  box-shadow: var(--shadow);
}

.toast.hidden {
  display: none;
}

.canvas-stage.panning {
  cursor: grabbing;
}

.canvas-stage.pan-ready:not(.panning) {
  cursor: grab;
}

.canvas-stage.creating {
  cursor: crosshair;
}

.canvas-stage.selecting {
  cursor: default;
}

.context-menu {
  position: fixed;
  z-index: 130;
  min-width: 168px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-strong);
  box-shadow: var(--shadow);
}

.context-menu.hidden {
  display: none;
}

.context-menu-group + .context-menu-group {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid var(--line);
}

.context-menu button {
  display: block;
  width: 100%;
  height: 32px;
  padding: 0 10px;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  text-align: left;
  font-size: 13px;
}

.context-menu button:hover {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.tooltip {
  position: fixed;
  z-index: 140;
  max-width: 220px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--text);
  color: var(--panel);
  font-size: 12px;
  pointer-events: none;
  box-shadow: var(--shadow);
}

.tooltip.hidden {
  display: none;
}
