﻿:root {
  --shell-sidebar-width: 314px;
}

#app {
  width: 100%;
  height: 100%;
}

button:disabled,
input:disabled,
select:disabled {
  opacity: var(--disabled-opacity);
  cursor: not-allowed;
  pointer-events: none;
}

.boot-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  grid-auto-flow: column;
  gap: 10px;
  color: var(--text-secondary);
}

.spinner {
  width: 15px;
  height: 15px;
  border: 2px solid var(--stroke);
  border-top-color: var(--accent-bright);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.workspace {
  --shell-sidebar-footer-height: 82px;
  --shell-card-wall-left: 32px;
  --shell-card-wall-right: 89px;
  --shell-scrollbar-width: var(--app-scrollbar-width);
  display: grid;
  grid-template-columns: var(--shell-sidebar-width) minmax(0, 1fr);
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: var(--canvas);
  animation: none;
  position: relative;
}

.workspace.is-resizing-sidebar {
  user-select: none;
  cursor: ew-resize;
}

.library-sidebar-resizer {
  position: absolute;
  z-index: 30;
  top: 0;
  bottom: 0;
  left: calc(var(--shell-sidebar-width) - 7px);
  width: 14px;
  cursor: ew-resize;
  touch-action: none;
  outline: none;
}

.library-sidebar-resizer::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 6px;
  width: 1px;
  background: transparent;
}

.library-sidebar-resizer:hover::after,
.library-sidebar-resizer:focus-visible::after,
.workspace.is-resizing-sidebar .library-sidebar-resizer::after {
  background: var(--accent);
}

.library-sidebar {
  --sidebar: #1d1e22;
  --field: #191b21;
  --surface-0: #17181a;
  --surface-1: #222325;
  --surface-2: #2c2d30;
  --stroke: #3a3c40;
  --stroke-soft: #2b2d30;
  --stroke-strong: #55585f;
  --text: #f1f2f4;
  --text-secondary: #a2a5ac;
  --text-muted: #6f737b;
  --accent: #688bff;
  --accent-soft: rgba(104, 139, 255, 0.2);
  --accent-bright: #688bff;
  --hover-soft: rgba(255, 255, 255, 0.055);
  --interaction-hover: rgba(255, 255, 255, 0.065);
  --interaction-pressed: rgba(104, 139, 255, 0.18);
  --sidebar-nav-text: #e7e8eb;
  --sidebar-nav-muted: #969aa3;
  --sidebar-icon: #a1a5ad;
  --sidebar-selection-accent: #688bff;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-right: 0;
  background: var(--sidebar);
  color: var(--text);
  font-family: "Noto Sans SC", "Segoe UI", sans-serif;
  font-size: 12px;
  font-weight: 400;
  position: relative;
}

.workspace--embedded {
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  animation: none;
}

.workspace--embedded .library-main {
  grid-column: 1;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}

.library-sidebar::after {
  position: absolute;
  z-index: 29;
  top: 0;
  right: 0;
  bottom: 0;
  width: 1px;
  background: #2f333c;
  content: "";
  pointer-events: none;
}

:root[data-theme="light"] .library-sidebar {
  --sidebar: #fbfcfe;
  --field: #f3f5f8;
  --surface-0: #ffffff;
  --surface-1: #f0f2f6;
  --surface-2: #e7eaf0;
  --stroke: #d5d9e2;
  --stroke-soft: #e3e6ec;
  --stroke-strong: #b9c0cc;
  --text: #20232a;
  --text-secondary: #626978;
  --text-muted: #8a919f;
  --accent: #688bff;
  --accent-soft: rgba(104, 139, 255, 0.1);
  --accent-bright: #688bff;
  --hover-soft: rgba(31, 38, 53, 0.055);
  --interaction-hover: rgba(31, 38, 53, 0.065);
  --interaction-pressed: rgba(104, 139, 255, 0.13);
  --sidebar-nav-text: #20232a;
  --sidebar-nav-muted: #626978;
  --sidebar-icon: #626978;
  --sidebar-selection-accent: #688bff;
}

:root[data-theme="light"] .library-sidebar::after {
  background: #d5d9e2;
}

.sidebar-head {
  min-height: 113px;
  padding: 12px 10px 0;
  width: 100%;
  box-sizing: border-box;
  border-bottom: 1px solid #2f3338;
  box-shadow: none;
  position: relative;
}

.sidebar-head::before {
  position: absolute;
  left: 10px;
  right: 10px;
  top: 12px;
  bottom: 0;
  background: #181a20;
  content: "";
}

:root[data-theme="light"] .sidebar-head {
  border-bottom-color: #d5d9e2;
}

:root[data-theme="light"] .sidebar-head::before {
  background: #ffffff;
}

.sidebar-head > * {
  position: relative;
  z-index: 1;
}

.canvas-brand-row,
.library-toolbar,
.section-label,
.board-title-row,
.board-meta,
.empty-actions {
  display: flex;
  align-items: center;
}

.canvas-brand-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 72px;
  min-height: 36px;
  align-items: center;
  gap: 8px;
}

.sidebar-brand-action {
  display: flex;
  width: 72px;
  height: 28px;
  padding: 0 8px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  align-self: center;
  margin-top: 0;
  transform: translateY(4px);
}

.sidebar-brand-action:focus-visible {
  outline: none;
}

.sidebar-brand-action:hover {
  background: var(--hover-soft);
  color: var(--text);
}

.canvas-brand-logo {
  display: block;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  object-fit: contain;
  box-shadow: none;
  transform: translateY(8px);
}

.canvas-brand-logo:not(img) {
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #111214;
  font-size: 20px;
  font-weight: 700;
}

.canvas-brand-row > div {
  min-width: 0;
  display: flex;
  height: 36px;
  align-items: center;
  transform: translateY(8px);
}

.canvas-brand-row strong {
  position: static;
  overflow: hidden;
  font-size: 14px;
  line-height: 23px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-theme-button {
  width: 28px;
  height: 28px;
}

.theme-toggle-button {
  display: grid;
  padding: 0;
  place-items: center;
}

.theme-toggle-glyph {
  position: relative;
  display: block;
  width: 14px;
  height: 14px;
  overflow: hidden;
  border: 1.1px solid #9a9faa;
  border-radius: 50%;
  background: #eceef3;
}

.theme-toggle-glyph::after {
  position: absolute;
  top: 0;
  right: 0;
  width: 50%;
  height: 100%;
  border: 0;
  border-radius: 0 50% 50% 0;
  background: #303339;
  content: "";
}

.canvas-workspace-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3px;
  height: 31px;
  margin-top: 26px;
  padding: 2px;
  border: 1px solid #3e4147;
  border-radius: 8px;
  background: #1f2023;
}

.canvas-workspace-switch button {
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #979ba4;
  cursor: pointer;
  font-size: 11px;
  font-weight: 400;
}

.canvas-workspace-switch button:hover {
  color: var(--text);
}

.canvas-workspace-switch button.is-active {
  background: #36383d;
  color: #f4f5f8;
  box-shadow: none;
}

:root[data-theme="light"] .canvas-workspace-switch {
  border-color: #d5d9e2;
  background: #f0f2f6;
}

:root[data-theme="light"] .canvas-workspace-switch button {
  color: #626978;
}

:root[data-theme="light"] .canvas-workspace-switch button.is-active {
  background: #dce0e8;
  color: #20232a;
}

.icon-button,
.primary-button,
.secondary-button,
.segmented-button {
  min-width: 34px;
  min-height: 34px;
  height: var(--control-hit-size);
  border: 1px solid var(--stroke);
  border-radius: 9px;
  background: var(--surface-1);
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, transform 120ms ease;
}

.icon-button:hover,
.secondary-button:hover,
.segmented-button:hover {
  background: var(--surface-2);
  border-color: var(--stroke-strong);
}

.icon-button:active,
.primary-button:active,
.secondary-button:active {
  transform: translateY(1px);
}

.primary-button {
  padding: 0 14px;
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

.primary-button:hover {
  background: #7b9aff;
  color: #fff;
}

.secondary-button {
  padding: 0 13px;
}

.sidebar-scroll {
  min-height: 0;
  flex: 1;
  overflow: auto;
  padding: 10px 28px 18px 10px;
  scrollbar-gutter: stable;
}

.sidebar-scroll {
  scrollbar-width: none;
}

.sidebar-scroll::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.sidebar-stable-scrollbar {
  position: absolute;
  z-index: 14;
  right: 15px;
  width: 5px;
  border-radius: 999px;
  background: transparent;
  cursor: default;
  touch-action: none;
}

.sidebar-stable-scrollbar[hidden] {
  display: none;
}

.sidebar-stable-scrollbar-thumb {
  width: 5px;
  min-height: 42px;
  border-radius: 999px;
  background: var(--app-scrollbar-thumb);
  transition: background-color 120ms ease;
  will-change: transform;
}

.sidebar-stable-scrollbar:hover .sidebar-stable-scrollbar-thumb {
  background: var(--app-scrollbar-thumb-hover);
}

.sidebar-stable-scrollbar.is-dragging .sidebar-stable-scrollbar-thumb {
  background: var(--app-scrollbar-thumb-active);
}

.sidebar-commands {
  flex: 0 0 var(--shell-sidebar-footer-height, 82px);
  display: grid;
  grid-template-rows: 34px 48px;
  height: var(--shell-sidebar-footer-height, 82px);
  min-height: var(--shell-sidebar-footer-height, 82px);
  gap: 0;
  padding: 0 10px;
  margin-bottom: 12px;
  width: 100%;
  box-sizing: border-box;
  background: var(--sidebar);
}

.sidebar-library-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  height: 34px;
  padding: 2px;
  gap: 4px;
  box-sizing: border-box;
  background: #181a20;
}

:root[data-theme="light"] .sidebar-library-actions {
  background: #f0f2f6;
}

.sidebar-library-actions button {
  display: flex;
  min-width: 0;
  min-height: 30px;
  height: 30px;
  padding: 0 10px;
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 11px;
  font-weight: 400;
  transition:
    background-color var(--motion-fast) ease,
    color var(--motion-fast) ease;
}

.footer-action-icon {
  position: relative;
  display: inline-block;
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}

.footer-action-icon.is-open {
  height: 10px;
  border: 1px solid currentColor;
  border-radius: 2px;
}

.footer-action-icon.is-open::before {
  content: "";
  position: absolute;
  left: 1px;
  top: -4px;
  width: 6px;
  height: 4px;
  border: 1px solid currentColor;
  border-bottom: 0;
  border-radius: 2px 2px 0 0;
}

.footer-action-icon.is-refresh {
  border: 1.4px solid currentColor;
  border-left-color: transparent;
  border-radius: 50%;
}

.footer-action-icon.is-refresh::after {
  content: "";
  position: absolute;
  right: -2px;
  top: -1px;
  border: 3px solid transparent;
  border-left-color: currentColor;
  transform: rotate(-35deg);
}

.sidebar-library-actions button:hover {
  background: var(--hover-soft);
  color: var(--text);
}

.sidebar-category-composer {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 58px;
  height: 32px;
  align-items: center;
  align-self: center;
  gap: 8px;
}

.sidebar-category-composer button,
.sidebar-category-composer input {
  min-width: 0;
  height: 32px;
  border: 1px solid var(--stroke);
  border-radius: 9px;
  background: var(--field);
  color: var(--text);
  font-size: 12px;
  font-weight: 400;
}

.sidebar-category-composer .sidebar-theme-button {
  height: 28px;
  border-color: transparent;
  background: transparent;
  cursor: pointer;
}

.sidebar-category-composer .sidebar-theme-button:hover {
  border-color: var(--stroke);
  background: var(--surface-1);
}

.sidebar-category-composer input {
  padding: 0 11px;
  border-color: transparent;
  outline: none;
}

.sidebar-category-composer input:focus {
  border-color: var(--accent-bright);
  box-shadow: 0 0 0 3px rgba(104, 139, 255, 0.12);
}

.sidebar-category-composer .sidebar-add-category {
  border-color: transparent;
  background: transparent;
  cursor: pointer;
}

.sidebar-category-composer .sidebar-add-category:hover {
  border-color: var(--stroke-strong);
  background: var(--surface-1);
}

.sidebar-scroll::-webkit-scrollbar,
.board-grid::-webkit-scrollbar {
  width: var(--shell-scrollbar-width);
}

.sidebar-scroll::-webkit-scrollbar-track,
.board-grid::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-scroll::-webkit-scrollbar-thumb,
.board-grid::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: var(--app-scrollbar-thumb);
  background-clip: padding-box;
}

.sidebar-scroll::-webkit-scrollbar-thumb:hover,
.board-grid::-webkit-scrollbar-thumb:hover {
  background: var(--app-scrollbar-thumb-hover);
  background-clip: padding-box;
}

.section-label {
  height: 29px;
  margin-top: 8px;
  padding: 0 6px;
  width: 100%;
  border: 0;
  background: transparent;
  justify-content: flex-start;
  color: var(--sidebar-nav-muted);
  font-family: inherit;
  font-size: 11px;
  font-weight: 400;
  text-align: left;
  cursor: pointer;
}

.section-label:hover {
  background: var(--hover-soft);
  color: var(--text);
}

.section-label:focus-visible {
  outline: 1px solid var(--accent-bright);
  outline-offset: -1px;
}

.section-label-copy {
  display: flex;
  align-items: center;
  gap: 4px;
}

.section-chevron {
  display: block;
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.15;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform var(--motion-fast) ease;
}

.section-label[aria-expanded="false"] .section-chevron {
  transform: rotate(-90deg);
}

.nav-row,
.folder-row {
  position: relative;
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) 42px;
  column-gap: 9px;
  align-items: center;
  width: 100%;
  min-height: 29px;
  height: 29px;
  margin-bottom: 0;
  padding: 0 10px 0 12px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--sidebar-nav-text);
  text-align: left;
  cursor: pointer;
  font-size: 12px;
  font-weight: 400;
  transition: background 140ms ease, color 140ms ease;
}

.folder-row {
  grid-template-columns: 14px 16px minmax(0, 1fr) 42px;
  column-gap: 5px;
  padding-right: 10px;
}

.nav-row:hover,
.folder-row:hover {
  background: var(--hover-soft);
  color: var(--text);
}

.nav-row.is-active,
.folder-row.is-active {
  background: #292a2f;
  color: var(--sidebar-nav-text);
}

:root[data-theme="light"] .nav-row.is-active,
:root[data-theme="light"] .folder-row.is-active {
  background: #e7eaf0;
}

:root[data-theme="light"] .nav-row.is-active .row-count,
:root[data-theme="light"] .folder-row.is-active .row-count {
  color: #626978;
}

.nav-row.is-active .row-count,
.folder-row.is-active .row-count {
  color: #cdd2dc;
}

.nav-row.is-active::before,
.folder-row.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 5px;
  bottom: 5px;
  width: 2px;
  border-radius: 2px;
  background: var(--sidebar-selection-accent);
}

.row-icon {
  width: 15px;
  height: 12px;
  border: 1px solid currentColor;
  border-radius: 3px;
  opacity: 0.85;
}

.row-icon.all {
  position: relative;
  width: 14px;
  height: 12px;
  border-radius: 1px;
}

.row-icon.all::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 2px;
  bottom: 2px;
  width: 2px;
  border-radius: 1px;
  background: var(--accent-bright);
}

.row-icon.recent {
  position: relative;
  width: 14px;
  height: 14px;
  border-radius: 50%;
}

.row-icon.recent::before,
.row-icon.recent::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 3px;
  width: 1px;
  height: 4px;
  border-radius: 1px;
  background: currentColor;
  transform-origin: 50% 100%;
}

.row-icon.recent::after {
  transform: rotate(-55deg);
}

.row-icon.folder {
  position: relative;
}

.row-icon.favorites {
  display: grid;
  height: 16px;
  place-content: center;
  border: 0;
  color: #e6b655;
  font-size: 14px;
}

.row-icon.favorites::before {
  content: "★";
}

.row-icon.folder::before {
  content: "";
  position: absolute;
  left: 1px;
  top: -4px;
  width: 7px;
  height: 4px;
  border: 1px solid currentColor;
  border-bottom: 0;
  border-radius: 2px 2px 0 0;
  background: var(--sidebar);
}

.row-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-count {
  display: block;
  width: 42px;
  min-width: 42px;
  height: 29px;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: var(--sidebar-nav-muted);
  font-size: 12px;
  line-height: 29px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.row-icon-svg {
  display: block;
  width: 16px;
  height: 16px;
  overflow: visible;
  color: var(--sidebar-icon);
  opacity: 1;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.row-icon-svg .icon-accent-fill {
  fill: currentColor;
  stroke: none;
}

.row-icon-svg .folder-outline {
  stroke: var(--sidebar-icon);
}

.row-icon-svg .folder-accent-dot {
  fill: currentColor;
  stroke: none;
}

.row-icon-svg.folder-color-blue { color: #6f91ff; }
.row-icon-svg.folder-color-purple { color: #a66cff; }
.row-icon-svg.folder-color-green { color: #52c78f; }
.row-icon-svg.folder-color-orange { color: #ffb454; }
.row-icon-svg.folder-color-red { color: #f05b68; }
.row-icon-svg.folder-color-neutral { color: #a2a5ac; }

.footer-action-glyph {
  display: block;
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.folder-tree {
  position: relative;
}

.folder-outdent-indicator {
  position: absolute;
  z-index: 5;
  top: var(--folder-outdent-top, 0);
  right: 10px;
  left: var(--folder-outdent-left, 9px);
  height: 2px;
  border-radius: 2px;
  background: var(--accent-bright);
  box-shadow: 0 0 0 1px rgba(104, 139, 255, 0.18), 0 0 8px rgba(104, 139, 255, 0.58);
  opacity: 0;
  pointer-events: none;
}

.folder-tree.is-folder-outdent-target .folder-outdent-indicator {
  opacity: 1;
}

.folder-tree::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 5px;
  bottom: 5px;
  width: 1px;
  background: #383a40;
  pointer-events: none;
}

:root[data-theme="light"] .folder-tree::before {
  background: #d5d9e2;
}

.folder-row {
  padding-left: 9px;
}

.folder-row.depth-2 { padding-left: 25px; }
.folder-row.depth-3 { padding-left: 41px; }
.folder-row.depth-4 { padding-left: 57px; }
.folder-row.depth-5 { padding-left: 73px; }

.folder-color-blue { color: #6f91ff; }
.folder-color-purple { color: #a66cff; }
.folder-color-green { color: #52c78f; }
.folder-color-orange { color: #ffb454; }
.folder-color-red { color: #f05b68; }
.folder-color-neutral { color: #a2a5ac; }

.folder-toggle {
  display: grid;
  place-content: center;
  width: 14px;
  height: 22px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.folder-chevron {
  display: block;
  width: 6px;
  height: 6px;
  border-right: 1.2px solid currentColor;
  border-bottom: 1.2px solid currentColor;
  transform: rotate(45deg) translate(-1px, -1px);
  transition: transform var(--motion-fast) ease;
}

.folder-toggle[aria-expanded="false"] .folder-chevron {
  transform: rotate(-45deg);
}

.folder-toggle.is-empty {
  visibility: hidden;
}

.row-icon.trash {
  position: relative;
  width: 12px;
  height: 14px;
  margin-left: 2px;
  border-radius: 2px 2px 4px 4px;
}

.row-icon.trash::before {
  content: "";
  position: absolute;
  left: -2px;
  top: -4px;
  width: 14px;
  height: 2px;
  border-top: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
}

.row-icon.trash::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 4px;
  height: 7px;
  border-right: 1px solid currentColor;
  border-left: 1px solid currentColor;
}

.folder-row,
.nav-row[data-drop-folder] {
  transition: background 140ms ease, color 140ms ease, box-shadow 140ms ease, transform 160ms ease;
}

.is-drop-target {
  background: rgba(104, 139, 255, 0.18) !important;
  box-shadow: inset 0 0 0 1px var(--accent-bright);
}

.is-drop-invalid {
  background: rgba(240, 91, 104, 0.11) !important;
  box-shadow: inset 0 0 0 1px rgba(240, 91, 104, 0.68);
}

[data-drop-folder].is-drop-target,
[data-drop-folder].is-drop-invalid {
  z-index: 3;
  transform: translateX(4px);
}

[data-drop-folder][data-drop-hint]::after {
  position: absolute;
  z-index: 3;
  right: 8px;
  max-width: 72%;
  padding: 3px 7px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--accent-bright) 58%, var(--stroke));
  border-radius: 6px;
  background: color-mix(in srgb, var(--surface-2) 94%, transparent);
  color: var(--text);
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.2);
  content: attr(data-drop-hint);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.is-dragging {
  opacity: 0.45;
}

.library-main {
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  container-type: inline-size;
  padding: 10px 12px 0;
  background:
    radial-gradient(circle at 30% 0, rgba(39, 47, 65, 0.16), transparent 34%),
    var(--canvas);
}

.library-toolbar {
  --library-toolbar-search-min: 238px;
  --library-toolbar-search-max: 320px;
  --library-toolbar-filter-width: 140px;
  --library-toolbar-density-min: 218px;
  --library-toolbar-sort-width: 168px;
  --library-toolbar-select-width: 70px;
  --library-toolbar-new-width: 70px;
  flex: 0 0 52px;
  display: grid;
  grid-template-columns: minmax(var(--library-toolbar-search-min), var(--library-toolbar-search-max)) minmax(0, 1fr);
  align-items: center;
  min-height: 52px;
  height: 52px;
  padding: 9px 20px 13px 22px;
  column-gap: 8px;
  overflow: hidden;
  border-bottom: 0;
  background: color-mix(in srgb, var(--canvas) 92%, transparent);
}

.library-toolbar-search {
  position: relative;
  min-width: 0;
  max-width: none;
  width: 100%;
  height: 32px;
  transform: translateY(1px);
  margin-right: 0;
}

.library-toolbar-search input {
  width: 100%;
  height: 100%;
  padding: 0 14px 0 34px;
  border: 1px solid transparent;
  border-radius: 18px;
  outline: none;
  background: var(--surface-1);
  color: var(--text);
  font: 500 11px/32px var(--font);
  transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.library-toolbar-search input:focus {
  border-color: color-mix(in srgb, var(--accent-bright) 58%, var(--stroke));
  background: var(--surface-2);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-bright) 12%, transparent);
}

.toolbar-search-icon {
  position: absolute;
  z-index: 1;
  left: 13px;
  top: 9px;
  width: 11px;
  height: 11px;
  border: 1.5px solid var(--text-muted);
  border-radius: 50%;
  pointer-events: none;
}

.toolbar-search-icon::after {
  position: absolute;
  right: -4px;
  bottom: -3px;
  width: 5px;
  height: 1.5px;
  border-radius: 1px;
  background: var(--text-muted);
  content: "";
  transform: rotate(45deg);
}

.library-heading {
  min-width: 0;
  margin-right: auto;
}

.library-heading h1 {
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 16px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-heading p {
  margin: 3px 0 0;
  color: var(--text-muted);
  font-size: 11px;
}

.library-toolbar-actions {
  min-width: 0;
  display: grid;
  grid-template-columns: var(--library-toolbar-filter-width) minmax(var(--library-toolbar-density-min), 1fr) var(--library-toolbar-sort-width) var(--library-toolbar-select-width) var(--library-toolbar-new-width);
  align-items: center;
  gap: 8px;
}

.library-toolbar-actions.is-trash {
  --library-toolbar-new-width: 118px;
}

.library-toolbar-danger-action {
  min-width: 118px !important;
  white-space: nowrap;
}

.library-filter-cluster {
  display: flex;
  width: 100%;
  min-width: 0;
  height: 30px;
  align-items: center;
  gap: 0;
  padding-left: 4px;
}

.library-toolbar-actions > .secondary-button,
.library-toolbar-actions > .primary-button {
  width: 100%;
  min-width: 0;
  min-height: 30px;
  height: 30px;
  padding: 0 10px;
  position: relative;
  top: 1px;
}

.library-icon-button,
.secondary-button {
  min-width: 34px;
  min-height: 30px;
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--stroke);
  border-radius: 9px;
  background: var(--surface-1);
  color: var(--text-secondary);
  font: 600 11px/28px var(--font);
  cursor: pointer;
}

.library-icon-button {
  width: 30px;
  min-width: 30px;
  padding: 0;
  border-color: transparent;
  background: transparent;
  font-size: 18px;
}

.toolbar-icon-glyph {
  display: block;
  width: 16px;
  height: 16px;
  margin: auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.55;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.toolbar-pin-glyph {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}

.library-icon-button:hover,
.library-icon-button.is-active,
.secondary-button:hover,
.secondary-button.is-active {
  border-color: color-mix(in srgb, var(--accent-bright) 52%, var(--stroke));
  background: color-mix(in srgb, var(--accent-bright) 13%, var(--surface-1));
  color: var(--text);
}

.library-result-count {
  display: inline-flex;
  flex: 0 0 58px;
  width: 58px;
  min-width: 58px;
  max-width: 58px;
  height: 22px;
  padding: 0 6px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--stroke-soft);
  border-radius: 13px;
  background: var(--surface-1);
  color: var(--text-secondary);
  font-size: 11px;
  white-space: nowrap;
}

.library-density-control {
  display: flex;
  width: 100%;
  min-width: 0;
  height: 30px;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 11px;
  white-space: nowrap;
}

.library-density-control input {
  flex: 1 1 auto;
  min-width: 84px;
  width: auto;
  max-width: 360px;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  cursor: pointer;
}

.library-toolbar-search input::placeholder {
  color: #757575;
  opacity: 1;
}

.library-density-control input::-webkit-slider-runnable-track {
  width: 100%;
  height: 8px;
  border: 0;
  border-radius: 4px;
  background: linear-gradient(
    to right,
    var(--accent-bright) 0,
    var(--accent-bright) var(--library-density-progress, 0%),
    #3b3b3b var(--library-density-progress, 0%),
    #3b3b3b 100%
  );
}

:root[data-theme="light"] .library-density-control input::-webkit-slider-runnable-track {
  background: linear-gradient(
    to right,
    var(--accent-bright) 0,
    var(--accent-bright) var(--library-density-progress, 0%),
    var(--stroke) var(--library-density-progress, 0%),
    var(--stroke) 100%
  );
}

.library-density-control input::-webkit-slider-thumb {
  width: 15px;
  height: 15px;
  margin-top: -3.5px;
  border: 0;
  border-radius: 50%;
  -webkit-appearance: none;
  appearance: none;
  background: var(--accent-bright);
}

.library-density-control input:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 2px var(--canvas), 0 0 0 4px var(--accent-bright);
}

.library-density-control strong {
  min-width: 26px;
  color: var(--text);
  font-size: 11px;
  font-weight: 650;
}

.sort-control {
  display: flex;
  width: 100%;
  height: 30px;
  padding: 0;
  align-items: center;
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--stroke);
  border-radius: 9px;
  background: var(--surface-1);
  color: var(--text-muted);
  font-size: 10px;
  box-sizing: border-box;
  white-space: nowrap;
}

.sort-control-icon {
  display: grid;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  place-items: center;
  pointer-events: none;
}

.sort-control-glyph {
  width: 12px;
  height: 12px;
  stroke-width: 1.35;
}

/* Match the prompt-library toolbar's internal spacing without allowing any
   child to absorb the fixed slots declared by .library-toolbar-actions. */
.library-toolbar-actions {
  position: relative;
}

.library-filter-cluster .library-icon-button + .library-icon-button {
  margin-left: 4px;
}

.library-filter-cluster .library-result-count {
  flex: 0 0 58px;
  width: 58px;
  min-width: 58px;
  max-width: 58px;
  margin-left: 8px;
  padding-left: 6px;
  justify-content: center;
}

.library-density-control {
  max-width: none;
  padding-left: 0;
  gap: 8px;
  box-sizing: border-box;
}

.library-density-control > span {
  flex: 0 0 29px;
  width: 29px;
}

.library-density-control > span,
.library-density-control > strong {
  position: relative;
  top: -1px;
}

.library-density-control input {
  flex: 1 1 auto;
  width: auto;
  min-width: 74px;
  max-width: none;
  height: 28px;
  margin-left: 8px;
  padding: 0;
  box-sizing: border-box;
}

.library-density-control strong {
  flex: 0 0 28px;
  width: 28px;
  min-width: 28px;
  margin-left: 8px;
}

.sort-control {
  margin-left: 0;
  margin-right: 0;
}

.sort-select {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  min-height: 30px;
  height: 30px;
  padding: 0 30px 0 2px;
  border: 0;
  border-radius: 0;
  background: transparent;
  outline: none;
  color: var(--text-secondary);
  font: 600 11px/30px var(--font);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.button-plus {
  margin-right: 5px;
  font-size: 16px;
  font-weight: 450;
}

.board-grid {
  min-height: 0;
  flex: 1;
  display: grid;
  grid-template-columns: repeat(var(--library-columns, 3), minmax(0, 1fr));
  grid-auto-rows: max-content;
  gap: 18px;
  align-content: start;
  overflow-x: hidden;
  overflow-y: scroll;
  padding: 18px var(--shell-card-wall-right) 44px var(--shell-card-wall-left);
  scrollbar-gutter: stable;
}

.board-card {
  position: relative;
  min-width: 0;
  border: 1px solid var(--stroke-soft);
  border-radius: 12px;
  background: var(--card);
  overflow: hidden;
  cursor: pointer;
  contain: layout paint;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 160ms ease;
}

.board-card.is-selected {
  border-color: var(--accent-bright);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-bright) 22%, transparent);
}

.board-selection-check {
  appearance: none;
  padding: 0;
  cursor: pointer;
  font: inherit;
  pointer-events: auto;
  position: absolute;
  z-index: 4;
  left: 10px;
  top: 10px;
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--accent-bright) 65%, var(--stroke));
  border-radius: 7px;
  background: color-mix(in srgb, var(--surface-2) 92%, transparent);
  color: #fff;
  font-size: 13px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.24);
}

.board-card.is-selected .board-selection-check {
  background: var(--accent-bright);
}

.board-card:hover {
  border-color: #4d5056;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.24);
  transform: translateY(-1px);
}

.workspace.is-board-dragging,
.workspace.is-board-dragging .board-grid {
  cursor: grabbing;
  user-select: none;
}

.workspace.is-board-dragging .board-card:hover {
  transform: none;
}

.board-card.is-board-placeholder {
  border-color: color-mix(in srgb, var(--accent-bright) 68%, var(--stroke));
  border-style: dashed;
  opacity: 0.16;
  box-shadow: inset 0 0 0 1px var(--selection-halo);
  transform: none;
}

.board-drag-preview {
  position: fixed;
  z-index: 10020;
  top: 0;
  left: 0;
  margin: 0;
  pointer-events: none;
  opacity: 0.94;
  box-shadow: 0 22px 58px rgba(0, 0, 0, 0.38), 0 0 0 2px var(--selection-halo);
  cursor: grabbing;
  will-change: transform;
  transition:
    width 120ms cubic-bezier(.2,.8,.2,1),
    height 120ms cubic-bezier(.2,.8,.2,1),
    border-radius 120ms ease,
    opacity 120ms ease,
    box-shadow 120ms ease !important;
}

.board-drag-preview:hover {
  transform: none;
}

.board-drag-preview.is-sidebar-compact {
  border-color: color-mix(in srgb, var(--accent-bright) 66%, var(--stroke));
  border-radius: 7px;
  opacity: 0.88;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.32), 0 0 0 1px var(--selection-halo);
}

.board-drag-preview.is-sidebar-compact .board-preview {
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  border-bottom: 0;
}

.board-drag-preview.is-sidebar-compact .board-preview-badge,
.board-drag-preview.is-sidebar-compact .board-card-body {
  display: none;
}

.board-drag-preview.is-sidebar-compact .board-preview img {
  animation: none;
}

.board-card.is-reorder-before,
.board-card.is-reorder-after {
  border-color: var(--accent-bright);
  box-shadow: 0 0 0 2px var(--selection-halo), 0 12px 30px rgba(0, 0, 0, 0.24);
}

.board-card.is-reorder-before::before,
.board-card.is-reorder-after::after {
  position: absolute;
  z-index: 4;
  left: 10px;
  right: 10px;
  height: 3px;
  border-radius: 999px;
  background: var(--accent-bright);
  content: "";
}

.board-card.is-reorder-before::before { top: -7px; }
.board-card.is-reorder-after::after { bottom: -7px; }

.board-card:focus-visible {
  border-color: var(--accent-bright);
  outline: 2px solid var(--selection-halo);
  outline-offset: 2px;
}

.board-card.is-deleted {
  opacity: 0.72;
}

.board-card.is-deleted .board-preview {
  filter: grayscale(0.75);
}

.board-card.is-favorite {
  border-color: rgba(230, 182, 85, 0.34);
}

.board-preview {
  position: relative;
  aspect-ratio: 16 / 9;
  border-bottom: 1px solid var(--stroke-soft);
  background-color: #151618;
  background-image: radial-gradient(#303238 0.8px, transparent 0.8px);
  background-size: 18px 18px;
}

:root[data-theme="light"] .board-preview {
  background-color: #f5f6f8;
  background-image: radial-gradient(#e0e2e6 0.8px, transparent 0.8px);
}

.board-preview-badge {
  position: absolute;
  z-index: 2;
  right: 10px;
  left: auto;
  top: 10px;
  max-width: calc(100% - 52px);
  overflow: hidden;
  box-sizing: border-box;
  min-height: 22px;
  padding: 3px 8px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 7px;
  background: rgba(20, 21, 24, 0.76);
  color: rgba(255, 255, 255, 0.78);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
  line-height: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
  backdrop-filter: blur(8px);
}

.board-preview::after {
  content: "";
  position: absolute;
  inset: 26% 24%;
  border: 1px solid #34363a;
  border-radius: 6px;
  background: #202124;
  box-shadow: 28px 18px 0 -3px #202124, -20px 28px 0 -8px #202124;
}

:root[data-theme="light"] .board-preview::after {
  border-color: #d5d9e2;
  background: #e7eaf0;
  box-shadow: 28px 18px 0 -3px #e7eaf0, -20px 28px 0 -8px #e7eaf0;
}

.board-preview.has-thumbnail::after {
  display: none;
}

.board-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  animation: none;
}

.board-card-body {
  min-height: 88px;
  padding: 13px 14px 14px;
}

.board-title-row {
  min-height: var(--control-hit-size);
  gap: var(--space-2);
}

.board-title {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  font-size: 14px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board-card-actions {
  display: flex;
  flex: 0 0 auto;
  gap: var(--space-1);
}

.board-menu {
  min-width: 34px;
  min-height: 34px;
  width: var(--control-hit-size);
  height: var(--control-hit-size);
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.board-favorite,
.board-pin {
  min-width: 34px;
  min-height: 34px;
  width: var(--control-hit-size);
  height: var(--control-hit-size);
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #777b84;
  font-size: 15px;
  cursor: pointer;
}

.board-pin[aria-pressed="true"] {
  color: var(--accent-bright);
}

.board-favorite[aria-pressed="true"] {
  color: #e6b655;
}

.board-favorite:hover,
.board-pin:hover {
  background: var(--surface-2);
  color: #f1c76f;
}

.board-menu:hover {
  background: var(--surface-2);
  color: var(--text);
}

.board-meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-3);
  margin-top: var(--space-2);
  color: var(--text-muted);
  font-size: 11px;
}

.board-card-recency {
  color: var(--text-secondary);
}

.board-meta-detail {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.board-meta-detail .board-meta-count::before {
  content: "·";
  margin-right: 6px;
  color: var(--text-muted);
}

.board-meta-path,
.board-meta-count {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board-meta-count {
  font-variant-numeric: tabular-nums;
}

.empty-state {
  grid-column: 1 / -1;
  min-height: 55vh;
  display: grid;
  place-content: center;
  justify-items: center;
  color: var(--text-secondary);
  text-align: center;
}

.empty-mark {
  width: 62px;
  height: 48px;
  margin-bottom: 16px;
  border: 1px solid var(--stroke);
  border-radius: 10px;
  background:
    linear-gradient(135deg, transparent 50%, rgba(104, 139, 255, 0.12) 50%),
    var(--surface-1);
}

.empty-state h2 {
  margin: 0;
  color: var(--text);
  font-size: 15px;
}

.empty-state p {
  max-width: 330px;
  margin: 7px 0 17px;
  color: var(--text-muted);
  line-height: 1.65;
}

.empty-actions {
  gap: 8px;
}

.board-route {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--canvas);
  background-image: radial-gradient(#2b2d31 0.75px, transparent 0.75px);
  background-size: 20px 20px;
}

.board-route-head {
  position: absolute;
  left: 14px;
  top: 14px;
  z-index: 2;
  display: flex;
  align-items: center;
  height: 40px;
  padding: 4px;
  gap: 5px;
  border: 1px solid var(--stroke);
  border-radius: 11px;
  background: rgba(34, 35, 37, 0.96);
  box-shadow: var(--shadow-lg);
}

.board-route-title {
  max-width: 280px;
  padding: 0 10px 0 5px;
  overflow: hidden;
  font-weight: 620;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  color: var(--text-muted);
}

.toast-region {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  display: grid;
  gap: 8px;
}

.toast {
  position: relative;
  max-width: 360px;
  padding: 11px 15px 11px 35px;
  border: 1px solid var(--stroke);
  border-radius: 10px;
  background: color-mix(in srgb, var(--overlay-panel) 94%, var(--surface-2));
  box-shadow: var(--shadow-lg);
  animation: toast-in 160ms ease;
}

.toast::before {
  position: absolute;
  left: 13px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  content: "";
  transform: translateY(-50%);
}

.drop-progress {
  width: min(280px, calc(100vw - 36px));
  box-sizing: border-box;
  display: grid;
  padding: 12px 14px;
  border: 1px solid #555b63;
  border-radius: 9px;
  background: linear-gradient(135deg, #24272a, #202326);
  color: #f4f5f6;
  box-shadow: 0 10px 32px #0005, inset 0 0 0 1px #ffffff06;
}
.drop-progress::before { content: none; }
.drop-progress-title { font-size: 15px; line-height: 21px; font-weight: 650; }
.drop-progress-stats { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 7px; font-variant-numeric: tabular-nums; }
.drop-progress-stats strong { font-size: 25px; line-height: 29px; font-weight: 750; letter-spacing: -.8px; }
.drop-progress-stats span { font-size: 12px; line-height: 18px; color: #aeb5bf; white-space: nowrap; }
.drop-progress progress { appearance: none; display: block; width: 100%; height: 7px; margin-top: 7px; border: 0; border-radius: 999px; overflow: hidden; background: #40454b; }
.drop-progress progress::-webkit-progress-bar { background: linear-gradient(#44494f, #3b4046); border-radius: 999px; }
.drop-progress progress::-webkit-progress-value { background: linear-gradient(#688bff, #688bff); border-radius: 999px; }
.drop-progress button { justify-self: end; min-width: 60px; height: 28px; margin-top: 10px; padding: 0 12px; border: 1px solid #5a6068; border-radius: 6px; background: transparent; color: inherit; font-size: 13px; font-weight: 650; }
.drop-progress button:hover:not(:disabled) { background: #ffffff09; border-color: #838b96; }
.drop-progress button:active:not(:disabled) { background: #ffffff12; }
.drop-progress button:focus-visible { outline: 2px solid #688bff; outline-offset: 3px; }
.drop-progress button:disabled { opacity: .5; }

.toast.error,
.toast[data-tone="error"] {
  border-color: rgba(240, 91, 104, 0.55);
}

.toast[data-tone="error"]::before {
  background: var(--danger);
}

.toast[data-tone="success"] {
  border-color: color-mix(in srgb, var(--success) 42%, var(--stroke));
}

.context-menu {
  position: fixed;
  z-index: 18;
  width: 180px;
  padding: var(--overlay-padding);
  border: 1px solid var(--stroke);
  border-radius: var(--overlay-radius);
  background: color-mix(in srgb, var(--surface-2) 98%, transparent);
  box-shadow: var(--shadow-lg);
}

.context-menu[hidden] {
  display: none;
}

.context-menu-item {
  position: relative;
}

.context-menu-item.has-submenu > button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.context-submenu {
  position: absolute;
  z-index: 2;
  left: calc(100% - 4px);
  top: -7px;
  display: none;
  width: 190px;
  max-height: min(420px, calc(100vh - 24px));
  overflow: auto;
  padding: var(--overlay-padding);
  border: 1px solid var(--stroke);
  border-radius: var(--overlay-radius);
  background: color-mix(in srgb, var(--surface-2) 98%, transparent);
  box-shadow: var(--shadow-lg);
  overscroll-behavior: contain;
}

.context-menu.opens-left .context-submenu {
  right: calc(100% - 4px);
  left: auto;
}

.context-menu.opens-upward .context-submenu {
  top: auto;
  bottom: -7px;
}

.context-menu-item.has-submenu:hover > .context-submenu,
.context-menu-item.has-submenu:focus-within > .context-submenu,
.context-menu-item.has-submenu.is-open > .context-submenu {
  display: block;
}

.context-menu button.is-checked {
  color: var(--accent-bright);
}

.context-menu button {
  width: 100%;
  height: var(--overlay-control-height);
  padding: 0 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.context-menu button:hover,
.context-menu button:focus-visible {
  background: var(--hover-soft);
  outline: none;
}

.context-menu button.danger {
  color: #ff929b;
}

.context-separator {
  height: 1px;
  margin: 5px 7px;
  background: var(--stroke);
}

.busy-overlay {
  position: absolute;
  inset: 0;
  z-index: 16;
  display: grid;
  grid-auto-flow: column;
  place-content: center;
  gap: 9px;
  background: color-mix(in srgb, var(--overlay-scrim) 48%, transparent);
  color: var(--text-secondary);
  backdrop-filter: blur(1.5px);
}

.dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-content: center;
  background: var(--overlay-scrim);
  backdrop-filter: blur(4px);
  animation: overlay-enter 160ms linear both;
}

.canvas-dialog {
  width: min(390px, calc(100vw - 36px));
  padding: 18px;
  border: 1px solid var(--overlay-border);
  border-radius: 14px;
  background: var(--overlay-panel);
  box-shadow: var(--overlay-shadow);
  animation: dialog-enter 160ms linear both;
}

.dialog-title {
  margin-bottom: 16px;
  color: var(--text);
  font-size: 15px;
  font-weight: 650;
}

.dialog-label {
  display: block;
  margin-bottom: 7px;
  color: var(--text-secondary);
  font-size: 12px;
}

.dialog-input {
  width: 100%;
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--stroke);
  border-radius: 9px;
  background: var(--surface-0);
  outline: none;
}

.dialog-input:focus {
  border-color: var(--accent-bright);
  box-shadow: 0 0 0 3px rgba(104, 139, 255, 0.12);
}

.dialog-hint,
.dialog-error {
  min-height: 18px;
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 11px;
}

.dialog-error {
  color: #ff929b;
}

.dialog-message {
  margin: -2px 0 20px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

.danger-button {
  border-color: #c74350;
  background: #c74350;
}

.danger-button:hover {
  background: #d9505d;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(5px); }
}

@keyframes overlay-enter {
  from { opacity: 0; }
}

@keyframes dialog-enter {
  from {
    opacity: 0;
  }
}

@keyframes workspace-enter {
  from { opacity: 0; }
}

@keyframes thumbnail-reveal {
  from { opacity: 0; }
}

/* The library main box has 24px horizontal padding; 1096px content = 1120px toolbar host. */
@container (max-width: 1096px) {
  .library-toolbar {
    --library-toolbar-search-min: 210px;
    --library-toolbar-search-max: 280px;
    --library-toolbar-filter-width: 140px;
    --library-toolbar-density-min: 172px;
    --library-toolbar-sort-width: 148px;
    --library-toolbar-select-width: 72px;
    --library-toolbar-new-width: 74px;
    column-gap: 6px;
  }

  .library-toolbar-search {
    min-width: 0;
    max-width: none;
  }

  .library-toolbar-actions {
    gap: 6px;
  }

  .library-filter-cluster {
    width: 100%;
  }

  .library-filter-cluster .library-result-count {
    flex-basis: 58px;
    width: 58px;
    min-width: 58px;
    max-width: 58px;
  }

  .library-density-control {
    width: 100%;
    min-width: 0;
    max-width: none;
    padding-left: 0;
    gap: 6px;
  }

  .library-density-control > span {
    flex: 0 0 auto;
    width: auto;
  }

  .library-density-control input {
    flex: 1 1 auto;
    width: auto;
    min-width: 74px;
    max-width: 112px;
    height: auto;
    margin-left: 0;
  }

  .library-density-control strong {
    flex: 0 0 auto;
    width: auto;
    min-width: 26px;
    margin-left: 0;
  }

  .sort-control {
    width: 100%;
  }

  .library-toolbar-actions > .secondary-button,
  .library-toolbar-actions > .primary-button {
    width: 100%;
    min-width: 0;
    top: 0;
  }

  .library-toolbar-actions > .new-board-button {
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 900px) {
  .workspace:not(.workspace--embedded) {
    grid-template-columns: var(--shell-sidebar-width, 224px) minmax(0, 1fr);
  }

  .board-grid {
    padding: 18px 28px 44px 18px;
  }
}

/* The library main box has 24px horizontal padding; 876px content = 900px toolbar host. */
@container (max-width: 876px) {
  .library-toolbar {
    grid-template-columns: minmax(170px, 1fr) auto;
  }

  .library-toolbar-search {
    min-width: 0;
    max-width: none;
  }

  .library-toolbar-actions {
    grid-template-columns: var(--library-toolbar-filter-width) var(--library-toolbar-select-width) var(--library-toolbar-new-width);
  }

  .library-density-control,
  .sort-control {
    display: none;
  }
}

@container (max-width: 696px) {
  .library-toolbar {
    padding-inline: 8px;
  }
}

@media (max-width: 720px) {
  .board-grid {
    gap: 18px;
    padding: 18px 28px 44px 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }

  .workspace,
  .board-preview img {
    animation: none !important;
  }
}

.ai-task-region { position: fixed; right: 24px; bottom: 72px; width: min(350px, calc(100vw - 32px)); display: flex; flex-direction: column; gap: 10px; z-index: 1500; pointer-events: none; }
.ai-task-card { position: relative; box-sizing: border-box; width: 100%; min-width: 0; flex-shrink: 0; transition: opacity .3s ease, transform .3s ease; padding: 18px; border: 1px solid #454d70; border-radius: 14px; background: #20232ded; color: #f2f3fb; box-shadow: 0 8px 28px #0005; pointer-events: auto; }
.ai-task-card strong { display: block; padding-right: 22px; font-size: 14px; }
.ai-task-card[data-dismissing="true"] { position: absolute; top: 0; opacity: 0; transform: translateY(-12px); pointer-events: none; }
.ai-task-card[data-phase="completed"], .ai-task-card[data-phase="failed"] { cursor: pointer; }
.ai-task-card > button { position: absolute; right: 10px; top: 8px; background: transparent; border: 0; color: #c8cbd8; cursor: pointer; font-size: 20px; }
.ai-task-name { margin-top: 7px; color: #9da5bc; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-task-status { margin: 16px 0 10px; font-size: 12px; line-height: 1.6; }
.ai-task-track { height: 7px; border-radius: 10px; background: #353a4c; overflow: hidden; }
.ai-task-track > div { height: 100%; border-radius: inherit; background: #688bff; transition: width .6s ease; }
.ai-task-track > .indeterminate { animation: ai-task-slide 1.8s ease-in-out infinite; }
.ai-task-card[data-phase="completed"] .ai-task-track > div { background: #70cda1; }
.ai-task-card[data-phase="failed"] { border-color: #9d6565; }
.ai-task-card[data-phase="failed"] .ai-task-track { display: none; }
@keyframes ai-task-slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }
@media (prefers-reduced-motion: reduce) { .ai-task-track > .indeterminate { animation: none; } }
