:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #2563eb;
  --brand-ink: #ffffff;
  --danger: #dc2626;
  --ok: #059669;
  --warn: #d97706;
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.brand {
  font-weight: 700;
  letter-spacing: 0.2px;
}

.brand-sub {
  font-size: 12px;
  color: var(--muted);
}

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 14px 14px calc(28px + env(safe-area-inset-bottom));
  display: grid;
  gap: 14px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

h1 {
  font-size: 18px;
  margin: 0 0 6px;
}

h2 {
  font-size: 15px;
  margin: 0 0 10px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 10px;
}

input,
textarea,
select {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  outline: none;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

button {
  font: inherit;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 10px 14px;
  cursor: pointer;
}

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

button.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--brand-ink);
  font-weight: 600;
}

button.ghost {
  background: transparent;
  color: var(--muted);
}

button.link {
  border: 0;
  background: none;
  padding: 4px 0;
  color: var(--brand);
  text-align: left;
  width: 100%;
}

.row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.row > input,
.row > select {
  flex: 1;
}

.record {
  display: grid;
  gap: 10px;
  justify-items: center;
  text-align: center;
}

.record-btn {
  width: 100%;
  padding: 18px;
  font-size: 18px;
  font-weight: 700;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  border: 0;
}

.record-btn.recording {
  background: var(--danger);
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.35); }
  50% { box-shadow: 0 0 0 12px rgba(220, 38, 38, 0); }
}

.timer {
  font-variant-numeric: tabular-nums;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 1px;
}

.status {
  font-size: 13px;
  color: var(--muted);
  min-height: 20px;
}

.draft {
  width: 100%;
  text-align: left;
  font-size: 14px;
  background: #f8fafc;
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 10px;
  min-height: 56px;
  white-space: pre-wrap;
  word-break: break-word;
}

.draft.empty {
  color: #94a3b8;
}

.notes {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.note {
  display: flex;
  gap: 8px;
  font-size: 14px;
  background: #f8fafc;
  border-radius: 10px;
  padding: 8px 10px;
  text-align: left;
}

.note-label {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
  height: fit-content;
}

.note-decision .note-label { background: #dbeafe; color: #1d4ed8; }
.note-action .note-label { background: #dcfce7; color: #15803d; }
.note-risk .note-label { background: #fee2e2; color: #b91c1c; }

.transcript {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 14px;
  background: #f8fafc;
  border-radius: 10px;
  padding: 10px;
  margin: 8px 0 0;
}

audio {
  width: 100%;
  margin-top: 12px;
}

.answer {
  border-top: 1px solid var(--line);
  padding-top: 10px;
  margin-top: 10px;
  font-size: 14px;
}

.answer p {
  margin: 0 0 8px;
  white-space: pre-wrap;
}

.citations {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #dbeafe;
}

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

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

.small {
  font-size: 12px;
}

.error {
  color: var(--danger);
  font-size: 13px;
  min-height: 18px;
}

details summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
}

@media (min-width: 720px) {
  body { font-size: 15px; }
}


/* 日历 */
.cal-head {
  justify-content: space-between;
}

.cal-title {
  margin: 0;
  font-size: 15px;
  text-align: center;
  flex: 1;
}

.cal-legend {
  display: flex;
  gap: 14px;
  margin: 4px 0 10px;
}

.cal-legend .dot {
  width: 8px;
  height: 8px;
  margin-right: 4px;
}

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

.cal-wd {
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  padding-bottom: 4px;
}

.cal-cell {
  position: relative;
  aspect-ratio: 1 / 1;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  padding: 5px 0 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 13px;
  color: var(--ink);
}

.cal-cell.empty {
  border: 0;
  background: transparent;
  pointer-events: none;
}

.cal-cell.has {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.cal-num {
  font-variant-numeric: tabular-nums;
}

.cal-dots {
  display: flex;
  gap: 3px;
  margin-top: 6px;
}

.cal-dots .dot {
  width: 5px;
  height: 5px;
  margin: 0;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  background: #cbd5e1;
}

.dot-session { background: #2563eb; }
.dot-action { background: #16a34a; }
.dot-order { background: #d97706; }

.day-detail {
  margin-top: 12px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
  font-size: 14px;
}

.day-title {
  font-weight: 600;
  margin-bottom: 4px;
}

.day-sec-title {
  font-size: 12px;
  color: var(--muted);
  margin: 8px 0 2px;
}

.day-row {
  padding: 1px 0;
  word-break: break-word;
}

.sub-title {
  font-size: 13px;
  color: var(--muted);
  margin: 14px 0 4px;
  font-weight: 600;
}
