:root {
  color-scheme: light;
  font-family: "Microsoft YaHei", Arial, sans-serif;
  background: #eef1f4;
  color: #18202a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 1px solid #b8c1cc;
  background: #ffffff;
  border-radius: 6px;
  min-height: 38px;
  padding: 0 14px;
  cursor: pointer;
}

button:hover {
  border-color: #536dfe;
}

input,
textarea {
  width: 100%;
  border: 1px solid #c8d0da;
  border-radius: 6px;
  padding: 10px;
  background: #fff;
}

textarea {
  min-height: 112px;
  resize: vertical;
}

pre {
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.app {
  min-height: 100vh;
  padding: 20px;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.toolbar h1 {
  margin: 0 0 6px;
  font-size: 24px;
}

.toolbar p {
  margin: 0;
  color: #5a6675;
}

.actions,
.gesture-row,
.grid {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) 380px;
  gap: 18px;
  align-items: start;
}

.device {
  display: grid;
  justify-items: center;
  gap: 14px;
}

.phone-frame {
  position: relative;
  width: min(430px, 100%);
  aspect-ratio: 9 / 19.5;
  border: 14px solid #15191f;
  border-radius: 28px;
  background: #10151c;
  overflow: hidden;
  box-shadow: 0 18px 45px rgba(24, 32, 42, 0.22);
}

#screen {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: none;
  background: #000;
  cursor: crosshair;
}

#emptyState {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 28px;
  text-align: center;
  color: #d5dbe4;
}

.panel {
  display: grid;
  gap: 14px;
}

.group {
  background: #ffffff;
  border: 1px solid #d7dde5;
  border-radius: 8px;
  padding: 14px;
}

.group h2 {
  margin: 0 0 10px;
  font-size: 16px;
}

.group > * + * {
  margin-top: 10px;
}

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

.log pre {
  min-height: 120px;
  max-height: 240px;
  margin: 0;
  color: #3f4b5a;
}

.app-list {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
}

.app-list button {
  display: block;
  width: 100%;
  min-height: 34px;
  text-align: left;
  font-size: 13px;
}

@media (max-width: 880px) {
  .toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .panel {
    width: 100%;
  }
}

.search-page {
  min-height: 100vh;
  padding: 24px;
  display: grid;
  place-items: start center;
}

.search-shell {
  width: min(920px, 100%);
  display: grid;
  gap: 18px;
}

.search-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  padding-top: 18px;
}

.search-header h1 {
  margin: 0 0 8px;
  font-size: 28px;
}

.search-header p,
.risk-note,
#durationText {
  margin: 0;
  color: #5a6675;
}

.control-link {
  color: #315bdc;
  text-decoration: none;
  white-space: nowrap;
  padding: 8px 0;
}

.control-link:hover {
  text-decoration: underline;
}

.search-form,
.result-panel {
  background: #fff;
  border: 1px solid #d7dde5;
  border-radius: 8px;
  padding: 18px;
}

.search-form label {
  display: block;
  font-weight: 700;
  margin-bottom: 10px;
}

.switch-row {
  display: inline-flex !important;
  align-items: center;
  gap: 10px;
  width: auto;
  margin: 14px 0 0 !important;
  color: #263241;
  cursor: pointer;
  user-select: none;
}

.switch-row input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.switch-track {
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: #c8d0da;
  padding: 3px;
  transition: background 160ms ease;
}

.switch-track span {
  display: block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(24, 32, 42, 0.24);
  transition: transform 160ms ease;
}

.switch-row input:checked + .switch-track {
  background: #1d4ed8;
}

.switch-row input:checked + .switch-track span {
  transform: translateX(20px);
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 104px;
  gap: 10px;
}

.search-row input {
  min-height: 46px;
}

.search-row button {
  min-height: 46px;
  background: #1d4ed8;
  border-color: #1d4ed8;
  color: #fff;
  font-weight: 700;
}

.search-row button:disabled,
.search-row input:disabled {
  opacity: 0.62;
  cursor: wait;
}

.result-panel {
  min-height: 360px;
}

.result-topline {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #e8edf4;
  color: #3f4b5a;
  font-size: 13px;
  font-weight: 700;
}

.status-badge[data-state="loading"] {
  background: #fff3c4;
  color: #735600;
}

.status-badge[data-state="done"] {
  background: #dff5e8;
  color: #166534;
}

.status-badge[data-state="error"] {
  background: #ffe4e6;
  color: #be123c;
}

#resultText {
  margin: 0;
  min-height: 280px;
  line-height: 1.72;
  color: #1f2937;
}

.references-block,
.answer-block {
  display: grid;
  gap: 10px;
}

.references-block {
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid #e5eaf0;
}

.references-block h2,
.answer-block h2 {
  margin: 0;
  font-size: 16px;
}

.muted-text {
  margin: 0;
  color: #5a6675;
}

.reference-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 22px;
  color: #263241;
  line-height: 1.58;
}

.reference-list:empty {
  display: none;
}

@media (max-width: 640px) {
  .search-page {
    padding: 16px;
  }

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

  .search-row {
    grid-template-columns: 1fr;
  }
}

.dashboard-body {
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(155, 184, 246, 0.5), rgba(176, 230, 239, 0.46) 46%, rgba(239, 244, 252, 0.92) 72%),
    #eef4fb;
  color: #20283a;
}

.dashboard-body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(118deg, transparent 0 38%, rgba(255, 255, 255, 0.26) 38.2% 38.8%, transparent 39%),
    repeating-linear-gradient(156deg, rgba(255, 255, 255, 0.16) 0 1px, transparent 1px 64px);
}

.ai-dashboard {
  position: relative;
  width: min(1160px, calc(100% - 36px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 22px 0 56px;
}

.workbench-header {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.workbench-header > div,
.workbench-header nav,
.history-tools,
.query-options {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #6d39ff;
  color: #fff;
  font-size: 13px;
  font-weight: 900;
}

.brand-title {
  font-size: 17px;
  font-weight: 900;
  color: #26314a;
}

.device-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border: 1px solid #cdd8ea;
  border-radius: 999px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.72);
  color: #607089;
  font-size: 13px;
  font-weight: 700;
}

.device-pill[data-state="online"] {
  border-color: #a6e3c0;
  background: #ecfff3;
  color: #187445;
}

.device-pill[data-state="offline"] {
  border-color: #ffd0d8;
  background: #fff1f3;
  color: #b4233f;
}

.header-link {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(119, 89, 255, 0.28);
  border-radius: 6px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.76);
  color: #5730c9;
  text-decoration: none;
  font-size: 13px;
  font-weight: 800;
}

.query-console,
.history-shell {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(109, 57, 255, 0.2);
  border-radius: 8px;
  box-shadow: 0 18px 48px rgba(61, 78, 126, 0.14);
  backdrop-filter: blur(12px);
}

.query-console {
  width: min(840px, 100%);
  margin: 4px auto 28px;
  padding: 12px;
  border-top: 3px solid #7d49ff;
}

.query-bar {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr) 108px;
  gap: 8px;
  margin-bottom: 12px;
}

.query-bar select,
.query-bar input {
  min-height: 38px;
  border-color: #e2e7f0;
  background: #f9fbff;
}

.query-bar select {
  border: 1px solid #e2e7f0;
  border-radius: 6px;
  padding: 0 10px;
  color: #44516a;
}

.query-bar button,
.history-tools button {
  border-color: #722cff;
  background: #722cff;
  color: #fff;
  font-weight: 800;
}

.provider-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(104px, 1fr));
  gap: 8px;
}

.provider-item {
  display: grid;
  justify-items: center;
  gap: 5px;
  min-height: 118px;
  border: 1px solid #e5e9f1;
  border-radius: 8px;
  padding: 10px 8px;
  background: #fff;
  color: #344055;
  cursor: pointer;
}

.provider-item input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.provider-item strong {
  font-size: 13px;
}

.provider-item small {
  color: #7b879a;
  font-size: 11px;
}

.provider-item em {
  border: 1px solid #ffd68a;
  border-radius: 999px;
  padding: 1px 7px;
  color: #c27600;
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
  background: #fff9e8;
}

.provider-item.is-selected {
  border-color: #8a4dff;
  box-shadow: inset 0 0 0 1px rgba(138, 77, 255, 0.18);
}

.provider-item.is-disabled {
  opacity: 0.66;
  cursor: not-allowed;
}

.provider-logo {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #fff;
  font-size: 13px;
  font-weight: 900;
}

.logo-blue { background: #1397ff; }
.logo-indigo { background: #6c7cff; }
.logo-green { background: #09bd77; }
.logo-violet { background: #5961e8; }
.logo-purple { background: #8d63ff; }
.logo-dark { background: #1e2430; }

.query-options {
  justify-content: flex-end;
  margin-top: 12px;
  color: #4f5d76;
  font-size: 13px;
  font-weight: 700;
}

.query-options label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.query-options input {
  width: 14px;
  height: 14px;
  accent-color: #722cff;
}

.history-shell {
  width: min(1060px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e8edf5;
}

.history-head h1 {
  margin: 0 0 4px;
  font-size: 17px;
}

.history-head p {
  margin: 0;
  color: #6b7790;
}

.history-tools button {
  min-height: 34px;
  border-radius: 6px;
}

.history-tools button:first-child {
  border-color: #d8e0ec;
  background: #fff;
  color: #526174;
}

.run-status {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 42px;
  margin: 12px 0;
  border-radius: 6px;
  padding: 8px 10px;
  background: #f6f8fc;
}

.run-status[data-state="loading"] {
  background: #fffaf0;
}

.history-table {
  overflow: hidden;
  border: 1px solid #e7ecf4;
  border-radius: 8px;
  background: #fff;
}

.table-head,
.row-main {
  display: grid;
  grid-template-columns: minmax(260px, 1.7fr) 76px 90px 70px 70px 92px 76px;
  align-items: center;
  gap: 10px;
}

.table-head {
  min-height: 44px;
  padding: 0 14px;
  background: #f5f7fb;
  color: #68758b;
  font-size: 12px;
  font-weight: 900;
}

.record-list {
  display: grid;
}

.empty-row {
  display: grid;
  justify-items: center;
  gap: 6px;
  min-height: 180px;
  place-content: center;
  color: #748099;
  background: #fbfdff;
}

.empty-row strong {
  color: #313b4f;
}

.record-row {
  border-top: 1px solid #edf1f6;
  background: #fff;
}

.record-row[data-status="running"] {
  background: #fffdf7;
}

.record-row[data-status="error"] {
  background: #fff8f9;
}

.row-main {
  min-height: 58px;
  padding: 8px 14px;
  color: #3a465b;
  font-size: 13px;
}

.question-cell {
  display: grid;
  gap: 5px;
}

.question-cell strong {
  font-size: 14px;
  line-height: 1.35;
  color: #20283a;
}

.record-type,
.record-state {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 800;
}

.record-type {
  background: #f2ecff;
  color: #6b2cff;
}

.record-state {
  background: #eef3fa;
  color: #536176;
  white-space: nowrap;
}

.record-row[data-status="done"] .record-state {
  background: #e9f9ef;
  color: #157347;
}

.record-row[data-status="error"] .record-state {
  background: #fff0f3;
  color: #b4233f;
}

.row-detail {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.85fr);
  border-top: 1px solid #edf1f6;
  background: #fff;
}

.row-detail section {
  padding: 14px 16px 16px;
}

.row-detail section + section {
  border-left: 1px solid #edf1f6;
  background: #fbfcff;
}

.row-detail h4 {
  margin: 0 0 8px;
  font-size: 14px;
}

.row-detail p {
  margin: 0 0 8px;
  color: #6f7a8e;
  font-size: 13px;
}

.row-detail pre {
  max-height: 280px;
  margin: 0;
  color: #273247;
  font-family: inherit;
  line-height: 1.68;
}

.row-detail ol {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 20px;
  color: #344055;
  line-height: 1.55;
}

.quick-dock {
  position: fixed;
  right: 18px;
  top: 48%;
  display: grid;
  overflow: hidden;
  border: 1px solid #e0e7f1;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 28px rgba(68, 82, 128, 0.16);
}

.quick-dock a,
.quick-dock button {
  min-width: 54px;
  min-height: 48px;
  border: 0;
  border-radius: 0;
  padding: 0 10px;
  display: grid;
  place-items: center;
  color: #40506a;
  background: transparent;
  text-decoration: none;
  font-size: 13px;
}

.quick-dock a {
  border-bottom: 1px solid #e8edf5;
}

@media (max-width: 900px) {
  .provider-strip {
    grid-template-columns: repeat(3, 1fr);
  }

  .table-head {
    display: none;
  }

  .row-main {
    grid-template-columns: 1fr 1fr;
  }

  .question-cell {
    grid-column: 1 / -1;
  }

  .row-detail {
    grid-template-columns: 1fr;
  }

  .row-detail section + section {
    border-left: 0;
    border-top: 1px solid #edf1f6;
  }
}

@media (max-width: 640px) {
  .ai-dashboard {
    width: min(100% - 20px, 1220px);
    padding-top: 16px;
  }

  .workbench-header,
  .history-head {
    align-items: stretch;
    flex-direction: column;
    height: auto;
  }

  .query-bar {
    grid-template-columns: 1fr;
  }

  .provider-strip {
    grid-template-columns: repeat(2, 1fr);
  }

  .quick-dock {
    display: none;
  }
}

/* Product workbench redesign */
.product-body {
  min-height: 100vh;
  background:
    linear-gradient(140deg, rgba(218, 230, 248, 0.96), rgba(230, 239, 248, 0.86) 46%, rgba(210, 234, 240, 0.82)),
    #e8eef7;
  color: #202636;
}

.product-body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(112deg, transparent 0 33%, rgba(255, 255, 255, 0.34) 33.2% 33.6%, transparent 33.8%),
    linear-gradient(154deg, transparent 0 62%, rgba(255, 255, 255, 0.24) 62.2% 62.6%, transparent 62.8%);
}

.product-app {
  position: relative;
  min-height: 100vh;
  display: block;
}

.app-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 22px 18px;
  background: rgba(255, 255, 255, 0.58);
  border-right: 1px solid rgba(125, 142, 170, 0.24);
  backdrop-filter: blur(18px);
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
}

.app-brand span {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #5138d8;
  color: #fff;
  font-weight: 900;
}

.app-brand strong {
  font-size: 17px;
  color: #1f2635;
}

.sidebar-nav {
  display: grid;
  gap: 6px;
}

.sidebar-nav a {
  min-height: 38px;
  display: flex;
  align-items: center;
  border-radius: 7px;
  padding: 0 12px;
  color: #5d687b;
  text-decoration: none;
  font-size: 14px;
  font-weight: 800;
}

.sidebar-nav a.is-active,
.sidebar-nav a:hover {
  background: #ffffff;
  color: #3825a7;
  box-shadow: 0 8px 20px rgba(74, 85, 119, 0.1);
}

.sidebar-card {
  margin-top: auto;
  display: grid;
  gap: 6px;
  border: 1px solid rgba(116, 132, 164, 0.22);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.68);
}

.sidebar-card span,
.sidebar-card small,
.topbar p,
.console-copy p,
.records-header p,
.task-question small {
  color: #6d7789;
}

.sidebar-card strong {
  color: #232b3a;
}

.app-main {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 24px 0 54px;
}

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

.topbar p,
.topbar h1,
.console-copy h2,
.records-header h2 {
  margin: 0;
}

.topbar h1 {
  margin-top: 3px;
  font-size: 27px;
  letter-spacing: 0;
}

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

.ghost-btn {
  min-height: 34px;
  border: 1px solid #d8e0eb;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.8);
  color: #435069;
  font-weight: 800;
}

.hero-console {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 18px;
  border: 1px solid rgba(107, 87, 220, 0.2);
  border-radius: 8px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 20px 48px rgba(75, 87, 124, 0.14);
  backdrop-filter: blur(14px);
}

.console-copy {
  border-right: 1px solid #e7ecf4;
  padding-right: 18px;
}

.console-copy h2 {
  font-size: 20px;
  line-height: 1.28;
}

.console-copy p {
  margin: 10px 0 0;
  line-height: 1.65;
}

.process-steps {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.process-steps span {
  position: relative;
  min-height: 34px;
  display: flex;
  align-items: center;
  border: 1px solid #e1e6f0;
  border-radius: 7px;
  padding: 0 12px 0 34px;
  background: #fbfcff;
  color: #344055;
  font-size: 13px;
  font-weight: 800;
}

.process-steps span::before {
  content: "";
  position: absolute;
  left: 13px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #5138d8;
  box-shadow: 0 0 0 4px rgba(81, 56, 216, 0.1);
}

.task-form {
  display: grid;
  gap: 14px;
}

.task-input {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) 108px;
  gap: 8px;
}

.task-input select,
.task-input input,
.task-input button {
  min-height: 40px;
  border-radius: 7px;
}

.task-input select {
  border: 1px solid #dfe6f0;
  padding: 0 10px;
  background: #fbfcff;
  color: #46536a;
}

.task-input button {
  border-color: #5138d8;
  background: #5138d8;
  color: #fff;
  font-weight: 900;
}

.provider-panel {
  display: grid;
  grid-template-columns: repeat(6, minmax(86px, 1fr));
  gap: 8px;
}

.provider-tile {
  display: grid;
  justify-items: center;
  gap: 5px;
  min-height: 116px;
  border: 1px solid #e3e8f1;
  border-radius: 8px;
  padding: 10px 7px;
  background: #fff;
  color: #2f3a4d;
}

.provider-tile input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.provider-tile.is-ready {
  border-color: #6f58ee;
  box-shadow: inset 0 0 0 1px rgba(111, 88, 238, 0.16), 0 10px 22px rgba(85, 75, 160, 0.1);
}

.provider-tile:not(.is-ready) {
  opacity: 0.62;
}

.provider-tile strong {
  font-size: 13px;
}

.provider-tile small {
  color: #7d8798;
  font-size: 11px;
}

.provider-tile em {
  border-radius: 999px;
  padding: 2px 7px;
  background: #f1edff;
  color: #5b3de0;
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
}

.provider-tile:not(.is-ready) em {
  background: #f3f5f8;
  color: #8a94a5;
}

.provider-logo {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #fff;
  font-size: 13px;
  font-weight: 900;
}

.run-options {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  color: #4e5a70;
  font-size: 13px;
  font-weight: 800;
}

.run-options label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.run-options input {
  width: 14px;
  height: 14px;
  accent-color: #5138d8;
}

.metrics-grid {
  display: grid;
  grid-template-columns: 180px minmax(260px, 1fr) 160px;
  gap: 12px;
  margin: 14px 0;
}

.metrics-grid > div {
  display: grid;
  gap: 5px;
  min-height: 72px;
  border: 1px solid rgba(131, 146, 174, 0.22);
  border-radius: 8px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.78);
}

.metrics-grid span {
  color: #718096;
  font-size: 12px;
  font-weight: 900;
}

.metrics-grid strong {
  align-self: end;
  color: #222b3c;
  font-size: 16px;
}

.records-workspace {
  border: 1px solid rgba(131, 146, 174, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 18px 44px rgba(75, 87, 124, 0.12);
  overflow: hidden;
}

.records-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid #e8edf5;
}

.records-header h2 {
  font-size: 18px;
}

.records-header p {
  margin: 4px 0 0;
}

.records-table {
  background: #fff;
}

.records-columns,
.task-row {
  display: grid;
  grid-template-columns: minmax(280px, 1.8fr) 78px 96px 72px 72px 78px;
  gap: 10px;
  align-items: center;
}

.records-columns {
  min-height: 42px;
  padding: 0 16px;
  background: #f6f8fb;
  color: #6d7789;
  font-size: 12px;
  font-weight: 900;
}

.task-record {
  border-top: 1px solid #edf1f6;
  background: #fff;
}

.task-record[data-status="running"] {
  background: #fffdf7;
}

.task-record[data-status="error"] {
  background: #fff8f9;
}

.task-row {
  min-height: 66px;
  padding: 10px 16px;
  color: #3d485c;
  font-size: 13px;
}

.task-question {
  display: grid;
  gap: 5px;
}

.task-question strong {
  color: #202636;
  font-size: 14px;
  line-height: 1.35;
}

.record-type,
.record-state {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  border-radius: 999px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 900;
}

.record-type {
  background: #f1edff;
  color: #5138d8;
}

.record-state {
  background: #eef2f7;
  color: #586477;
}

.task-record[data-status="done"] .record-state {
  background: #e9f8ef;
  color: #157347;
}

.task-record[data-status="error"] .record-state {
  background: #fff0f3;
  color: #b4233f;
}

.task-detail {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.9fr);
  border-top: 1px solid #edf1f6;
  background: #fff;
}

.task-detail section {
  padding: 15px 16px 17px;
}

.task-detail section + section {
  border-left: 1px solid #edf1f6;
  background: #fbfcff;
}

.task-detail h4 {
  margin: 0 0 8px;
  color: #202636;
  font-size: 14px;
}

.task-detail p {
  margin: 0 0 8px;
  color: #6d7789;
  font-size: 13px;
}

.task-detail pre {
  max-height: 320px;
  margin: 0;
  color: #273247;
  font-family: inherit;
  line-height: 1.7;
}

.task-detail ol {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 20px;
  color: #344055;
  line-height: 1.56;
}

.product-empty {
  display: grid;
  place-items: center;
  gap: 6px;
  min-height: 210px;
  color: #748095;
}

.product-empty strong {
  color: #2d3547;
}

@media (max-width: 1080px) {
  .product-app {
    grid-template-columns: 1fr;
  }

  .app-sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
  }

  .sidebar-nav {
    display: flex;
  }

  .sidebar-card {
    display: none;
  }

  .hero-console {
    grid-template-columns: 1fr;
  }

  .console-copy {
    border-right: 0;
    border-bottom: 1px solid #e7ecf4;
    padding: 0 0 14px;
  }
}

@media (max-width: 760px) {
  .app-main {
    width: min(100% - 24px, 1180px);
    padding-top: 16px;
  }

  .topbar,
  .records-header {
    align-items: stretch;
    flex-direction: column;
  }

  .task-input,
  .metrics-grid,
  .task-detail {
    grid-template-columns: 1fr;
  }

  .provider-panel {
    grid-template-columns: repeat(2, 1fr);
  }

  .records-columns {
    display: none;
  }

  .task-row {
    grid-template-columns: 1fr 1fr;
  }

  .task-question {
    grid-column: 1 / -1;
  }

  .task-detail section + section {
    border-left: 0;
    border-top: 1px solid #edf1f6;
  }
}

/* Clean homepage */
.home-body {
  min-height: 100vh;
  background:
    linear-gradient(140deg, rgba(223, 232, 246, 0.98), rgba(235, 241, 248, 0.92) 48%, rgba(215, 236, 241, 0.86)),
    #edf3f9;
  color: #202638;
}

.home-body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(115deg, transparent 0 38%, rgba(255, 255, 255, 0.28) 38.1% 38.5%, transparent 38.7%),
    linear-gradient(150deg, transparent 0 68%, rgba(255, 255, 255, 0.2) 68.1% 68.4%, transparent 68.6%);
}

.home-app {
  position: relative;
  width: min(1180px, calc(100% - 40px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px 0 56px;
}

.home-header,
.panel-heading,
.record-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.home-header {
  margin-bottom: 18px;
}

.home-kicker,
.panel-heading p,
.record-toolbar p,
.home-question small,
.home-record-detail p {
  margin: 0;
  color: #6d7789;
}

.home-header h1 {
  margin: 3px 0 0;
  font-size: 29px;
  line-height: 1.16;
  letter-spacing: 0;
}

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

.home-link,
.home-ghost {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  border: 1px solid #d6deea;
  border-radius: 7px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.78);
  color: #42506a;
  text-decoration: none;
  font-size: 13px;
  font-weight: 850;
}

.home-ghost:hover,
.home-link:hover {
  border-color: #8c7af0;
  color: #5138d8;
}

.command-panel,
.status-strip > div,
.record-panel {
  border: 1px solid rgba(128, 143, 170, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 18px 44px rgba(75, 87, 124, 0.12);
  backdrop-filter: blur(14px);
}

.command-panel {
  padding: 18px;
}

.panel-heading {
  padding-bottom: 16px;
  border-bottom: 1px solid #e8edf5;
}

.panel-heading h2,
.record-toolbar h2 {
  margin: 0 0 5px;
  font-size: 18px;
}

.flow-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.flow-inline span {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  border: 1px solid #e1e7f0;
  border-radius: 999px;
  padding: 0 10px;
  background: #fbfcff;
  color: #46536a;
  font-size: 12px;
  font-weight: 850;
}

.command-form {
  display: grid;
  gap: 14px;
  padding-top: 16px;
}

.command-row {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) 112px;
  gap: 8px;
}

.command-row select,
.command-row input,
.command-row button {
  min-height: 44px;
  border-radius: 7px;
}

.command-row select {
  border: 1px solid #dfe6f0;
  padding: 0 10px;
  background: #fbfcff;
  color: #46536a;
}

.command-row button {
  border-color: #5138d8;
  background: #5138d8;
  color: #fff;
  font-weight: 900;
}

.command-row button:disabled,
.command-row input:disabled {
  opacity: 0.65;
  cursor: wait;
}

.provider-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(108px, 1fr));
  gap: 8px;
}

.provider-chip {
  display: grid;
  justify-items: center;
  gap: 5px;
  min-height: 104px;
  border: 1px solid #e3e8f1;
  border-radius: 8px;
  padding: 10px 8px;
  background: #fff;
  color: #2f3a4d;
}

.provider-chip input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.provider-chip.is-ready {
  cursor: pointer;
}

.provider-chip.is-selected {
  border-color: #6f58ee;
  box-shadow: inset 0 0 0 1px rgba(111, 88, 238, 0.14), 0 10px 22px rgba(85, 75, 160, 0.1);
}

.provider-chip.is-disabled {
  opacity: 0.62;
}

.provider-chip strong {
  font-size: 13px;
}

.provider-chip em {
  border-radius: 999px;
  padding: 2px 7px;
  background: #f1edff;
  color: #5b3de0;
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
}

.provider-chip.is-disabled em {
  background: #f4f6f9;
  color: #8a94a5;
}

.mode-row {
  display: flex;
  justify-content: flex-end;
  gap: 14px;
  flex-wrap: wrap;
  color: #4e5a70;
  font-size: 13px;
  font-weight: 850;
}

.mode-row label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.mode-row input {
  width: 14px;
  height: 14px;
  accent-color: #5138d8;
}

.status-strip {
  display: grid;
  grid-template-columns: 180px minmax(280px, 1fr) 160px;
  gap: 12px;
  margin: 14px 0;
}

.status-strip > div {
  min-height: 72px;
  display: grid;
  gap: 5px;
  padding: 12px 14px;
  box-shadow: none;
}

.status-strip span {
  color: #718096;
  font-size: 12px;
  font-weight: 900;
}

.status-strip strong {
  align-self: end;
  color: #222b3c;
  font-size: 16px;
}

.record-panel {
  overflow: hidden;
}

.record-toolbar {
  padding: 16px 18px;
  border-bottom: 1px solid #e8edf5;
}

.record-table {
  background: #fff;
}

.record-columns,
.home-record-row {
  display: grid;
  grid-template-columns: minmax(300px, 1.8fr) 78px 96px 72px 72px 78px;
  gap: 10px;
  align-items: center;
}

.record-columns {
  min-height: 42px;
  padding: 0 16px;
  background: #f6f8fb;
  color: #6d7789;
  font-size: 12px;
  font-weight: 900;
}

.home-empty {
  min-height: 220px;
  display: grid;
  place-items: center;
  place-content: center;
  gap: 8px;
  color: #748095;
  text-align: center;
}

.home-empty strong {
  color: #2d3547;
  font-size: 16px;
}

.home-record {
  border-top: 1px solid #edf1f6;
  background: #fff;
}

.home-record[data-status="running"] {
  background: #fffdf7;
}

.home-record[data-status="error"] {
  background: #fff8f9;
}

.home-record-row {
  min-height: 66px;
  padding: 10px 16px;
  color: #3d485c;
  font-size: 13px;
}

.home-question {
  display: grid;
  gap: 5px;
}

.home-question strong {
  color: #202636;
  font-size: 14px;
  line-height: 1.35;
}

.home-record-detail {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.9fr);
  border-top: 1px solid #edf1f6;
  background: #fff;
}

.home-record-detail section {
  padding: 15px 16px 17px;
}

.home-record-detail section + section {
  border-left: 1px solid #edf1f6;
  background: #fbfcff;
}

.home-record-detail h3 {
  margin: 0 0 8px;
  color: #202636;
  font-size: 14px;
}

.home-record-detail pre {
  max-height: 320px;
  margin: 0;
  color: #273247;
  font-family: inherit;
  line-height: 1.7;
}

.home-record-detail ol {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 20px;
  color: #344055;
  line-height: 1.56;
}

@media (max-width: 900px) {
  .home-app {
    width: min(100% - 24px, 1180px);
  }

  .home-header,
  .panel-heading,
  .record-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .command-row,
  .status-strip,
  .home-record-detail {
    grid-template-columns: 1fr;
  }

  .provider-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .record-columns {
    display: none;
  }

  .home-record-row {
    grid-template-columns: 1fr 1fr;
  }

  .home-question {
    grid-column: 1 / -1;
  }

  .home-record-detail section + section {
    border-left: 0;
    border-top: 1px solid #edf1f6;
  }
}

@media (max-width: 560px) {
  .home-app {
    width: min(100% - 16px, 1180px);
    padding-top: 16px;
  }

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

/* Homepage layout pass */
.home-app {
  width: min(1360px, calc(100% - 48px));
}

.home-header {
  align-items: flex-end;
}

.home-header h1 {
  font-size: 30px;
}

.command-panel {
  padding: 16px;
}

.panel-heading {
  align-items: flex-start;
  padding-bottom: 14px;
}

.command-form {
  gap: 12px;
  padding-top: 14px;
}

.provider-row {
  grid-template-columns: repeat(6, minmax(120px, 1fr));
}

.provider-chip {
  min-height: 92px;
  align-content: center;
}

.provider-logo {
  width: 32px;
  height: 32px;
}

.status-strip {
  grid-template-columns: 170px minmax(360px, 1fr) 150px;
}

.record-panel {
  box-shadow: 0 22px 56px rgba(75, 87, 124, 0.13);
}

.record-toolbar {
  min-height: 74px;
}

.record-columns,
.home-record-row {
  grid-template-columns: minmax(360px, 1.8fr) 82px 92px 72px 72px 82px;
}

.home-record-row {
  min-height: 62px;
}

.home-record-detail {
  grid-template-columns: minmax(0, 1fr);
  max-height: none;
}

.home-record-detail section {
  min-height: 0;
  overflow: visible;
}

.home-record-detail pre {
  max-height: none;
  padding-right: 10px;
  font-size: 15px;
}

.home-record-detail section + section {
  border-left: 0;
  border-top: 1px solid #edf1f6;
  background: #f8faff;
}

.home-record-detail ol {
  gap: 10px;
  padding-left: 0;
  list-style: none;
}

.home-record-detail li {
  display: grid;
  gap: 5px;
  border: 1px solid #e5ebf4;
  border-radius: 7px;
  padding: 9px 10px;
  background: #fff;
}

.home-record-detail li span {
  color: #344055;
  font-weight: 750;
}

.home-record-detail li a,
.home-record-detail li small {
  min-width: 0;
  color: #5364d8;
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.home-record-detail li small {
  color: #8a95a8;
}

.citation-table {
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid #e1e7f0;
  border-radius: 8px;
  background: #fff;
}

.citation-head,
.citation-row {
  display: grid;
  grid-template-columns: 56px minmax(120px, 0.75fr) minmax(118px, 0.65fr) minmax(420px, 2fr) 112px;
  align-items: center;
  gap: 12px;
  min-width: 980px;
}

.citation-head {
  min-height: 42px;
  padding: 0 12px;
  border-bottom: 1px solid #e8edf5;
  background: #f7f9fd;
  color: #7a8597;
  font-size: 12px;
  font-weight: 900;
}

.citation-row {
  min-height: 58px;
  padding: 10px 12px;
  color: #344055;
  font-size: 13px;
}

.citation-row + .citation-row {
  border-top: 1px solid #edf1f6;
}

.citation-index,
.citation-date {
  color: #8a95a8;
  text-align: center;
}

.citation-site {
  min-width: 0;
  overflow: hidden;
  color: #5b6576;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.citation-type {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 26px;
  border-radius: 6px;
  padding: 0 8px;
  background: #f2edff;
  color: #5f39db;
  font-style: normal;
  font-weight: 850;
  white-space: nowrap;
}

.citation-title {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.citation-title a,
.citation-title strong {
  min-width: 0;
  color: #202638;
  font-weight: 800;
  line-height: 1.45;
  overflow-wrap: anywhere;
  text-decoration: none;
  white-space: normal;
}

.citation-title a:hover {
  color: #5138d8;
  text-decoration: underline;
}

.citation-title small {
  min-width: 0;
  color: #7e8aa0;
  font-size: 12px;
  overflow-wrap: anywhere;
  white-space: normal;
}

.citation-empty {
  display: grid;
  min-height: 54px;
  place-items: center;
  border: 1px solid #e1e7f0;
  border-radius: 8px;
  background: #fff;
  color: #8a95a8;
}

@media (max-width: 900px) {
  .home-app {
    width: min(100% - 24px, 1360px);
  }

  .provider-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .home-record-detail {
    max-height: none;
  }

  .home-record-detail section {
    min-height: 0;
    max-height: none;
  }

  .citation-table {
    overflow-x: auto;
  }

  .citation-head,
  .citation-row {
    min-width: 760px;
  }
}

/* Result card layout */
.record-table {
  background: #f7f9fd;
}

.record-columns {
  display: none;
}

.record-list {
  display: grid;
  gap: 18px;
  padding: 16px;
}

.home-record {
  overflow: hidden;
  border: 1px solid #e2e8f1;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 34px rgba(62, 76, 112, 0.08);
}

.home-record + .home-record {
  border-top: 1px solid #e2e8f1;
}

.home-record[data-status="running"] {
  background: #fff;
  border-color: #eadca8;
}

.home-record[data-status="error"] {
  background: #fff;
  border-color: #f1c4cb;
}

.home-record-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  border-bottom: 1px solid #edf1f6;
  background: #fbfcff;
}

.home-question {
  min-width: 0;
  gap: 6px;
}

.home-question strong {
  font-size: 16px;
  line-height: 1.45;
}

.record-meta {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 300px;
  color: #536075;
  font-size: 12px;
  font-weight: 850;
}

.record-meta > span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid #e2e8f1;
  border-radius: 999px;
  background: #fff;
}

.record-meta .record-state {
  border-color: #dce8f3;
  background: #eef3f8;
  color: #526174;
}

.home-record-detail {
  display: block;
  border-top: 0;
  background: #fff;
}

.home-record-detail section {
  padding: 0;
}

.home-record-detail section + section {
  border-left: 0;
  border-top: 1px solid #edf1f6;
}

.answer-card {
  padding: 20px 22px 24px;
}

.answer-card h3,
.source-card h3 {
  margin: 0;
  color: #1f2937;
  font-size: 15px;
  font-weight: 900;
}

.answer-card pre,
.answer-content {
  max-width: 1080px;
  margin: 12px 0 0;
  color: #263246;
  font-size: 15px;
  line-height: 1.85;
  white-space: pre-wrap;
  word-break: break-word;
}

.answer-content {
  display: grid;
  gap: 9px;
  white-space: normal;
}

.answer-content h4 {
  margin: 12px 0 2px;
  color: #172033;
  font-size: 15px;
  line-height: 1.7;
}

.answer-content h4:first-child {
  margin-top: 0;
}

.answer-content p {
  margin: 0;
  color: #263246;
  line-height: 1.85;
}

.answer-content .is-list {
  position: relative;
  padding-left: 18px;
}

.answer-content .is-list::before {
  position: absolute;
  left: 2px;
  top: 0.78em;
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: #64748b;
  content: "";
}

.source-card {
  padding: 14px 22px 18px;
  background: #f7f9fd;
}

.source-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}

.source-heading p {
  color: #7a8597;
  font-size: 13px;
}

.source-card.is-empty {
  padding-bottom: 14px;
}

.source-card.is-empty .source-heading {
  margin-bottom: 4px;
}

.source-card.is-empty .citation-empty {
  min-height: 38px;
  place-items: center start;
  border: 0;
  background: transparent;
  color: #8995a8;
  text-align: left;
}

.citation-table {
  border-radius: 8px;
}

@media (max-width: 900px) {
  .record-list {
    padding: 10px;
  }

  .home-record-head,
  .source-heading {
    display: grid;
  }

  .record-meta {
    justify-content: flex-start;
    min-width: 0;
  }

  .answer-card,
  .source-card {
    padding-left: 14px;
    padding-right: 14px;
  }
}
