:root {
  --bg: #f4f1ec;
  --surface: #ffffff;
  --surface-soft: #f7faf7;
  --ink: #202623;
  --muted: #65706b;
  --line: #dde5de;
  --accent: #286c60;
  --accent-strong: #173f39;
  --accent-soft: #e4f1ed;
  --warning-bg: #fff8ea;
  --warning: #8d5917;
  --danger: #a43b32;
  --shadow: 0 18px 48px rgba(32, 38, 35, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

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

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

.sidebar {
  border-right: 1px solid var(--line);
  background: #fbfaf7;
  padding: 24px;
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 24px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 22px;
  font-weight: 800;
}

.brand h1 {
  font-size: 18px;
  line-height: 1.25;
}

.brand p,
.section-head p,
.privacy-panel p,
.input-meta,
.status,
.coming-soon span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.project-panel,
.flow-panel,
.privacy-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.flow-panel {
  margin-bottom: 16px;
}

.privacy-panel {
  margin-top: 16px;
}

.history-panel {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  padding: 18px;
}

.account-panel {
  display: grid;
  gap: 14px;
  margin-top: 16px;
  padding: 18px;
}

.account-summary {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-soft);
  color: var(--muted);
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.55;
}

.account-summary.active {
  border-color: #b8d6ca;
  background: #edf7f3;
  color: var(--accent-strong);
}

.account-summary.warning {
  border-color: #edcf9d;
  background: var(--warning-bg);
  color: var(--warning);
}

.login-box,
.logged-in-box,
.packages-box,
.admin-points-box {
  display: grid;
  gap: 12px;
}

.admin-points-box {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
}

.grant-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
}

.small-primary {
  min-height: 40px;
  margin-top: 0;
}

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

.account-grid div {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-soft);
  padding: 10px;
}

.account-grid strong,
.packages-head strong {
  display: block;
  color: var(--accent-strong);
  font-size: 12px;
  line-height: 1.35;
}

.account-grid span,
.packages-head span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.point-packages {
  display: grid;
  gap: 8px;
}

.point-package {
  width: 100%;
  min-height: 58px;
  border: 1px solid var(--line);
  background: #fff;
  display: grid;
  justify-items: start;
  align-content: center;
  gap: 4px;
  text-align: left;
}

.point-package:hover {
  border-color: var(--accent);
  background: var(--surface-soft);
}

.point-package strong {
  color: var(--accent-strong);
  font-size: 14px;
}

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

.section-title {
  display: grid;
  gap: 4px;
}

.section-title h2 {
  font-size: 15px;
}

.flow-steps {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.flow-steps li {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.flow-steps span {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 900;
}

.flow-steps p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.client-profile-status {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-soft);
  color: var(--muted);
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.55;
}

.client-profile-status.active {
  border-color: #b8d6ca;
  background: #edf7f3;
  color: var(--accent-strong);
}

.client-profile-status.warning {
  border-color: #edcf9d;
  background: var(--warning-bg);
  color: var(--warning);
}

label {
  display: grid;
  gap: 7px;
  color: #39413d;
  font-size: 13px;
  font-weight: 800;
}

.field-help {
  margin-top: -6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  outline: none;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

input,
select {
  height: 40px;
  padding: 0 11px;
}

textarea {
  min-height: 390px;
  resize: vertical;
  padding: 14px;
  line-height: 1.75;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.main {
  min-width: 0;
  padding: 26px;
}

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

.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

.topbar h2 {
  margin-top: 4px;
  font-size: 28px;
  line-height: 1.25;
}

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

button {
  min-height: 38px;
  border-radius: 7px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  white-space: nowrap;
}

.primary {
  width: 100%;
  min-height: 48px;
  margin-top: 14px;
  background: var(--accent);
  color: #fff;
}

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

.ghost,
.coming-soon button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  text-decoration: none;
}

.pdf-action {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  box-shadow: 0 10px 22px rgba(42, 120, 101, 0.18);
}

.pdf-action:hover {
  background: var(--accent-strong);
}

.pdf-action:disabled {
  border-color: var(--line);
  background: #edf1ee;
  color: var(--muted);
  box-shadow: none;
}

.backup-action {
  color: var(--muted);
}

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

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

.workspace {
  display: grid;
  grid-template-columns: minmax(360px, 0.92fr) minmax(420px, 1.08fr);
  gap: 18px;
  align-items: start;
}

.transcript-panel,
.report {
  padding: 20px;
}

.section-head,
.report-toolbar,
.coming-soon,
.audio-upload {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

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

.section-head h3,
.report-toolbar h3 {
  font-size: 20px;
  line-height: 1.3;
}

.badge {
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.input-meta {
  justify-content: space-between;
  margin-top: 8px;
}

.coming-soon,
.audio-upload {
  align-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  margin-top: 14px;
  padding: 12px;
}

.coming-soon div,
.audio-upload > div:first-child {
  display: grid;
  gap: 2px;
}

.coming-soon strong,
.audio-upload strong {
  font-size: 14px;
}

.switch-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  margin-top: 8px;
}

.switch-line input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.consent-line {
  color: var(--ink);
  font-weight: 700;
}

.audio-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.file-button {
  position: relative;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  overflow: hidden;
  cursor: pointer;
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.status {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-soft);
  padding: 10px 12px;
  margin-top: 14px;
  white-space: pre-wrap;
  font-weight: 700;
}

.status.active {
  border-color: #a8d5ca;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.status.warning {
  border-color: #edcf9d;
  background: var(--warning-bg);
  color: var(--warning);
}

.status.error {
  border-color: #e7b3ad;
  background: #fff1ef;
  color: var(--danger);
}

.history-status {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  padding: 10px 12px;
}

.history-status.active {
  border-color: #b8d6ca;
  background: #edf7f3;
  color: var(--accent-strong);
}

.history-status.warning {
  border-color: #edcf9d;
  background: var(--warning-bg);
  color: var(--warning);
}

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

.history-empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  padding: 12px;
}

.history-item {
  width: 100%;
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 10px 11px;
  text-align: left;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.history-item:hover {
  border-color: #8eb9ac;
  box-shadow: 0 8px 24px rgba(37, 52, 47, 0.08);
  transform: translateY(-1px);
}

.history-item.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.history-item-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.history-item-title {
  font-size: 14px;
  font-weight: 800;
  line-height: 1.35;
}

.history-item-source {
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 800;
  padding: 4px 8px;
}

.history-item-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.history-item-client {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #52605b;
  font-size: 11px;
  line-height: 1.35;
}

.report {
  min-height: 720px;
}

.report-toolbar {
  margin-bottom: 16px;
  position: sticky;
  top: 14px;
  z-index: 5;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
}

.report-content {
  display: grid;
  gap: 16px;
}

.report-content.professional {
  gap: 20px;
}

.report-content.empty {
  min-height: 540px;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  padding: 24px;
}

.report-section {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.report-section:first-child {
  border-top: 0;
  padding-top: 0;
}

.report-section h4 {
  margin: 0 0 10px;
  color: var(--accent-strong);
  font-size: 16px;
}

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

.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-soft);
}

.metric strong {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
}

.metric span,
.report-section li,
.report-section p {
  color: #3f4743;
  font-size: 14px;
  line-height: 1.75;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 800;
}

ul {
  margin: 0;
  padding-left: 20px;
}

.report-cover {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: 18px;
  border: 1px solid #cddbd4;
  border-radius: 8px;
  background: linear-gradient(135deg, #f8faf7 0%, #ffffff 48%, #edf5f1 100%);
  padding: 20px;
}

.report-cover h4,
.chapter h4,
.report-section h4 {
  margin: 0;
  color: var(--accent-strong);
}

.report-cover h4 {
  margin-top: 8px;
  font-size: 26px;
  line-height: 1.25;
}

.report-cover p {
  margin-top: 12px;
  color: #4c5752;
  font-size: 14px;
  line-height: 1.8;
}

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

.executive {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 18px;
}

.section-kicker,
.chapter-label {
  width: fit-content;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 900;
}

.lead {
  margin-top: 12px;
  color: #34403a;
  font-size: 15px;
  line-height: 1.85;
}

.chapter {
  display: grid;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 20px;
}

.chapter h4 {
  font-size: 22px;
  line-height: 1.3;
}

.insight-grid {
  display: grid;
  gap: 12px;
}

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

.mini-panel,
.analysis-card,
.diagnosis-card,
.risk-column {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.mini-panel {
  padding: 14px 16px;
}

.mini-panel.wide {
  grid-column: 1 / -1;
}

.mini-panel h5,
.analysis-block h5,
.risk-column h5 {
  margin: 0 0 10px;
  color: var(--accent-strong);
  font-size: 15px;
}

.mini-panel li,
.risk-column li {
  color: #3f4743;
  font-size: 14px;
  line-height: 1.75;
}

.warning-panel {
  border-color: #edcf9d;
  background: #fff8ea;
}

.action-panel {
  border-color: #b8d6ca;
  background: #edf7f3;
}

.analysis-block {
  display: grid;
  gap: 12px;
}

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

.analysis-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  background: #fff;
}

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

.card-head strong {
  color: var(--ink);
  font-size: 15px;
}

.card-head span {
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 900;
}

.analysis-card p,
.evidence,
.recommendation {
  color: #3f4743;
  font-size: 14px;
  line-height: 1.75;
}

.evidence,
.recommendation {
  border-left: 3px solid #c9d9d2;
  padding-left: 10px;
}

.recommendation {
  border-left-color: var(--accent);
}

.evidence b,
.recommendation b {
  display: block;
  color: var(--accent-strong);
  font-size: 12px;
}

.diagnosis-band {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.diagnosis-card {
  padding: 13px;
  background: #fbfdfa;
}

.diagnosis-card span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.diagnosis-card strong {
  color: #26312c;
  font-size: 14px;
  line-height: 1.65;
}

.risk-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.risk-column {
  padding: 14px;
}

.risk-column.high {
  border-color: #e7b3ad;
  background: #fff1ef;
}

.risk-column.medium {
  border-color: #edcf9d;
  background: #fff8ea;
}

.risk-column.low {
  border-color: #b8d6ca;
  background: #edf7f3;
}

.appendix {
  background: #fbfaf7;
}

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

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 720px) {
  .sidebar,
  .main {
    padding: 16px;
  }

  .topbar,
  .section-head,
  .report-toolbar,
  .coming-soon,
  .audio-upload {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar h2 {
    font-size: 23px;
  }

  .actions,
  .audio-actions,
  .report-toolbar .actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .actions button,
  .audio-actions button,
  .audio-actions .file-button,
  .report-toolbar .actions button {
    width: 100%;
  }

  .report-toolbar {
    top: 8px;
    padding: 10px 0;
  }

  .transcript-panel,
  .report {
    padding: 16px;
  }

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

  .report-cover,
  .insight-grid.two,
  .analysis-grid,
  .diagnosis-band,
  .risk-board,
  .meta-grid {
    grid-template-columns: 1fr;
  }

  textarea {
    min-height: 280px;
  }
}

@media print {
  body {
    background: #fff;
  }

  .sidebar,
  .topbar,
  .transcript-panel,
  .report-toolbar .actions {
    display: none;
  }

  .app-shell,
  .workspace {
    display: block;
  }

  .main,
  .report {
    padding: 0;
  }

  .report {
    border: 0;
    box-shadow: none;
  }
}
