/* Visual layer adapted from docs/prototype/index.html.
   Existing ids, form controls and application behavior stay in static/index.html + app.js. */

:root {
  --wb-bg: #05080f;
  --wb-panel: rgba(13, 20, 34, 0.72);
  --wb-panel-solid: #0b1220;
  --wb-panel-soft: rgba(8, 14, 25, 0.58);
  --wb-line: rgba(56, 189, 248, 0.14);
  --wb-line-strong: rgba(56, 189, 248, 0.34);
  --wb-cyan: #22d3ee;
  --wb-sky: #38bdf8;
  --wb-indigo: #6366f1;
  --wb-success: #34d399;
  --wb-text: #e7eef8;
  --wb-muted: #8296b0;
  --wb-muted-2: #5b6b82;
  --wb-gradient: linear-gradient(135deg, #22d3ee 0%, #38bdf8 45%, #6366f1 100%);
  --wb-radius: 18px;
  --topbar-height: 74px;
  --side-panel-width: 365px;
}

body.theme-light {
  --wb-bg: #f1f5fa;
  --wb-panel: rgba(255, 255, 255, 0.78);
  --wb-panel-solid: #ffffff;
  --wb-panel-soft: rgba(255, 255, 255, 0.62);
  --wb-line: rgba(18, 55, 110, 0.1);
  --wb-line-strong: rgba(8, 145, 178, 0.38);
  --wb-cyan: #0891b2;
  --wb-sky: #0284c7;
  --wb-indigo: #4f46e5;
  --wb-success: #059669;
  --wb-text: #0d1b2e;
  --wb-muted: #4c5f7a;
  --wb-muted-2: #8496ad;
  --wb-gradient: linear-gradient(135deg, #06b6d4 0%, #3b82f6 50%, #6366f1 100%);
}

body {
  position: relative;
  background: var(--wb-bg);
  color: var(--wb-text);
  -webkit-font-smoothing: antialiased;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

body::before {
  background-image:
    linear-gradient(rgba(56, 189, 248, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(56, 189, 248, 0.045) 1px, transparent 1px),
    linear-gradient(rgba(56, 189, 248, 0.075) 1px, transparent 1px),
    linear-gradient(90deg, rgba(56, 189, 248, 0.075) 1px, transparent 1px);
  background-size: 36px 36px, 36px 36px, 180px 180px, 180px 180px;
  -webkit-mask-image: radial-gradient(ellipse 94% 86% at 50% 0%, #000 42%, transparent 100%);
  mask-image: radial-gradient(ellipse 94% 86% at 50% 0%, #000 42%, transparent 100%);
}

body::after {
  background:
    radial-gradient(circle at 4% -8%, rgba(34, 211, 238, 0.16), transparent 29%),
    radial-gradient(circle at 102% 92%, rgba(99, 102, 241, 0.14), transparent 31%),
    radial-gradient(circle at 56% 45%, rgba(56, 189, 248, 0.055), transparent 26%);
}

.theme-light::before {
  background-image:
    linear-gradient(rgba(37, 99, 235, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(37, 99, 235, 0.05) 1px, transparent 1px),
    linear-gradient(rgba(37, 99, 235, 0.085) 1px, transparent 1px),
    linear-gradient(90deg, rgba(37, 99, 235, 0.085) 1px, transparent 1px);
}

.theme-light::after {
  opacity: 0.42;
}

::selection {
  background: rgba(34, 211, 238, 0.26);
}

::-webkit-scrollbar {
  width: 0;
  height: 0;
}

::-webkit-scrollbar-thumb {
  border: 2px solid var(--wb-bg);
  border-radius: 8px;
  background: rgba(56, 189, 248, 0.2);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(56, 189, 248, 0.45);
}

/* Scrollbars only show while the user is actively scrolling. */
* {
  scrollbar-width: none;
}

.is-scrolling {
  scrollbar-width: thin;
}

.is-scrolling::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.app-frame {
  position: relative;
  z-index: 1;
}

/* Header */
.topbar {
  height: var(--topbar-height);
  padding: 10px 28px;
  gap: 14px;
  border-color: var(--wb-line);
  background: rgba(6, 10, 18, 0.74);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.theme-light .topbar {
  background: rgba(255, 255, 255, 0.82);
}

.brand-mark {
  width: 56px;
  height: 56px;
  filter: drop-shadow(0 0 12px rgba(34, 211, 238, 0.32));
}

.brand-copy h1 {
  color: var(--wb-text);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.35px;
  white-space: nowrap;
  word-break: keep-all;
}

.brand-copy h1 .grad {
  background: var(--wb-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand-copy p {
  margin-top: 3px;
  color: var(--wb-muted);
  font-size: 11.5px;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.topbar-actions {
  gap: 10px;
}

.status-banner {
  width: min(420px, 29vw);
  min-height: 38px;
  padding: 7px 16px;
  gap: 9px;
  border-color: var(--wb-line);
  border-radius: 999px;
  background: rgba(34, 211, 238, 0.06);
  box-shadow: none;
}

.status-banner:hover,
.status-banner[data-state="processing"] {
  border-color: var(--wb-line-strong);
  background: rgba(34, 211, 238, 0.09);
  box-shadow: 0 0 18px rgba(34, 211, 238, 0.1);
}

.status-banner[data-state="success"] {
  border-color: color-mix(in srgb, var(--wb-success) 34%, transparent);
  background: color-mix(in srgb, var(--wb-success) 8%, transparent);
}

.status-indicator {
  width: 8px;
  height: 8px;
  flex-basis: 8px;
  background: var(--wb-sky);
  box-shadow: none;
}

.status-indicator::after {
  content: "";
  position: absolute;
  inset: -4px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  color: var(--wb-sky);
  animation: wb-ripple 1.8s ease-out infinite;
}

.status-banner[data-state="success"] .status-indicator {
  background: var(--wb-success);
}

.status {
  color: var(--wb-muted);
  font-size: 13px;
}

.utility-toggle,
.help-login-button,
.icon-button.primary {
  min-height: 38px;
  border-color: var(--wb-line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--wb-muted);
  box-shadow: none;
  transition: transform 180ms cubic-bezier(0.23, 1, 0.32, 1), border-color 180ms ease, color 180ms ease, box-shadow 180ms ease;
}

.auth-user-menu {
  position: relative;
}

.auth-user-trigger {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  max-width: 180px;
  padding: 5px 14px 5px 6px;
  border: 1px solid var(--wb-line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--wb-muted);
  cursor: pointer;
  font: inherit;
  font-size: 12.5px;
  line-height: 1;
  white-space: nowrap;
  transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.auth-user-trigger:hover,
.auth-user-trigger:focus-visible {
  border-color: var(--wb-line-strong);
  box-shadow: 0 0 16px rgba(34, 211, 238, 0.12);
  outline: none;
}

.auth-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--wb-gradient);
  color: #04121c;
  font-size: 12px;
  font-weight: 700;
}

.auth-avatar-image {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
}

.auth-avatar-image[hidden] {
  display: none;
}

.auth-user-name {
  max-width: 100px;
  overflow: hidden;
  color: var(--wb-muted);
  font-size: 12.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-user-chevron {
  flex-shrink: 0;
  color: var(--wb-muted);
  transition: transform 180ms ease;
}

.auth-user-trigger[aria-expanded="true"] .auth-user-chevron {
  transform: rotate(180deg);
}

.auth-user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 200;
  min-width: 140px;
  padding: 6px;
  overflow: hidden;
  border: 1px solid var(--wb-line);
  border-radius: 12px;
  background: rgba(13, 20, 34, 0.82);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 20px rgba(56, 189, 248, 0.1);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.auth-dropdown-item {
  display: block;
  width: 100%;
  padding: 9px 14px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--wb-text);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  text-align: left;
}

.auth-dropdown-item:hover,
.auth-dropdown-item:focus-visible {
  background: rgba(56, 189, 248, 0.1);
  outline: none;
}

.auth-dropdown-item.danger {
  color: #f87171;
}

.auth-dropdown-item.danger:hover,
.auth-dropdown-item.danger:focus-visible {
  background: rgba(248, 113, 113, 0.12);
}

.theme-light .auth-user-trigger {
  background: rgba(13, 30, 55, 0.04);
}

.theme-light .auth-avatar {
  color: #ffffff;
}

.theme-light .auth-user-dropdown {
  background: rgba(255, 255, 255, 0.88);
  border-color: var(--wb-line);
  box-shadow: 0 10px 30px rgba(15, 40, 80, 0.14);
}

.theme-light .auth-dropdown-item {
  color: var(--wb-text);
}

.theme-light .auth-dropdown-item:hover,
.theme-light .auth-dropdown-item:focus-visible {
  background: rgba(8, 145, 178, 0.1);
}

.theme-light .auth-dropdown-item.danger {
  color: #b91c1c;
}

.theme-light .auth-dropdown-item.danger:hover,
.theme-light .auth-dropdown-item.danger:focus-visible {
  background: rgba(185, 28, 28, 0.08);
}

.utility-toggle:hover,
.help-login-button:hover {
  border-color: var(--wb-line-strong);
  color: var(--wb-text);
  box-shadow: 0 0 16px rgba(34, 211, 238, 0.1);
  transform: translateY(-1px);
}

.icon-button.primary {
  position: relative;
  overflow: hidden;
  border: 0;
  background: var(--wb-gradient);
  color: #04121c;
  font-weight: 700;
  box-shadow: 0 4px 20px rgba(34, 211, 238, 0.28);
}

.theme-light .icon-button.primary {
  color: #ffffff;
}

.icon-button.primary::after,
.sidebar-idle-assist-demo::after {
  content: "";
  position: absolute;
  top: 0;
  left: -85%;
  width: 48%;
  height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.42), transparent);
  transform: skewX(-20deg);
  animation: wb-sheen 3.6s ease-in-out infinite;
}

/* Main shell */
.workspace,
.theme-light .workspace {
  grid-template-columns: var(--side-panel-width) 8px minmax(0, 1fr);
  padding: 8px 8px 8px;
  background: transparent;
}

.workspace.side-collapsed {
  grid-template-columns: 0 8px minmax(0, 1fr);
}

.side-panel {
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 6px;
  margin: 0;
  padding: 0;
  background: transparent;
}

.workflow-card,
.control-section,
.summary-panel,
.sidebar-idle-assist,
.data-panel,
.canvas-panel,
.idle-hero,
.idle-action-card,
.idle-guide-panel {
  border: 1px solid var(--wb-line);
  background: var(--wb-panel);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.workflow-card,
.sidebar-idle-assist,
.data-panel,
.canvas-panel,
.idle-hero,
.idle-action-card,
.idle-guide-panel {
  border-radius: var(--wb-radius);
}

.workflow-card,
.control-section {
  padding: 18px 20px;
}

.section-head h2,
.section-head > strong {
  color: var(--wb-text);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.7px;
}

.section-head h2::before,
.section-head > strong::before {
  content: "";
  display: inline-block;
  width: 3px;
  height: 14px;
  margin-right: 9px;
  border-radius: 2px;
  vertical-align: -2px;
  background: var(--wb-gradient);
  box-shadow: 0 0 8px rgba(34, 211, 238, 0.6);
}

#workflow-new-drawing {
  min-height: 32px;
  padding-inline: 12px;
  border-color: var(--wb-line-strong);
  border-radius: 8px;
  background: rgba(34, 211, 238, 0.06);
  color: var(--wb-cyan);
  font-size: 12px;
}

.steps {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: start;
  margin-top: 18px;
  gap: 0;
}

.steps::before {
  display: none;
}

.steps .workflow-step {
  position: relative;
  min-width: 0;
  min-height: 76px;
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 7px;
  padding: 0 3px;
  border: 0;
  background: transparent;
  color: var(--wb-muted);
  text-align: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.theme-light .steps .workflow-step {
  border: 0;
  background: transparent;
  color: var(--wb-muted);
}

.steps .workflow-step:last-child {
  min-height: 76px;
}

.steps .workflow-step::before {
  content: attr(data-step);
  position: relative;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1.5px solid rgba(130, 150, 176, 0.28);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  color: var(--wb-muted);
  font: 700 15px/1 "Rajdhani", "DIN Alternate", sans-serif;
  z-index: 1;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.steps .workflow-step:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 16px;
  left: calc(50% + 17px);
  right: calc(-50% + 17px);
  height: 2px;
  border-radius: 2px;
  background: rgba(130, 150, 176, 0.18);
}

.steps .workflow-step strong {
  max-width: 100%;
  color: var(--wb-muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
}

.steps .workflow-step small {
  display: none;
}

.steps .workflow-step.active::before {
  border-color: transparent;
  background: var(--wb-gradient);
  color: #04121c;
  box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.12), 0 0 20px rgba(34, 211, 238, 0.42);
}

.steps .workflow-step.active strong {
  color: var(--wb-text);
}

.steps .workflow-step.done::before {
  border-color: var(--wb-line-strong);
  background: rgba(34, 211, 238, 0.12);
  color: var(--wb-cyan);
}

.steps .workflow-step.done::after {
  background: var(--wb-gradient);
}

.theme-light .steps .workflow-step::before {
  border-color: rgba(76, 95, 122, 0.3);
  background: #ffffff;
  color: var(--wb-muted);
}

.theme-light .steps .workflow-step.active::before {
  border-color: transparent;
  background: var(--wb-gradient);
  color: #ffffff;
}

.theme-light .steps .workflow-step.done::before {
  border-color: var(--wb-line-strong);
  background: rgba(8, 145, 178, 0.1);
  color: var(--wb-cyan);
}

.steps .workflow-step:hover::before {
  transform: translateY(-2px) scale(1.04);
  border-color: var(--wb-cyan);
  box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.1), 0 0 16px rgba(34, 211, 238, 0.3);
}

.steps .workflow-step:hover strong {
  color: var(--wb-text);
}

.steps .workflow-step:active::before {
  transform: translateY(0) scale(0.92);
}

@media (prefers-reduced-motion: reduce) {
  .steps .workflow-step::before {
    transition: none;
  }
}

/* History library — blueprint glass modal */
.history-library-overlay {
  padding: 24px;
  background:
    radial-gradient(circle at 50% 12%, rgba(34, 211, 238, 0.12), transparent 38%),
    rgba(2, 6, 13, 0.78);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.history-library-dialog {
  width: min(1040px, calc(100vw - 48px));
  max-height: min(780px, calc(100vh - 48px));
  border: 1px solid var(--wb-line-strong);
  border-radius: 18px;
  background:
    linear-gradient(145deg, rgba(17, 28, 47, 0.98), rgba(7, 13, 25, 0.98));
  color: var(--wb-text);
  box-shadow:
    0 34px 90px rgba(0, 0, 0, 0.58),
    0 0 0 1px rgba(99, 102, 241, 0.08),
    0 0 70px rgba(34, 211, 238, 0.08);
  opacity: 1;
  transform: translateY(0) scale(1);
  transition:
    opacity 180ms cubic-bezier(0.23, 1, 0.32, 1),
    transform 180ms cubic-bezier(0.23, 1, 0.32, 1);
}

@starting-style {
  .history-library-dialog {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
}

.history-library-header {
  min-height: 76px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--wb-line);
  background: rgba(10, 20, 36, 0.58);
}

.history-library-header .history-library-title-row {
  gap: 12px;
}

.history-library-header .history-library-title-row h3 {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--wb-text);
  font-size: 20px;
  font-weight: 720;
  letter-spacing: 0.2px;
}

.history-library-header .history-library-title-row h3::before {
  content: "";
  width: 9px;
  height: 24px;
  border-radius: 999px;
  background: var(--wb-gradient);
  box-shadow: 0 0 18px rgba(34, 211, 238, 0.38);
}

.history-library-count {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  border: 1px solid var(--wb-line);
  border-radius: 999px;
  background: rgba(34, 211, 238, 0.07);
  color: var(--wb-cyan);
  font-size: 11px;
  font-weight: 700;
}

.history-library-actions {
  gap: 8px;
}

.history-library-icon-button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--wb-line);
  border-radius: 10px;
  background: rgba(8, 16, 29, 0.72);
  color: var(--wb-muted);
  transition:
    transform 140ms cubic-bezier(0.23, 1, 0.32, 1),
    border-color 140ms ease,
    background-color 140ms ease,
    color 140ms ease;
}

.history-library-icon-button:hover {
  border-color: var(--wb-line-strong);
  background: rgba(34, 211, 238, 0.09);
  color: var(--wb-text);
}

.history-library-icon-button:active {
  transform: scale(0.96);
}

.history-library-toolbar {
  grid-template-columns: minmax(240px, 1fr) 154px auto;
  gap: 10px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--wb-line);
  background: rgba(5, 12, 23, 0.48);
}

.history-library-search,
.history-library-filter {
  min-height: 40px;
  border: 1px solid var(--wb-line);
  border-radius: 10px;
  background: rgba(4, 11, 21, 0.72);
  color: var(--wb-muted);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease;
}

.history-library-search:focus-within,
.history-library-filter:focus {
  border-color: var(--wb-line-strong);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.08);
}

.history-library-search input,
.history-library-filter {
  color: var(--wb-text);
  font-size: 13px;
}

.history-library-search input::placeholder {
  color: var(--wb-muted-2);
}

.history-library-sort {
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--wb-line);
  border-radius: 10px;
  background: rgba(4, 11, 21, 0.72);
}

.history-library-sort button {
  min-height: 32px;
  padding: 0 14px;
  border-radius: 7px;
  color: var(--wb-muted);
  font-size: 12px;
  font-weight: 650;
  transition:
    transform 140ms cubic-bezier(0.23, 1, 0.32, 1),
    background-color 140ms ease,
    color 140ms ease;
}

.history-library-sort button.active {
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.19), rgba(99, 102, 241, 0.2));
  color: #dff8ff;
  box-shadow: inset 0 0 0 1px rgba(34, 211, 238, 0.18);
}

.history-library-sort button:active {
  transform: scale(0.97);
}

.history-library-body {
  padding: 18px 22px 22px;
  background:
    linear-gradient(rgba(56, 189, 248, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(56, 189, 248, 0.025) 1px, transparent 1px);
  background-size: 24px 24px;
}

.history-library-list {
  gap: 10px;
}

.history-library-date-header {
  gap: 10px;
  margin: 12px 0 4px;
  padding: 0 2px 8px;
  border-bottom-color: var(--wb-line);
}

.history-library-date-header strong {
  min-height: 26px;
  padding: 0 10px;
  border: 1px solid var(--wb-line);
  background: rgba(34, 211, 238, 0.07);
  color: var(--wb-cyan);
  font-size: 12px;
  font-weight: 700;
}

.history-library-date-header span {
  color: var(--wb-muted-2);
  font-size: 11px;
}

.history-library-item {
  gap: 16px;
  padding: 15px 16px;
  border: 1px solid var(--wb-line);
  border-radius: 13px;
  background: rgba(10, 20, 35, 0.74);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
  transition:
    transform 160ms cubic-bezier(0.23, 1, 0.32, 1),
    border-color 160ms ease,
    background-color 160ms ease,
    box-shadow 160ms ease;
}

.history-library-item:hover {
  transform: translateY(-1px);
  border-color: var(--wb-line-strong);
  background: rgba(13, 28, 47, 0.86);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 10px 26px rgba(0, 0, 0, 0.18);
}

.history-library-item.selected {
  border-color: rgba(251, 113, 133, 0.62);
  background: rgba(127, 29, 54, 0.18);
  box-shadow: 0 0 0 3px rgba(251, 113, 133, 0.08);
}

.history-library-item-content {
  gap: 6px;
}

.history-library-item-content strong {
  color: var(--wb-text);
  font-size: 14px;
  font-weight: 680;
}

.history-library-id {
  color: var(--wb-muted-2);
  font-size: 10.5px;
}

.history-library-meta {
  gap: 8px 20px;
  color: var(--wb-muted);
  font-size: 11.5px;
}

.history-library-tag {
  min-height: 22px;
  padding: 0 8px;
  border: 1px solid rgba(129, 140, 248, 0.2);
  background: rgba(99, 102, 241, 0.1);
  color: #aeb4ff;
  font-size: 10.5px;
  font-weight: 700;
}

.history-library-tag[data-status="done"] {
  border-color: rgba(52, 211, 153, 0.2);
  background: rgba(52, 211, 153, 0.09);
  color: #7ee8bd;
}

.history-library-tag[data-status="failed"] {
  border-color: rgba(251, 113, 133, 0.22);
  background: rgba(251, 113, 133, 0.09);
  color: #fda4b4;
}

.history-library-item-actions .pill-button {
  min-height: 32px;
  border-color: rgba(34, 211, 238, 0.3);
  background: rgba(34, 211, 238, 0.08);
  color: #bcefff;
  box-shadow: none;
  font-size: 12px;
  transition:
    transform 140ms cubic-bezier(0.23, 1, 0.32, 1),
    border-color 140ms ease,
    background-color 140ms ease;
}

.history-library-item-actions .pill-button:hover {
  border-color: rgba(34, 211, 238, 0.54);
  background: rgba(34, 211, 238, 0.14);
}

.history-library-item-actions .pill-button:active,
.history-library-footer .pill-button:active {
  transform: scale(0.97);
}

.history-library-empty {
  min-height: 240px;
  display: grid;
  place-content: center;
  gap: 10px;
  margin: 0;
  color: var(--wb-muted);
  font-size: 13px;
}

.history-library-empty::before {
  content: "⌁";
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  justify-self: center;
  border: 1px solid var(--wb-line);
  border-radius: 13px;
  background: rgba(34, 211, 238, 0.07);
  color: var(--wb-cyan);
  font-size: 24px;
}

.history-library-footer {
  min-height: 64px;
  gap: 10px;
  padding: 12px 22px;
  border-top: 1px solid var(--wb-line);
  background: rgba(6, 13, 25, 0.76);
}

.history-library-footer .pill-button {
  min-height: 32px;
  border-color: var(--wb-line);
  background: rgba(10, 20, 35, 0.72);
  color: var(--wb-text);
  box-shadow: none;
  font-size: 12px;
  transition:
    transform 140ms cubic-bezier(0.23, 1, 0.32, 1),
    border-color 140ms ease,
    background-color 140ms ease;
}

.history-library-footer .pill-button:hover {
  border-color: var(--wb-line-strong);
  background: rgba(34, 211, 238, 0.08);
}

.history-library-footnote {
  color: var(--wb-muted-2);
  font-size: 11px;
}

body.theme-light .history-library-overlay {
  background:
    radial-gradient(circle at 50% 10%, rgba(14, 165, 233, 0.1), transparent 40%),
    rgba(220, 231, 242, 0.72);
}

body.theme-light .history-library-dialog {
  border-color: rgba(8, 145, 178, 0.28);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.99), rgba(241, 247, 253, 0.99));
  color: var(--wb-text);
  box-shadow:
    0 32px 80px rgba(37, 60, 86, 0.24),
    0 0 0 1px rgba(14, 165, 233, 0.05);
}

body.theme-light .history-library-header,
body.theme-light .history-library-toolbar,
body.theme-light .history-library-footer {
  border-color: var(--wb-line);
  background: rgba(250, 253, 255, 0.76);
}

body.theme-light .history-library-search,
body.theme-light .history-library-filter,
body.theme-light .history-library-sort {
  border-color: var(--wb-line);
  background: rgba(255, 255, 255, 0.9);
  color: var(--wb-text);
  box-shadow: none;
}

body.theme-light .history-library-sort button.active {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.12), rgba(59, 130, 246, 0.12));
  color: var(--wb-indigo);
}

body.theme-light .history-library-body {
  background:
    linear-gradient(rgba(37, 99, 235, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(37, 99, 235, 0.03) 1px, transparent 1px);
  background-size: 24px 24px;
}

body.theme-light .history-library-item {
  border-color: var(--wb-line);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

body.theme-light .history-library-item:hover {
  border-color: var(--wb-line-strong);
  background: #ffffff;
  box-shadow: 0 10px 28px rgba(37, 60, 86, 0.1);
}

body.theme-light .history-library-item-content strong {
  color: var(--wb-text);
}

body.theme-light .history-library-item-actions .pill-button {
  border-color: rgba(8, 145, 178, 0.32);
  background: rgba(6, 182, 212, 0.08);
  color: #0e7490;
}

body.theme-light .history-library-item-actions .pill-button:hover {
  border-color: rgba(8, 145, 178, 0.5);
  background: rgba(6, 182, 212, 0.14);
}

body.theme-light .history-library-item.selected {
  border-color: rgba(225, 29, 72, 0.44);
  background: rgba(255, 241, 244, 0.9);
}

@media (max-width: 760px) {
  .history-library-overlay {
    padding: 12px;
  }

  .history-library-dialog {
    width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
    border-radius: 14px;
  }

  .history-library-toolbar {
    grid-template-columns: 1fr;
  }

  .history-library-sort {
    width: 100%;
  }

  .history-library-sort button {
    flex: 1;
  }

  .history-library-item,
  .history-library-item.selecting {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .history-library-item:not(.selecting) {
    grid-template-columns: minmax(0, 1fr);
  }

  .history-library-item-actions {
    grid-column: 1 / -1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .history-library-dialog,
  .history-library-icon-button,
  .history-library-sort button,
  .history-library-item,
  .history-library-item-actions .pill-button,
  .history-library-footer .pill-button {
    transition-duration: 0.01ms !important;
  }
}

.panel-resizer-left {
  border: 0;
}

.panel-resizer:hover,
.panel-resizer.is-dragging,
.theme-light .panel-resizer:hover,
.theme-light .panel-resizer.is-dragging {
  background: rgba(34, 211, 238, 0.07);
}

.collapse-handle,
.top-collapse-handle {
  border-color: var(--wb-line);
  background: color-mix(in srgb, var(--wb-panel-solid) 92%, transparent);
  color: var(--wb-muted);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.24);
}

.collapse-handle:hover,
.top-collapse-handle:hover {
  border-color: var(--wb-line-strong);
  color: var(--wb-cyan);
}

/* Sidebar preparation card */
.sidebar-idle-assist {
  gap: 15px;
  padding: 17px 20px 18px;
  background: var(--wb-panel);
}

.sidebar-idle-assist-heading {
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 12px;
}

.sidebar-idle-assist-icon {
  border-color: var(--wb-line-strong);
  border-radius: 11px;
  background: rgba(34, 211, 238, 0.1);
  color: var(--wb-cyan);
  box-shadow: 0 0 16px rgba(34, 211, 238, 0.12);
}

.sidebar-idle-assist-heading h2 {
  color: var(--wb-text);
  font-size: 14px;
  font-weight: 700;
}

.sidebar-idle-assist-heading p,
.sidebar-idle-assist-label,
.sidebar-idle-assist-checklist li {
  color: var(--wb-muted);
}

.sidebar-idle-assist-tags span {
  min-height: 26px;
  padding-inline: 12px;
  border-color: var(--wb-line);
  background: rgba(34, 211, 238, 0.07);
  color: color-mix(in srgb, var(--wb-cyan) 58%, var(--wb-text));
}

.sidebar-idle-assist-checklist {
  padding: 14px 0 0;
  border-top-color: color-mix(in srgb, var(--wb-sky) 9%, transparent);
  border-bottom: 0;
}

.sidebar-idle-assist-checklist li > span:first-child {
  border: 1px solid color-mix(in srgb, var(--wb-success) 40%, transparent);
  background: color-mix(in srgb, var(--wb-success) 12%, transparent);
  color: var(--wb-success);
}

.sidebar-idle-assist-demo {
  position: relative;
  overflow: hidden;
  min-height: 78px;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 12px;
  padding: 10px 14px;
  border: 0;
  border-radius: 14px;
  background: var(--wb-gradient);
  color: #04121c;
  box-shadow: 0 6px 24px rgba(34, 211, 238, 0.26);
}

.theme-light .sidebar-idle-assist-demo {
  color: #ffffff;
}

.sidebar-idle-assist-demo-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: rgba(4, 18, 28, 0.16);
}

.sidebar-idle-assist-help {
  min-height: 50px;
  border-color: var(--wb-line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--wb-muted);
}

.sidebar-idle-assist-help:hover {
  border-color: var(--wb-line-strong);
  background: rgba(34, 211, 238, 0.05);
  color: var(--wb-cyan);
}

/* Canvas shell and the idle composition */
.canvas-panel {
  margin: 0;
  border: 0;
  border-radius: var(--wb-radius);
  background: var(--wb-panel-soft);
}

.idle-state {
  gap: 12px;
  padding: 0;
  background: transparent;
  color: var(--wb-text);
}

.idle-hero {
  position: relative;
  min-height: 338px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(330px, 42%);
  align-items: center;
  gap: 18px;
  padding: 26px 32px;
  overflow: hidden;
  box-shadow: none;
}

.workflow-card,
.sidebar-idle-assist {
  position: relative;
}

.idle-hero-copy {
  position: relative;
  z-index: 2;
  min-width: 0;
}

.idle-kicker-row {
  gap: 0;
  margin-bottom: 16px;
}

.idle-kicker {
  min-height: 34px;
  padding: 0 15px;
  border-color: rgba(52, 211, 153, 0.34);
  background: rgba(52, 211, 153, 0.08);
  color: var(--wb-success);
  font-size: 12.5px;
  font-weight: 500;
  box-shadow: none;
}

.idle-dot {
  background: var(--wb-success);
  box-shadow: 0 0 8px var(--wb-success);
  animation: wb-blink 1.6s ease-in-out infinite;
}

.idle-kicker-note {
  margin-left: -1px;
  color: var(--wb-muted-2);
  font-size: 12px;
}

.idle-kicker-note::before {
  content: "/";
  margin: 0 8px;
  color: var(--wb-muted-2);
}

.idle-hero h2 {
  max-width: 460px;
  margin: 0 0 12px;
  background: var(--wb-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-size: clamp(25px, 2.15vw, 31px);
  font-weight: 800;
  line-height: 1.32;
  letter-spacing: 0.35px;
  text-wrap: balance;
}

.idle-hero p {
  max-width: 650px;
  color: var(--wb-muted);
  font-size: 13.5px;
  line-height: 1.7;
}

.idle-hero-metrics {
  display: flex;
  gap: 28px;
  margin-top: 20px;
}

.idle-hero-metrics span {
  display: grid;
  gap: 2px;
}

.idle-hero-metrics strong {
  background: var(--wb-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font: 700 22px/1.1 "Rajdhani", "DIN Alternate", sans-serif;
  letter-spacing: 0.6px;
}

.idle-hero-metrics small {
  color: var(--wb-muted-2);
  font-size: 11px;
  letter-spacing: 0.4px;
}

.idle-hero-art {
  position: relative;
  min-width: 0;
  height: 285px;
  color: var(--wb-sky);
  perspective: 900px;
}

#idle-part-3d,
#idle-blueprint-fallback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#idle-part-3d {
  z-index: 2;
  cursor: grab;
  touch-action: none;
}

#idle-part-3d:active {
  cursor: grabbing;
}

#idle-part-3d canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

#idle-blueprint-fallback {
  z-index: 1;
  overflow: visible;
  filter: drop-shadow(0 0 14px rgba(34, 211, 238, 0.16));
  transform: rotateX(3deg) rotateZ(-1deg);
  transform-style: preserve-3d;
  transition: opacity 240ms ease;
}

.idle-hero-art.is-3d-ready #idle-blueprint-fallback {
  opacity: 0;
}

.idle-fallback-bubble text {
  fill: var(--wb-cyan);
  font: 700 17px/1 "Rajdhani", sans-serif;
  text-anchor: middle;
}

.idle-fallback-bubble path {
  stroke: var(--wb-cyan);
  opacity: 0.75;
}

.idle-upload-zone {
  position: relative;
  min-height: 196px;
  gap: 9px;
  padding: 32px;
  overflow: hidden;
  border: 1.5px dashed color-mix(in srgb, var(--wb-sky) 36%, transparent);
  border-radius: var(--wb-radius);
  background: rgba(10, 16, 28, 0.5);
  color: var(--wb-text);
  transition: border-color 240ms ease, background 240ms ease, box-shadow 240ms ease, transform 240ms cubic-bezier(0.23, 1, 0.32, 1);
}

.theme-light .idle-upload-zone {
  background: rgba(255, 255, 255, 0.55);
}

.theme-light .idle-upload-icon {
  color: var(--wb-cyan);
}

.idle-upload-zone::before {
  content: "";
  position: absolute;
  top: -82px;
  right: 0;
  left: 0;
  height: 72px;
  background: linear-gradient(180deg, transparent, rgba(34, 211, 238, 0.1), transparent);
  animation: wb-scan 5.5s ease-in-out infinite;
  pointer-events: none;
}

.idle-upload-zone:hover {
  border-style: solid;
  border-color: var(--wb-cyan);
  background: rgba(34, 211, 238, 0.05);
  color: var(--wb-text);
  box-shadow: inset 0 0 40px rgba(34, 211, 238, 0.1), 0 12px 32px rgba(0, 0, 0, 0.12);
  transform: translateY(-1px);
}

.idle-upload-icon {
  width: 74px;
  height: 74px;
  padding: 20px;
  overflow: visible;
  border: 1px solid var(--wb-line-strong);
  border-radius: 22px;
  background: rgba(34, 211, 238, 0.08);
  color: var(--wb-cyan);
  stroke-width: 1.6;
  filter: drop-shadow(0 0 18px rgba(34, 211, 238, 0.18));
  animation: wb-float 4.4s ease-in-out infinite;
}

.idle-upload-zone strong {
  color: var(--wb-text);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.idle-upload-zone span {
  color: var(--wb-muted);
  font-size: 12.5px;
}

.idle-format-list {
  display: flex !important;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 9px;
}

.idle-format-list b {
  min-width: 44px;
  padding: 5px 10px;
  border: 1px solid rgba(130, 150, 176, 0.22);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--wb-muted);
  font: 600 10px/1 "Rajdhani", "DIN Alternate", sans-serif;
  letter-spacing: 1px;
}

.idle-action-grid {
  gap: 20px;
}

.idle-action-card {
  position: relative;
  min-height: 92px;
  gap: 17px;
  padding: 18px 22px;
  color: var(--wb-text);
  box-shadow: none;
  overflow: hidden;
  transition: transform 260ms cubic-bezier(0.23, 1, 0.32, 1), border-color 220ms ease, box-shadow 220ms ease;
}

.idle-action-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(34, 211, 238, 0.08), transparent 58%);
  opacity: 0;
  transition: opacity 220ms ease;
}

.idle-action-card:hover {
  border-color: var(--wb-line-strong);
  background: var(--wb-panel);
  box-shadow: 0 12px 34px rgba(3, 6, 12, 0.42), 0 0 24px rgba(34, 211, 238, 0.08);
  transform: translateY(-3px) rotateX(0.5deg);
}

.idle-action-card:hover::before {
  opacity: 1;
}

.idle-action-card.primary {
  border-color: rgba(99, 102, 241, 0.32);
  background: var(--wb-panel);
}

.idle-action-icon {
  position: relative;
  z-index: 1;
  width: 48px;
  height: 48px;
  border: 1px solid var(--wb-line-strong);
  border-radius: 14px;
  background: rgba(34, 211, 238, 0.09);
  color: var(--wb-cyan);
  box-shadow: 0 0 18px rgba(34, 211, 238, 0.1);
}

.idle-action-card.primary .idle-action-icon {
  border-color: rgba(99, 102, 241, 0.35);
  background: rgba(99, 102, 241, 0.1);
  color: color-mix(in srgb, var(--wb-indigo) 64%, var(--wb-text));
}

.idle-action-copy,
.idle-action-arrow {
  position: relative;
  z-index: 1;
}

.idle-action-copy strong {
  color: var(--wb-text);
  font-size: 15.5px;
  font-weight: 700;
}

.idle-action-copy span {
  color: var(--wb-muted);
  font-size: 12px;
}

.idle-action-copy em {
  padding: 2px 8px;
  border: 1px solid rgba(99, 102, 241, 0.38);
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.14);
  color: color-mix(in srgb, var(--wb-indigo) 54%, var(--wb-text));
  font-size: 10px;
}

.idle-action-arrow {
  color: var(--wb-muted-2);
  font-size: 19px;
  transition: transform 220ms ease, color 220ms ease;
}

.idle-action-card:hover .idle-action-arrow {
  color: var(--wb-cyan);
  transform: translateX(4px);
}

.idle-guide-button {
  width: 100%;
  min-height: 48px;
  justify-content: center;
  border-color: var(--wb-line);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--wb-muted);
  font-size: 13.5px;
  font-weight: 500;
  transition: border-color 220ms ease, color 220ms ease, box-shadow 220ms ease;
}

.idle-guide-button:hover {
  border-color: var(--wb-line-strong);
  color: var(--wb-cyan);
  box-shadow: 0 0 20px rgba(34, 211, 238, 0.1);
}

.idle-guide-button svg:last-child {
  transition: transform 220ms ease;
}

.idle-guide-button[aria-expanded="true"] svg:last-child {
  transform: rotate(180deg);
}

.idle-guide-panel {
  max-width: none;
  color: var(--wb-muted);
}

/* Processed drawing state: keep the same blueprint glass language. */
.drawing-header,
.canvas-toolbar,
.theme-light .drawing-header,
.theme-light .canvas-toolbar {
  border-color: var(--wb-line);
  background: color-mix(in srgb, var(--wb-panel-solid) 82%, transparent);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.canvas-toolbar {
  position: relative;
  z-index: 19;
  flex-wrap: wrap;
  align-content: center;
  row-gap: 6px;
  padding-block: 6px;
}

.canvas-toolbar > * {
  flex-shrink: 0;
}

.canvas-toolbar > .toolbar-spacer {
  flex: 1 1 8px;
}

.canvas-toolbar button,
.canvas-toolbar label,
.canvas-toolbar span {
  white-space: nowrap;
}

.drawing-file,
.drawing-file strong,
.theme-light .drawing-file,
.theme-light .drawing-file strong {
  color: var(--wb-text);
}

.segmented,
.zoom-control,
.bubble-controls,
.theme-light .segmented,
.theme-light .zoom-control,
.theme-light .bubble-controls {
  border-color: var(--wb-line);
  background: rgba(255, 255, 255, 0.035);
}

.segmented button,
.zoom-control button,
.theme-light .segmented button,
.theme-light .zoom-control button {
  border-color: var(--wb-line);
  color: var(--wb-muted);
}

.segmented button.active,
.theme-light .segmented button.active {
  background: var(--wb-gradient);
  color: #ffffff;
}

.zoom-control span,
.bubble-size-control span,
.theme-light .zoom-control span {
  color: var(--wb-text);
}

.data-panel {
  background: var(--wb-panel);
}

.tabs,
.theme-light .tabs {
  border-color: var(--wb-line);
  background: rgba(255, 255, 255, 0.025);
}

.tab-button,
.theme-light .tab-button {
  border-color: var(--wb-line);
  color: var(--wb-muted);
}

.tab-button.active,
.theme-light .tab-button.active {
  background: rgba(34, 211, 238, 0.07);
  color: var(--wb-text);
  box-shadow: inset 0 -2px 0 var(--wb-cyan);
}

.table-shell,
.gdt-table th,
.gdt-table td,
.theme-light .table-shell,
.theme-light .gdt-table th,
.theme-light .gdt-table td {
  border-color: var(--wb-line);
  background: transparent;
}

.gdt-table th,
.theme-light .gdt-table th {
  background: color-mix(in srgb, var(--wb-panel-solid) 92%, transparent);
  color: var(--wb-muted);
}

.gdt-table td,
.theme-light .gdt-table td {
  color: var(--wb-text);
}

.gdt-table tbody tr:hover td,
.theme-light .gdt-table tbody tr:hover td {
  background: rgba(34, 211, 238, 0.08);
}

.modal-dialog,
.annotation-toolbar-popover,
.context-menu,
.auth-card,
.theme-light .modal-dialog,
.theme-light .annotation-toolbar-popover,
.theme-light .context-menu,
.theme-light .auth-card {
  border-color: var(--wb-line-strong);
  background: color-mix(in srgb, var(--wb-panel-solid) 96%, transparent);
  color: var(--wb-text);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.4), 0 0 34px rgba(34, 211, 238, 0.07);
}

/* Annotation tools — viewport-level blueprint glass modals */
.modal-overlay:is(.bubble-sort-overlay, .bulk-gage-overlay, .category-filter-overlay) {
  z-index: 1120;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 12%, rgba(34, 211, 238, 0.12), transparent 38%),
    rgba(2, 6, 13, 0.78);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.modal-dialog:is(.bubble-sort-dialog, .bulk-gage-dialog, .category-filter-dialog) {
  position: relative;
  inset: auto;
  max-height: min(760px, calc(100vh - 48px));
  overflow: hidden;
  border: 1px solid var(--wb-line-strong);
  border-radius: 18px;
  background: linear-gradient(
    145deg,
    color-mix(in srgb, var(--wb-panel-solid) 98%, var(--wb-cyan) 2%),
    color-mix(in srgb, var(--wb-panel-solid) 98%, var(--wb-indigo) 2%)
  );
  color: var(--wb-text);
  box-shadow:
    0 34px 90px rgba(0, 0, 0, 0.58),
    0 0 0 1px rgba(99, 102, 241, 0.08),
    0 0 70px rgba(34, 211, 238, 0.08);
  opacity: 1;
  transform: translateY(0) scale(1);
  transition:
    opacity 180ms cubic-bezier(0.23, 1, 0.32, 1),
    transform 180ms cubic-bezier(0.23, 1, 0.32, 1);
}

@starting-style {
  .modal-dialog:is(.bubble-sort-dialog, .bulk-gage-dialog, .category-filter-dialog) {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
}

.modal-dialog.bubble-sort-dialog {
  width: min(980px, calc(100vw - 48px));
}

.modal-dialog.bulk-gage-dialog {
  width: min(720px, calc(100vw - 48px));
}

.modal-dialog.category-filter-dialog {
  width: min(980px, calc(100vw - 48px));
}

.bubble-sort-dialog .modal-header,
.category-filter-dialog .modal-header,
.bulk-gage-dialog .bulk-gage-header {
  min-height: 76px;
  padding: 18px 22px;
  border-color: var(--wb-line);
  background: color-mix(in srgb, var(--wb-panel-solid) 76%, transparent);
}

.bubble-sort-dialog .modal-header h3,
.category-filter-dialog .modal-header h3,
.bulk-gage-header-text h3 {
  color: var(--wb-text);
  font-size: 19px;
  font-weight: 720;
  letter-spacing: 0.2px;
}

.bubble-sort-dialog .modal-header p,
.category-filter-dialog .modal-header p,
.bulk-gage-dialog .bulk-gage-subtitle {
  color: var(--wb-muted);
}

.reference-modal-title-icon,
.bulk-gage-title-icon {
  border: 1px solid var(--wb-line-strong);
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.18), rgba(99, 102, 241, 0.2));
  color: var(--wb-cyan);
  box-shadow: 0 0 18px rgba(34, 211, 238, 0.1);
}

.theme-light .reference-modal-title-icon,
.theme-light .bulk-gage-title-icon {
  border: 1px solid var(--wb-line-strong);
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.12), rgba(79, 70, 229, 0.12));
  color: var(--wb-cyan);
}

.bubble-sort-dialog .modal-close,
.category-filter-dialog .modal-close,
.bulk-gage-dialog .modal-close {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--wb-line);
  border-radius: 10px;
  background: rgba(8, 16, 29, 0.62);
  color: var(--wb-muted);
  font-size: 21px;
  transition:
    transform 140ms cubic-bezier(0.23, 1, 0.32, 1),
    border-color 140ms ease,
    background-color 140ms ease,
    color 140ms ease;
}

.bubble-sort-dialog .modal-close:hover,
.category-filter-dialog .modal-close:hover,
.bulk-gage-dialog .modal-close:hover {
  border-color: var(--wb-line-strong);
  background: rgba(34, 211, 238, 0.08);
  color: var(--wb-text);
}

.theme-light .bubble-sort-dialog .modal-close,
.theme-light .category-filter-dialog .modal-close,
.theme-light .bulk-gage-dialog .modal-close {
  border-color: var(--wb-line);
  background: rgba(13, 27, 46, 0.035);
  color: var(--wb-muted);
}

.theme-light .bubble-sort-dialog .modal-close:hover,
.theme-light .category-filter-dialog .modal-close:hover,
.theme-light .bulk-gage-dialog .modal-close:hover {
  border-color: var(--wb-line-strong);
  background: rgba(8, 145, 178, 0.07);
  color: var(--wb-text);
}

.bubble-sort-dialog .modal-close:active,
.category-filter-dialog .modal-close:active,
.bulk-gage-dialog .modal-close:active {
  transform: scale(0.96);
}

.bubble-sort-dialog .modal-body,
.category-filter-dialog .modal-body,
.bulk-gage-dialog .modal-body {
  background:
    linear-gradient(rgba(56, 189, 248, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(56, 189, 248, 0.018) 1px, transparent 1px);
  background-size: 24px 24px;
  color: var(--wb-text);
}

.bubble-sort-body h4,
.category-filter-summary strong,
.category-filter-text strong,
.bulk-gage-row-title {
  color: var(--wb-text);
}

.bubble-sort-rule-item,
.bubble-sort-preview-summary,
.bubble-sort-preview-table-shell,
.category-filter-card,
.bulk-gage-hint,
.bulk-gage-list {
  border-color: var(--wb-line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--wb-text);
}

.bubble-sort-rule-item {
  border-color: var(--wb-line-strong);
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.07), rgba(99, 102, 241, 0.07));
}

.bubble-sort-preview-table th {
  background: color-mix(in srgb, var(--wb-panel-solid) 86%, transparent);
  color: var(--wb-muted);
}

.bubble-sort-preview-table th,
.bubble-sort-preview-table td,
.bulk-gage-row {
  border-color: var(--wb-line);
}

.category-filter-card {
  transition:
    transform 150ms cubic-bezier(0.23, 1, 0.32, 1),
    border-color 150ms ease,
    background-color 150ms ease;
}

.category-filter-card:hover {
  border-color: var(--wb-line-strong);
  background: rgba(34, 211, 238, 0.055);
}

.category-filter-card:active {
  transform: scale(0.985);
}

.category-filter-symbol,
.bulk-gage-row-icon {
  border-color: var(--wb-line-strong);
  background: rgba(34, 211, 238, 0.055);
  color: var(--wb-cyan);
}

.bulk-gage-row:hover,
.bulk-gage-row.is-configured {
  background: rgba(34, 211, 238, 0.035);
}

.bulk-gage-row select {
  border-color: var(--wb-line);
  background-color: color-mix(in srgb, var(--wb-panel-solid) 90%, transparent);
  color: var(--wb-text);
}

.modal-footer.bubble-sort-footer,
.modal-footer.bulk-gage-footer,
.modal-footer.category-filter-footer {
  min-height: 76px;
  padding: 16px 22px;
  border-color: var(--wb-line);
  background: color-mix(in srgb, var(--wb-panel-solid) 76%, transparent);
}

.bubble-sort-footer .pill-button,
.bulk-gage-footer .pill-button,
.category-filter-footer .pill-button {
  min-width: 120px;
  min-height: 40px;
  border-radius: 10px;
  transition:
    transform 140ms cubic-bezier(0.23, 1, 0.32, 1),
    border-color 140ms ease,
    background-color 140ms ease,
    color 140ms ease;
}

.bubble-sort-footer .pill-button:active,
.bulk-gage-footer .pill-button:active,
.category-filter-footer .pill-button:active {
  transform: scale(0.97);
}

.bubble-sort-footer .pill-button:not(.primary),
.bulk-gage-footer .pill-button:not(.primary),
.category-filter-footer .pill-button:not(.primary) {
  border-color: var(--wb-line);
  background: rgba(255, 255, 255, 0.035);
  color: var(--wb-muted);
  box-shadow: none;
}

.bubble-sort-footer .pill-button:not(.primary):hover,
.bulk-gage-footer .pill-button:not(.primary):hover,
.category-filter-footer .pill-button:not(.primary):hover {
  border-color: var(--wb-line-strong);
  background: rgba(34, 211, 238, 0.07);
  color: var(--wb-text);
}

.bubble-sort-footer .pill-button.primary,
.bulk-gage-footer .pill-button.primary,
.category-filter-footer .pill-button.primary {
  border-color: transparent;
  background: var(--wb-gradient);
  color: #ffffff;
  box-shadow: 0 10px 24px rgba(34, 211, 238, 0.16);
}

@media (max-width: 768px) {
  .modal-overlay:is(.bubble-sort-overlay, .bulk-gage-overlay, .category-filter-overlay) {
    padding: 12px;
  }

  .modal-dialog:is(.bubble-sort-dialog, .bulk-gage-dialog, .category-filter-dialog) {
    width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
    border-radius: 14px;
  }

  .bubble-sort-body {
    grid-template-columns: 1fr;
  }

  .category-filter-list {
    grid-template-columns: 1fr;
  }

  .category-filter-summary,
  .category-filter-footer,
  .bubble-sort-footer {
    align-items: stretch;
    flex-direction: column;
  }
}

@keyframes wb-ripple {
  from { transform: scale(0.5); opacity: 1; }
  to { transform: scale(1.65); opacity: 0; }
}

@keyframes wb-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

@keyframes wb-sheen {
  0%, 60% { left: -85%; }
  100% { left: 165%; }
}

@keyframes wb-scan {
  0% { top: -82px; opacity: 0; }
  12%, 88% { opacity: 1; }
  100% { top: 105%; opacity: 0; }
}

@keyframes wb-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

@media (max-width: 1180px) {
  .workspace,
  .theme-light .workspace {
    padding: 8px;
  }

  .idle-hero {
    grid-template-columns: minmax(0, 1fr) minmax(280px, 38%);
  }

  .idle-hero-art {
    height: 220px;
  }
}

@media (max-width: 960px) {
  .idle-hero {
    grid-template-columns: 1fr;
  }

  .idle-hero-art {
    display: none;
  }
}

@media (max-width: 768px) {
  :root {
    --topbar-height: 100px;
  }

  .topbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    height: auto;
    min-height: 64px;
    padding: 10px 12px;
    gap: 10px;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
    margin-right: auto;
  }

  .brand-copy {
    display: none;
  }

  .topbar-actions {
    display: contents;
  }

  .topbar-actions > .status-banner {
    flex: 1 0 100%;
    width: 100%;
    min-height: 32px;
    padding: 6px 12px;
    font-size: 12px;
    order: 99;
  }

  .topbar-actions > .utility-toggle,
  .topbar-actions > .help-login-button,
  .topbar-actions > .auth-user-trigger,
  .topbar-actions > #help-nav-link,
  .topbar-actions > .auth-user-menu {
    margin-left: 0;
  }

  .utility-toggle,
  .help-login-button,
  .auth-user-trigger,
  .icon-button.primary {
    padding: 6px 10px;
    font-size: 12px;
  }

  #help-nav-link {
    padding: 6px 12px;
    font-size: 12px;
  }

  .workspace,
  .theme-light .workspace {
    padding: 0;
  }

  .side-panel {
    gap: 12px;
    padding: 12px;
  }

  .canvas-panel,
  .workflow-card,
  .sidebar-idle-assist,
  .idle-hero,
  .idle-upload-zone,
  .idle-action-card {
    border-radius: 12px;
  }

  .idle-state {
    padding: 12px;
  }

  .idle-hero {
    min-height: auto;
    padding: 22px;
  }

  .idle-kicker-row {
    gap: 8px;
  }

  .idle-kicker-note {
    margin-left: 0;
  }

  .idle-kicker-note::before {
    content: none;
  }

  .idle-hero h2 {
    font-size: 25px;
  }

  .idle-hero-metrics {
    gap: 18px;
  }

  .idle-upload-zone {
    min-height: 210px;
  }
}

@media (max-width: 480px) {
  :root {
    --topbar-height: 94px;
  }

  .topbar {
    padding: 8px 10px;
    gap: 8px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .utility-toggle,
  .help-login-button,
  .auth-user-trigger,
  .icon-button.primary,
  #help-nav-link {
    padding: 5px 8px;
    font-size: 11.5px;
  }

  .status-banner {
    font-size: 11.5px;
  }

  .idle-hero {
    padding: 16px;
  }

  .idle-hero h2 {
    font-size: 20px;
  }

  .idle-hero-metrics {
    gap: 10px;
    flex-wrap: wrap;
  }

  .idle-upload-zone {
    min-height: 160px;
    padding: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .modal-dialog:is(.bubble-sort-dialog, .bulk-gage-dialog, .category-filter-dialog) {
    transition-duration: 0.01ms !important;
  }

  .status-indicator::after,
  .idle-dot,
  .icon-button.primary::after,
  .sidebar-idle-assist-demo::after,
  .idle-upload-zone::before,
  .idle-upload-icon {
    animation: none !important;
  }

  .idle-action-card,
  .utility-toggle,
  .help-login-button,
  .auth-user-trigger,
  .idle-upload-zone {
    transition-duration: 0.01ms !important;
  }
}
