:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: #f5f7f8;
  color: #172026;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 6px;
  background: #11675d;
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  min-height: 42px;
  padding: 0 16px;
}

button.secondary {
  background: #263238;
}

button:disabled {
  background: #9aa6ac;
  cursor: not-allowed;
}

.shell {
  min-height: 100vh;
  padding: 28px;
}

.login-view {
  align-items: center;
  display: flex;
  min-height: calc(100vh - 56px);
  justify-content: center;
}

.login-panel {
  background: #fff;
  border: 1px solid #dce4e7;
  border-radius: 8px;
  box-shadow: 0 18px 46px rgba(23, 32, 38, 0.1);
  display: grid;
  gap: 14px;
  max-width: 380px;
  padding: 24px;
  width: 100%;
}

.login-panel h1 {
  margin-bottom: 8px;
}

.error-text {
  color: #b3261e;
  font-size: 13px;
  margin: 0;
  min-height: 18px;
}

.workspace {
  max-width: 1260px;
  margin: 0 auto;
}

.topbar {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 20px;
}

.topbar-actions {
  align-items: center;
  display: flex;
  gap: 10px;
}

.eyebrow {
  color: #607078;
  font-size: 13px;
  font-weight: 700;
  margin: 0 0 6px;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  font-size: 34px;
  line-height: 1.15;
  margin-bottom: 0;
}

h2 {
  font-size: 18px;
  margin-bottom: 12px;
}

.status-pill {
  background: #e5f0ed;
  border: 1px solid #c6ded8;
  border-radius: 999px;
  color: #11675d;
  font-weight: 700;
  padding: 8px 14px;
}

.control-layout {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(260px, 0.75fr) minmax(420px, 1.25fr);
  margin-bottom: 22px;
}

.settings-panel,
.chat-panel,
.detail,
.task-card {
  background: #fff;
  border: 1px solid #dce4e7;
  border-radius: 8px;
  box-shadow: 0 8px 26px rgba(23, 32, 38, 0.06);
}

.settings-panel {
  align-content: start;
  display: grid;
  gap: 12px;
  padding: 18px;
}

.chat-panel {
  display: grid;
  grid-template-rows: minmax(180px, 1fr) auto auto;
  height: calc(100vh - 128px);
  min-height: 620px;
  max-height: 900px;
  overflow: hidden;
}

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  overflow: auto;
  padding: 18px;
}

.chat-bubble {
  border-radius: 8px;
  max-width: 78%;
  padding: 10px 12px;
}

.chat-bubble p {
  margin: 0;
  line-height: 1.55;
}

.chat-bubble.user {
  align-self: flex-end;
  background: #11675d;
  color: #fff;
}

.chat-bubble.assistant {
  align-self: flex-start;
  background: #eef2f4;
  color: #263238;
}

.chat-form {
  border-top: 1px solid #e4eaed;
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr auto;
  padding: 14px;
}

textarea,
input {
  border: 1px solid #cfd9dd;
  border-radius: 6px;
  color: #172026;
  outline: none;
  padding: 10px 12px;
  width: 100%;
}

textarea:focus,
input:focus {
  border-color: #11675d;
  box-shadow: 0 0 0 3px rgba(17, 103, 93, 0.13);
}

label {
  color: #526169;
  display: grid;
  font-size: 13px;
  font-weight: 700;
  gap: 6px;
}

.split {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(300px, 0.85fr) minmax(420px, 1.15fr);
  margin-top: 24px;
}

.task-list {
  display: grid;
  gap: 12px;
}

.task-card {
  cursor: pointer;
  padding: 14px;
}

.task-card.active {
  border-color: #11675d;
  box-shadow: 0 0 0 3px rgba(17, 103, 93, 0.12);
}

.task-card h3 {
  font-size: 16px;
  margin: 0 0 8px;
}

.task-meta {
  color: #5d6c73;
  display: flex;
  flex-wrap: wrap;
  font-size: 13px;
  gap: 8px;
}

.badge {
  background: #eef2f4;
  border-radius: 999px;
  color: #39474e;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  padding: 4px 8px;
}

.badge.waiting_review,
.badge.waiting_verification_request,
.badge.waiting_user_code,
.badge.logging_in,
.badge.opening_login_page,
.badge.login_submitted,
.badge.needs_manual_help,
.badge.login_failed {
  background: #fff2d8;
  color: #7a4c00;
}

.badge.submitted,
.badge.login_success {
  background: #dff3e7;
  color: #126132;
}

.detail {
  min-height: 420px;
  padding: 18px;
}

.detail.empty {
  align-items: center;
  color: #75848b;
  display: flex;
  justify-content: center;
}

.detail-header {
  align-items: start;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
}

.auth-panel,
.progress-panel,
.browser-panel {
  border: 1px solid #dce4e7;
  border-radius: 8px;
  display: grid;
  gap: 12px;
  margin: 16px 0;
  padding: 14px;
}

.auth-panel {
  background: #f7faf9;
}

.auth-panel p {
  color: #46565d;
  margin: 0;
}

.code-form {
  grid-template-columns: 1fr auto;
  align-items: end;
}

.progress-topline,
.step-title-row,
.browser-info {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.progress-topline span,
.step-title-row span,
.browser-info span,
.browser-panel a {
  color: #607078;
  font-size: 12px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.progress-track {
  background: #e8eef0;
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
}

.progress-fill {
  background: #11675d;
  border-radius: inherit;
  height: 100%;
  transition: width 180ms ease;
}

.step-list {
  display: grid;
  gap: 8px;
}

.step-item {
  align-items: start;
  display: grid;
  gap: 10px;
  grid-template-columns: 26px 1fr;
}

.step-index {
  align-items: center;
  background: #eef2f4;
  border-radius: 50%;
  color: #607078;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  height: 26px;
  justify-content: center;
  width: 26px;
}

.step-body {
  border-bottom: 1px solid #edf2f4;
  padding-bottom: 8px;
}

.step-body p {
  color: #5d6c73;
  font-size: 13px;
  margin: 4px 0 0;
}

.step-item.done .step-index {
  background: #dff3e7;
  color: #126132;
}

.step-item.active .step-index {
  background: #fff2d8;
  color: #7a4c00;
}

.step-item.active .step-body {
  border-bottom-color: #f2d9a8;
}

.step-item.pending {
  opacity: 0.68;
}

.browser-panel img {
  border: 1px solid #e4eaed;
  border-radius: 6px;
  max-height: 360px;
  object-fit: contain;
  width: 100%;
}

.orders {
  border-collapse: collapse;
  margin-top: 16px;
  width: 100%;
}

.orders th,
.orders td {
  border-bottom: 1px solid #e4eaed;
  font-size: 13px;
  padding: 10px 8px;
  text-align: left;
}

.events {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.event {
  border-left: 3px solid #c6ded8;
  color: #4c5b63;
  font-size: 13px;
  padding-left: 10px;
}

[hidden] {
  display: none !important;
}

@media (max-width: 900px) {
  .shell {
    padding: 18px;
  }

  .control-layout,
  .split,
  .chat-form {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .topbar-actions {
    width: 100%;
  }

  .chat-bubble {
    max-width: 92%;
  }
}

.admin-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
}

.metric-card,
.admin-section {
  background: #fff;
  border: 1px solid #dce4e7;
  border-radius: 8px;
  box-shadow: 0 8px 26px rgba(23, 32, 38, 0.06);
  padding: 16px;
}

.metric-card span {
  color: #607078;
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
}

.metric-card strong {
  color: #11675d;
  font-size: 30px;
}

.admin-two-col {
  display: grid;
  gap: 18px;
  grid-template-columns: 1fr 1fr;
  margin-bottom: 18px;
}

.section-title-row {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.admin-list {
  display: grid;
  gap: 10px;
}

.admin-row {
  align-items: center;
  border: 1px solid #e4eaed;
  border-radius: 8px;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 12px;
}

.admin-row p {
  color: #607078;
  font-size: 13px;
  margin: 5px 0 0;
}

.admin-row a {
  color: #11675d;
  display: block;
  font-size: 13px;
  margin-top: 6px;
  overflow-wrap: anywhere;
}

.admin-empty,
.muted-text {
  color: #607078;
  font-size: 14px;
}

.row-actions {
  display: flex;
  gap: 8px;
}

@media (max-width: 900px) {
  .admin-grid,
  .admin-two-col,
  .admin-row {
    grid-template-columns: 1fr;
  }

  .row-actions {
    flex-wrap: wrap;
  }
}

.agent-layout {
  grid-template-columns: minmax(280px, 0.7fr) minmax(460px, 1.3fr);
}

.agent-meta {
  display: grid;
  gap: 8px;
}

.agent-meta p {
  border-bottom: 1px solid #edf2f4;
  display: grid;
  gap: 4px;
  margin: 0;
  padding-bottom: 8px;
}

.agent-meta strong {
  color: #526169;
  font-size: 12px;
}

.agent-meta span {
  color: #172026;
  overflow-wrap: anywhere;
}

.chat-empty {
  align-self: center;
  color: #75848b;
  font-size: 14px;
  margin: auto;
  max-width: 420px;
  text-align: center;
}

.capability-state {
  border-left: 3px solid #c94739;
  display: grid;
  gap: 6px;
  padding: 2px 0 2px 12px;
}

.capability-state > span,
.capability-state .capability-title-row + span {
  color: #607078;
  font-size: 13px;
}

.capability-title-row,
.workflow-head {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.skill-stage {
  background: #fff0dc;
  border-radius: 4px;
  color: #8a4f00;
  font-size: 12px;
  font-weight: 800;
  padding: 4px 7px;
  white-space: nowrap;
}

.skill-stage.enabled {
  background: #dff3e7;
  color: #126132;
}

.workflow-panel {
  background: #fafcfc;
  border-top: 1px solid #dce4e7;
  max-height: 52vh;
  overflow-y: auto;
  padding: 16px 18px;
}

.workflow-head {
  align-items: flex-start;
  margin-bottom: 14px;
}

.workflow-head h2 {
  font-size: 17px;
  margin: 4px 0 0;
}

.workflow-skill {
  color: #c94739;
  display: block;
  font-size: 12px;
  font-weight: 800;
}

.workflow-steps {
  display: grid;
  gap: 7px;
  margin-top: 14px;
}

.workflow-step {
  align-items: start;
  display: grid;
  gap: 9px;
  grid-template-columns: 26px minmax(0, 1fr);
}

.workflow-step strong {
  display: block;
  font-size: 13px;
}

.workflow-step p {
  color: #607078;
  font-size: 12px;
  line-height: 1.45;
  margin: 2px 0 0;
  overflow-wrap: anywhere;
}

.workflow-step.done .step-index {
  background: #dff3e7;
  color: #126132;
}

.workflow-step.active .step-index {
  background: #fff2d8;
  color: #7a4c00;
}

.workflow-step.failed .step-index {
  background: #fbe8e5;
  color: #a4372e;
}

.workflow-actions {
  align-items: end;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
  margin-top: 16px;
}

.workflow-actions p {
  color: #526169;
  font-size: 13px;
  grid-column: 1 / -1;
  margin: 0;
}

.task-input-label {
  min-width: 0;
}

.workflow-error {
  background: #fbe8e5;
  color: #a4372e;
  font-size: 13px;
  margin: 12px 0 0;
  padding: 9px 10px;
}

.badge.waiting_account,
.badge.ready_to_login,
.badge.collecting,
.badge.generating_report {
  background: #e6f1f5;
  color: #23627a;
}

.badge.report_ready {
  background: #dff3e7;
  color: #126132;
}

@media (max-width: 900px) {
  .agent-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .chat-panel {
    min-width: 0;
    order: 1;
    height: auto;
    max-height: none;
    min-height: 0;
  }

  .chat-messages {
    max-height: 42vh;
    min-height: 280px;
  }

  .settings-panel {
    min-width: 0;
    order: 2;
  }

  .muted-text {
    overflow-wrap: anywhere;
  }

  .workflow-actions {
    grid-template-columns: 1fr;
  }

  .workflow-actions button {
    width: 100%;
  }
}