:root {
  color-scheme: dark;
  --bg: #0f1320;
  --panel: #1a2033;
  --panel-strong: #151a29;
  --border: rgba(148, 187, 255, 0.14);
  --border-soft: rgba(148, 187, 255, 0.08);
  --accent: #6ea8fe;
  --accent-soft: rgba(110, 168, 254, 0.16);
  --success: #6fcf97;
  --warning: #ffd166;
  --muted: rgba(220, 232, 255, 0.65);
  --text: #edf3ff;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  padding: 0;
  background: radial-gradient(circle at 15% -20%, rgba(110, 168, 254, 0.18), transparent 55%),
    radial-gradient(circle at 90% 10%, rgba(111, 207, 151, 0.12), transparent 45%),
    var(--bg);
  color: var(--text);
}

.app-shell {
  min-height: 100vh;
  padding: 2rem clamp(1.75rem, 4vw, 3rem);
  display: grid;
  gap: 2rem;
}

.app-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.35rem 1.8rem;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(110, 168, 254, 0.18), rgba(21, 26, 41, 0.92));
  box-shadow: 0 18px 55px rgba(10, 16, 38, 0.4);
  backdrop-filter: blur(18px);
}

.app-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.45rem;
  letter-spacing: 0.02em;
  margin: 0;
}

.app-actions {
  display: inline-flex;
  gap: 0.9rem;
  align-items: center;
}

.app-actions .action-link,
.app-actions .action-button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border-radius: 12px;
  padding: 0.55rem 0.95rem;
  border: 1px solid rgba(110, 168, 254, 0.28);
  background: rgba(15, 19, 32, 0.6);
  color: var(--text);
  font-size: 0.88rem;
  text-decoration: none;
  cursor: pointer;
}

.app-actions .action-button {
  background: rgba(110, 168, 254, 0.14);
}

.app-content {
  display: block;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 340px) 1fr;
  gap: 1.75rem;
  align-items: start;
}

.sidebar {
  display: grid;
  gap: 1.5rem;
  position: sticky;
  top: 2rem;
  max-height: calc(100vh - 4rem);
  overflow: visible;
}

.sidebar .panel {
  position: relative;
}

.main-pane {
  display: grid;
  gap: 1.5rem;
}

.main-pane[data-empty="true"] #session-steps,
.main-pane[data-empty="true"] #suite-preview,
.main-pane[data-empty="true"] #events-log {
  opacity: 0.35;
  filter: grayscale(0.3);
}

.banner {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  align-items: flex-start;
  flex-wrap: wrap;
}

.banner h2 {
  margin: 0.2rem 0 0;
}

.banner p {
  margin: 0.4rem 0 0;
  color: var(--muted);
}

.banner .detail-actions {
  display: inline-flex;
  gap: 0.7rem;
  align-items: center;
}

.panel {
  background: var(--panel);
  border-radius: 20px;
  border: 1px solid var(--border);
  padding: 1.25rem;
  display: grid;
  gap: 1rem;
  box-shadow: 0 16px 45px rgba(4, 10, 26, 0.35);
}

.panel.subtile {
  background: var(--panel-strong);
  border-color: var(--border-soft);
}

.panel.resizable {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  resize: vertical;
  overflow: hidden;
  min-height: 200px;
  max-height: 75vh;
  padding-bottom: 1.5rem;
}

.panel.resizable::-webkit-resizer {
  background: rgba(110, 168, 254, 0.35);
  border-radius: 12px;
}

.panel.inline {
  padding: 1rem;
}

.panel header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  border: 1px solid rgba(110, 168, 254, 0.28);
  background: rgba(110, 168, 254, 0.1);
  color: var(--accent);
  font-size: 0.72rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.ghost-button {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 12px;
  padding: 0.45rem 0.85rem;
  border: 1px solid rgba(110, 168, 254, 0.24);
  background: rgba(15, 19, 32, 0.55);
  color: var(--text);
  font-size: 0.82rem;
  cursor: pointer;
}

.session-list {
  display: grid;
  gap: 0.75rem;
}

.session-card {
  padding: 0.9rem 1rem;
  border-radius: 16px;
  display: grid;
  gap: 0.45rem;
  background: var(--panel-strong);
  border: 1px solid transparent;
  cursor: pointer;
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.session-card:hover {
  border-color: rgba(110, 168, 254, 0.4);
  transform: translateY(-2px);
}

.session-card.active {
  border-color: var(--accent);
  box-shadow: 0 16px 38px rgba(110, 168, 254, 0.22);
}

.session-card h3 {
  margin: 0;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.session-card footer {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.78rem;
}

session-card footer span,
.session-card footer span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.9rem;
}

.meta-chip {
  background: var(--panel-strong);
  border: 1px solid rgba(110, 168, 254, 0.18);
  border-radius: 18px;
  padding: 0.8rem 1rem;
  display: grid;
  gap: 0.4rem;
}

.meta-chip span {
  text-transform: uppercase;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.meta-chip strong {
  font-size: 1rem;
  display: inline-flex;
  gap: 0.45rem;
  align-items: center;
}

.variable-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  min-height: 32px;
}

.variable-chips .chip {
  border: 1px solid rgba(110, 168, 254, 0.26);
  background: rgba(110, 168, 254, 0.12);
  color: var(--accent);
  padding: 0.32rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.event-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.8rem;
  max-height: 320px;
  overflow: auto;
}

.event-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.85rem;
  padding: 0.85rem 0.95rem;
  background: rgba(20, 25, 40, 0.85);
  border-radius: 16px;
  border: 1px solid rgba(148, 187, 255, 0.12);
}

.event-item strong {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
}

.event-item small {
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
}

.event-item p {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  color: rgba(226, 233, 255, 0.9);
}

.icon-stack {
  width: 28px;
  height: 28px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(110, 168, 254, 0.32);
  background: rgba(110, 168, 254, 0.16);
  color: var(--accent);
}

.icon-stack.success {
  background: rgba(111, 207, 151, 0.14);
  border-color: rgba(67, 160, 110, 0.35);
  color: var(--success);
}

.icon-stack.warning {
  background: rgba(255, 209, 102, 0.16);
  border-color: rgba(255, 209, 102, 0.4);
  color: var(--warning);
}

.icon-stack.fail {
  background: rgba(235, 87, 87, 0.16);
  border-color: rgba(235, 87, 87, 0.38);
  color: #eb5757;
}

.step-list {
  display: grid;
  gap: 0.6rem;
  position: relative;
}

.step-list.drag-active {
  cursor: grabbing;
}

.step-card {
  border-radius: 18px;
  padding: 0.75rem 0.9rem;
  background: var(--panel-strong);
  border: 1px solid rgba(148, 187, 255, 0.14);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.step-card.inactive {
  opacity: 0.55;
}

.step-card.dragging {
  cursor: grabbing;
  box-shadow: 0 16px 32px rgba(15, 22, 45, 0.5);
  opacity: 0.95;
}

.step-placeholder {
  border: 1px dashed rgba(110, 168, 254, 0.35);
  border-radius: 16px;
  background: rgba(110, 168, 254, 0.12);
  margin: 0;
}

.step-card .step-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  line-height: 1.2;
  flex-wrap: nowrap;
  min-height: 1.6rem;
  min-width: 0;
}

.step-card .step-label {
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  flex: 0 1 auto;
  min-width: 0;
}

.step-card .step-args {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.18rem 0.45rem;
  border-radius: 999px;
  background: rgba(110, 168, 254, 0.16);
  color: rgba(226, 235, 255, 0.9);
  font-size: 0.72rem;
  max-width: 50%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 0 1 auto;
  min-width: 0;
}

.step-card .step-id {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--muted);
  font-size: 0.72rem;
  margin-left: auto;
  white-space: nowrap;
  flex: 0 0 auto;
}

.assignment-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.assignment-chips .chip {
  border: 1px solid rgba(110, 168, 254, 0.24);
  background: rgba(110, 168, 254, 0.12);
  color: var(--accent);
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.step-controls {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.step-control-button {
  font-size: 0.68rem;
  padding: 0.28rem 0.5rem;
}

.suite-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.suite-actions {
  display: inline-flex;
  gap: 0.6rem;
  align-items: center;
}

.suite-preview {
  background: rgba(12, 16, 27, 0.85);
  border-radius: 18px;
  border: 1px solid rgba(148, 187, 255, 0.13);
  font-family: "JetBrains Mono", Consolas, monospace;
  font-size: 0.85rem;
  padding: 1rem 1.2rem;
  max-height: none;
  overflow: auto;
  line-height: 1.65;
}

.suite-preview code {
  display: block;
  white-space: pre;
  min-height: 100%;
}

.muted {
  color: var(--muted);
}

.ghost-button.copied {
  border-color: rgba(111, 207, 151, 0.45);
  color: var(--success);
}

body.compact-mode .step-card {
  padding: 0.65rem;
  gap: 0.35rem;
}

body.compact-mode .step-card .step-row {
  font-size: 0.74rem;
}

body.compact-mode .step-card .step-args,
body.compact-mode .step-card .assignment-chips,
body.compact-mode .step-controls {
  display: none;
}

body.compact-mode .suite-preview {
  font-size: 0.78rem;
  line-height: 1.4;
}

body.compact-mode .event-item {
  grid-template-columns: auto;
  gap: 0.6rem;
  padding: 0.65rem 0.75rem;
}

body.compact-mode .event-item p {
  display: none;
}

#session-steps {
  flex: 1 1 auto;
  overflow: auto;
  min-height: 0;
}

#suite-preview {
  flex: 1 1 auto;
  min-height: 0;
}

#events-log {
  flex: 1 1 auto;
  overflow: auto;
  min-height: 0;
}

@media (max-width: 1080px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    max-height: none;
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 1.2rem 1rem;
  }

  .app-topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.9rem;
  }

  .app-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}
