:root {
  font-family: Inter, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: #111316;
  background: #fff;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  --ink: #111316;
  --muted: #6a6f76;
  --line: #d8dce1;
  --gray: #f2f2f2;
  --white: #ffffff;
  --green: #164b3c;
  --space: clamp(76px, 10vw, 150px);
  --gutter: clamp(22px, 4.5vw, 72px);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--white); }
button, input { font: inherit; }
button { border: 0; cursor: pointer; }
button:focus-visible, input:focus-visible, .drop-zone:focus-within {
  outline: 2px solid rgba(22, 75, 60, .35);
  outline-offset: 3px;
}
button:disabled { cursor: not-allowed; opacity: 1; }

.tool-header {
  display: flex;
  min-height: 80px;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  padding: 0 var(--gutter);
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.tool-header__brand {
  color: var(--ink);
  font-size: 18px;
  font-weight: 620;
  letter-spacing: -.035em;
  flex: 0 0 auto;
}
.tool-header__project {
  margin: 0;
  color: var(--ink);
  font-size: 18px;
  font-weight: 520;
  letter-spacing: -.025em;
  text-align: right;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-shell {
  max-width: 1560px;
  margin: 0 auto;
  padding: clamp(42px, 5vw, 76px) var(--gutter) var(--space);
}
.workspace {
  display: grid;
  grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr);
  min-height: 760px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--white);
}
.upload-side, .results-side { padding: clamp(28px, 3.2vw, 50px); }
.upload-side {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--gray);
}
.drop-zone {
  display: flex;
  flex: 1;
  min-height: 560px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 42px 28px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, .54);
  text-align: center;
  transition: background .18s ease, border-color .18s ease;
}
.drop-zone.dragging { border-color: var(--green); background: var(--white); }
.drop-zone svg {
  width: 48px;
  margin: 0 0 24px;
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.55;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.drop-zone h2 {
  margin: 0 0 26px;
  color: var(--ink);
  font-size: clamp(25px, 2.5vw, 38px);
  font-weight: 570;
  letter-spacing: -.03em;
}
.drop-zone p { margin: 24px 0 5px; color: #40464d; font-size: 14px; }
.drop-zone span { color: var(--muted); font-size: 14px; }
.primary, .analyze, .download {
  min-height: 48px;
  padding: 0 27px;
  border: 1px solid var(--ink);
  border-radius: 9px;
  background: var(--ink);
  color: var(--white);
  font-size: 14px;
  font-weight: 600;
  transition: background .18s ease, border-color .18s ease, opacity .18s ease;
}
.primary:hover, .analyze:hover, .download:hover { border-color: #2e3135; background: #2e3135; }
.primary:disabled, .analyze:disabled, .download:disabled {
  border-color: var(--line);
  background: #e4e7e9;
  color: #858a90;
  opacity: 1;
}
.preview {
  height: auto;
  width: min(72%, 360px);
  max-height: 330px;
  margin-top: 25px;
  border: 1px solid var(--line);
  background: var(--white);
  object-fit: contain;
}
.analyze { width: min(360px, 100%); margin: 24px auto 0; }
.error, .warning { margin: 14px 0 0; color: #a63a3a; font-size: 14px; line-height: 1.55; text-align: center; }

.results-side { display: flex; flex-direction: column; }
.status-line {
  display: flex;
  min-height: 38px;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-size: 17px;
  font-weight: 590;
}
.status-dot {
  display: grid;
  width: 29px;
  height: 29px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: #e4e7e9;
  color: var(--white);
}
.status-dot.done { background: var(--green); }
.zero-notice {
  margin: 14px 0 0;
  padding: 13px 15px;
  border-left: 1px solid var(--line);
  background: var(--gray);
  color: #976426;
  font-size: 14px;
  line-height: 1.55;
}
.results-grid {
  display: grid;
  grid-template-columns: minmax(168px, 205px) minmax(280px, 1fr);
  gap: clamp(26px, 3vw, 48px);
  min-height: 430px;
  padding: 26px 0 22px;
}
.metrics { display: flex; flex-direction: column; }
.metric { padding: 18px 4px 23px; border-bottom: 1px solid var(--line); }
.metric-label { display: flex; align-items: center; gap: 12px; font-size: 17px; font-weight: 580; }
.legend { width: 11px; height: 11px; border-radius: 50%; }
.legend.green { background: #164b3c; }
.legend.red { background: #c84a40; }
.metric strong, .metric input {
  display: block;
  width: 100%;
  padding: 15px 0 5px;
  border: 0;
  background: transparent;
  color: #164b3c;
  font-size: clamp(42px, 4.1vw, 70px);
  font-weight: 620;
  line-height: 1;
}
.metric:nth-child(2) strong, .metric:nth-child(2) input, .metric:nth-child(2) b { color: #c84a40; }
.metric b { color: #164b3c; font-size: 14px; font-weight: 570; }
.total { padding: 24px 4px; }
.total span { display: block; font-size: 14px; font-weight: 560; }
.total strong { display: block; margin-top: 10px; font-size: clamp(25px, 2.5vw, 38px); font-weight: 600; }
.chart {
  position: relative;
  display: flex;
  min-width: 250px;
  align-items: flex-end;
  justify-content: center;
  padding: 14px 15px 20px 58px;
  border-bottom: 1px solid var(--line);
}
.axis {
  position: absolute;
  top: 15px;
  bottom: 49px;
  left: 6px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: var(--muted);
  font-size: 14px;
}
.bar {
  display: flex;
  width: min(190px, 68%);
  height: 340px;
  align-self: flex-start;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  background: #e8eaec;
}
.bar > div {
  display: grid;
  width: 100%;
  place-items: center;
  color: var(--white);
  font-size: clamp(25px, 2.5vw, 38px);
  font-weight: 620;
  transition: height .18s ease;
}
.rest-segment { background: #c84a40; }
.work-segment { background: #164b3c; }
.chart p { position: absolute; bottom: -2px; margin: 0; color: var(--muted); font-size: 14px; }
.review { padding-top: 20px; border-top: 1px solid var(--line); }
.review h2 { margin: 0 0 14px; font-size: 17px; font-weight: 590; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 12px 14px; border: 1px solid var(--line); text-align: left; }
th { background: var(--gray); font-weight: 580; }
th:not(:first-child), td:not(:first-child) { text-align: center; }
.download { min-width: 250px; align-self: center; margin-top: 24px; }
.download-feedback { margin: 10px 0 0; color: var(--muted); font-size: 14px; line-height: 1.5; text-align: center; }
.download-feedback.error { color: #a63a3a; }

.site-footer {
  display: flex;
  min-height: 112px;
  align-items: center;
  justify-content: flex-end;
  padding: 0 var(--gutter);
  border-top: 1px solid var(--line);
  background: var(--white);
}
.site-footer small { color: var(--muted); }

@media (max-width: 800px) {
  .workspace { grid-template-columns: 1fr; }
  .upload-side { border-right: 0; border-bottom: 1px solid var(--line); }
  .drop-zone { min-height: 480px; }
}

@media (max-width: 800px) {
  .tool-header { min-height: 68px; gap: 20px; }
  .tool-header__brand, .tool-header__project { font-size: 14px; }
  .app-shell { padding-top: 28px; }
  .upload-side, .results-side { padding: 24px 20px; }
  .drop-zone { min-height: 430px; padding: 32px 18px; }
  .site-footer { min-height: 96px; justify-content: flex-end; }
  .results-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 520px) {
  .results-grid { grid-template-columns: minmax(0, 1fr); }
  .metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .total { grid-column: 1 / -1; }
  .chart { min-height: 380px; }
  .review { overflow-x: auto; }
  .preview { width: min(86%, 330px); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; }
  .tool-spinner { animation: none !important; }
}

.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tool-spinner { display: inline-block; width: 24px; height: 24px; border: 2px solid var(--line); border-top-color: var(--green); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.tool-upload { border: 1px dashed var(--line); background: var(--white); }
.tool-upload { cursor: pointer; }
.tool-upload:focus-within { outline: 2px solid var(--green); outline-offset: 3px; }
.tool-upload:has(input:disabled) { cursor: not-allowed; }
.tool-secondary-button { display: inline-flex; align-items: center; justify-content: center; }
.drop-zone > .tool-secondary-button { color: var(--ink); }
.tool-upload.is-dragover { border-color: var(--green); background: var(--white); }
.tool-secondary-button { min-height: 44px; border: 1px solid var(--line); background: var(--white); color: var(--ink); }
.tool-secondary-button:hover { background: var(--white); border-color: var(--ink); }
.tool-table-wrap { overflow-x: auto; }
.tool-table thead th { position: sticky; top: 0; }
.tool-table tbody tr:hover { background: var(--gray); }
.work-segment, .legend.green { background: #164b3c; }
.rest-segment, .legend.red { background: #c84a40; }
.bar .rest-segment { color: var(--white); }
.metric input, .metric strong, .metric b, .metric:nth-child(2) strong, .metric:nth-child(2) input, .metric:nth-child(2) b { color: var(--ink); }
.metric input { border: 1px solid var(--line); border-radius: 8px; margin: 12px 0 5px; padding: 10px 12px; }
.metric, .metric input, .upload-side, .results-side { min-width: 0; }
.error, .warning, .download-feedback.error { color: #a63a3a; }
.zero-notice { border: 1px solid var(--line); background: var(--gray); color: #976426; }
.bar { background: #e8eaec; }
.bar > div { transition: height 180ms ease; }
.site-footer small { font-size: 14px; }
button:disabled { opacity: 1; }
button:focus-visible, input:focus-visible, .tool-table-wrap:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }
.tool-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 16px; margin-bottom: 16px; }
.tool-actions .tool-secondary-button { padding: 12px 17px; border-radius: 9px; font-size: 14px; text-decoration: none; }
.tool-actions .tool-secondary-button:disabled { border-color: var(--line); background: #e4e7e9; color: #858a90; opacity: 1; cursor: not-allowed; }
.tool-actions a:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }
.template-help, .demo-note { max-width: 780px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.template-help { margin: 0 0 24px; }
.demo-note { margin: 10px 0 0; }
