:root {
  color-scheme: light;
  --page: #eaf3ff;
  --page-deep: #dfeeff;
  --card: #ffffff;
  --card-soft: #f8fbff;
  --text: #202633;
  --muted: #737d8c;
  --line: #e3e8f1;
  --line-strong: #cfd8e7;
  --accent: #3479f6;
  --accent-strong: #2464dc;
  --accent-soft: #e7f0ff;
  --danger: #c34032;
  --shadow: 0 16px 38px rgba(61, 104, 168, 0.18);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: #f7f9fd;
}

body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(circle at 0 0, rgba(52, 121, 246, 0.12), transparent 34%),
    linear-gradient(180deg, var(--page) 0%, var(--page-deep) 100%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
textarea {
  font: inherit;
}

.shell {
  width: min(420px, 100%);
  min-height: 100dvh;
  margin: 0 auto;
  padding: 10px 14px 28px;
}

.appHeader {
  padding: 2px 2px 10px;
}

.statusRow,
.navRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.statusRow {
  height: 24px;
  font-size: 17px;
  line-height: 1;
}

.statusRow span::before {
  content: "";
  display: inline-block;
  width: 62px;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, #232833 0 34px, transparent 34px 39px, #232833 39px 48px, transparent 48px 53px, #232833 53px);
  opacity: 0.9;
}

.navRow {
  height: 38px;
}

.navRow strong {
  font-size: 18px;
  line-height: 1;
}

.navRow span {
  min-width: 42px;
  color: #1f2937;
  font-size: 16px;
}

.navRow span:last-child {
  text-align: right;
}

.toolBanner {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  margin-bottom: 12px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 10px 24px rgba(59, 97, 151, 0.12);
}

.avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(145deg, #f3f6ff, #d9e8ff);
  color: var(--accent-strong);
  font-size: 18px;
  font-weight: 850;
  box-shadow: inset 0 0 0 1px rgba(52, 121, 246, 0.16);
}

.toolBanner strong {
  min-width: 0;
  font-size: 18px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.statusPill {
  display: inline-flex;
  align-items: center;
  max-width: 104px;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: #edf4ff;
  color: #58739c;
  font-size: 12px;
  font-weight: 750;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.statusPill.danger {
  background: #fff0ef;
  color: var(--danger);
}

.panel {
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid rgba(213, 222, 236, 0.95);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 8px 26px rgba(59, 97, 151, 0.08);
}

.loginPanel {
  padding: 14px 14px 16px;
  box-shadow: var(--shadow);
}

.titleRow,
.sectionHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 21px;
  line-height: 1.2;
}

h2 {
  font-size: 18px;
  line-height: 1.2;
}

.sectionHead span {
  color: var(--muted);
  font-size: 13px;
}

.sectionHead b {
  color: var(--text);
}

.helpButton {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border-color: #d7e5ff;
  background: linear-gradient(180deg, #f5f9ff, #e8f1ff);
  color: #3f6ea8;
  font-size: 13px;
}

.accountBox {
  margin-bottom: 14px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.boxLabel {
  margin-bottom: 10px;
  color: #384150;
  font-size: 15px;
  font-weight: 750;
}

.loginTabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  min-height: 40px;
  padding: 4px;
  border-radius: 10px;
  background: #f0f2f7;
  box-shadow: inset 0 0 0 1px #e1e6ef;
}

.tabButton {
  min-height: 32px;
  padding: 0 6px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #7a8393;
  font-size: 13px;
  font-weight: 750;
}

.tabButton.active {
  background: #fff;
  color: var(--accent-strong);
  box-shadow: 0 3px 10px rgba(67, 94, 135, 0.12);
}

.tabButton:disabled {
  opacity: 0.8;
}

.taskHint {
  margin-top: 13px;
  color: #616b7a;
  font-size: 14px;
  line-height: 1.45;
}

.field {
  display: block;
  margin: 0;
}

.field > span,
label,
summary {
  color: #313948;
  font-size: 14px;
  font-weight: 750;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  color: var(--text);
  background: #fff;
}

input {
  height: 48px;
  margin-top: 8px;
  padding: 0 12px;
  font-size: 16px;
}

textarea {
  min-height: 118px;
  margin-top: 8px;
  padding: 12px;
  resize: vertical;
  font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

input::placeholder,
textarea::placeholder {
  color: #9aa5b5;
}

input:focus,
textarea:focus {
  outline: 3px solid rgba(52, 121, 246, 0.16);
  border-color: var(--accent);
}

input:disabled,
textarea:disabled {
  background: #f4f6fa;
  color: var(--muted);
}

.loginGrid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;
  margin-top: 12px;
}

.loginMode.hidden {
  display: none;
}

#cookieLoginPanel button,
#startQrButton {
  width: 100%;
  margin-top: 10px;
}

.qrBox {
  display: grid;
  justify-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card-soft);
}

.qrBox.hidden {
  display: none;
}

.qrBox img {
  width: 180px;
  max-width: 100%;
  aspect-ratio: 1;
  border-radius: 10px;
  background: #fff;
}

.qrBox p {
  color: var(--muted);
  font-size: 13px;
}

.qrFallback {
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
}

.hint {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

summary {
  cursor: pointer;
  color: #626d7e;
}

details[open] summary {
  margin-bottom: 12px;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 12px;
}

button,
.button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 43px;
  padding: 0 14px;
  border: 1px solid var(--accent);
  border-radius: 9px;
  background: linear-gradient(180deg, #3f83ff, var(--accent));
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 120ms ease, filter 120ms ease, opacity 120ms ease;
}

button:hover,
.button:hover {
  filter: brightness(0.96);
}

button:active,
.button:active {
  transform: translateY(1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
  transform: none;
}

.secondary,
.ghost {
  background: #fff;
  color: var(--accent);
}

.secondary:hover,
.ghost:hover {
  color: var(--accent-strong);
}

.ghost {
  min-height: 34px;
  padding: 0 11px;
}

.compact {
  background: rgba(255, 255, 255, 0.86);
}

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

.conversationList {
  display: grid;
  gap: 8px;
}

.conversationList.empty {
  min-height: 110px;
  align-content: center;
  padding: 17px;
  border: 1px dashed #cbd7ea;
  border-radius: 10px;
  background: var(--card-soft);
  color: var(--muted);
}

.conversationList.empty strong {
  color: var(--text);
  font-size: 15px;
}

.conversationList.empty small {
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.45;
}

.conversation {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.conversation img {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  object-fit: cover;
  background: #edf4ff;
}

.conversation strong {
  display: block;
  font-size: 15px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.conversation small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.conversation button {
  grid-column: 1 / -1;
  width: 100%;
}

.progress {
  height: 9px;
  background: #e5ebf4;
  border-radius: 999px;
  overflow: hidden;
}

.estimateBox {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid #d6e3f6;
  border-radius: 12px;
  background: #f8fbff;
}

.estimateBox.hidden {
  display: none;
}

.estimateBox strong {
  font-size: 15px;
}

.estimateBox p {
  color: #5f6d80;
  font-size: 13px;
  line-height: 1.5;
}

.estimateBox textarea {
  min-height: 82px;
}

#progressBar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #5a93ff, var(--accent));
  transition: width 180ms ease;
}

#jobLog {
  min-height: 102px;
  max-height: 220px;
  overflow: auto;
  margin: 12px 0 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: #667085;
  font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
}

#jobLog:empty::before {
  content: "等待导出任务";
  color: #9aa5b5;
}

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

.downloadGrid .button {
  width: 100%;
}

.downloadGrid .button:first-child {
  grid-column: 1 / -1;
}

.hidden {
  display: none;
}

.danger {
  color: var(--danger);
}

@media (max-width: 360px) {
  .shell {
    padding-inline: 10px;
  }

  .actions,
  .downloadGrid {
    grid-template-columns: 1fr;
  }

  .downloadGrid .button:first-child {
    grid-column: auto;
  }
}
