:root {
  color-scheme: light;
  font-family: Inter, "PingFang SC", "Noto Sans SC", "Noto Sans JP",
    ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --canvas: #f7f8fa;
  --surface: #ffffff;
  --surface-muted: #fafbfc;
  --surface-hover: #f7f8fa;
  --line: #e6e8ec;
  --line-strong: #dfe3e8;
  --text: #181b20;
  --text-soft: #667085;
  --text-faint: #98a2b3;
  --blue: #2563eb;
  --blue-hover: #1d4ed8;
  --blue-soft: #eff6ff;
  --green: #15803d;
  --green-soft: #eefbf3;
  --amber: #b45309;
  --amber-soft: #fff8e8;
  --red: #dc2626;
  --red-soft: #fff3f1;
  --radius: 6px;
  --radius-lg: 10px;
  --sidebar-width: 208px;
  --topbar-height: 56px;
  --panel-width: 400px;
  --control-height: 36px;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--canvas);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--canvas);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  color: var(--text);
  letter-spacing: -0.02em;
}

h1 {
  margin-bottom: 4px;
  font-size: clamp(20px, 2vw, 28px);
  line-height: 1.2;
}

h2 {
  margin-bottom: 0;
  font-size: 16px;
  line-height: 1.3;
}

h3 {
  margin-bottom: 4px;
  font-size: 14px;
}

small {
  color: var(--text-soft);
}

.hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  border: 0;
  white-space: nowrap;
}

.skip-link {
  position: fixed;
  z-index: 200;
  top: 8px;
  left: 8px;
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--text);
  color: #fff;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.boot-splash {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  background: var(--canvas);
}

.boot-splash-mark,
.brand-mark {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #202938;
  color: #fff;
  font-size: 15px;
  font-weight: 800;
}

.boot-splash-text {
  color: var(--text-soft);
  font-size: 13px;
}

/* Account */
.account-gate {
  display: grid;
  min-height: 100vh;
  padding: 24px;
  place-items: center;
  background: var(--canvas);
}

.account-card {
  width: min(100%, 460px);
  padding: clamp(24px, 4vw, 40px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.auth-brand {
  margin-bottom: 20px;
}

.eyebrow,
.step-label {
  margin: 0 0 5px;
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.subtitle,
.help,
.heading-help {
  margin-bottom: 0;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.55;
}

.auth-path {
  display: grid;
  gap: 8px;
  margin: 22px 0;
  padding: 0;
  list-style: none;
}

.auth-path li {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-soft);
}

.auth-path li > span {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--text-soft);
  font-size: 12px;
}

.auth-path li[data-state="current"] > span {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.auth-path strong,
.auth-path small {
  display: block;
}

.auth-path strong {
  color: var(--text);
  font-size: 13px;
}

.auth-path small {
  margin-top: 1px;
  font-size: 12px;
}

.account-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2px;
  margin: 24px 0 16px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
}

.account-tab {
  min-height: 34px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text-soft);
  font-weight: 650;
}

.account-tab.active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 1px 2px rgb(16 24 40 / 7%);
}

.account-form {
  display: grid;
  gap: 14px;
}

.pending-card {
  text-align: center;
}

.pending-icon {
  display: grid;
  width: 44px;
  height: 44px;
  margin: 0 auto 16px;
  place-items: center;
  border-radius: 50%;
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 24px;
}

/* Shared controls */
.field {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
}

.field > span em {
  color: var(--text-faint);
  font-style: normal;
  font-weight: 500;
}

.field input,
.field select,
.field textarea,
.product-condition-input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  outline: none;
  background: #fff;
  color: var(--text);
  font-weight: 450;
}

.field input,
.field select,
.product-condition-input {
  min-height: var(--control-height);
  padding: 7px 10px;
}

.field textarea {
  min-height: 86px;
  padding: 9px 10px;
  resize: vertical;
  line-height: 1.5;
}

.field input::placeholder,
.field textarea::placeholder,
.product-condition-input::placeholder {
  color: var(--text-faint);
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.product-condition-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgb(37 99 235 / 10%);
}

.check-row {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: var(--text-soft);
  font-size: 12px;
  white-space: nowrap;
}

.check-row input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--blue);
}

.strong-check {
  color: var(--text);
  font-weight: 600;
}

.button,
.icon-button,
.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: var(--control-height);
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 650;
  line-height: 1;
  text-decoration: none;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

.button.primary {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.button.primary:hover:not(:disabled) {
  border-color: var(--blue-hover);
  background: var(--blue-hover);
}

.button.secondary {
  border-color: var(--line-strong);
  background: #fff;
  color: #344054;
}

.button.secondary:hover:not(:disabled) {
  border-color: #c6ccd6;
  background: var(--surface-hover);
}

.button.compact {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 12px;
}

.large-button {
  min-height: 42px;
}

.icon-button {
  width: 32px;
  min-width: 32px;
  padding: 0;
  border-color: var(--line);
  background: #fff;
  color: var(--text-soft);
}

.icon-button:hover:not(:disabled) {
  background: var(--surface-hover);
  color: var(--text);
}

.link-button {
  min-height: auto;
  padding: 3px;
  border: 0;
  background: transparent;
  color: var(--blue);
  font-size: 12px;
}

.button-row,
.chip-row,
.topbar-actions,
.dialog-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.message {
  min-height: 0;
  margin: 0;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.45;
}

.message:empty {
  display: none;
}

.message[data-state="error"] {
  color: var(--red);
}

.message[data-state="success"] {
  color: var(--green);
}

.status-badge.warning {
  color: var(--amber);
}

.status-badge.danger {
  color: var(--red);
}

.empty-state {
  padding: 32px 20px;
  color: var(--text-soft);
  font-size: 13px;
  text-align: center;
}

/* App shell */
.page-shell {
  min-height: 100vh;
}

.app-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

.app-sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 16px 12px;
  border-right: 1px solid var(--line);
  background: #fff;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 20px;
}

.sidebar-brand strong,
.sidebar-brand span {
  display: block;
}

.sidebar-brand strong {
  font-size: 14px;
  line-height: 1.2;
}

.sidebar-brand span {
  margin-top: 3px;
  color: var(--text-faint);
  font-size: 11px;
}

.page-tabs {
  position: relative;
  display: grid;
  gap: 3px;
}

.nav-active-indicator,
.tab-active-indicator {
  display: none !important;
}

.page-tab {
  position: relative;
  display: grid;
  gap: 2px;
  width: 100%;
  min-height: 48px;
  padding: 9px 10px 9px 38px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text-soft);
  text-align: left;
}

.page-tab::before {
  position: absolute;
  top: 18px;
  left: 13px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #c7cdd8;
  content: "";
}

.page-tab > span {
  color: inherit;
  font-size: 13px;
  font-weight: 650;
}

.page-tab small {
  color: inherit;
  font-size: 11px;
  opacity: 0.78;
}

.page-tab:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.page-tab.active {
  border-color: #dbeafe;
  background: var(--blue-soft);
  color: #1d4ed8;
}

.page-tab.active::before {
  background: var(--blue);
}

.sidebar-status {
  display: grid;
  gap: 8px;
  margin-top: auto;
  padding: 14px 8px 4px;
  border-top: 1px solid var(--line);
}

.sidebar-status-heading {
  color: var(--text-faint);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.license-pill,
.health-pill,
.readiness-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  min-height: 28px;
  padding: 5px 0;
  border: 0;
  background: transparent;
  color: var(--text-soft);
  font-size: 11px;
  text-align: left;
}

.license-pill {
  width: 100%;
}

.license-dot,
.health-dot,
.readiness-dot,
.sync-status-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #98a2b3;
}

.license-pill[data-state="online"] .license-dot,
.health-pill[data-state="online"] .health-dot,
.readiness-pill[data-state="ready"] .readiness-dot {
  background: var(--green);
}

.license-pill[data-state="offline"] .license-dot,
.health-pill[data-state="offline"] .health-dot {
  background: var(--red);
}

.app-main {
  min-width: 0;
  background: var(--canvas);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--topbar-height);
  gap: 16px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.brand-lockup h1,
.topbar-title h1 {
  margin-bottom: 0;
  font-size: 20px;
  font-weight: 680;
  white-space: nowrap;
}

.topbar-title {
  flex: 0 0 auto;
}

.brand-lockup .subtitle,
.topbar .eyebrow {
  display: none;
}

.topbar-actions {
  justify-content: flex-end;
  flex-wrap: nowrap;
}

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

.account-identity {
  max-width: 160px;
  overflow: hidden;
  color: var(--text-soft);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-topbar-controls {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.topbar-device-control {
  display: grid;
  min-width: 0;
  grid-template-columns: auto minmax(150px, 240px);
  align-items: center;
  gap: 7px;
  color: var(--text-soft);
  font-size: 12px;
  white-space: nowrap;
}

.topbar-device-control select {
  width: 100%;
  min-width: 0;
  height: var(--control-height);
  padding: 0 28px 0 9px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font-size: 12px;
}

.topbar-check,
.workspace-active-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-soft);
  font-size: 12px;
  white-space: nowrap;
}

.topbar-check input,
.workspace-active-filter input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--blue);
}

.topbar-sync-meta {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.topbar-sync-meta .sync-strip {
  min-height: 16px;
}

.topbar-sync-meta .sync-detail-inline {
  max-width: 205px;
  margin: 0;
}

.app-content {
  padding: 16px 20px 24px;
}

.content-grid {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.content-grid > *,
.workspace-view {
  min-width: 0;
}

.card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.span-two {
  grid-column: 1 / -1;
}

.card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.getting-started-bar {
  display: none;
}

.sync-detail-inline {
  display: block;
  max-width: 430px;
  margin-top: 3px;
  overflow: hidden;
  color: var(--text-soft);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sync-strip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  color: var(--text-soft);
  font-size: 12px;
  white-space: nowrap;
}

.sync-strip[data-state="succeeded"] .sync-status-dot {
  background: var(--green);
}

.sync-strip[data-state="failed"] .sync-status-dot {
  background: var(--red);
}

.sync-strip[data-state="running"] .sync-status-dot,
.sync-strip[data-state="pending"] .sync-status-dot {
  background: var(--amber);
}

.sync-last-count strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.status-badge,
.state-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}

.state-chip.succeeded,
.state-chip.connected,
.state-chip.online {
  color: var(--green);
}

.state-chip.failed,
.state-chip.offline,
.state-chip.needs_attention,
.state-chip.uncertain,
.state-chip.stale {
  color: var(--red);
}

.state-chip.pending,
.state-chip.running,
.state-chip.leased,
.state-chip.scheduled,
.state-chip.activating,
.state-chip.reverting {
  color: var(--amber);
}

.workspace-login-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid #f3d7a1;
  border-radius: 8px;
  background: var(--amber-soft);
}

.workspace-login-strip[data-state="connected"] {
  display: none;
}

.workspace-login-strip[data-state="failed"],
.workspace-login-strip[data-state="disconnected"],
.workspace-login-strip[data-state="unavailable"] {
  border-color: #f2c3bf;
  background: var(--red-soft);
}

.workspace-login-copy {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.workspace-login-copy strong,
.workspace-login-copy span {
  display: block;
}

.workspace-login-copy strong {
  font-size: 12px;
}

.workspace-login-copy span {
  margin-top: 1px;
  overflow: hidden;
  color: var(--text-soft);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-login-indicator {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--amber);
}

.workspace-login-strip[data-state="failed"] .workspace-login-indicator,
.workspace-login-strip[data-state="disconnected"] .workspace-login-indicator,
.workspace-login-strip[data-state="unavailable"] .workspace-login-indicator {
  background: var(--red);
}

.pending-apply-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: var(--blue-soft);
}

.pending-apply-copy {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.pending-apply-icon {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 6px;
  background: #dbeafe;
  color: var(--blue);
}

.pending-apply-copy strong,
.pending-apply-copy p {
  display: block;
  margin: 0;
}

.pending-apply-copy strong {
  font-size: 12px;
}

.pending-apply-copy p {
  overflow: hidden;
  margin-top: 2px;
  color: var(--text-soft);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pending-apply-controls {
  display: flex;
  align-items: end;
  gap: 8px;
}

.pending-apply-controls .compact-field {
  min-width: 126px;
}

.pending-apply-controls .field > span {
  font-size: 10px;
}

#app-shell[data-editor-open="false"] .editor-panel {
  display: none;
}

.product-condition-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.product-condition-rows {
  display: grid;
  gap: 6px;
}

.product-condition-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 8px;
}

.product-condition-label {
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 650;
}

.product-condition-remove {
  display: grid;
  width: 28px;
  height: 28px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  color: var(--text-soft);
}

.product-condition-remove:hover:not(:disabled) {
  background: var(--surface-hover);
  color: var(--text);
}

.product-condition-remove:disabled {
  visibility: hidden;
}

.product-condition-actions {
  justify-content: flex-start;
}

.product-search-summary {
  margin: 0;
  color: var(--text-soft);
  font-size: 11px;
  line-height: 1.4;
}

#selection-count {
  color: var(--text);
  font-weight: 650;
}

.product-panel {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
}

.table-wrap {
  position: relative;
  min-width: 0;
  min-height: 260px;
  flex: 1 1 auto;
  overflow: auto;
  overscroll-behavior: contain;
}

.product-table {
  width: 100%;
  min-width: 890px;
  border-collapse: collapse;
  table-layout: fixed;
}

.product-table th,
.product-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  text-align: left;
  vertical-align: middle;
}

.product-table th {
  position: sticky;
  z-index: 1;
  top: 0;
  background: var(--surface-muted);
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 650;
}

.product-table th:nth-child(1) { width: 42px; }
.product-table th:nth-child(2) { width: 37%; }
.product-table th:nth-child(3) { width: 13%; }
.product-table th:nth-child(4) { width: 13%; }
.product-table th:nth-child(5) { width: 14%; }
.product-table th:nth-child(6) { width: 15%; }

.product-table tbody tr {
  background: #fff;
}

.product-table tbody tr:hover {
  background: var(--surface-hover);
}

.product-table tbody tr.is-selected {
  background: #f5f9ff;
  box-shadow: inset 3px 0 0 var(--blue);
}

.check-cell {
  width: 42px;
  text-align: center !important;
}

.check-cell input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--blue);
}

.product-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.product-thumb {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  color: var(--text-faint);
  font-size: 8px;
}

.product-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.product-copy strong {
  display: -webkit-box;
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.product-copy span,
.product-table td small {
  display: block;
  overflow: hidden;
  margin-top: 2px;
  color: var(--text-faint);
  font-size: 11px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-price-cell strong {
  display: block;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.table-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-soft);
  font-size: 12px;
  white-space: nowrap;
}

.table-status i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #b7bfcc;
}

.table-status.is-active,
.table-status.change-preview {
  color: var(--green);
}

.table-status.is-active i,
.table-status.change-preview i {
  background: var(--green);
}

.table-status.is-paused,
.table-status.change-draft {
  color: var(--amber);
}

.table-status.is-paused i,
.table-status.change-draft i {
  background: var(--amber);
}

.table-status.change-selected {
  color: var(--blue);
}

.table-status.change-selected i {
  background: var(--blue);
}

.product-time-cell small {
  font-variant-numeric: tabular-nums;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 8px 14px;
  border-top: 1px solid var(--line);
  color: var(--text-soft);
  font-size: 12px;
}

.skeleton {
  display: inline-block;
  border-radius: 4px;
  background: #edf0f4;
}

.skeleton-check { width: 15px; height: 15px; }
.skeleton-thumb { width: 42px; height: 42px; }
.skeleton-copy { display: grid; gap: 5px; width: 100%; }
.skeleton-line { width: 75%; height: 10px; }
.skeleton-line-wide { width: 95%; }
.skeleton-line-short { width: 48%; }
.skeleton-chip { width: 58px; height: 16px; }

/* Editor */
.editor-scrim {
  display: none;
}

.editor-panel {
  display: flex;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
}

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

.editor-panel-header .step-label {
  margin-bottom: 2px;
}

.editor-panel-header h2 {
  font-size: 15px;
}

.editor-panel-header .icon-button {
  display: none;
}

.edit-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  flex: 0 0 auto;
  gap: 0;
  padding: 7px 8px 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.edit-tab {
  min-width: 0;
  min-height: 32px;
  padding: 5px 3px 8px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}

.edit-tab:hover {
  color: var(--text);
}

.edit-tab.active {
  border-bottom-color: var(--blue);
  color: var(--blue);
}

.rule-panel {
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
}

.rule-scroll {
  display: grid;
  flex: 1 1 auto;
  align-content: start;
  gap: 16px;
  min-height: 0;
  overflow: auto;
  padding: 16px 14px;
  overscroll-behavior: contain;
}

.rule-intro h3 {
  margin-bottom: 4px;
  font-size: 14px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-grid.one-column {
  grid-template-columns: minmax(0, 1fr);
}

.rule-footer {
  display: grid;
  flex: 0 0 auto;
  gap: 10px;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.rule-summary {
  display: grid;
  grid-template-columns: auto auto;
  align-items: baseline;
  gap: 3px 8px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-muted);
}

.rule-summary span {
  color: var(--text-soft);
  font-size: 11px;
}

.rule-summary strong {
  color: var(--text);
  font-size: 14px;
}

.rule-summary small {
  grid-column: 1 / -1;
  overflow: hidden;
  color: var(--text-soft);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rule-footer > .button {
  width: 100%;
}

.selection-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
}

.selection-action-copy {
  min-width: 0;
}

.selection-action-copy strong,
.selection-action-copy span {
  display: block;
}

.selection-action-copy strong {
  font-size: 12px;
}

.selection-action-copy span {
  overflow: hidden;
  margin-top: 2px;
  color: var(--text-soft);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Workspace V2 */
.workspace-v2 {
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-rows: minmax(0, 1fr) auto;
  background: var(--surface);
}

.workspace-v2-body {
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-columns: minmax(0, 1fr) var(--panel-width);
  background: var(--surface);
}

.workspace-v2-catalog {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-rows: 56px auto minmax(0, 1fr);
}

.workspace-v2-searchbar {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.workspace-search-mode {
  width: 118px;
  flex: 0 0 auto;
}

.workspace-search-mode select,
.workspace-query-field input {
  width: 100%;
  height: var(--control-height);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
}

.workspace-search-mode select {
  padding: 0 26px 0 9px;
}

.workspace-query-field {
  min-width: 160px;
  flex: 1 1 320px;
}

.workspace-query-field input {
  padding: 0 11px;
}

.workspace-clear-search {
  flex: 0 0 auto;
  padding: 6px 2px;
  color: var(--text-soft);
  font-size: 12px;
  white-space: nowrap;
}

.workspace-v2-filter-popover {
  position: absolute;
  z-index: 20;
  top: 48px;
  left: 16px;
  display: grid;
  width: min(520px, calc(100% - 32px));
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 30px rgb(16 24 40 / 14%);
}

.workspace-v2-filter-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.workspace-v2-filter-header h2 {
  margin: 0;
  font-size: 14px;
}

.workspace-v2-filter-header p {
  margin: 3px 0 0;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.45;
}

.workspace-v2-filter-popover .product-condition-actions {
  gap: 8px;
}

.workspace-v2-filter-popover .product-search-summary {
  padding-top: 9px;
  border-top: 1px solid var(--line);
}

.workspace-login-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 40px;
  gap: 12px;
  padding: 4px 16px;
  border: 0;
  border-bottom: 1px solid #eed7a8;
  border-radius: 0;
  background: #fffaf0;
}

.workspace-login-strip[data-state="connected"] {
  display: none;
}

.workspace-login-strip[data-state="failed"],
.workspace-login-strip[data-state="disconnected"],
.workspace-login-strip[data-state="unavailable"] {
  border-color: #edc4c0;
  background: #fff7f6;
}

.workspace-login-copy strong,
.workspace-login-copy span {
  display: inline;
}

.workspace-login-copy strong {
  font-size: 12px;
}

.workspace-login-copy span {
  margin-left: 6px;
  color: var(--text-soft);
  font-size: 12px;
}

.workspace-login-actions {
  flex: 0 0 auto;
}

.workspace-v2-table-area {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
}

.workspace-v2-table-head {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.workspace-v2-section-label {
  display: block;
  margin-bottom: 1px;
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 650;
}

.workspace-v2-table-head h2,
.editor-panel-header h2 {
  margin: 0;
  font-size: 16px;
}

.workspace-v2-selection-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px 12px;
  color: var(--text-soft);
  font-size: 12px;
}

.workspace-v2-selection-controls #selection-count {
  color: var(--text);
  font-weight: 650;
}

.workspace-v2-table-area .product-panel {
  min-height: 0;
}

.workspace-v2-table-area .table-wrap {
  min-height: 0;
  background: var(--surface);
}

.workspace-v2-table-area .product-table th,
.workspace-v2-table-area .product-table td {
  padding: 8px 12px;
}

.workspace-v2-table-area .product-table th {
  background: #fafbfc;
}

.workspace-v2-table-area .product-table tbody tr.is-selected {
  background: #f5f9ff;
  box-shadow: inset 2px 0 0 var(--blue);
}

.workspace-v2-table-area .pagination {
  min-height: 52px;
  padding: 8px 16px;
  background: var(--surface);
}

.workspace-v2-editor {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  border-left: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface);
}

.workspace-v2-editor .editor-panel-header {
  min-height: 56px;
  padding: 10px 16px;
}

.workspace-v2-editor .editor-panel-header .step-label {
  display: none;
}

.workspace-v2-editor .edit-tabs {
  padding: 5px 12px 0;
}

.workspace-v2-editor .rule-scroll {
  gap: 18px;
  padding: 18px 16px;
}

.workspace-v2-editor .rule-footer {
  gap: 8px;
  padding: 12px 16px;
}

.workspace-v2-editor .rule-summary {
  padding: 8px 9px;
  border-radius: 6px;
}

.workspace-v2-bottom-stack {
  display: grid;
  min-width: 0;
  background: var(--surface);
}

.workspace-v2-bottom-stack > .hidden {
  display: none !important;
}

.workspace-v2-bottom-stack .selection-action-bar,
.workspace-v2-bottom-stack .pending-apply-bar {
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
}

.workspace-v2-bottom-stack .selection-action-bar {
  min-height: 58px;
  padding: 9px 16px;
  background: #fff;
}

.workspace-v2-bottom-stack .pending-apply-bar {
  display: flex;
  min-height: 62px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 16px;
  background: #fff;
}

.workspace-v2-bottom-stack .pending-apply-icon {
  width: 28px;
  height: 28px;
  border-radius: 0;
  background: transparent;
  color: var(--blue);
}

.workspace-v2-bottom-stack .pending-apply-copy strong {
  font-size: 13px;
}

.workspace-v2-bottom-stack .pending-apply-copy p {
  font-size: 12px;
}

.workspace-v2-bottom-stack .pending-apply-controls {
  align-items: center;
  gap: 8px;
}

.workspace-v2-bottom-stack .pending-apply-controls .compact-field {
  min-width: 112px;
}

.workspace-v2-bottom-stack .pending-apply-controls .field > span {
  display: none;
}

.workspace-v2-bottom-stack .pending-apply-controls select,
.workspace-v2-bottom-stack .pending-apply-controls input {
  height: var(--control-height);
  font-size: 12px;
}

.workspace-v2-bottom-stack .pending-apply-actions {
  gap: 6px;
}

/* Secondary application views */
.settings-view,
.records-view,
.coupons-view {
  min-width: 0;
}

.coupons-view {
  display: grid;
  gap: 16px;
  align-content: start;
  overflow-y: auto;
  padding: 16px 20px 24px;
}

.setup-card,
.records-view .card,
.coupons-view .card {
  overflow: hidden;
}

.setup-card,
.records-view .card,
.coupons-view .card {
  padding: 0;
}

.setup-card > :not(.card-heading),
.records-view .card > :not(.card-heading),
.coupons-view .card > :not(.card-heading) {
  margin-right: 20px;
  margin-left: 20px;
}

.setup-submit,
.setup-footer,
.notification-setup-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 0;
}

.field-note,
.privacy-note {
  margin: 0;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.55;
}

.device-item,
.job-item,
.plan-item,
.catalog-item {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.device-item h3,
.job-item h3,
.plan-item h3,
.catalog-item h3 {
  margin: 0;
}

.setup-progress {
  padding: 16px 0;
}

.setup-progress-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.setup-progress-heading span,
.setup-progress-heading small {
  display: block;
}

.setup-progress-heading > span {
  color: var(--text-soft);
  font-size: 12px;
}

.setup-progress-heading strong {
  display: block;
  margin-top: 2px;
  font-size: 13px;
}

.setup-progress-track {
  height: 6px;
  margin: 10px 0;
  overflow: hidden;
  border-radius: 999px;
  background: #edf0f4;
}

.setup-progress-track > span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
}

.setup-progress-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 16px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--text-soft);
  font-size: 11px;
}

.setup-progress-steps li {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.setup-progress-steps li > span {
  display: grid;
  width: 17px;
  height: 17px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  font-size: 10px;
}

.setup-progress-steps li[data-state="complete"] {
  color: var(--green);
}

.setup-progress-steps li[data-state="complete"] > span {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.local-status-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin: 0 !important;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface-muted);
}

.local-status-grid article {
  min-width: 0;
  padding: 14px 16px;
  border-right: 1px solid var(--line);
}

.local-status-grid article:last-child {
  border-right: 0;
}

.local-status-grid span,
.local-status-grid strong,
.local-status-grid small {
  display: block;
}

.local-status-grid span {
  color: var(--text-faint);
  font-size: 10px;
}

.local-status-grid strong {
  overflow: hidden;
  margin-top: 3px;
  color: var(--text);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.local-status-grid small {
  overflow: hidden;
  margin-top: 2px;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.current-device-context,
.account-devices-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-top: 16px !important;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.current-device-context[data-state="success"] {
  border-color: #b8e2c7;
  background: #f5fbf7;
}

.current-device-context[data-state="warning"] {
  border-color: #f0d7a5;
  background: #fffbf3;
}

.current-device-context[data-state="error"] {
  border-color: #edc1bd;
  background: #fff7f6;
}

.current-device-context span:first-child,
.account-devices-heading span {
  display: block;
  color: var(--text-faint);
  font-size: 10px;
}

.current-device-context strong,
.current-device-context small,
.account-devices-heading strong,
.account-devices-heading small {
  display: block;
}

.current-device-context strong,
.account-devices-heading strong {
  margin-top: 3px;
  color: var(--text);
  font-size: 13px;
}

.current-device-context small,
.account-devices-heading small {
  margin-top: 3px;
  color: var(--text-soft);
  font-size: 11px;
  line-height: 1.5;
}

.setup-form {
  display: grid;
  gap: 0;
  margin-top: 16px !important;
}

.setup-section {
  min-width: 0;
  margin: 0;
  padding: 18px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
}

.setup-section legend {
  padding: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
}

.setup-section legend > span {
  display: inline-grid;
  width: 20px;
  height: 20px;
  margin-right: 6px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--text-soft);
  font-size: 10px;
}

.setup-section[data-state="current"] legend > span,
.setup-section[data-state="complete"] legend > span {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.setup-section .form-grid {
  margin-top: 12px;
}

.setup-submit {
  padding-bottom: 0;
}

.setup-footer {
  align-items: flex-start;
  padding-bottom: 18px;
}

.account-devices-heading {
  margin-top: 0 !important;
  padding: 14px 0 10px;
  border: 0;
  border-radius: 0;
  border-top: 1px solid var(--line);
}

.device-item.current-device {
  border-color: #b8e2c7;
  box-shadow: inset 3px 0 0 var(--green);
}

.setup-footer .button-row {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.onboarding-replay {
  margin-bottom: 16px;
}

.compact-device-list,
.job-list,
.plan-list,
.catalog-list {
  display: grid;
  gap: 10px;
  padding: 0 0 18px;
}

.device-top,
.job-top,
.plan-top,
.catalog-top,
.preview-item-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  color: var(--text-faint);
  font-size: 11px;
}

.result-summary,
.result-list,
.event-list,
.plan-progress,
.plan-item-list,
.plan-actions,
.job-actions {
  margin-top: 10px;
}

.result-summary,
.plan-progress {
  color: var(--text-soft);
  font-size: 12px;
}

.result-list,
.event-list,
.plan-item-list {
  display: grid;
  gap: 6px;
}

.result-row,
.event-row,
.plan-item-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  color: var(--text-soft);
  font-size: 11px;
}

.result-row small,
.plan-item-row small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plan-actions,
.job-actions {
  display: flex;
  justify-content: flex-end;
}

.danger-button {
  border-color: #f0c0bc !important;
  color: var(--red) !important;
}

/* Toasts and preview */
.toast-region {
  position: fixed;
  z-index: 110;
  right: 18px;
  bottom: 18px;
  display: grid;
  width: min(360px, calc(100vw - 36px));
  gap: 8px;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 12px;
  box-shadow: 0 8px 20px rgb(16 24 40 / 10%);
}

.toast-success { border-color: #b8e2c7; }
.toast-warning { border-color: #f0d7a5; }
.toast-error { border-color: #edc1bd; }
.toast .icon-button {
  width: 24px;
  min-width: 24px;
  height: 24px;
  min-height: 24px;
  margin-left: auto;
}

.preview-dialog {
  width: min(920px, calc(100vw - 32px));
  max-height: min(820px, calc(100dvh - 32px));
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  background: #fff;
  box-shadow: 0 20px 60px rgb(16 24 40 / 20%);
}

.preview-dialog::backdrop {
  background: rgb(16 24 40 / 35%);
}

.dialog-shell {
  display: flex;
  max-height: inherit;
  flex-direction: column;
}

.dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.preview-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

.preview-summary article {
  display: grid;
  gap: 3px;
  padding: 12px 18px;
  border-right: 1px solid var(--line);
}

.preview-summary article:last-child {
  border-right: 0;
}

.preview-summary span {
  color: var(--text-soft);
  font-size: 11px;
}

.preview-summary strong {
  font-size: 17px;
}

.preview-list {
  display: grid;
  gap: 10px;
  overflow: auto;
  padding: 14px 18px;
}

.preview-item {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.preview-item.blocked {
  background: var(--surface-muted);
}

.preview-item-heading strong,
.preview-item-heading span {
  display: block;
}

.preview-item-heading strong {
  font-size: 13px;
}

.preview-item-heading span {
  margin-top: 2px;
  color: var(--text-faint);
  font-size: 11px;
}

.diff-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.diff-before,
.diff-after {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-muted);
}

.diff-after.is-changed {
  border-color: #bfdbfe;
  background: var(--blue-soft);
}

.diff-before > span,
.diff-after > span {
  display: block;
  margin-bottom: 6px;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 650;
}

.diff-value {
  width: 100%;
  max-height: 180px;
  margin: 0;
  overflow: auto;
  border: 0;
  background: transparent;
  color: var(--text);
  font: 11px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

textarea.diff-value {
  min-height: 80px;
  outline: none;
  resize: vertical;
}

.draft-save-note {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 0 18px 14px;
  padding: 10px;
  border: 1px solid #bfdbfe;
  border-radius: 7px;
  background: var(--blue-soft);
}

.draft-save-note-icon {
  color: var(--blue);
}

.draft-save-note strong,
.draft-save-note p {
  display: block;
  margin: 0;
}

.draft-save-note strong {
  font-size: 12px;
}

.draft-save-note p {
  margin-top: 2px;
  color: var(--text-soft);
  font-size: 11px;
}

.dialog-actions {
  justify-content: flex-end;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
}

.preview-dialog > .message,
.dialog-shell > .message {
  padding: 0 18px 14px;
}

.ui-icon {
  width: 15px;
  height: 15px;
  stroke-width: 1.8;
}

/* Responsive */
@media (min-width: 1025px) {
  #app-shell[data-active-view="workspace"] {
    height: 100dvh;
    overflow: hidden;
  }

  #app-shell[data-active-view="workspace"] .app-main {
    display: grid;
    grid-template-rows: var(--topbar-height) minmax(0, 1fr);
    min-height: 0;
    overflow: hidden;
  }

  #app-shell[data-active-view="workspace"] .app-content {
    min-height: 0;
    overflow: hidden;
    padding: 0;
  }

  #app-shell[data-active-view="workspace"] .content-grid,
  #app-shell[data-active-view="workspace"] .workspace-v2 {
    height: 100%;
    min-height: 0;
  }

  #app-shell[data-active-view="workspace"] .workspace-v2-bottom-stack {
    max-height: 142px;
  }
}

@media (max-width: 1024px) {
  body.editor-drawer-open {
    overflow: hidden;
  }

  .app-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .app-sidebar {
    position: static;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    height: auto;
    padding: 10px 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .sidebar-brand {
    padding: 0;
  }

  .sidebar-brand span {
    display: none;
  }

  .sidebar-nav {
    display: flex;
    justify-content: center;
    gap: 3px;
  }

  .page-tab {
    display: inline-flex;
    width: auto;
    min-height: 32px;
    padding: 6px 9px;
    align-items: center;
    border-radius: 5px;
  }

  .page-tab::before,
  .page-tab small {
    display: none;
  }

  .sidebar-status {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 0;
    border: 0;
  }

  .sidebar-status-heading,
  .health-pill {
    display: none;
  }

  .license-pill {
    width: auto;
  }

  .topbar {
    padding: 10px 14px;
  }

  .app-content {
    padding: 14px;
  }

  .editor-panel {
    position: fixed;
    z-index: 90;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(var(--panel-width), calc(100vw - 56px));
    border: 0;
    border-left: 1px solid var(--line);
    border-radius: 0;
    box-shadow: -12px 0 32px rgb(16 24 40 / 14%);
    display: none;
  }

  #app-shell[data-editor-open="true"] .editor-panel {
    display: flex;
  }

  .editor-panel-header .icon-button {
    display: inline-flex;
  }

  .editor-scrim {
    position: fixed;
    z-index: 89;
    inset: 0;
    border: 0;
    background: rgb(16 24 40 / 24%);
  }

  #app-shell[data-editor-open="true"] .editor-scrim {
    display: block;
  }

  .selection-action-bar {
    position: sticky;
    z-index: 5;
    bottom: 10px;
    margin-top: 10px;
    box-shadow: 0 8px 22px rgb(16 24 40 / 12%);
  }

  .pending-apply-bar {
    grid-template-columns: minmax(0, 1fr);
  }

  .pending-apply-controls {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .local-status-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .local-status-grid article:nth-child(3) {
    border-right: 0;
  }
}

@media (max-width: 760px) {
  .app-sidebar {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .sidebar-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
    overflow: auto;
    margin-top: 10px;
    padding-bottom: 1px;
  }

  .sidebar-status {
    justify-self: end;
  }

  .license-pill #license-label {
    display: none;
  }

  .brand-lockup .eyebrow,
  .brand-lockup .subtitle,
  .readiness-pill,
  .account-identity,
  .topbar #account-logout {
    display: none;
  }

  .topbar-actions {
    gap: 5px;
  }

  .utility-button {
    padding: 6px 8px;
  }

  .pending-apply-controls {
    flex-wrap: wrap;
  }

  .workspace-login-strip {
    align-items: flex-start;
    flex-direction: column;
  }

  .workspace-login-actions {
    width: 100%;
  }

  .workspace-login-actions .button {
    flex: 1 1 0;
  }

  .local-status-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .local-status-grid article:nth-child(3) {
    border-right: 1px solid var(--line);
  }

  .local-status-grid article:nth-child(even) {
    border-right: 0;
  }

  .setup-footer,
  .setup-submit,
  .current-device-context,
  .account-devices-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .setup-submit .button {
    width: 100%;
  }
}

@media (max-width: 540px) {
  .account-gate {
    padding: 14px;
  }

  .account-card {
    padding: 22px 18px;
  }

  .topbar {
    min-height: 50px;
    padding: 8px 10px;
  }

  .brand-lockup h1 {
    font-size: 14px;
  }

  .app-content {
    padding: 10px;
  }

  .editor-toggle {
    font-size: 0;
  }

  .topbar .utility-button {
    min-width: var(--control-height);
    padding-right: 8px;
    padding-left: 8px;
    font-size: 0;
  }

  .editor-toggle .ui-icon {
    margin: 0;
  }

  .sync-strip {
    white-space: normal;
  }

  .product-condition-row {
    grid-template-columns: 66px minmax(0, 1fr) 28px;
    gap: 6px;
  }

  .product-condition-actions .button {
    flex: 1 1 0;
  }

  .selection-action-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .selection-action-bar .button-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  }

  .selection-action-bar .button {
    width: 100%;
  }

  .pending-apply-actions {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pending-apply-actions .button {
    width: 100%;
  }

  .editor-panel {
    width: 100vw;
    border-left: 0;
  }

  .preview-dialog {
    width: 100vw;
    max-height: 100dvh;
    height: 100dvh;
    border: 0;
    border-radius: 0;
  }

  .preview-list {
    padding: 10px;
  }

  .dialog-heading,
  .dialog-actions {
    padding-right: 12px;
    padding-left: 12px;
  }

  .preview-summary article {
    padding: 10px;
  }

  .diff-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .draft-save-note {
    margin-right: 12px;
    margin-left: 12px;
  }

  .toast-region {
    right: 10px;
    bottom: 10px;
    width: calc(100vw - 20px);
  }
}

/* Batch group execution */
.batch-group-bar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(180px, 320px) auto;
  align-items: center;
  gap: 18px;
  padding: 14px 18px;
  border: 1px solid color-mix(in srgb, var(--accent, #2563eb) 32%, transparent);
  border-radius: 14px;
  background: color-mix(in srgb, var(--accent, #2563eb) 7%, var(--surface, #fff));
  box-shadow: 0 12px 30px rgb(15 23 42 / 8%);
}

.batch-group-meter,
.batch-group-record-meter {
  overflow: hidden;
  height: 8px;
  border-radius: 999px;
  background: rgb(148 163 184 / 24%);
}

.batch-group-meter > span,
.batch-group-record-meter > span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent, #2563eb);
  transition: width 180ms ease;
}

.batch-group-list {
  display: grid;
  gap: 12px;
}

.batch-group-item {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  background: var(--surface, #fff);
}

.batch-group-failure {
  display: grid;
  grid-template-columns: minmax(120px, 0.7fr) 100px minmax(180px, 2fr);
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--border, #e2e8f0);
}

.batch-item-review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.danger-text {
  margin: 6px 0 0;
  color: var(--red);
}

.error-guidance {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 8px;
}

.error-guidance p {
  margin: 0;
  color: var(--muted, #64748b);
  font-size: 12px;
}

.group-error-guidance {
  padding: 10px 12px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  background: rgb(148 163 184 / 7%);
}

.error-category {
  flex: 0 0 auto;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgb(148 163 184 / 16%);
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 700;
}

.error-category[data-category="authentication"],
.error-category[data-category="transient"] {
  background: color-mix(in srgb, var(--amber) 14%, transparent);
  color: var(--amber);
}

.error-category[data-category="submission_uncertain"],
.error-category[data-category="validation"],
.error-category[data-category="page_structure"] {
  background: color-mix(in srgb, var(--red) 12%, transparent);
  color: var(--red);
}

.apply-confirm-dialog {
  width: min(560px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  border-radius: 16px;
  box-shadow: 0 24px 70px rgb(15 23 42 / 30%);
}

.apply-confirm-dialog::backdrop {
  background: rgb(15 23 42 / 52%);
  backdrop-filter: blur(3px);
}

.apply-confirm-card {
  display: grid;
  gap: 18px;
  padding: 24px;
}

.apply-confirm-card ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 20px;
  color: var(--muted, #64748b);
}

.apply-confirm-card footer {
  justify-content: flex-end;
}

@media (max-width: 760px) {
  .batch-group-bar {
    grid-template-columns: minmax(0, 1fr);
  }

  .batch-group-actions {
    flex-wrap: wrap;
  }

  .batch-group-failure {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 1280px) and (min-width: 1025px) {
  .topbar-device-control {
    grid-template-columns: minmax(0, 190px);
  }

  .topbar-device-control > span,
  .topbar-check,
  .topbar-sync-meta .sync-detail-inline,
  .account-identity {
    display: none;
  }

  .workspace-topbar-controls {
    gap: 6px;
  }
}

@media (max-width: 1024px) {
  .topbar {
    height: auto;
    min-height: var(--topbar-height);
    align-items: flex-start;
    padding: 8px 14px;
  }

  .workspace-topbar-controls {
    flex: 1 1 auto;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .topbar-device-control {
    grid-template-columns: minmax(150px, 230px);
  }

  .topbar-device-control > span,
  .topbar-check,
  .topbar-sync-meta .sync-detail-inline {
    display: none;
  }

  .workspace-v2 {
    min-height: calc(100dvh - 112px);
  }

  .workspace-v2-body {
    display: block;
  }

  .workspace-v2-catalog {
    min-height: 0;
  }

  .workspace-v2-editor.editor-panel {
    width: min(var(--panel-width), calc(100vw - 48px));
    border-left: 1px solid var(--line);
    background: #fff;
  }

  .workspace-v2-bottom-stack {
    position: sticky;
    z-index: 12;
    bottom: 0;
  }

  .workspace-v2-bottom-stack .pending-apply-bar,
  .workspace-v2-bottom-stack .selection-action-bar {
    align-items: flex-start;
  }

  .workspace-v2-bottom-stack .pending-apply-bar {
    flex-direction: column;
  }

  .workspace-v2-bottom-stack .pending-apply-controls {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-end;
  }
}

@media (max-width: 760px) {
  .topbar-title h1 {
    font-size: 16px;
  }

  .workspace-v2 {
    min-height: calc(100dvh - 154px);
  }

  .workspace-v2-searchbar {
    flex-wrap: wrap;
    min-height: 56px;
    padding: 8px 12px;
  }

  .workspace-search-mode {
    width: 112px;
  }

  .workspace-query-field {
    flex-basis: 160px;
  }

  .workspace-clear-search {
    margin-left: auto;
  }

  .workspace-v2-table-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
    padding: 9px 12px;
  }

  .workspace-v2-selection-controls {
    justify-content: flex-start;
  }

  .workspace-login-strip {
    align-items: flex-start;
    flex-direction: column;
    padding: 7px 12px;
  }

  .workspace-login-copy span {
    display: block;
    margin: 2px 0 0;
    white-space: normal;
  }

  .workspace-login-actions {
    width: 100%;
  }

  .workspace-login-actions .button {
    flex: 1 1 0;
  }
}

@media (max-width: 540px) {
  .topbar {
    align-items: center;
  }

  .workspace-topbar-controls {
    flex: 0 0 auto;
  }

  .topbar-device-control,
  .topbar-sync-meta,
  .readiness-pill {
    display: none;
  }

  .editor-toggle {
    font-size: 0;
  }

  .workspace-v2 {
    min-height: calc(100dvh - 136px);
  }

  .workspace-v2-searchbar {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr) auto;
    gap: 7px;
  }

  .workspace-query-field {
    min-width: 0;
  }

  .workspace-active-filter {
    grid-column: 1 / 2;
  }

  #search-products {
    grid-column: 2 / 3;
  }

  #toggle-product-filters {
    grid-column: 3;
  }

  .workspace-clear-search {
    grid-column: 1 / -1;
    justify-self: start;
    margin: 0;
  }

  .workspace-v2-filter-popover {
    top: 52px;
    left: 8px;
    width: calc(100% - 16px);
  }

  .workspace-v2-editor.editor-panel {
    width: 100vw;
    border-left: 0;
  }

  .workspace-v2-bottom-stack .pending-apply-bar,
  .workspace-v2-bottom-stack .selection-action-bar {
    padding: 10px 12px;
  }

  .workspace-v2-bottom-stack .pending-apply-actions {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .workspace-v2-bottom-stack .pending-apply-actions .button {
    width: 100%;
    padding-right: 6px;
    padding-left: 6px;
    font-size: 11px;
  }
}

/* Workspace V2 visual calibration — Attio / Uvodo / Clay */
body {
  font-size: 14px;
  line-height: 1.45;
}

h1,
.topbar-title h1 {
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.018em;
}

h2,
.workspace-v2-table-head h2,
.editor-panel-header h2 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.ui-icon {
  width: 16px;
  height: 16px;
  stroke-width: 1.8;
}

.app-sidebar {
  padding: 0 8px 12px;
  background: #fff;
}

.sidebar-brand {
  height: 64px;
  padding: 0 8px;
  gap: 9px;
}

.sidebar-brand .brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  font-size: 14px;
}

.sidebar-brand strong {
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.sidebar-nav {
  gap: 2px;
}

.page-tab {
  display: flex;
  min-height: 40px;
  align-items: center;
  gap: 9px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  color: var(--text-soft);
}

.page-tab::before,
.page-tab small {
  display: none;
}

.page-tab .ui-icon {
  width: 18px;
  height: 18px;
  color: #98a2b3;
}

.page-tab > span {
  font-size: 14px;
  font-weight: 500;
}

.page-tab:hover {
  background: #f7f8fa;
  color: var(--text);
}

.page-tab.active {
  border: 0;
  background: #eef4ff;
  color: var(--blue);
}

.page-tab.active .ui-icon {
  color: var(--blue);
}

.sidebar-status {
  gap: 7px;
  padding: 12px 8px 0;
  border-top: 1px solid var(--line);
}

.sidebar-status-heading {
  display: none;
}

.license-pill,
.health-pill {
  min-height: 20px;
  padding: 0;
  font-size: 12px;
}

.license-dot,
.health-dot {
  width: 6px;
  height: 6px;
}

.topbar {
  gap: 20px;
  padding: 0 16px;
  background: #fff;
}

.topbar * {
  white-space: nowrap;
}

.workspace-topbar-controls {
  gap: 10px;
}

.topbar-device-control {
  grid-template-columns: auto minmax(170px, 220px);
  gap: 8px;
  color: var(--text-soft);
  font-size: 12px;
}

.topbar-device-control select {
  height: 36px;
  border-color: var(--line);
  border-radius: 6px;
  font-size: 13px;
}

.topbar-sync-state {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 6px;
  color: var(--text-soft);
  font-size: 12px;
}

.topbar-sync-state .sync-strip {
  min-height: 20px;
  gap: 5px;
}

.topbar-sync-state .sync-detail-inline {
  max-width: 150px;
  margin: 0;
  color: var(--text-faint);
  font-size: 12px;
}

.topbar-sync-state .status-badge,
.topbar-sync-state .state-chip {
  font-size: 12px;
  font-weight: 500;
}

#sync-products {
  min-width: 88px;
  height: 36px;
  border-radius: 6px;
  box-shadow: none;
  font-size: 13px;
  font-weight: 600;
}

.topbar-icon-button {
  display: inline-flex;
  width: 36px;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-color: var(--line);
  border-radius: 6px;
}

.topbar-icon-button .ui-icon {
  margin: 0;
}

.account-menu {
  position: relative;
}

.account-menu summary {
  display: flex;
  min-width: 36px;
  height: 36px;
  align-items: center;
  gap: 7px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text-soft);
  cursor: pointer;
  list-style: none;
}

.account-menu summary::-webkit-details-marker {
  display: none;
}

.account-menu summary:hover,
.account-menu[open] summary {
  border-color: var(--line);
  background: #fff;
  color: var(--text);
}

.account-menu-avatar {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 50%;
  background: #eef1f5;
  color: #344054;
  font-size: 11px;
  font-weight: 650;
}

.account-menu .account-identity {
  max-width: 118px;
  font-size: 12px;
}

.account-menu-chevron {
  display: grid;
  place-items: center;
}

.account-menu-chevron .ui-icon {
  width: 14px;
  height: 14px;
}

.account-menu-popover {
  position: absolute;
  z-index: 30;
  top: calc(100% + 8px);
  right: 0;
  display: grid;
  width: 188px;
  gap: 2px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 28px rgb(16 24 40 / 14%);
}

.account-menu-check,
.account-menu-item {
  display: flex;
  width: 100%;
  min-height: 34px;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text-soft);
  font-size: 13px;
  text-align: left;
}

.account-menu-check input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--blue);
}

.account-menu-item:hover,
.account-menu-check:hover {
  background: #f7f8fa;
  color: var(--text);
}

.account-menu-item .ui-icon {
  width: 16px;
  height: 16px;
}

.workspace-v2-searchbar {
  min-height: 52px;
  gap: 8px;
  padding: 8px 16px;
}

.workspace-search-mode {
  width: 116px;
}

.workspace-search-mode select,
.workspace-query-field input {
  height: 36px;
  border-color: var(--line);
  border-radius: 6px;
  font-size: 13px;
}

.workspace-query-field {
  flex-basis: 360px;
}

.workspace-active-filter {
  margin-left: 4px;
  font-size: 13px;
}

.workspace-v2-searchbar #search-products {
  min-width: 56px;
  height: 36px;
  border-color: var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.workspace-v2-searchbar #search-products:hover {
  border-color: #cfd5dd;
  background: #f7f8fa;
}

.workspace-v2-searchbar #toggle-product-filters {
  min-width: 68px;
  height: 36px;
  border-color: var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text-soft);
  font-size: 13px;
  white-space: nowrap;
}

.workspace-v2-searchbar #toggle-product-filters[aria-expanded="true"] {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: var(--blue);
}

.workspace-clear-search {
  color: var(--text-soft);
  font-size: 12px;
}

.workspace-v2-filter-popover {
  top: 44px;
  width: min(500px, calc(100% - 32px));
  gap: 16px;
  padding: 16px;
  border-color: var(--line);
  border-radius: 10px;
  box-shadow: 0 16px 32px rgb(16 24 40 / 15%);
}

.workspace-v2-filter-header h2 {
  font-size: 15px;
  font-weight: 600;
}

.workspace-v2-filter-popover .product-condition-rows {
  gap: 8px;
}

.workspace-v2-filter-popover .product-condition-row {
  grid-template-columns: 76px minmax(0, 1fr) 28px;
}

.workspace-v2-table-head {
  min-height: 52px;
  padding: 8px 16px;
}

.workspace-v2-table-head h2 {
  font-size: 15px;
}

.workspace-v2-selection-controls {
  gap: 8px 12px;
  font-size: 12px;
}

.table-editor-toggle {
  height: 32px;
  min-height: 32px;
  padding: 0 9px;
  border-color: var(--line);
  border-radius: 6px;
  color: var(--text-soft);
  font-size: 12px;
}

@media (min-width: 1025px) {
  .table-editor-toggle {
    display: none;
  }
}

.workspace-v2-table-area .product-table th {
  height: 38px;
  padding: 0 12px;
  background: #fafbfc;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 500;
}

.workspace-v2-table-area .product-table td {
  height: 68px;
  padding: 12px;
}

.workspace-v2-table-area .product-table tbody tr {
  background: #fff;
}

.workspace-v2-table-area .product-table tbody tr:hover {
  background: #fafcff;
}

.workspace-v2-table-area .product-table tbody tr.is-selected {
  background: #fff;
  box-shadow: inset 2px 0 0 var(--blue);
}

.workspace-v2-table-area .product-table tbody tr.is-editing {
  background: #f5f8ff;
}

.workspace-v2-table-area .product-table tbody tr.is-selected.is-editing {
  background: #eff6ff;
}

.product-thumb {
  width: 44px;
  height: 44px;
  border-color: #edf0f3;
  border-radius: 6px;
}

.product-copy {
  gap: 2px;
}

.product-copy strong {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
}

.product-copy span,
.product-table td small {
  margin-top: 1px;
  font-size: 12px;
}

.product-price-cell strong {
  font-size: 14px;
  font-weight: 600;
}

.table-status {
  gap: 5px;
  font-size: 13px;
}

.table-status i {
  width: 6px;
  height: 6px;
}

.workspace-v2-table-area .pagination {
  min-height: 48px;
  padding: 6px 16px;
  font-size: 12px;
}

.workspace-v2-editor {
  border-left-color: var(--line);
}

.workspace-v2-editor .editor-panel-header {
  min-height: 64px;
  padding: 14px 20px 12px;
}

.workspace-v2-editor .edit-tabs {
  min-height: 42px;
  padding: 4px 16px 0;
}

.workspace-v2-editor .edit-tab {
  min-height: 38px;
  padding: 7px 3px 9px;
  font-size: 12px;
  font-weight: 500;
}

.workspace-v2-editor .rule-scroll {
  gap: 24px;
  padding: 24px 20px;
}

.workspace-v2-editor .rule-intro h3 {
  margin-bottom: 5px;
  font-size: 15px;
  font-weight: 600;
}

.workspace-v2-editor .rule-intro .help {
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.6;
}

.workspace-v2-editor .form-grid.one-column {
  gap: 20px;
}

.workspace-v2-editor .rule-field-group {
  display: grid;
  gap: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.workspace-v2-editor .rule-field-group-title {
  color: var(--text-faint);
  font-size: 12px;
  font-weight: 500;
}

.workspace-v2-editor .field {
  gap: 7px;
}

.workspace-v2-editor .field > span {
  color: #344054;
  font-size: 12px;
  font-weight: 500;
}

.workspace-v2-editor .field input,
.workspace-v2-editor .field select,
.workspace-v2-editor .field textarea {
  border-color: var(--line);
  border-radius: 6px;
  font-size: 14px;
}

.workspace-v2-editor .field textarea {
  min-height: 104px;
  line-height: 1.55;
}

.workspace-v2-editor .rule-footer {
  gap: 10px;
  padding: 12px 20px 16px;
}

.workspace-v2-editor .rule-summary {
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.workspace-v2-editor .rule-summary span,
.workspace-v2-editor .rule-summary small {
  font-size: 12px;
}

.workspace-v2-editor .rule-summary strong {
  font-size: 14px;
  font-weight: 600;
}

.rule-footer-actions {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.rule-footer-actions .link-button {
  height: 36px;
  padding: 0 4px;
  color: var(--text-soft);
  font-size: 13px;
}

.rule-footer-actions #generate-preview {
  height: 36px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
}

.workspace-v2-bottom-stack .selection-action-bar,
.workspace-v2-bottom-stack .pending-apply-bar {
  min-height: 56px;
  padding: 8px 16px;
}

.workspace-v2-bottom-stack .pending-apply-copy strong {
  font-weight: 600;
}

@media (max-width: 1280px) and (min-width: 1025px) {
  .topbar-device-control {
    grid-template-columns: minmax(0, 190px);
  }

  .topbar-device-control > span,
  .topbar-sync-state .sync-detail-inline,
  .account-menu .account-identity {
    display: none;
  }
}

@media (max-width: 1024px) {
  .topbar {
    padding: 8px 14px;
  }

  .account-menu-popover {
    right: 0;
  }

  .workspace-v2-editor .rule-scroll {
    padding: 24px 20px;
  }
}

@media (max-width: 760px) {
  .topbar-sync-state .sync-detail-inline,
  .account-menu .account-identity {
    display: none;
  }

  .workspace-v2-table-head {
    align-items: center;
    flex-direction: row;
  }
}

@media (max-width: 540px) {
  .topbar-sync-state {
    display: none;
  }

  .account-menu summary {
    width: 36px;
    padding: 0;
    justify-content: center;
  }

  .account-menu-chevron {
    display: none;
  }

  .account-menu #account-logout {
    display: flex;
  }

  .workspace-v2-editor .editor-panel-header,
  .workspace-v2-editor .rule-scroll,
  .workspace-v2-editor .rule-footer {
    padding-right: 16px;
    padding-left: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* Workspace V2 reference-led component reconstruction */
:root {
  --canvas: #f7f8fa;
  --surface: #ffffff;
  --surface-muted: #fafbfc;
  --surface-hover: #f5f7fa;
  --line: #e6e8ec;
  --line-strong: #dfe3e8;
  --text: #181b20;
  --text-soft: #667085;
  --text-faint: #98a2b3;
  --blue: #2563eb;
  --blue-hover: #1d4ed8;
  --blue-soft: #eff6ff;
  --radius: 6px;
  --sidebar-width: 208px;
  --topbar-height: 56px;
  --panel-width: 400px;
  --control-height: 36px;
}

body {
  font-family: Inter, "PingFang SC", "Noto Sans SC", "Noto Sans JP",
    ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

h1,
.topbar-title h1 {
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.025em;
}

h2,
.workspace-v2-table-head h2,
.editor-panel-header h2 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.012em;
}

button,
input,
select,
textarea {
  font-family: inherit;
}

button,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 2px solid rgb(37 99 235 / 68%);
  outline-offset: 2px;
}

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  appearance: none;
  border: 1px solid #cbd2dc;
  border-radius: 4px;
  background: #fff;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 11px;
  cursor: pointer;
}

input[type="checkbox"]:hover {
  border-color: #98a2b3;
}

input[type="checkbox"]:checked {
  border-color: var(--blue);
  background-color: var(--blue);
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 12 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2.3 6.1 4.8 8.5 9.8 3.5' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

input[type="checkbox"]:disabled {
  border-color: #d9dee7;
  background-color: #f2f4f7;
  cursor: not-allowed;
}

select {
  appearance: none;
  padding-right: 30px !important;
  background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m4 6 4 4 4-4' stroke='%23667085' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
  background-position: right 9px center !important;
  background-repeat: no-repeat !important;
}

input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button {
  appearance: none;
}

.ui-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  stroke-width: 1.8;
}

.button,
.icon-button,
.link-button {
  min-height: 36px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 560;
  transition: color 140ms ease, background-color 140ms ease, border-color 140ms ease;
}

.button.compact {
  min-height: 32px;
  font-size: 12px;
  font-weight: 560;
}

.button.primary {
  box-shadow: none;
}

.button.secondary {
  border-color: #dfe3e8;
  color: #475467;
}

.button.secondary:hover:not(:disabled),
.icon-button:hover:not(:disabled) {
  border-color: #cbd2dc;
  background: #f7f8fa;
  color: var(--text);
}

.button[aria-busy="true"] .ui-icon {
  animation: workspace-icon-spin 760ms linear infinite;
}

.button:disabled,
.icon-button:disabled,
.link-button:disabled {
  opacity: 0.48;
}

@keyframes workspace-icon-spin {
  to {
    transform: rotate(360deg);
  }
}

.app-sidebar {
  padding: 0 8px 12px;
  border-right-color: var(--line);
  background: #f9fafb;
}

.sidebar-brand {
  height: 64px;
  padding: 0 8px;
  gap: 9px;
}

.sidebar-brand .brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: #202936;
  font-size: 13px;
  font-weight: 700;
}

.sidebar-brand strong {
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -0.012em;
}

.sidebar-nav {
  display: grid;
  gap: 16px;
  padding: 4px 0 0;
}

.sidebar-nav-group {
  display: grid;
  gap: 2px;
}

.sidebar-nav-label {
  display: block;
  padding: 0 10px 5px;
  color: #98a2b3;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.nav-active-indicator {
  display: none;
}

.page-tab {
  min-height: 36px;
  gap: 10px;
  padding: 0 10px;
  border-radius: 5px;
  color: #667085;
}

.page-tab .ui-icon {
  width: 17px;
  height: 17px;
  color: #98a2b3;
}

.page-tab > span {
  font-size: 13px;
  font-weight: 500;
}

.page-tab:hover {
  background: #f1f3f6;
  color: #344054;
}

.page-tab.active {
  background: #eaf2ff;
  color: #1d4ed8;
}

.page-tab.active .ui-icon {
  color: #2563eb;
}

.sidebar-status {
  padding: 12px 8px 2px;
  border-top-color: var(--line);
}

.sidebar-status-line {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
}

.sidebar-status-separator {
  width: 3px;
  height: 3px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #c5cad3;
}

.license-pill,
.health-pill {
  width: auto;
  min-width: 0;
  min-height: 20px;
  padding: 0;
  color: #667085;
  font-size: 11px;
}

.sidebar-status-line .license-pill,
.sidebar-status-separator {
  display: none;
}

.license-pill .ui-icon {
  display: none;
}

.license-pill span:last-child,
.health-pill span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.license-dot,
.health-dot {
  width: 6px;
  height: 6px;
}

.topbar {
  gap: 24px;
  padding: 0 16px;
  background: #fff;
}

.workspace-topbar-controls {
  gap: 9px;
}

.topbar-device-control {
  grid-template-columns: auto minmax(170px, 220px);
  gap: 8px;
  font-size: 12px;
}

.topbar-device-control select {
  height: 34px;
  border-color: #e1e5eb;
  border-radius: 5px;
  color: #344054;
  font-size: 12px;
}

.topbar-sync-state {
  gap: 6px;
  font-size: 12px;
}

.topbar-sync-state .sync-strip {
  min-height: 20px;
  gap: 5px;
}

.topbar-sync-state .sync-detail-inline {
  max-width: 132px;
  color: #98a2b3;
  font-size: 11px;
}

.topbar-sync-state .status-badge,
.topbar-sync-state .state-chip {
  color: #667085;
  font-size: 12px;
  font-weight: 500;
}

#sync-products {
  min-width: 91px;
  height: 34px;
  border-radius: 5px;
  font-size: 12px;
}

.topbar-icon-button {
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  border-color: #e1e5eb;
  border-radius: 5px;
}

.account-menu summary {
  min-width: 34px;
  height: 34px;
  gap: 6px;
  padding: 0 7px;
  border-radius: 5px;
}

.account-menu summary:hover,
.account-menu[open] summary {
  border-color: #e1e5eb;
  background: #f7f8fa;
}

.account-menu-avatar {
  width: 22px;
  height: 22px;
  background: #eef1f5;
  color: #475467;
  font-size: 10px;
  font-weight: 650;
}

.account-menu .account-identity {
  max-width: 112px;
  color: #667085;
  font-size: 12px;
}

.account-menu-popover {
  width: 196px;
  padding: 6px;
  border-color: #e1e5eb;
  border-radius: 8px;
  box-shadow: 0 14px 30px rgb(16 24 40 / 14%);
}

.account-menu-check,
.account-menu-item {
  min-height: 34px;
  border-radius: 5px;
  color: #475467;
  font-size: 12px;
}

.account-menu-item:hover,
.account-menu-check:hover {
  background: #f5f7fa;
  color: #181b20;
}

.workspace-v2-body {
  grid-template-columns: minmax(0, 1fr) var(--panel-width);
}

.workspace-v2-catalog {
  grid-template-rows: 52px auto minmax(0, 1fr);
}

.workspace-v2-searchbar {
  min-height: 52px;
  gap: 12px;
  padding: 8px 16px;
}

.workspace-search-composer {
  display: flex;
  min-width: 240px;
  flex: 1 1 460px;
  align-items: stretch;
  border: 1px solid #dfe3e8;
  border-radius: 6px;
  background: #fff;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.workspace-search-composer:focus-within {
  border-color: #7aa7f8;
  box-shadow: 0 0 0 3px rgb(37 99 235 / 10%);
}

.workspace-search-mode {
  width: 108px;
  flex: 0 0 108px;
  border-right: 1px solid #e6e8ec;
}

.workspace-search-mode select,
.workspace-query-field input {
  height: 34px;
  border: 0;
  border-radius: 0;
  background-color: transparent;
  font-size: 12px;
}

.workspace-search-mode select {
  color: #475467;
}

.workspace-query-field {
  position: relative;
  min-width: 0;
  flex: 1 1 auto;
}

.workspace-query-icon {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 10px;
  display: grid;
  color: #98a2b3;
  transform: translateY(-50%);
  pointer-events: none;
}

.workspace-query-icon .ui-icon {
  width: 15px;
  height: 15px;
}

.workspace-query-field input {
  padding: 0 11px 0 32px;
}

.workspace-query-field input:focus {
  outline: 0;
}

.workspace-search-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.workspace-active-filter {
  gap: 7px;
  margin: 0 2px 0 0;
  color: #667085;
  font-size: 12px;
}

.workspace-v2-searchbar #search-products,
.workspace-v2-searchbar #toggle-product-filters {
  height: 34px;
  min-height: 34px;
  border-color: #dfe3e8;
  border-radius: 5px;
  background: #fff;
  color: #475467;
  font-size: 12px;
  font-weight: 560;
}

.workspace-v2-searchbar #search-products {
  min-width: 62px;
}

.workspace-v2-searchbar #toggle-product-filters {
  min-width: 70px;
}

.workspace-v2-searchbar #search-products:hover,
.workspace-v2-searchbar #toggle-product-filters:hover {
  border-color: #c9d0da;
  background: #f7f8fa;
}

.workspace-v2-searchbar #toggle-product-filters[aria-expanded="true"] {
  border-color: #bfd6fb;
  background: #eff6ff;
  color: #2563eb;
}

.workspace-clear-search {
  min-height: 32px;
  padding: 0 2px;
  color: #667085;
  font-size: 12px;
  font-weight: 500;
}

.workspace-clear-search:hover {
  color: #344054;
}

.workspace-v2-filter-popover {
  top: 48px;
  left: 16px;
  width: min(508px, calc(100% - 32px));
  gap: 16px;
  padding: 16px;
  border-color: #e1e5eb;
  border-radius: 10px;
  box-shadow: 0 18px 36px rgb(16 24 40 / 15%);
}

.workspace-v2-filter-header {
  padding-bottom: 12px;
}

.workspace-v2-filter-header h2 {
  font-size: 15px;
}

.workspace-v2-filter-header p,
.workspace-v2-filter-popover .product-search-summary {
  font-size: 12px;
  line-height: 1.55;
}

.workspace-login-strip {
  min-height: 38px;
  padding: 5px 16px;
  border-bottom-color: #efd7a7;
  background: #fffaf0;
}

.workspace-login-copy strong,
.workspace-login-copy span {
  font-size: 12px;
  font-weight: 500;
}

.workspace-login-actions .button {
  min-height: 30px;
  font-size: 11px;
}

.workspace-v2-table-head {
  min-height: 50px;
  padding: 8px 16px;
}

.workspace-v2-table-head h2 {
  color: #181b20;
  font-size: 15px;
}

.workspace-v2-selection-controls {
  gap: 8px 12px;
  color: #667085;
  font-size: 12px;
}

.workspace-v2-selection-controls #selection-count {
  color: #344054;
  font-weight: 560;
}

.table-editor-toggle {
  height: 30px;
  min-height: 30px;
  border-radius: 5px;
}

.workspace-v2-table-area .product-table {
  min-width: 720px;
}

.workspace-v2-table-area .product-table th,
.workspace-v2-table-area .product-table td {
  border-bottom-color: #e8ebef;
}

.workspace-v2-table-area .product-table th {
  height: 38px;
  padding: 0 12px;
  background: #fafbfc;
  color: #667085;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
}

.workspace-v2-table-area .product-table th:nth-child(1) {
  width: 44px;
}

.workspace-v2-table-area .product-table th:nth-child(2) {
  width: 34%;
}

.workspace-v2-table-area .product-table th:nth-child(3) {
  width: 13%;
}

.workspace-v2-table-area .product-table th:nth-child(4) {
  width: 14%;
}

.workspace-v2-table-area .product-table th:nth-child(5) {
  width: 16%;
}

.workspace-v2-table-area .product-table th:nth-child(6) {
  width: 16%;
}

.workspace-v2-table-area .product-table td {
  height: 68px;
  padding: 10px 12px;
}

.workspace-v2-table-area .product-table tbody tr {
  background: #fff;
  transition: background-color 120ms ease;
}

.workspace-v2-table-area .product-table tbody tr:hover {
  background: #f8fafc;
}

.workspace-v2-table-area .product-table tbody tr.is-selected {
  background: #f8fbff;
  box-shadow: inset 2px 0 0 #2563eb;
}

.workspace-v2-table-area .product-table tbody tr.is-editing {
  background: #f5f8ff;
}

.workspace-v2-table-area .product-table tbody tr.is-pending {
  box-shadow: inset 2px 0 0 #b45309;
}

.workspace-v2-table-area .product-table tbody tr.is-selected.is-editing {
  background: #edf5ff;
  box-shadow: inset 2px 0 0 #2563eb;
}

.workspace-v2-table-area .product-table tbody tr.is-selected.is-pending {
  box-shadow: inset 2px 0 0 #2563eb;
}

.product-cell {
  gap: 12px;
}

.product-thumb {
  width: 44px;
  height: 44px;
  border: 1px solid #edf0f3;
  border-radius: 5px;
  background: #f8fafc;
  color: #a6afbd;
  font-size: 8px;
}

.product-thumb-placeholder {
  display: grid;
  place-items: center;
  color: #b8c0cb;
}

.product-thumb-placeholder .ui-icon {
  width: 15px;
  height: 15px;
  stroke-width: 1.55;
}

.product-copy {
  gap: 3px;
}

.product-copy strong {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
}

.product-copy .product-meta,
.product-table td small {
  margin-top: 0;
  color: #98a2b3;
  font-size: 11px;
  line-height: 1.4;
}

.product-copy .product-meta {
  display: flex;
  min-width: 0;
  gap: 4px;
}

.product-copy .product-meta b {
  overflow: hidden;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-copy .product-meta i {
  flex: 0 0 auto;
  color: #c0c6d0;
  font-style: normal;
}

.product-price-cell strong {
  color: #344054;
  font-size: 13px;
  font-weight: 600;
}

.product-status-cell,
.product-price-cell {
  line-height: 1.35;
}

.table-status {
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
}

.table-status i {
  width: 6px;
  height: 6px;
}

.product-status-detail {
  padding-left: 12px;
}

.product-time-cell small {
  color: #98a2b3;
  font-size: 11px;
}

.workspace-v2-table-area .pagination {
  min-height: 46px;
  padding: 6px 16px;
  border-top: 1px solid #e8ebef;
  color: #667085;
}

.workspace-v2-table-area .pagination .button {
  min-height: 30px;
}

.workspace-v2-editor {
  background: #fff;
}

.workspace-v2-editor .editor-panel-header {
  min-height: 68px;
  padding: 14px 20px;
}

.editor-panel-heading {
  display: grid;
  gap: 3px;
}

.editor-panel-heading h2 {
  margin: 0;
  color: #181b20;
  font-size: 15px;
  font-weight: 600;
}

.editor-panel-heading > span {
  color: #98a2b3;
  font-size: 11px;
  line-height: 1.35;
}

.workspace-v2-editor .edit-tabs {
  display: flex;
  min-height: 42px;
  gap: 16px;
  padding: 4px 20px 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.workspace-v2-editor .edit-tabs::-webkit-scrollbar {
  display: none;
}

.workspace-v2-editor .edit-tab {
  width: auto;
  min-width: max-content;
  min-height: 38px;
  padding: 7px 0 10px;
  color: #667085;
  font-size: 12px;
  font-weight: 500;
}

.workspace-v2-editor .edit-tab:hover {
  color: #344054;
}

.workspace-v2-editor .edit-tab.active {
  color: #2563eb;
  font-weight: 600;
}

.workspace-v2-editor .rule-scroll {
  gap: 24px;
  padding: 24px 20px;
}

.workspace-v2-editor .rule-intro {
  display: grid;
  gap: 5px;
}

.workspace-v2-editor .rule-intro h3 {
  margin: 0;
  color: #344054;
  font-size: 14px;
  font-weight: 600;
}

.workspace-v2-editor .rule-intro .help {
  margin: 0;
  color: #667085;
  font-size: 12px;
  line-height: 1.6;
}

.workspace-v2-editor .form-grid.one-column {
  gap: 20px;
}

.workspace-v2-editor .rule-field-group {
  gap: 16px;
  padding: 0 0 20px;
  border-bottom-color: #e9ecf0;
}

.rule-field-group-heading {
  display: grid;
  gap: 3px;
}

.workspace-v2-editor .rule-field-group-title {
  color: #475467;
  font-size: 12px;
  font-weight: 600;
}

.rule-field-group-heading > span:last-child {
  color: #98a2b3;
  font-size: 11px;
}

.rule-field-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.workspace-v2-editor .field {
  gap: 6px;
}

.workspace-v2-editor .field > span {
  color: #475467;
  font-size: 12px;
  font-weight: 500;
}

.workspace-v2-editor .field input,
.workspace-v2-editor .field select,
.workspace-v2-editor .field textarea {
  min-width: 0;
  border-color: #dfe3e8;
  border-radius: 5px;
  background-color: #fff;
  color: #344054;
  font-size: 13px;
  line-height: 1.45;
}

.workspace-v2-editor .field input,
.workspace-v2-editor .field select {
  min-height: 36px;
}

.workspace-v2-editor .field textarea {
  min-height: 108px;
  padding: 9px 10px;
  resize: vertical;
}

.workspace-v2-editor .field input:focus,
.workspace-v2-editor .field select:focus,
.workspace-v2-editor .field textarea:focus {
  border-color: #7aa7f8;
  box-shadow: 0 0 0 3px rgb(37 99 235 / 10%);
  outline: 0;
}

.workspace-v2-editor .rule-footer {
  gap: 12px;
  padding: 14px 20px 16px;
  border-top-color: #e6e8ec;
}

.workspace-v2-editor .rule-summary {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px 12px;
  padding: 0 0 12px;
  border: 0;
  border-bottom: 1px solid #edf0f3;
  border-radius: 0;
  background: transparent;
}

.workspace-v2-editor .rule-summary span,
.workspace-v2-editor .rule-summary small {
  font-size: 11px;
}

.workspace-v2-editor .rule-summary span {
  color: #667085;
}

.workspace-v2-editor .rule-summary strong {
  color: #344054;
  font-size: 13px;
  font-weight: 600;
}

.workspace-v2-editor .rule-summary small {
  color: #98a2b3;
}

.rule-footer-actions {
  gap: 12px;
}

.rule-footer-actions .link-button {
  height: 36px;
  color: #667085;
  font-size: 12px;
  font-weight: 500;
}

.rule-footer-actions #generate-preview {
  height: 36px;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 600;
}

.workspace-v2-bottom-stack .selection-action-bar,
.workspace-v2-bottom-stack .pending-apply-bar {
  min-height: 56px;
  padding: 8px 16px;
  background: #fff;
}

.workspace-v2-bottom-stack .pending-apply-copy strong,
.workspace-v2-bottom-stack .selection-action-copy strong {
  color: #344054;
  font-size: 12px;
  font-weight: 600;
}

.workspace-v2-bottom-stack .pending-apply-copy p,
.workspace-v2-bottom-stack .selection-action-copy span {
  color: #98a2b3;
  font-size: 11px;
}

.toast {
  padding: 12px;
  border-color: #e1e5eb;
  border-radius: 10px;
  font-size: 12px;
  box-shadow: 0 14px 32px rgb(16 24 40 / 14%);
}

.toast-success {
  border-color: #c8ead3;
}

.toast-warning {
  border-color: #efd6a5;
}

.toast-error {
  border-color: #efc7c2;
}

@media (max-width: 1280px) and (min-width: 1025px) {
  .topbar-device-control {
    grid-template-columns: minmax(0, 184px);
  }

  .topbar-device-control > span,
  .topbar-sync-state .sync-detail-inline,
  .account-menu .account-identity {
    display: none;
  }

  .workspace-v2-searchbar {
    gap: 8px;
  }

  .workspace-search-actions {
    gap: 6px;
  }

  .workspace-active-filter {
    margin-right: 0;
  }
}

@media (max-width: 1024px) {
  .sidebar-nav {
    display: flex;
    gap: 4px;
    padding: 0;
  }

  .sidebar-nav-group {
    display: flex;
    gap: 3px;
  }

  .sidebar-nav-label,
  .sidebar-status-separator {
    display: none;
  }

  .sidebar-status-line {
    gap: 8px;
  }

  .workspace-v2-searchbar {
    flex-wrap: wrap;
    min-height: 88px;
  }

  .workspace-search-composer {
    min-height: 36px;
    flex-basis: 420px;
  }

  .workspace-v2-catalog {
    grid-template-rows: auto auto minmax(0, 1fr);
  }

  .workspace-v2-editor .rule-scroll {
    padding: 24px 20px;
  }
}

@media (max-width: 760px) {
  .sidebar-nav-group {
    flex: 0 0 auto;
  }

  .page-tab {
    min-height: 32px;
    padding: 0 8px;
  }

  .page-tab > span {
    font-size: 12px;
  }

  .workspace-v2-searchbar {
    gap: 8px;
    padding: 8px 12px;
  }

  .workspace-search-composer {
    width: 100%;
    flex-basis: 100%;
  }

  .workspace-search-actions {
    width: 100%;
  }

  .workspace-search-actions .workspace-active-filter {
    margin-right: auto;
  }

  .workspace-v2-editor .editor-panel-header,
  .workspace-v2-editor .rule-scroll,
  .workspace-v2-editor .rule-footer {
    padding-right: 16px;
    padding-left: 16px;
  }
}

@media (max-width: 540px) {
  .workspace-search-mode {
    width: 104px;
    flex-basis: 104px;
  }

  .workspace-v2-searchbar {
    display: flex;
    min-height: 94px;
    flex-wrap: wrap;
    grid-template-columns: none;
  }

  .workspace-search-actions {
    flex-wrap: wrap;
  }

  .workspace-search-actions .workspace-active-filter {
    width: 100%;
    margin-bottom: 2px;
  }

  .workspace-v2-searchbar #search-products,
  .workspace-v2-searchbar #toggle-product-filters {
    flex: 1 1 auto;
  }

  .workspace-clear-search {
    margin-left: auto;
  }

  .rule-field-pair {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ============ 优惠券活动 ============ */

/* Coupon campaign product picker */
.coupon-picker-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.coupon-picker-search {
  flex: 1;
  min-width: 0;
}

.coupon-picker-search input {
  width: 100%;
}

.coupon-picker-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.coupon-picker-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border, #e3e5ea);
  border-radius: 10px;
  cursor: pointer;
  background: var(--surface, #fff);
}

.coupon-picker-row:hover {
  border-color: var(--primary, #4f46e5);
}

.coupon-picker-row.is-selected {
  border-color: var(--primary, #4f46e5);
  background: color-mix(in srgb, var(--primary, #4f46e5) 6%, #fff);
}

.coupon-picker-row input[type="checkbox"] {
  flex: none;
}

.coupon-picker-row .coupon-picker-thumb {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-muted, #f3f4f6);
  display: flex;
  align-items: center;
  justify-content: center;
}

.coupon-picker-row .coupon-picker-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.coupon-picker-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.coupon-picker-copy strong {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.coupon-picker-copy small {
  color: var(--muted-foreground, #6b7280);
}

.coupon-picker-pager {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.coupon-picker-range {
  font-size: 12px;
  color: var(--muted-foreground, #6b7280);
}

/* 操作条提到列表上方常驻，避免长列表把创建按钮推到屏幕外。 */
.coupon-action-bar {
  position: sticky;
  top: 8px;
  z-index: 2;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgb(16 24 40 / 8%);
}

.coupon-selected-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 96px;
  overflow-y: auto;
  margin-bottom: 12px;
}

.coupon-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line-strong, #d6d9e0);
  border-radius: 999px;
  background: #fff;
  padding: 3px 10px;
  font-size: 12px;
  cursor: pointer;
}

.coupon-chip:hover {
  border-color: var(--danger, #d93025);
  color: var(--danger, #d93025);
}

.coupon-picker-modes {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border, #e3e5ea);
  margin-bottom: 12px;
}

.coupon-mode-tab {
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  padding: 8px 12px;
  color: var(--text-soft, #6b7280);
  font-size: 13px;
  cursor: pointer;
}

.coupon-mode-tab.is-active {
  border-bottom-color: var(--accent, #4f46e5);
  color: var(--accent, #4f46e5);
  font-weight: 600;
}

.coupon-paste-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 10px 0;
}

.coupon-paste-result {
  border: 1px solid var(--border, #e3e5ea);
  border-radius: 8px;
  padding: 12px;
}

.coupon-paste-summary {
  margin: 0 0 6px;
  font-size: 13px;
}

.coupon-paste-summary .is-missing {
  color: var(--danger, #d93025);
}

.coupon-missing-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
  max-height: 120px;
  overflow-y: auto;
}

.coupon-missing-list code {
  border-radius: 4px;
  background: var(--surface-soft, #f3f4f6);
  padding: 2px 6px;
  font-size: 12px;
}

.coupon-picker-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  border-top: 1px solid var(--border, #e3e5ea);
  padding-top: 14px;
  padding-bottom: 16px;
}

.coupon-picker-footer strong {
  display: block;
  font-size: 14px;
}

.coupon-picker-footer .help {
  font-size: 12px;
}

.coupon-campaign-dialog {
  width: min(720px, calc(100vw - 48px));
}

.coupon-campaign-card {
  max-width: 720px;
  width: 100%;
}

.coupon-campaign-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
  margin-block: 12px;
}

@media (max-width: 640px) {
  .coupon-campaign-grid {
    grid-template-columns: 1fr;
  }
}

.coupon-campaign-preview {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
  padding: 8px;
  border-radius: 8px;
  background: color-mix(in srgb, currentColor 5%, transparent);
}

/* 店铺管理面板 */
.shop-manager {
  margin-bottom: 24px;
  padding: 16px 20px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.shop-manager-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.shop-manager-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}
.current-device-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.setup-form input[readonly] {
  background: color-mix(in srgb, var(--surface) 86%, var(--border));
  color: var(--text-muted);
  cursor: not-allowed;
}
.shop-manager-hint {
  margin: 0 0 12px;
  font-size: 0.82rem;
  color: var(--text-muted);
}
.shop-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.shop-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--background);
}
.shop-card-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.shop-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.shop-card-info strong {
  font-size: 0.9rem;
}
.shop-remove-btn {
  font-size: 0.75rem;
}

/* 添加店铺对话框 */
.modal-dialog {
  border: none;
  border-radius: 12px;
  padding: 24px;
  min-width: 340px;
  max-width: 420px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
}
.modal-dialog::backdrop {
  background: rgba(0,0,0,0.4);
}
.dialog-form h4 {
  margin: 0 0 16px;
  font-size: 1.05rem;
}
.dialog-form .field {
  margin-bottom: 12px;
}
.dialog-form .field-note {
  margin: 4px 0 16px;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.dialog-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 16px;
}
