:root {
  --bg: #f4f6f8;
  --ink: #17202a;
  --muted: #657282;
  --line: #d9e0e7;
  --panel: #ffffff;
  --panel-2: #eef3f6;
  --blue: #2f6fed;
  --green: #16a085;
  --amber: #d98c21;
  --violet: #7c5cff;
  --rose: #c9405f;
  --shadow: 0 18px 60px rgba(23, 32, 42, 0.12);
  font-family: Inter, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sprite {
  display: none;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--rail-width, 280px) 10px minmax(0, 1fr);
  min-height: 100vh;
}

.rail {
  grid-column: 1;
  background: #111922;
  color: #edf3f7;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.layout-splitter {
  position: relative;
  z-index: 4;
  min-width: 10px;
  width: 10px;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: col-resize;
  touch-action: none;
  outline: none;
}

.layout-splitter::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 4px;
  width: 2px;
  border-radius: 999px;
  background: transparent;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.layout-splitter:hover::before,
.layout-splitter:focus-visible::before,
body.is-resizing-layout .layout-splitter::before {
  background: var(--blue);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.12);
}

.rail-splitter {
  grid-column: 2;
  height: 100%;
  margin-left: -10px;
  transform: translateX(5px);
}

body.is-resizing-layout {
  cursor: col-resize;
  user-select: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 6px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #e9f2ff;
  color: #132031;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-title {
  font-size: 17px;
  font-weight: 760;
}

.brand-subtitle,
.eyebrow,
.panel-label {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.brand-subtitle {
  color: #93a5b7;
}

.skill-nav {
  display: grid;
  gap: 8px;
}

.skill-button {
  width: 100%;
  min-height: 48px;
  border: 1px solid transparent;
  color: #d7e1ea;
  background: transparent;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  text-align: left;
}

.skill-button:hover {
  background: rgba(255, 255, 255, 0.06);
}

.skill-button.active {
  background: #f6f9fc;
  color: #101820;
  border-color: #ffffff;
}

.skill-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--skill-color, var(--blue));
}

.env-panel {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding-top: 18px;
}

.env-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.env-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #cfdae5;
  font-size: 13px;
  gap: 8px;
}

.status-pill {
  min-width: 46px;
  height: 22px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  font-size: 12px;
  color: #111922;
  background: #c6d2dd;
}

.status-pill.ready {
  background: #8bd6bd;
}

.workspace {
  grid-column: 3;
  padding: 28px 32px 36px;
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
}

h1 {
  margin: 4px 0 0;
  font-size: 34px;
  line-height: 1.16;
  letter-spacing: 0;
}

.icon-button {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
}

.metrics-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric {
  min-height: 86px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 8px 22px rgba(23, 32, 42, 0.05);
}

.metric strong {
  display: block;
  font-size: 24px;
  margin-top: 6px;
}

.work-surface {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) 10px minmax(320px, var(--run-panel-width, 420px));
  column-gap: 4px;
  align-items: start;
}

.workspace-splitter {
  grid-column: 2;
  align-self: stretch;
  min-height: 220px;
}

.task-form,
.run-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.task-form {
  grid-column: 1;
  padding: 22px;
  display: grid;
  gap: 20px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.field {
  display: grid;
  gap: 8px;
}

.field.full {
  grid-column: 1 / -1;
}

.field label,
.group-label {
  font-size: 13px;
  font-weight: 700;
  color: #2c3a46;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cad4dd;
  background: #fbfcfd;
  color: var(--ink);
  border-radius: 7px;
  min-height: 42px;
  padding: 10px 12px;
  outline: none;
}

textarea {
  min-height: 118px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.14);
}

.segmented,
.checkbox-grid,
.format-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.segment,
.check-tile {
  border: 1px solid #cad4dd;
  background: #fbfcfd;
  border-radius: 7px;
  min-height: 38px;
  padding: 8px 11px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #263642;
}

.segment input,
.check-tile input {
  width: 16px;
  min-height: 16px;
  accent-color: var(--blue);
}

.segment:has(input:checked),
.check-tile:has(input:checked) {
  border-color: color-mix(in srgb, var(--active-color, var(--blue)) 70%, #ffffff);
  background: color-mix(in srgb, var(--active-color, var(--blue)) 10%, #ffffff);
}

.run-panel {
  grid-column: 3;
  padding: 18px;
  display: grid;
  gap: 14px;
  position: sticky;
  top: 18px;
}

.resizable-height {
  min-height: var(--resize-min-height, 160px);
  max-height: 900px;
  resize: vertical;
  overflow: auto;
}

.run-header,
.console-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.primary-button {
  border: 0;
  min-height: 42px;
  border-radius: 8px;
  padding: 0 15px;
  background: var(--active-color, var(--blue));
  color: white;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 760;
}

.primary-button:disabled {
  opacity: 0.56;
  cursor: wait;
}

.command-box,
.console-box,
.files-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
  padding: 13px;
}

.command-box code {
  display: block;
  margin-top: 8px;
  color: #334250;
  word-break: break-word;
  font-size: 12px;
  line-height: 1.5;
}

.console-box {
  background: #0d141c;
  color: #dbe7ef;
  min-height: 260px;
}

.console-title {
  justify-content: flex-start;
  color: #aebdcc;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 10px;
}

pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12px;
  line-height: 1.5;
  max-height: 420px;
  overflow: auto;
}

.file-list {
  display: grid;
  gap: 8px;
}

.file-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 9px;
  align-items: center;
  min-height: 38px;
  border-radius: 7px;
  color: #263642;
  text-decoration: none;
  padding: 8px;
}

.file-row:hover {
  background: #eef3f6;
}

.file-meta {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.file-meta span,
.file-meta small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-meta small {
  color: var(--muted);
}

.file-action {
  min-width: 44px;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #cad4dd;
  border-radius: 7px;
  color: #263642;
  background: #ffffff;
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
}

.file-action:hover {
  border-color: var(--active-color, var(--blue));
  color: var(--active-color, var(--blue));
}

.download-action {
  min-width: 36px;
}

.empty {
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .layout-splitter {
    display: none;
  }

  .rail {
    grid-column: 1;
    position: static;
    padding: 16px;
  }

  .skill-nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .env-panel {
    display: none;
  }

  .work-surface {
    grid-template-columns: 1fr;
    row-gap: 18px;
  }

  .run-panel {
    grid-column: 1;
    position: static;
  }

  .workspace,
  .task-form {
    grid-column: 1;
  }

  .resizable-height {
    height: auto !important;
    max-height: none;
    resize: none;
  }
}

@media (max-width: 760px) {
  .workspace {
    padding: 20px 14px 28px;
  }

  .skill-nav,
  .metrics-row,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .skill-button {
    min-height: 44px;
  }

  h1 {
    font-size: 28px;
  }
}
