.dialog,
.panel-card {
  border: 1px solid var(--border);
  background: var(--panel-elevated);
  border-radius: 4px;
  box-shadow: var(--shadow);
}

.workspace-meta {
  padding: 5px 10px;
  padding-right: 140px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  background: rgba(var(--tint), 0.015);
  font-size: 13px;
  min-height: 0;
  -webkit-app-region: drag;
}

.workspace-meta button,
.workspace-meta a,
.workspace-meta__path--copyable {
  -webkit-app-region: no-drag;
}

.workspace-empty-copy {
  -webkit-app-region: drag;
}

.workspace-remote-alert {
  margin: 0 0 8px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 111, 141, 0.35);
  border-radius: 4px;
  background: rgba(255, 111, 141, 0.1);
  color: #ffd7df;
  font-size: 13px;
  line-height: 1.45;
}

.workspace-remote-alert strong {
  color: #fff0f4;
}

.workspace-meta__main {
  min-width: 0;
  flex: 1;
}

.workspace-meta__path {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.workspace-meta__path--copyable {
  cursor: pointer;
}

.workspace-meta__path--copyable:hover {
  color: var(--fg);
}

.workspace-meta__notes {
  display: none;
}

.workspace-meta__stats {
  display: flex;
  gap: 6px;
  justify-content: flex-start;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.workspace-chip {
  border-radius: 3px;
  border: 1px solid color-mix(in srgb, var(--accent), transparent 72%);
  background: rgba(var(--tint), 0.04);
  padding: 2px 7px;
  color: var(--text);
  white-space: nowrap;
  font-size: 11px;
}

.workspace-chip strong {
  margin-right: 3px;
}

.workspace-chip--btn {
  cursor: pointer;
  font-family: inherit;
  transition:
    border-color 0.15s,
    background 0.15s;
}

.workspace-chip--btn:hover {
  border-color: color-mix(in srgb, var(--accent), transparent 40%);
  background: rgba(var(--tint), 0.08);
}

.workspace-chip--active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent), transparent 82%);
  color: var(--accent);
}

.workspace-chip--alert {
  border-color: rgba(255, 111, 141, 0.26);
  background: rgba(255, 111, 141, 0.1);
  color: #ffd7df;
}

.workspace-chip--alert-fresh {
  animation: workspace-alert-pulse 0.9s ease-out 4;
}

@keyframes project-attention-pulse {
  0% {
    transform: translateX(0);
    box-shadow:
      inset 2px 0 0 rgba(255, 111, 141, 0.55),
      0 0 0 rgba(255, 111, 141, 0);
  }
  22% {
    transform: translateX(-1px);
    box-shadow:
      inset 2px 0 0 rgba(255, 111, 141, 0.68),
      0 0 0 6px rgba(255, 111, 141, 0.08);
  }
  44% {
    transform: translateX(2px);
    box-shadow:
      inset 2px 0 0 rgba(255, 111, 141, 0.72),
      0 0 0 10px rgba(255, 111, 141, 0);
  }
  100% {
    transform: translateX(0);
    box-shadow:
      inset 2px 0 0 rgba(255, 111, 141, 0.55),
      0 0 0 rgba(255, 111, 141, 0);
  }
}

@keyframes project-bell-ring {
  0%,
  100% {
    transform: rotate(0deg) scale(1);
  }
  18% {
    transform: rotate(14deg) scale(1.02);
  }
  36% {
    transform: rotate(-11deg) scale(1.06);
  }
  54% {
    transform: rotate(8deg) scale(1.03);
  }
  72% {
    transform: rotate(-5deg) scale(1);
  }
}

@keyframes workspace-alert-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(255, 111, 141, 0);
  }
  35% {
    box-shadow: 0 0 0 5px rgba(255, 111, 141, 0.12);
  }
}

.terminal-toolbar {
  display: flex;
  align-items: stretch;
  gap: 0;
  border-bottom: 1px solid var(--border);
  background: rgba(var(--tint), 0.01);
  min-height: 0;
}

.terminal-toolbar__actions,
.workspace-pane__actions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
}

.terminal-toolbar__actions {
  padding: 0 6px;
  flex-shrink: 0;
}

.tab-actions__separator {
  width: 1px;
  height: 18px;
  background: var(--border);
  margin: 0 2px;
  flex-shrink: 0;
}

.tab-actions__icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  flex-shrink: 0;
}

.tab-actions__icon:hover {
  background: rgba(var(--tint), 0.1);
  color: var(--text);
}

.tab-actions__icon--danger:hover {
  background: rgba(255, 111, 141, 0.14);
  color: var(--danger);
}

.tab-strip {
  display: flex;
  gap: 0;
  overflow: auto hidden;
  min-width: 0;
  flex: 1;
}

.tab {
  border: none;
  border-bottom: 3px solid transparent;
  border-right: 1px solid rgba(var(--tint), 0.06);
  background: transparent;
  color: var(--muted);
  padding: 6px 8px 5px 10px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  grid-template-rows: auto auto;
  gap: 0 2px;
  align-items: center;
  text-align: left;
  cursor: pointer;
  font-size: 13px;
  transition:
    color 0.12s,
    border-color 0.12s,
    background 0.12s;
  white-space: nowrap;
  position: relative;
  flex: 1 0 0;
  min-width: 80px;
  max-width: 200px;
}

.tab > span:first-child {
  grid-column: 1;
  grid-row: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.tab > small {
  grid-column: 1;
  grid-row: 2;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.tab > small:empty::before {
  /* Preserve vertical space when the status chip is hidden so tab height
     does not jitter on command start/finish transitions. */
  content: "\00a0";
}

.tab:hover {
  color: var(--text);
  background: rgba(var(--tint), 0.025);
}

.tab--active {
  color: var(--text);
  border-bottom-color: var(--accent);
  background: transparent;
  box-shadow: none;
}

.tab--active:hover {
  background: transparent;
}

.tab--attention .tab__attention {
  animation: project-bell-ring 0.9s ease-out 5;
  transform-origin: 68% 12%;
}

.tab--running small {
  color: var(--success-fg);
}

.tab--error small {
  color: var(--danger);
}

.tab small {
  font-size: 11px;
}

.tab__menu {
  grid-row: 1;
  grid-column: 2;
  align-self: start;
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  border-radius: 3px;
  font-size: 12px;
  line-height: 1;
  color: var(--muted);
  opacity: 0.5;
  transition:
    opacity 0.12s,
    background 0.12s,
    color 0.12s;
}

.tab:hover .tab__menu,
.tab--active .tab__menu {
  opacity: 1;
}

.tab__menu:hover {
  background: rgba(var(--tint), 0.1);
  color: var(--text);
}

.tab__attention {
  grid-row: 1;
  grid-column: 3;
  align-self: start;
  width: 16px;
  height: 18px;
  display: grid;
  place-items: center;
  font-size: 11px;
  line-height: 1;
  color: #ffd7df;
  opacity: 0.95;
}

.tab--attention-fresh .tab__attention {
  animation: project-bell-ring 0.5s ease-out 6;
  transform-origin: 68% 12%;
}

.tab__task-badge {
  background: rgba(var(--tint), 0.12);
  color: var(--text-secondary, #aaa);
  font-size: 9px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.tab--dragging {
  opacity: 0.4;
}

.tab--drag-before::before,
.tab--drag-after::after {
  content: "";
  position: absolute;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: var(--accent);
  border-radius: 1px;
}

.tab--drag-before::before {
  left: -2px;
}

.tab--drag-after::after {
  right: -2px;
}

.terminal-stage {
  min-height: 0;
  height: 100%;
  border-radius: 0;
  overflow: hidden;
  background: var(--bg);
  border: none;
  position: relative;
  display: grid;
  gap: 3px;
  padding: 3px;
  align-content: stretch;
}

.terminal-stage--solo {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
}

.terminal-stage--cols {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr;
}

.terminal-stage--rows {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr 1fr;
}

.terminal-stage--top-split {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  grid-template-areas: "a a" "b c";
}

.terminal-stage--left-split {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  grid-template-areas: "a b" "a c";
}

.terminal-stage--grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: 1fr 1fr;
}

.workspace-pane {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border: 1px solid var(--border);
  border-radius: 3px;
  overflow: hidden;
  background: color-mix(in srgb, var(--panel), var(--bg) 10%);
  /* Container query scope for responsive pane header: below the threshold
     the swap arrows collapse into a hamburger button. */
  container-type: inline-size;
}

.workspace-pane--plain {
  grid-template-rows: minmax(0, 1fr);
}

.workspace-pane--active {
  border-color: rgba(255, 164, 36, 0.45);
}

/* Active-pane indicator is useful for terminal panes (signals which pane
   takes keyboard input) but adds visual noise on non-interactive content
   panes — Azure/GitHub inboxes, Git, Docker, file manager, dashboards.
   Drop the orange border on those. */
.workspace-pane--active:has(.workspace-pane__body--git),
.workspace-pane--active:has(.workspace-pane__body--browser),
.workspace-pane--active:has(.workspace-pane__body--files),
.workspace-pane--active:has(.workspace-pane__body--task-dashboard),
.workspace-pane--active:has(.workspace-pane__body--headless-judge) {
  border-color: var(--border);
}

.workspace-pane__header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  padding: 4px 8px;
  border-bottom: 1px solid var(--border);
  background: rgba(var(--tint), 0.02);
  font-size: 13px;
}

.workspace-pane__meta {
  min-width: 0;
}

.workspace-pane__header strong,
.workspace-pane__header small {
  display: block;
}

.workspace-pane__header small {
  font-size: 11px;
}

.workspace-pane__actions {
  flex-wrap: nowrap;
  flex-shrink: 0;
}

.workspace-pane__icon-btn {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(var(--tint), 0.08);
  border-radius: 4px;
  background: rgba(var(--tint), 0.04);
  color: var(--text);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  transition:
    background 0.12s,
    border-color 0.12s,
    color 0.12s;
}

.workspace-pane__icon-btn:hover {
  background: rgba(var(--tint), 0.12);
  border-color: rgba(var(--tint), 0.18);
}

.workspace-pane__icon-btn--danger {
  color: var(--danger);
  border-color: rgba(255, 111, 141, 0.18);
}

.workspace-pane__icon-btn--danger:hover {
  background: rgba(255, 111, 141, 0.12);
  border-color: rgba(255, 111, 141, 0.28);
}

.workspace-pane__icon-btn--swap {
  color: var(--muted);
  font-size: 14px;
}

.workspace-pane__icon-btn--swap:hover {
  color: var(--text);
}

.workspace-pane__action-divider {
  color: var(--muted);
  opacity: 0.4;
  font-weight: 400;
  padding: 0 2px;
  align-self: center;
  user-select: none;
}

/* Responsive collapse:
   - Above 420 px: inline base icons + | + swap arrows, hamburger hidden.
   - 320–420 px:   base icons stay, swap arrows + divider hide, hamburger
                   visible so the Move-to list is still reachable.
   - Below 320 px: every inline icon hides, only the hamburger remains.
                   The context menu it opens contains every action
                   (focus/edit/save/clear/restart/close + Move to). */
.workspace-pane__icon-btn--menu {
  display: none;
}

@container (max-width: 420px) {
  .workspace-pane__icon-btn--swap,
  .workspace-pane__action-divider {
    display: none;
  }

  .workspace-pane__icon-btn.workspace-pane__icon-btn--menu {
    display: grid;
  }
}

@container (max-width: 320px) {
  .workspace-pane__icon-btn {
    display: none;
  }

  .workspace-pane__icon-btn.workspace-pane__icon-btn--menu {
    display: grid;
  }
}

.workspace-pane__body {
  min-height: 0;
  position: relative;
  overflow: hidden;
}

.workspace-pane__body--git {
  overflow: auto;
}

.workspace-pane__body--browser {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0;
}

.browser-url-bar {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 4px 6px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.browser-url-bar__btn {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: rgba(var(--tint), 0.04);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}

.browser-url-bar__btn:hover {
  background: rgba(var(--tint), 0.1);
}

.browser-url-bar__form {
  flex: 1;
  min-width: 0;
  display: flex;
}

.browser-url-bar__input {
  flex: 1;
  min-width: 0;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: rgba(var(--tint), 0.06);
  color: var(--text);
  font: inherit;
  font-size: 12px;
}

.browser-url-bar__input:focus {
  outline: 1px solid var(--accent);
  border-color: var(--accent);
}

.terminal-host {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 4px 4px 2px;
  overflow: hidden;
  background: #071019;
}

.terminal-host .xterm {
  width: 100%;
  height: 100%;
}

.terminal-host .xterm-viewport {
  overscroll-behavior: contain;
}

.terminal-empty {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  gap: 4px;
  color: var(--muted);
  text-align: center;
}

.welcome-screen {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
}

.welcome-screen__card {
  max-width: 460px;
  padding: 32px;
  text-align: center;
}

.welcome-screen__title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.welcome-screen__title em {
  font-style: normal;
  color: var(--accent);
}

.welcome-screen__subtitle {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 24px;
}

.welcome-screen__steps {
  display: grid;
  gap: 12px;
  text-align: left;
}

.welcome-screen__step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
}

.welcome-screen__step strong {
  display: block;
  font-size: 13px;
  color: var(--text);
}

.welcome-screen__step small {
  color: var(--muted);
  font-size: 12px;
}

.welcome-screen__step-num {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent), transparent 80%);
  color: var(--accent);
  font-weight: 800;
  font-size: 12px;
}

.welcome-screen__link {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent);
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
}

.welcome-screen__link:hover {
  color: var(--text);
}

.welcome-screen__actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 16px;
}

.welcome-screen__actions .button {
  padding: 10px 20px;
  font-size: 14px;
}
