.tsw-overlay {
  position: fixed;
  inset: 0;
  z-index: 12050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow: hidden;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #111827;
  -webkit-font-smoothing: antialiased;
  animation: tsw-overlay-in 0.28s ease;
}

@keyframes tsw-overlay-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.tsw-overlay[hidden] {
  display: none;
}

body.tsw-modal-open {
  overflow: hidden;
}

.tsw-shell {
  width: min(1320px, 100%);
  height: min(90vh, 860px);
  max-height: 90vh;
  margin: auto;
  padding: 14px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: linear-gradient(180deg, #f8faff 0%, #f5f7fc 100%);
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 24px;
  box-shadow:
    0 28px 80px rgba(15, 23, 42, 0.28),
    0 0 0 1px rgba(15, 23, 42, 0.04);
  overflow: hidden;
  animation: tsw-modal-in 0.34s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes tsw-modal-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.tsw-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-shrink: 0;
}

.tsw-topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  flex: 1;
}

.tsw-logo img {
  height: 42px;
  width: auto;
  display: block;
  flex-shrink: 0;
}

.tsw-welcome-strip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.tsw-welcome-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.tsw-welcome-strip h1 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.tsw-welcome-strip p {
  margin: 0;
  font-size: 13px;
  font-weight: 400;
  color: #6b7280;
  line-height: 1.4;
}

.tsw-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #ede9fe;
  color: #5b21b6;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.tsw-progress-card {
  min-width: 220px;
  max-width: 280px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 8px 12px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
  flex-shrink: 0;
}

.tsw-progress-label {
  margin: 0 0 6px;
  font-size: 12px;
  color: #6b7280;
}

.tsw-progress-label strong {
  color: #111827;
}

.tsw-progress-track {
  height: 6px;
  border-radius: 999px;
  background: #eef2ff;
  overflow: hidden;
}

.tsw-progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #4f46e5, #6366f1);
  transition: width 0.45s ease;
}

.tsw-progress-eta {
  margin: 6px 0 0;
  font-size: 11px;
  color: #6b7280;
}

.tsw-layout {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr) 320px;
  gap: 12px;
  align-items: stretch;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.tsw-sidebar,
.tsw-preview,
.tsw-main-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 18px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
}

.tsw-sidebar {
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.tsw-sidebar-title {
  margin: 0 0 8px;
  padding: 0 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #6b7280;
  flex-shrink: 0;
}

.tsw-sidebar-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.tsw-sidebar-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: #6b7280;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.tsw-sidebar-list li:hover {
  background: #f9fafb;
}

.tsw-sidebar-list li.is-active {
  background: #eef2ff;
  color: #4f46e5;
}

.tsw-sidebar-list li.is-done {
  color: #15803d;
}

.tsw-sidebar-badge {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 800;
  background: #f3f4f6;
  color: #9ca3af;
  flex-shrink: 0;
}

.tsw-sidebar-list li.is-active .tsw-sidebar-badge {
  background: #4f46e5;
  color: #fff;
}

.tsw-sidebar-list li.is-done .tsw-sidebar-badge {
  background: #22c55e;
  color: #fff;
}

.tsw-help-card {
  margin-top: 8px;
  padding: 10px;
  border-radius: 12px;
  background: linear-gradient(180deg, #faf5ff 0%, #f5f3ff 100%);
  border: 1px solid #ede9fe;
  flex-shrink: 0;
}

.tsw-help-card strong {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
}

.tsw-help-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: #22c55e;
  color: #fff;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.tsw-help-btn:hover {
  transform: translateY(-1px);
}

.tsw-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.tsw-main-card {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tsw-timeline-wrap {
  padding: 0 12px;
  overflow-x: auto;
  flex-shrink: 0;
  border-bottom: 1px solid #f3f4f6;
}

.tsw-timeline {
  list-style: none;
  margin: 0;
  padding: 10px 4px 8px;
  display: flex;
  gap: 0;
  min-width: max-content;
}

.tsw-timeline li {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 72px;
  padding: 0 8px;
  cursor: pointer;
  user-select: none;
}

.tsw-timeline li:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 11px;
  left: calc(50% + 14px);
  width: calc(100% - 28px);
  height: 2px;
  background: #e5e7eb;
  z-index: 0;
}

.tsw-timeline li.is-done:not(:last-child)::after {
  background: #86efac;
}

.tsw-timeline-dot {
  position: relative;
  z-index: 1;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 800;
  background: #f3f4f6;
  color: #9ca3af;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px #e5e7eb;
}

.tsw-timeline li.is-active .tsw-timeline-dot {
  background: #4f46e5;
  color: #fff;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.18);
}

.tsw-timeline li.is-done .tsw-timeline-dot {
  background: #22c55e;
  color: #fff;
}

.tsw-timeline-label {
  font-size: 11px;
  font-weight: 600;
  color: #9ca3af;
  text-align: center;
  white-space: nowrap;
}

.tsw-timeline li.is-active .tsw-timeline-label {
  color: #4f46e5;
}

.tsw-timeline li.is-done .tsw-timeline-label {
  color: #15803d;
}

.tsw-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 18px 14px;
  animation: tsw-fade-in 0.25s ease;
}

@keyframes tsw-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.tsw-step-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.tsw-step-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.tsw-step-desc {
  margin: 4px 0 0;
  font-size: 14px;
  color: #6b7280;
  line-height: 1.4;
}

.tsw-secure-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 10px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.tsw-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.tsw-role-card,
.tsw-feature-card {
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  background: #fff;
  padding: 12px 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.tsw-role-card:hover,
.tsw-feature-card:hover {
  border-color: #c7d2fe;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
}

.tsw-role-card.is-highlight {
  border-color: #a5b4fc;
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1);
}

.tsw-role-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.tsw-role-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 16px;
  background: #f5f3ff;
}

.tsw-role-icon--green { background: #ecfdf5; }
.tsw-role-icon--blue { background: #eff6ff; }
.tsw-role-icon--gold { background: #fffbeb; }

.tsw-role-badge {
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
}

.tsw-role-badge--purple { background: #ede9fe; color: #6d28d9; }
.tsw-role-badge--blue { background: #dbeafe; color: #1d4ed8; }
.tsw-role-badge--green { background: #dcfce7; color: #15803d; }

.tsw-role-name {
  margin: 0 0 2px;
  font-size: 14px;
  font-weight: 600;
}

.tsw-role-desc {
  margin: 0 0 8px;
  font-size: 12px;
  color: #6b7280;
  line-height: 1.35;
}

.tsw-role-perms {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
  display: grid;
  gap: 4px;
}

.tsw-role-perms li {
  font-size: 12px;
  color: #374151;
}

.tsw-role-perms li::before {
  content: '✓ ';
  color: #22c55e;
  font-weight: 800;
}

.tsw-role-add,
.tsw-open-inline {
  width: 100%;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fafafa;
  color: #374151;
  padding: 8px 10px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.tsw-role-add:hover,
.tsw-open-inline:hover {
  background: #fff;
  border-color: #c7d2fe;
  color: #4f46e5;
}

.tsw-status {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
}

.tsw-status[data-tone="ok"] {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.tsw-status[data-tone="warn"] {
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
}

.tsw-status[data-tone="neutral"] {
  background: #f9fafb;
  color: #4b5563;
  border: 1px solid #e5e7eb;
}

.tsw-tip {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #faf5ff;
  border: 1px solid #ede9fe;
  font-size: 12px;
  color: #5b21b6;
}

.tsw-checklist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.tsw-checklist li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  font-size: 13px;
  font-weight: 600;
  color: #6b7280;
}

.tsw-checklist li.is-done {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #15803d;
}

.tsw-check-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  background: #f3f4f6;
  color: #9ca3af;
  flex-shrink: 0;
}

.tsw-checklist li.is-done .tsw-check-icon {
  background: #22c55e;
  color: #fff;
}

.tsw-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  border-top: 1px solid #e5e7eb;
  background: #fff;
  border-radius: 16px;
  flex-shrink: 0;
  box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.04);
}

.tsw-foot-left {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 0;
}

.tsw-foot-note {
  margin: 0;
  padding-left: 2px;
  font-size: 11px;
  color: #9ca3af;
  line-height: 1.3;
}

.tsw-foot-actions {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex-shrink: 0;
}

.tsw-btn--save {
  min-width: 148px;
}

.tsw-btn {
  border: 0;
  border-radius: 12px;
  padding: 10px 16px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.tsw-btn:active {
  transform: translateY(1px);
}

.tsw-btn--primary {
  min-width: 160px;
  background: linear-gradient(180deg, #4f46e5 0%, #4338ca 100%);
  color: #fff;
  box-shadow: 0 8px 20px rgba(79, 70, 229, 0.25);
}

.tsw-btn--ghost {
  background: #fff;
  color: #374151;
  border: 1px solid #e5e7eb;
}

.tsw-btn--link {
  background: transparent;
  color: #6b7280;
  padding-inline: 4px;
  font-size: 13px;
}

.tsw-next-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.tsw-next-hint {
  font-size: 11px;
  color: #6b7280;
}

.tsw-preview {
  padding: 16px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
}

.tsw-preview-title {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 700;
  flex-shrink: 0;
}

.tsw-preview-cover {
  position: relative;
  margin-bottom: 38px;
  flex-shrink: 0;
}

.tsw-preview-hero {
  height: 118px;
  border-radius: 16px;
  background: linear-gradient(135deg, #312e81, #4f46e5);
  overflow: hidden;
  border: 0;
  padding: 0;
  display: block;
  width: 100%;
  position: relative;
  cursor: pointer;
}

.tsw-preview-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tsw-preview-hero-cta {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.72);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  opacity: 0;
  transform: translateY(2px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.tsw-preview-hero:hover .tsw-preview-hero-cta {
  opacity: 1;
  transform: translateY(0);
}

.tsw-preview-brand {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
  padding-left: 4px;
}

.tsw-preview-logo-btn {
  position: absolute;
  left: 14px;
  bottom: -30px;
  z-index: 2;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  line-height: 0;
}

.tsw-preview-logo-btn:hover .tsw-preview-logo,
.tsw-preview-logo-btn:hover .tsw-preview-logo-fallback {
  outline: 3px solid rgba(79, 70, 229, 0.35);
  outline-offset: 2px;
}

.tsw-preview-logo {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  background: #f3f4f6;
  border: 4px solid #fff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
}

.tsw-preview-logo-fallback {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #eef2ff;
  color: #4f46e5;
  font-weight: 800;
  font-size: 20px;
  border: 4px solid #fff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
}

.tsw-preview-name {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
}

.tsw-preview-status {
  display: inline-flex;
  margin-top: 2px;
  padding: 3px 7px;
  border-radius: 999px;
  background: #dcfce7;
  color: #15803d;
  font-size: 10px;
  font-weight: 700;
}

.tsw-preview-rating {
  margin: 8px 0 10px;
  font-size: 13px;
  color: #6b7280;
}

.tsw-preview-stats {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
  display: grid;
  gap: 5px;
}

.tsw-preview-stats li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: #6b7280;
}

.tsw-preview-stats strong {
  color: #111827;
}

.tsw-preview-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  font-size: 11px;
  color: #4f46e5;
  margin-bottom: 8px;
}

.tsw-preview-action {
  width: 100%;
  border: 0;
  border-radius: 10px;
  padding: 9px 10px;
  background: #4f46e5;
  color: #fff;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.tsw-preview-remaining {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #f3f4f6;
}

.tsw-preview-remaining h4 {
  margin: 0 0 6px;
  font-size: 12px;
}

.tsw-preview-remaining ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}

.tsw-preview-remaining li {
  font-size: 11px;
  color: #6b7280;
}

.tsw-preview-remaining li::before {
  content: '○ ';
  color: #d1d5db;
}

.tsw-preview-remaining li.is-done {
  color: #15803d;
}

.tsw-preview-remaining li.is-done::before {
  content: '✓ ';
  color: #22c55e;
}

.tsw-pill {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 12040;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px 10px 16px;
  border-radius: 999px;
  background: #111827;
  color: #f9fafb;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.28);
  font-size: 13px;
}

.tsw-pill[hidden] {
  display: none;
}

.tsw-pill button {
  border: 0;
  border-radius: 999px;
  padding: 8px 12px;
  font: inherit;
  font-weight: 700;
  background: #4f46e5;
  color: #fff;
  cursor: pointer;
}

@media (max-width: 1100px) {
  .tsw-layout {
    grid-template-columns: 190px minmax(0, 1fr);
    grid-template-rows: 1fr auto;
  }

  .tsw-preview {
    grid-column: 1 / -1;
    max-height: none;
    flex-direction: column;
    overflow: visible;
  }

  .tsw-preview-cover {
    margin-bottom: 34px;
  }

  .tsw-preview-hero {
    height: 100px;
  }
}

@media (max-width: 820px) {
  .tsw-overlay {
    padding: 8px;
  }

  .tsw-shell {
    height: 96vh;
    max-height: 96vh;
    border-radius: 18px;
    padding: 10px;
  }

  .tsw-topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .tsw-topbar-left {
    flex-direction: column;
    align-items: flex-start;
  }

  .tsw-welcome-strip p {
    display: block;
  }

  .tsw-progress-card {
    max-width: none;
    width: 100%;
  }

  .tsw-layout {
    grid-template-columns: 1fr;
  }

  .tsw-sidebar {
    max-height: 140px;
  }

  .tsw-card-grid {
    grid-template-columns: 1fr;
  }

  .tsw-foot {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .tsw-foot-actions {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .tsw-next-wrap {
    align-items: stretch;
    width: 100%;
  }

  .tsw-btn--primary,
  .tsw-btn--save {
    width: 100%;
  }
}
