:root {
  --bg: #f6f4ee;
  --surface: #ffffff;
  --surface-2: #f9faf7;
  --ink: #202421;
  --muted: #68706a;
  --line: #d9ded5;
  --accent: #167c6b;
  --accent-ink: #ffffff;
  --blue: #2f6fbd;
  --amber: #b86e00;
  --red: #b42318;
  --green: #198754;
  --shadow: 0 18px 48px rgba(31, 41, 35, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(90deg, rgba(22, 124, 107, 0.08), transparent 34%),
    linear-gradient(180deg, #faf8f1 0%, var(--bg) 38%, #eff3f1 100%);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  letter-spacing: 0;
}

button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease,
    color 160ms ease;
}

button:hover {
  border-color: rgba(22, 124, 107, 0.48);
  transform: translateY(-1px);
}

.app-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 20px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 72px;
  padding: 10px 0 18px;
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: #202421;
  color: #f4c95d;
  font-weight: 800;
  flex: 0 0 auto;
}

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

h1 {
  font-size: 23px;
  line-height: 1.15;
}

.brand p,
.section-heading p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

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

.icon-button {
  width: 40px;
  padding: 0;
  font-size: 21px;
}

.primary-button {
  padding: 0 14px;
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 650;
}

.context-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
  box-shadow: var(--shadow);
}

.context-strip div {
  min-width: 0;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.86);
}

.context-strip span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.context-strip strong {
  display: block;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workbench-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 18px;
  margin-top: 18px;
}

.main-column,
.side-column {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.main-column,
.status-panel,
.waitpoint-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
}

.main-column {
  padding: 16px;
}

.status-panel,
.waitpoint-panel {
  padding: 14px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.section-heading h2 {
  font-size: 16px;
  line-height: 1.25;
}

.compact-heading {
  margin-top: 2px;
  padding-top: 4px;
}

.inline-heading span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.segmented {
  display: flex;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.segmented button {
  min-height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
}

.segmented button.active {
  background: #203b35;
  color: white;
}

.task-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.task-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 128px 120px;
  align-items: center;
  gap: 12px;
  min-height: 74px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.task-title {
  min-width: 0;
}

.task-title strong {
  display: block;
  overflow: hidden;
  margin-bottom: 5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-title span,
.task-owner {
  color: var(--muted);
  font-size: 12px;
}

.progress-track {
  overflow: hidden;
  height: 8px;
  border-radius: 999px;
  background: #e7ebe4;
}

.progress-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.status-pill.running {
  background: rgba(47, 111, 189, 0.12);
  color: var(--blue);
}

.status-pill.waiting,
.status-pill.warning {
  background: rgba(184, 110, 0, 0.13);
  color: var(--amber);
}

.status-pill.done,
.status-pill.ready {
  background: rgba(25, 135, 84, 0.12);
  color: var(--green);
}

.status-pill.failed {
  background: rgba(180, 35, 24, 0.1);
  color: var(--red);
}

.waitpoint-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: #fffaf1;
}

.waitpoint-main {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}

.waitpoint-main h3 {
  font-size: 15px;
  line-height: 1.35;
}

.waitpoint-main p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.priority-dot {
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 5px rgba(184, 110, 0, 0.12);
  flex: 0 0 auto;
}

.surface-list {
  display: grid;
  gap: 9px;
  margin-top: 12px;
}

.surface-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
}

.surface-row:first-child {
  border-top: 0;
}

.surface-row strong {
  display: block;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.surface-row span {
  color: var(--muted);
  font-size: 12px;
}

.surface-icon {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
}

.surface-icon.warning {
  background: var(--amber);
}

.capability-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.capability-grid button {
  min-height: 42px;
  background: #fbfcfa;
}

.artifact-list {
  display: grid;
  gap: 10px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.artifact-list li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.artifact-list li:first-child {
  border-top: 0;
  padding-top: 0;
}

.artifact-list strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.artifact-list span {
  color: var(--muted);
  flex: 0 0 auto;
  font-size: 12px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100vw - 36px));
  padding: 12px 14px;
  border: 1px solid rgba(22, 124, 107, 0.28);
  border-radius: 8px;
  background: rgba(32, 36, 33, 0.96);
  color: white;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

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

  .context-strip {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: 14px;
  }

  .topbar,
  .section-heading,
  .waitpoint-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions,
  .button-row,
  .segmented {
    width: 100%;
  }

  .primary-button,
  .button-row button,
  .segmented button {
    flex: 1;
  }

  .context-strip {
    grid-template-columns: 1fr;
  }

  .task-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .capability-grid {
    grid-template-columns: 1fr;
  }
}
