﻿:root {
  --ink: #101828;
  --muted: #667085;
  --line: #d0d5dd;
  --paper: #ffffff;
  --soft: #f3f5f7;
  --brand: #0f766e;
  --brand-dark: #134e4a;
  --accent: #b45309;
  --blue: #175cd3;
  --warn: #9a3412;
}

* { box-sizing: border-box; }

html { min-width: 320px; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--soft);
  font-family: Arial, "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

a { color: inherit; text-decoration: none; }

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 28px;
  height: 100vh;
  padding: 28px 22px;
  background: #ffffff;
  border-right: 1px solid var(--line);
}

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

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 54px;
  height: 34px;
  overflow: hidden;
  background: #ffffff;
}

.brand-mark img {
  display: block;
  width: 54px;
  height: 34px;
  object-fit: contain;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong { font-size: 17px; }

.brand small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

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

.nav a {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 0 12px;
  border-left: 3px solid transparent;
  color: #344054;
  font-size: 14px;
  font-weight: 800;
}

.nav a:hover,
.nav a.active {
  border-left-color: var(--brand);
  background: #eef6f3;
  color: var(--brand-dark);
}

.sidebar-note {
  margin-top: auto;
  padding: 18px;
  border: 1px solid var(--line);
  background: #f8fafc;
}

.sidebar-note span,
.eyebrow,
.action-card span,
.report-list span {
  display: block;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.sidebar-note strong {
  display: block;
  margin-top: 8px;
  font-size: 18px;
}

.sidebar-note p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.main {
  min-width: 0;
  padding: clamp(28px, 4vw, 56px);
}

.main.narrow { max-width: 1180px; }

.main.work-main {
  width: 100%;
  max-width: 1520px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.eyebrow { margin: 0 0 10px; }

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

h1 {
  margin-bottom: 0;
  font-size: clamp(32px, 4vw, 54px);
  line-height: 1.12;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(24px, 2.7vw, 34px);
  line-height: 1.18;
  letter-spacing: 0;
}

.user-chip {
  min-width: 188px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: var(--paper);
  box-shadow: inset 3px 0 0 var(--brand);
  text-align: left;
}

.user-chip span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.user-chip strong {
  display: block;
  margin-top: 5px;
  color: var(--brand-dark);
  font-size: 15px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.summary-grid,
.action-grid,
.flow-grid {
  display: grid;
  gap: 14px;
}

.summary-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 34px;
}

.summary-card,
.action-card,
.flow-item,
.detail-panel,
.table-section,
.report-list article {
  border: 1px solid var(--line);
  background: var(--paper);
}

.summary-card {
  min-height: 132px;
  padding: 18px;
}

.summary-card span,
.flow-item span {
  display: block;
  color: var(--brand);
  font-weight: 900;
}

.summary-card strong,
.summary-card em,
.flow-item strong,
.flow-item em {
  display: block;
}

.summary-card strong {
  margin-top: 18px;
  font-size: 18px;
}

.summary-card em,
.flow-item em,
.action-card em,
.report-list em {
  margin-top: 8px;
  color: var(--muted);
  font-style: normal;
  line-height: 1.55;
}

.summary-card.ready { box-shadow: inset 4px 0 0 var(--brand); }
.summary-card.warning { box-shadow: inset 4px 0 0 var(--warn); }

.dashboard-activity {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.dashboard-activity article {
  min-height: 150px;
  padding: 20px;
  border: 1px solid var(--line);
  background: var(--paper);
}

.dashboard-activity span,
.dashboard-activity strong,
.dashboard-activity em {
  display: block;
}

.dashboard-activity span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
}

.dashboard-activity strong {
  margin-top: 12px;
  font-size: 20px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.dashboard-activity em {
  margin-top: 8px;
  color: var(--muted);
  font-style: normal;
  line-height: 1.55;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin: 26px 0 16px;
}

.section-head.compact { margin-top: 34px; }
.section-head.inline { margin: 0 0 16px; }

.action-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.action-card {
  display: grid;
  min-height: 170px;
  padding: 22px;
}

.action-card.primary {
  border-color: rgba(15, 118, 110, .5);
  background: #eef6f3;
}

.action-card strong {
  margin-top: 20px;
  font-size: 24px;
  line-height: 1.2;
}

.action-card:hover {
  border-color: var(--brand);
  transform: translateY(-1px);
}

.flow-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.flow-item {
  display: block;
  min-height: 118px;
  padding: 18px;
}

.flow-item.active {
  border-color: rgba(15, 118, 110, .5);
  box-shadow: inset 4px 0 0 var(--brand);
}

.flow-item.available {
  background: #ffffff;
}

.flow-item.available:hover {
  border-color: var(--brand);
  background: #eef6f3;
}

.flow-item.planned {
  background: #fbfcfd;
}

.flow-item.planned span,
.flow-item.planned strong {
  color: #344054;
}

.flow-item strong {
  margin-top: 16px;
  font-size: 17px;
  line-height: 1.25;
}

.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--brand-dark);
  font-size: 14px;
  font-weight: 900;
  white-space: nowrap;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.ghost-button.primary-link {
  border-color: rgba(15, 118, 110, .35);
  background: #eef6f3;
  color: var(--brand-dark);
}

.ghost-button.primary-link:hover {
  border-color: var(--brand);
  background: #dff3ed;
}

.detail-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 24px;
  padding: 28px;
  margin-bottom: 24px;
}

.detail-copy p:not(.eyebrow) {
  max-width: 760px;
  margin: 18px 0 0;
  color: var(--muted);
  line-height: 1.8;
}

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

.status-list div {
  padding: 14px;
  background: #f8fafc;
  border: 1px solid var(--line);
}

.status-list span,
.status-list strong {
  display: block;
}

.status-list span {
  color: var(--muted);
  font-size: 12px;
}

.status-list strong {
  margin-top: 5px;
  color: var(--blue);
}

.review-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 14px;
}

.review-form,
.review-result {
  border: 1px solid var(--line);
  background: var(--paper);
}

.review-form {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.review-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.review-form input,
.review-form select,
.review-form textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  background: var(--paper);
  padding: 0 14px;
  color: var(--ink);
  font: inherit;
  font-weight: 800;
}

.review-form textarea {
  min-height: 112px;
  padding-top: 12px;
  resize: vertical;
  line-height: 1.55;
}

.form-grid,
.score-grid {
  display: grid;
  gap: 12px;
}

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

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

.score-grid label {
  padding: 14px;
  border: 1px solid var(--line);
  background: #f8fafc;
}

.score-grid input[type="range"] {
  min-height: 28px;
  padding: 0;
}

.score-grid b {
  color: var(--brand);
  font-size: 20px;
}

.review-result {
  align-self: start;
  padding: 20px;
  box-shadow: inset 4px 0 0 var(--brand);
}

.review-result span,
.review-result strong,
.review-result p {
  display: block;
}

.review-result span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.review-result strong {
  margin-top: 14px;
  font-size: 24px;
  line-height: 1.2;
}

.review-result p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.review-result dl {
  display: grid;
  gap: 10px;
  margin: 18px 0 0;
}

.review-result dl div {
  padding: 12px;
  border: 1px solid var(--line);
  background: #f8fafc;
}

.review-result dt,
.review-result dd {
  margin: 0;
}

.review-result dt {
  color: var(--muted);
  font-size: 12px;
}

.review-result dd {
  margin-top: 5px;
  color: var(--ink);
  font-weight: 900;
}

.table-section {
  padding: 22px;
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
  line-height: 1.55;
}

th {
  color: #344054;
  background: #f8fafc;
  font-weight: 900;
  white-space: nowrap;
}

tr:last-child td { border-bottom: 0; }

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

.report-list article {
  padding: 20px;
}

.report-toolbar,
.task-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 210px;
  gap: 12px;
  margin-bottom: 14px;
}

.report-toolbar label,
.task-toolbar label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.report-toolbar input,
.report-toolbar select,
.task-toolbar input,
.task-toolbar select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  padding: 0 12px;
  font: inherit;
  font-size: 14px;
}

.task-source-status {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}

.source-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid #d5dce3;
  background: #fff;
  color: #667085;
  font-size: 12px;
}

.source-state b { color: #182230; }
.source-state.loaded { border-color: #9ecfc5; background: #f1f9f7; color: #087669; }
.source-state.empty { color: #667085; }
.source-state.timeout,
.source-state.failed { border-color: #e8c4b8; background: #fff7f4; color: #a43f23; }
.source-state.unauthorized { border-color: #ead5a5; background: #fffaf0; color: #9a6700; }

.report-card-list {
  grid-template-columns: 1fr;
}

.report-list article.clickable-report {
  cursor: pointer;
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.report-list article.clickable-report:hover {
  border-color: rgba(15, 118, 110, .45);
  box-shadow: inset 4px 0 0 var(--brand);
  transform: translateY(-1px);
}

.report-list strong {
  display: block;
  margin-top: 12px;
  font-size: 20px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.card-row b {
  color: #344054;
  font-size: 12px;
  white-space: nowrap;
}

.report-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.report-actions.compact {
  margin-top: 16px;
}

.open-report {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid rgba(15, 118, 110, .35);
  background: #eef6f3;
  color: var(--brand-dark);
  font-size: 14px;
  font-weight: 900;
}

.open-report:is(button) {
  cursor: pointer;
  font-family: inherit;
}

.open-report:hover {
  border-color: var(--brand);
  background: #dff3ed;
}

.open-report.secondary {
  border-color: rgba(23, 92, 211, .28);
  background: #eff4ff;
  color: var(--blue);
}

.open-report.secondary:hover {
  border-color: var(--blue);
  background: #dbeafe;
}

.open-report.subtle {
  border-color: var(--line);
  background: var(--soft);
  color: var(--ink);
}

.open-report.subtle:hover {
  border-color: rgba(15, 118, 110, .35);
  background: #fff;
}

.disabled-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: #f8fafc;
  color: var(--muted);
  font-size: 14px;
  font-weight: 900;
}

.task-overview,
.report-overview {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.task-overview {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

.task-overview div,
.report-overview div,
.task-card {
  border: 1px solid var(--line);
  background: var(--paper);
}

.task-overview div,
.report-overview div {
  min-height: 92px;
  padding: 18px;
}

.task-overview span,
.report-overview span,
.task-list span {
  display: block;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.task-overview strong,
.report-overview strong {
  display: block;
  margin-top: 12px;
  font-size: 30px;
}

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

.task-card {
  padding: 20px;
}

.work-main .task-card,
.work-main .report-card {
  min-height: 168px;
}

.work-main .report-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  align-items: start;
  column-gap: 24px;
}

.work-main .report-card .card-row,
.work-main .report-card strong,
.work-main .report-card em {
  grid-column: 1 / 2;
}

.work-main .report-card .report-actions {
  grid-column: 2 / 3;
  grid-row: 1 / 4;
  align-self: center;
  justify-content: flex-end;
}

.task-card.running { box-shadow: inset 4px 0 0 var(--blue); }
.task-card.complete { box-shadow: inset 4px 0 0 var(--brand); }
.task-card.error { box-shadow: inset 4px 0 0 var(--warn); }

.task-card strong {
  display: block;
  margin-top: 12px;
  font-size: 20px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.task-card em {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-style: normal;
  line-height: 1.55;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: #f8fafc;
  font-size: 12px;
  font-weight: 900;
}

.status-badge.running {
  border-color: rgba(23, 92, 211, .25);
  background: #eff4ff;
  color: var(--blue);
}

.status-badge.complete {
  border-color: rgba(15, 118, 110, .3);
  background: #eef6f3;
  color: var(--brand-dark);
}

.status-badge.error {
  border-color: rgba(154, 52, 18, .3);
  background: #fff7ed;
  color: var(--warn);
}

.progress-track {
  height: 8px;
  margin-top: 16px;
  overflow: hidden;
  background: #e5e7eb;
}

.progress-track i {
  display: block;
  height: 100%;
  background: var(--brand);
}

.task-card.running .progress-track i { background: var(--blue); }
.task-card.error .progress-track i { background: var(--warn); }

.task-card dl {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0 0;
}

.task-card dl div {
  padding: 12px;
  background: #f8fafc;
  border: 1px solid var(--line);
}

.task-card dt,
.task-card dd {
  margin: 0;
}

.task-card dt {
  color: var(--muted);
  font-size: 12px;
}

.task-card dd {
  margin-top: 5px;
  color: #344054;
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.mono-text {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.task-error {
  margin: 14px 0 0;
  padding: 12px;
  border: 1px solid rgba(154, 52, 18, .25);
  background: #fff7ed;
  color: var(--warn);
  font-size: 13px;
  line-height: 1.55;
}

.cost-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.login-body {
  display: grid;
  place-items: center;
  padding: 24px;
  background: #f3f5f7;
}

.login-shell {
  width: min(100%, 460px);
}

.login-panel,
.account-form {
  border: 1px solid var(--line);
  background: var(--paper);
}

.login-panel {
  display: grid;
  gap: 26px;
  padding: 28px;
}

.login-copy p:not(.eyebrow) {
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.login-form,
.account-form {
  display: grid;
  gap: 14px;
}

.account-form {
  padding: 22px;
}

.login-form label,
.account-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.login-form input,
.account-form input,
.account-form select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  padding: 0 12px;
  font: inherit;
  font-size: 14px;
}

.form-message {
  min-height: 20px;
  margin: 0;
  color: var(--warn);
  font-size: 13px;
  line-height: 1.55;
}

.form-message[data-type="info"] { color: var(--blue); }
.form-message[data-type="success"] { color: var(--brand-dark); }

.auth-chip nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.auth-chip a,
.auth-chip button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(23, 92, 211, .22);
  background: #eff4ff;
  color: var(--blue);
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.auth-chip button {
  border-color: var(--line);
  background: #f8fafc;
  color: #344054;
}

.auth-chip a:hover {
  border-color: var(--blue);
  background: #dbeafe;
}

.auth-chip button:hover {
  border-color: rgba(15, 118, 110, .35);
  color: var(--brand-dark);
}

.module-checks {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.module-checks label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: #f8fafc;
  color: #344054;
}

.module-checks input {
  width: auto;
  min-height: 0;
}

.auth-blocked {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.auth-blocked section {
  width: min(100%, 560px);
  padding: 28px;
  border: 1px solid var(--line);
  background: var(--paper);
}

@media (max-width: 1180px) {
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .action-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .flow-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .report-card-list { grid-template-columns: 1fr; }
  .review-layout { grid-template-columns: 1fr; }
}

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

  .sidebar {
    position: static;
    height: auto;
    padding: 20px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

  .topbar,
  .detail-panel {
    display: grid;
    grid-template-columns: 1fr;
  }

  .user-chip { text-align: left; }
  .summary-grid,
  .action-grid,
  .flow-grid,
  .dashboard-activity,
  .form-grid,
  .score-grid,
  .module-checks,
  .report-toolbar,
  .task-toolbar,
  .report-overview,
  .task-overview,
  .task-card dl { grid-template-columns: 1fr; }

  .work-main .report-card {
    display: block;
  }

  .work-main .report-card .report-actions {
    min-width: 0;
    justify-content: flex-start;
  }
}

@media (min-width: 641px) {
  .app-shell {
    display: grid !important;
    grid-template-columns: 280px minmax(0, 1fr) !important;
    min-height: 100vh !important;
  }

  .sidebar {
    position: sticky !important;
    top: 0 !important;
    width: 280px !important;
    height: 100vh !important;
    padding: 28px 22px !important;
    border-right: 1px solid var(--line) !important;
    border-bottom: 0 !important;
  }

  .nav {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 6px !important;
  }

  .main {
    min-width: 0 !important;
    padding: clamp(28px, 4vw, 56px) !important;
  }
}
