:root {
  color: #17212b;
  background: #f4f6f8;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
}

button,
textarea,
input {
  font: inherit;
}

button,
.attachment-button {
  min-height: 44px;
}

button:focus-visible,
textarea:focus-visible,
input:focus-visible,
.attachment-button:focus-visible,
.attachment-button:has(#image-input:focus-visible) {
  outline: 3px solid rgba(24, 99, 160, 0.28);
  outline-offset: 2px;
}

.app-shell {
  width: min(760px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px 20px 132px;
  background: #fff;
}

.app-header,
.context-strip,
.quick-actions,
.composer-actions,
.card-header,
.card-footer {
  display: flex;
  align-items: center;
}

.app-header {
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-radius: 16px;
  color: #fff;
  background: linear-gradient(135deg, #10234a 0%, #173f7d 58%, #1a5fb4 100%);
  box-shadow: 0 8px 24px rgba(16, 35, 74, 0.22);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-logo {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
}

.eyebrow {
  margin: 0 0 4px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  letter-spacing: 0.14em;
}

h1 {
  margin: 0;
  color: #fff;
  font-size: 24px;
}

.mode-badge {
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
  font-size: 12px;
}

.demo-warning {
  margin: 12px 0 0;
  padding: 9px 12px;
  border: 1px solid #e2bc73;
  border-radius: 10px;
  color: #704a0b;
  background: #fff7e6;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.context-strip {
  align-items: stretch;
  gap: 1px;
  margin: 20px 0 12px;
  overflow: hidden;
  border: 1px solid #dfe5ea;
  border-radius: 12px;
  background: #dfe5ea;
}

.context-strip p {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 10px 12px;
  background: #f8fafb;
}

.context-strip span,
.context-strip strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.context-strip span {
  margin-bottom: 3px;
  color: #6c7780;
  font-size: 11px;
}

.context-strip strong {
  font-size: 13px;
  font-weight: 600;
}

.quick-actions {
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 12px;
}

.quick-actions button {
  flex: 0 0 auto;
  padding: 0 14px;
  border: 1px solid #cbd5dd;
  border-radius: 999px;
  color: #24435c;
  background: #fff;
  cursor: pointer;
}

.quick-actions button:hover {
  background: #f0f6fa;
}

.conversation {
  display: grid;
  gap: 12px;
  padding: 12px 0;
}

.welcome-message,
.message,
.fact-card,
.evidence-card,
.confirmation-card,
.notice-card {
  border: 1px solid #dfe5ea;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 4px 18px rgba(32, 49, 62, 0.06);
}

.welcome-message,
.notice-card {
  padding: 16px;
}

.welcome-message p,
.welcome-message small,
.notice-card p {
  margin: 0;
}

.welcome-message small {
  display: block;
  margin-top: 6px;
  color: #6c7780;
}

.candidate-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.document-item {
  min-width: 0;
  padding: 12px;
  border: 1px solid #dfe5ea;
  border-radius: 10px;
  overflow-wrap: anywhere;
}

.document-item + .document-item { margin-top: 12px; }
.document-item[data-status="EXCLUDED"] { opacity: 0.65; }
.document-item-status { color: #64717d; font-size: 13px; }
.document-row-form .exclude-button { margin-left: 8px; }
.document-item .field-grid input { min-width: 0; width: 100%; }

.candidate-choice {
  min-height: 38px;
  padding: 7px 12px;
  border: 1px solid #9fb8cb;
  border-radius: 999px;
  color: #164f7c;
  background: #f4f9fc;
  cursor: pointer;
}

.candidate-choice:hover {
  background: #e8f3fa;
}

.candidate-choice:disabled {
  cursor: wait;
  opacity: 0.6;
}

.message {
  justify-self: end;
  max-width: 82%;
  padding: 10px 14px;
  border-color: #cde0ef;
  background: #edf6fc;
}

.fact-card,
.evidence-card,
.confirmation-card {
  overflow: hidden;
}

.evidence-card .card-header {
  padding-bottom: 10px;
}

.card-status {
  color: #8b5e12;
  font-weight: 600;
}

.evidence-card .limitations {
  padding-top: 9px;
  padding-bottom: 9px;
}

.evidence-card .card-footer {
  flex-wrap: wrap;
  padding-top: 10px;
  padding-bottom: 10px;
}

.card-header,
.card-footer {
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
}

.card-header {
  border-bottom: 1px solid #edf0f2;
}

.card-header h2 {
  margin: 0;
  font-size: 17px;
}

.card-header span {
  color: #60717f;
  font-size: 12px;
}

.fact-list {
  display: grid;
  grid-template-columns: minmax(100px, 0.38fr) 1fr;
  margin: 0;
}

.fact-list dt,
.fact-list dd {
  margin: 0;
  padding: 9px 16px;
  border-bottom: 1px solid #f0f2f4;
}

.fact-list dt {
  color: #66737d;
  font-size: 13px;
}

.fact-list dd {
  overflow-wrap: anywhere;
  font-size: 14px;
  font-weight: 600;
}

.limitations {
  margin: 0;
  padding: 12px 16px;
  color: #7a5314;
  background: #fff8e8;
  font-size: 13px;
}

.card-footer {
  color: #65727c;
  font-size: 12px;
}

.copy-button,
.confirm-button,
.send-button {
  padding: 0 16px;
  border: 0;
  border-radius: 9px;
  color: #fff;
  background: #1863a0;
  cursor: pointer;
}

.confirmation-body {
  padding: 16px;
}

.attachment-name {
  margin: 0 0 0.75rem;
  color: #425466;
  overflow-wrap: anywhere;
}

.document-evidence {
  display: grid;
  gap: 0.5rem;
  padding: 0.75rem;
  border: 1px solid #d8dde3;
  border-radius: 0.5rem;
  background: #f4f6f8;
}

.document-evidence:empty {
  display: none;
}

.document-evidence p {
  margin: 0;
  overflow-wrap: anywhere;
}

.ocr-preview {
  display: block;
  width: min(100%, 280px);
  max-height: 180px;
  margin-bottom: 12px;
  border-radius: 8px;
  object-fit: contain;
  background: #f4f6f8;
}

.ocr-text {
  padding: 10px;
  border-radius: 8px;
  background: #f4f6f8;
  white-space: pre-wrap;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin: 14px 0;
}

.field-grid label {
  display: grid;
  gap: 5px;
  color: #5d6a74;
  font-size: 12px;
}

.field-grid input {
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid #cbd5dd;
  border-radius: 8px;
  color: #17212b;
  background: #fff;
}

.warning-list {
  color: #8b5e12;
  font-size: 13px;
}

.processing-stage {
  position: fixed;
  right: 20px;
  bottom: 112px;
  padding: 9px 12px;
  border-radius: 999px;
  color: #fff;
  background: #263746;
  box-shadow: 0 6px 18px rgba(23, 33, 43, 0.2);
  font-size: 13px;
}

.composer {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 12px 20px 18px;
  border-top: 1px solid #dfe5ea;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
}

.suggest-panel {
  position: absolute;
  right: 20px;
  bottom: calc(100% + 8px);
  left: 20px;
  display: grid;
  gap: 2px;
  max-height: 260px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid #cbd5dd;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(32, 49, 62, 0.14);
}

.suggest-panel[hidden] {
  display: none;
}

.suggest-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  color: #17212b;
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.suggest-option:hover,
.suggest-option:focus-visible {
  background: #f0f6fa;
}

.suggest-kind {
  flex: 0 0 auto;
  padding: 2px 8px;
  border-radius: 999px;
  color: #164f7c;
  background: #e8f3fa;
  font-size: 11px;
}

.suggest-kind.customer {
  color: #285c3c;
  background: #eaf6ee;
}

.suggest-label {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.suggest-empty {
  margin: 0;
  padding: 10px 12px;
  color: #6c7780;
  font-size: 13px;
}

.composer textarea {
  width: 100%;
  min-height: 54px;
  max-height: 140px;
  resize: vertical;
  padding: 12px;
  border: 1px solid #bdc9d2;
  border-radius: 12px;
  color: #17212b;
  background: #fff;
}

.composer-actions {
  gap: 8px;
}

.attachment-button {
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid #bdc9d2;
  border-radius: 9px;
  cursor: pointer;
}

#image-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  padding: 24px 16px;
  place-items: center;
  background: linear-gradient(160deg, #10234a 0%, #173f7d 60%, #1a5fb4 100%);
}

.login-card {
  display: grid;
  gap: 10px;
  width: min(420px, 100%);
  padding: 32px 28px;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(8, 20, 44, 0.35);
  text-align: center;
}

.login-logo {
  justify-self: center;
  width: 56px;
  height: 56px;
  border-radius: 14px;
}

.login-company,
.login-hint,
.login-error,
.login-note,
.login-beian {
  margin: 0;
}

.login-company {
  color: #6c7780;
  font-size: 12px;
  letter-spacing: 0.08em;
}

.login-card h1 {
  color: #17212b;
  font-size: 22px;
}

.login-hint {
  color: #4a5763;
  font-size: 14px;
}

.login-card form {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

.login-card input {
  min-height: 46px;
  padding: 10px 14px;
  border: 1px solid #bdc9d2;
  border-radius: 10px;
  text-align: center;
  letter-spacing: 0.12em;
}

.login-card .send-button {
  min-height: 46px;
}

.login-error {
  color: #a13232;
  font-size: 13px;
}

.login-note,
.login-beian,
.site-footer {
  color: #8a95a0;
  font-size: 12px;
}

.site-footer {
  margin-top: 28px;
  text-align: center;
}

.site-footer a,
.login-beian a {
  color: inherit;
  text-decoration: none;
}

.site-footer a:hover,
.login-beian a:hover {
  color: #173f7d;
  text-decoration: underline;
}

@media (max-width: 390px) {
  .app-shell {
    padding: 18px 14px 132px;
  }

  .app-header {
    padding: 14px;
  }

  .brand-logo {
    width: 34px;
    height: 34px;
  }

  h1 {
    font-size: 20px;
  }

  .eyebrow {
    font-size: 10px;
  }

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

  .context-strip p:last-child {
    grid-column: 1 / -1;
  }

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

  .fact-list {
    grid-template-columns: minmax(86px, 0.42fr) 1fr;
  }

  .fact-list dt,
  .fact-list dd {
    padding: 9px 12px;
  }

  .composer {
    grid-template-columns: 1fr;
    padding-right: 14px;
    padding-left: 14px;
  }

  .suggest-panel {
    right: 14px;
    left: 14px;
  }

  .composer-actions {
    justify-content: flex-end;
  }
}
