/* ————————————————————————————————
   月序 · 2026
   A quiet calendar for a loud semester.
   ———————————————————————————————— */

:root {
  --paper: #f2eee4;
  --paper-deep: #e8e1d3;
  --card: #fbf9f3;
  --card-solid: #fffdf8;
  --ink: #1d2b25;
  --ink-soft: #3e4b44;
  --muted: #666a60;
  --muted-light: #939489;
  --line: rgba(29, 43, 37, 0.13);
  --line-strong: rgba(29, 43, 37, 0.22);
  --forest: #1f3c33;
  --forest-mid: #2f6b5a;
  --forest-wash: #e8f0e9;
  --terracotta: #c56b45;
  --amber: #af862d;
  --butter: #f7edcf;
  --butter-deep: #efe0b9;
  --danger: #a94b43;
  --cream: #f6f0e3;
  --font-sans: "Inter", "Noto Sans SC", "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif;
  --font-serif: "Iowan Old Style", "Palatino Linotype", "Songti SC", "STSong", "Noto Serif CJK SC", "SimSun", serif;
  --font-hand: "Kaiti SC", "KaiTi", "STKaiti", "Noto Serif SC", serif;
  --shadow-card: 0 22px 50px -38px rgba(31, 50, 41, 0.5), 0 1px 0 rgba(255, 255, 255, 0.7) inset;
  --shadow-float: 0 24px 70px -28px rgba(23, 34, 29, 0.48);
  --radius-xl: 26px;
  --radius-lg: 22px;
  --radius-md: 14px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 9% 4%, rgba(255, 253, 246, 0.92), transparent 35%),
    radial-gradient(circle at 92% 18%, rgba(247, 237, 207, 0.5), transparent 30%),
    linear-gradient(135deg, transparent 0 55%, rgba(197, 107, 69, 0.035) 55% 55.2%, transparent 55.2%);
}

button,
input,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

button,
[role="button"] {
  -webkit-tap-highlight-color: transparent;
}

button:not(:disabled) {
  cursor: pointer;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

::selection {
  background: rgba(197, 107, 69, 0.2);
  color: var(--ink);
}

[hidden] {
  display: none !important;
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  opacity: 0.15;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.28'/%3E%3C/svg%3E");
}

.ambient {
  position: fixed;
  z-index: 0;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(1px);
}

.ambient--one {
  top: -160px;
  right: -110px;
  width: 430px;
  height: 430px;
  border: 1px solid rgba(175, 134, 45, 0.14);
  box-shadow: 0 0 0 45px rgba(175, 134, 45, 0.025), 0 0 0 95px rgba(175, 134, 45, 0.018);
}

.ambient--two {
  bottom: -200px;
  left: -160px;
  width: 480px;
  height: 480px;
  background: radial-gradient(circle, rgba(47, 107, 90, 0.055), transparent 68%);
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 200;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--forest);
  color: var(--cream);
  font-size: 12px;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: none;
}

.app-shell {
  position: relative;
  width: 100%;
  max-width: 1580px;
  margin: 0 auto;
  padding: 22px 34px 28px;
}

/* ——— Header ——— */

.topbar {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto minmax(180px, 1fr);
  align-items: center;
  gap: 24px;
  padding: 2px 2px 22px;
  animation: settle-in 0.55s cubic-bezier(0.22, 0.8, 0.3, 1) both;
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 43px;
  height: 43px;
  flex: 0 0 auto;
  border-radius: 13px;
  background: var(--forest);
  color: #f7f0e1;
  font-family: var(--font-serif);
  font-size: 25px;
  line-height: 1;
  box-shadow: 0 7px 16px -10px rgba(31, 60, 51, 0.8);
  transform: rotate(-2deg);
}

.brand-words {
  min-width: 0;
}

.brand-words h1 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 21px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0.08em;
}

.brand-words p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.month-nav {
  display: flex;
  align-items: center;
  gap: 3px;
  justify-self: center;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(251, 249, 243, 0.72);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset;
  backdrop-filter: blur(10px);
}

.icon-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-soft);
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.icon-button svg {
  width: 17px;
  height: 17px;
}

.icon-button:hover {
  background: rgba(31, 60, 51, 0.08);
  color: var(--forest);
}

.icon-button:active {
  transform: scale(0.94);
}

.month-label {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 138px;
  min-height: 32px;
  padding: 5px 9px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.025em;
  white-space: nowrap;
}

.nav-separator {
  width: 1px;
  height: 17px;
  margin: 0 5px;
  background: var(--line);
}

.today-button {
  padding: 7px 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--forest-mid);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.04em;
  transition: background 0.18s ease;
}

.today-button:hover {
  background: var(--forest-wash);
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  min-width: 0;
}

.local-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.local-badge i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--forest-mid);
  box-shadow: 0 0 0 3px rgba(47, 107, 90, 0.09);
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  padding: 9px 18px;
  border: 0;
  border-radius: 999px;
  background: var(--forest);
  color: #f9f3e7;
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: 0.04em;
  box-shadow: 0 10px 20px -13px rgba(31, 60, 51, 0.8);
  transition: background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.primary-button svg {
  width: 17px;
  height: 17px;
  stroke-width: 1.9;
}

.primary-button:hover {
  background: #152f27;
  transform: translateY(-1px);
  box-shadow: 0 14px 24px -13px rgba(31, 60, 51, 0.75);
}

.primary-button:active {
  transform: translateY(0);
}

.primary-button:focus-visible,
.secondary-button:focus-visible,
.icon-button:focus-visible,
.today-button:focus-visible,
.text-button:focus-visible,
.footer-button:focus-visible,
.round-button:focus-visible,
.add-to-day:focus-visible,
.pending-add:focus-visible,
.switch:focus-visible {
  outline: 2px solid var(--terracotta);
  outline-offset: 2px;
}

/* ——— Demo notice ——— */

.demo-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0 0 16px;
  padding: 10px 14px;
  border: 1px solid rgba(175, 134, 45, 0.25);
  border-radius: 12px;
  background: rgba(247, 237, 207, 0.72);
  color: #65563a;
  animation: settle-in 0.45s 0.1s cubic-bezier(0.22, 0.8, 0.3, 1) both;
}

.demo-notice-copy {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.demo-spark {
  color: var(--amber);
  font-size: 15px;
  line-height: 1;
}

.demo-notice p {
  margin: 0;
  font-size: 12px;
  line-height: 1.55;
}

.demo-notice strong {
  font-weight: 700;
}

.text-button {
  flex: 0 0 auto;
  padding: 4px 2px;
  border: 0;
  border-bottom: 1px solid rgba(101, 86, 58, 0.3);
  background: transparent;
  color: #65563a;
  font-size: 11.5px;
  font-weight: 650;
  transition: border-color 0.18s ease, color 0.18s ease;
}

.text-button:hover {
  color: var(--ink);
  border-color: var(--ink);
}

/* ——— Main grid ——— */

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

.left-rail,
.right-rail,
.calendar-card {
  min-width: 0;
}

.left-rail {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 2px 2px 0;
  animation: settle-in 0.55s 0.05s cubic-bezier(0.22, 0.8, 0.3, 1) both;
}

.month-masthead {
  position: relative;
  overflow: hidden;
  min-height: 236px;
  padding: 3px 8px 22px;
}

.masthead-kicker {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.14em;
  white-space: nowrap;
}

.kicker-line {
  width: 18px;
  height: 1px;
  background: var(--line-strong);
}

.month-masthead h2 {
  position: relative;
  z-index: 1;
  margin: 22px 0 3px;
  color: var(--forest);
  font-family: var(--font-serif);
  font-size: clamp(62px, 5.4vw, 80px);
  font-weight: 600;
  line-height: 0.94;
  letter-spacing: 0.02em;
}

.masthead-english {
  position: relative;
  z-index: 1;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.3em;
}

.masthead-copy {
  position: relative;
  z-index: 1;
  margin: 24px 0 0;
  color: var(--ink-soft);
  font-family: var(--font-serif);
  font-size: 14px;
  line-height: 1.8;
  letter-spacing: 0.06em;
}

.masthead-orbit {
  position: absolute;
  right: -33px;
  bottom: 26px;
  width: 104px;
  height: 104px;
  border: 1px solid rgba(175, 134, 45, 0.2);
  border-radius: 50%;
}

.masthead-orbit::before {
  content: "";
  position: absolute;
  inset: 19px;
  border: 1px dashed rgba(175, 134, 45, 0.2);
  border-radius: 50%;
}

.today-card {
  width: 100%;
  padding: 17px 17px 16px;
  overflow: hidden;
  border: 0;
  border-radius: 22px;
  background: var(--forest);
  color: #f5eee0;
  text-align: left;
  box-shadow: 0 22px 35px -26px rgba(31, 60, 51, 0.88);
  transition: transform 0.22s ease, box-shadow 0.22s ease;
  position: relative;
}

.today-card::after {
  content: "";
  position: absolute;
  right: -46px;
  bottom: -62px;
  width: 160px;
  height: 160px;
  border: 1px solid rgba(246, 240, 227, 0.08);
  border-radius: 50%;
  box-shadow: 0 0 0 28px rgba(246, 240, 227, 0.025);
  pointer-events: none;
}

.today-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 28px 40px -26px rgba(31, 60, 51, 0.9);
}

.today-card:focus-visible {
  outline: 2px solid var(--terracotta);
  outline-offset: 3px;
}

.today-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: rgba(245, 238, 224, 0.68);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
}

.today-card-head span:first-child {
  color: #eacb8b;
  font-weight: 700;
}

.today-card-body {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
}

.today-date {
  display: flex;
  align-items: flex-end;
  gap: 5px;
}

.today-date strong {
  font-family: var(--font-serif);
  font-size: 55px;
  font-weight: 500;
  line-height: 0.8;
  letter-spacing: -0.03em;
}

.today-date small {
  padding-bottom: 1px;
  color: rgba(245, 238, 224, 0.6);
  font-size: 10px;
  letter-spacing: 0.04em;
}

.progress-ring {
  position: relative;
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: conic-gradient(#ddb66e calc(var(--progress, 0) * 1%), rgba(246, 240, 227, 0.13) 0);
}

.progress-ring::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: var(--forest);
}

.progress-ring span {
  position: relative;
  z-index: 1;
  color: rgba(245, 238, 224, 0.84);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.today-caption {
  display: block;
  min-height: 16px;
  margin-top: 19px;
  color: rgba(245, 238, 224, 0.72);
  font-size: 11px;
  line-height: 1.55;
}

.today-track {
  display: block;
  height: 3px;
  margin-top: 10px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(246, 240, 227, 0.12);
}

.today-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: #dcb66e;
  transition: width 0.45s cubic-bezier(0.22, 0.8, 0.3, 1);
}

.month-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 20px 0 0;
  padding: 15px 0 16px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.month-stats div {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding-left: 12px;
  border-left: 1px solid var(--line);
}

.month-stats div:first-child {
  padding-left: 2px;
  border-left: 0;
}

.month-stats strong {
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 23px;
  font-weight: 500;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.month-stats span {
  color: var(--muted);
  font-size: 9.5px;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 16px;
  padding: 0 2px;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.legend-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--dot);
}

.rail-quote {
  margin: 30px 2px 0;
  padding-left: 11px;
  border-left: 1px solid rgba(197, 107, 69, 0.4);
  color: var(--muted);
  font-family: var(--font-serif);
  font-size: 14px;
  line-height: 1.7;
  letter-spacing: 0.04em;
}

/* ——— Calendar ——— */

.calendar-card {
  padding: 19px 19px 13px;
  border: 1px solid rgba(29, 43, 37, 0.1);
  border-radius: var(--radius-xl);
  background: rgba(251, 249, 243, 0.94);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(10px);
  animation: settle-in 0.6s 0.08s cubic-bezier(0.22, 0.8, 0.3, 1) both;
}

.calendar-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 23px;
  padding: 0 1px 12px;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.15em;
  line-height: 1.5;
}

.eyebrow .live-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-right: 5px;
  border-radius: 50%;
  background: var(--amber);
  vertical-align: 1px;
}

.caption-hint {
  margin: 0;
  color: var(--muted);
  font-size: 10.5px;
  white-space: nowrap;
}

.weekday-row {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  padding: 8px 0 8px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.weekday-row span {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-align: center;
}

.weekday-row span.weekend {
  color: var(--terracotta);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-auto-rows: minmax(112px, 1fr);
  border-bottom: 1px solid var(--line);
}

.day-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 7px 8px 6px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  outline: none;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.18s ease, box-shadow 0.18s ease;
}

.day-cell:nth-child(7n) {
  border-right: 0;
}

.day-cell:nth-last-child(-n + 7) {
  border-bottom: 0;
}

.day-cell:hover {
  background: rgba(244, 240, 230, 0.74);
}

.day-cell:focus-visible {
  z-index: 2;
  box-shadow: inset 0 0 0 2px var(--terracotta);
}

.day-cell.is-other-month {
  background: rgba(236, 230, 218, 0.28);
  color: var(--muted-light);
}

.day-cell.is-other-month:hover {
  background: rgba(236, 230, 218, 0.55);
}

.day-cell.is-selected {
  z-index: 1;
  background: var(--forest-wash);
  box-shadow: inset 0 0 0 1.5px var(--forest);
}

.day-cell.is-selected:hover {
  background: #e3ede5;
}

.day-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 27px;
}

.day-number {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  color: inherit;
  font-family: var(--font-serif);
  font-size: 15.5px;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  transition: color 0.18s ease, background 0.18s ease;
}

.day-cell.is-weekend:not(.is-other-month) .day-number {
  color: var(--terracotta);
}

.day-cell.is-today .day-number {
  color: var(--terracotta);
  box-shadow: inset 0 0 0 1px rgba(197, 107, 69, 0.65);
}

.day-cell.is-selected .day-number {
  background: var(--forest);
  color: #fbf5e9;
  box-shadow: none;
}

.day-cell.is-other-month .day-number {
  color: var(--muted-light);
}

.today-flag {
  margin-right: 1px;
  color: var(--terracotta);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.day-topright {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.day-extra {
  color: var(--muted);
  font-size: 9px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.day-cell.is-selected .today-flag {
  color: var(--forest-mid);
}

.cell-events {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  overflow: hidden;
  padding-top: 2px;
}

.event-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  height: 20px;
  padding: 0 5px;
  overflow: hidden;
  border-radius: 5px;
  background: var(--cat-soft);
  color: var(--cat);
  font-size: 10px;
  line-height: 1;
  white-space: nowrap;
  transition: opacity 0.18s ease;
}

.event-chip.is-done {
  opacity: 0.42;
  text-decoration: line-through;
}

.chip-time {
  flex: 0 0 auto;
  font-size: 9px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  opacity: 0.9;
}

.chip-title {
  min-width: 0;
  overflow: hidden;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0;
  text-overflow: ellipsis;
}

.calendar-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 1px 0;
  color: var(--muted);
  font-size: 9.5px;
}

.calendar-foot-key {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.calendar-foot-key i {
  display: block;
  width: 12px;
  height: 4px;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--forest-mid), var(--terracotta), var(--amber));
}

.calendar-foot-count {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Category colors */
.cat-study {
  --cat: #2f6b5a;
  --cat-soft: #e7efe9;
}

.cat-homework {
  --cat: #b45e3a;
  --cat-soft: #f7e9e1;
}

.cat-exam {
  --cat: #9c4039;
  --cat-soft: #f5e5e2;
}

.cat-life {
  --cat: #9b7627;
  --cat-soft: #f5edda;
}

.cat-club {
  --cat: #536e88;
  --cat-soft: #e8edf2;
}

.cat-other {
  --cat: #77786e;
  --cat-soft: #eeede8;
}

/* ——— Right rail ——— */

.right-rail {
  display: flex;
  flex-direction: column;
  gap: 18px;
  animation: settle-in 0.6s 0.15s cubic-bezier(0.22, 0.8, 0.3, 1) both;
}

.day-panel,
.pending-panel {
  border: 1px solid rgba(29, 43, 37, 0.1);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.day-panel {
  position: relative;
  padding: 20px 19px 13px;
  overflow: hidden;
  background: rgba(251, 249, 243, 0.96);
}

.day-panel::before {
  content: "";
  position: absolute;
  top: 0;
  right: 22px;
  left: 22px;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(47, 107, 90, 0.44), transparent);
}

.day-close {
  display: none;
}

.day-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.day-heading {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 3px;
}

.day-heading h2 {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 30px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.day-tag {
  display: inline-flex;
  align-items: center;
  min-height: 19px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #efe5d1;
  color: #82602a;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.day-tag.is-past {
  background: #ebe9e2;
  color: var(--muted);
}

.day-subline {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 10.5px;
  letter-spacing: 0.02em;
}

.day-progress {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex: 0 0 auto;
  padding-top: 4px;
}

.day-progress strong {
  color: var(--forest-mid);
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.day-progress span {
  color: var(--muted);
  font-size: 8.5px;
  letter-spacing: 0.06em;
}

.day-progress-track {
  height: 3px;
  margin: 14px 0 16px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(29, 43, 37, 0.08);
}

.day-progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--forest-mid);
  transition: width 0.4s cubic-bezier(0.22, 0.8, 0.3, 1);
}

.timeline {
  position: relative;
  --axis: 68px;
}

.timeline.has-items::before {
  content: "";
  position: absolute;
  top: 12px;
  bottom: 14px;
  left: var(--axis);
  width: 1px;
  background: var(--line);
}

.agenda-item {
  display: grid;
  grid-template-columns: 50px 16px minmax(0, 1fr);
  column-gap: 10px;
  min-width: 0;
  padding: 0 0 16px;
}

.agenda-item:last-child {
  padding-bottom: 5px;
}

.time-column {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  padding-top: 1px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
  white-space: nowrap;
}

.time-column small {
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 450;
}

.time-marker {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  padding-top: 4px;
}

.timeline-dot {
  display: block;
  width: 9px;
  height: 9px;
  border: 2px solid var(--card);
  border-radius: 50%;
  background: var(--cat);
  box-shadow: 0 0 0 1px var(--cat);
}

.agenda-item.is-done .timeline-dot {
  background: var(--muted-light);
  box-shadow: 0 0 0 1px var(--muted-light);
}

.agenda-body {
  position: relative;
  min-width: 0;
  padding-right: 28px;
}

.agenda-edit {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.agenda-edit:focus-visible {
  outline: 2px solid var(--terracotta);
  outline-offset: 3px;
  border-radius: 4px;
}

body.modal-open {
  overflow: hidden;
}

.agenda-title {
  display: block;
  margin: 0;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.agenda-item.is-done .agenda-title {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-color: rgba(124, 125, 114, 0.6);
}

.agenda-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

.category-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 18px;
  padding: 1px 7px;
  border-radius: 99px;
  background: var(--cat-soft);
  color: var(--cat);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.category-pill i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
}

.agenda-note {
  display: -webkit-box;
  margin: 6px 0 0;
  overflow: hidden;
  color: #62685f;
  font-size: 11px;
  line-height: 1.6;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.agenda-edit:hover .agenda-title {
  color: var(--forest-mid);
}

.agenda-item.is-done .agenda-body {
  opacity: 0.55;
}

.task-check {
  position: absolute;
  top: 1px;
  right: 0;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid rgba(29, 43, 37, 0.22);
  border-radius: 50%;
  background: transparent;
  color: transparent;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.task-check::before {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 50%;
}

.task-check svg {
  width: 12px;
  height: 12px;
  stroke-width: 2.2;
}

.task-check:hover {
  border-color: var(--forest-mid);
  color: var(--forest-mid);
  background: var(--forest-wash);
}

.agenda-item.is-done .task-check {
  border-color: var(--forest-mid);
  background: var(--forest-mid);
  color: #fffdf7;
}

.task-check:focus-visible {
  outline: 2px solid var(--terracotta);
  outline-offset: 2px;
}

.add-to-day {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 100%;
  min-height: 39px;
  margin-top: 8px;
  padding: 8px 10px;
  border: 0;
  border-top: 1px dashed var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 550;
  transition: color 0.18s ease;
}

.add-to-day svg {
  width: 14px;
  height: 14px;
}

.add-to-day:hover {
  color: var(--forest);
}

.empty-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 172px;
  padding: 15px 10px 22px;
  text-align: center;
}

.empty-orbit {
  position: relative;
  display: grid;
  place-items: center;
  width: 66px;
  height: 66px;
  margin-bottom: 13px;
  border: 1px dashed rgba(175, 134, 45, 0.3);
  border-radius: 50%;
}

.empty-orbit::before {
  content: "";
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #f4e5bd;
  box-shadow: 14px -12px 0 -9px rgba(197, 107, 69, 0.65);
}

.empty-orbit::after {
  content: "";
  position: absolute;
  right: 4px;
  bottom: 8px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--forest-mid);
}

.empty-day h3 {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.empty-day p {
  max-width: 230px;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
}

/* ——— Pending ——— */

.pending-panel {
  position: relative;
  padding: 18px 17px 15px;
  overflow: hidden;
  border-color: rgba(175, 134, 45, 0.22);
  background:
    linear-gradient(rgba(255, 253, 247, 0.36), rgba(255, 253, 247, 0.36)),
    repeating-linear-gradient(0deg, transparent 0 23px, rgba(139, 110, 57, 0.05) 23px 24px),
    var(--butter);
}

.pending-panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: repeating-linear-gradient(180deg, rgba(175, 134, 45, 0.5) 0 8px, transparent 8px 13px);
  opacity: 0.48;
}

.pending-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.pending-panel .eyebrow {
  color: #8d774e;
  font-size: 9px;
}

.pending-heading {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 3px;
}

.pending-heading h2 {
  margin: 0;
  color: #4b402d;
  font-family: var(--font-serif);
  font-size: 25px;
  font-weight: 600;
  line-height: 1.2;
}

.count-badge {
  display: grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 99px;
  background: rgba(139, 110, 57, 0.12);
  color: #715c35;
  font-size: 9.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.round-button {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid rgba(139, 110, 57, 0.24);
  border-radius: 50%;
  background: rgba(255, 252, 243, 0.45);
  color: #705e3e;
  transition: background 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
}

.round-button:hover {
  border-color: rgba(139, 110, 57, 0.5);
  background: rgba(255, 252, 243, 0.85);
  transform: rotate(90deg);
}

.round-button svg {
  width: 14px;
  height: 14px;
}

.pending-intro {
  margin: 8px 0 14px;
  color: #78684a;
  font-size: 10.5px;
  line-height: 1.6;
}

.pending-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pending-item {
  position: relative;
  padding: 12px 12px 10px;
  border: 1px solid rgba(139, 110, 57, 0.18);
  border-radius: 12px;
  background: rgba(255, 253, 246, 0.84);
  box-shadow: 0 5px 12px -9px rgba(88, 69, 32, 0.35);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.pending-item:hover {
  border-color: rgba(139, 110, 57, 0.28);
  box-shadow: 0 9px 18px -12px rgba(88, 69, 32, 0.4);
  transform: translateY(-1px);
}

.pending-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.schedule-button {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex: 0 0 auto;
  padding: 2px 0;
  border: 0;
  border-bottom: 1px solid transparent;
  background: transparent;
  color: #7f6941;
  font-size: 9.5px;
  font-weight: 650;
  transition: color 0.18s ease, border-color 0.18s ease;
}

.schedule-button:hover {
  color: #4e422e;
  border-color: rgba(78, 66, 46, 0.5);
}

.schedule-button svg {
  width: 11px;
  height: 11px;
}

.pending-title {
  margin: 7px 0 0;
  color: #383124;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.pending-note {
  margin: 7px 0 9px;
  padding-left: 8px;
  border-left: 2px solid rgba(175, 134, 45, 0.38);
  color: #67583e;
  font-family: var(--font-hand);
  font-size: 12px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.pending-note::before {
  content: "备注 · ";
  color: #927d58;
  font-family: var(--font-sans);
  font-size: 8.5px;
  letter-spacing: 0.02em;
}

.pending-note.is-empty {
  color: #a39377;
  font-style: italic;
}

.pending-note.is-empty::before {
  content: "";
}

.pending-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 7px;
  border-top: 1px dashed rgba(139, 110, 57, 0.16);
}

.complete-quiet {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: #7d6c4e;
  font-size: 9.5px;
  font-weight: 550;
  transition: color 0.18s ease;
}

.complete-quiet:hover {
  color: var(--forest);
}

.complete-quiet svg {
  width: 12px;
  height: 12px;
}

.pending-edit {
  display: grid;
  place-items: center;
  width: 23px;
  height: 23px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #a18f70;
  transition: background 0.18s ease, color 0.18s ease;
}

.pending-edit:hover {
  background: rgba(139, 110, 57, 0.1);
  color: #5d4c2f;
}

.pending-edit svg {
  width: 12px;
  height: 12px;
}

.pending-add {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 100%;
  min-height: 38px;
  margin-top: 11px;
  padding: 8px;
  border: 1px dashed rgba(139, 110, 57, 0.29);
  border-radius: 10px;
  background: rgba(255, 253, 246, 0.3);
  color: #74613f;
  font-size: 10.5px;
  font-weight: 550;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.pending-add:hover {
  border-color: rgba(139, 110, 57, 0.48);
  background: rgba(255, 253, 246, 0.65);
  color: #51432c;
}

.pending-add svg {
  width: 13px;
  height: 13px;
}

.pending-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 130px;
  padding: 20px 8px 16px;
  text-align: center;
}

.pending-empty svg {
  width: 38px;
  height: 38px;
  margin-bottom: 9px;
  color: rgba(139, 110, 57, 0.5);
  stroke-width: 1.15;
}

.pending-empty p {
  margin: 0;
  color: #7e6e50;
  font-family: var(--font-hand);
  font-size: 12px;
  line-height: 1.65;
}

.pending-empty small {
  margin-top: 4px;
  color: #998666;
  font-size: 9px;
}

.completed-pending-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  padding: 8px 2px 1px;
  border: 0;
  background: transparent;
  color: #897451;
  font-size: 9.5px;
}

.completed-pending-toggle:hover {
  color: #5d4c2f;
}

.completed-pending-toggle svg {
  width: 11px;
  height: 11px;
  transition: transform 0.2s ease;
}

.completed-pending-toggle.is-open svg {
  transform: rotate(180deg);
}

.pending-item.is-completed {
  opacity: 0.58;
}

.pending-item.is-completed .pending-title {
  text-decoration: line-through;
}

/* ——— Footer ——— */

.app-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 4px 0;
  color: var(--muted);
  font-size: 9.5px;
}

.app-footer p {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.privacy-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--forest-mid);
  opacity: 0.7;
}

.footer-actions {
  display: flex;
  align-items: center;
  gap: 3px;
}

.footer-button {
  padding: 4px 6px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-size: 9.5px;
  transition: background 0.18s ease, color 0.18s ease;
}

.footer-button:hover {
  background: rgba(31, 60, 51, 0.06);
  color: var(--ink);
}

/* ——— Modal ——— */

.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, visibility 0.22s ease;
}

.modal-layer.is-open {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.modal-scrim {
  position: absolute;
  inset: 0;
  background: rgba(23, 34, 29, 0.48);
  backdrop-filter: blur(6px);
}

.task-dialog {
  position: relative;
  width: min(604px, 100%);
  max-height: calc(100dvh - 44px);
  padding: 24px 24px 20px;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-xl);
  background: #fbf8ef;
  box-shadow: 0 28px 90px -24px rgba(14, 25, 20, 0.6);
  opacity: 0;
  transform: translateY(18px) scale(0.985);
  transition: opacity 0.24s ease, transform 0.3s cubic-bezier(0.22, 0.8, 0.3, 1);
  scrollbar-width: thin;
  scrollbar-color: rgba(31, 60, 51, 0.25) transparent;
}

.modal-layer.is-open .task-dialog {
  opacity: 1;
  transform: none;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 16px;
}

.modal-header h2 {
  margin: 3px 0 0;
  font-family: var(--font-serif);
  font-size: 30px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.01em;
}

.modal-close {
  flex: 0 0 auto;
  margin: -4px -5px 0 0;
}

#taskForm {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.form-field > label,
.category-field legend {
  padding: 0;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.02em;
}

.title-field > input {
  height: 49px;
  font-size: 16px;
  font-weight: 500;
}

.form-field input,
.form-field textarea {
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid rgba(29, 43, 37, 0.17);
  border-radius: 10px;
  outline: none;
  background: rgba(255, 253, 248, 0.9);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.4;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.form-field input {
  height: 41px;
}

.form-field input::placeholder,
.form-field textarea::placeholder {
  color: #aaa89c;
}

.form-field input:focus,
.form-field textarea:focus {
  border-color: rgba(47, 107, 90, 0.7);
  background: #fffdf8;
  box-shadow: 0 0 0 3px rgba(47, 107, 90, 0.09);
}

.form-field input.is-invalid,
.form-field textarea.is-invalid {
  border-color: rgba(169, 75, 67, 0.7);
  box-shadow: 0 0 0 3px rgba(169, 75, 67, 0.08);
}

.form-field textarea {
  min-height: 78px;
  resize: vertical;
}

input[type="date"],
input[type="time"] {
  color-scheme: light;
}

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
  opacity: 0.45;
  cursor: pointer;
}

.optional {
  color: var(--muted);
  font-size: 9px;
  font-weight: 450;
  letter-spacing: 0;
}

.category-field {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.category-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 1px;
}

.category-options label {
  position: relative;
  cursor: pointer;
}

.category-options input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.category-choice {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 32px;
  padding: 5px 12px;
  border: 1px solid rgba(29, 43, 37, 0.13);
  border-radius: 99px;
  background: rgba(255, 253, 248, 0.58);
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 550;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.category-choice i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cat);
}

.category-choice:hover {
  border-color: rgba(29, 43, 37, 0.24);
  background: rgba(255, 253, 248, 0.95);
}

.category-options input:checked + .category-choice {
  border-color: var(--cat);
  background: var(--cat);
  color: #fffdf8;
}

.category-options input:checked + .category-choice i {
  background: #fffdf8;
}

.category-options input:focus-visible + .category-choice {
  outline: 2px solid var(--terracotta);
  outline-offset: 2px;
}

.timing-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 13px;
  border: 1px solid rgba(29, 43, 37, 0.08);
  border-radius: 12px;
  background: rgba(235, 230, 218, 0.46);
}

.timing-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.timing-copy strong {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 650;
}

.timing-copy span {
  color: var(--muted);
  font-size: 10px;
}

.switch {
  position: relative;
  width: 39px;
  height: 23px;
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  border-radius: 99px;
  background: #c3c0b5;
  transition: background 0.2s ease;
}

.switch span {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: #fffdf7;
  box-shadow: 0 1px 3px rgba(29, 43, 37, 0.28);
  transition: transform 0.22s cubic-bezier(0.22, 0.8, 0.3, 1);
}

.switch[aria-checked="true"] {
  background: var(--forest-mid);
}

.switch[aria-checked="true"] span {
  transform: translateX(16px);
}

.timing-fields {
  display: grid;
  grid-template-columns: 1.35fr 0.9fr 0.9fr;
  gap: 10px;
  margin-top: -3px;
  animation: fields-in 0.2s ease both;
}

.untimed-hint {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-top: -4px;
  padding: 10px 12px;
  border: 1px solid rgba(175, 134, 45, 0.22);
  border-radius: 10px;
  background: rgba(247, 237, 207, 0.65);
  color: #6f5e3e;
  font-size: 10.5px;
  line-height: 1.65;
  animation: fields-in 0.2s ease both;
}

.untimed-hint span {
  color: var(--amber);
}

.field-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 9px;
}

.form-error {
  margin: -4px 0 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(169, 75, 67, 0.08);
  color: var(--danger);
  font-size: 11px;
  line-height: 1.5;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
}

.modal-footer-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-left: auto;
}

.secondary-button {
  min-height: 41px;
  padding: 8px 15px;
  border: 1px solid rgba(29, 43, 37, 0.15);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 11.5px;
  font-weight: 550;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.secondary-button:hover {
  border-color: rgba(29, 43, 37, 0.25);
  background: rgba(29, 43, 37, 0.04);
}

.modal-save {
  min-width: 108px;
}

.danger-button {
  padding: 7px 2px;
  border: 0;
  border-bottom: 1px solid transparent;
  background: transparent;
  color: rgba(169, 75, 67, 0.88);
  font-size: 10.5px;
  transition: color 0.18s ease, border-color 0.18s ease;
}

.danger-button:hover {
  color: var(--danger);
  border-color: rgba(169, 75, 67, 0.4);
}

.danger-button.is-confirming {
  padding: 8px 12px;
  border: 1px solid var(--danger);
  border-radius: 999px;
  background: var(--danger);
  color: #fff9f5;
}

/* ——— Toast ——— */

.toast {
  position: fixed;
  bottom: max(24px, env(safe-area-inset-bottom));
  left: 50%;
  z-index: 140;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 32px);
  padding: 11px 15px;
  border: 1px solid rgba(246, 240, 227, 0.12);
  border-radius: 999px;
  background: rgba(31, 60, 51, 0.96);
  color: #f7f1e5;
  font-size: 11.5px;
  line-height: 1.45;
  box-shadow: 0 18px 32px -16px rgba(20, 35, 28, 0.55);
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
  backdrop-filter: blur(10px);
}

.toast.is-visible {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
}

.toast.is-error {
  background: rgba(120, 45, 39, 0.97);
}

.toast-mark {
  width: 5px;
  height: 5px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #ddb66e;
}

.toast-action {
  flex: 0 0 auto;
  margin-left: 2px;
  padding: 2px 1px;
  border: 0;
  border-bottom: 1px solid rgba(247, 241, 229, 0.45);
  background: transparent;
  color: #f7f1e5;
  font-size: 11px;
  font-weight: 650;
}

.toast-action:hover {
  border-color: #f7f1e5;
}

/* ——— Responsive ——— */

@media (max-width: 1380px) {
  .app-shell {
    padding-right: 26px;
    padding-left: 26px;
  }

  .layout {
    grid-template-columns: 190px minmax(0, 1fr) 352px;
    gap: 16px;
  }

  .month-masthead h2 {
    font-size: 62px;
  }

  .legend {
    gap: 8px;
  }

  .day-panel {
    padding-right: 16px;
    padding-left: 16px;
  }

  .pending-panel {
    padding-right: 14px;
    padding-left: 14px;
  }

  .calendar-grid {
    grid-auto-rows: minmax(112px, 1fr);
  }

  .day-cell {
    padding-right: 6px;
    padding-left: 6px;
  }
}

@media (max-width: 1320px) {
  .layout {
    grid-template-columns: minmax(0, 1fr) 352px;
  }

  .left-rail {
    display: none;
  }

  .calendar-grid {
    grid-auto-rows: minmax(112px, 1fr);
  }

  .topbar {
    grid-template-columns: minmax(160px, 1fr) auto minmax(160px, 1fr);
  }
}

@media (max-width: 1120px) {
  .local-badge {
    display: none;
  }

  .topbar {
    gap: 14px;
  }

  .calendar-card {
    padding-right: 15px;
    padding-left: 15px;
  }

  .caption-hint {
    font-size: 10px;
  }

  .calendar-grid {
    grid-auto-rows: minmax(112px, 1fr);
  }
}

@media (max-width: 1020px) {
  .app-shell {
    max-width: 880px;
    padding: 20px 22px 24px;
  }

  .topbar {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "brand actions"
      "nav nav";
    gap: 11px 16px;
    padding-bottom: 16px;
  }

  .brand {
    grid-area: brand;
  }

  .month-nav {
    grid-area: nav;
    justify-self: stretch;
    justify-content: space-between;
  }

  .month-label {
    flex: 1;
    min-width: 0;
  }

  .top-actions {
    grid-area: actions;
  }

  .layout {
    display: block;
  }

  .calendar-card {
    padding: 16px 16px 12px;
  }

  .calendar-grid {
    grid-auto-rows: minmax(112px, 1fr);
  }

  .day-cell {
    padding: 7px 7px 6px;
  }

  .right-rail {
    display: block;
    margin-top: 16px;
    animation: none;
  }

  .pending-panel {
    margin-top: 0;
    padding: 18px 18px 15px;
  }

  .pending-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  .pending-empty,
  .completed-pending-toggle {
    grid-column: 1 / -1;
  }

  .day-panel {
    position: fixed;
    right: auto;
    bottom: 0;
    left: 50%;
    z-index: 61;
    width: min(620px, 100%);
    max-height: 88dvh;
    margin: 0;
    padding: 22px 22px calc(14px + env(safe-area-inset-bottom));
    overflow-y: auto;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -24px 70px -28px rgba(23, 34, 29, 0.5);
    transform: translate(-50%, 105%);
    transition: transform 0.32s cubic-bezier(0.22, 0.8, 0.3, 1);
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(31, 60, 51, 0.25) transparent;
  }

  .day-panel::before {
    right: 24px;
    left: 24px;
  }

  body.day-open .day-panel {
    transform: translate(-50%, 0);
  }

  body.day-open {
    overflow: hidden;
  }

  .day-close {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 2;
    display: grid;
    width: 34px;
    height: 34px;
    background: rgba(29, 43, 37, 0.05);
  }

  .day-header {
    padding-right: 42px;
  }

  .day-heading h2 {
    font-size: 27px;
  }

  .day-backdrop {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: block;
    background: rgba(23, 34, 29, 0.36);
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    backdrop-filter: blur(3px);
    transition: opacity 0.26s ease, visibility 0.26s ease;
  }

  body.day-open .day-backdrop {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
  }

  .timeline {
    --axis: 67px;
  }

  .agenda-item {
    grid-template-columns: 49px 16px minmax(0, 1fr);
    column-gap: 10px;
  }

  .agenda-title {
    font-size: 14px;
  }

  .agenda-note {
    font-size: 11.5px;
  }

  .app-footer {
    padding-top: 18px;
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: max(14px, env(safe-area-inset-top)) 13px calc(22px + env(safe-area-inset-bottom));
  }

  .topbar {
    gap: 10px 12px;
    padding-bottom: 13px;
  }

  .brand {
    gap: 9px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    font-size: 22px;
  }

  .brand-words h1 {
    font-size: 18px;
  }

  .brand-words p {
    margin-top: 3px;
    font-size: 9.5px;
  }

  .primary-button {
    min-height: 38px;
    padding: 8px 14px;
    font-size: 11.5px;
  }

  .primary-button svg {
    width: 15px;
    height: 15px;
  }

  .month-nav {
    padding: 3px;
  }

  .nav-arrow {
    width: 36px;
    height: 36px;
  }

  .month-label {
    min-width: 0;
    font-size: 15px;
  }

  .nav-separator {
    margin: 0 2px;
  }

  .today-button {
    padding: 6px 9px;
    font-size: 11px;
  }

  .demo-notice {
    align-items: flex-start;
    gap: 10px;
    padding: 9px 11px;
  }

  .demo-notice p {
    font-size: 10.5px;
  }

  .demo-spark {
    font-size: 13px;
  }

  .demo-notice .text-button {
    font-size: 10px;
    white-space: nowrap;
  }

  .calendar-card {
    padding: 12px 10px 10px;
    border-radius: 20px;
  }

  .calendar-caption {
    min-height: 20px;
    padding: 0 2px 9px;
  }

  .caption-hint {
    font-size: 9.5px;
  }

  .weekday-row {
    padding: 7px 0;
  }

  .weekday-row span {
    font-size: 9.5px;
  }

  .calendar-grid {
    grid-auto-rows: 80px;
  }

  .day-cell {
    gap: 1px;
    padding: 6px 4px 5px;
    border-right: 1px solid rgba(29, 43, 37, 0.09);
  }

  .day-cell.is-selected {
    box-shadow: inset 0 0 0 1.5px var(--forest);
  }

  .day-topline {
    min-height: 21px;
  }

  .day-number {
    width: 23px;
    height: 23px;
    font-size: 13px;
  }

  .today-flag {
    display: none;
  }

  .day-extra {
    font-size: 8px;
  }

  .cell-events {
    gap: 3px;
    padding-top: 4px;
  }

  .event-chip {
    height: 4px;
    min-height: 4px;
    padding: 0;
    border-radius: 99px;
    background: var(--cat);
    opacity: 0.82;
  }

  .event-chip.is-done {
    opacity: 0.28;
  }

  .chip-time,
  .chip-title {
    display: none;
  }

  .agenda-title {
    font-size: 13.5px;
  }

  .agenda-note {
    font-size: 11px;
  }

  .calendar-foot {
    justify-content: flex-end;
    padding-top: 9px;
  }

  .calendar-foot-key {
    display: none;
  }

  .day-panel {
    width: 100%;
    max-height: 90dvh;
    padding: 20px 18px calc(12px + env(safe-area-inset-bottom));
    border-radius: 22px 22px 0 0;
  }

  .day-heading h2 {
    font-size: 26px;
  }

  .day-subline {
    font-size: 10px;
  }

  .timeline {
    --axis: 63px;
  }

  .agenda-item {
    grid-template-columns: 45px 16px minmax(0, 1fr);
    column-gap: 10px;
  }

  .agenda-body {
    padding-right: 26px;
  }

  .right-rail {
    margin-top: 13px;
  }

  .pending-panel {
    padding: 16px 14px 13px;
    border-radius: 20px;
  }

  .pending-list {
    display: flex;
  }

  .pending-heading h2 {
    font-size: 24px;
  }

  .pending-item {
    padding: 11px 12px 9px;
  }

  .app-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 17px 2px 0;
    font-size: 9px;
  }

  .footer-actions {
    margin-left: -6px;
  }

  .task-dialog {
    width: 100%;
    max-height: 92dvh;
    padding: 21px 18px calc(16px + env(safe-area-inset-bottom));
    border-radius: 22px 22px 0 0;
    transform: translateY(100%);
  }

  .modal-layer {
    align-items: flex-end;
    padding: 0;
  }

  .modal-header h2 {
    font-size: 27px;
  }

  .timing-fields {
    grid-template-columns: 1fr 1fr;
  }

  .timing-fields .form-field:first-child {
    grid-column: 1 / -1;
  }

  .category-options {
    gap: 5px;
  }

  .category-choice {
    min-height: 30px;
    padding: 4px 10px;
    font-size: 10.5px;
  }

  .modal-footer {
    align-items: center;
  }

  .toast {
    bottom: max(18px, env(safe-area-inset-bottom));
    width: max-content;
    max-width: calc(100% - 28px);
    padding: 9px 13px;
    font-size: 10.5px;
  }
}

@media (max-width: 390px) {
  .brand-words p {
    display: none;
  }

  .brand-words h1 {
    font-size: 17px;
  }

  .primary-button {
    gap: 5px;
    padding: 8px 12px;
  }

  .month-label {
    font-size: 14px;
  }

  .today-button {
    padding-right: 7px;
    padding-left: 7px;
  }

  .demo-notice-copy {
    gap: 7px;
  }

  .demo-notice .text-button {
    font-size: 9.5px;
  }

  .timing-row {
    gap: 10px;
    padding: 10px 11px;
  }

  .timing-copy span {
    font-size: 9.5px;
  }

  .modal-save {
    min-width: 95px;
  }
}

/* ——— Motion ——— */

@keyframes settle-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes fields-in {
  from {
    opacity: 0;
    transform: translateY(-3px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.noscript {
  position: fixed;
  right: 16px;
  bottom: 16px;
  left: 16px;
  z-index: 200;
  padding: 14px;
  border-radius: 12px;
  background: var(--forest);
  color: var(--cream);
  text-align: center;
  font-size: 12px;
}

/* ————————————————————————————————
   Sync badge & week view
   ———————————————————————————————— */

.sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(251, 249, 243, 0.72);
  color: var(--muted);
  font-size: 10px;
  font-weight: 550;
  letter-spacing: 0.02em;
  white-space: nowrap;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.sync-badge:hover {
  border-color: var(--line-strong);
  background: var(--card-solid);
  color: var(--ink-soft);
}

.sync-badge i {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--muted-light);
}

.sync-badge.is-synced i {
  background: var(--forest-mid);
  box-shadow: 0 0 0 3px rgba(47, 107, 90, 0.1);
}

.sync-badge.is-syncing i {
  background: var(--amber);
  animation: sync-pulse 1.1s ease infinite;
}

.sync-badge.is-error i {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(169, 75, 67, 0.09);
}

.sync-badge.is-local i {
  background: #a7a79d;
}

.sync-badge.is-idle i {
  background: #b79a5b;
}

.sync-badge:focus-visible {
  outline: 2px solid var(--terracotta);
  outline-offset: 2px;
}

.sync-badge:disabled {
  opacity: 0.55;
  cursor: default;
}

.sync-badge[disabled] span {
  opacity: 0.7;
}

.month-label span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.month-label.is-week {
  max-width: 235px;
  font-size: 14px;
}

@keyframes sync-pulse {
  0%,
  100% {
    opacity: 0.45;
    transform: scale(0.85);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}

.calendar-caption-right {
  display: flex;
  align-items: center;
  gap: 11px;
}

.view-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(232, 225, 212, 0.6);
}

.view-switch__button {
  min-width: 34px;
  height: 25px;
  padding: 0 9px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.view-switch__button:hover {
  color: var(--ink);
}

.view-switch__button.is-active {
  background: var(--card-solid);
  color: var(--forest);
  box-shadow: 0 2px 7px -3px rgba(31, 60, 51, 0.25);
}

.view-switch__button:focus-visible {
  outline: 2px solid var(--terracotta);
  outline-offset: 2px;
}

.week-view {
  border-top: 1px solid var(--line);
}

.week-row {
  display: grid;
  grid-template-columns: 94px minmax(0, 1fr);
  min-height: 84px;
  border-bottom: 1px solid var(--line);
  transition: background 0.18s ease;
}

.week-row:last-child {
  border-bottom: 0;
}

.week-row:hover {
  background: rgba(245, 241, 231, 0.58);
}

.week-row.is-selected {
  background: var(--forest-wash);
  box-shadow: inset 2px 0 0 var(--forest);
}

.week-date {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 13px 12px 12px 15px;
  border: 0;
  border-right: 1px dashed rgba(29, 43, 37, 0.13);
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.week-date:hover .week-date-number {
  color: var(--forest-mid);
}

.week-date:focus-visible {
  outline: 2px solid var(--terracotta);
  outline-offset: -2px;
}

.week-weekday {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.06em;
}

.week-date-number {
  margin-top: 1px;
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 25px;
  font-weight: 600;
  line-height: 1.12;
  font-variant-numeric: tabular-nums;
}

.week-date-month {
  margin-top: 1px;
  color: var(--muted-light);
  font-size: 8px;
}

.week-row.is-weekend .week-date-number {
  color: var(--terracotta);
}

.week-row.is-today .week-date-number {
  color: var(--terracotta);
  box-shadow: inset 0 -1px 0 rgba(197, 107, 69, 0.5);
}

.week-row.is-selected .week-date-number {
  color: var(--forest);
  box-shadow: none;
}

.week-today-flag {
  margin-top: 4px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #efe1c7;
  color: #87652d;
  font-size: 7px;
  font-weight: 650;
  letter-spacing: 0.02em;
  line-height: 1.5;
}

.week-row-events {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: 8px 15px 8px 13px;
}

.week-task {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px dashed rgba(29, 43, 37, 0.09);
}

.week-task:last-child {
  border-bottom: 0;
}

.week-task-main {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.week-task-main:focus-visible {
  outline: 2px solid var(--terracotta);
  outline-offset: 2px;
  border-radius: 3px;
}

.week-cat {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  margin-top: 7px;
  border-radius: 50%;
  background: var(--cat);
}

.week-task-time {
  width: 40px;
  flex: 0 0 auto;
  padding-top: 1px;
  color: var(--ink-soft);
  font-size: 9px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  line-height: 1.45;
}

.week-task-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.week-task-title {
  overflow: hidden;
  color: var(--ink);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.week-task-note {
  overflow: hidden;
  margin-top: 1px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.week-task.is-done .week-task-main {
  opacity: 0.52;
}

.week-task.is-done .week-task-title {
  text-decoration: line-through;
}

.week-task-check {
  position: static;
  flex: 0 0 auto;
  width: 19px;
  height: 19px;
  margin-top: 1px;
}

.week-task-check svg {
  width: 11px;
  height: 11px;
}

.week-empty {
  padding: 3px 0;
  color: var(--muted-light);
  font-family: var(--font-serif);
  font-size: 10px;
  letter-spacing: 0.02em;
}

/* ————————————————————————————————
   Sync dialog
   ———————————————————————————————— */

.sync-dialog {
  position: relative;
  width: min(690px, 100%);
  max-height: calc(100dvh - 44px);
  padding: 24px 24px 20px;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-xl);
  background: #fbf8ef;
  box-shadow: 0 28px 90px -24px rgba(14, 25, 20, 0.6);
  opacity: 0;
  transform: translateY(18px) scale(0.985);
  transition: opacity 0.24s ease, transform 0.3s cubic-bezier(0.22, 0.8, 0.3, 1);
  scrollbar-width: thin;
  scrollbar-color: rgba(31, 60, 51, 0.25) transparent;
}

.sync-layer.is-open .sync-dialog {
  opacity: 1;
  transform: none;
}

.sync-setup,
.sync-connected {
  padding-top: 15px;
}

.sync-lead {
  margin: 0 0 18px;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.75;
}

.sync-choice-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  padding: 15px;
  border: 1px solid rgba(47, 107, 90, 0.16);
  border-radius: 15px;
  background: rgba(232, 240, 233, 0.55);
}

.sync-choice-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--forest);
  color: #f7f0e1;
  font-family: var(--font-serif);
  font-size: 22px;
  line-height: 1;
}

.sync-choice-card h3,
.sync-pair-copy h3 {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.35;
}

.sync-choice-card p,
.sync-pair-copy p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.55;
}

.sync-choice-card .primary-button {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 8px 13px;
  font-size: 10.5px;
}

.sync-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 19px 0 14px;
  color: var(--muted-light);
  font-size: 8.5px;
  letter-spacing: 0.05em;
}

.sync-divider::before,
.sync-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.sync-connect-form {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.sync-connect-form label {
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 600;
}

.sync-connect-row {
  display: flex;
  gap: 8px;
}

.sync-connect-row input {
  flex: 1;
  min-width: 0;
  height: 41px;
  padding: 0 12px;
  border: 1px solid rgba(29, 43, 37, 0.16);
  border-radius: 10px;
  outline: none;
  background: #fffdf8;
  color: var(--ink);
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.sync-connect-row input:focus {
  border-color: rgba(47, 107, 90, 0.7);
  box-shadow: 0 0 0 3px rgba(47, 107, 90, 0.09);
}

.sync-connect-row .secondary-button {
  flex: 0 0 auto;
  min-height: 41px;
}

.sync-footnote {
  margin: 13px 0 0;
  color: var(--muted-light);
  font-size: 8.5px;
  line-height: 1.65;
}

.sync-error {
  margin-top: 12px;
  padding: 9px 11px;
  border-radius: 8px;
  background: rgba(169, 75, 67, 0.08);
  color: var(--danger);
  font-size: 9.5px;
  line-height: 1.55;
}

.sync-error.is-info {
  background: rgba(47, 107, 90, 0.07);
  color: var(--forest-mid);
}

.sync-overview {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 13px;
}

.sync-status-text {
  display: block;
  margin-top: 3px;
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.2;
}

.sync-last-time {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 8.5px;
}

.sync-pill {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--paper-deep);
  color: var(--muted);
  font-size: 8px;
  font-weight: 650;
  white-space: nowrap;
}

.sync-pill.is-synced {
  background: var(--forest-wash);
  color: var(--forest-mid);
}

.sync-pill.is-syncing {
  background: #f5edda;
  color: var(--amber);
}

.sync-pill.is-error {
  background: rgba(169, 75, 67, 0.09);
  color: var(--danger);
}

.sync-pill.is-idle {
  background: #f5edda;
  color: #8e7133;
}

button:disabled,
.sync-copy-button:disabled,
.sync-connect-row button:disabled {
  opacity: 0.5;
  cursor: default;
}

.sync-code-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(235, 230, 218, 0.48);
}

.sync-code-label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.sync-code-card code {
  display: block;
  color: var(--ink);
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.sync-copy-button {
  flex: 0 0 auto;
  padding: 5px 3px;
  border: 0;
  border-bottom: 1px solid rgba(31, 60, 51, 0.3);
  background: transparent;
  color: var(--forest-mid);
  font-size: 9px;
  font-weight: 600;
}

.sync-copy-button:hover {
  border-color: var(--forest);
  color: var(--forest);
}

.sync-pair {
  display: flex;
  align-items: center;
  gap: 17px;
  margin-top: 16px;
  padding: 14px;
  border: 1px dashed rgba(29, 43, 37, 0.16);
  border-radius: 14px;
}

.sync-qr {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 132px;
  height: 132px;
  flex: 0 0 auto;
  padding: 7px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
}

.sync-qr img {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

.sync-qr-fallback {
  color: var(--muted);
  font-size: 7px;
  line-height: 1.4;
  word-break: break-all;
}

.sync-pair-copy {
  min-width: 0;
}

.sync-pair-copy .eyebrow {
  font-size: 7.5px;
}

.sync-pair-copy h3 {
  margin-top: 3px;
}

.sync-pair-copy .secondary-button {
  min-height: 31px;
  margin-top: 9px;
  padding: 6px 11px;
  font-size: 9.5px;
}

.sync-actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 17px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
}

.sync-actions-row .secondary-button {
  min-height: 35px;
  padding: 7px 13px;
  font-size: 10px;
}

.danger-link {
  padding: 6px 2px;
  border: 0;
  border-bottom: 1px solid transparent;
  background: transparent;
  color: rgba(169, 75, 67, 0.8);
  font-size: 9.5px;
}

.danger-link:hover {
  color: var(--danger);
  border-color: rgba(169, 75, 67, 0.35);
}

.sync-warning {
  margin: 14px 0 0;
  padding: 9px 11px;
  border-left: 2px solid rgba(175, 134, 45, 0.45);
  background: rgba(247, 237, 207, 0.45);
  color: #78684a;
  font-size: 8.5px;
  line-height: 1.7;
}

.sync-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 19px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted-light);
  font-size: 8px;
}

.sync-footer .secondary-button {
  min-height: 33px;
  padding: 7px 13px;
  font-size: 9.5px;
}

@media (max-width: 720px) {
  .sync-badge {
    width: 34px;
    height: 34px;
    min-height: 0;
    padding: 0;
    justify-content: center;
  }

  .sync-badge span {
    display: none;
  }

  .calendar-caption {
    gap: 8px;
  }

  .caption-hint {
    display: none;
  }

  .calendar-caption-right {
    margin-left: auto;
  }

  .view-switch__button {
    height: 23px;
    padding: 0 8px;
  }

  .month-label.is-week {
    max-width: 190px;
    font-size: 12.5px;
  }

  .week-row {
    grid-template-columns: 78px minmax(0, 1fr);
    min-height: 72px;
  }

  .week-date {
    padding: 10px 9px 9px 12px;
  }

  .week-date-number {
    font-size: 22px;
  }

  .week-row-events {
    padding: 6px 11px 6px 10px;
  }

  .week-task {
    gap: 6px;
    padding: 6px 0;
  }

  .week-task-main {
    gap: 6px;
  }

  .week-task-time {
    width: 34px;
    font-size: 8.5px;
  }

  .week-task-title {
    font-size: 10.5px;
  }

  .week-task-note {
    font-size: 8.5px;
  }

  .week-task-check {
    width: 19px;
    height: 19px;
  }

  .week-empty {
    font-size: 9px;
  }

  .sync-dialog {
    width: 100%;
    max-height: 92dvh;
    padding: 21px 18px calc(16px + env(safe-area-inset-bottom));
    border-radius: 22px 22px 0 0;
    transform: translateY(100%);
  }

  .sync-layer.is-open .sync-dialog {
    transform: translateY(0);
  }

  .sync-choice-card {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
  }

  .sync-choice-card .primary-button {
    grid-column: 1 / -1;
    width: 100%;
    min-height: 38px;
  }

  .sync-pair {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .sync-qr {
    align-self: center;
    width: 138px;
    height: 138px;
  }

  .sync-pair-copy .secondary-button {
    width: 100%;
  }

  .sync-code-card code {
    font-size: 10.5px;
    letter-spacing: 0.07em;
  }

  .sync-footer {
    align-items: center;
  }
}

@media (max-width: 390px) {
  .sync-choice-icon {
    width: 34px;
    height: 34px;
    font-size: 20px;
  }

  .sync-choice-card {
    padding: 12px;
  }

  .sync-code-card code {
    font-size: 9.5px;
  }
}
