:root {
  color-scheme: light;
  font-family: "Microsoft JhengHei", "Noto Sans TC", system-ui, sans-serif;
  color: #17212b;
  background: #f3f5f4;
  --ink: #17212b;
  --muted: #65717b;
  --surface: #ffffff;
  --line: #d8dedb;
  --teal: #006d77;
  --teal-soft: #e5f3f2;
  --blue: #285c88;
  --red: #a7372d;
  --red-soft: #fff0ee;
  --amber: #8a5b12;
  --amber-soft: #fff7df;
  --green: #1e6b49;
  --green-soft: #e9f6ef;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button, textarea, a { font: inherit; }
button, a { touch-action: manipulation; }
button { min-height: 44px; cursor: pointer; }
button:focus-visible, a:focus-visible, textarea:focus-visible { outline: 3px solid #55a6d9; outline-offset: 2px; }

.review-topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  padding: 18px clamp(16px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.review-topbar p, .task-panel-head p, .workspace-head p { margin: 0 0 3px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.review-topbar h1, .task-panel h2, .workspace-head h2 { margin: 0; }
.review-topbar h1 { font-size: clamp(22px, 3vw, 30px); }
.review-topbar nav { display: flex; gap: 8px; }
.review-topbar a { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 13px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); text-decoration: none; }
.review-topbar a:hover { background: var(--teal-soft); }

.preview-banner { display: flex; justify-content: center; gap: 8px; padding: 9px 16px; border-bottom: 1px solid #ead59b; background: var(--amber-soft); color: #66440e; font-size: 13px; }
.review-layout { display: grid; grid-template-columns: minmax(220px, 300px) minmax(0, 1fr); gap: 16px; max-width: 1440px; margin: 0 auto; padding: 16px; }
.task-panel, .review-workspace { min-width: 0; }
.task-panel { align-self: start; position: sticky; top: 16px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.task-panel-head, .workspace-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.task-panel h2 { font-size: 18px; }
.count-badge { display: grid; place-items: center; min-width: 32px; height: 32px; padding: 0 8px; border-radius: 999px; background: var(--ink); color: white; font-weight: 800; font-variant-numeric: tabular-nums; }
.task-list { display: grid; gap: 7px; margin-top: 14px; }
.task-button { display: grid; gap: 3px; width: 100%; padding: 10px 11px; border: 1px solid transparent; border-radius: 8px; background: #f7f8f7; color: var(--ink); text-align: left; }
.task-button strong { font-size: 13px; }
.task-button small { color: var(--muted); font-size: 11px; }
.task-button:hover, .task-button.active { border-color: #8db9b7; background: var(--teal-soft); }
.task-button.active { box-shadow: inset 3px 0 var(--teal); }

.review-workspace { padding: clamp(14px, 2.5vw, 24px); border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.workspace-head { padding-bottom: 15px; border-bottom: 1px solid var(--line); }
.workspace-head h2 { font-size: clamp(20px, 2.5vw, 26px); }
.status-pill { padding: 6px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.status-new { background: #eef1f3; color: #4f5d67; }
.status-draft { background: var(--amber-soft); color: var(--amber); }
.status-checked { background: #eaf2f9; color: var(--blue); }
.status-approved { background: var(--green-soft); color: var(--green); }

.step-list { display: grid; gap: 12px; margin: 16px 0 0; padding: 0; list-style: none; }
.step-card { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 11px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: #fcfdfc; }
.step-number { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: var(--ink); color: white; font-weight: 900; }
.step-content { min-width: 0; }
.step-content header { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.step-content small { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.step-content h3 { margin: 1px 0 0; font-size: 17px; }
.step-help, .security-note { color: var(--muted); font-size: 13px; line-height: 1.55; }
.step-content label { display: block; margin: 12px 0 6px; font-size: 13px; font-weight: 800; }
textarea { width: 100%; min-height: 210px; padding: 12px; border: 1px solid #aeb9b4; border-radius: 8px; background: white; color: var(--ink); font-size: 14px; line-height: 1.65; resize: vertical; }
#packagePreview { min-height: 260px; margin-top: 8px; background: #f5f7f6; font-family: Consolas, monospace; font-size: 12px; }
details { margin-top: 9px; }
summary { min-height: 44px; padding: 11px 0; cursor: pointer; color: var(--blue); font-weight: 800; }

.primary-button, .secondary-button, .locked-button, .preview-tabs button { padding: 8px 13px; border-radius: 8px; font-weight: 800; }
.primary-button { border: 1px solid var(--teal); background: var(--teal); color: white; }
.primary-button:hover:not(:disabled) { background: #005a62; }
.secondary-button, .preview-tabs button { border: 1px solid var(--line); background: white; color: var(--ink); }
.secondary-button:hover, .preview-tabs button:hover, .preview-tabs button.active { border-color: #8db9b7; background: var(--teal-soft); }
.locked-button, button:disabled { cursor: not-allowed; opacity: .55; }
.locked-button { border: 1px solid var(--line); background: #eef0ef; color: var(--muted); }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.inline-status { min-height: 20px; margin-top: 6px; color: var(--green); font-size: 12px; }

.validation-summary { margin-top: 10px; padding: 10px 12px; border-radius: 8px; font-size: 13px; font-weight: 800; }
.empty-validation { background: #eef1f3; color: var(--muted); }
.validation-summary.has-error { background: var(--red-soft); color: var(--red); }
.validation-summary.has-warning { background: var(--amber-soft); color: var(--amber); }
.validation-summary.all-pass { background: var(--green-soft); color: var(--green); }
.validation-list { display: grid; gap: 7px; margin: 9px 0 0; padding: 0; list-style: none; }
.validation-list li { display: grid; grid-template-columns: 58px minmax(0, 1fr); gap: 8px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 7px; background: white; font-size: 13px; line-height: 1.45; }
.validation-list b { font-size: 11px; }
.validation-error b { color: var(--red); }
.validation-warning b { color: var(--amber); }
.validation-pass b { color: var(--green); }

.preview-tabs { display: flex; gap: 7px; margin-top: 10px; }
.preview-tabs button { min-height: 40px; }
.publish-preview { min-height: 150px; max-height: 360px; margin-top: 8px; padding: 14px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: white; white-space: pre-wrap; line-height: 1.65; }
.publish-preview.line-card { max-width: 440px; border-top: 5px solid var(--teal); box-shadow: 0 7px 20px #17212b14; }
.publish-preview p { margin: 0; }
.security-note { margin-bottom: 0; }

@media (max-width: 780px) {
  .review-topbar { align-items: flex-start; }
  .review-topbar nav { flex-direction: column; }
  .preview-banner { align-items: flex-start; justify-content: flex-start; flex-direction: column; }
  .review-layout { grid-template-columns: 1fr; padding: 10px; }
  .task-panel { position: static; }
  .task-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .step-content header { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 480px) {
  .review-topbar { display: grid; padding: 14px; }
  .review-topbar nav { display: grid; grid-template-columns: 1fr 1fr; }
  .task-list { grid-template-columns: 1fr; }
  .review-workspace { padding: 11px; }
  .step-card { grid-template-columns: 30px minmax(0, 1fr); padding: 11px; }
  .step-number { width: 28px; height: 28px; }
  .button-row > button { flex: 1 1 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
