:root {
  --bg: #f6f8fb;
  --text: #172033;
  --muted: #64748b;
  --surface: #ffffff;
  --soft: #eaf2ff;
  --outline: #dbe4f0;
  --primary: #2563eb;
  --primary-strong: #1d4ed8;
  --success: #16a34a;
  --success-soft: #e9f8ef;
  --warning: #f59e0b;
  --warning-soft: #fff7ed;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --dark: #0f172a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans CJK SC", "Noto Sans SC", "Source Han Sans SC", "Alibaba PuHuiTi", "阿里巴巴普惠体", "Microsoft YaHei", sans-serif;
}

.sidebar {
  position: fixed;
  left: 24px;
  top: 24px;
  bottom: 24px;
  width: 300px;
  min-height: 720px;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--outline);
  border-radius: 24px;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.08);
  padding: 28px 14px 0;
  display: flex;
  flex-direction: column;
  z-index: 20;
}

.brand {
  text-align: center;
  font-weight: 900;
  font-size: 28px;
  line-height: 1.46;
  color: #0b1220;
}

.sidebar-new-project {
  width: 252px;
  min-width: 0;
  height: 50px;
  margin: 16px auto 0;
  border: 1px solid var(--primary);
  border-radius: 999px;
  background: #fff;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 17px;
  font-weight: 900;
}

.sidebar-new-project span:last-child {
  transform: translateX(-5px);
}

.sidebar-new-project:hover {
  background: var(--soft);
}

.plus-icon {
  position: relative;
  width: 18px;
  height: 18px;
  display: inline-block;
}

.plus-icon::before,
.plus-icon::after {
  content: "";
  position: absolute;
  left: 3px;
  right: 3px;
  top: 8px;
  height: 2px;
  border-radius: 1px;
  background: var(--primary);
}

.plus-icon::after {
  left: 8px;
  right: auto;
  top: 3px;
  width: 2px;
  height: 12px;
}

.history-title {
  margin: 38px 0 16px 8px;
  color: #94a3b8;
  font-size: 19px;
  line-height: 28px;
  font-weight: 900;
}

.case-list {
  display: grid;
  gap: 4px;
  min-height: 0;
  overflow: visible;
}

.case-item {
  position: relative;
  width: 268px;
  height: 40px;
  margin: 0 auto;
  border: 1px solid transparent;
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  display: flex;
  align-items: center;
  padding: 0 44px 0 14px;
  font-size: 16px;
  line-height: 24px;
  font-weight: 900;
  text-align: left;
  cursor: pointer;
}

.case-item:hover,
.case-item.active,
.case-item.menu-open {
  background: var(--soft);
  border-color: #d7e7ff;
}

.case-item:hover::before,
.case-item.active::before,
.case-item.menu-open::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 8px;
  width: 3px;
  height: 24px;
  border-radius: 999px;
  background: var(--primary);
}

.case-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.case-more {
  position: absolute;
  right: 10px;
  top: 5px;
  width: 30px;
  height: 30px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #94a3b8;
  opacity: 0;
  display: grid;
  place-items: center;
}

.case-item:hover .case-more,
.case-item.menu-open .case-more {
  opacity: 1;
}

.case-menu {
  position: absolute;
  left: 278px;
  top: -4px;
  width: 142px;
  padding: 9px 13px;
  border: 1px solid var(--outline);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.16);
  z-index: 5;
}

.case-menu button {
  width: 100%;
  height: 38px;
  min-width: 0;
  padding: 0 4px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  text-align: left;
  font-size: 15px;
  font-weight: 600;
}

.case-menu button:hover {
  background: #f8fafc;
}

.case-menu .delete-case-action {
  color: var(--danger);
  border-top: 1px solid #eef2f7;
  border-radius: 0;
}

.account-area {
  margin: auto -14px 0;
  min-height: 88px;
  border-top: 1px solid var(--outline);
  padding: 12px 10px;
}

.account-card {
  position: relative;
  height: 60px;
  border: 1px solid transparent;
  border-radius: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 5px 10px 5px 12px;
  color: var(--text);
}

.account-card:hover {
  background: var(--soft);
  border-color: #d7e7ff;
}

.avatar-circle {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 1px solid #dbe4f0;
  background: #f8fbff;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  overflow: hidden;
}

.avatar-img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.account-name {
  min-width: 0;
  font-size: 18px;
  line-height: 27px;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logout-btn {
  margin-left: auto;
  width: 34px;
  height: 34px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #94a3b8;
  opacity: 0;
}

.account-card:hover .logout-btn {
  opacity: 1;
}

.sidebar-login-btn {
  width: 125px;
  height: 50px;
  min-width: 0;
  margin: 6px auto 0;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--primary);
  border-radius: 999px;
  background: #fff;
  color: var(--primary);
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
  text-align: center;
}

.app {
  margin-left: 348px;
  padding: 34px 40px 56px;
}

.topbar {
  display: flex;
  justify-content: flex-end;
  gap: 24px;
  align-items: center;
}

.eyebrow {
  color: var(--primary);
  font-size: 13px;
  font-weight: 800;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.2;
}

h1 {
  margin-top: 8px;
  font-size: 34px;
  font-weight: 900;
}

h2 {
  font-size: 22px;
  font-weight: 900;
}

h3 {
  font-size: 18px;
  font-weight: 900;
}

p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

button {
  min-width: 112px;
  height: 48px;
  border: 0;
  border-radius: 999px;
  padding: 0 20px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

button.primary {
  background: var(--primary);
  color: white;
}

button.primary:hover {
  background: var(--primary-strong);
}

button.secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--outline);
}

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: rgba(246, 248, 251, 0.64);
  backdrop-filter: blur(1px);
}

.auth-overlay[hidden] {
  display: none;
}

.auth-card {
  width: 448px;
  min-height: 292px;
  padding: 12px 31px 8px;
  border: 0;
  background: #fff;
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.16);
}

.auth-card h1 {
  margin: 0 0 6px;
  color: #111111;
  text-align: center;
  font-size: 20px;
  line-height: 32px;
  font-weight: 500;
}

.auth-login-hint {
  margin: 0 0 14px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
  line-height: 1.6;
}

.auth-input {
  width: 100%;
  height: 48px;
  border: 0;
  border-radius: 4px;
  background: #f5f6fa;
  padding: 0 17px;
  color: #172033;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  outline: none;
}

.auth-input::placeholder {
  color: #b9bfcb;
  font-weight: 500;
}

.auth-code-row {
  position: relative;
  margin-top: 12px;
}

.auth-code-row .auth-input {
  padding-right: 128px;
}

.send-code-btn {
  position: absolute;
  right: 11px;
  top: 6px;
  width: 112px;
  min-width: 0;
  height: 36px;
  padding: 0;
  background: transparent;
  color: #aeb5c2;
  font-size: 14px;
  font-weight: 500;
}

.send-code-btn:not(:disabled) {
  color: var(--primary);
}

.send-code-btn:disabled {
  cursor: not-allowed;
}

.auth-options {
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #7d8490;
  font-size: 14px;
  font-weight: 400;
}

.remember-option,
.agreement-option {
  display: inline-flex;
  align-items: center;
}

.remember-option {
  gap: 8px;
}

.remember-option input {
  width: 13px;
  height: 13px;
  accent-color: #1a73e8;
}

.login-submit {
  width: 100%;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #1f7ceb;
  color: #fff;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 6px;
  text-align: center;
  text-indent: 6px;
}

.login-submit:hover {
  background: #176ed8;
}

.agreement-option {
  justify-content: center;
  width: 100%;
  margin-top: 10px;
  gap: 4px;
  color: #9aa0aa;
  font-size: 12px;
  font-weight: 400;
}

.agreement-option input {
  width: 12px;
  height: 12px;
  appearance: none;
  border: 1px solid #8791a0;
  border-radius: 50%;
  background: #fff;
}

.agreement-option input:checked {
  border-color: var(--primary);
  box-shadow: inset 0 0 0 4px #fff;
  background: var(--primary);
}

.agreement-option a {
  color: #1f7ceb;
  text-decoration: none;
}

.auth-notice {
  min-height: 14px;
  margin-top: 3px;
  text-align: center;
  color: var(--danger);
  font-size: 12px;
}

.workflow {
  display: flex;
  align-items: center;
  margin: 34px 0 28px;
  max-width: 760px;
}

.step {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-weight: 800;
}

.step b {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #cbd5e1;
  color: white;
}

.step.done b {
  background: var(--success);
}

.step.active {
  color: var(--primary);
}

.step.active b {
  background: var(--primary);
}

.line {
  width: 86px;
  height: 2px;
  background: var(--outline);
  margin: 0 18px;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 24px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--outline);
  border-radius: 24px;
  padding: 24px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 22px;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

button.action-primary {
  margin-left: -10px;
  color: #2563EB;
  background: #EAF2FF;
  border-color: #2088E1;
}

button.action-primary:hover:not(:disabled) {
  color: #2563EB;
  background: #EAF2FF;
  border-color: #2088E1;
}

.field-row {
  display: flex;
  gap: 12px;
}

.folder-picker {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.selection-hint {
  min-width: 140px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

input[type="text"] {
  height: 48px;
  flex: 1;
  border: 1px solid var(--outline);
  border-radius: 999px;
  padding: 0 18px;
  color: var(--text);
  font: inherit;
}

.auth-card input.auth-input {
  width: 100%;
  height: 48px;
  border: 0;
  border-radius: 4px;
  background: #f5f6fa;
  padding: 0 17px;
  color: #172033;
  font-size: 14px;
  font-weight: 500;
}

.auth-card .auth-code-row input.auth-input {
  padding-right: 128px;
}

.upload-box {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding: 18px;
  background: var(--bg);
  border: 1px dashed #b8c7dc;
  border-radius: 18px;
}

.upload-panel {
  position: relative;
  display: flex;
  padding: 0;
  overflow: hidden;
  border: 0;
}

.upload-dropzone {
  box-sizing: border-box;
  flex: 1;
  width: 100%;
  min-height: 520px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 86px 24px 72px;
  border: 1px dashed #2f66ff;
  border-radius: 24px;
  background: #fff;
  text-align: center;
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.upload-dropzone.is-dragging {
  background: #f8fbff;
  border-color: var(--primary);
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.16), 0 12px 32px rgba(37, 99, 235, 0.14);
}

.upload-dropzone.is-uploading {
  opacity: 0.72;
}

.upload-dropzone h2 {
  max-width: 100%;
  font-size: 28px;
  font-weight: 900;
  color: #111827;
  line-height: 1.25;
}

.upload-dropzone p {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 24px;
  margin: 0;
  max-width: 100%;
  color: #667796;
  font-size: 18px;
  font-weight: 500;
  line-height: 1.5;
}

.upload-task-title {
  position: absolute;
  left: 22px;
  top: 18px;
  color: #9ca3af;
  font-size: 20px;
  font-weight: 900;
  line-height: 1.25;
}

.upload-caution {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #8f98a8;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
}

.upload-caution span {
  width: 18px;
  height: 18px;
  border: 1.5px solid #c2c8d0;
  border-radius: 999px;
  color: #a6adb8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

.upload-main-btn {
  min-width: 176px;
  height: 58px;
  padding: 0 34px;
  border-radius: 999px;
  font-size: 18px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

.notice {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 18px;
  margin: 0;
  color: var(--muted);
  text-align: center;
}

.summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(92px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stat {
  padding: 14px;
  border: 1px solid var(--outline);
  border-radius: 16px;
  background: var(--surface);
  text-align: left;
}

.stat-label-row,
.stat-value-row {
  display: flex;
  align-items: center;
}

.stat-label-row {
  gap: 6px;
  min-height: 20px;
}

.stat-value-row {
  justify-content: space-between;
  gap: 10px;
}

.stat strong {
  display: block;
  margin-top: 4px;
  font-size: 24px;
  font-weight: 900;
}

.stat-button {
  width: 100%;
  min-width: 0;
  height: auto;
  color: var(--text);
}

.stat-button:hover,
.stat-button.active {
  border-color: var(--primary);
  background: var(--soft);
}

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

.stat-analysis {
  border-color: #d7e7ff;
  background: #fff;
}

.analysis-progress {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.analysis-spinner {
  width: 18px;
  height: 18px;
  border: 3px solid #d1d5db;
  border-top-color: transparent;
  border-radius: 999px;
  animation: analysis-spin 0.8s linear infinite;
  flex: 0 0 auto;
}

.analysis-percent {
  color: #095dff;
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
}

.analysis-warning {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: #f59e0b;
  color: #fff;
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
  cursor: default;
}

.analysis-warning-tip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  z-index: 12;
  width: max-content;
  max-width: 260px;
  padding: 8px 10px;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  background: #fff7ed;
  color: #9a3412;
  box-shadow: 0 10px 24px rgba(154, 52, 18, 0.14);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
  white-space: normal;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 4px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.analysis-warning:hover .analysis-warning-tip {
  opacity: 1;
  transform: translate(-50%, 0);
}

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

.doc-list {
  display: grid;
  gap: 10px;
  overflow: visible;
}

.doc-empty,
.doc-table-wrap {
  border: 1px solid var(--outline);
  border-radius: 14px;
  background: #fff;
}

.doc-empty {
  padding: 14px 16px;
}

.doc-table-wrap {
  max-height: 440px;
  overflow: auto;
}

.doc-table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
  table-layout: fixed;
}

.doc-table th,
.doc-table td {
  padding: 12px 10px;
  border-bottom: 1px solid #edf2f7;
  text-align: left;
  vertical-align: middle;
}

.doc-table tbody tr,
.doc-table tbody tr.is-locked {
  background: #fff;
}

.doc-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #f8fafc;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.doc-table tbody tr:last-child td {
  border-bottom: 0;
}

.doc-table tbody tr.is-locked {
  color: var(--muted);
}

.select-col {
  width: 44px;
  text-align: center !important;
}

.index-col {
  width: 58px;
  color: var(--muted);
  text-align: center !important;
  white-space: nowrap;
}

.time-col {
  width: 138px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.size-col {
  width: 104px;
  color: var(--muted);
  white-space: nowrap;
}

.status-col {
  width: 96px;
}

.delete-col {
  width: 78px;
  text-align: center !important;
}

.doc-table input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

.doc-table input[type="checkbox"]:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.table-sort {
  width: auto;
  min-width: 0;
  height: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font-size: inherit;
  font-weight: 900;
  text-align: left;
}

.table-sort:hover {
  color: var(--primary);
}

.doc-name {
  position: relative;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
}

.doc-name-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.doc-name-row .doc-name {
  min-width: 0;
}

.doc-size {
  flex: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.doc-retry-btn,
.doc-contact-required {
  flex: none;
}

.doc-contact-required {
  color: var(--danger);
  font-size: 12px;
  font-weight: 800;
}

.doc-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 74px;
  height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.badge.uploaded {
  color: var(--muted);
  background: #f1f5f9;
}

.badge.parsing {
  color: var(--primary);
  background: var(--soft);
}

.badge.queued {
  color: #92400e;
  background: #fef3c7;
}

.badge.parsed {
  color: var(--success);
  background: var(--success-soft);
}

.badge.failed {
  color: var(--danger);
  background: var(--danger-soft);
}

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

button.tiny {
  min-width: 54px;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12px;
}

button.danger {
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid #fecaca;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.report-panel {
  margin-top: 24px;
}

.report-download-footer {
  display: flex;
  justify-content: center;
  margin-top: 22px;
}

button.download-report-btn,
button.download-report-btn:hover {
  color: var(--primary);
  background: #fff;
  border: 1px solid var(--primary);
}

.report {
  min-width: 0;
}

.report-workspace {
  position: relative;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
  width: calc(100% + 272px);
  margin-left: -272px;
  min-width: 0;
}

.report-source-drawer {
  position: fixed;
  z-index: 200;
  top: 0;
  bottom: 0;
  right: 0;
  width: min(390px, calc(100vw - 24px));
  height: 100dvh;
  overflow-y: auto;
  padding: 28px 24px;
  border-left: 1px solid var(--outline);
  border-radius: 0;
  background: #fff;
  box-shadow: -12px 0 32px rgba(15, 23, 42, 0.12);
}

.report-source-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}

.report-source-head h2 {
  margin: 0;
  font-size: 20px;
}

.report-source-close {
  width: 32px;
  min-width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #64748b;
  font-size: 24px;
  font-weight: 400;
  line-height: 1;
}

.report-source-close:hover,
.report-source-close:focus-visible {
  background: #f1f5f9;
  color: #0f172a;
}

.report-source-content,
.source-current,
.source-candidates,
.source-candidate,
.source-derivation,
.source-components {
  display: grid;
  gap: 16px;
}

.source-current h3,
.source-candidates > h3,
.source-derivation h3,
.source-components h3 {
  margin: 0;
  color: #0f172a;
  font-size: 15px;
}

.source-detail-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  color: #64748b;
  font-size: 14px;
  line-height: 1.55;
}

.source-detail-row > span {
  color: #0f172a;
  font-weight: 800;
}

.source-detail-row > strong {
  min-width: 0;
  overflow-wrap: anywhere;
  color: #64748b;
  font-weight: 500;
}

.source-divider {
  height: 1px;
  margin: 6px 0;
  background: #e2e8f0;
}

.source-candidate {
  padding: 0 0 20px;
  border-bottom: 1px solid #edf2f7;
}

.source-candidate:last-child {
  border-bottom: 0;
}

.source-candidate-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.source-candidate-head h3 {
  margin: 0;
  font-size: 15px;
}

.source-selected-badge,
.source-apply-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  min-height: 28px;
  padding: 3px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
}

.source-selected-badge {
  border: 1px solid #22c55e;
  color: #16a34a;
  background: #f0fdf4;
}

.source-apply-btn {
  border: 1px solid #2563eb;
  color: #2563eb;
  background: #fff;
}

.source-apply-btn:hover,
.source-apply-btn:focus-visible {
  color: #2563eb;
  background: #eff6ff;
}

.source-empty {
  margin: 0;
  color: #94a3b8;
  font-size: 14px;
}

.source-error {
  margin: 0;
  color: #dc2626;
  font-size: 14px;
}

.source-section-head,
.source-component-head,
.source-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.source-section-head > span {
  color: #64748b;
  font-size: 13px;
}

.source-component {
  display: grid;
  gap: 10px;
  padding: 14px 0;
  border-bottom: 1px solid #edf2f7;
}

.source-component:last-of-type {
  border-bottom: 0;
}

.source-component-head {
  align-items: start;
}

.source-component-head h4 {
  margin: 0;
  color: #334155;
  font-size: 14px;
  font-weight: 700;
}

.source-component-head strong {
  max-width: 55%;
  overflow-wrap: anywhere;
  color: #0f172a;
  font-size: 14px;
  text-align: right;
}

.source-pagination button {
  min-height: 34px;
  padding: 5px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  color: #334155;
  font-weight: 700;
}

.source-pagination button:hover:not(:disabled),
.source-pagination button:focus-visible:not(:disabled) {
  border-color: #2563eb;
  color: #2563eb;
}

.source-pagination button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.report-sidebar {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 18px;
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--outline);
  border-radius: 16px;
  background: #fff;
}

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

.report-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: auto;
  min-width: 86px;
  height: 46px;
  padding: 0 16px;
  border: 1px solid var(--primary);
  border-radius: 999px;
  color: var(--primary);
  background: #fff;
  font-size: 14px;
  font-weight: 800;
}

.report-menu-btn:hover,
.report-menu-btn:focus-visible {
  border-color: var(--primary);
  color: var(--primary);
  background: #fff;
}

.report-menu-close {
  display: none;
}

.report-workspace.is-compact-nav {
  display: block;
  width: 100%;
  margin-left: 0;
}

.report-workspace.is-compact-nav .report-menu-btn {
  display: inline-flex;
}

.report-workspace.is-compact-nav .report-sidebar {
  position: absolute;
  z-index: 140;
  top: 88px;
  right: 22px;
  display: none;
  width: 250px;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  padding: 20px;
  border-radius: 16px;
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.18), 0 3px 10px rgba(15, 23, 42, 0.08);
}

.report-workspace.is-compact-nav.is-menu-open .report-sidebar {
  display: grid;
}

.report-workspace.is-compact-nav.is-menu-open.is-menu-pinned .report-sidebar {
  position: fixed;
  top: 20px;
  right: var(--report-menu-fixed-right, 22px);
}

.report-workspace.is-compact-nav .report-menu-close {
  position: absolute;
  z-index: 1;
  top: 8px;
  right: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  min-width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #64748b;
  background: transparent;
  font-size: 22px;
  line-height: 1;
}

.report-workspace.is-compact-nav .report-menu-close:hover,
.report-workspace.is-compact-nav .report-menu-close:focus-visible {
  color: #0f172a;
  background: #f1f5f9;
}

.report-workspace.is-compact-nav .report-nav {
  padding-right: 42px;
}

.report-workspace.is-compact-nav .report-nav-links {
  grid-template-columns: minmax(0, 1fr);
}

.report-nav,
.report-settings,
.report-section {
  border: 1px solid var(--outline);
  border-radius: 12px;
  background: #fff;
}

.report-nav {
  padding: 18px 16px;
}

.report-nav-links {
  display: grid;
  gap: 8px;
}

.nav-title {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.report-nav-links button {
  min-height: 34px;
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
  height: auto;
  padding: 6px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.35;
  text-align: left;
  white-space: normal;
}

.report-nav-links button:hover,
.report-nav-links button:focus-visible {
  color: var(--primary);
  background: transparent;
}

.report-settings {
  display: grid;
  gap: 14px;
  padding: 18px 16px;
}

.report-settings h3 {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.report-setting-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 28px;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.report-setting-row input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--primary);
}

.report-body {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.report-section {
  padding: 18px;
  scroll-margin-top: 20px;
}

.report-section h3 {
  margin-bottom: 14px;
}

.report-section-title {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
}

.report-ocr-notice {
  color: #f59e0b;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: 0;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.report-empty {
  margin: 0;
  padding: 48px 20px;
  color: #94a3b8;
  text-align: center;
}

.report-value-trigger {
  display: inline-block;
  max-width: 100%;
  min-width: 0;
  height: auto;
  min-height: 0;
  margin: -3px -5px;
  padding: 3px 5px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: inherit;
  font: inherit;
  line-height: inherit;
  text-align: inherit;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  vertical-align: top;
  cursor: pointer;
}

.report-value-trigger:hover,
.report-value-trigger:focus-visible {
  border-color: #f5c36b;
  background: #fff7e6;
  color: inherit;
}

.report-value-trigger.is-selected {
  border-color: #e8a33a;
  background: #fbd7a0;
  color: #422006;
}

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

.subsection:first-of-type {
  margin-top: 0;
}

.subsection h4 {
  margin: 0;
  font-size: 15px;
}

.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;
}

.partner-subsection {
  min-width: 0;
}

.partner-subtitle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.partner-subtitle-row h4 {
  min-width: 0;
  overflow-wrap: anywhere;
}

.partner-subtitle {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
}

.partner-title-year {
  display: inline-flex;
  align-items: center;
}

.partner-year-print {
  display: none;
}

.partner-year-control {
  flex: 0 0 auto;
  display: inline-flex;
}

.partner-year-control select {
  height: 28px;
  min-width: 84px;
  border: 1px solid var(--outline);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  padding: 0 28px 0 10px;
}

.report-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.report-summary .stat {
  padding: 12px;
}

.report-summary .stat strong {
  font-size: 20px;
}

.table-wrap {
  width: 100%;
  overflow-x: hidden;
  border: 1px solid #edf2f7;
  border-radius: 12px;
}

.table-wrap.is-scrollable {
  overflow-x: auto;
}

.report-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  table-layout: fixed;
}

.report-table th,
.report-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #edf2f7;
  text-align: left;
  vertical-align: top;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.report-table thead th {
  position: relative;
  background: #f8fafc;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.report-table thead th.narrow-col,
.report-table tbody td:first-child {
  white-space: nowrap;
}

.report-table thead th.narrow-col {
  width: 72px;
  text-align: center;
}

.compact-table tbody td:first-child {
  text-align: center;
}

.enterprise-credit-summary-table {
  min-width: 900px;
}

.enterprise-credit-summary-table th,
.enterprise-credit-summary-table td {
  border-right: 1px solid #edf2f7;
  text-align: center;
  vertical-align: middle;
}

.enterprise-credit-summary-table th:last-child,
.enterprise-credit-summary-table td:last-child {
  border-right: 0;
}

.enterprise-credit-summary-table thead tr:first-child th {
  color: var(--text);
}

.th-label {
  display: block;
  padding-right: 10px;
}

.report-table-sort {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: calc(100% - 10px);
  min-height: auto;
  padding: 0 10px 0 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  line-height: inherit;
  text-align: left;
}

.report-table-sort:hover,
.report-table-sort:focus-visible {
  color: #2563eb;
}

.report-table-sort-indicator {
  flex: 0 0 auto;
  color: #94a3b8;
  font-size: 12px;
}

.report-table-sort:hover .report-table-sort-indicator,
.report-table-sort:focus-visible .report-table-sort-indicator {
  color: currentColor;
}

.col-resizer {
  position: absolute;
  top: 0;
  right: 0;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  z-index: 2;
}

.col-resizer::after {
  content: "";
  position: absolute;
  top: 9px;
  bottom: 9px;
  left: 3px;
  width: 1px;
  background: transparent;
}

.col-resizer:hover::after,
.is-resizing-column .col-resizer::after {
  background: #cbd5e1;
}

.is-resizing-column {
  cursor: col-resize;
  user-select: none;
}

.report-table tbody th {
  width: 170px;
  font-weight: 900;
}

.report-table tr:last-child th,
.report-table tr:last-child td {
  border-bottom: 0;
}

.compact-table {
  min-width: 680px;
}

.income-comparison-subsection {
  margin-top: 24px;
}

.income-comparison-table {
  min-width: 760px;
}

.income-comparison-table th,
.income-comparison-table td {
  text-align: center;
  vertical-align: middle;
}

.income-comparison-table tbody th {
  background: #f8fafc;
  color: #334155;
  font-weight: 900;
  white-space: nowrap;
}

.income-comparison-table tbody th:first-child {
  width: 170px;
}

.empty-cell,
.muted {
  color: #DFDFDF;
}

.mini-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  height: 24px;
  border-radius: 999px;
  color: var(--muted);
  background: #f1f5f9;
  font-size: 12px;
  font-weight: 900;
}

.mini-status.ok {
  color: var(--success);
  background: var(--success-soft);
}

.report-paragraphs {
  min-height: 72px;
  padding: 14px;
  border: 1px solid #edf2f7;
  border-radius: 12px;
  color: var(--muted);
}

.intro-table {
  min-width: 0;
}

.intro-table thead th {
  color: var(--text);
  white-space: nowrap;
  text-align: left;
}

.report-table.intro-table tbody td,
.report-table.intro-table tbody td:first-child {
white-space: normal;
word-break: break-word;
overflow-wrap: anywhere;
line-height: 1.8;
color: var(--text);
}

.report-table.intro-table tbody td.empty-cell {
color: #DFDFDF;
}

@media (max-width: 1080px) {
  .sidebar {
    position: static;
    width: auto;
    min-height: auto;
    margin: 16px;
    padding-bottom: 14px;
  }

  .app {
    margin-left: 0;
    padding: 24px;
  }

  .case-list {
    max-height: 180px;
    overflow-y: auto;
  }

  .account-area {
    margin-top: 16px;
  }

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

  .report-shell {
    grid-template-columns: minmax(0, 1fr);
  }

}

@media (max-width: 720px) {
  .intro-table {
    min-width: 720px;
  }

  .topbar,
  .field-row,
  .folder-picker,
  .upload-box,
  .doc {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .workflow {
    overflow-x: auto;
  }

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

  button,
  input[type="text"] {
    width: 100%;
  }

  .auth-card {
    width: calc(100vw - 32px);
    padding: 12px 20px 8px;
  }

  .auth-card h1 {
    font-size: 20px;
  }

  .auth-input {
    height: 48px;
    font-size: 14px;
  }

  .auth-options {
    font-size: 13px;
  }

  .selection-hint {
    width: 100%;
  }
}

@media print {
  @page {
    size: A4;
    margin: 14mm 12mm;
  }

  body {
    background: #fff;
    color: #172033;
  }

  .sidebar,
  .topbar,
  .workflow,
  .grid,
  .report-sidebar,
  .report-nav,
  .partner-year-control,
  .download-report-btn,
  .report-download-footer {
    display: none !important;
  }

  .partner-year-print {
    display: inline;
  }

  .app {
    margin-left: 0;
    padding: 0;
  }

  .panel,
  .report-panel {
    box-shadow: none;
  }

  .report-panel {
    margin-top: 0;
    padding: 0;
    border: 0;
  }

  .panel-head {
    margin-bottom: 14px;
  }

  .report-shell {
    display: block;
  }

  .report-body {
    display: grid;
    gap: 12px;
  }

  .report-section {
    break-inside: avoid;
    page-break-inside: avoid;
    padding: 0;
    border: 0;
    border-radius: 0;
  }

  .table-wrap {
    overflow: visible !important;
    border-radius: 8px;
  }

  .report-table,
  .compact-table,
  .intro-table {
    min-width: 0 !important;
    width: 100% !important;
    font-size: 10px;
  }

  .report-table col.narrow-col-def {
    width: 3.25em !important;
  }

  .report-table th,
  .report-table td {
    padding: 6px 7px;
    line-height: 1.45;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  .report-table tbody td:first-child {
    white-space: normal;
  }

  .report-table thead th.narrow-col,
  .report-table tbody td.narrow-cell {
    width: 3.25em !important;
    min-width: 3.25em !important;
    max-width: 3.25em !important;
    padding-left: 4px;
    padding-right: 4px;
    white-space: nowrap;
    text-align: center;
  }

  .intro-table thead th {
    white-space: nowrap;
  }

  .intro-table tbody td {
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  .col-resizer {
    display: none;
  }
}

/* Two-level page layout */
.page-view[hidden],
.history-panel[hidden] {
  display: none !important;
}

.home-page {
  min-height: 100vh;
  padding: 12px 24px 24px;
  display: flex;
  flex-direction: column;
}

.home-header {
  position: relative;
  width: 100%;
  min-height: 82px;
  display: grid;
  grid-template-columns: minmax(96px, 1fr) auto minmax(96px, 1fr);
  align-items: start;
}

.home-header-spacer {
  min-width: 96px;
}

.home-brand {
  margin: 20px 0 0;
  color: #0b1220;
  font-size: 48px;
  line-height: 1.1;
  font-weight: 900;
  text-align: center;
  overflow-wrap: anywhere;
}

.home-brand.is-long-name {
  font-size: 40px;
}

.home-brand.is-very-long-name {
  font-size: 28px;
}

.top-account-area {
  min-width: 132px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.home-header .top-account-area {
  padding-top: 0;
}

.home-header-actions {
  min-width: 0;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}

.home-feedback-btn {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--outline);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 0 12px;
  font-weight: 800;
}

.home-feedback-btn:hover,
.home-feedback-btn:focus-visible {
  border-color: #9dbef7;
  color: var(--primary-strong);
  background: #f8fbff;
}

.home-feedback-btn svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.home-feedback-label-mobile {
  display: none;
}

.task-feedback-fab {
  position: fixed;
  right: 26px;
  bottom: 28px;
  z-index: 60;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid #c9daf9;
  border-radius: 50%;
  background: #fff;
  color: var(--primary);
  box-shadow: 0 10px 26px rgba(30, 64, 175, 0.18);
}

.task-feedback-fab[hidden] {
  display: none;
}

.task-feedback-fab:hover,
.task-feedback-fab:focus-visible {
  background: var(--primary);
  color: #fff;
}

.task-feedback-fab svg {
  width: 23px;
  height: 23px;
}

.task-feedback-tooltip {
  position: absolute;
  right: 56px;
  top: 50%;
  width: max-content;
  padding: 6px 9px;
  border-radius: 6px;
  background: #172033;
  color: #fff;
  font-size: 12px;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  transform: translate(6px, -50%);
  transition: opacity 120ms ease, transform 120ms ease;
}

.task-feedback-fab:hover .task-feedback-tooltip,
.task-feedback-fab:focus-visible .task-feedback-tooltip {
  opacity: 1;
  transform: translate(0, -50%);
}

.feedback-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.42);
}

.feedback-overlay[hidden] {
  display: none;
}

.feedback-dialog {
  width: min(560px, 100%);
  max-height: min(760px, calc(100vh - 40px));
  overflow-y: auto;
  border-radius: 8px;
  background: #fff;
  padding: 22px;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.22);
}

.feedback-dialog-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.feedback-dialog-head h2 {
  margin: 0;
  font-size: 22px;
}

.feedback-dialog-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.feedback-close-btn {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #64748b;
  font-size: 26px;
  line-height: 1;
}

.feedback-close-btn:hover {
  background: #f1f5f9;
  color: var(--text);
}

.feedback-field {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.feedback-field > span {
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
}

.feedback-field select,
.feedback-field textarea {
  width: 100%;
  border: 1px solid var(--outline);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
}

.feedback-field select {
  min-height: 44px;
}

.feedback-field textarea {
  min-height: 132px;
  resize: vertical;
  line-height: 1.6;
}

.feedback-field select:focus,
.feedback-field textarea:focus {
  border-color: #75a4f5;
  outline: 3px solid rgba(37, 99, 235, 0.1);
}

.feedback-field small {
  justify-self: end;
  color: var(--muted);
}

.feedback-upload-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.feedback-image-btn {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 8px;
}

.feedback-image-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.feedback-image-item {
  position: relative;
  min-width: 0;
}

.feedback-image-item img {
  width: 100%;
  aspect-ratio: 1;
  display: block;
  object-fit: cover;
  border: 1px solid var(--outline);
  border-radius: 6px;
}

.feedback-image-item span {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feedback-image-item button {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.78);
  color: #fff;
  line-height: 1;
}

.feedback-form-notice {
  min-height: 20px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.feedback-form-notice.is-error {
  color: var(--danger);
}

.feedback-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

.feedback-dialog-actions button {
  min-width: 92px;
  min-height: 42px;
  border-radius: 8px;
}

.top-login-btn {
  width: 82px;
  min-width: 82px;
  height: 34px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--primary);
  border-radius: 8px;
  background: #fff;
  color: var(--primary);
  display: grid;
  place-items: center;
  font-size: 14px;
  line-height: 1;
  font-weight: 900;
}

.top-login-btn:hover {
  background: var(--soft);
}

.top-account-card {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 3px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  transition: background 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.top-account-card:hover,
.top-account-card:focus-within {
  border-color: #d7e7ff;
  background: #fff;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.08);
}

.top-account-main {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-account-card .avatar-circle {
  width: 42px;
  height: 42px;
}

.top-account-card .account-name {
  max-width: 128px;
  font-size: 15px;
  line-height: 22px;
  font-weight: 800;
}

.top-account-card .logout-btn {
  width: 0;
  min-width: 0;
  height: 34px;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: var(--danger-soft);
  color: var(--danger);
  opacity: 0;
  font-size: 13px;
  font-weight: 800;
  transition: width 180ms ease, margin 180ms ease, padding 180ms ease, opacity 180ms ease;
}

.top-account-card:hover .logout-btn,
.top-account-card:focus-within .logout-btn {
  width: 76px;
  margin-left: 8px;
  padding: 0 12px;
  opacity: 1;
}

.home-content {
  width: min(820px, calc(100vw - 32px));
  margin: 44px auto 0;
  display: grid;
  gap: 28px;
}

.system-notice-banner {
  border: 1px solid #f1d48a;
  border-radius: 8px;
  background: #fff9e8;
  color: #7c5510;
  padding: 11px 14px;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.system-notice-banner[hidden] {
  display: none;
}

.home-beian {
  width: min(820px, calc(100vw - 32px));
  margin: auto auto 0;
  padding-top: 26px;
  display: flex;
  justify-content: center;
}

.home-beian a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #6b7280;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
  text-decoration: none;
}

.home-beian a:hover {
  color: #2563eb;
}

.home-beian img {
  width: 20px;
  height: 20px;
  object-fit: contain;
  flex: 0 0 auto;
}

.home-upload-panel {
  min-width: 0;
}

.home-page .upload-dropzone {
  min-height: 452px;
  padding: 96px 28px 72px;
  border-width: 1px;
  border-radius: 20px;
}

.home-page .upload-dropzone h2 {
  font-size: 26px;
}

.home-page .upload-task-title {
  left: 22px;
  top: 14px;
  font-size: 20px;
}

.home-page .upload-dropzone p {
  font-size: 16px;
}

.history-panel {
  min-height: 360px;
  padding: 16px 20px 22px;
  border: 1px solid #cbd5e1;
  border-radius: 20px;
  background: #fff;
}

.history-panel h2 {
  margin: 0 0 6px 6px;
  color: #8b95a5;
  font-size: 20px;
  line-height: 30px;
}

.case-list {
  display: grid;
  gap: 2px;
  max-height: none;
  overflow: visible;
}

.case-page-items {
  display: grid;
  gap: 2px;
}

.history-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 36px;
  margin-top: 14px;
}

.history-page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  min-width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  color: #2563eb;
  background: #fff;
  font-size: 22px;
  line-height: 1;
}

.history-page-btn:hover:not(:disabled),
.history-page-btn:focus-visible:not(:disabled) {
  border-color: #2088e1;
  background: #eaf2ff;
}

.history-page-btn:disabled {
  border-color: #e2e8f0;
  color: #cbd5e1;
  background: #f8fafc;
  cursor: not-allowed;
}

.history-page-status {
  min-width: 74px;
  color: #64748b;
  font-size: 13px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
}

.case-item {
  position: relative;
  width: 100%;
  height: 44px;
  margin: 0;
  padding: 0 58px 0 0;
  border: 1px solid transparent;
  border-radius: 9px;
  background: #fff;
}

.case-item:hover,
.case-item.active,
.case-item.menu-open {
  border-color: #d7e7ff;
  background: #f7faff;
}

.case-item:hover::before,
.case-item.active::before,
.case-item.menu-open::before {
  top: 9px;
  height: 24px;
}

.case-entry {
  width: 100%;
  min-width: 0;
  height: 42px;
  padding: 0 10px 0 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 118px;
  align-items: center;
  gap: 18px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.case-entry:hover {
  background: transparent;
}

.case-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
  line-height: 22px;
  font-weight: 800;
}

.case-date {
  color: #8b95a5;
  font-size: 14px;
  line-height: 22px;
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
}

.case-more {
  position: absolute;
  right: 8px;
  top: 6px;
  width: 46px;
  min-width: 0;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #6b7280;
  opacity: 0;
  font-size: 12px;
}

.case-item:hover .case-more,
.case-item.menu-open .case-more,
.case-more:focus-visible {
  opacity: 1;
}

.case-more:hover {
  background: #eaf2ff;
  color: var(--primary);
}

.case-menu {
  left: auto;
  right: 8px;
  top: 38px;
  width: 132px;
  padding: 7px;
  border-radius: 12px;
  z-index: 12;
}

.case-empty {
  padding: 24px 14px;
  color: #94a3b8;
  text-align: center;
  font-size: 14px;
}

.task-page {
  min-height: 100vh;
  padding: 8px 16px 56px;
}

.task-header {
  min-height: 54px;
  display: grid;
  grid-template-columns: 126px minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
}

.back-home-btn {
  width: 102px;
  min-width: 102px;
  height: 36px;
  padding: 0;
  border: 1px solid #b8c2cf;
  border-radius: 7px;
  background: #fff;
  color: #6b7280;
  font-size: 14px;
  font-weight: 700;
}

.back-home-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: #fff;
}

.task-title-wrap {
  min-width: 0;
  display: flex;
  align-items: center;
}

.task-name-text {
  width: auto;
  max-width: min(720px, 70vw);
  min-width: 0;
  height: 42px;
  padding: 0 5px;
  overflow: hidden;
  border: 0;
  border-bottom: 1px solid transparent;
  border-radius: 0;
  background: transparent;
  color: #111827;
  text-overflow: ellipsis;
  font-size: 28px;
  line-height: 40px;
  font-weight: 900;
  text-align: left;
}

.task-name-text:hover,
.task-name-text:focus-visible {
  border-bottom-color: #93c5fd;
  color: #111827;
  background: transparent;
}

.task-name-input {
  width: min(720px, 70vw);
  min-width: 240px;
  height: 42px;
  padding: 0 10px;
  border: 1px solid var(--primary);
  border-radius: 8px;
  background: #fff;
  color: #111827;
  font-size: 24px;
  line-height: 40px;
  font-weight: 900;
  outline: none;
}

.task-content {
  width: min(1680px, calc(100vw - 48px));
  margin: 0 auto;
  display: grid;
  gap: 28px;
}

.task-content .panel {
  padding: 22px;
  border-color: #cbd5e1;
  border-radius: 20px;
}

.task-content .status-panel {
  min-height: 480px;
}

.task-content .panel-head {
  margin-bottom: 18px;
  align-items: center;
}

.task-content .panel-head h2 {
  font-size: 24px;
}

.task-content .panel-actions {
  gap: 14px;
}

.task-content .panel-actions button {
  min-width: 112px;
  height: 46px;
}

button.add-materials-btn {
  border-color: var(--primary);
  color: var(--primary);
  background: #fff;
}

button.add-materials-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: #fff;
}

button.action-primary {
  margin-left: -10px;
}

.task-content .summary {
  grid-template-columns: repeat(6, minmax(104px, 1fr));
}

.task-content .doc-table-wrap {
  max-height: 560px;
}

.task-content .report-panel {
  min-height: 520px;
  margin-top: 0;
}

.notice {
  position: fixed;
  left: 50%;
  right: auto;
  bottom: 28px;
  z-index: 120;
  width: max-content;
  max-width: min(560px, calc(100vw - 32px));
  min-height: 40px;
  margin: 0;
  padding: 10px 18px;
  border: 1px solid #dbe4f0;
  border-radius: 10px;
  background: #fff;
  color: #475569;
  box-shadow: 0 12px 34px rgba(15, 23, 42, 0.14);
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.notice.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.notice.is-progress {
  top: 50%;
  bottom: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: min(360px, calc(100vw - 32px));
  min-height: 58px;
  padding: 15px 22px;
  border-radius: 16px;
  color: #0f172a;
  font-size: 15px;
  font-weight: 800;
  transform: translate(-50%, calc(-50% + 10px));
}

.notice.is-progress::before {
  content: "";
  width: 18px;
  height: 18px;
  border: 3px solid #dbe7ff;
  border-top-color: #2563eb;
  border-radius: 999px;
  animation: analysis-spin 0.85s linear infinite;
  flex: 0 0 auto;
}

.notice.is-progress.is-visible {
  transform: translate(-50%, -50%);
}

.notice.is-progress.is-error::before {
  display: none;
}

.notice.is-error {
  border-color: #fecaca;
  color: var(--danger);
  background: #fffafa;
}

@media (max-width: 960px) {
  .home-brand {
    font-size: 40px;
  }

  .task-header {
    grid-template-columns: 110px minmax(0, 1fr) auto;
    gap: 10px;
  }

  .task-name-text {
    max-width: 46vw;
    font-size: 23px;
  }

  .task-content {
    width: calc(100vw - 24px);
    margin: 0 auto;
  }

  .task-content .summary {
    grid-template-columns: repeat(3, minmax(104px, 1fr));
  }

  .report-workspace {
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
    margin-left: 0;
  }

  .report-sidebar {
    position: static;
    grid-template-columns: minmax(0, 1.35fr) minmax(240px, 0.65fr);
  }

  .report-nav-links {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .home-page {
    padding: 12px 12px 20px;
  }

  .home-header {
    min-height: 70px;
    grid-template-columns: 76px minmax(0, 1fr) 76px;
  }

  .home-brand {
    margin-top: 14px;
    font-size: 34px;
  }

  .home-brand.is-long-name {
    font-size: 28px;
  }

  .home-brand.is-very-long-name {
    font-size: 22px;
  }

  .home-header-spacer,
  .top-account-area,
  .home-header-actions {
    min-width: 76px;
  }

  .home-header-actions {
    gap: 4px;
  }

  .home-feedback-btn {
    position: absolute;
    top: 0;
    left: 0;
    width: 72px;
    min-width: 72px;
    height: 40px;
    min-height: 40px;
    justify-content: center;
    padding: 0;
  }

  .home-feedback-btn svg,
  .home-feedback-label-desktop {
    display: none;
  }

  .home-feedback-label-mobile {
    display: inline;
  }

  .feedback-dialog {
    padding: 18px;
  }

  .feedback-image-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .task-feedback-fab {
    right: 16px;
    bottom: 18px;
  }

  .top-login-btn {
    width: 72px;
    min-width: 72px;
  }

  .home-content {
    width: 100%;
    margin-top: 26px;
    gap: 18px;
  }

  .home-beian {
    width: 100%;
    padding-top: 18px;
  }

  .home-beian a {
    font-size: 12px;
  }

  .home-page .upload-dropzone {
    min-height: 340px;
    padding: 70px 18px 66px;
    gap: 14px;
  }

  .home-page .upload-dropzone h2 {
    font-size: 22px;
  }

  .home-page .upload-dropzone p {
    left: 18px;
    right: 18px;
    bottom: 18px;
    font-size: 14px;
  }

  .home-page .upload-task-title {
    left: 18px;
    top: 14px;
    font-size: 18px;
  }

  .upload-caution {
    gap: 7px;
    font-size: 14px;
  }

  .history-panel {
    min-height: 280px;
    padding: 14px 10px;
  }

  .history-pagination {
    margin-top: 10px;
  }

  .case-entry {
    grid-template-columns: minmax(0, 1fr) 92px;
    gap: 8px;
  }

  .case-date {
    font-size: 12px;
  }

  .task-page {
    padding: 8px 8px 36px;
  }

  .task-header {
    grid-template-columns: 92px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
  }

  .back-home-btn {
    width: 88px !important;
    min-width: 88px;
    height: 34px;
  }

  .task-title-wrap {
    min-width: 0;
  }

  .task-name-text,
  .task-name-input {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    height: 38px;
    font-size: 19px;
    line-height: 36px;
  }

  .task-header .top-account-area {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }

  .task-content {
    width: 100%;
    gap: 16px;
  }

  .task-content .panel {
    min-width: 0;
    padding: 16px 12px;
    border-radius: 14px;
  }

  .task-content .report-panel,
  .report-workspace,
  .report-sidebar,
  .report,
  .report-shell,
  .report-body,
  .report-section {
    min-width: 0;
    max-width: 100%;
  }

  .report-sidebar {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    padding: 12px;
    border-radius: 14px;
  }

  .report-source-drawer {
    left: 0;
    right: 0;
    width: auto;
    max-width: none;
    padding: 22px 18px;
  }

  .report-workspace.is-compact-nav .report-sidebar {
    top: 80px;
    right: 12px;
    width: min(250px, calc(100% - 24px));
  }

  .report-workspace.is-compact-nav.is-menu-open.is-menu-pinned .report-sidebar {
    top: 12px;
    right: var(--report-menu-fixed-right, 12px);
  }

  .report-nav,
  .report-settings {
    padding: 14px;
  }

  .report-nav-links {
    grid-template-columns: minmax(0, 1fr);
  }

  .report-section {
    overflow: hidden;
  }

  .task-content .panel-head {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }

  .task-content .panel-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .task-content .panel-actions button {
    width: 100%;
    min-width: 0;
    height: 40px;
    padding: 0 8px;
    font-size: 13px;
  }

  button.action-primary {
    margin-left: 0;
  }

  .task-content .summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .top-account-card .account-name {
    display: none;
  }

  .top-account-card:hover .logout-btn,
  .top-account-card:focus-within .logout-btn {
    width: 72px;
  }
}

@media print {
  .home-page,
  .task-header,
  .status-panel,
  .report-sidebar,
  .report-source-drawer,
  .notice,
  .task-feedback-fab,
  .feedback-overlay {
    display: none !important;
  }

  .task-page {
    display: block !important;
    min-height: 0;
    padding: 0;
  }

  .task-content {
    width: 100%;
    display: block;
  }

  .report-workspace {
    display: block !important;
  }
}
