:root {
  color-scheme: light;
  --ink: #15201d;
  --muted: #66736f;
  --line: #dce4df;
  --panel: #ffffff;
  --soft: #f4f7f1;
  --mint: #4b8f78;
  --teal: #176b72;
  --rose: #c96567;
  --gold: #b98727;
  --blue: #4b6f9e;
  --shadow: 0 18px 48px rgba(25, 43, 38, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #eef3ee;
  color: var(--ink);
  font-family: "Microsoft JhengHei", "Noto Sans TC", Arial, sans-serif;
}

.home-shell {
  width: min(1120px, calc(100% - 36px));
  margin: 0 auto;
  min-height: 100vh;
  padding: 42px 0;
  display: grid;
  align-content: center;
  gap: 26px;
}

.home-hero {
  display: grid;
  gap: 32px;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.home-hero h1 {
  font-size: 36px;
}

.home-hero p {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.7;
}

.home-services .service-card {
  min-height: 280px;
}

button,
input,
select {
  font: inherit;
}

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

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

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

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

.face-mark {
  background: var(--rose);
}

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

.brand small {
  margin-top: 3px;
  color: var(--muted);
}

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

.nav-list a {
  padding: 11px 12px;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
}

.nav-list a:hover,
.nav-list a.active {
  color: var(--teal);
  background: #e7f0ec;
}

.client-panel {
  display: grid;
  gap: 14px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.client-panel label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.client-panel input,
.client-panel select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
  color: var(--ink);
}

.local-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.local-actions button {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
  color: var(--teal);
  cursor: pointer;
  font-weight: 700;
}

.local-actions button:first-child {
  border-color: var(--teal);
  color: #fff;
  background: var(--teal);
}

.save-status {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.workspace {
  min-width: 0;
  padding: 28px;
  display: grid;
  gap: 24px;
}

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

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

h1 {
  font-size: 30px;
  line-height: 1.25;
}

.topbar p,
.section-heading p,
.upload-panel p {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.6;
}

.primary-button {
  border: 0;
  border-radius: 8px;
  padding: 12px 18px;
  color: #fff;
  background: var(--teal);
  cursor: pointer;
  white-space: nowrap;
}

.face-button {
  background: var(--rose);
}

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

.service-card {
  min-height: 210px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  display: grid;
  align-content: space-between;
  gap: 16px;
}

.service-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.service-card h2 {
  font-size: 26px;
}

.service-card p {
  color: var(--muted);
  line-height: 1.65;
}

.service-card a {
  color: var(--teal);
  font-weight: 800;
  text-decoration: none;
}

.scalp-service {
  border-top: 5px solid var(--teal);
}

.face-service {
  border-top: 5px solid var(--rose);
}

.single-report {
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
}

.upload-panel,
.chart-panel,
.recommend-grid article,
.notice {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.upload-panel {
  padding: 18px;
  display: grid;
  gap: 16px;
}

.report-profile {
  padding: 20px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.summary-list {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px 18px;
  margin-top: 18px;
  align-items: center;
}

.summary-list span {
  color: var(--muted);
}

.summary-list strong {
  font-size: 24px;
}

.analysis-status {
  margin: 18px 0 0;
  padding: 12px;
  border-radius: 8px;
  color: var(--muted);
  background: var(--soft);
  line-height: 1.5;
}

.upload-box {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 260px;
  border: 1px dashed #aab8b3;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(75, 143, 120, 0.08), rgba(201, 101, 103, 0.08)),
    #fbfcfb;
  overflow: hidden;
  cursor: pointer;
}

.upload-box input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload-box span {
  position: relative;
  z-index: 1;
  color: var(--teal);
  font-weight: 700;
}

.upload-box img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.upload-box.has-image span {
  align-self: end;
  margin-bottom: 14px;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.summary-strip article,
.metric-card,
.timeline article {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.summary-strip span,
.summary-strip small {
  color: var(--muted);
}

.summary-strip strong {
  display: block;
  margin: 8px 0 4px;
  font-size: 24px;
  line-height: 1.25;
}

.analysis-layout,
.trend-section,
.recommend-section,
.care-section {
  display: grid;
  gap: 16px;
}

.care-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

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

.care-result strong {
  display: block;
  margin-top: 6px;
  font-size: 26px;
}

.care-result p {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.6;
}

.care-result button {
  border: 0;
  border-radius: 8px;
  padding: 11px 14px;
  color: #fff;
  background: var(--teal);
  cursor: pointer;
  white-space: nowrap;
}

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

.care-card {
  position: relative;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.care-card.recommended {
  border-color: var(--gold);
  outline: 3px solid rgba(185, 135, 39, 0.22);
}

.care-card.recommended::after {
  content: "建議";
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 5px 9px;
  border-radius: 999px;
  color: #fff;
  background: var(--gold);
  font-size: 12px;
  font-weight: 800;
}

.care-card span,
.care-card small {
  color: var(--muted);
}

.care-card h3 {
  margin-top: 10px;
  font-size: 34px;
}

.care-card p {
  margin-top: 10px;
  color: var(--ink);
  line-height: 1.55;
}

.care-card small {
  display: block;
  margin-top: 12px;
  line-height: 1.45;
}

.care-steps {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  padding: 14px;
  border-radius: 8px;
  background: #111714;
  color: #fff;
}

.care-steps article {
  padding: 12px;
  border-left: 1px solid rgba(255, 255, 255, 0.18);
}

.care-steps article:first-child {
  border-left: 0;
}

.care-steps strong {
  display: block;
  color: #f1bd66;
}

.care-steps span {
  display: block;
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.76);
  line-height: 1.5;
  font-size: 13px;
}

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

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

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

.mini-summary article {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.mini-summary span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.mini-summary strong {
  display: block;
  margin-top: 6px;
  color: var(--teal);
  font-size: 30px;
}

.metric-card {
  display: grid;
  gap: 12px;
  min-height: 152px;
}

.metric-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.metric-top strong {
  font-size: 16px;
}

.metric-value {
  color: var(--teal);
  font-size: 24px;
  font-weight: 800;
}

.bar {
  height: 8px;
  border-radius: 999px;
  background: #e6ece8;
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--mint);
}

.metric-note {
  color: var(--muted);
  line-height: 1.45;
  font-size: 14px;
}

.chart-panel {
  padding: 16px;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
}

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

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

.timeline strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
}

.timeline p {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.5;
}

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

.recommend-grid article {
  padding: 18px;
}

.recommend-grid ul {
  margin: 12px 0 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.7;
}

.notice {
  padding: 16px;
  color: #705015;
  background: #fff8e8;
  border-color: #ead59f;
  box-shadow: none;
}

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

  .sidebar {
    position: static;
    height: auto;
  }

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

  .nav-list a {
    text-align: center;
  }

  .summary-strip,
  .service-grid,
  .metric-grid,
  .recommend-grid,
  .care-grid,
  .care-steps,
  .timeline {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .care-result {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 680px) {
  .workspace {
    padding: 18px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  h1 {
    font-size: 24px;
  }

  .section-grid,
  .service-grid,
  .single-report,
  .summary-strip,
  .metric-grid,
  .recommend-grid,
  .care-grid,
  .care-steps,
  .timeline,
  .nav-list {
    grid-template-columns: 1fr;
  }

  .upload-box {
    min-height: 220px;
  }
}

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

  .sidebar,
  .primary-button {
    display: none;
  }

  .app-shell {
    display: block;
  }

  .workspace {
    padding: 0;
  }

  .upload-panel,
  .chart-panel,
  .recommend-grid article,
  .summary-strip article,
  .metric-card,
  .timeline article,
  .notice {
    box-shadow: none;
    break-inside: avoid;
  }
}
