:root {
  --bg: #070b16;
  --bg-elevated: #10182a;
  --border: #263650;
  --text: #f2f6ff;
  --muted: #a8b6cd;
  --teal: #62e5ff;
  --teal-dim: #17354a;
  --amber: #fbbf24;
  --danger: #f87171;
  --success: #34d399;
  --radius: 10px;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: radial-gradient(1200px 600px at 10% -10%, #132038 0%, var(--bg) 55%);
  color: var(--text);
  line-height: 1.5;
}

.hidden {
  display: none !important;
}

.cockpit-shell .btn,
.cockpit-shell .tab,
.cockpit-shell select {
  min-height: 44px;
}

.cockpit-shell :focus-visible {
  outline: 2px solid #62e5ff;
  outline-offset: 3px;
}

.cockpit-shell #panel-tasks,
.cockpit-shell #panel-memory,
.cockpit-shell #panel-search {
  max-width: 1360px;
  margin: 0 auto;
}

.view {
  max-width: 1880px;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
  box-sizing: border-box;
  width: 100%;
}

.login-card {
  margin: 15vh auto 0;
  max-width: 420px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
  text-align: center;
}

.muted {
  color: var(--muted);
  font-size: 0.92rem;
}

.status {
  margin-top: 1rem;
  min-height: 1.5rem;
}

.top-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.25rem;
}

.brand h1 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: 0.18em;
}

.tagline {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.stat-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
}

.stat-card .label {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-card .value {
  font-size: 1.5rem;
  font-weight: 650;
  color: var(--teal);
}

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}

.dispatch-note {
  border-color: var(--teal-dim);
}

.dispatch-note strong {
  color: var(--amber);
}

.model-pins span {
  color: var(--teal);
  font-family: ui-monospace, monospace;
  font-size: 0.88rem;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  margin: 1rem 0;
}

.filter-label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--muted);
}

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

.tab {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  cursor: pointer;
  font: inherit;
}

.tab.active {
  color: var(--bg);
  background: var(--teal);
  border-color: var(--teal);
}

.banner {
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
  font-size: 0.92rem;
}

.banner.error {
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.35);
  color: #fecaca;
}

.banner.loading {
  background: rgba(45, 212, 191, 0.08);
  border: 1px solid var(--teal-dim);
  color: var(--teal);
}

.grid-two {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 900px) {
  .grid-two {
    grid-template-columns: 1fr 1fr;
  }
}

.stack-form label,
.stack-form fieldset {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
  font-size: 0.88rem;
}

input[type="text"],
input[type="url"],
input[type="search"],
select,
textarea {
  width: 100%;
  background: #0a101c;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 0.55rem 0.65rem;
  font: inherit;
}

textarea {
  resize: vertical;
  min-height: 4rem;
}

.checkbox-row {
  flex-direction: row !important;
  align-items: center;
  gap: 0.5rem !important;
}

.checkbox-row input:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.note-picker {
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 0.65rem;
}

.note-option {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  margin-bottom: 0.35rem;
  font-size: 0.85rem;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.form-status {
  font-size: 0.85rem;
  color: var(--muted);
}

.form-status.ok {
  color: var(--success);
}

.form-status.err {
  color: var(--danger);
}

.btn {
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #152238;
  color: var(--text);
  padding: 0.5rem 0.85rem;
  cursor: pointer;
  font: inherit;
}

.btn-primary {
  background: linear-gradient(180deg, #2dd4bf 0%, #14b8a6 100%);
  color: #042f2e;
  border-color: #0d9488;
  font-weight: 600;
}

.btn-ghost {
  background: transparent;
}

.btn-danger {
  border-color: rgba(248, 113, 113, 0.5);
  color: #fecaca;
}

.list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.list-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  background: #0c1525;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
}

.list-item header {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: baseline;
}

.list-item h3 {
  margin: 0;
  font-size: 0.98rem;
}

.badge {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
}

.badge.queued {
  color: var(--amber);
  border-color: rgba(251, 191, 36, 0.4);
}

.badge.running,
.badge.dispatching {
  color: var(--teal);
  border-color: rgba(45, 212, 191, 0.4);
}

.badge.finished,
.badge.reviewed {
  color: var(--success);
}

.badge.failed,
.badge.cancelled {
  color: var(--danger);
}

.trust {
  font-size: 0.75rem;
  color: var(--muted);
}

.empty {
  color: var(--muted);
  font-size: 0.9rem;
}

.detail {
  margin-top: 1rem;
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.detail-block {
  margin: 0.75rem 0;
}

.detail-block pre {
  white-space: pre-wrap;
  word-break: break-word;
  background: #0a101c;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem;
  font-size: 0.82rem;
  max-height: 280px;
  overflow: auto;
}

.search-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

@media (max-width: 480px) {
  .view {
    padding-left: 0.65rem;
    padding-right: 0.65rem;
  }

  .search-form {
    flex-direction: column;
  }

  .tabs {
    width: 100%;
  }

  .model-pins {
    word-break: break-word;
  }
}

.search-columns {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  min-width: 0;
}

.search-columns > div {
  min-width: 0;
  max-width: 100%;
}

@media (min-width: 768px) {
  .search-columns {
    grid-template-columns: 1fr 1fr;
  }
}

a.source-link {
  color: var(--teal);
  word-break: break-all;
}

a.source-link:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

/* AI cockpit UX shell */
/* AI COMMAND — cockpit shell override. All rules scoped to body.cockpit-shell. */

body.cockpit-shell {
  --ink: #080d16;
  --slate: #111b29;
  --slate-2: #162334;
  --slate-3: #1c2c40;
  --panel: #0e1724;
  --text: #eef4f8;
  --muted: #93a4b8;
  --ice: #72e4ee;
  --amber: #e8b86d;
  --violet: #8b7cf7;
  --ok: #7dcea0;
  --danger: #f07178;
  --line: rgba(114, 228, 238, 0.14);
  --line-strong: rgba(114, 228, 238, 0.32);
  --glow: rgba(114, 228, 238, 0.18);
  --shadow: 0 16px 40px rgba(4, 8, 14, 0.45);
  --radius: 14px;
  --radius-sm: 10px;
  --control: 44px;
  --ease: 180ms ease;
  --font: ui-sans-serif, system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Consolas, monospace;
  --max: 1180px;
  color: var(--text);
  background-color: var(--ink);
  background-image:
    radial-gradient(1200px 640px at 86% -10%, rgba(114, 228, 238, 0.08), transparent 58%),
    radial-gradient(900px 520px at -12% 108%, rgba(139, 124, 247, 0.08), transparent 62%),
    linear-gradient(180deg, #0a111c 0%, var(--ink) 42%, #070b12 100%);
  font-family: var(--font);
  font-size: 0.9375rem;
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
}

body.cockpit-shell *,
body.cockpit-shell *::before,
body.cockpit-shell *::after {
  box-sizing: border-box;
}

body.cockpit-shell::before,
body.cockpit-shell::after {
  content: "";
  position: fixed;
  width: min(52vw, 34rem);
  height: min(52vw, 34rem);
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  filter: blur(72px);
  opacity: 0.42;
  transform: translate3d(0, 0, 0);
}

body.cockpit-shell::before {
  top: -12vh;
  right: -8vw;
  background: radial-gradient(circle at 40% 40%, rgba(114, 228, 238, 0.28), transparent 68%);
  animation: cockpit-orb-a 26s ease-in-out infinite;
}

body.cockpit-shell::after {
  bottom: -16vh;
  left: -12vw;
  background: radial-gradient(circle at 55% 50%, rgba(139, 124, 247, 0.24), transparent 70%);
  animation: cockpit-orb-b 32s ease-in-out infinite;
}

@keyframes cockpit-orb-a {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(-4%, 6%, 0) scale(1.08); }
}

@keyframes cockpit-orb-b {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(6%, -5%, 0) scale(1.06); }
}

body.cockpit-shell .hidden,
body.cockpit-shell [hidden] {
  display: none !important;
}

body.cockpit-shell .view,
body.cockpit-shell #app-view,
body.cockpit-shell #login-view {
  position: relative;
  z-index: 1;
}

body.cockpit-shell #app-view.view {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

body.cockpit-shell h1,
body.cockpit-shell h2,
body.cockpit-shell h3 {
  color: var(--text);
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin: 0;
}

body.cockpit-shell p {
  margin: 0;
}

body.cockpit-shell .muted,
body.cockpit-shell p.muted,
body.cockpit-shell .tagline {
  color: var(--muted);
}

body.cockpit-shell a {
  color: var(--ice);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

body.cockpit-shell a:hover {
  color: #b7f4f8;
}

body.cockpit-shell :focus {
  outline: none;
}

body.cockpit-shell :focus-visible {
  outline: 2px solid var(--ice);
  outline-offset: 2px;
}

body.cockpit-shell .top-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  grid-template-areas: "brand tabs filter logout";
  align-items: center;
  gap: 0.65rem 1rem;
  min-height: 64px;
  padding: 0.55rem 1.25rem;
  padding-left: max(1.25rem, env(safe-area-inset-left));
  padding-right: max(1.25rem, env(safe-area-inset-right));
  background: rgba(8, 13, 22, 0.88);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03), 0 12px 32px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(18px);
}

body.cockpit-shell .toolbar {
  display: contents;
}

body.cockpit-shell .brand {
  grid-area: brand;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.1rem;
  padding-left: 2.35rem;
  position: relative;
  min-width: 0;
}

body.cockpit-shell .brand::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 1.7rem;
  height: 1.7rem;
  transform: translateY(-50%);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 42%),
    linear-gradient(135deg, var(--ice) 0%, #5b6ee8 58%, var(--violet) 100%);
  clip-path: polygon(50% 0%, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%);
  box-shadow: 0 0 16px var(--glow);
}

body.cockpit-shell .brand::after {
  content: "";
  position: absolute;
  left: 0.62rem;
  top: 50%;
  width: 0.46rem;
  height: 0.46rem;
  transform: translateY(-50%) rotate(45deg);
  background: var(--ink);
  box-shadow: 0 0 0 1px rgba(238, 244, 248, 0.22);
}

body.cockpit-shell .brand h1 {
  font-size: 0.98rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

body.cockpit-shell .brand .tagline,
body.cockpit-shell .brand p {
  font-size: 0.78rem;
  line-height: 1.3;
  max-width: 16rem;
}

body.cockpit-shell .tabs {
  grid-area: tabs;
  display: inline-flex;
  flex-wrap: nowrap;
  justify-self: center;
  align-items: center;
  gap: 0.2rem;
  padding: 0.2rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(17, 27, 41, 0.7);
}

body.cockpit-shell .tab {
  appearance: none;
  min-height: var(--control);
  min-width: var(--control);
  padding: 0 0.95rem;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: color var(--ease), background-color var(--ease), box-shadow var(--ease);
}

body.cockpit-shell .tab:hover {
  color: var(--text);
  background: rgba(114, 228, 238, 0.08);
}

body.cockpit-shell .tab.active,
body.cockpit-shell .tab[aria-selected="true"] {
  color: #071018;
  background: linear-gradient(180deg, #9af1f7, var(--ice));
  box-shadow: 0 6px 16px rgba(114, 228, 238, 0.2);
}

body.cockpit-shell .filter-label {
  grid-area: filter;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

body.cockpit-shell .filter-label label {
  color: var(--muted);
}

body.cockpit-shell .filter-label select,
body.cockpit-shell #project-filter {
  min-width: 9.5rem;
  width: 14rem;
  max-width: 14rem;
}

body.cockpit-shell .header-actions {
  grid-area: logout;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

body.cockpit-shell .panel,
body.cockpit-shell .card,
body.cockpit-shell .login-card,
body.cockpit-shell #task-detail.detail {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 38%),
    var(--slate);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), var(--shadow);
}

body.cockpit-shell .panel,
body.cockpit-shell .card {
  padding: 1.1rem 1.15rem 1.2rem;
}

body.cockpit-shell .card h2,
body.cockpit-shell .panel h2,
body.cockpit-shell .section-heading h2 {
  font-size: 1.2rem;
}

body.cockpit-shell [id^="panel-"],
body.cockpit-shell [role="tabpanel"] {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.15rem 1.25rem 2rem;
  padding-left: max(1.25rem, env(safe-area-inset-left));
  padding-right: max(1.25rem, env(safe-area-inset-right));
}

body.cockpit-shell .section-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem 1rem;
  margin-bottom: 0.95rem;
}

body.cockpit-shell .section-heading p {
  flex: 1 1 12rem;
}

body.cockpit-shell .grid-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

body.cockpit-shell .search-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  align-items: start;
}

body.cockpit-shell .ai-cockpit-intake-slot {
  margin: 0 0 1.15rem;
}

body.cockpit-shell .ai-cockpit-intake-slot #mission-compose,
body.cockpit-shell #mission-compose.card {
  padding: 1.2rem 1.2rem 1.15rem;
  border-color: var(--line-strong);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 0 0 1px rgba(114, 228, 238, 0.08),
    0 18px 44px rgba(4, 10, 18, 0.42);
}

body.cockpit-shell #mission-compose h2 {
  font-size: 1.28rem;
  margin-bottom: 0.35rem;
}

body.cockpit-shell #mission-compose > p,
body.cockpit-shell #mission-compose .muted {
  margin-bottom: 0.95rem;
  max-width: 42rem;
}

body.cockpit-shell .stack-form,
body.cockpit-shell form.stack-form,
body.cockpit-shell #form-task {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

body.cockpit-shell label {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-bottom: 0.35rem;
}

body.cockpit-shell input,
body.cockpit-shell select,
body.cockpit-shell textarea,
body.cockpit-shell button,
body.cockpit-shell .btn,
body.cockpit-shell summary {
  font-family: inherit;
  font-size: 0.9375rem;
}

body.cockpit-shell input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]),
body.cockpit-shell select,
body.cockpit-shell textarea {
  width: 100%;
  min-height: var(--control);
  color: var(--text);
  background: #0c141f;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
  transition: border-color var(--ease), box-shadow var(--ease), background-color var(--ease);
}

body.cockpit-shell textarea {
  min-height: 6.5rem;
  resize: vertical;
  line-height: 1.55;
}

body.cockpit-shell #task-prompt,
body.cockpit-shell textarea#task-prompt {
  min-height: 8rem;
  font-size: 1.02rem;
  line-height: 1.55;
  border-color: rgba(114, 228, 238, 0.26);
  background:
    linear-gradient(180deg, rgba(114, 228, 238, 0.04), transparent 42%),
    #0c141f;
}

body.cockpit-shell input:hover,
body.cockpit-shell select:hover,
body.cockpit-shell textarea:hover {
  border-color: rgba(114, 228, 238, 0.28);
}

body.cockpit-shell input:focus-visible,
body.cockpit-shell select:focus-visible,
body.cockpit-shell textarea:focus-visible {
  border-color: var(--ice);
  box-shadow: 0 0 0 3px rgba(114, 228, 238, 0.16);
}

body.cockpit-shell input:disabled,
body.cockpit-shell select:disabled,
body.cockpit-shell textarea:disabled,
body.cockpit-shell button:disabled,
body.cockpit-shell .btn:disabled,
body.cockpit-shell [aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  filter: grayscale(0.15);
}

body.cockpit-shell input:read-only:not([type="checkbox"]):not([type="radio"]):not(select):not(button),
body.cockpit-shell textarea:read-only {
  background: #101826;
  color: #d5e0ea;
}

body.cockpit-shell option {
  background: var(--slate);
  color: var(--text);
}

body.cockpit-shell .mission-routing {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem 1rem;
}

body.cockpit-shell details.mission-advanced {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  padding: 0;
}

body.cockpit-shell details.mission-advanced[open] {
  border-color: var(--line);
  background: rgba(12, 20, 31, 0.55);
  padding: 0 0.85rem 0.85rem;
}

body.cockpit-shell details.mission-advanced > summary {
  list-style: none;
  display: flex;
  align-items: center;
  min-height: var(--control);
  cursor: pointer;
  color: var(--ice);
  font-weight: 600;
}

body.cockpit-shell details.mission-advanced > summary::-webkit-details-marker {
  display: none;
}

body.cockpit-shell details.mission-advanced > summary::before {
  content: "";
  width: 0.42rem;
  height: 0.42rem;
  margin-right: 0.55rem;
  border-right: 2px solid var(--ice);
  border-bottom: 2px solid var(--ice);
  transform: rotate(-45deg);
  transition: transform var(--ease);
}

body.cockpit-shell details.mission-advanced[open] > summary::before {
  transform: rotate(45deg);
}

body.cockpit-shell fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin: 0.7rem 0 0;
  padding: 0.7rem 0.8rem 0.85rem;
  min-width: 0;
}

body.cockpit-shell legend {
  padding: 0 0.35rem;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 650;
}

body.cockpit-shell fieldset.note-picker {
  background: rgba(8, 13, 22, 0.35);
}

body.cockpit-shell .note-option {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-height: var(--control);
  padding: 0 0.15rem;
  color: var(--text);
}

body.cockpit-shell .note-option label {
  display: inline;
  margin: 0;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
}

body.cockpit-shell .note-option input[type="checkbox"],
body.cockpit-shell input[type="checkbox"],
body.cockpit-shell input[type="radio"] {
  width: 1.15rem;
  height: 1.15rem;
  min-height: 1.15rem;
  accent-color: var(--ice);
  flex: 0 0 auto;
}

body.cockpit-shell .form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.65rem;
}

body.cockpit-shell .btn,
body.cockpit-shell button.btn,
body.cockpit-shell button:not(.tab):not([class^="ai-cockpit-"]) {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--control);
  min-width: var(--control);
  padding: 0 1.05rem;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--slate-2);
  color: var(--text);
  font-weight: 650;
  cursor: pointer;
  transition: background-color var(--ease), border-color var(--ease), transform var(--ease), box-shadow var(--ease), color var(--ease);
}

body.cockpit-shell .btn:hover,
body.cockpit-shell button:not(.tab):not([class^="ai-cockpit-"]):hover {
  border-color: var(--line-strong);
  background: var(--slate-3);
}

body.cockpit-shell .btn:active,
body.cockpit-shell button:not(.tab):not([class^="ai-cockpit-"]):active {
  transform: translateY(1px);
}

body.cockpit-shell .btn-primary,
body.cockpit-shell button.btn-primary,
body.cockpit-shell #form-task button[type="submit"],
body.cockpit-shell #btn-new-mission {
  border-color: transparent;
  color: #071018;
  background: linear-gradient(180deg, #9af1f7 0%, var(--ice) 100%);
  box-shadow: 0 8px 20px rgba(114, 228, 238, 0.22);
}

body.cockpit-shell .btn-primary:hover,
body.cockpit-shell #form-task button[type="submit"]:hover,
body.cockpit-shell #btn-new-mission:hover {
  background: linear-gradient(180deg, #c5f7fb 0%, #67dbe6 100%);
}

body.cockpit-shell .btn-ghost,
body.cockpit-shell #btn-logout {
  background: transparent;
  color: var(--muted);
  border-color: var(--line);
}

body.cockpit-shell .btn-ghost:hover,
body.cockpit-shell #btn-logout:hover {
  color: var(--text);
  background: rgba(114, 228, 238, 0.08);
}

body.cockpit-shell .form-status,
body.cockpit-shell #task-form-status,
body.cockpit-shell #mission-count {
  color: var(--muted);
  font-size: 0.86rem;
  min-height: 1.25rem;
}

body.cockpit-shell .form-status.ok {
  color: var(--ok);
}

body.cockpit-shell .form-status.err {
  color: var(--danger);
}

body.cockpit-shell .mission-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(10rem, 13.5rem);
  gap: 0.7rem;
  margin: 0 0 0.65rem;
}

body.cockpit-shell #mission-search,
body.cockpit-shell #mission-status {
  width: 100%;
}

body.cockpit-shell .list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

body.cockpit-shell .list-item,
body.cockpit-shell article.list-item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  transition: border-color var(--ease), transform var(--ease), box-shadow var(--ease);
}

body.cockpit-shell .list-item:hover {
  border-color: var(--line-strong);
  box-shadow: 0 10px 24px rgba(4, 8, 14, 0.28);
}

body.cockpit-shell .list-item > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.7rem 1rem;
}

body.cockpit-shell .list-item h3 {
  font-size: 1rem;
  font-weight: 650;
}

body.cockpit-shell .list-item > p,
body.cockpit-shell .list-item .muted {
  margin-top: 0.35rem;
}

body.cockpit-shell .list-item .form-actions {
  margin-top: 0.75rem;
}

body.cockpit-shell .badge,
body.cockpit-shell span.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 1.7rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(147, 164, 184, 0.12);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: lowercase;
  white-space: nowrap;
}

body.cockpit-shell .badge.queued,
body.cockpit-shell [data-status="queued"] .badge {
  color: #c5d2e0;
  background: rgba(147, 164, 184, 0.14);
}

body.cockpit-shell .badge.dispatching,
body.cockpit-shell [data-status="dispatching"] .badge {
  color: #c8bfff;
  background: rgba(139, 124, 247, 0.16);
  border-color: rgba(139, 124, 247, 0.32);
}

body.cockpit-shell .badge.running,
body.cockpit-shell [data-status="running"] .badge {
  color: #082026;
  background: var(--ice);
  border-color: transparent;
}

body.cockpit-shell .badge.finished,
body.cockpit-shell [data-status="finished"] .badge {
  color: #24180a;
  background: var(--amber);
  border-color: transparent;
}

body.cockpit-shell .badge.reviewed,
body.cockpit-shell [data-status="reviewed"] .badge {
  color: #ece8ff;
  background: rgba(139, 124, 247, 0.22);
  border-color: rgba(139, 124, 247, 0.38);
}

body.cockpit-shell .badge.failed,
body.cockpit-shell [data-status="failed"] .badge {
  color: #ffd6d8;
  background: rgba(240, 113, 120, 0.18);
  border-color: rgba(240, 113, 120, 0.38);
}

body.cockpit-shell .badge.uncertain,
body.cockpit-shell [data-status="uncertain"] .badge {
  color: #24180a;
  background: #c9a36a;
  border-color: transparent;
}

body.cockpit-shell .badge.cancelled,
body.cockpit-shell [data-status="cancelled"] .badge {
  color: #aebbcb;
  background: rgba(17, 27, 41, 0.9);
}

body.cockpit-shell .list-item[data-agent-id] .badge.running,
body.cockpit-shell .list-item:has([data-agent-id]) .badge.running {
  animation: cockpit-task-pulse 1.8s ease-in-out infinite;
}

@keyframes cockpit-task-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(114, 228, 238, 0.45); }
  50% { box-shadow: 0 0 0 6px rgba(114, 228, 238, 0); }
}

body.cockpit-shell #task-detail,
body.cockpit-shell .detail {
  margin-top: 0.9rem;
  padding: 1.1rem 1.15rem 1.2rem;
}

body.cockpit-shell .detail-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.7rem 1rem;
  margin-bottom: 0.95rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--line);
}

body.cockpit-shell .detail-block {
  margin: 0 0 0.95rem;
  min-width: 0;
}

body.cockpit-shell .detail-block h3 {
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

body.cockpit-shell .detail-block p,
body.cockpit-shell .detail-block a {
  overflow-wrap: anywhere;
}

body.cockpit-shell .trust {
  color: var(--muted);
  font-size: 0.86rem;
  margin: 0.35rem 0 0.9rem;
}

body.cockpit-shell code,
body.cockpit-shell kbd,
body.cockpit-shell [data-model],
body.cockpit-shell .model,
body.cockpit-shell .id {
  font-family: var(--mono);
  font-size: 0.86rem;
}

body.cockpit-shell pre {
  max-width: 100%;
  max-height: 22rem;
  overflow: auto;
  margin: 0;
  padding: 0.85rem 0.95rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: #0c141f;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

body.cockpit-shell .empty {
  padding: 1.4rem 1rem;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: rgba(14, 23, 36, 0.55);
}

body.cockpit-shell .banner {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-height: var(--control);
  margin: 0 0 0.85rem;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}

body.cockpit-shell .banner.error {
  color: #ffd6d8;
  background: rgba(240, 113, 120, 0.12);
  border-color: rgba(240, 113, 120, 0.36);
}

body.cockpit-shell .banner.loading {
  color: var(--ice);
  background: rgba(114, 228, 238, 0.08);
}

body.cockpit-shell .search-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: end;
  margin-bottom: 0.95rem;
}

body.cockpit-shell .search-form input,
body.cockpit-shell .search-form select {
  flex: 1 1 14rem;
}

body.cockpit-shell .search-form .btn,
body.cockpit-shell .search-form button {
  flex: 0 0 auto;
}

body.cockpit-shell #login-view.view {
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 1.25rem;
}

body.cockpit-shell .login-card {
  width: min(100%, 26rem);
  padding: 1.4rem 1.3rem 1.35rem;
}

body.cockpit-shell .login-card h1,
body.cockpit-shell .login-card h2 {
  margin-bottom: 0.35rem;
}

body.cockpit-shell .login-card p {
  margin-bottom: 1rem;
}

@media (max-width: 1100px) {
  body.cockpit-shell .top-bar {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "brand logout"
      "tabs tabs"
      "filter filter";
    min-height: 0;
    padding-top: 0.7rem;
    padding-bottom: 0.75rem;
  }

  body.cockpit-shell .tabs {
    justify-self: stretch;
    width: 100%;
    display: flex;
    flex-wrap: wrap;
  }

  body.cockpit-shell .tab {
    flex: 1 1 0;
  }

  body.cockpit-shell .filter-label {
    width: 100%;
  }

  body.cockpit-shell .filter-label select,
  body.cockpit-shell #project-filter {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    max-width: none;
  }

  body.cockpit-shell .grid-two,
  body.cockpit-shell .search-columns,
  body.cockpit-shell .mission-routing,
  body.cockpit-shell .mission-tools {
    grid-template-columns: 1fr;
  }

  body.cockpit-shell .brand .tagline,
  body.cockpit-shell .brand p {
    max-width: none;
  }
}

@media (max-width: 640px) {
  body.cockpit-shell .brand h1 {
    font-size: 0.9rem;
    letter-spacing: 0.12em;
  }

  body.cockpit-shell [id^="panel-"],
  body.cockpit-shell [role="tabpanel"] {
    padding-top: 0.95rem;
  }

  body.cockpit-shell .list-item > header {
    flex-direction: column;
    align-items: flex-start;
  }

  body.cockpit-shell .form-actions .btn,
  body.cockpit-shell .list-item .btn {
    flex: 1 1 calc(50% - 0.4rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  body.cockpit-shell,
  body.cockpit-shell *,
  body.cockpit-shell *::before,
  body.cockpit-shell *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  body.cockpit-shell::before,
  body.cockpit-shell::after {
    opacity: 0.22;
    filter: blur(64px);
  }
}

body.cockpit-shell #mission-inputs { border:0; padding:0; margin:0; min-width:0; display:block; }
body.cockpit-shell #mission-inputs:disabled { opacity:.78; }
body.cockpit-shell #task-prompt { margin-bottom:14px; }
body.cockpit-shell { --max:1600px; }
body.cockpit-shell #app-view.view { padding:0 18px 24px; }
body.cockpit-shell::before, body.cockpit-shell::after { animation:none; }
body.cockpit-shell .top-bar { margin-bottom:0; }
@media (max-width:480px) {
  body.cockpit-shell .search-form input,
  body.cockpit-shell .search-form select { flex:0 0 auto; width:100%; }
}
@media (max-width:640px) {
  body.cockpit-shell #app-view.view { padding:0 6px 20px; }
  body.cockpit-shell .top-bar { position:relative; padding-inline:10px; }
  body.cockpit-shell [id^="panel-"] { padding-inline:8px; }
}

/* Keep every section name inside its target on narrow screens. */
@media (max-width: 360px) {
  body.cockpit-shell .tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  body.cockpit-shell .tab {
    min-width: 0;
    padding-inline: 3px;
    font-size: 13px;
    letter-spacing: 0;
  }
}

body.cockpit-shell #direct-task-compose > summary {
  min-height: var(--control);
  padding-block: 0.6rem;
  cursor: pointer;
}

/* The overview owns its composition; avoid a second decorative frame. */
body.cockpit-shell #panel-overview {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
}

body.cockpit-shell #panel-overview .ai-cockpit-brand {
  display: none;
}
