:root {
  --font-body: "Manrope", "Segoe UI", sans-serif;
  --font-display: "Space Grotesk", "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", "Menlo", "Consolas", monospace;
  --ink: #16263a;
  --ink-soft: #5f738d;
  --surface: #ffffff;
  --surface-soft: #f4f8fc;
  --surface-muted: #eef3f8;
  --border: #d8e3ef;
  --brand: #0d6f7a;
  --brand-strong: #05515a;
  --accent: #ea8d3f;
  --success: #1e7a58;
  --warning: #ba7426;
  --danger: #b13a3a;
  --info: #2a6faa;
  --shadow-sm: 0 6px 16px rgba(16, 36, 58, 0.08);
  --shadow-lg: 0 20px 45px rgba(16, 36, 58, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(1100px 420px at -8% -12%, rgba(13, 111, 122, 0.16), transparent 58%),
    radial-gradient(900px 380px at 110% -10%, rgba(234, 141, 63, 0.18), transparent 60%),
    linear-gradient(180deg, #f7fafe 0%, #edf3fa 100%);
  min-height: 100vh;
}

a {
  color: var(--brand);
  text-decoration: none;
}

a:hover {
  color: var(--brand-strong);
}

h1,
h2,
h3,
h4,
h5,
h6,
.navbar-brand,
.page-title,
.card-title {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}

.app-shell {
  width: 100%;
  max-width: none;
  padding-left: clamp(0.85rem, 1.7vw, 1.6rem);
  padding-right: clamp(0.85rem, 1.7vw, 1.6rem);
}

.app-navbar {
  backdrop-filter: blur(10px);
  background: rgba(9, 26, 45, 0.86);
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow: 0 8px 24px rgba(7, 20, 34, 0.32);
  padding-top: 0.65rem;
  padding-bottom: 0.65rem;
}

.brand-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-mark {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 0.7rem;
  background: linear-gradient(135deg, #0b7a86, #18b3a8);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 800;
  color: #f3feff;
  box-shadow: 0 8px 20px rgba(16, 190, 177, 0.3);
}

.brand-meta {
  display: inline-flex;
  flex-direction: column;
  gap: 0.1rem;
  color: #f4f9ff;
}

.brand-meta strong {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
}

.brand-meta small {
  font-size: 0.72rem;
  color: #a6bfd8;
  line-height: 1;
}

.app-navbar .navbar-nav {
  gap: 0.35rem;
}

.app-navbar .nav-link {
  color: #c4d5e8;
  border-radius: 0.55rem;
  font-weight: 600;
  font-size: 0.92rem;
  padding: 0.5rem 0.75rem;
  transition: all 0.2s ease;
}

.app-navbar .nav-link:hover {
  color: #f4f9ff;
  background: rgba(255, 255, 255, 0.08);
}

.app-navbar .nav-link.active {
  color: #f6fbff;
  background: rgba(35, 145, 173, 0.34);
  box-shadow: inset 0 0 0 1px rgba(115, 216, 245, 0.42);
}

.btn-account {
  border: 1px solid rgba(160, 202, 231, 0.38);
  color: #e8f3ff;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 0.7rem;
  font-weight: 700;
  padding: 0.45rem 0.8rem;
}

.btn-account:hover,
.btn-account:focus {
  border-color: rgba(208, 231, 249, 0.66);
  color: #ffffff;
  background: rgba(255, 255, 255, 0.14);
}

.dropdown-menu {
  border: 1px solid #dbe6f2;
  border-radius: 0.85rem;
  box-shadow: var(--shadow-lg);
}

.dropdown-item {
  font-size: 0.92rem;
}

main.app-shell {
  animation: fade-slide 0.42s ease;
}

.page-header {
  margin-bottom: 1rem;
}

.page-title {
  margin: 0;
  font-size: clamp(1.35rem, 2.4vw, 1.85rem);
  font-weight: 700;
  color: #0f2034;
}

.page-subtitle {
  margin: 0.4rem 0 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.overline {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-size: 0.72rem;
  font-weight: 700;
  color: #5d7a99;
}

.panel-card,
.card {
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: linear-gradient(180deg, #ffffff 0%, #fdfefe 100%);
  box-shadow: var(--shadow-sm);
}

.card-header {
  background: transparent;
  border-bottom: 1px solid #e7edf4;
  padding: 0.9rem 1.1rem;
  font-weight: 700;
  color: #1d3552;
}

.card-body {
  padding: 1.1rem;
}

.metric-card {
  border: 1px solid #dae6f4;
  border-radius: 1rem;
  padding: 1rem 1.1rem;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(244, 250, 255, 0.96));
  box-shadow: var(--shadow-sm);
  height: 100%;
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(21, 49, 79, 0.14);
}

.metric-label {
  margin: 0;
  color: #607792;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}

.metric-value {
  margin: 0.3rem 0 0;
  font-family: var(--font-display);
  font-size: clamp(1.55rem, 2.3vw, 2rem);
  font-weight: 700;
  color: #0f2742;
  line-height: 1.05;
}

.metric-link {
  display: inline-flex;
  margin-top: 0.45rem;
  font-size: 0.82rem;
  font-weight: 700;
}

.hero-panel {
  border: 1px solid #dbe7f3;
  border-radius: 1.2rem;
  padding: 1.2rem;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.98), rgba(237, 247, 255, 0.95));
  box-shadow: var(--shadow-sm);
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.toolbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.table-modern {
  margin-bottom: 0;
  font-size: 0.92rem;
}

.table-modern thead th {
  border-bottom: 1px solid #dce6f2;
  color: #45617e;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  background: #f7faff;
  white-space: nowrap;
}

.table-modern tbody td {
  border-color: #edf2f7;
  vertical-align: middle;
  color: #1d324a;
}

.table-modern tbody tr:hover {
  background: rgba(9, 107, 128, 0.04);
}

.styled-form p {
  margin-bottom: 1rem;
}

.styled-form label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
  color: #28425f;
  font-weight: 700;
}

.styled-form input[type="text"],
.styled-form input[type="email"],
.styled-form input[type="password"],
.styled-form input[type="url"],
.styled-form input[type="number"],
.styled-form input[type="search"],
.styled-form input[type="file"],
.styled-form textarea,
.styled-form select {
  display: block;
  width: 100%;
  border: 1px solid #cedceb;
  background: #fdfefe;
  border-radius: 0.72rem;
  padding: 0.6rem 0.75rem;
  font-size: 0.94rem;
  color: #16263a;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.styled-form textarea {
  min-height: 7.5rem;
  resize: vertical;
}

.styled-form input[type="file"] {
  padding: 0.45rem 0.6rem;
  background: #fbfdff;
}

.styled-form input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
  margin-right: 0.35rem;
  accent-color: var(--brand);
}

.styled-form input:focus,
.styled-form textarea:focus,
.styled-form select:focus {
  border-color: #77a8d4;
  box-shadow: 0 0 0 0.22rem rgba(67, 136, 192, 0.2);
  outline: none;
}

.styled-form .helptext {
  display: block;
  margin-top: 0.35rem;
  color: #647d98;
  font-size: 0.8rem;
}

.styled-form ul.errorlist {
  list-style: none;
  margin: 0.4rem 0 0;
  padding: 0;
  color: var(--danger);
  font-size: 0.83rem;
}

.styled-form .errorlist + input,
.styled-form .errorlist + textarea,
.styled-form .errorlist + select {
  border-color: #d97f7f;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 0.7rem;
}

.filter-grid .span-3 {
  grid-column: span 3;
}

.filter-grid .span-2 {
  grid-column: span 2;
}

.filter-grid .span-4 {
  grid-column: span 4;
}

.filter-grid .span-12 {
  grid-column: span 12;
}

.status-pill,
.severity-pill,
.job-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.26rem 0.64rem;
  border: 1px solid #d7e2ef;
  background: #eef4fb;
  color: #2a4868;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.1;
  text-transform: uppercase;
}

.status-pill.status-active,
.severity-pill.status-active,
.job-pill.status-active {
  background: rgba(30, 122, 88, 0.12);
  color: #176345;
  border-color: rgba(30, 122, 88, 0.3);
}

.status-pill.status-inactive,
.severity-pill.status-inactive,
.job-pill.status-inactive {
  background: rgba(88, 109, 133, 0.13);
  color: #465f79;
  border-color: rgba(88, 109, 133, 0.26);
}

.severity-pill[data-severity="critical"] {
  background: rgba(177, 58, 58, 0.14);
  color: #8f2a2a;
  border-color: rgba(177, 58, 58, 0.32);
}

.severity-pill[data-severity="high"] {
  background: rgba(217, 113, 49, 0.15);
  color: #9b4f12;
  border-color: rgba(217, 113, 49, 0.3);
}

.severity-pill[data-severity="medium"] {
  background: rgba(186, 116, 38, 0.14);
  color: #8c5a1f;
  border-color: rgba(186, 116, 38, 0.3);
}

.severity-pill[data-severity="low"],
.severity-pill[data-severity="info"] {
  background: rgba(42, 111, 170, 0.12);
  color: #245985;
  border-color: rgba(42, 111, 170, 0.28);
}

.status-pill[data-status="accepted"],
.status-pill[data-status="paid"],
.job-pill[data-status="done"] {
  background: rgba(30, 122, 88, 0.12);
  color: #176345;
  border-color: rgba(30, 122, 88, 0.3);
}

.status-pill[data-status="rejected"],
.job-pill[data-status="failed"],
.job-pill[data-status="canceled"],
.job-pill[data-status="stuck"] {
  background: rgba(177, 58, 58, 0.12);
  color: #8f2a2a;
  border-color: rgba(177, 58, 58, 0.32);
}

.status-pill[data-status="submitted"],
.status-pill[data-status="triaged"],
.job-pill[data-status="running"] {
  background: rgba(42, 111, 170, 0.12);
  color: #245985;
  border-color: rgba(42, 111, 170, 0.3);
}

.status-pill[data-status="idea"],
.status-pill[data-status="validating"],
.status-pill[data-status="poc_ready"],
.job-pill[data-status="pending"] {
  background: rgba(88, 109, 133, 0.12);
  color: #475f79;
  border-color: rgba(88, 109, 133, 0.28);
}

.status-pill[data-status="completed"] {
  background: rgba(30, 122, 88, 0.12);
  color: #176345;
  border-color: rgba(30, 122, 88, 0.3);
}

.status-pill[data-status="failed"],
.status-pill[data-status="interrupted"],
.status-pill[data-status="error"] {
  background: rgba(177, 58, 58, 0.12);
  color: #8f2a2a;
  border-color: rgba(177, 58, 58, 0.32);
}

.status-pill[data-status="running"] {
  background: rgba(42, 111, 170, 0.12);
  color: #245985;
  border-color: rgba(42, 111, 170, 0.3);
}

.health-pill {
  text-transform: uppercase;
}

.health-pill.health-online {
  background: rgba(30, 122, 88, 0.12);
  color: #176345;
  border-color: rgba(30, 122, 88, 0.3);
}

.health-pill.health-offline {
  background: rgba(186, 116, 38, 0.14);
  color: #8c5a1f;
  border-color: rgba(186, 116, 38, 0.3);
}

.health-pill.health-provisioning {
  background: rgba(42, 111, 170, 0.12);
  color: #245985;
  border-color: rgba(42, 111, 170, 0.3);
}

.health-pill.health-error {
  background: rgba(177, 58, 58, 0.12);
  color: #8f2a2a;
  border-color: rgba(177, 58, 58, 0.32);
}

.health-pill.health-inactive {
  background: rgba(88, 109, 133, 0.13);
  color: #465f79;
  border-color: rgba(88, 109, 133, 0.26);
}

.json-block {
  margin: 0;
  max-height: 24rem;
  overflow: auto;
  border-radius: 0.8rem;
  border: 1px solid #dce6f2;
  background: #f6f9fe;
  color: #163455;
  padding: 0.85rem 0.95rem;
  font-size: 0.82rem;
}

.target-command {
  display: inline-block;
  max-width: 30rem;
  white-space: normal;
  word-break: break-word;
  border-radius: 0.55rem;
  border: 1px solid #dbe5f0;
  background: #f5f9fe;
  color: #1f4468;
  padding: 0.22rem 0.48rem;
  font-size: 0.78rem;
}

.target-command-group {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
  flex-wrap: wrap;
}

.target-guidance-list {
  margin: 0;
  padding-left: 1.05rem;
  color: #33516f;
  font-size: 0.9rem;
}

.target-guidance-list li {
  margin-bottom: 0.46rem;
}

.target-guidance-list li:last-child {
  margin-bottom: 0;
}

.target-query-samples {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.target-query-samples code {
  border: 1px solid #d8e3ef;
  background: #f6fafe;
  border-radius: 0.58rem;
  color: #214b70;
  padding: 0.24rem 0.46rem;
  font-size: 0.76rem;
}

.target-meta-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.target-meta-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid #d5e2ef;
  background: #f3f8fd;
  color: #2b4c6d;
  padding: 0.26rem 0.62rem;
  font-size: 0.78rem;
  font-weight: 600;
}

.inline-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin: 0.8rem 0;
  color: #496482;
  font-size: 0.9rem;
}

.inline-meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.list-clean {
  list-style: none;
  margin: 0;
  padding: 0;
}

.list-clean li {
  border-bottom: 1px solid #ecf1f7;
  padding: 0.74rem 0;
}

.list-clean li:last-child {
  border-bottom: none;
}

.empty-state {
  border: 1px dashed #d0dde9;
  background: #f7fafd;
  border-radius: 0.8rem;
  padding: 1rem;
  color: #67819d;
  text-align: center;
}

.pagination-modern {
  margin-top: 1rem;
}

.pagination-modern .page-link {
  border-radius: 0.62rem;
  margin-right: 0.25rem;
  border: 1px solid #d5e2f0;
  color: #2c4f72;
  font-weight: 600;
  font-size: 0.84rem;
}

.pagination-modern .page-item.active .page-link {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.app-alert {
  border-radius: 0.8rem;
  border: 1px solid transparent;
  box-shadow: var(--shadow-sm);
}

.auth-shell {
  min-height: calc(100vh - 170px);
  display: grid;
  place-items: center;
}

.auth-panel {
  width: 100%;
  max-width: 920px;
  border: 1px solid #d8e5f2;
  border-radius: 1.2rem;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  background: #ffffff;
}

.auth-cover {
  height: 100%;
  padding: 2.1rem;
  color: #eef8ff;
  background:
    radial-gradient(circle at 10% 10%, rgba(44, 230, 210, 0.27), transparent 48%),
    linear-gradient(145deg, #0d3457, #0b6f79);
}

.auth-cover h1 {
  font-size: clamp(1.45rem, 2.4vw, 1.95rem);
  margin-bottom: 0.8rem;
}

.auth-cover p {
  color: #d2e7f8;
}

.auth-body {
  padding: 2rem;
  background: #ffffff;
}

.auth-body .page-title {
  font-size: 1.55rem;
}

.btn-primary {
  background: linear-gradient(135deg, #0b6f7a, #0c8593);
  border-color: #0b6f7a;
  box-shadow: 0 8px 16px rgba(12, 133, 147, 0.24);
}

.btn-primary:hover,
.btn-primary:focus {
  background: linear-gradient(135deg, #095f67, #0b7581);
  border-color: #095f67;
}

.btn-outline-primary {
  border-color: #98bdd6;
  color: #285170;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
  background: #e8f3fb;
  border-color: #81abc9;
  color: #1c445f;
}

.btn-outline-secondary {
  border-color: #c9d6e3;
  color: #48637f;
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus {
  background: #eef4fa;
  border-color: #b7c7d7;
  color: #314e6a;
}

.codex-mission-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.codex-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.8rem;
}

.codex-kpi-card {
  border: 1px solid #d2e1ef;
  border-radius: 0.9rem;
  background: linear-gradient(180deg, #ffffff 0%, #f4f9ff 100%);
  padding: 0.86rem 0.92rem;
  box-shadow: var(--shadow-sm);
}

.codex-kpi-label {
  margin: 0;
  color: #59738e;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}

.codex-kpi-value {
  margin: 0.34rem 0 0.5rem;
  color: #112a44;
  font-size: 1.3rem;
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.1;
}

.codex-kpi-value-code {
  font-family: var(--font-mono);
  font-size: 0.84rem;
  line-height: 1.35;
  word-break: break-word;
}

.codex-live-alert {
  margin-bottom: 0.95rem;
}

.codex-control-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 0.95rem;
  align-items: start;
}

.codex-main-chat-card .card-body {
  padding: 0.86rem;
}

.codex-chat-context {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: #547192;
  border: 1px solid #d4e1ee;
  border-radius: 0.5rem;
  background: #f4f9ff;
  padding: 0.18rem 0.38rem;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.codex-subagent-window-card .card-body {
  padding: 0.86rem;
}

.codex-subagent-hint {
  margin: 0 0 0.62rem;
  font-size: 0.76rem;
  color: #5f7892;
}

.codex-subagent-windows {
  display: grid;
  gap: 0.72rem;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

.codex-subagent-window {
  border: 1px solid #334760;
  border-radius: 0.88rem;
  background: linear-gradient(150deg, #0f1825 0%, #121f2c 100%);
  padding: 0.72rem;
  box-shadow: 0 12px 28px rgba(8, 18, 30, 0.35);
  cursor: pointer;
  transition: border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.codex-subagent-window:hover {
  border-color: #4f6c89;
  transform: translateY(-1px);
}

.codex-subagent-window:focus-visible {
  outline: none;
  border-color: #6ca0d1;
  box-shadow: 0 0 0 2px rgba(108, 160, 209, 0.42), 0 12px 28px rgba(8, 18, 30, 0.35);
}

.codex-subagent-window.is-active {
  border-color: #3d7e68;
  background: linear-gradient(140deg, rgba(21, 46, 40, 0.95), rgba(20, 56, 46, 0.95));
}

.codex-subagent-window.is-selected {
  border-color: #5f96c9;
  box-shadow: 0 0 0 1px rgba(95, 150, 201, 0.44), 0 14px 30px rgba(8, 24, 39, 0.42);
}

.codex-subagent-window.is-main-slot {
  border-color: #6e84a2;
  background: linear-gradient(145deg, #1a2837 0%, #1d2f42 100%);
}

.codex-subagent-window-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.codex-subagent-window-title {
  margin: 0;
  color: #dbe8f6;
  font-size: 0.95rem;
}

.codex-subagent-window-body {
  margin: 0 0 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: #a8bdd4;
  white-space: pre-wrap;
  word-break: break-word;
  background: rgba(7, 12, 20, 0.62);
  border: 1px solid #2a3e54;
  border-radius: 0.68rem;
  padding: 0.52rem 0.58rem;
  min-height: 7.4rem;
  max-height: 16.5rem;
  overflow: auto;
}

.codex-subagent-window-foot {
  display: grid;
  gap: 0.24rem;
  font-size: 0.78rem;
  color: #9bb3c9;
}

.codex-subagent-window-foot code {
  border: 1px solid #3a526c;
  border-radius: 0.42rem;
  padding: 0.08rem 0.35rem;
  background: #102032;
  color: #a4c3de;
}

.codex-collapsed-zone {
  margin-top: 0.5rem;
}

.codex-log-details {
  overflow: hidden;
}

.codex-log-details > summary {
  list-style: none;
  cursor: pointer;
  padding: 0.88rem 1.1rem;
  font-weight: 700;
  color: #1d3552;
  border-bottom: 1px solid #e7edf4;
  background: linear-gradient(180deg, #ffffff 0%, #f5f9ff 100%);
}

.codex-log-details > summary::-webkit-details-marker {
  display: none;
}

.codex-log-details[open] > summary {
  border-bottom-color: #dce8f3;
}

.codex-log-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.codex-log-card {
  border: 1px solid #dce7f2;
  border-radius: 0.9rem;
  overflow: hidden;
  box-shadow: none;
}

.codex-log-card .card-header {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #486682;
  background: #f7faff;
}

.codex-connection-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.72rem;
  font-size: 0.84rem;
  color: #4e6883;
}

.codex-connection-inline code {
  border: 1px solid #d4e2ef;
  background: #f6fafe;
  border-radius: 0.5rem;
  color: #20496e;
  padding: 0.12rem 0.3rem;
}

.codex-side-stack {
  display: grid;
  gap: 0.95rem;
}

.codex-connection-list {
  margin: 0;
  display: grid;
  gap: 0.56rem;
}

.codex-connection-list div {
  border-bottom: 1px solid #e8eff6;
  padding-bottom: 0.46rem;
}

.codex-connection-list div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.codex-connection-list dt {
  margin: 0;
  color: #597490;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.codex-connection-list dd {
  margin: 0.22rem 0 0;
  color: #203b58;
  font-size: 0.87rem;
  word-break: break-word;
}

.codex-action-grid {
  display: grid;
  gap: 0.52rem;
}

.codex-action-grid form {
  margin: 0;
}

.codex-action-grid .btn {
  width: 100%;
}

.codex-quick-prompts {
  display: grid;
  gap: 0.5rem;
}

.codex-quick-prompt {
  text-align: left;
  font-size: 0.84rem;
}

.codex-compose-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.68rem;
  align-items: end;
}

.codex-chat-compose-form {
  margin: 0;
}

.codex-compose-box {
  position: relative;
  border: 1px solid #2e4359;
  border-radius: 0.95rem;
  background:
    radial-gradient(560px 150px at 14% -30%, rgba(54, 105, 171, 0.2), transparent 60%),
    linear-gradient(180deg, rgba(12, 20, 30, 0.97), rgba(10, 17, 25, 0.98));
  padding: 0.56rem;
  box-shadow:
    inset 0 1px 0 rgba(163, 195, 225, 0.06),
    0 16px 30px rgba(4, 8, 14, 0.4);
}

.codex-compose-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  margin-bottom: 0.45rem;
}

.codex-compose-target-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid rgba(79, 143, 201, 0.44);
  background: rgba(24, 50, 80, 0.52);
  color: #afd1ef;
  font-size: 0.7rem;
  line-height: 1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 700;
  padding: 0.24rem 0.52rem;
}

.codex-compose-target-chip[data-scope="subagent"] {
  border-color: rgba(72, 179, 134, 0.45);
  background: rgba(22, 66, 50, 0.48);
  color: #99e2bf;
}

.codex-compose-shortcuts {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.38rem;
  font-size: 0.67rem;
  color: #8ea8bf;
}

.codex-compose-shortcuts kbd {
  border: 1px solid #3a536a;
  border-radius: 0.36rem;
  background: #121f2d;
  color: #c4d7ea;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 600;
  line-height: 1;
  padding: 0.12rem 0.34rem;
}

.codex-compose-input-wrap {
  position: relative;
  display: flex;
  gap: 0.46rem;
  align-items: flex-end;
  background: #121d2b;
  border: 1px solid #31485f;
  border-radius: 0.78rem;
  padding: 0.38rem 0.4rem;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.codex-compose-input-wrap:focus-within {
  border-color: #4b7dac;
  background: #132233;
  box-shadow:
    0 0 0 1px rgba(75, 125, 172, 0.25),
    0 0 0 3px rgba(75, 125, 172, 0.1);
}

.codex-compose-leading {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border-radius: 0.56rem;
  border: 1px solid rgba(61, 91, 120, 0.58);
  background: rgba(14, 27, 40, 0.82);
  color: #86abc9;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.codex-compose-leading svg {
  display: block;
}

.codex-compose-input-wrap textarea {
  flex: 1;
  border: none !important;
  background: transparent !important;
  outline: none !important;
  box-shadow: none !important;
  border-radius: 0.62rem;
  padding: 0.52rem 0.1rem 0.54rem 0;
  margin: 0;
  min-height: calc(1.42em * 3);
  max-height: calc(1.42em * 12 + 1.1rem);
  resize: none;
  line-height: 1.42;
  color: #d8e8f8;
  font-family: var(--font-body);
  font-size: 0.9rem;
}

.codex-compose-input-wrap textarea::placeholder {
  color: #6f8aa4;
}

.codex-send-btn {
  flex-shrink: 0;
  align-self: flex-end;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.34rem;
  min-width: 3.02rem;
  height: 2.18rem;
  margin: 0;
  padding: 0 0.64rem;
  border-radius: 0.62rem;
  border: 1px solid #2d7f61;
  background: linear-gradient(180deg, #3ea37d 0%, #347f66 100%);
  color: #fff;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s, border-color 0.15s;
}

.codex-send-btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.codex-send-btn-label {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.codex-send-btn:hover {
  background: linear-gradient(180deg, #4aa987 0%, #39876c 100%);
  border-color: #3f9a79;
  box-shadow: 0 8px 18px rgba(24, 94, 70, 0.34);
  transform: translateY(-1px);
}

.codex-send-btn:active {
  transform: translateY(0);
  box-shadow: none;
}

.codex-send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.codex-send-btn svg {
  display: block;
}

.codex-compose-bottomline {
  margin-top: 0.46rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.67rem;
}

.codex-compose-meta {
  color: #82a0ba;
  line-height: 1.3;
}

/* ── Slash-command palette ─────────────────────────── */
.codex-slash-palette {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 0.4rem);
  background: #0d1720;
  border: 1px solid rgba(55, 85, 115, 0.6);
  border-radius: 0.85rem;
  overflow: hidden;
  z-index: 20;
  box-shadow:
    0 0 0 1px rgba(20, 40, 60, 0.8),
    0 8px 32px rgba(0, 0, 0, 0.6),
    0 2px 8px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transform: translateY(4px) scale(0.99);
  pointer-events: none;
  transition: opacity 0.12s ease, transform 0.12s ease;
  transform-origin: bottom center;
}

.codex-slash-palette.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* category label */
.codex-slash-group {
  padding: 0.55rem 0.9rem 0.2rem;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #3d5a75;
}

.codex-slash-group + .codex-slash-group {
  border-top: 1px solid rgba(40, 65, 90, 0.35);
}

/* item row */
.codex-slash-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.48rem 0.7rem 0.48rem 0.82rem;
  cursor: pointer;
  user-select: none;
  border-left: 2px solid transparent;
  transition: background 0.08s, border-color 0.08s;
}

.codex-slash-item:hover {
  background: rgba(255, 255, 255, 0.03);
  border-left-color: rgba(59, 138, 110, 0.4);
}

.codex-slash-item.is-active {
  background: rgba(59, 138, 110, 0.1);
  border-left-color: #3b8a6e;
}

/* icon box */
.codex-slash-item-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.48rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: #7aaec8;
  transition: background 0.08s, color 0.08s;
}

.codex-slash-item.is-active .codex-slash-item-icon {
  background: rgba(59, 138, 110, 0.15);
  border-color: rgba(59, 138, 110, 0.3);
  color: #5fbf9f;
}

.codex-slash-item-icon svg {
  display: block;
}

/* text block */
.codex-slash-item-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
}

.codex-slash-item-cmd {
  font-family: var(--font-mono);
  font-size: 0.83rem;
  font-weight: 600;
  color: #d6e8f8;
  line-height: 1.3;
}

.codex-slash-item-cmd mark {
  background: transparent;
  color: #5fbf9f;
  font-weight: 700;
}

.codex-slash-item-desc {
  font-size: 0.73rem;
  color: #4e6880;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.codex-slash-item.is-active .codex-slash-item-desc {
  color: #6a8fa8;
}

/* right badge */
.codex-slash-item-tag {
  flex-shrink: 0;
  font-size: 0.62rem;
  font-family: var(--font-mono);
  color: #3a5570;
  background: rgba(30, 50, 72, 0.5);
  border: 1px solid rgba(45, 68, 92, 0.5);
  border-radius: 999px;
  padding: 0.1rem 0.42rem;
  letter-spacing: 0.02em;
}

.codex-slash-item.is-active .codex-slash-item-tag {
  color: #4a7060;
  border-color: rgba(59, 138, 110, 0.25);
  background: rgba(59, 138, 110, 0.08);
}

/* footer */
.codex-slash-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.9rem;
  padding: 0.42rem 0.9rem;
  border-top: 1px solid rgba(40, 65, 90, 0.35);
  background: rgba(0, 0, 0, 0.15);
}

.codex-slash-footer-hint {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  font-size: 0.66rem;
  color: #324a60;
}

.codex-slash-footer-hint kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.2rem;
  height: 1.2rem;
  padding: 0 0.22rem;
  font-size: 0.62rem;
  font-family: var(--font-mono);
  color: #3f5d78;
  background: rgba(30, 50, 70, 0.6);
  border: 1px solid rgba(50, 75, 100, 0.5);
  border-radius: 0.25rem;
  line-height: 1;
}

.codex-bottom-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.codex-subagent-toolbar {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(360px, 1.35fr);
  gap: 0.78rem;
  margin-bottom: 0.85rem;
}

.codex-subagent-filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.58rem;
}

.codex-subagent-filter-field {
  display: grid;
  gap: 0.28rem;
}

.codex-subagent-filter-field label {
  margin: 0;
  color: #4f6c89;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
}

.codex-subagent-filter-field input,
.codex-subagent-filter-field select {
  display: block;
  width: 100%;
  border: 1px solid #c5d7ea;
  border-radius: 0.62rem;
  background: #f8fbff;
  color: #183450;
  padding: 0.44rem 0.54rem;
  font-size: 0.85rem;
}

.codex-subagent-filter-field input:focus,
.codex-subagent-filter-field select:focus {
  border-color: #78a8d3;
  box-shadow: 0 0 0 0.16rem rgba(67, 136, 192, 0.16);
  outline: none;
}

.codex-subagent-focus {
  border: 1px solid #d5e2ee;
  border-radius: 0.8rem;
  background: linear-gradient(180deg, #f9fcff 0%, #f2f8ff 100%);
  padding: 0.62rem 0.74rem;
}

.codex-subagent-focus.is-empty {
  border-style: dashed;
}

.codex-focused-name {
  margin: 0 0 0.44rem;
  color: #14324f;
  font-size: 1rem;
}

.codex-focus-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.codex-focus-actions .btn {
  font-size: 0.76rem;
  padding: 0.24rem 0.48rem;
}

.codex-chat-shell {
  display: block;
}

.shell-frame {
  border: 1px solid #213248;
  border-radius: 1rem;
  /* overflow visible so the slash palette can escape upward */
  overflow: visible;
  background: #0b1119;
  box-shadow: 0 24px 52px rgba(6, 16, 27, 0.5);
}

.shell-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  padding: 0.62rem 0.9rem;
  border-bottom: 1px solid #2a4058;
  background: linear-gradient(180deg, #101a26 0%, #0d151f 100%);
  border-radius: 1rem 1rem 0 0;
  overflow: hidden;
}

.shell-head-left {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.shell-dot {
  width: 0.62rem;
  height: 0.62rem;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
}

.shell-dot-red {
  background: #f46560;
}

.shell-dot-yellow {
  background: #f6bc3f;
}

.shell-dot-green {
  background: #58cb42;
}

.shell-title {
  color: #9eb4ca;
  font-family: var(--font-mono);
  font-size: 0.79rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shell-live-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid rgba(59, 172, 122, 0.45);
  background: rgba(38, 146, 103, 0.18);
  color: #7de0b2;
  font-weight: 700;
  letter-spacing: 0.05em;
  font-size: 0.69rem;
  padding: 0.15rem 0.48rem;
}

.shell-body {
  padding: 0.92rem;
  background:
    radial-gradient(850px 320px at 15% -20%, rgba(34, 91, 152, 0.16), transparent 56%),
    radial-gradient(900px 340px at 120% 0%, rgba(35, 146, 120, 0.11), transparent 58%),
    #091018;
}

.shell-compose {
  border-top: 1px solid #223446;
  background: linear-gradient(180deg, #0d1722 0%, #0c151f 100%);
  padding: 0.9rem;
}

.shell-compose .styled-form label {
  color: #a7c0d8;
}

.shell-compose .styled-form p {
  margin-bottom: 0;
}

.shell-compose .styled-form input[type="text"] {
  border-color: #32485f;
  background: #121e2b;
  color: #dbe9f7;
  font-family: var(--font-mono);
}

.shell-compose .styled-form input::placeholder {
  color: #7f99b3;
}

.shell-compose .styled-form .helptext {
  color: #8eabc6;
}

.codex-chat-history {
  border: 1px solid #22364c;
  border-radius: 0.9rem;
  background: #0a1119;
  padding: 0.78rem;
  min-height: 52vh;
  max-height: 72vh;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.62rem;
}

.codex-chat-message {
  border-radius: 0.72rem;
  padding: 0.36rem 0.48rem;
  border: 1px solid rgba(73, 98, 123, 0.16);
  background: rgba(15, 24, 35, 0.18);
  box-shadow: none;
}

.codex-chat-message-user {
  margin-left: 11%;
  background: rgba(19, 40, 60, 0.16);
  border-color: rgba(72, 106, 136, 0.2);
}

.codex-chat-message-assistant {
  margin-right: 11%;
  background: rgba(22, 39, 33, 0.16);
  border-color: rgba(78, 107, 96, 0.2);
}

.codex-chat-message-system {
  margin-left: 5%;
  margin-right: 5%;
  background: rgba(30, 30, 40, 0.22);
  border-color: rgba(100, 100, 130, 0.22);
  font-size: 0.88rem;
}

.codex-chat-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.38rem;
  margin-bottom: 0.28rem;
  font-size: 0.72rem;
  color: #88a0b8;
}

.codex-chat-meta strong {
  color: #b8c8d9;
  font-weight: 600;
}

.codex-chat-meta code {
  font-size: 0.68rem;
  border: 1px solid #304a65;
  border-radius: 0.45rem;
  padding: 0.04rem 0.28rem;
  background: rgba(15, 34, 52, 0.82);
  color: #8fb0cf;
}

.codex-chat-text {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 0.85rem;
  color: #bacbdd;
  line-height: 1.48;
  font-family: var(--font-body);
  white-space: pre-wrap;
  word-break: break-word;
}

.codex-agent-grid {
  display: grid;
  gap: 0.85rem;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.codex-agent-card {
  border: 1px solid #334760;
  border-radius: 0.9rem;
  background: linear-gradient(150deg, #0f1825 0%, #121f2c 100%);
  padding: 0.9rem;
  box-shadow: 0 14px 32px rgba(8, 18, 30, 0.35);
}

.codex-agent-card.is-active {
  border-color: #3d7e68;
  background: linear-gradient(140deg, rgba(21, 46, 40, 0.95), rgba(20, 56, 46, 0.95));
  box-shadow: 0 16px 34px rgba(6, 24, 19, 0.38);
}

.codex-agent-card.is-selected {
  border-color: #4f8fc9;
  box-shadow: 0 0 0 1px rgba(79, 143, 201, 0.44), 0 16px 36px rgba(8, 24, 39, 0.42);
}

.codex-agent-title {
  margin: 0;
  font-size: 1rem;
  color: #dbe8f6;
}

.codex-agent-preview {
  margin: 0 0 0.6rem;
  font-size: 0.83rem;
  color: #a8bdd4;
  font-family: var(--font-mono);
  white-space: pre-wrap;
  background: rgba(7, 12, 20, 0.62);
  border: 1px solid #2a3e54;
  border-radius: 0.7rem;
  padding: 0.58rem 0.64rem;
}

.codex-agent-card .inline-meta {
  color: #9bb3c9;
  font-size: 0.82rem;
}

.codex-agent-card code {
  border: 1px solid #3a526c;
  border-radius: 0.42rem;
  padding: 0.08rem 0.35rem;
  background: #102032;
  color: #a4c3de;
}

.codex-agent-controls {
  margin-top: 0.56rem;
  display: flex;
  justify-content: flex-end;
}

.codex-agent-select {
  font-size: 0.75rem;
  padding: 0.2rem 0.56rem;
}

.shell-body .empty-state {
  background: #111c2a;
  border-color: #2d4259;
  color: #9cb4cc;
}

@media (max-width: 991.98px) {
  .codex-mission-header {
    flex-direction: column;
    align-items: stretch;
  }

  .codex-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .codex-control-grid,
  .codex-bottom-grid {
    grid-template-columns: 1fr;
  }

  .codex-log-grid {
    grid-template-columns: 1fr;
  }

  .codex-compose-grid,
  .codex-compose-row {
    grid-template-columns: 1fr;
  }

  .codex-subagent-toolbar,
  .codex-subagent-filters {
    grid-template-columns: 1fr;
  }

  .codex-subagent-windows {
    grid-template-columns: 1fr;
  }

  .codex-focus-actions .btn {
    width: 100%;
    text-align: left;
  }

  .codex-agent-controls {
    justify-content: flex-start;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar-actions {
    justify-content: flex-start;
  }

  .filter-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .filter-grid .span-2,
  .filter-grid .span-3,
  .filter-grid .span-4 {
    grid-column: span 6;
  }

  .auth-cover {
    padding: 1.5rem;
  }

  .auth-body {
    padding: 1.5rem;
  }

  .codex-chat-shell {
    grid-template-columns: 1fr;
  }

  .codex-chat-message-user,
  .codex-chat-message-assistant,
  .codex-chat-message-system {
    margin-left: 0;
    margin-right: 0;
  }

  .codex-chat-history {
    min-height: 46vh;
    max-height: 58vh;
  }

  .codex-compose-box {
    padding: 0.5rem;
  }

  .codex-compose-topline {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.34rem;
  }

  .codex-compose-shortcuts {
    font-size: 0.64rem;
  }

  .codex-compose-input-wrap textarea {
    min-height: calc(1.42em * 3);
  }

  .codex-send-btn-label {
    display: none;
  }

  .codex-send-btn {
    min-width: 2.28rem;
    width: 2.28rem;
    padding: 0;
  }
}

@media (max-width: 575.98px) {
  .codex-kpi-grid {
    grid-template-columns: 1fr;
  }

  .metric-card {
    padding: 0.9rem;
  }

  .page-subtitle {
    font-size: 0.9rem;
  }

  .table-modern {
    font-size: 0.86rem;
  }
}

@keyframes fade-slide {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}
