:root { --thread-panel: 360px; }

.app-shell {
  grid-template-columns: var(--sidebar) minmax(0, 1fr) var(--thread-panel);
}

.workspace-content {
  width: 100%;
  max-width: 1500px;
  display: grid;
  gap: 30px;
  padding-inline: 30px;
}

.workspace-module {
  min-width: 0;
  scroll-margin-top: 112px;
  container-type: inline-size;
  transition: opacity .18s ease, transform .18s ease;
}

.workspace-module.dragging { opacity: .42; transform: scale(.992); }
.workspace-module > .section { padding-top: 18px; }

.workspace-module-toolbar {
  min-height: 34px;
  margin-bottom: 10px;
  padding: 0 3px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,.055);
  color: #626b66;
}

.workspace-module-toolbar > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 8px;
  font-weight: 750;
  letter-spacing: .11em;
  text-transform: uppercase;
  cursor: grab;
  user-select: none;
}

.workspace-module-toolbar > span:active { cursor: grabbing; }
.workspace-module-toolbar svg { width: 12px; height: 12px; }
.workspace-module-toolbar > div { display: flex; gap: 4px; }
.workspace-module-toolbar button {
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.workspace-module-toolbar button:hover:not(:disabled) {
  border-color: var(--line);
  background: rgba(255,255,255,.035);
  color: var(--accent);
}
.workspace-module-toolbar button:disabled { opacity: .2; cursor: default; }

.thread-dock {
  grid-column: 3;
  position: sticky;
  top: 0;
  z-index: 18;
  height: 100vh;
  min-width: 0;
  padding: 12px 12px 12px 16px;
  border-left: 1px solid var(--line);
  background: rgba(8,10,10,.9);
  backdrop-filter: blur(18px);
  scroll-margin-top: 20px;
}

.desktop .thread-dock { padding-top: 46px; }
.thread-dock .thread-panel {
  position: static;
  top: auto;
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: none;
}

.thread-dock-resizer {
  position: absolute;
  inset: 0 auto 0 -5px;
  width: 10px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: col-resize;
}
.thread-dock-resizer::after {
  content: "";
  position: absolute;
  inset: 44% 4px;
  width: 2px;
  min-height: 54px;
  border-radius: 99px;
  background: var(--line-strong);
  transition: background .18s ease, box-shadow .18s ease;
}
.thread-dock-resizer:hover::after,
.resizing-thread-dock .thread-dock-resizer::after {
  background: var(--accent);
  box-shadow: 0 0 10px rgba(166,244,106,.45);
}
.resizing-thread-dock { cursor: col-resize; user-select: none; }
.resizing-thread-dock * { cursor: col-resize !important; }

.toast-region { right: calc(var(--thread-panel) + 24px); }

.activity-project-group + .activity-project-group { border-top: 7px solid #090b0b; }
.activity-project-heading {
  width: 100%;
  min-height: 62px;
  padding: 11px 17px;
  display: grid;
  grid-template-columns: 34px 1fr auto 20px;
  gap: 10px;
  align-items: center;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(166,244,106,.055), rgba(255,255,255,.012));
  text-align: left;
  cursor: pointer;
}
.activity-project-heading:hover { background: rgba(166,244,106,.075); }
.activity-project-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent);
}
.activity-project-icon svg { width: 15px; height: 15px; }
.activity-project-heading > span:nth-child(2) { display: grid; gap: 3px; }
.activity-project-heading strong { font-size: 11px; }
.activity-project-heading small { color: var(--muted); font-size: 8px; }
.activity-project-heading em {
  padding: 5px 7px;
  border-radius: 99px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 7px;
  font-style: normal;
}
.activity-project-chevron { color: var(--muted); transition: transform .18s ease; }
.activity-project-group.collapsed .activity-project-chevron { transform: rotate(-90deg); }
.activity-project-group.collapsed .activity-project-heading { border-bottom: 0; }

@container (max-width: 820px) {
  .hero { grid-template-columns: 1fr; }
  .quota-card { min-height: 300px; }
  .run-summary { grid-template-columns: 9px minmax(100px, 1fr) 74px; }
  .run-task, .run-mode { display: none; }
  .terminal-toolbar { grid-template-columns: 1fr auto; }
  .terminal-policy { grid-column: 1 / -1; grid-row: 2; }
}

@media (min-width: 901px) and (max-width: 1250px) {
  .topbar { padding-inline: 22px; }
  .topbar h1 { font-size: 19px; }
  .account-pill { min-width: 185px; max-width: 220px; }
  .workspace-content { padding-inline: 22px; }
}

@media (max-width: 900px) {
  .app-shell { grid-template-columns: var(--sidebar) minmax(0, 1fr); }
  .thread-dock {
    grid-column: 2;
    position: relative;
    height: auto;
    padding: 0 30px 70px;
    border-left: 0;
    background: transparent;
    backdrop-filter: none;
  }
  .desktop .thread-dock { padding-top: 0; }
  .thread-dock .thread-panel { min-height: 580px; max-height: 760px; }
  .thread-dock-resizer { display: none; }
  .toast-region { right: 24px; }
}

@media (max-width: 760px) {
  .workspace-content { padding-inline: 14px; gap: 22px; }
  .thread-dock { padding: 0 14px 95px; }
  .activity-project-heading { grid-template-columns: 32px 1fr 18px; }
  .activity-project-heading em { display: none; }
}
