:root {
  --paper: #f7f6f1;
  --card: #fffefa;
  --ink: #20231f;
  --muted: #747b73;
  --line: #e6e7df;
  --green: #5f846f;
  --green-dark: #496a58;
  --green-soft: #e8f0e9;
  --yellow: #f4e4a8;
  --danger: #a75149;
  --shadow: 0 18px 46px rgba(49, 57, 48, 0.08);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background: radial-gradient(circle at 10% 0%, rgba(226, 239, 224, 0.72), transparent 34rem), var(--paper);
  font-family: Inter, "Microsoft YaHei UI", "PingFang SC", "Noto Sans SC", "Segoe UI", sans-serif;
  line-height: 1.5;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: 0.55; }
h1, h2, h3, p { margin: 0; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.shell {
  width: min(1420px, calc(100% - 48px));
  margin: 0 auto;
  padding: 24px 0 42px;
}

.topbar, .section-head, .month-bar, .detail-head, .ai-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar { margin-bottom: 34px; }

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  font-weight: 750;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 35px;
  height: 35px;
  place-items: center;
  color: #fff;
  background: var(--green);
  border-radius: 11px;
  box-shadow: 0 8px 18px rgba(95, 132, 111, 0.24);
}

.brand small { display: block; color: var(--muted); font-size: 11px; font-weight: 500; }
.nav { display: flex; gap: 6px; }
.nav a { padding: 8px 11px; color: var(--muted); border-radius: 10px; font-size: 13px; text-decoration: none; }
.nav a:hover, .nav a.active { color: var(--ink); background: #ecece6; }

.intro { margin-bottom: 24px; }
.eyebrow { color: var(--green); font-size: 12px; font-weight: 760; letter-spacing: 0.12em; }
.intro h1 { margin-top: 7px; font-size: clamp(28px, 3vw, 40px); letter-spacing: -0.045em; }
.intro > p:last-child { max-width: 720px; margin-top: 9px; color: var(--muted); font-size: 14px; }

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(340px, 0.84fr);
  gap: 20px;
  align-items: start;
}

.card {
  background: rgba(255, 254, 250, 0.92);
  border: 1px solid rgba(220, 222, 213, 0.88);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.records-card { padding: 24px; }
.section-head h2, .ai-title h2 { font-size: 18px; letter-spacing: -0.025em; }
.section-head p, .ai-head p { color: var(--muted); font-size: 12px; }

.ghost-btn, .icon-btn, .entry-action, .suggestions button {
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 9px;
}

.ghost-btn { padding: 7px 11px; font-size: 12px; }
.section-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.icon-btn { width: 34px; height: 34px; font-size: 19px; }
.month-bar { margin-top: 21px; }
.month-bar > strong { font-size: 22px; letter-spacing: -0.04em; }
.month-actions { display: flex; gap: 7px; }

.calendar { margin-top: 17px; }
.weekdays, .days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.weekdays { color: #9ba099; font-size: 11px; text-align: center; }
.days { margin-top: 7px; }

.day {
  position: relative;
  min-height: 62px;
  padding: 8px;
  color: #696f68;
  background: #fafaf6;
  border: 1px solid transparent;
  border-radius: 12px;
  text-align: left;
  transition: 0.18s ease;
}

.day:hover { border-color: #c8d7ca; transform: translateY(-1px); }
.day.empty { background: transparent; pointer-events: none; }
.day.today { color: var(--ink); border-color: #bdd1c0; }
.day.selected { color: #fff; background: var(--green); border-color: var(--green); box-shadow: 0 8px 16px rgba(95, 132, 111, 0.2); }
.day-number { font-size: 12px; font-weight: 720; }
.day-count { display: block; margin-top: 13px; color: #a6aca4; font-size: 10px; }
.day.selected .day-count { color: rgba(255, 255, 255, 0.78); }
.day .dot { position: absolute; top: 9px; right: 9px; }
.day.selected .dot { background: #fff; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 999px; background: var(--green); }
.calendar-note { display: flex; align-items: center; gap: 7px; margin-top: 12px; color: var(--muted); font-size: 12px; }

.day-detail { margin-top: 27px; padding-top: 21px; border-top: 1px solid var(--line); }
.detail-head { align-items: end; margin-bottom: 14px; }
.detail-head h3 { font-size: 16px; }
.detail-head span { color: var(--muted); font-size: 12px; }
.entry-list { display: grid; gap: 9px; }

.entry {
  display: grid;
  grid-template-columns: 5px minmax(0, 1fr) auto;
  gap: 11px;
  padding: 12px 13px;
  background: #fff;
  border: 1px solid #ecece6;
  border-radius: 13px;
}

.entry-line { min-height: 38px; background: var(--yellow); border-radius: 9px; }
.entry-text { font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
.entry-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; color: var(--muted); font-size: 11px; }
.tag { padding: 2px 6px; background: #f0f1eb; border-radius: 6px; }
.entry-side { display: grid; justify-items: end; gap: 8px; }
.entry-time { color: #7f887f; font-size: 11px; }
.entry-actions { display: flex; gap: 5px; }
.entry-action { padding: 3px 6px; font-size: 10px; }
.entry-action.danger { color: var(--danger); }
.empty-entry { padding: 18px; color: var(--muted); background: #fbfcf8; border: 1px dashed #d7ddd5; border-radius: 13px; font-size: 13px; text-align: center; }

.composer { margin-top: 17px; padding: 14px; background: #fbfcf8; border: 1px dashed #d3dbd3; border-radius: 14px; }
.composer textarea { width: 100%; min-height: 66px; padding: 0; resize: vertical; color: var(--ink); background: transparent; border: 0; outline: 0; font-size: 13px; }
.composer-options { display: grid; grid-template-columns: 118px minmax(160px, 1fr) auto; gap: 9px; align-items: end; margin-top: 10px; }
.composer-options label, dialog label { display: grid; gap: 4px; color: var(--muted); font-size: 11px; }
input, select, dialog textarea { width: 100%; padding: 8px 9px; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 9px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: #aec8b2; box-shadow: 0 0 0 3px rgba(174, 200, 178, 0.18); }
.primary-btn { padding: 9px 14px; color: #fff; background: var(--green); border: 0; border-radius: 9px; font-size: 12px; font-weight: 720; }
.primary-btn:hover { background: var(--green-dark); }

.ai-card { position: sticky; top: 20px; display: flex; min-height: 700px; flex-direction: column; overflow: hidden; }
.ai-head { padding: 21px 21px 17px; border-bottom: 1px solid var(--line); }
.ai-head p { margin-top: 7px; }
.agent-badge { padding: 4px 8px; color: #547762; background: var(--green-soft); border-radius: 7px; font-size: 10px; font-weight: 760; }
.ai-actions { margin-top: 14px; }
.report-btn { width: 100%; padding: 9px 12px; color: #fff; background: var(--green); border: 0; border-radius: 10px; font-size: 12px; font-weight: 700; }
.suggestions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.suggestions button { padding: 6px 8px; font-size: 11px; }

.chat { display: flex; min-height: 0; flex: 1; flex-direction: column; }
.messages { display: grid; align-content: start; gap: 13px; flex: 1; max-height: 590px; padding: 18px 21px; overflow-y: auto; }
.message { max-width: 91%; }
.message.user { justify-self: end; }
.message-meta { margin-bottom: 4px; color: #7d877e; font-size: 11px; }
.message.user .message-meta { text-align: right; }
.bubble { padding: 10px 12px; border-radius: 13px; font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.message.assistant .bubble { background: #fbfcf8; border: 1px solid #e9ede6; }
.message.user .bubble { color: #fff; background: var(--green); }
.report-title { margin-bottom: 9px; font-size: 15px; }
.report-heading { margin: 12px 0 4px; color: var(--green-dark); font-size: 12px; }
.report-paragraph, .report-item, .report-note { margin-top: 4px; white-space: pre-wrap; }
.report-item { padding-left: 8px; }
.report-note { margin-top: 11px; color: var(--muted); font-size: 10px; }
.action-card { margin-top: 9px; padding: 10px; background: #f2f7f1; border: 1px solid #dce8dc; border-radius: 10px; }
.action-card p { font-size: 11px; white-space: pre-wrap; }
.action-card button { margin-top: 8px; padding: 6px 9px; color: #fff; background: var(--green); border: 0; border-radius: 7px; font-size: 11px; }
.request-status { min-height: 20px; padding: 0 14px; color: var(--muted); font-size: 11px; }
.request-status.error { color: var(--danger); }
.chat-form { display: flex; gap: 8px; padding: 13px; background: #fff; border-top: 1px solid var(--line); }
.chat-form input { min-width: 0; flex: 1; font-size: 12px; }
.chat-form button { width: 39px; color: #fff; background: var(--green); border: 0; border-radius: 10px; }

.footer-note { margin-top: 15px; color: #939a92; font-size: 11px; text-align: center; }

dialog { width: min(560px, calc(100% - 32px)); padding: 22px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(31, 36, 31, 0.38); backdrop-filter: blur(2px); }
dialog h2 { margin-bottom: 16px; font-size: 19px; }
dialog textarea { min-height: 110px; resize: vertical; }
.dialog-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 12px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

@media (max-width: 960px) {
  .workspace { grid-template-columns: 1fr; }
  .ai-card { position: static; min-height: 580px; }
}

@media (max-width: 620px) {
  .shell { width: min(100% - 24px, 560px); padding-top: 14px; }
  .topbar { margin-bottom: 24px; }
  .nav a { padding: 7px 8px; }
  .records-card { padding: 16px; }
  .day { min-height: 52px; padding: 7px 5px; }
  .day-count { display: none; }
  .composer-options, .dialog-grid { grid-template-columns: 1fr; }
  .primary-btn { width: 100%; }
  .entry { grid-template-columns: 4px minmax(0, 1fr); }
  .entry-side { grid-column: 2; justify-items: start; }
}
