html {
  font-size: 14px;
  min-height: 100%;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

body {
  min-height: 100vh;
  margin: 0;
  background: #f3f5f9;
  color: #17202a;
}

.cb-auth-body {
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(47, 128, 237, 0.18), transparent 28%),
    linear-gradient(180deg, #f7f9fc 0%, #eef2f6 100%);
}

.cb-auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
}

.cb-auth-card {
  width: min(100%, 420px);
}

.cb-auth-brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-bottom: 1rem;
}

.cb-auth-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: #2f80ed;
  color: #fff;
  font-weight: 700;
}

.cb-auth-brand strong,
.cb-auth-brand small {
  display: block;
}

.cb-auth-brand small {
  color: #667085;
  margin-top: 0.15rem;
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-select:focus,
.form-check-input:focus {
  box-shadow: 0 0 0 0.1rem #fff, 0 0 0 0.25rem rgba(22, 97, 171, 0.22);
}

.cb-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.cb-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 1.25rem;
  background: #101820;
  color: #fff;
  overflow-y: auto;
}

.cb-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #fff;
  text-decoration: none;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.cb-brand:hover {
  color: #fff;
}

.cb-brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #2f80ed;
  font-weight: 700;
}

.cb-brand small {
  display: block;
  color: #aab6c2;
  font-size: 0.78rem;
  margin-top: 0.1rem;
}

.cb-nav {
  padding-top: 1rem;
}

.cb-nav-section {
  margin: 1.2rem 0 0.45rem;
  color: #7f8d9a;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.cb-nav a {
  display: block;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  color: #dce4ec;
  text-decoration: none;
  font-weight: 500;
}

.cb-nav a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.cb-main {
  min-width: 0;
}

.cb-topbar {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.5rem;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid #dfe3e8;
  backdrop-filter: blur(14px);
}

.cb-topbar-title {
  font-weight: 700;
}

.cb-topbar-subtitle {
  color: #667085;
  font-size: 0.9rem;
}

.cb-content {
  padding: 1.75rem;
}

.cb-page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.cb-page-header h1 {
  margin: 0;
  font-size: 1.7rem;
}

.cb-page-header p {
  margin: 0.35rem 0 0;
  color: #667085;
}

.cb-panel {
  background: #fff;
  border: 1px solid #dfe3e8;
  border-radius: 14px;
  padding: 1rem;
  box-shadow: 0 12px 28px rgba(16, 24, 32, 0.05);
}

.cb-panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.cb-panel-heading h2,
.cb-section-title h2 {
  margin: 0;
  font-size: 1.05rem;
}

.cb-panel-heading p {
  margin: 0.25rem 0 0;
  color: #667085;
  font-size: 0.9rem;
}

.cb-section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.cb-section-title span {
  color: #667085;
  font-size: 0.88rem;
}

.cb-memory-item h2,
.cb-memory-item h3 {
  margin: 0;
  font-size: 1.05rem;
}

.cb-memory-item p {
  margin: 0.85rem 0 0;
  white-space: pre-wrap;
}

.cb-rule-set {
  padding: 0.85rem 0;
  border-bottom: 1px solid #edf0f3;
}

.cb-rule-set:last-child {
  border-bottom: 0;
}

.cb-rule-set p {
  margin: 0.2rem 0 0;
  color: #667085;
  font-size: 0.9rem;
}

.cb-conversation-card:hover {
  border-color: #b8c4d1;
  box-shadow: 0 14px 30px rgba(16, 24, 32, 0.10);
}

.cb-chat-window {
  min-height: 420px;
  max-height: 62vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.cb-chat-shell {
  padding: 0;
  overflow: hidden;
}

.cb-chat-window {
  padding: 1.1rem;
}

.cb-chat-message {
  margin-bottom: 1rem;
  max-width: min(78%, 860px);
  display: flex;
  flex-direction: column;
  align-self: flex-start;
}

.cb-chat-meta {
  color: #667085;
  font-size: 0.78rem;
  margin-bottom: 0.25rem;
}

.cb-chat-bubble {
  background: #f5f7fb;
  border: 1px solid #e2e8ef;
  border-radius: 14px;
  padding: 0.9rem 1rem;
  white-space: pre-wrap;
}

.cb-chat-user .cb-chat-bubble {
  background: #edf5ff;
  border-color: #cfe4ff;
}

.cb-chat-user {
  align-self: flex-end;
  align-items: flex-end;
}

.cb-chat-assistant .cb-chat-bubble {
  background: #eefaf1;
  border-color: #d9ead9;
}

.cb-chat-assistant,
.cb-chat-system {
  align-self: flex-start;
  align-items: flex-start;
}

.cb-chat-system .cb-chat-bubble {
  background: #f7f8fa;
  border-color: #d8dee6;
  color: #4c5a67;
}

.cb-chat-bubble-processing {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
}

.cb-routing-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.cb-routing-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.85rem;
  border: 1px solid #dfe3e8;
  border-radius: 12px;
  background: #f8fafc;
  min-height: 138px;
}

.cb-routing-card:has(input[type="radio"]:checked) {
  border-color: #7db0ff;
  background: #f3f8ff;
  box-shadow: inset 0 0 0 1px rgba(47, 128, 237, 0.15);
}

.cb-routing-head {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.6rem;
  align-items: start;
  margin: 0;
  cursor: pointer;
}

.cb-routing-head input[type="radio"] {
  margin-top: 0.2rem;
}

.cb-routing-copy strong {
  display: block;
  font-size: 0.98rem;
}

.cb-routing-copy small {
  display: block;
  color: #667085;
  margin-top: 0.15rem;
}

.cb-routing-slot {
  margin-top: 0.15rem;
  padding-top: 0.65rem;
  border-top: 1px solid #e7ebf0;
}

.cb-routing-slot .form-label {
  margin-bottom: 0.35rem;
}

.cb-story-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.cb-story {
  padding: 1rem;
  border: 1px solid #e3e8ee;
  border-radius: 8px;
  background: #f8fafc;
}

.cb-story h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.cb-story p {
  margin: 0;
  color: #556170;
}

.cb-manual-step {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
  margin-bottom: 1.5rem;
}

.cb-manual-copy {
  background: #ffffff;
  border: 1px solid #dfe3e8;
  border-radius: 8px;
  padding: 1rem;
  position: sticky;
  top: 1.5rem;
}

.cb-manual-copy h2 {
  margin: 0.25rem 0 0.5rem;
}

.cb-manual-copy p {
  margin: 0;
  color: #556170;
}

.cb-manual-kicker {
  color: #2f80ed;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
}

.cb-manual-shot {
  width: 100%;
  border: 1px solid #dfe3e8;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(16, 24, 32, 0.08);
}

.cb-manual-shot-frame {
  width: 100%;
  overflow: hidden;
  border: 1px solid #dfe3e8;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(16, 24, 32, 0.08);
}

.cb-manual-shot-crop {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  width: 132%;
  max-width: none;
  transform: translateX(-18%);
  display: block;
}

.cb-checklist {
  display: grid;
  gap: 0.85rem;
}

.cb-list-stack {
  display: grid;
  gap: 1rem;
}

.cb-list-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 1rem;
  align-items: center;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}

.cb-list-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 36px rgba(16, 24, 32, 0.10);
}

.cb-list-card-main {
  min-width: 0;
}

.cb-list-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.cb-list-card-header h2 {
  margin: 0;
  font-size: 1.05rem;
}

.cb-list-card-subtitle {
  margin-top: 0.3rem;
  color: #617182;
  font-size: 0.92rem;
}

.cb-list-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  margin-top: 0.9rem;
  color: #6b7785;
  font-size: 0.86rem;
}

.cb-list-card-side {
  padding-left: 1rem;
  border-left: 1px solid #e6ebf1;
  color: #51606f;
}

.cb-list-card-label {
  margin-bottom: 0.25rem;
  color: #6c7a88;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.cb-list-card-open {
  background: linear-gradient(180deg, #e7f8ea 0%, #ffffff 58%);
  border-color: #a7d7b1;
}

.cb-list-card-closed {
  background: linear-gradient(180deg, #eceff3 0%, #ffffff 58%);
  border-color: #c7d0da;
}

.cb-list-card-warning {
  background: linear-gradient(180deg, #fff9ef 0%, #ffffff 55%);
  border-color: #f1ddb3;
}

.cb-list-card-danger {
  background: linear-gradient(180deg, #fff3f3 0%, #ffffff 55%);
  border-color: #efc4c4;
}

.cb-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.38rem 0.68rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  border: 1px solid transparent;
  white-space: nowrap;
}

.cb-status-success {
  background: #dff5e3;
  color: #1f6538;
  border-color: #a9d7b3;
}

.cb-status-neutral {
  background: #e6eaef;
  color: #465360;
  border-color: #c7d0da;
}

.cb-status-warning {
  background: #fff4d8;
  color: #8a5a00;
  border-color: #f2deb0;
}

.cb-status-danger {
  background: #fee7e7;
  color: #a33b3b;
  border-color: #f3c4c4;
}

.cb-status-info {
  background: #e9f2ff;
  color: #245da8;
  border-color: #cfe0fb;
}

.cb-chat-compose {
  position: sticky;
  bottom: 1rem;
}

.cb-spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #c8d7ea;
  border-top-color: #2f80ed;
  animation: cb-spin 0.85s linear infinite;
  flex: 0 0 auto;
}

@keyframes cb-spin {
  to {
    transform: rotate(360deg);
  }
}

.cb-run-item {
  padding: 0.85rem 0;
  border-bottom: 1px solid #edf0f3;
}

.cb-run-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.card {
  border-color: #dfe3e8;
  border-radius: 8px;
}

pre {
  white-space: pre-wrap;
}

@media (max-width: 991.98px) {
  .cb-shell {
    display: block;
  }

  .cb-sidebar {
    position: static;
    height: auto;
  }

  .cb-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.25rem 0.5rem;
  }

  .cb-nav-section {
    grid-column: 1 / -1;
  }

  .cb-topbar {
    align-items: flex-start;
  }

  .cb-page-header {
    flex-direction: column;
  }

  .cb-routing-grid {
    grid-template-columns: 1fr;
  }

  .cb-list-card {
    grid-template-columns: 1fr;
  }

  .cb-list-card-side {
    padding-left: 0;
    border-left: 0;
    border-top: 1px solid #e6ebf1;
    padding-top: 0.85rem;
  }

  .cb-story-grid,
  .cb-manual-step {
    grid-template-columns: 1fr;
  }

  .cb-manual-copy {
    position: static;
  }
}
