/* App-level layout */
html, body { margin: 0; padding: 0; height: 100%; }
body { background: var(--bg-1); overflow: hidden; }

.password-gate-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--s-8);
  background:
    radial-gradient(circle at 20% 20%, rgba(0,0,0,0.035), transparent 32%),
    radial-gradient(circle at 80% 10%, rgba(253,126,20,0.08), transparent 24%),
    linear-gradient(180deg, #FFFFFF 0%, #FAFAFA 100%);
}

.password-gate-card {
  width: min(440px, 100%);
  padding: 36px 32px 30px;
  background: rgba(255,255,255,0.94);
  border: 1px solid var(--gray-200);
  border-radius: 16px;
  box-shadow: 0 18px 44px rgba(0,0,0,0.08), 0 2px 8px rgba(0,0,0,0.04);
}

.password-gate-logo {
  height: 30px;
  width: auto;
  display: block;
  margin-bottom: 22px;
}

.password-gate-card h1 {
  font-size: 28px;
  margin-bottom: 10px;
}

.password-gate-card p {
  font-size: 14px;
  color: var(--gray-600);
  margin-bottom: 18px;
}

.password-gate-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.password-gate-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.password-gate-field span {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-700);
}

.password-gate-select {
  width: 100%;
}

.password-gate-form .btn {
  width: 100%;
}

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

/* App shell */
.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: var(--white);
}

/* Legacy top bar — removed from the product UI */
.topbar {
  display: none;
}

/* Header row under top bar */
.header {
  height: 56px;
  flex: none;
  display: flex;
  align-items: center;
  padding: 0 var(--s-5);
  border-bottom: 1px solid var(--gray-200);
  gap: var(--s-4);
  background: var(--white);
}
.header-left { display: flex; align-items: center; gap: var(--s-3); flex: 1; }
.header-right { display: flex; align-items: center; gap: var(--s-3); }
.header-logo {
  height: 30px;
  width: auto;
  display: block;
  flex: none;
}
.part-pill {
  display: inline-flex; align-items: center; gap: 8px;
  height: 30px; padding: 0 12px;
  background: var(--gray-50); border: 1px solid var(--gray-200);
  border-radius: var(--r-md);
  font-size: 13px; color: var(--gray-800); font-weight: 500;
}
.part-pill .mono { font-family: var(--font-mono); color: var(--gray-600); font-size: 12px; }

.avatar { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg, #C7E8E0, #A8D5C9); color: var(--gray-800); display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; letter-spacing: 0.04em; flex: none; }

/* Workspace = features rail + canvas + notes panel */
.workspace { flex: 1; display: flex; min-height: 0; }

/* Features rail (left) — kept simple, do-not-touch per brief */
.rail {
  width: 240px;
  flex: none;
  border-right: 1px solid var(--gray-200);
  background: var(--white);
  overflow: auto;
  padding: var(--s-3) 0;
}
.rail-section { padding: 0 var(--s-3); margin-bottom: var(--s-3); }
.rail-label { font-family: var(--font-mono); font-size: 10px; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; color: var(--gray-500); padding: 6px 10px; }
.rail-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: var(--r-sm);
  font-size: 13px; color: var(--gray-700); cursor: pointer;
  user-select: none;
}
.rail-item:hover { background: var(--gray-50); }
.rail-item.active { background: var(--orange-50); color: var(--orange-700); }
.rail-item .ri-letter { width: 18px; height: 18px; border: 1px solid var(--gray-300); border-radius: 3px; display: inline-grid; place-items: center; font-family: var(--font-mono); font-size: 10px; color: var(--gray-600); background: var(--white); flex: none; }
.rail-item.active .ri-letter { border-color: var(--orange-300); color: var(--orange-700); background: var(--orange-50); }
.rail-item .ri-icon { width: 16px; height: 16px; flex: none; color: var(--gray-500); }
.rail-item.active .ri-icon { color: var(--orange-600); }

/* Canvas (center) — blurred background */
.canvas-area {
  flex: 1;
  position: relative;
  background:
    radial-gradient(circle at 30% 40%, rgba(0,0,0,0.04), transparent 50%),
    radial-gradient(circle at 70% 60%, rgba(0,0,0,0.03), transparent 60%),
    var(--bg-1);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.canvas-blur {
  position: absolute; inset: 0;
  filter: blur(3px) grayscale(100%);
  opacity: 0.45;
  pointer-events: none;
}
.canvas-blur svg { width: 100%; height: 100%; }
.canvas-veil { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(255,255,255,0.55), rgba(255,255,255,0.7)); pointer-events: none; }

/* Notes panel — anchored as a floating sheet over the canvas */
.notes-panel {
  position: absolute;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width var(--dur-base, 200ms) var(--ease, ease);
}
.notes-panel.dragging,
.notes-panel.resizing { user-select: none; transition: none; }
.notes-panel-resize-handle {
  position: absolute;
  right: 0; bottom: 0;
  width: 16px; height: 16px;
  cursor: nwse-resize;
  z-index: 5;
}
.notes-panel-resize-handle::before,
.notes-panel-resize-handle::after {
  content: "";
  position: absolute;
  background: var(--gray-400);
  border-radius: 1px;
}
.notes-panel-resize-handle::before {
  right: 3px; bottom: 3px;
  width: 8px; height: 1px;
  transform: rotate(-45deg);
  transform-origin: right bottom;
}
.notes-panel-resize-handle::after {
  right: 3px; bottom: 7px;
  width: 4px; height: 1px;
  transform: rotate(-45deg);
  transform-origin: right bottom;
}
.notes-panel-resize-handle:hover::before,
.notes-panel-resize-handle:hover::after { background: var(--gray-700); }

.np-header {
  height: 56px; flex: none;
  display: flex; align-items: center; gap: var(--s-3);
  padding: 0 var(--s-4);
  border-bottom: 1px solid var(--gray-200);
  cursor: move;
  user-select: none;
}
.np-title { font-family: var(--font-display); font-size: 17px; font-weight: 600; color: var(--gray-900); letter-spacing: -0.01em; }
.np-spec-stamp {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 10px; font-weight: 500;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--gray-700);
  padding: 4px 8px;
  background: var(--gray-50); border: 1px solid var(--gray-200);
  border-radius: var(--r-xs);
}
.np-spec-stamp .dot { width: 5px; height: 5px; background: var(--orange-500); border-radius: 50%; }
.np-header .grow { flex: 1; }

.np-body { flex: 1; display: flex; min-height: 0; }

/* Filter sidebar (left of notes panel) */
.filter-rail {
  width: 240px; flex: none;
  border-right: 1px solid var(--gray-200);
  overflow: auto;
  padding: var(--s-4) 0;
  background: var(--gray-50);
  transition: width var(--dur-base, 200ms) var(--ease, ease),
              border-right-color var(--dur-base, 200ms) var(--ease, ease),
              padding var(--dur-base, 200ms) var(--ease, ease);
}
.filter-rail.collapsed {
  width: 0;
  padding-left: 0;
  padding-right: 0;
  border-right-color: transparent;
  overflow: hidden;
}
.filter-rail-content {
  width: 240px;
  min-width: 240px;
}
.filter-rail-toggle {
  width: 24px; height: 24px;
  display: inline-grid; place-items: center;
  background: transparent;
  border: 1px solid var(--gray-200);
  border-radius: var(--r-xs);
  color: var(--gray-600);
  cursor: pointer;
  margin-right: 6px;
  position: relative;
  transition: color var(--dur-micro) var(--ease), border-color var(--dur-micro) var(--ease), background var(--dur-micro) var(--ease);
}
.filter-rail-toggle:hover { color: var(--gray-900); border-color: var(--gray-400); background: var(--white); }
.filter-rail-toggle .icon { transition: transform var(--dur-base, 200ms) var(--ease, ease); }
.filter-rail-toggle.is-open .icon { transform: rotate(180deg); }
.filter-rail-toggle-badge {
  position: absolute;
  top: -9px; right: -10px;
  min-width: 14px; height: 14px; padding: 0 4px;
  display: grid; place-items: center;
  background: var(--orange-500);
  color: var(--white);
  border-radius: 7px;
  font-family: var(--font-mono); font-size: 9px; font-weight: 600;
  pointer-events: none;
}
.filter-search {
  margin: 0 var(--s-3) var(--s-3);
  position: relative;
}
.filter-search .input { padding-left: 32px; height: 32px; font-size: 13px; background: var(--white); }
.filter-search .icon-pos { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--gray-500); width: 14px; height: 14px; }
.filter-rail-content > .filter-search {
  position: relative;
  margin-bottom: 0;
  padding-bottom: var(--s-3);
}
.filter-rail-content > .filter-search .icon-pos { top: 16px; }
.filter-rail-content > .filter-search::after {
  content: "";
  position: absolute;
  left: calc(-1 * var(--s-3));
  right: calc(-1 * var(--s-3));
  bottom: 0;
  height: 1px;
  background: var(--gray-200);
  pointer-events: none;
}
.filter-rail .stamp,
.np-toolbar .stamp {
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: normal;
  text-transform: none;
  color: var(--gray-900);
}

.filter-group { padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--gray-200); }
.filter-group:last-child { border-bottom: none; }
.filter-group-head {
  display: flex; align-items: center; gap: 6px;
  font-family: inherit; font-size: 13px; font-weight: 600;
  letter-spacing: normal; text-transform: none;
  color: var(--gray-900);
  margin-bottom: var(--s-2);
}
.filter-group-head .info-btn {
  width: 14px; height: 14px;
  display: inline-grid; place-items: center;
  color: var(--gray-500); cursor: pointer;
  background: transparent;
  border: none;
  padding: 0;
  transition: color var(--dur-micro) var(--ease);
}
.filter-group-head .info-btn:hover { color: var(--orange-600); }
.filter-group-head .info-btn .icon { width: 14px; height: 14px; }
.filter-group-head .grow { flex: 1; }

.filter-mini-search { margin-bottom: 6px; position: relative; }
.filter-mini-search .input { height: 26px; font-size: 12px; padding: 0 8px 0 26px; background: var(--white); }
.filter-mini-search .icon-pos { position: absolute; left: 8px; top: 50%; transform: translateY(-50%); color: var(--gray-500); width: 12px; height: 12px; }

.filter-row {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 6px; border-radius: var(--r-sm);
  cursor: pointer; user-select: none;
  font-size: 13px; color: var(--gray-700);
}
.filter-row:hover { background: var(--gray-100); }
.filter-row .thumb { width: 22px; height: 22px; border-radius: 3px; border: 1px solid var(--gray-300); flex: none; background: var(--white); display: inline-grid; place-items: center; }
.filter-row .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filter-row .count { font-family: var(--font-mono); font-size: 11px; color: var(--gray-500); }
.filter-row.checked { color: var(--gray-900); font-weight: 500; }
.filter-row.is-child { padding-left: 28px; }
.filter-row .chev {
  width: 16px; height: 16px;
  display: inline-grid; place-items: center;
  border: none; background: transparent; padding: 0; margin: 0 -2px 0 -4px;
  color: var(--gray-500); cursor: pointer; flex: none;
  border-radius: 2px;
  transition: transform var(--dur-micro) var(--ease), background var(--dur-micro) var(--ease), color var(--dur-micro) var(--ease);
}
.filter-row .chev:hover { background: var(--gray-200); color: var(--gray-800); }
.filter-row .chev .icon { width: 12px; height: 12px; transition: transform var(--dur-micro) var(--ease); }
.filter-row .chev.is-open .icon { transform: rotate(180deg); }
.filter-group-list {
  max-height: 280px;
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.15) transparent;
}
.filter-group-list::-webkit-scrollbar { width: 6px; }
.filter-group-list::-webkit-scrollbar-track { background: transparent; }
.filter-group-list::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 999px; }
.filter-group-empty {
  padding: 6px 8px; font-size: 12px;
  color: var(--gray-500); font-style: italic;
}
.filter-subgroup-head {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 4px 4px;
  font-family: var(--font-mono); font-size: 9px; font-weight: 500;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--gray-500);
  cursor: pointer; user-select: none;
}
.filter-subgroup-head:hover { color: var(--gray-800); }
.filter-subgroup-head .chev { color: var(--gray-500); }
.filter-subgroup-head:first-child { padding-top: 2px; }

/* Suggested + saved column */
.notes-col { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.np-toolbar {
  height: 44px; flex: none;
  display: flex; align-items: center; gap: var(--s-2);
  padding: 0 var(--s-4);
  border-bottom: 1px solid var(--gray-200);
  background: var(--white);
  min-width: 0;
}
.np-toolbar-leading {
  display: flex; align-items: center; gap: var(--s-2);
  flex: none;
}
.np-toolbar-scroll {
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.15) transparent;
}
.np-toolbar-scroll::-webkit-scrollbar {
  height: 6px;
}
.np-toolbar-scroll::-webkit-scrollbar-track {
  background: transparent;
}
.np-toolbar-scroll::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.15);
  border-radius: 999px;
}
.np-toolbar-chips {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  min-width: max-content;
  padding: 2px 0;
}
.np-toolbar-empty-state {
  white-space: nowrap;
}
.np-toolbar-count {
  flex: none;
  white-space: nowrap;
  margin-left: var(--s-2);
}
.active-chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 6px 0 8px;
  border-radius: 3px;
  font-size: 12px;
  background: var(--gray-100); border: 1px solid var(--gray-200);
  color: var(--gray-800);
  flex: 0 0 auto;
  white-space: nowrap;
}
.active-chip .x { width: 14px; height: 14px; border-radius: 2px; display: inline-grid; place-items: center; cursor: pointer; color: var(--gray-500); }
.active-chip .x .icon { width: 10px; height: 10px; }
.active-chip .x:hover { background: var(--gray-200); color: var(--gray-800); }
.active-chip.spec { background: var(--orange-50); border-color: var(--orange-200); color: var(--orange-700); }

.np-list { flex: 1; overflow: auto; padding: var(--s-4); }
.np-section-label {
  font-family: inherit; font-size: 13px; font-weight: 600;
  letter-spacing: normal; text-transform: none;
  color: var(--gray-900);
  display: flex; align-items: center; gap: 8px;
  margin: var(--s-3) 0 var(--s-2);
}
.np-section-label:first-child { margin-top: 0; }
.np-section-label .count { color: var(--gray-500); font-weight: 400; }
.np-section-label .accent-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--orange-500); }

/* "On the drawing" — primary section: orange left rail + stronger header */
.notes-section-on-drawing {
  position: relative;
  padding: var(--s-3) 0 var(--s-3) var(--s-8);
  margin-bottom: var(--s-3);
}
.notes-section-on-drawing::before {
  content: "";
  position: absolute;
  left: 0; top: 4px; bottom: 4px;
  width: 3px;
  background: var(--orange-500);
  border-radius: 2px;
}
.notes-section-on-drawing .np-section-label {
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: normal;
  text-transform: none;
  color: var(--gray-900);
  margin-top: 0;
  margin-bottom: var(--s-3);
  gap: 8px;
}
.notes-section-on-drawing .np-section-label .icon { color: var(--orange-600); }
.notes-section-on-drawing .np-section-label .count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--gray-500);
  margin-left: 2px;
}

/* Note row */
.note-row {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 12px;
  border: 1px solid var(--gray-200);
  border-radius: var(--r-md);
  background: var(--white);
  margin-bottom: 8px;
  transition: border-color var(--dur-micro) var(--ease), background var(--dur-micro) var(--ease);
  position: relative;
}
.note-row:hover { border-color: var(--gray-400); }
.note-row.is-dragging { opacity: 0.4; }
.note-row .note-drag-handle {
  position: absolute;
  left: -20px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 22px;
  cursor: grab;
  color: var(--gray-400);
  opacity: 0;
  transition: opacity 120ms ease, color 120ms ease;
  flex-shrink: 0;
}
.note-row:hover .note-drag-handle,
.note-row.is-dragging .note-drag-handle { opacity: 1; }
.note-row .note-drag-handle:hover { color: var(--gray-700); }
.note-row .note-drag-handle:active { cursor: grabbing; }
.note-row .body { flex: 1; min-width: 0; }
.note-row .note-content { min-width: 0; }
.note-row.has-side-actions .note-content { padding-right: 112px; }
.note-row.suggested .note-content { padding-right: 190px; }
.note-row.removal .note-content { padding-right: 228px; }
.note-row .text {
  font-family: var(--font-mono); font-size: 12px; line-height: 1.55;
  color: var(--gray-800);
  letter-spacing: 0.01em;
}
.note-row .text.draft { font-family: var(--font-sans); font-size: 13px; color: var(--gray-700); font-style: italic; }
.note-row .note-edit {
  width: 100%;
  display: block;
  font-family: var(--font-mono);
  font-size: 12px; line-height: 1.55;
  letter-spacing: 0.01em;
  color: var(--gray-900);
  background: var(--white);
  border: 1px solid var(--orange-400);
  border-radius: var(--r-sm);
  padding: 6px 8px;
  resize: vertical;
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 140, 0, 0.12);
}
.note-row.editing { border-color: var(--orange-400); }
.note-row .meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.note-row .meta .badge { height: 18px; padding: 0 6px; font-size: 9px; }

/* Expand toggle — shares ghost icon styling, chevron rotates when open */
.note-expand-inline .icon { transition: transform var(--dur-base, 200ms) var(--ease, ease); }
.note-expand-inline.is-open .icon { transform: rotate(180deg); }
.note-row.suggested > .note-expand-inline,
.note-row.removal > .note-expand-inline {
  position: absolute;
  top: 10px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-micro) var(--ease), background var(--dur-micro) var(--ease);
}
.note-row.suggested > .note-expand-inline { right: 126px; }
.note-row.removal > .note-expand-inline { right: 164px; }
.note-row.suggested:hover > .note-expand-inline,
.note-row.suggested:focus-within > .note-expand-inline,
.note-row.suggested > .note-expand-inline.is-open,
.note-row.removal:hover > .note-expand-inline,
.note-row.removal:focus-within > .note-expand-inline,
.note-row.removal > .note-expand-inline.is-open {
  opacity: 1;
  pointer-events: auto;
}

/* Expanded detail panel */
.note-detail {
  margin-top: 10px;
  padding: 12px 14px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--r-sm);
}
.note-detail-title { font-family: var(--font-display); font-size: 14px; font-weight: 600; margin: 0 0 4px; color: var(--gray-900); }
.note-detail-sub { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--gray-600); margin-bottom: 8px; }
.note-detail-body { font-size: 13px; line-height: 1.5; color: var(--gray-700); margin: 0 0 10px; }
.note-detail-body:last-child { margin-bottom: 0; }
.note-detail-tip {
  display: flex; gap: 8px; align-items: flex-start;
  padding: 10px 12px;
  background: var(--orange-50); border: 1px solid var(--orange-200);
  border-radius: var(--r-sm);
  font-size: 12px; color: var(--gray-800);
}
.note-detail-tip .label { font-family: var(--font-mono); font-size: 9px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--orange-700); flex: none; padding-top: 1px; }
.note-row .actions { display: flex; gap: 2px; opacity: 0; transition: opacity var(--dur-micro); }
.note-row.has-side-actions .actions {
  position: absolute;
  top: 10px;
  right: 12px;
}
.note-row:hover .actions { opacity: 1; }
.note-row.has-side-actions:focus-within .actions { opacity: 1; }
.note-row .actions .btn-icon { height: 28px; width: 28px; }
.note-row .actions .note-add-ghost { height: 28px; padding: 0 8px; gap: 4px; color: var(--gray-700); }
.note-row .actions .note-add-ghost:hover { color: var(--orange-700); background: var(--orange-50); }
.note-row .actions .note-add-ghost .icon { color: var(--orange-600); }

/* suggested variant */
.note-row.suggested { background: #FFFBF6; border-color: var(--orange-200); }
.note-row.suggested:hover { border-color: var(--orange-300); }
.note-row.suggested .accept-actions {
  display: flex;
  gap: 6px;
  opacity: 1;
  position: absolute;
  top: 10px;
  right: 12px;
  align-self: auto;
}

/* removal candidate */
.note-row.removal {
  background: #FFF7F5; border-color: #F2C8BE;
}
.note-row.removal .text { color: var(--gray-600); text-decoration: line-through; text-decoration-color: rgba(208,66,44,0.6); }
.note-row.removal .accept-actions {
  position: absolute;
  top: 10px;
  right: 12px;
  align-self: auto;
}

/* dismissed */
.note-row.dismissed { opacity: 0.55; }

/* Custom note inline */
.custom-note-input {
  border: 1px dashed var(--gray-300);
  border-radius: var(--r-md);
  padding: 10px 12px;
  margin-bottom: var(--s-3);
  display: flex; align-items: center; gap: 10px;
  background: var(--white);
}
.custom-note-input:focus-within { border-color: var(--orange-500); border-style: solid; box-shadow: 0 0 0 3px rgba(253,126,20,0.08); }
.custom-note-input input { flex: 1; border: none; outline: none; font-family: var(--font-mono); font-size: 12px; color: var(--gray-800); background: transparent; }
.custom-note-input input::placeholder { font-family: var(--font-sans); font-style: italic; color: var(--gray-500); }

/* Education popover */
.edu-pop {
  width: 380px;
  background: var(--white);
  border: 1px solid var(--gray-300);
  border-radius: var(--r-md);
  box-shadow: 0 12px 32px rgba(0,0,0,0.14), 0 2px 6px rgba(0,0,0,0.08);
  overflow: hidden;
  font-size: 13px;
  color: var(--gray-800);
}
.edu-pop .image {
  height: 140px; background: var(--gray-100);
  display: grid; place-items: center;
  border-bottom: 1px solid var(--gray-200);
  position: relative; overflow: hidden;
}
.edu-pop .image .placeholder-mark { font-family: var(--font-mono); font-size: 10px; color: var(--gray-500); letter-spacing: 0.1em; text-transform: uppercase; position: absolute; top: 8px; left: 10px; }
.edu-pop .body { padding: 14px 16px; }
.edu-pop h4 { font-family: var(--font-display); font-size: 15px; font-weight: 600; margin: 0 0 4px; color: var(--gray-900); }
.edu-pop .sub { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--gray-600); margin-bottom: 10px; }
.edu-pop p { font-size: 13px; line-height: 1.5; color: var(--gray-700); margin: 0 0 10px; }
.edu-pop .tip {
  display: flex; gap: 8px; align-items: flex-start;
  padding: 10px 12px;
  background: var(--orange-50); border: 1px solid var(--orange-200);
  border-radius: var(--r-sm);
  margin-bottom: 12px;
  font-size: 12px; color: var(--gray-800);
}
.edu-pop .tip .label { font-family: var(--font-mono); font-size: 9px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--orange-700); flex: none; padding-top: 1px; }
.edu-pop .cta { display: flex; gap: 8px; }

/* Diff banner */
.diff-banner {
  background: var(--orange-50);
  border: 1px solid var(--orange-200);
  border-radius: var(--r-md);
  padding: 12px 14px;
  margin-bottom: var(--s-4);
  display: flex; align-items: center; gap: 12px;
}
.diff-banner .icon-wrap { width: 30px; height: 30px; border-radius: 50%; background: var(--white); border: 1px solid var(--orange-200); display: grid; place-items: center; color: var(--orange-600); flex: none; }
.diff-banner .text { flex: 1; font-size: 13px; color: var(--gray-800); }
.diff-banner .text strong { color: var(--gray-900); font-weight: 600; }
.diff-banner .actions { display: flex; gap: 6px; }

/* Settings page */
.settings-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: var(--white);
}
.settings-app-header {
  height: 68px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--s-6);
  border-bottom: 1px solid var(--gray-200);
  background: var(--white);
}
.settings-logo {
  height: 30px;
  width: auto;
  display: block;
}
.settings-account {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--gray-900);
}
.settings-account-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #E7F5FA;
  color: #1CA3C7;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-sans);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  flex: none;
}
.settings-account-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.settings-account-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-900);
  line-height: 1.2;
}
.settings-account-sub {
  font-size: 12px;
  color: var(--gray-500);
  line-height: 1.2;
}
.settings-account-caret {
  color: var(--gray-600);
}
.settings-shell { display: flex; flex: 1; min-height: 0; background: var(--white); }
.settings-side {
  width: 240px; flex: none;
  border-right: 1px solid var(--gray-200);
  background: var(--white);
  padding: var(--s-4) var(--s-3);
}
.settings-side .label {
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: normal;
  text-transform: none;
  color: var(--gray-900);
  padding: 8px 12px;
  margin-bottom: 4px;
}
.settings-side .item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  margin-bottom: 2px;
  border-radius: var(--r-md);
  font-size: 14px;
  color: var(--gray-800);
  cursor: pointer;
}
.settings-side .item:hover { background: var(--gray-50); }
.settings-side .item.active { background: var(--gray-100); color: var(--gray-900); font-weight: 500; }
.settings-side .item .icon { width: 20px; height: 20px; font-size: 20px; color: var(--gray-700); flex-shrink: 0; }
.settings-side .item.active .icon { color: var(--gray-900); }

.settings-main { flex: 1; overflow: auto; }
.settings-header { padding: var(--s-8) var(--s-8) var(--s-5); display: flex; align-items: flex-end; gap: var(--s-4); }
.settings-header-copy { display: flex; flex-direction: column; gap: 8px; }
.settings-header h1 { font-size: 24px; }
.settings-header .crumbs { font-family: inherit; font-size: 14px; color: var(--gray-500); letter-spacing: normal; }
.settings-header .crumbs a { color: var(--orange-500); cursor: pointer; }
.settings-header .crumbs a:hover { color: var(--orange-600); }
.settings-header .grow { flex: 1; }

.settings-body { padding: var(--s-8) var(--s-8) var(--s-6); }
.settings-section { margin-bottom: var(--s-8); }
.ff-toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.ff-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.ff-toggle-track {
  width: 32px; height: 18px;
  background: var(--gray-300);
  border-radius: 999px;
  position: relative;
  transition: background var(--dur-micro) var(--ease);
  flex-shrink: 0;
}
.ff-toggle-thumb {
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  background: var(--white);
  border-radius: 999px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.18);
  transition: transform var(--dur-micro) var(--ease);
}
.ff-toggle input:checked ~ .ff-toggle-track { background: var(--orange-500); }
.ff-toggle input:checked ~ .ff-toggle-track .ff-toggle-thumb { transform: translateX(14px); }
.ff-toggle-label { font-size: 12px; color: var(--gray-600); min-width: 24px; }
.settings-home-notes-section { margin-top: var(--s-10); }
.settings-section h3 { font-size: 16px; margin-bottom: var(--s-2); }
.settings-section .desc { font-size: 13px; color: var(--gray-600); margin-bottom: var(--s-4); max-width: none; }
.settings-search-wrap {
  position: relative;
  width: 240px;
}
.settings-attr-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.settings-attr-grid-libraries {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.settings-attr-grid-tags {
  grid-template-columns: minmax(0, 420px);
}
.settings-attr-card {
  display: flex;
  flex-direction: column;
  align-self: stretch;
}
.settings-home-group-libraries .settings-home-card {
  border-color: var(--gray-200);
  background: var(--white);
}
.settings-home-group-tags .settings-home-card {
  border-color: #E7E1D5;
  background: var(--white);
}
.settings-home-card {
  min-height: 168px;
}
.settings-home-card-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
}
.settings-home-card-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--gray-200);
  background: var(--gray-50);
  color: var(--gray-700);
  flex: none;
}
.settings-home-card-icon-libraries {
  background: #F7F7F5;
  border-color: #E7E5DF;
}
.settings-home-card-icon-tags {
  background: #FFF4E9;
  border-color: #FFDABA;
  color: var(--orange-700);
}
.settings-home-card-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.settings-home-card-eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gray-500);
}
.settings-home-card-count {
  margin-left: auto;
  flex: none;
  padding-top: 2px;
}
.settings-home-card-summary {
  font-size: 13px;
  line-height: 1.55;
  color: var(--gray-600);
  margin: 0;
}
.settings-home-card-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}
.settings-home-card-stat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--gray-200);
  background: rgba(255,255,255,0.9);
}
.settings-home-card-stat-mat {
  border-color: #D6EAF4;
  background: #EEF6FB;
}
.settings-home-card-stat-fin {
  border-color: #DDE0D2;
  background: #F1F2EE;
}
.settings-home-card-stat-pro {
  border-color: #E5D6EA;
  background: #F6F0F8;
}
.settings-home-card-stat-free {
  border-color: var(--gray-300);
  background: var(--white);
}
.settings-home-card-stat-label,
.settings-home-card-stat-value {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
}
.settings-home-card-stat-label {
  color: var(--gray-600);
  text-transform: uppercase;
}
.settings-home-card-stat-value {
  color: var(--gray-900);
}
.settings-attr-values {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.settings-attr-action {
  margin-top: auto;
  padding-top: 10px;
}
/* Shared TableCard chrome — rounded container that wraps all settings tables */
.table-card {
  border: 1px solid var(--gray-200);
  border-radius: var(--r-md);
  background: var(--white);
  overflow: hidden;
}
.table-card + .table-card {
  margin-top: var(--s-6);
}
.table-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 20px;
  flex-wrap: wrap;
}
.table-card-summary {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.table-card-summary h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-900);
}
.table-card-summary .desc {
  margin: 0;
  font-size: 13px;
  color: var(--gray-600);
  max-width: 760px;
}
.table-card-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.table-card-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  flex-shrink: 0;
  justify-content: flex-end;
  margin-left: auto;
}
.table-card-actions .input,
.table-card-actions .select,
.table-card-controls .input,
.table-card-controls .select {
  background-color: var(--white);
}
.table-card-search {
  position: relative;
  width: 200px;
}
.table-card-search .input {
  width: 100%;
  padding-left: 32px;
}
.table-card-filter {
  width: 132px;
  font-size: 13px;
  color: var(--gray-700);
}
.table-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  border-top: 1px solid var(--gray-200);
  font-size: 13px;
  color: var(--gray-700);
  flex-wrap: wrap;
}
.table-card-rpp {
  display: flex;
  align-items: center;
  gap: 8px;
}
.table-card-rpp-select {
  width: 72px;
  height: 32px;
  padding: 0 28px 0 10px;
  font-size: 13px;
}
.table-card-pager {
  display: flex;
  align-items: center;
  gap: 6px;
}
.table-card-pager-page {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border-radius: var(--r-md);
  background: var(--orange-500);
  color: var(--white);
  font-size: 13px;
  font-weight: 600;
}
.table-card-count {
  color: var(--gray-600);
}
.prefs-kind-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-800);
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
}
.prefs-kind-badge.rough-cut {
  background: #FFF3E7;
  border-color: #FFD2A6;
  color: #A24F00;
}
.prefs-kind-badge.standard-machining {
  background: #EDF4FF;
  border-color: #C9DCF9;
  color: #275387;
}
.prefs-kind-badge.higher-precision {
  background: #EEF9F2;
  border-color: #C6E7D0;
  color: #1D6A3A;
}
.prefs-kind-badge.ultra-high-precision {
  background: #F4EEFF;
  border-color: #D9CBFF;
  color: #5D3A9B;
}
.prefs-segmented {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  gap: 4px;
}
.prefs-segment {
  height: 30px;
  padding: 0 14px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--gray-700);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.prefs-segment.active {
  background: var(--white);
  color: var(--gray-900);
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

/* Notes-list table in Settings */
.notes-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  background: var(--white);
}
.notes-table th,
.notes-table td {
  text-align: left;
  padding: 12px 20px;
  vertical-align: top;
}
.notes-table th {
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: normal;
  text-transform: none;
  color: var(--gray-900);
  background: var(--gray-50);
  vertical-align: middle;
  border-bottom: 1px solid var(--gray-200);
}
.notes-table tbody tr { position: relative; }
.notes-table tbody tr:not(:last-child) td:first-child::after {
  content: '';
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 0;
  height: 1px;
  background: var(--gray-200);
  pointer-events: none;
}
.notes-table td.note-text { font-family: var(--font-mono); font-size: 12px; color: var(--gray-800); line-height: 1.45; }
.notes-table td .tagchips { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.notes-table th.table-action,
.notes-table td.table-action {
  width: 1%;
  text-align: right;
  white-space: nowrap;
  vertical-align: middle;
}
.team-table td {
  vertical-align: middle;
}
.team-user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.team-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.team-user-name {
  color: var(--gray-800);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.3;
}
.team-user-sub {
  margin-top: 2px;
  color: var(--gray-500);
  font-size: 12px;
  line-height: 1.2;
}
.team-role-pill {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  background: #EDF4FF;
  color: #2F7DE1;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.team-role-pill.admin {
  background: #FFF3E7;
  color: #A24F00;
}
.team-search {
  width: 220px;
}
.team-menu-wrap {
  position: relative;
  display: inline-flex;
}
.team-row-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 80;
  min-width: 152px;
  padding: 6px;
  border: 1px solid var(--gray-200);
  border-radius: 7px;
  background: var(--white);
  box-shadow: 0 12px 28px rgba(22, 26, 33, 0.14);
}
.team-row-menu button {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--gray-800);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.team-row-menu button:hover:not(:disabled) {
  background: var(--gray-50);
}
.team-row-menu button.danger {
  color: #D92D20;
}
.team-row-menu button:disabled {
  color: var(--gray-400);
  cursor: not-allowed;
}
.team-auth-note {
  padding: 12px;
  border: 1px solid var(--gray-200);
  border-radius: var(--r-md);
  background: var(--gray-50);
  color: var(--gray-600);
  font-size: 12px;
  line-height: 1.45;
}
.team-form-error {
  margin-top: 12px;
}
.team-invite-sheet {
  width: 420px;
}

/* Attribute manager sub-page toolbar */
.attr-mgr-toolbar { display: flex; align-items: center; gap: 16px; }
.settings-library-value {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 28px;
}
.settings-library-value-mark {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--gray-200);
  background: var(--gray-50);
  flex: none;
}
.settings-library-value-mark-fin {
  background: #F1F2EE;
  border-color: #DDE0D2;
}
.settings-library-value-mark-pro {
  background: #F6F0F8;
  border-color: #E5D6EA;
}
.settings-library-value-glyph {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--gray-700);
  text-transform: uppercase;
}
.settings-library-value-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--gray-900);
}
.tagchip { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 6px; border-radius: 3px; font-size: 11px; background: var(--gray-100); border: 1px solid var(--gray-200); color: var(--gray-700); }
.tagchip.attr-mat { background: #EEF6FB; border-color: #D6EAF4; color: #285F7B; }
.tagchip.attr-fin { background: #F1F2EE; border-color: #DDE0D2; color: #4F5840; }
.tagchip.attr-pro { background: #F6F0F8; border-color: #E5D6EA; color: #6A4079; }
.tagchip.attr-free { background: var(--white); border-color: var(--gray-300); color: var(--gray-700); }
.tagchip-stateful {
  background: #EDF4FF;
  border-color: #C9DCF9;
  color: #275387;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.tagchip.is-default {
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.4), 0 0 0 1px rgba(253,126,20,0.14);
}
.tagchip-state {
  display: inline-flex;
  align-items: center;
  height: 14px;
  padding: 0 4px;
  border-radius: 999px;
  background: rgba(255,255,255,0.82);
  border: 1px solid rgba(253,126,20,0.22);
  color: var(--orange-700);
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Note authoring sheet */
.auth-sheet {
  position: fixed; right: 0; top: 0; bottom: 0; width: 720px;
  background: var(--white);
  border-left: 1px solid var(--gray-200);
  box-shadow: -8px 0 24px rgba(0,0,0,0.06);
  z-index: 30;
  display: flex; flex-direction: column;
}
.auth-head { padding: var(--s-5) var(--s-6); border-bottom: 1px solid var(--gray-200); display: flex; align-items: center; gap: var(--s-3); }
.auth-head h2 { font-size: 19px; margin: 0; }
.auth-body { flex: 1; overflow: auto; padding: var(--s-6); }
.auth-foot { padding: var(--s-4) var(--s-6); border-top: 1px solid var(--gray-200); display: flex; gap: var(--s-2); justify-content: flex-end; background: var(--gray-50); }
.auth-foot-between { justify-content: space-between; }
.auth-foot-actions { display: flex; gap: var(--s-2); }

.auth-block { margin-bottom: var(--s-6); }
.auth-block label {
  display: block;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  color: var(--gray-800);
  margin-bottom: var(--s-2);
}
.auth-block .help { font-size: 12px; color: var(--gray-600); margin-top: 6px; }
.auth-label-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: var(--s-2);
}
.auth-label-row label {
  margin-bottom: 0;
}
.auth-info-wrap {
  display: inline-flex;
  flex: none;
  align-self: center;
}
.auth-info-btn {
  width: 14px;
  height: 14px;
  display: inline-grid;
  place-items: center;
  color: var(--gray-500);
  cursor: pointer;
  background: transparent;
  border: none;
  padding: 0;
  transition: color var(--dur-micro) var(--ease);
}
.auth-info-btn:hover,
.auth-info-btn:focus-visible {
  color: var(--orange-600);
}
.auth-info-btn .icon {
  width: 14px;
  height: 14px;
}
.auth-tooltip {
  position: fixed;
  z-index: 1000;
  padding: 10px 12px;
  background: var(--white);
  color: var(--gray-700);
  border: 1px solid var(--gray-300);
  border-radius: var(--r-md);
  box-shadow: 0 10px 24px rgba(0,0,0,0.12), 0 2px 6px rgba(0,0,0,0.06);
  font-size: 12px;
  line-height: 1.5;
}
.auth-related-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.auth-related-item {
  border: 1px solid var(--gray-200);
  border-radius: var(--r-md);
  background: var(--white);
  padding: 10px 12px;
}
.auth-related-item-title {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--gray-800);
  line-height: 1.5;
}
.auth-related-item-meta {
  margin-top: 6px;
  font-size: 11px;
  color: var(--gray-500);
}
.auth-block-inline-toggle { margin-top: -8px; margin-bottom: var(--s-5); }
.toggle-inline-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.toggle-inline-row .chk {
  margin: 0;
  flex: none;
}
.auth-block .toggle-inline-label {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--gray-900);
  line-height: 1.2;
  cursor: pointer;
  margin: 0;
}
.toggle-inline-row .auth-info-wrap {
  align-self: center;
}

.attr-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--s-3); }
.attr-pickers { display: flex; flex-wrap: wrap; gap: 6px; }
.attr-picker {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 9px;
  border-radius: 999px; border: 1px solid var(--gray-300);
  font-size: 12px; cursor: pointer; background: var(--white);
  user-select: none;
  position: relative;
}
.attr-picker:hover { border-color: var(--gray-500); }
.attr-picker.on { background: var(--gray-900); border-color: var(--gray-900); color: var(--white); }
.attr-picker.on.mat { background: #285F7B; border-color: #285F7B; }
.attr-picker.on.fin { background: #4F5840; border-color: #4F5840; }
.attr-picker.on.pro { background: #6A4079; border-color: #6A4079; }
.attr-picker.default {
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.22), 0 0 0 2px rgba(253,126,20,0.16);
}
.attr-picker-state {
  display: inline-flex;
  align-items: center;
  height: 16px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(255,255,255,0.18);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.attr-picker .glyph { width: 10px; height: 10px; border-radius: 2px; }

.note-text-input {
  width: 100%; min-height: 80px;
  font-family: var(--font-mono); font-size: 13px; line-height: 1.55;
  padding: 12px 14px;
  border: 1px solid var(--gray-300); border-radius: var(--r-md);
  background: var(--white); color: var(--gray-800);
  resize: vertical; box-sizing: border-box;
}
.note-text-input:focus { border-color: var(--orange-500); outline: none; box-shadow: 0 0 0 3px rgba(253,126,20,0.12); }

/* Part Spec launch screen */
.part-spec-app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: #F6F7F8;
}
.part-spec-app-shell .settings-app-header {
  height: 64px;
  padding: 0 24px;
}
.part-spec-app-shell .settings-logo {
  height: 24px;
}
.part-spec-app-shell .settings-account-avatar {
  width: 40px;
  height: 40px;
  font-size: 15px;
}
.part-spec-app-shell.workflow-open {
  background: #F5F6F7;
}
.part-spec-launch-screen {
  position: relative;
  min-height: calc(100vh - 64px);
  background: #F6F7F8;
}
.ps-home-board {
  position: relative;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 0;
  min-height: calc(100vh - 64px);
  padding: 0;
  background: linear-gradient(90deg, var(--white) 0 320px, #F6F7F8 320px);
}
.ps-home-board::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 320px;
  width: 1px;
  background: var(--gray-200);
  pointer-events: none;
}
.ps-home-board > * {
  position: relative;
  z-index: 1;
}
.ps-upload-card {
  align-self: start;
  justify-self: center;
  width: 280px;
  min-height: 204px;
  margin: 18px 16px 0;
  border: 1px dashed #C9D3DE;
  border-radius: 4px;
  background: var(--white);
  padding: 18px 20px;
  text-align: center;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: border-color var(--dur-micro) var(--ease), transform var(--dur-micro) var(--ease), box-shadow var(--dur-micro) var(--ease);
}
.ps-upload-card:hover {
  border-color: var(--orange-500);
  transform: none;
  box-shadow: 0 4px 12px rgba(34, 38, 46, 0.08);
}
.ps-upload-badge {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--orange-500);
  color: var(--white);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0 0 16px;
  box-shadow: none;
}
.ps-upload-badge .icon {
  width: 24px;
  height: 24px;
}
.ps-upload-card strong {
  display: block;
  color: var(--gray-900);
  max-width: 230px;
  font-size: 16px;
  line-height: 1.25;
}
.ps-upload-card strong span {
  color: var(--orange-600);
}
.ps-upload-card p {
  margin: 10px auto 0;
  max-width: 230px;
  color: var(--gray-600);
  font-size: 12px;
  line-height: 1.45;
}
.ps-projects-shell {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  padding: 22px 18px 32px;
}
.ps-projects-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.ps-projects-toolbar h1 {
  font-size: 18px;
  line-height: 1.2;
}
.ps-projects-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.ps-home-filter-label {
  color: var(--gray-800);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.ps-home-select {
  width: 320px;
  height: 38px;
  font-size: 13px;
}
.ps-home-search {
  position: relative;
  width: 240px;
}
.ps-home-search .icon {
  position: absolute;
  left: 12px;
  top: 50%;
  width: 15px;
  height: 15px;
  transform: translateY(-50%);
  color: var(--gray-500);
}
.ps-home-search .input {
  height: 38px;
  padding-left: 36px;
  font-size: 13px;
}
.ps-project-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.ps-builder-shell {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: #F5F6F7;
}
.ps-builder-toprow {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr) 292px;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 10px 24px;
}
.ps-builder-account {
  justify-self: end;
}
.ps-builder-part-group {
  display: inline-flex;
  align-items: center;
  gap: 20px;
  min-width: 0;
}
.ps-builder-back-link {
  border: 0;
  background: transparent;
  color: var(--gray-700);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.ps-builder-back-link:hover {
  color: var(--gray-900);
}
.ps-builder-part {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--gray-900);
  font-size: 14px;
  font-weight: 600;
}
.ps-builder-part-logo {
  width: 20px;
  height: 20px;
  object-fit: contain;
}
.ps-builder-stepper {
  justify-self: center;
  display: inline-flex;
  align-items: stretch;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 1px 1px rgba(15, 23, 42, 0.03);
}
.ps-builder-step {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 17px;
  color: #9AA3AE;
  font-size: 13px;
  font-weight: 500;
  border-right: 1px solid var(--gray-200);
}
.ps-builder-step:last-child {
  border-right: none;
}
.ps-builder-step.active {
  color: var(--gray-900);
  background: var(--white);
}
.ps-builder-step-bullet {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #B8C0C9;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #B8C0C9;
  flex: none;
}
.ps-builder-step.active .ps-builder-step-bullet {
  border-color: var(--orange-500);
  color: var(--orange-500);
}
.ps-builder-step-play {
  width: 0;
  height: 0;
  margin-left: 2px;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 7px solid var(--orange-500);
}
.ps-builder-stage {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  gap: 12px;
  flex: 1;
  min-height: 0;
  padding: 12px 12px 0;
}
.ps-builder-panel {
  width: 260px;
  padding: 0;
  margin-left: 0;
  overflow: hidden;
  border-radius: 6px;
  border-color: #DDE2E7;
  box-shadow: 0 2px 8px rgba(24, 30, 38, 0.08);
  align-self: start;
}
.ps-builder-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 14px 12px;
  border-bottom: 1px solid var(--gray-200);
}
.ps-builder-template-name {
  margin-top: 3px;
  max-width: 118px;
  color: var(--gray-500);
  font-size: 11px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ps-builder-template-btn {
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--gray-200);
  border-radius: 5px;
  background: var(--white);
  color: var(--gray-700);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  flex: none;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color var(--dur-micro) var(--ease), color var(--dur-micro) var(--ease), background var(--dur-micro) var(--ease);
}
.ps-builder-template-btn:hover {
  border-color: var(--orange-300);
  background: #FFF8EF;
  color: var(--orange-700);
}
.ps-builder-template-btn:focus-visible {
  outline: 3px solid rgba(253, 126, 20, 0.22);
  outline-offset: 2px;
}
.ps-builder-panel-body {
  padding: 14px 14px 15px;
}
.ps-builder-field {
  margin-bottom: 13px;
}
.ps-builder-field label {
  display: block;
  margin-bottom: 6px;
  color: var(--gray-900);
  font-size: 12px;
  font-weight: 600;
}
.ps-builder-units {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border-radius: 6px;
  border: 1px solid var(--gray-300);
  background: #EEF1F4;
  padding: 2px;
}
.ps-builder-unit-btn {
  height: 30px;
  border: none;
  background: transparent;
  border-radius: 4px;
  color: var(--gray-700);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.ps-builder-unit-btn.active {
  background: var(--white);
  color: var(--gray-900);
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}
.ps-builder-continue {
  width: auto;
  justify-content: center;
  min-width: 104px;
  height: 38px;
  margin-top: 17px;
  margin-left: auto;
  display: flex;
}
.ps-builder-canvas {
  position: relative;
  min-height: 680px;
  border-radius: 0;
  overflow: hidden;
  background: #F5F6F7;
}
.ps-builder-model-wrap {
  position: absolute;
  inset: 76px 210px 48px 292px;
  display: grid;
  place-items: center;
  pointer-events: none;
}
.ps-builder-model-image {
  width: min(840px, 66vw);
  max-width: 100%;
  max-height: calc(100vh - 188px);
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 18px 20px rgba(15, 23, 42, 0.08));
}
.ps-builder-orbit-cube {
  position: absolute;
  top: 0;
  right: 28px;
  width: 158px;
  height: 160px;
  pointer-events: none;
}
.ps-builder-nav-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.ps-project-card {
  border: 1px solid #D6DCE2;
  border-radius: 5px;
  overflow: hidden;
  background: var(--white);
  box-shadow: 0 1px 2px rgba(36, 40, 48, 0.08);
}
.ps-project-art {
  height: 188px;
  background: var(--white);
  border-bottom: 1px solid #DFE5EA;
  display: grid;
  place-items: center;
}
.ps-project-meta {
  min-height: 60px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.ps-project-meta > div:first-child {
  min-width: 0;
}
.ps-project-name {
  font-size: 14px;
  font-weight: 400;
  color: var(--gray-900);
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ps-project-sub {
  color: var(--gray-500);
  font-size: 12px;
  line-height: 1.3;
}
.ps-project-trailing {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}
.ps-project-status {
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid #DCEADB;
  background: #FCFEFB;
  color: #1B7A2F;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.ps-project-status::before {
  content: "";
  width: 10px;
  height: 10px;
  border: 1px solid #34C759;
  border-radius: 50%;
  background: #F5FFF6;
  box-shadow: inset 0 0 0 3px var(--white);
  flex: none;
}
.ps-project-trailing .btn-sm {
  width: 24px;
  height: 24px;
}
.ps-project-illustration {
  position: relative;
  width: 180px;
  height: 118px;
  opacity: 0.92;
}
.ps-geo-block,
.ps-geo-disc,
.ps-geo-shaft,
.ps-geo-plate,
.ps-geo-body,
.ps-geo-body-cut {
  position: absolute;
  background: linear-gradient(180deg, #F7F8FA, #E4E7EB);
  border: 1px solid #A7AFBA;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.9);
}
.ps-geo-block-a {
  left: 34px;
  bottom: 28px;
  width: 68px;
  height: 58px;
  border-radius: 7px;
}
.ps-geo-block-b {
  left: 86px;
  bottom: 42px;
  width: 68px;
  height: 38px;
  border-radius: 10px;
  transform: skewX(-20deg);
}
.ps-geo-block-c {
  right: 14px;
  bottom: 38px;
  width: 58px;
  height: 46px;
  border-radius: 8px;
}
.ps-geo-disc {
  left: 52px;
  top: 18px;
  width: 78px;
  height: 78px;
  border-radius: 50%;
}
.ps-geo-shaft {
  left: 110px;
  top: 48px;
  width: 82px;
  height: 20px;
  border-radius: 999px;
}
.ps-geo-word {
  position: absolute;
  left: 6px;
  right: 6px;
  top: 40px;
  text-align: center;
  color: #C9CCD1;
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.04em;
  transform: skewX(-10deg);
}
.ps-geo-plate {
  left: 60px;
  top: 12px;
  width: 88px;
  height: 88px;
  border-radius: 50%;
}
.ps-geo-body {
  left: 42px;
  top: 34px;
  width: 106px;
  height: 66px;
  border-radius: 14px;
}
.ps-geo-body-cut {
  left: 68px;
  top: 48px;
  width: 50px;
  height: 34px;
  background: linear-gradient(180deg, #FFFFFF, #EEF1F4);
  border-radius: 8px;
}
.ps-modal-scrim {
  position: fixed;
  inset: 0;
  background: rgba(34, 38, 46, 0.14);
  backdrop-filter: blur(6px);
  z-index: 40;
}
.ps-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(880px, calc(100vw - 72px));
  height: min(660px, calc(100vh - 64px));
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-2);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  z-index: 41;
}
.ps-modal-workflow {
  height: min(610px, calc(100vh - 64px));
}
.ps-modal-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-200);
  background: var(--white);
}
.ps-modal-search {
  position: relative;
  width: 100%;
  flex: 1 1 auto;
  min-width: 0;
}
.ps-modal-search .icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-500);
}
.ps-modal-search .input {
  height: 32px;
  padding-left: 32px;
  border-radius: var(--r-md);
  font-size: 13px;
}
.ps-modal-head .btn-icon {
  flex: none;
}
.ps-modal-body {
  display: block;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.ps-modal-sidebar {
  padding: 12px 0;
  background: var(--gray-50);
  border-right: 1px solid var(--gray-200);
}
.ps-filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 10px 12px;
  border-bottom: 1px solid var(--gray-200);
}
.ps-filter-group-flush {
  padding-bottom: 0;
  border-bottom: none;
}
.ps-filter-item {
  width: 100%;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--gray-800);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--dur-micro) var(--ease), background var(--dur-micro) var(--ease), color var(--dur-micro) var(--ease);
}
.ps-filter-item:hover {
  background: var(--white);
  border-color: var(--gray-200);
}
.ps-filter-item.active {
  background: #FFFBF6;
  border-color: var(--orange-200);
  color: var(--orange-700);
  box-shadow: inset 3px 0 0 var(--orange-500);
}
.ps-filter-section-label {
  padding: 12px 16px 6px;
  color: var(--gray-500);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: var(--font-mono);
}
.ps-modal-main {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 20px 16px 26px;
  background: var(--white);
  height: 100%;
  overflow-y: auto;
}
.ps-action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.ps-action-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px dashed var(--gray-300);
  border-radius: var(--r-md);
  background: var(--white);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--dur-micro) var(--ease), background var(--dur-micro) var(--ease);
}
.ps-action-card:hover {
  border-color: var(--orange-500);
  background: #FFFBF6;
}
.ps-action-card:focus-visible {
  outline: 3px solid rgba(253, 126, 20, 0.22);
  outline-offset: 2px;
}
.ps-action-card-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gray-100);
  color: var(--gray-700);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.ps-action-card:hover .ps-action-card-icon {
  background: #FFF1E4;
  color: var(--orange-600);
}
.ps-action-card-icon .icon {
  width: 16px;
  height: 16px;
}
.ps-action-card-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.ps-action-card-copy strong {
  color: var(--gray-900);
  font-size: 13px;
  font-weight: 600;
}
.ps-action-card-copy span {
  color: var(--gray-600);
  font-size: 12px;
}
.ps-template-section {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.ps-template-section.menu-open {
  z-index: 80;
}
.ps-template-section-label {
  color: var(--gray-900);
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 0;
}
.ps-template-section-label .btn-sm {
  font-size: 12px;
}
.ps-template-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: 20px;
  row-gap: 28px;
  overflow: visible;
}
.ps-template-card {
  position: relative;
  z-index: 1;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 10px;
  cursor: pointer;
  text-align: left;
  overflow: visible;
}
.ps-template-card.menu-open {
  z-index: 90;
}
.ps-template-card-blank:focus-visible,
.ps-filter-item:focus-visible,
.ps-upload-card:focus-visible {
  outline: 3px solid rgba(253, 126, 20, 0.22);
  outline-offset: 2px;
}
.ps-template-card-blank {
  border-style: dashed;
  background: var(--white);
  justify-content: center;
  min-height: 200px;
}
.ps-template-card-blank:hover {
  border-color: var(--orange-500);
}
.ps-template-art {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-sm);
  box-sizing: border-box;
  height: 152px;
  padding: 14px 16px 13px;
  border: 1px solid #E7E4DF;
  background: linear-gradient(180deg, #FFFFFF 0%, #FCFBF8 100%);
  display: flex;
  flex-direction: column;
  gap: 7px;
  box-shadow: 0 1px 2px rgba(22, 26, 33, 0.04), inset 0 1px 0 rgba(255,255,255,0.9);
  transition:
    border-color var(--dur-micro) var(--ease),
    background var(--dur-micro) var(--ease),
    box-shadow var(--dur-micro) var(--ease),
    transform var(--dur-micro) var(--ease);
}
.ps-template-card:hover .ps-template-art {
  border-color: #D8D4CE;
  background: linear-gradient(180deg, #FFFFFF 0%, #FDFCF9 100%);
  box-shadow: 0 6px 16px rgba(22, 26, 33, 0.07), inset 0 1px 0 rgba(255,255,255,0.95);
  transform: translateY(-1px);
}
.ps-template-card.selected .ps-template-art {
  border-color: var(--orange-500);
  background: linear-gradient(180deg, #FFFDF9 0%, #FFF8EF 100%);
  box-shadow: 0 0 0 1px var(--orange-500), 0 8px 18px rgba(253, 126, 20, 0.12), inset 0 1px 0 rgba(255,255,255,0.95);
}
.ps-template-card:focus-visible .ps-template-art {
  outline: 3px solid rgba(253, 126, 20, 0.22);
  outline-offset: 2px;
}
.ps-template-art-row {
  display: grid;
  grid-template-columns: minmax(78px, 0.75fr) minmax(0, 1fr);
  align-items: baseline;
  gap: 14px;
  padding: 1px 0;
}
.ps-template-art-label {
  color: #9A9690;
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.12em;
  font-weight: 400;
  text-transform: uppercase;
}
.ps-template-art-value {
  color: var(--gray-700);
  font-size: 11.5px;
  font-weight: 400;
  line-height: 1.25;
  text-align: right;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ps-template-art-chips {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  align-items: center;
  min-width: 0;
  overflow: hidden;
  margin-top: auto;
}
.ps-template-art-chips .tagchip {
  background: rgba(255,255,255,0.78);
  border-color: #DDD8D0;
  color: var(--gray-700);
  box-shadow: 0 1px 1px rgba(22, 26, 33, 0.03);
}
.ps-template-tag-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 112px;
  line-height: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ps-template-tag-more {
  flex: none;
  min-width: 24px;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 400;
  line-height: 1;
}
.ps-template-card-copy {
  width: 100%;
  box-sizing: border-box;
  min-height: 24px;
  padding: 0 30px 0 2px;
  display: block;
  position: relative;
}
.ps-template-card-copy h3 {
  color: var(--gray-800);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.2;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.ps-template-menu-wrap {
  position: absolute;
  right: 2px;
  top: 50%;
  z-index: 2;
  transform: translateY(-50%);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-micro) var(--ease);
}
.ps-template-card:hover .ps-template-menu-wrap,
.ps-template-card:focus-within .ps-template-menu-wrap,
.ps-template-menu-wrap.open {
  opacity: 1;
  pointer-events: auto;
  z-index: 100;
}
.ps-template-menu-trigger {
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--gray-700);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}
.ps-template-menu-trigger:hover,
.ps-template-menu-wrap.open .ps-template-menu-trigger {
  color: var(--gray-800);
  background: transparent;
}
.ps-template-menu-trigger:focus-visible {
  outline: 3px solid rgba(253, 126, 20, 0.22);
  outline-offset: 2px;
}
.ps-template-menu {
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  z-index: 110;
  min-width: 140px;
  padding: 6px;
  border: 1px solid var(--gray-200);
  border-radius: 7px;
  background: var(--white);
  box-shadow: 0 12px 28px rgba(22, 26, 33, 0.14);
}
.ps-template-menu-item {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--gray-800);
  display: flex;
  align-items: center;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.ps-template-menu-item:hover {
  background: var(--gray-50);
}
.ps-template-menu-item.danger {
  color: #B42318;
}
.ps-template-menu-item.danger:hover {
  background: #FFF1F0;
}
.ps-template-menu-item:disabled {
  color: var(--gray-400);
  cursor: not-allowed;
  background: transparent;
}
.ps-template-card-copy p {
  color: var(--gray-600);
  font-size: 12px;
  line-height: 1.5;
}
.ps-template-selected-pill {
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: #FFF3E7;
  color: var(--orange-700);
  border: 1px solid #FFD4AA;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
}
.ps-template-blank-badge {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #FFF1E4;
  color: var(--orange-600);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 1px rgba(253,126,20,0.12);
}
.ps-template-blank-badge .icon {
  width: 18px;
  height: 18px;
}
.ps-template-blank-link {
  color: var(--orange-600);
  font-size: 12px;
  font-weight: 600;
}
.ps-template-empty {
  grid-column: 1 / -1;
  min-height: 180px;
  padding: 20px;
  border: 1px dashed var(--gray-300);
  border-radius: var(--r-md);
  background: var(--white);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
}
.ps-template-empty strong {
  color: var(--gray-900);
  font-size: 17px;
  line-height: 1.15;
  margin-bottom: 8px;
}
.ps-template-empty p {
  max-width: 440px;
  color: var(--gray-600);
  font-size: 13px;
  line-height: 1.55;
  margin-bottom: 16px;
}
.ps-modal-footer {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--gray-200);
  background: var(--gray-50);
}
.ps-modal-footer-apply {
  background: var(--white);
}
.ps-modal-selected-template {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ps-modal-selected-template span {
  color: var(--gray-500);
  font-size: 11px;
  font-weight: 500;
}
.ps-modal-selected-template strong {
  max-width: 420px;
  color: var(--gray-900);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ps-modal-secondary-cta {
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
}
.ps-defaults-help {
  position: relative;
  flex: none;
}
.ps-defaults-help-trigger {
  height: 32px;
  padding: 0 8px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--gray-600);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  cursor: pointer;
}
.ps-defaults-help-trigger:hover,
.ps-defaults-help.open .ps-defaults-help-trigger {
  background: var(--gray-100);
  color: var(--gray-900);
}
.ps-defaults-help-trigger:focus-visible {
  outline: 3px solid rgba(253, 126, 20, 0.22);
  outline-offset: 2px;
}
.ps-help-mark {
  width: 16px;
  height: 16px;
  border: 1px solid var(--gray-300);
  border-radius: 50%;
  color: var(--gray-600);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}
.ps-defaults-popover {
  position: absolute;
  left: 0;
  bottom: calc(100% + 10px);
  z-index: 120;
  width: min(380px, calc(100vw - 48px));
  padding: 14px;
  border: 1px solid var(--gray-200);
  border-radius: var(--r-md);
  background: var(--white);
  box-shadow: 0 14px 34px rgba(22, 26, 33, 0.16);
}
.ps-defaults-popover::after {
  content: "";
  position: absolute;
  left: 20px;
  bottom: -7px;
  width: 12px;
  height: 12px;
  background: var(--white);
  border-right: 1px solid var(--gray-200);
  border-bottom: 1px solid var(--gray-200);
  transform: rotate(45deg);
}
.ps-defaults-popover > strong {
  display: block;
  margin-bottom: 6px;
  color: var(--gray-900);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
}
.ps-defaults-popover > p {
  margin: 0 0 12px;
  color: var(--gray-600);
  font-size: 12px;
  line-height: 1.45;
}
.ps-defaults-popover-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 10px;
  padding-top: 9px;
  border-top: 1px solid var(--gray-100);
}
.ps-defaults-popover-row + .ps-defaults-popover-row {
  margin-top: 9px;
}
.ps-defaults-popover-row span {
  color: var(--gray-900);
  font-size: 12px;
  font-weight: 600;
}
.ps-defaults-popover-row p {
  margin: 0;
  color: var(--gray-600);
  font-size: 12px;
  line-height: 1.4;
}
.ps-modal-footer-actions {
  display: flex;
  gap: 10px;
}
.ps-modal-cta {
  height: 32px;
  padding: 0 12px;
  gap: 6px;
  font-size: 13px;
  border-color: var(--orange-500);
  box-shadow: 0 1px 2px rgba(253, 126, 20, 0.16);
}
.ps-modal-cta:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.ps-cta-tooltip {
  position: relative;
  display: inline-flex;
}
.ps-cta-tooltip .btn:disabled {
  pointer-events: none;
}
.ps-cta-tooltip::before,
.ps-cta-tooltip::after {
  position: absolute;
  left: 50%;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 4px);
  transition: opacity var(--dur-micro) var(--ease), transform var(--dur-micro) var(--ease);
  transition-delay: 0ms;
  z-index: 5;
}
.ps-cta-tooltip::before {
  content: "";
  bottom: calc(100% + 5px);
  border: 6px solid transparent;
  border-top-color: var(--gray-900);
}
.ps-cta-tooltip::after {
  content: attr(data-tooltip);
  bottom: calc(100% + 16px);
  width: 260px;
  padding: 9px 10px;
  border-radius: var(--r-md);
  background: var(--gray-900);
  color: var(--white);
  box-shadow: 0 10px 24px rgba(0,0,0,0.16);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.35;
  text-align: left;
  white-space: normal;
}
.ps-cta-tooltip:last-child::after {
  left: auto;
  right: 0;
  transform: translateY(4px);
}
.ps-cta-tooltip:hover::before,
.ps-cta-tooltip:hover::after,
.ps-cta-tooltip:focus-within::before,
.ps-cta-tooltip:focus-within::after {
  opacity: 1;
  transform: translate(-50%, 0);
  transition-delay: 1s;
}
.ps-cta-tooltip:last-child:hover::after,
.ps-cta-tooltip:last-child:focus-within::after {
  transform: translateY(0);
}

@media (max-width: 1320px) {
  .ps-home-board {
    grid-template-columns: 320px 1fr;
  }
  .ps-home-board::before {
    left: 320px;
  }
  .ps-builder-stage {
    grid-template-columns: 300px 1fr;
  }
  .ps-project-grid,
  .ps-template-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1080px) {
  .ps-home-board {
    grid-template-columns: 1fr;
    background: #F6F7F8;
  }
  .ps-home-board::before {
    display: none;
  }
  .ps-upload-card {
    width: min(420px, calc(100% - 32px));
    margin: 16px auto 0;
  }
  .ps-projects-shell {
    padding: 18px 16px 28px;
  }
  .ps-projects-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }
  .ps-projects-toolbar-actions {
    width: 100%;
    flex-wrap: wrap;
  }
  .ps-home-select,
  .ps-home-search {
    width: 100%;
  }
  .ps-modal {
    width: calc(100% - 32px);
    height: calc(100% - 32px);
  }
  .ps-builder-toprow {
    grid-template-columns: 1fr;
    justify-items: start;
  }
  .ps-builder-stepper {
    justify-self: stretch;
    flex-wrap: wrap;
  }
  .ps-builder-stage {
    grid-template-columns: 1fr;
  }
  .ps-builder-panel {
    width: 100%;
    max-width: 360px;
  }
}

@media (max-width: 780px) {
  .ps-modal-head {
    padding: 14px 16px;
  }
  .ps-modal-main {
    gap: 22px;
    padding: 20px 16px 26px;
  }
  .ps-action-row {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .ps-project-grid,
  .ps-template-grid {
    grid-template-columns: 1fr;
    row-gap: 28px;
  }
  .ps-modal-footer {
    flex-direction: column;
    align-items: flex-start;
    padding: 16px;
  }
  .ps-modal-footer-actions {
    width: 100%;
    flex-wrap: wrap;
  }
  .ps-builder-model-wrap {
    inset: 78px 18px 24px;
  }
  .ps-builder-model-image {
    width: min(620px, 92vw);
    max-height: 58vh;
  }
  .ps-builder-orbit-cube {
    top: 20px;
    right: 20px;
    width: 126px;
    height: 128px;
  }
}

/* Floating screen switcher (prototype helper, distinct from Tweaks) */
.screen-switcher {
  position: fixed; left: 16px; bottom: 16px; z-index: 50;
  background: var(--gray-900); color: var(--white);
  border-radius: var(--r-md);
  padding: 4px;
  display: inline-flex; gap: 2px;
  box-shadow: 0 8px 22px rgba(0,0,0,0.18);
}
.screen-switcher button {
  height: 30px; padding: 0 12px;
  background: transparent; color: rgba(255,255,255,0.65);
  border: none; border-radius: var(--r-sm);
  font-family: var(--font-sans); font-size: 12px; font-weight: 500;
  cursor: pointer;
}
.screen-switcher button.active { background: var(--white); color: var(--gray-900); }
.screen-switcher .ss-label { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: rgba(255,255,255,0.45); padding: 0 10px; display: inline-flex; align-items: center; }

/* Utility */
.row { display: flex; align-items: center; gap: var(--s-2); }
.col { display: flex; flex-direction: column; gap: var(--s-2); }
.spacer { flex: 1; }
.divider-v { width: 1px; height: 18px; background: var(--gray-200); margin: 0 4px; }
.muted { color: var(--gray-600); }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums slashed-zero; }

/* Variation canvas page */
.canvas-host { width: 100%; height: 100vh; background: var(--bg-1); }
.canvas-surface-preview {
  position: relative;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--white);
  overflow: hidden;
}
.canvas-surface-preview > * {
  width: 100%;
}
.canvas-surface-preview .topbar {
  display: none;
}
.canvas-surface-preview .settings-page,
.canvas-surface-preview .part-spec-app-shell,
.canvas-surface-preview .app-shell {
  height: 100%;
  min-height: 100%;
}
.canvas-surface-preview .settings-app-header,
.canvas-surface-preview .header {
  flex: none;
}
.canvas-surface-preview .part-spec-launch-screen {
  height: calc(100% - 64px);
  min-height: calc(100% - 64px);
  overflow: hidden;
}
.canvas-surface-preview .ps-builder-shell {
  min-height: 100%;
  height: 100%;
  overflow: hidden;
}
.canvas-surface-preview .workspace,
.canvas-surface-preview .settings-shell,
.canvas-surface-preview .canvas-area,
.canvas-surface-preview .ps-projects-shell,
.canvas-surface-preview .ps-home-board,
.canvas-surface-preview .ps-modal,
.canvas-surface-preview .ps-modal-body,
.canvas-surface-preview .ps-modal-main,
.canvas-surface-preview .ps-modal-sidebar,
.canvas-surface-preview .ps-builder-stage,
.canvas-surface-preview .ps-builder-canvas {
  min-height: 0;
}
.canvas-surface-preview .workspace,
.canvas-surface-preview .settings-shell,
.canvas-surface-preview .canvas-area {
  height: 100%;
}
.canvas-surface-preview .settings-main,
.canvas-surface-preview .ps-projects-shell,
.canvas-surface-preview .ps-modal-main,
.canvas-surface-preview .ps-modal-sidebar {
  overflow: auto;
}
.canvas-surface-preview .ps-home-board {
  min-height: 100%;
  align-items: start;
}
.canvas-surface-preview .ps-modal-scrim {
  position: absolute;
}
.canvas-surface-preview .ps-modal {
  position: absolute;
  width: min(880px, calc(100% - 32px));
  height: auto;
  max-height: calc(100% - 32px);
  display: flex;
  flex-direction: column;
}
.canvas-surface-preview .ps-modal-body {
  flex: 1;
}
.canvas-auth-preview {
  position: relative;
  height: 100%;
  min-height: 0;
  background: var(--gray-50);
  overflow: hidden;
}
.canvas-auth-preview .auth-sheet {
  position: absolute;
  inset: 0;
  width: auto;
  border-left: none;
  box-shadow: none;
}
.canvas-auth-preview .auth-body {
  min-height: 0;
}

/* Material thumbnail glyphs */
.mat-thumb {
  width: 100%; height: 100%; border-radius: 2px;
  display: grid; place-items: center;
  font-family: var(--font-mono); font-size: 8px; font-weight: 600; letter-spacing: 0.06em; color: var(--gray-700);
}
.mat-aluminum { background: linear-gradient(135deg, #E8EDF1, #C9D2DA); }
.mat-steel { background: linear-gradient(135deg, #C5CCD4, #8B95A1); color: var(--white); }
.mat-stainless { background: linear-gradient(135deg, #DDE3E8, #B6BFC9); }
.mat-titanium { background: linear-gradient(135deg, #D9D6CF, #A09988); color: var(--white); }
.mat-copper { background: linear-gradient(135deg, #E8B894, #B57A53); color: var(--white); }
.mat-brass { background: linear-gradient(135deg, #EBD594, #B6975C); color: var(--white); }
.mat-plastic { background: linear-gradient(135deg, #F0E8DD, #D4C7B5); }
.mat-composite { background: repeating-linear-gradient(45deg, #2C3038, #2C3038 3px, #1A1D22 3px, #1A1D22 6px); color: var(--white); }
.mat-printed { background: repeating-linear-gradient(0deg, #E5E0D8, #E5E0D8 2px, #D4CDC0 2px, #D4CDC0 4px); }
