:root {
  color-scheme: light;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", system-ui, sans-serif;
  color: #18332c;
  background: #f5f5ef;
  --paper: #fffefa;
  --line: #e3e8df;
  --muted: #5e7067;
  --green: #154f45;
  --green-light: #e4f1e9;
  --gold-light: #fbf0da;
  --ink: #18332c;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 280px; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .55; }
button:focus-visible, input:focus-visible, textarea:focus-visible, .wheel:focus-visible {
  outline: 2px solid #2b8068;
  outline-offset: 3px;
}
.symbols { position: absolute; width: 0; height: 0; overflow: hidden; }
svg {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.topbar { background: var(--paper); border-bottom: 1px solid var(--line); }
.topbar-inner, .workspace { width: min(1120px, calc(100% - 72px)); margin-inline: auto; }
.topbar-inner {
  min-height: 73px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand, .brand-mark, .button { display: inline-flex; align-items: center; justify-content: center; }
.brand { gap: 11px; font-weight: 700; font-size: 16px; }
.brand-mark { width: 39px; height: 39px; border-radius: 11px; background: var(--green); color: white; }
.button {
  gap: 7px;
  min-height: 42px;
  padding: 0 13px;
  background: var(--paper);
  color: var(--green);
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 14px;
  font-weight: 600;
}
.button:hover:not(:disabled) { background: var(--green-light); }
.button svg { width: 17px; height: 17px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.arrow { width: 42px; padding: 0; }
.workspace { padding-block: 44px 56px; }
.page-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 15px;
  margin-bottom: 26px;
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(27px, 4vw, 38px); letter-spacing: -.035em; }
.week-controls { display: flex; align-items: center; gap: 10px; }
#week-range { min-width: 166px; text-align: center; font-size: 14px; font-weight: 650; color: var(--muted); }
.layout { display: grid; grid-template-columns: 244px minmax(0, 1fr); align-items: start; gap: 20px; }
.day-panel, .daily-panel { background: var(--paper); border: 1px solid var(--line); border-radius: 17px; }
.day-panel { padding: 17px; }
.day-panel > h2 { margin: 2px 6px 14px; font-size: 14px; color: var(--muted); }
.days { display: grid; gap: 5px; }
.day-button {
  position: relative;
  min-width: 0;
  text-align: left;
  min-height: 57px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  padding: 7px 10px;
  border-radius: 9px;
  border: 1px solid transparent;
  color: var(--ink);
  background: transparent;
}
.day-button:hover { background: #f0f3ec; }
.day-button[aria-pressed="true"] { border-color: #cedfd4; color: var(--green); background: var(--green-light); }
.day-date { display: flex; align-items: baseline; gap: 9px; }
.day-weekday { font-weight: 700; font-size: 14px; }
.day-number { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.day-duration { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.day-current { position: absolute; top: 10px; right: 10px; width: 6px; height: 6px; border-radius: 50%; background: #28816a; }
.daily-panel { min-height: 480px; overflow: hidden; }
.daily-header {
  padding: 26px 27px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  background: #f2f7ef;
  border-bottom: 1px solid var(--line);
}
.date-label { color: var(--muted); font-size: 13px; font-weight: 600; }
.daily-header h2 { margin-top: 6px; font-size: clamp(23px, 4vw, 32px); line-height: 1.2; }
.summary {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 154px;
  padding: 11px 14px;
  border: 1px solid #dbe9dc;
  border-radius: 12px;
  background: #fafff9;
}
.summary-icon, .empty-icon, .item-icon {
  display: inline-grid;
  place-items: center;
  flex: none;
  border-radius: 10px;
  color: var(--green);
  background: var(--green-light);
}
.summary-icon { width: 36px; height: 36px; }
.summary-label, #summary-count { display: block; color: var(--muted); font-size: 12px; }
#summary-total { display: block; color: var(--green); font-size: 19px; line-height: 1.3; overflow-wrap: anywhere; }
.actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; padding: 20px 27px 0; }
.action {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 7px;
  min-height: 46px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 700;
  color: var(--green);
  border: 1px solid #cedfd4;
  background: #f6fbf6;
}
.action:hover { background: var(--green-light); }
.action-note { border-color: var(--green); background: var(--green); color: white; }
.action-note:hover { background: #216658; }
.timeline-heading { display: flex; align-items: baseline; gap: 9px; margin: 26px 27px 4px; }
.timeline-heading h3 { font-size: 16px; }
#entry-count { font-size: 12px; color: var(--muted); }
.timeline { margin: 0; padding: 0 27px 14px; list-style: none; }
.timeline li {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 66px;
  padding-block: 9px;
}
.timeline li + li { border-top: 1px solid var(--line); }
.timeline time { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--green); }
.item-icon { width: 36px; height: 36px; }
.item-icon.capture { background: var(--gold-light); color: #7a510e; }
.item-icon.meeting { background: #e9edf9; color: #434c79; }
.item-icon svg { width: 18px; height: 18px; }
.item-type { display: block; font-size: 12px; color: var(--muted); }
.item-text { display: block; overflow-wrap: anywhere; margin-top: 2px; font-size: 14px; line-height: 1.55; }
.empty-state { display: grid; justify-items: center; gap: 10px; padding: 26px 10px 46px; color: var(--muted); font-size: 14px; }
.empty-icon { width: 48px; height: 48px; border-radius: 14px; background: #eef3ea; }
.load-error { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px; margin-bottom: 15px; color: #8e3025; background: #fcf0e8; border-radius: 10px; }

dialog {
  color: var(--ink);
  background: var(--paper);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  width: min(460px, calc(100% - 28px));
  max-height: calc(100dvh - 24px);
  box-shadow: 0 20px 65px #10271c33;
}
dialog::backdrop { background: #0f261cc0; }
body:has(dialog[open]) { overflow: hidden; }
.dialog-header, .dialog-footer { display: flex; align-items: center; gap: 8px; padding: 15px 20px; }
.dialog-header { justify-content: space-between; border-bottom: 1px solid var(--line); }
.dialog-header h2 { margin-top: 4px; font-size: 23px; }
.dialog-footer { justify-content: flex-end; border-top: 1px solid var(--line); }
.editor-fields { display: grid; gap: 14px; padding: 16px 20px; }
.export-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 16px 20px calc(16px + env(safe-area-inset-bottom));
}
.export-options > [id] { grid-column: 1 / -1; }
.export-status { color: var(--green); font-size: 13px; }
.export-status:empty { display: none; }
.field { display: grid; gap: 6px; }
.field > span, legend { font-size: 14px; font-weight: 700; }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
legend { margin-bottom: 6px; padding: 0; }
.field input, .field textarea, #clock-direct {
  min-width: 0;
  min-height: 43px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--paper);
  font-size: 16px;
}
.field textarea { width: 100%; resize: vertical; }
.picker {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  padding: 5px 8px;
  border-radius: 10px;
  background: #f1f5ed;
  color: var(--muted);
}
.wheel {
  --row: 32px;
  position: relative;
  width: 54px;
  height: calc(var(--row) * 3);
  padding-block: var(--row);
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  border-radius: 8px;
  background: linear-gradient(transparent 33.33%, #dceade 33.33% 66.67%, transparent 66.67%);
  font-variant-numeric: tabular-nums;
}
.wheel::-webkit-scrollbar { display: none; }
.wheel-option {
  display: block;
  width: 100%;
  height: var(--row);
  padding: 0;
  scroll-snap-align: center;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
}
.wheel-option.selected { color: var(--green); font-weight: 750; }
.picker-divider { font-weight: 700; }
.unit, .field-hint { color: var(--muted); font-size: 13px; }
#clock-direct { margin-left: auto; width: 128px; }
.recent-people { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; }
.recent-people .button { min-height: 36px; max-width: 100%; overflow-wrap: anywhere; }
.button.save-button { color: white; border-color: var(--green); background: var(--green); }
.button.save-button:hover:not(:disabled) { background: #216658; }
.button.delete-button { margin-right: auto; color: #9b2d27; }
.button.delete-button:hover:not(:disabled) { background: #fbece8; }
.editor-error, .delete-prompt { padding: 12px 20px; color: #8e3025; font-size: 14px; }

.login-page { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.login-card {
  width: min(100%, 400px);
  padding: clamp(18px, 5vw, 30px);
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--paper);
}
.login-heading { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.login-heading h1 { font-size: 24px; }
.login-form { display: grid; gap: 14px; }
.login-error { color: #8e3025; font-size: 14px; }

@media (max-width: 700px) {
  .topbar-inner, .workspace { width: calc(100% - 26px); }
  .topbar-inner { min-height: 60px; }
  .brand-mark { width: 34px; height: 34px; }
  .topbar-actions { gap: 5px; }
  .topbar-actions .button { padding-inline: 8px; }
  .today-button svg { display: none; }
  .workspace { padding-block: 20px calc(88px + env(safe-area-inset-bottom)); }
  .page-heading { grid-template-columns: minmax(0, 1fr) auto; margin-bottom: 13px; gap: 10px; }
  #export-week { grid-column: 2; grid-row: 1; padding-inline: 8px; }
  .week-controls { grid-column: 1 / -1; justify-content: space-between; gap: 7px; }
  #week-range { min-width: 0; font-size: 13px; }
  .layout { grid-template-columns: minmax(0, 1fr); gap: 11px; }
  .day-panel { padding: 5px; border-radius: 12px; }
  .day-panel > h2 { display: none; }
  .days { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
  .day-button { justify-content: flex-start; align-items: center; gap: 4px; padding: 7px 1px; min-height: 67px; text-align: center; }
  .day-date { flex-direction: column; align-items: center; gap: 2px; }
  .day-weekday, .day-number { font-size: 12px; }
  .day-duration { font-size: 11px; line-height: 1.25; }
  .day-current { top: 4px; right: 3px; width: 5px; height: 5px; }
  .daily-panel { min-height: 0; border-radius: 12px; }
  .daily-header { padding: 14px; gap: 7px; }
  .summary { min-width: 112px; padding: 8px; gap: 6px; }
  .summary-icon { width: 27px; height: 27px; }
  .summary-icon svg { width: 16px; height: 16px; }
  #summary-total { font-size: 16px; }
  .actions {
    position: fixed;
    z-index: 1;
    inset: auto 0 0;
    padding: 9px 13px calc(9px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: var(--paper);
  }
  .action { gap: 5px; }
  .action svg { width: 17px; height: 17px; }
  .timeline-heading { margin: 16px 14px 3px; }
  .timeline { padding: 0 14px 7px; }
  .timeline li { gap: 8px; }
  .item-icon { width: 30px; height: 30px; }
  .empty-state { padding-block: 19px 32px; }
  dialog { inset: auto 0 0; margin: 0 auto; width: 100%; max-width: 540px; border-radius: 17px 17px 0 0; }
  .dialog-footer { padding-bottom: calc(15px + env(safe-area-inset-bottom)); }
}
