.button {
  height: var(--control-height);
  min-height: var(--control-height);
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  padding: 0 var(--space-3);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}

.button:hover {
  border-color: var(--primary);
  color: var(--primary);
}

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

.button:disabled:hover {
  border-color: var(--border-strong);
  color: inherit;
}

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

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

.button-ghost {
  background: transparent;
}

.button-danger {
  border-color: #fecaca;
  background: #fff;
  color: var(--danger);
}

.button-danger:hover {
  border-color: var(--danger);
  color: var(--danger);
}

.button-warning {
  border-color: #fed7aa;
  color: var(--warning);
}

.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

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

.panel-title {
  font-weight: 700;
}

.panel-body {
  padding: 16px;
}

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

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-card);
}

.metric-label {
  color: var(--text-sub);
  font-size: 12px;
}

.metric-value {
  margin-top: 7px;
  font-size: 24px;
  font-weight: 700;
}

.empty-state {
  padding: 32px;
  color: var(--text-sub);
  text-align: center;
}

.status-pill,
.tag {
  display: inline-flex;
  align-items: center;
  height: var(--status-height);
  padding: 0 var(--space-2);
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--text-sub);
  border: 1px solid var(--border);
  font-size: var(--font-size-xs);
  white-space: nowrap;
}

.status-pending,
.status-muted,
.status-neutral {
  background: #f9fafb;
  color: #4b5563;
  border-color: #e5e7eb;
}

.status-running,
.status-info {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}

.status-success,
.status-completed {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}

.status-partial,
.status-warning {
  background: #fffbeb;
  color: #b45309;
  border-color: #fde68a;
}

.status-danger,
.status-failed {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}

.status-stopped {
  background: #f1f5f9;
  color: #334155;
  border-color: #cbd5e1;
}

.status-unknown {
  background: #f5f3ff;
  color: #6d28d9;
  border-color: #ddd6fe;
}

.tabs {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
}

.tab-button {
  border: 0;
  border-radius: 8px;
  min-height: var(--control-height);
  padding: 0 12px;
  background: transparent;
  color: var(--text-sub);
  cursor: pointer;
}

.tab-button.active {
  color: var(--primary);
  background: var(--primary-soft);
  font-weight: 700;
}

.global-context-menu {
  position: fixed;
  z-index: 9998;
  width: 156px;
  padding: 6px;
  display: grid;
  gap: 2px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
}

.global-context-menu.hidden {
  display: none;
}

.global-context-menu-item {
  width: 100%;
  height: 36px;
  border: 0;
  border-radius: 8px;
  padding: 0 10px;
  background: transparent;
  color: var(--text-main);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.global-context-menu-item:hover,
.global-context-menu-item:focus-visible {
  background: var(--bg-soft);
  outline: none;
}

.toast-root {
  position: fixed;
  right: 20px;
  top: 20px;
  z-index: 9999;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  min-width: 240px;
  max-width: 380px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  padding: 10px 12px;
  box-shadow: var(--shadow-card);
}

.toast.error {
  border-color: #fecaca;
  color: var(--danger);
}

.toast.success {
  border-color: #bbf7d0;
  color: var(--success);
}

.toast-item {
  width: 100%;
  min-width: 260px;
  max-width: 360px;
  display: grid;
  grid-template-columns: 4px minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--color-border, var(--border));
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.98);
  color: var(--color-text, var(--text-main));
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.16);
  opacity: 0;
  transform: translateY(-8px);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
  pointer-events: auto;
}

.toast-item.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast-item.is-leaving {
  opacity: 0;
  transform: translateY(-8px);
}

.toast-indicator {
  display: block;
  width: 4px;
  min-height: 100%;
  background: #64748b;
}

.toast-message {
  min-width: 0;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
}

.toast-item-success .toast-indicator {
  background: #10b981;
}

.toast-item-error .toast-indicator {
  background: #ef4444;
}

.toast-item-warning .toast-indicator {
  background: #f59e0b;
}

.toast-item-info .toast-indicator {
  background: #3b82f6;
}

.toast-item-success {
  border-color: #bbf7d0;
}

.toast-item-error {
  border-color: #fecaca;
}

.toast-item-warning {
  border-color: #fde68a;
}

.toast-item-info {
  border-color: #bfdbfe;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.38);
  padding: 24px;
}

.modal-backdrop-nested {
  z-index: 140;
}

.modal {
  width: min(560px, 100%);
  max-height: calc(100vh - 48px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-modal);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-wide {
  width: min(980px, 100%);
}

.page-selector-modal {
  width: min(920px, 100%);
}

.modal-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.icon-close-btn {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--radius-md, 8px);
  background: transparent;
  color: var(--color-text-muted, var(--text-sub));
  cursor: pointer;
  font-size: 20px;
  font-weight: 500;
  line-height: 1;
  padding: 0;
  transition: background 0.15s ease, color 0.15s ease;
}

.icon-close-btn:hover {
  background: var(--color-surface-subtle, var(--bg-soft));
  color: var(--color-text, var(--text-main));
}

.icon-close-btn:focus-visible {
  outline: 2px solid var(--color-primary, var(--primary));
  outline-offset: 2px;
}

.modal-header-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.modal-body {
  min-height: 0;
  overflow: auto;
  padding: 16px;
}

.page-selector-body {
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
}

.page-selector-toolbar {
  padding: 0 0 12px;
  border-bottom: 0;
}

.page-selector-panel {
  min-height: 320px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.modal-actions {
  flex-shrink: 0;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 12px;
}

.modal-body > .modal-actions:last-child {
  position: sticky;
  bottom: -16px;
  margin: 0 -16px -16px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
}

.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 180;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.32);
}

.dialog-card {
  width: min(440px, 100%);
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-modal);
}

.dialog-header {
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 8px;
}

.dialog-title {
  color: var(--text-main);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
}

.dialog-body {
  min-height: 0;
  overflow: auto;
  padding: 6px 18px 18px;
}

.dialog-message {
  color: var(--text-sub);
  line-height: var(--line-height-relaxed);
  word-break: break-word;
}

.dialog-message p {
  margin: 0;
}

.dialog-message p + p,
.dialog-message-block + .field {
  margin-top: 10px;
}

.dialog-error {
  color: var(--danger);
  font-size: 13px;
  margin-top: 8px;
}

.dialog-footer {
  flex-shrink: 0;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
}

.dialog-danger {
  border-color: #fecaca;
}

.dialog-warning {
  border-color: #fde68a;
}

.dialog-success {
  border-color: #bbf7d0;
}

.dialog-shake {
  animation: dialog-shake 0.18s ease-in-out;
}

@keyframes dialog-shake {
  0%, 100% {
    transform: translateX(0);
  }

  35% {
    transform: translateX(-4px);
  }

  70% {
    transform: translateX(4px);
  }
}

.modal-footer {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

.json-view {
  max-height: 52vh;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  padding: 12px;
  color: var(--text-main);
  font-size: 12px;
  line-height: var(--line-height-normal);
  white-space: pre-wrap;
  word-break: break-word;
}

.warning-box {
  border: 1px solid #fed7aa;
  background: var(--warning-soft);
  color: #92400e;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.salesmartly-account-host {
  min-height: 0;
  position: relative;
  overflow: hidden;
}

.salesmartly-account-page {
  width: min(860px, 100%);
  display: grid;
  gap: 14px;
}

.salesmartly-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.salesmartly-status-main,
.salesmartly-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

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

.salesmartly-status-name {
  color: var(--text-main);
  font-weight: 700;
}

.salesmartly-account-body {
  min-width: 0;
  overflow: hidden;
}

.salesmartly-info-list {
  width: min(620px, 100%);
  display: grid;
  border-top: 1px solid var(--border);
}

.salesmartly-info-list > div {
  min-width: 0;
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 18px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.salesmartly-info-list span {
  color: var(--text-sub);
}

.salesmartly-info-list strong {
  min-width: 0;
  color: var(--text-main);
  font-weight: 600;
  word-break: break-word;
}

.salesmartly-login-form {
  width: min(460px, 100%);
  display: grid;
  gap: 14px;
  padding-top: 2px;
}

.salesmartly-form-actions {
  justify-content: flex-start;
  gap: 10px;
}

@media (max-width: 900px) {
  .salesmartly-status-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .salesmartly-actions {
    justify-content: flex-start;
  }
}

.wizard-backdrop {
  position: fixed;
  inset: var(--header-height) 0 0 var(--sidebar-width);
  z-index: 115;
  display: flex;
  justify-content: flex-end;
  background: rgba(15, 23, 42, 0.18);
}

.wizard-drawer {
  width: min(920px, 100%);
  height: 100%;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-modal);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.create-plan-drawer {
  width: min(1180px, calc(100vw - var(--sidebar-width) - 40px));
  max-width: calc(100vw - var(--sidebar-width) - 40px);
}

.create-plan-shell {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  background: var(--color-surface);
}

.create-plan-shell.create-plan-edit-shell {
  grid-template-columns: minmax(0, 1fr);
}

.create-plan-edit-shell > .create-plan-step-main {
  grid-column: 1 / -1;
  width: 100%;
  min-width: 0;
}

.create-plan-steps-side {
  min-height: 0;
  padding: 14px 12px;
  border-right: 1px solid var(--color-border);
  background: var(--color-surface-subtle);
  overflow: auto;
}

.create-plan-steps-heading {
  padding: 0 8px 10px;
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
  font-weight: 600;
}

.create-plan-step-list {
  display: grid;
  gap: 6px;
}

.create-plan-step-item {
  min-width: 0;
  width: 100%;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 9px 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-text-muted);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.create-plan-step-item:hover {
  border-color: var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-secondary);
}

.create-plan-step-number {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-size: 12px;
  font-weight: 700;
}

.create-plan-step-text {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.create-plan-step-text strong {
  overflow: hidden;
  color: inherit;
  font-size: var(--font-size-sm);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.create-plan-step-text small {
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
}

.create-plan-step-item.is-current {
  border-color: var(--color-primary);
  background: var(--color-primary-soft);
  color: var(--color-primary);
}

.create-plan-step-item.is-current .create-plan-step-number {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: #fff;
}

.create-plan-step-item.is-done .create-plan-step-number {
  border-color: #a7f3d0;
  background: var(--color-success-soft);
  color: var(--color-success);
}

.wizard-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.wizard-steps {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  background: #fbfdff;
}

.wizard-steps-compact {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.wizard-step {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-sub);
  font-size: 12px;
}

.wizard-step-index {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-sub);
  font-weight: 700;
}

.wizard-step.is-current {
  color: var(--primary);
  font-weight: 700;
}

.wizard-step.is-current .wizard-step-index {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.wizard-step.is-done .wizard-step-index {
  border-color: #bbf7d0;
  background: var(--success-soft);
  color: var(--success);
}

.create-plan-steps {
  grid-template-columns: repeat(6, minmax(96px, 128px));
  justify-content: start;
  gap: 6px;
  padding: 10px 18px;
}

.create-plan-steps .wizard-step {
  gap: 6px;
  font-size: var(--font-size-xs);
}

.create-plan-steps .wizard-step-index {
  width: 20px;
  height: 20px;
  font-size: 11px;
}

.create-plan-steps .wizard-step.is-current .wizard-step-index {
  box-shadow: 0 0 0 3px var(--color-primary-soft);
}

.wizard-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.wizard-footer {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
}

.create-plan-footer {
  min-height: 56px;
  justify-content: flex-start;
}

.create-plan-footer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

@media (max-width: 900px) {
  .wizard-backdrop {
    inset: var(--header-height) 0 0 0;
  }

  .create-plan-drawer {
    width: min(100%, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
  }

  .create-plan-shell {
    grid-template-columns: 1fr;
  }

  .create-plan-steps-side {
    max-height: 128px;
    border-right: 0;
    border-bottom: 1px solid var(--color-border);
  }

  .create-plan-step-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

  .wizard-steps-compact {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Unified SaaS component layer */
.btn,
.button {
  height: var(--control-height);
  min-height: var(--control-height);
  border: 1px solid var(--color-border-strong);
  background: var(--color-surface);
  color: var(--color-text);
  border-radius: var(--radius-md);
  padding: 0 var(--space-3);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  font-size: var(--font-size-sm);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover,
.button:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-primary-soft);
}

.btn:disabled,
.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  box-shadow: none;
}

.btn:disabled:hover,
.button:disabled:hover {
  border-color: var(--color-border-strong);
  color: var(--color-text);
  background: var(--color-surface);
}

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

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

.btn-secondary,
.button-secondary {
  border-color: var(--color-border);
  background: var(--color-surface-subtle);
  color: var(--color-text-secondary);
}

.btn-danger,
.button-danger {
  border-color: #fecaca;
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

.btn-danger:hover,
.button-danger:hover {
  border-color: var(--color-danger);
  background: #fee2e2;
  color: var(--color-danger);
}

.btn-ghost,
.button-ghost {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--color-text-secondary);
}

.btn-ghost:hover,
.button-ghost:hover {
  background: var(--color-surface-subtle);
  border-color: var(--color-border);
}

.btn-sm,
.button-sm {
  height: var(--control-height-sm);
  min-height: var(--control-height-sm);
  padding: 0 var(--space-2);
  font-size: var(--font-size-xs);
}

.btn-icon,
.button-icon {
  width: 32px;
  padding: 0;
}

.panel,
.metric-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.panel-header {
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.panel-title {
  color: var(--color-text);
  font-size: var(--font-size-md);
  font-weight: 700;
}

.panel-body {
  padding: var(--space-4);
}

.metric-label {
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
}

.metric-value {
  color: var(--color-text);
  font-size: 22px;
  font-weight: 700;
}

.empty-state,
.table-empty {
  min-height: 180px;
  display: grid;
  place-items: center;
  padding: var(--space-5);
  color: var(--color-text-muted);
  text-align: center;
}

.empty-page {
  height: 100%;
  min-height: 320px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  color: var(--color-text-muted);
  text-align: center;
}

.empty-page-title {
  color: var(--color-text);
  font-size: 20px;
  font-weight: 800;
  line-height: 1.25;
}

.empty-page-desc {
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
}

.status-badge,
.status-pill,
.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--status-height);
  min-height: var(--status-height);
  padding: 0 var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--color-surface-subtle);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  font-size: var(--font-size-xs);
  font-weight: 700;
  white-space: nowrap;
}

.status-pending,
.status-muted,
.status-neutral {
  background: #f9fafb;
  color: #4b5563;
  border-color: #e5e7eb;
}

.status-running,
.status-info {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}

.status-success,
.status-completed {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}

.status-partial,
.status-warning {
  background: #fffbeb;
  color: #b45309;
  border-color: #fde68a;
}

.status-danger,
.status-failed {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}

.status-stopped {
  background: #f1f5f9;
  color: #334155;
  border-color: #cbd5e1;
}

.status-unknown {
  background: #f5f3ff;
  color: #6d28d9;
  border-color: #ddd6fe;
}

.tabs {
  min-height: 36px;
  gap: var(--space-1);
  padding: var(--space-1);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface-subtle);
}

.tab-button {
  min-height: var(--control-height-sm);
  border-radius: var(--radius-md);
  padding: 0 var(--space-3);
  color: var(--color-text-muted);
  font-weight: 600;
}

.tab-button.active {
  background: var(--color-surface);
  color: var(--color-primary);
  box-shadow: var(--shadow-sm);
}

.toast {
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: var(--shadow-md);
}

.modal-backdrop,
.dialog-backdrop {
  background: rgba(15, 23, 42, 0.34);
}

.modal,
.dialog,
.dialog-card,
.drawer,
.wizard-drawer,
.confirm-dialog {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
}

.drawer,
.wizard-drawer {
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
}

.modal-header,
.dialog-header,
.wizard-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.modal-body,
.dialog-body,
.wizard-body {
  background: var(--color-surface);
}

.modal-footer,
.dialog-footer,
.wizard-footer {
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
}

.wizard-steps {
  background: var(--color-surface-subtle);
  border-bottom: 1px solid var(--color-border);
}

.wizard-step-index {
  border-color: var(--color-border);
  background: var(--color-surface);
}

.wizard-step.is-current .wizard-step-index {
  border-color: var(--color-primary);
  background: var(--color-primary);
}

.warning-box {
  border-color: #fde68a;
  background: var(--color-warning-soft);
  color: #92400e;
  border-radius: var(--radius-md);
}

.json-view {
  border-color: var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-subtle);
}

.template-detail-modal {
  width: min(860px, 100%);
}

.template-detail-body {
  display: grid;
  gap: var(--space-4);
}

.template-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0 var(--space-5);
  border-top: 1px solid var(--color-border);
}

.template-detail-item {
  min-width: 0;
  display: grid;
  gap: 4px;
  padding: 11px 0;
  border-bottom: 1px solid var(--color-border);
}

.template-detail-item span {
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
  font-weight: 600;
}

.template-detail-item strong {
  min-width: 0;
  color: var(--color-text);
  font-size: var(--font-size-sm);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.template-preview-section {
  display: grid;
  gap: var(--space-2);
}

.template-preview-text {
  max-height: 220px;
  margin: 0;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-subtle);
  color: var(--color-text);
  padding: var(--space-3);
  font-size: var(--font-size-sm);
  line-height: 1.7;
}

.template-variable-line {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
}

.template-variable-line span {
  color: var(--color-text-muted);
  font-weight: 600;
}

.template-variable-line strong {
  color: var(--color-text);
  font-weight: 600;
}

.template-raw-section {
  overflow: hidden;
}

.plan-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 var(--space-5);
  border-top: 1px solid var(--color-border);
}

.plan-detail-item {
  min-width: 0;
  display: grid;
  gap: 5px;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border);
}

.plan-detail-item span {
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
  font-weight: 600;
}

.plan-detail-value {
  min-width: 0;
  color: var(--color-text);
  font-size: var(--font-size-sm);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.modal-section-title {
  margin: var(--space-5) 0 var(--space-3);
  color: var(--color-text);
  font-size: var(--font-size-sm);
  font-weight: 700;
}

.task-detail-drawer {
  width: min(1080px, calc(100vw - var(--sidebar-width) - 48px));
  max-width: calc(100vw - var(--sidebar-width) - 48px);
}

.task-detail-body {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  gap: var(--space-4);
}

.task-detail-body .modal-section-title {
  margin: 0;
}

.task-detail-items-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.task-detail-items-table-shell {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.task-detail-items-table-slot {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.task-detail-footer {
  justify-content: flex-start;
}

.task-detail-summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0 var(--space-4);
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-subtle);
}

.task-detail-summary-item {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.task-detail-summary-item > span,
.task-detail-error > span {
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
  font-weight: 600;
}

.task-detail-summary-item > strong,
.task-detail-error > strong {
  min-width: 0;
  color: var(--color-text);
  font-size: var(--font-size-sm);
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-detail-error {
  display: grid;
  gap: 5px;
  padding: 10px 12px;
  border: 1px solid var(--color-danger-soft);
  border-radius: var(--radius-md);
  background: var(--color-danger-soft);
}

.task-paused-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-md);
  background: rgba(255, 251, 235, 0.92);
  box-shadow: var(--shadow-sm);
}

.task-paused-banner-main {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--color-text);
  font-size: var(--font-size-sm);
}

.task-paused-banner-main > span,
.task-paused-banner-main > em {
  min-width: 0;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-paused-banner-main > em {
  color: var(--color-text-muted);
  font-style: normal;
}

.task-paused-banner-actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 8px;
}

@media (max-width: 900px) {
  .task-detail-drawer {
    width: min(860px, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
  }

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

  .task-detail-summary-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    row-gap: var(--space-3);
  }
}

@media (max-width: 640px) {
  .template-detail-grid,
  .plan-detail-grid {
    grid-template-columns: 1fr;
  }

  .task-detail-summary-strip {
    grid-template-columns: 1fr;
  }
}

.salesmartly-account-page {
  width: min(820px, 100%);
  gap: var(--space-4);
}

.salesmartly-status-row {
  padding: var(--space-3) 0;
}

.salesmartly-info-list {
  width: min(660px, 100%);
}

.salesmartly-info-list > div {
  padding: 11px 0;
  grid-template-columns: 112px minmax(0, 1fr);
}

.sales-account-host {
  min-height: 0;
  position: relative;
  overflow: hidden;
}

.sales-account-page {
  width: min(840px, 100%);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.sales-account-bar {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-border);
}

.sales-account-status {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.sales-account-name {
  color: var(--color-text);
  font-weight: 700;
}

.sales-account-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.sales-account-notice {
  width: min(620px, 100%);
  border-left: 3px solid var(--color-warning);
  background: var(--color-warning-soft);
  color: #92400e;
  border-radius: var(--radius-md);
  padding: 9px 12px;
  font-size: var(--font-size-sm);
}

.sales-account-info {
  width: min(760px, 100%);
}

.sales-account-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: var(--space-6);
  border-top: 1px solid var(--color-border);
}

.sales-account-item {
  min-width: 0;
  display: grid;
  gap: 4px;
  min-height: 58px;
  padding: 10px 0;
  border-bottom: 1px solid var(--color-border);
}

.sales-account-item span {
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
  font-weight: 600;
}

.sales-account-item strong {
  min-width: 0;
  color: var(--color-text);
  font-size: var(--font-size-sm);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.sales-account-login-panel {
  width: min(560px, 100%);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
}

.sales-account-login-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
  align-items: end;
}

.sales-account-form-actions {
  grid-column: 1 / -1;
  justify-content: flex-start;
  gap: var(--space-2);
}

@media (max-width: 900px) {
  .sales-account-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .sales-account-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 720px) {
  .sales-account-grid,
  .sales-account-login-form {
    grid-template-columns: 1fr;
  }
}
