:root {
  --bg: #f5f8fa;
  --surface: #ffffff;
  --surface-soft: #eef6f6;
  --ink: #15232d;
  --muted: #5f6f7a;
  --line: #dbe5e8;
  --accent: #0f8f8b;
  --accent-strong: #08736f;
  --accent-soft: #dff3f1;
  --warning: #b76b00;
  --warning-soft: #fff2d9;
  --danger: #bd2e2e;
  --danger-soft: #fde7e7;
  --ok: #1f8a55;
  --ok-soft: #e3f5ea;
  --shadow: 0 18px 45px rgba(21, 35, 45, 0.09);
  --radius: 8px;
  --radius-sm: 6px;
  color-scheme: light;
  font-family:
    Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(15, 143, 139, 0.08), rgba(245, 248, 250, 0) 260px),
    var(--bg);
  color: var(--ink);
  min-width: 320px;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

svg {
  display: block;
}

.app-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 24px;
}

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

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

.brand-mark {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(15, 143, 139, 0.11);
  color: var(--accent);
  display: grid;
  flex: 0 0 auto;
  height: 48px;
  justify-items: center;
  width: 48px;
}

.brand-mark svg {
  height: 31px;
  width: 31px;
}

.brand-mark path {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

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

h1 {
  font-size: clamp(24px, 3vw, 34px);
  font-weight: 760;
  letter-spacing: 0;
  line-height: 1.08;
}

.brand p,
.section-head p,
.block-title p,
.side-section p {
  color: var(--muted);
}

.brand p {
  font-size: 13px;
  margin-top: 5px;
}

.date-tools {
  align-items: end;
  display: flex;
  gap: 10px;
}

.date-field {
  display: grid;
  gap: 5px;
}

.date-field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 680;
}

input[type="date"],
input[type="text"],
textarea {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink);
  outline: none;
}

input[type="date"] {
  min-height: 42px;
  padding: 8px 10px;
}

input[type="date"]:focus,
input[type="text"]:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 143, 139, 0.15);
}

input[type="text"] {
  min-height: 38px;
  padding: 8px 10px;
  width: 100%;
}

.icon-button,
.primary,
.secondary,
.text-button {
  align-items: center;
  border: 0;
  display: inline-flex;
  justify-content: center;
}

.icon-button {
  background: var(--ink);
  border-radius: var(--radius-sm);
  color: #fff;
  height: 42px;
  width: 42px;
}

.icon-button svg,
.primary svg,
.secondary svg {
  height: 18px;
  width: 18px;
}

.icon-button path,
.primary path,
.secondary path,
.status-icon path {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.workspace {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) 390px;
}

.question-panel,
.side-panel {
  min-width: 0;
}

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

.section-head {
  align-items: start;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding-bottom: 18px;
}

.section-head h2 {
  font-size: 25px;
  font-weight: 760;
  line-height: 1.15;
}

.section-head p {
  font-size: 14px;
  margin-top: 6px;
}

.phase-chip {
  background: var(--accent-soft);
  border: 1px solid rgba(15, 143, 139, 0.22);
  border-radius: var(--radius-sm);
  color: var(--accent-strong);
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 760;
  padding: 8px 10px;
}

.checkin-form {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.block {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

.risk-block {
  border-color: rgba(183, 107, 0, 0.25);
  background: linear-gradient(180deg, rgba(255, 242, 217, 0.72), rgba(255, 255, 255, 0));
}

.block-title {
  align-items: center;
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
}

.step {
  align-items: center;
  background: var(--ink);
  border-radius: var(--radius-sm);
  color: #fff;
  display: inline-grid;
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 780;
  height: 30px;
  justify-items: center;
  width: 30px;
}

.block-title h3,
.side-section h3 {
  font-size: 17px;
  font-weight: 740;
  line-height: 1.2;
}

.block-title p {
  font-size: 13px;
  line-height: 1.45;
  margin-top: 3px;
}

.slider-row {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-template-columns: 96px minmax(130px, 1fr) 42px;
  margin-bottom: 14px;
}

.slider-row label {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

input[type="range"] {
  accent-color: var(--accent);
  width: 100%;
}

output {
  align-items: center;
  background: var(--ink);
  border-radius: var(--radius-sm);
  color: #fff;
  display: inline-grid;
  font-size: 15px;
  font-weight: 780;
  height: 34px;
  justify-items: center;
}

.segmented {
  background: #f2f6f7;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 4px;
  grid-template-columns: repeat(3, 1fr);
  padding: 4px;
}

.segmented.bruising {
  grid-template-columns: repeat(2, 1fr);
  margin-top: 10px;
}

.segmented.weight {
  grid-template-columns: repeat(4, 1fr);
}

.segmented label {
  min-width: 0;
}

.segmented input {
  position: absolute;
  opacity: 0;
}

.segmented span {
  align-items: center;
  border-radius: var(--radius-sm);
  color: var(--muted);
  display: flex;
  font-size: 13px;
  font-weight: 720;
  justify-content: center;
  min-height: 38px;
  padding: 8px;
  text-align: center;
  transition:
    background 160ms ease,
    color 160ms ease,
    box-shadow 160ms ease;
}

.segmented input:checked + span {
  background: var(--surface);
  box-shadow: 0 5px 15px rgba(21, 35, 45, 0.08);
  color: var(--ink);
}

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

.check-card,
.task-item {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  display: flex;
  gap: 10px;
  min-height: 54px;
  padding: 12px;
  transition:
    border-color 160ms ease,
    background 160ms ease,
  transform 160ms ease;
}

.task-item {
  align-items: start;
  display: grid;
  gap: 6px;
  min-height: 132px;
}

.check-card:hover,
.task-item:hover {
  border-color: rgba(15, 143, 139, 0.45);
}

.check-card input,
.task-item input {
  position: absolute;
  opacity: 0;
}

.check-icon {
  border: 2px solid #a9b8bd;
  border-radius: 5px;
  flex: 0 0 auto;
  height: 20px;
  position: relative;
  width: 20px;
}

.check-card input:checked + .check-icon,
.task-item input:checked + span::before {
  background: var(--accent);
  border-color: var(--accent);
}

.check-card input:checked + .check-icon::after,
.task-item input:checked + span::after {
  border-bottom: 2px solid #fff;
  border-right: 2px solid #fff;
  content: "";
  height: 9px;
  left: 6px;
  position: absolute;
  top: 2px;
  transform: rotate(45deg);
  width: 5px;
}

.check-card:has(input:checked),
.task-item:has(input:checked) {
  background: var(--accent-soft);
  border-color: rgba(15, 143, 139, 0.42);
}

.check-card span:last-child,
.task-item span {
  font-size: 14px;
  font-weight: 650;
  line-height: 1.35;
}

.task-item span {
  padding-left: 30px;
  position: relative;
}

.task-item span::before {
  border: 2px solid #a9b8bd;
  border-radius: 999px;
  content: "";
  height: 18px;
  left: 0;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
}

.task-item span::after {
  left: 7px;
  top: 50%;
  transform: translateY(-58%) rotate(45deg);
}

.task-item small {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 520;
  line-height: 1.55;
  padding-left: 30px;
}

.care-note {
  background: #f7fafb;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  margin-top: 12px;
  padding: 10px 12px;
}

textarea {
  line-height: 1.6;
  min-height: 108px;
  padding: 12px;
  resize: vertical;
  width: 100%;
}

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

.primary,
.secondary {
  border-radius: var(--radius-sm);
  gap: 8px;
  min-height: 44px;
  padding: 10px 14px;
}

.primary {
  background: var(--accent);
  color: #fff;
  font-weight: 780;
}

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

.secondary {
  background: #eef3f4;
  color: var(--ink);
  font-weight: 720;
}

.side-panel {
  display: grid;
  gap: 14px;
  position: sticky;
  top: 16px;
}

.status-card,
.side-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(21, 35, 45, 0.06);
  padding: 16px;
}

.status-card {
  align-items: center;
  display: flex;
  gap: 13px;
}

.status-card h2 {
  font-size: 20px;
  font-weight: 780;
}

.status-card p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  margin-top: 4px;
}

.status-icon {
  align-items: center;
  background: var(--ok-soft);
  border-radius: var(--radius);
  color: var(--ok);
  display: grid;
  flex: 0 0 auto;
  height: 42px;
  justify-items: center;
  width: 42px;
}

.status-icon svg {
  height: 24px;
  width: 24px;
}

.status-card.warn {
  border-color: rgba(183, 107, 0, 0.34);
}

.status-card.warn .status-icon {
  background: var(--warning-soft);
  color: var(--warning);
}

.status-card.danger {
  background: var(--danger-soft);
  border-color: rgba(189, 46, 46, 0.35);
}

.status-card.danger .status-icon {
  background: #fff;
  color: var(--danger);
}

.side-title {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.text-button {
  background: transparent;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 760;
  padding: 4px 0;
}

.settings-panel {
  background: #f3f7f8;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
  padding: 10px;
}

.settings-panel label {
  display: grid;
  gap: 5px;
}

.settings-panel span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 680;
}

.timeline-track {
  background: #e7eef0;
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
}

.timeline-track span {
  background: var(--accent);
  display: block;
  height: 100%;
  width: 4%;
}

.timeline-row {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
}

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

.timeline-row strong {
  font-size: 15px;
}

.timeline p {
  font-size: 13px;
  line-height: 1.5;
  margin-top: 7px;
}

.tiny-label {
  background: #eef3f4;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  padding: 5px 7px;
}

.question-list {
  display: grid;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.question-list li {
  border-left: 3px solid var(--accent);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
  padding-left: 9px;
}

.trend-chart {
  background: #f5f8fa;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  height: 132px;
  width: 100%;
}

.trend-chart text {
  fill: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.trend-chart .grid-line {
  stroke: #dce6e8;
  stroke-width: 1;
}

.trend-chart .trend-line {
  fill: none;
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
}

.trend-chart .trend-dot {
  fill: var(--surface);
  stroke: var(--accent);
  stroke-width: 2;
}

.calendar-grid {
  display: grid;
  gap: 7px;
  grid-template-columns: repeat(7, 1fr);
}

.calendar-day {
  align-items: center;
  aspect-ratio: 1;
  background: #f0f5f6;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--muted);
  display: grid;
  font-size: 11px;
  font-weight: 760;
  justify-items: center;
  min-width: 0;
}

.calendar-day.done {
  background: var(--accent);
  color: #fff;
}

.calendar-day.warn {
  background: var(--warning-soft);
  border-color: rgba(183, 107, 0, 0.28);
  color: var(--warning);
}

.calendar-day.danger {
  background: var(--danger-soft);
  border-color: rgba(189, 46, 46, 0.28);
  color: var(--danger);
}

.redflag-help {
  background: #fff8ed;
  border-color: rgba(183, 107, 0, 0.25);
}

.redflag-help p {
  color: #6d4b1e;
  font-size: 13px;
  line-height: 1.58;
}

.supervisor-section {
  background: linear-gradient(180deg, rgba(223, 243, 241, 0.72), #fff 42%);
}

.supervisor-settings {
  display: grid;
  gap: 10px;
}

.supervisor-settings label {
  display: grid;
  gap: 5px;
}

.supervisor-settings label > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

.supervisor-fixed {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  justify-content: space-between;
  min-height: 40px;
  padding: 9px 10px;
}

.supervisor-fixed span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

.supervisor-fixed strong {
  color: var(--accent-strong);
  font-size: 15px;
  font-weight: 800;
}

.auto-copy {
  align-items: center;
  display: flex !important;
  gap: 8px !important;
}

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

.auto-copy span {
  color: var(--ink) !important;
  font-size: 13px !important;
}

.share-tabs {
  background: #eef3f4;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 4px;
  grid-template-columns: repeat(2, 1fr);
  margin-top: 12px;
  padding: 4px;
}

.share-tab {
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
  min-height: 34px;
}

.share-tab.active {
  background: var(--surface);
  box-shadow: 0 5px 15px rgba(21, 35, 45, 0.08);
  color: var(--ink);
}

.share-preview {
  background: #f9fbfb;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.55;
  margin-top: 10px;
  min-height: 128px;
}

.share-actions {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 10px;
}

.small-action {
  font-size: 13px;
  min-height: 38px;
  padding: 8px 9px;
  white-space: nowrap;
}

.small-action svg {
  height: 16px;
  width: 16px;
}

.share-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  margin-top: 9px;
}

.toast {
  background: var(--ink);
  border-radius: var(--radius);
  bottom: 22px;
  box-shadow: 0 16px 38px rgba(21, 35, 45, 0.23);
  color: #fff;
  font-size: 14px;
  font-weight: 720;
  left: 50%;
  opacity: 0;
  padding: 11px 14px;
  pointer-events: none;
  position: fixed;
  transform: translate(-50%, 18px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
  z-index: 20;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 1080px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .side-panel {
    position: static;
  }

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

  .status-card,
  .redflag-help {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 14px;
  }

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

  .date-tools {
    align-items: stretch;
  }

  .date-field {
    flex: 1;
  }

  .question-panel {
    padding: 15px;
  }

  .section-head {
    flex-direction: column;
  }

  .phase-chip {
    width: 100%;
  }

  .block {
    padding: 13px;
  }

  .slider-row {
    grid-template-columns: 1fr 44px;
  }

  .slider-row label {
    grid-column: 1 / -1;
  }

  .segmented,
  .segmented.bruising,
  .segmented.weight,
  .choice-grid,
  .task-grid,
  .side-panel {
    grid-template-columns: 1fr;
  }

  .segmented span {
    justify-content: flex-start;
    min-height: 40px;
  }

  .form-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .primary,
  .secondary {
    width: 100%;
  }
}

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