:root {
  --sticky-top: 92px;
  --cream: #f0ede8;
  --cream-2: #e7e2da;
  --ink: #111218;
  --ink-2: #2a2b33;
  --muted: #6b6a66;
  --line: #d8d2c8;
  --gold: #c49a5c;
  --gold-2: #a9803f;
  --white: #fbfaf8;
  --serif-head: "Cormorant Garamond", "Times New Roman", Times, serif;
  --serif-body: "Times New Roman", Times, Georgia, serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--cream);
  color: var(--ink);
  font-family: var(--serif-body);
  font-size: 17px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--serif-head); font-weight: 700; margin: 0; letter-spacing: 0.005em; }
a { color: inherit; }
button { font: inherit; color: inherit; }
.eyebrow { font-family: var(--serif-head); font-weight: 600; text-transform: uppercase; letter-spacing: 0.14em; font-size: 12px; color: var(--gold-2); margin: 0 0 6px; }

.top { display: flex; align-items: center; justify-content: space-between; padding: 18px 28px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--serif-head); font-weight: 700; font-size: 22px; }
.topnav { display: flex; gap: 22px; }
.link { background: none; border: 0; padding: 0; cursor: pointer; text-decoration: none; font-family: var(--serif-head); font-weight: 600; font-size: 17px; border-bottom: 2px solid transparent; }
.link[aria-pressed="true"] { border-bottom-color: var(--gold); }

.hero { padding: 48px 28px 22px; max-width: 980px; }
.hero h1 { font-size: clamp(34px, 5vw, 56px); line-height: 1.05; }
.lede { font-size: 19px; color: var(--ink-2); margin: 16px 0 0; max-width: 760px; }
.lede span { font-family: var(--serif-head); font-weight: 700; color: var(--ink); }

.filters { display: flex; flex-wrap: wrap; gap: 14px; align-items: end; padding: 18px 28px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--white); position: sticky; top: 0; z-index: 5; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 150px; max-width: 260px; }
.field.grow { flex: 1 1 220px; }
.field label { font-family: var(--serif-head); font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
input, select { font: inherit; font-size: 16px; padding: 8px 10px; border: 1px solid var(--line); background: var(--cream); color: var(--ink); border-radius: 3px; min-height: 40px; }
input:focus, select:focus { outline: 2px solid var(--gold); outline-offset: 1px; }

.btn { border: 1px solid var(--ink); background: var(--ink); color: var(--cream); padding: 9px 16px; border-radius: 3px; cursor: pointer; font-family: var(--serif-head); font-weight: 600; font-size: 16px; text-decoration: none; display: inline-block; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--ink); }
.btn.gold { background: var(--gold); border-color: var(--gold); color: var(--ink); }
.btn.gold:hover { background: var(--gold-2); border-color: var(--gold-2); }
.btn.sm { padding: 5px 10px; font-size: 14px; }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 0; min-height: 60vh; }
.content { padding: 18px 28px 40px; min-width: 0; }
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 12px; flex-wrap: wrap; }
.range { font-family: var(--serif-head); font-weight: 700; font-size: 26px; }
.toolbar-actions { display: flex; gap: 6px; }
.status { color: var(--muted); font-size: 15px; min-height: 22px; margin-bottom: 8px; }
.status.error { color: #8a2d2d; }

/* Agenda */
.day { margin: 0 0 22px; }
.day-head { display: flex; align-items: baseline; gap: 12px; border-bottom: 1px solid var(--ink); padding-bottom: 4px; margin-bottom: 6px; position: sticky; top: var(--sticky-top); background: var(--cream); z-index: 2; }
.day-head h3 { font-size: 22px; }
.day-head .count { color: var(--muted); font-size: 14px; }
.row { display: grid; grid-template-columns: 74px minmax(0, 1fr) auto; gap: 12px; align-items: baseline; padding: 8px 6px; border-bottom: 1px solid var(--line); cursor: pointer; border-left: 3px solid transparent; }
.row:hover, .row.active { background: var(--white); border-left-color: var(--gold); }
.row .time { font-variant-numeric: tabular-nums; color: var(--ink-2); white-space: nowrap; }
.row .time small { display: block; color: var(--muted); font-size: 12px; }
.row .title { font-size: 17px; line-height: 1.3; overflow-wrap: anywhere; }
.row .meta { color: var(--muted); font-size: 14px; }
.row .tags { display: flex; gap: 6px; white-space: nowrap; }
.tag { font-family: var(--serif-head); font-weight: 600; font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; padding: 2px 7px; border: 1px solid var(--line); border-radius: 2px; color: var(--ink-2); background: var(--white); }
.tag.type { border-color: var(--gold); color: var(--gold-2); }
.tag.stale { border-color: #b98a3a; color: #7a5a1e; }
.more { text-align: center; margin: 12px 0 0; }

/* Month */
.month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 3px; overflow: hidden; background: var(--line); gap: 1px; }
.dow { background: var(--white); padding: 8px 6px; font-family: var(--serif-head); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); text-align: center; }
.cell { background: var(--cream); min-height: 96px; padding: 6px; cursor: pointer; display: flex; flex-direction: column; gap: 3px; }
.cell.other { background: var(--cream-2); color: var(--muted); }
.cell.today .dnum { color: var(--gold-2); }
.cell.selected { outline: 2px solid var(--gold); outline-offset: -2px; }
.cell.locked { cursor: default; opacity: 0.55; }
.dnum { font-family: var(--serif-head); font-weight: 700; font-size: 15px; }
.cell .n { font-size: 13px; color: var(--ink-2); }
.cell .pip { font-size: 12px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell .pip::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--gold); margin-right: 5px; vertical-align: middle; }
.cell:hover:not(.locked) { background: var(--white); }
.month-day-list { margin-top: 16px; }

/* Detail */
.detail { border-left: 1px solid var(--line); padding: 22px; background: var(--white); position: sticky; top: var(--sticky-top); align-self: start; max-height: calc(100vh - var(--sticky-top)); overflow: auto; }
.detail-empty p { color: var(--muted); }
.detail h2 { font-size: 24px; line-height: 1.15; margin-bottom: 10px; overflow-wrap: anywhere; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 10px; font-size: 15px; margin: 14px 0; }
.kv dt { color: var(--muted); font-family: var(--serif-head); font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.countdown { font-family: var(--serif-head); font-weight: 700; font-size: 20px; color: var(--gold-2); }
.orig { color: var(--muted); font-size: 14px; }
.detail .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

.pro-gate { margin-top: 26px; padding: 20px; border: 1px solid var(--gold); background: var(--white); border-radius: 3px; }
.pro-gate h3 { font-size: 22px; margin-bottom: 4px; }

.pro { padding: 48px 28px; border-top: 1px solid var(--line); }
.pro-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; max-width: 980px; }
.pro h2 { font-size: 42px; }
.pro h2 span { font-size: 18px; color: var(--muted); font-weight: 500; }
.pro h2 em { font-size: 16px; color: var(--muted); font-style: italic; font-weight: 500; display: block; }
.pro ul { padding-left: 18px; margin: 12px 0 18px; }
.pro-card { border: 1px solid var(--gold); padding: 22px; background: var(--white); border-radius: 3px; }
.fine { color: var(--muted); font-size: 14px; margin: 10px 0 0; }

.foot { padding: 28px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; max-width: 980px; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .detail { position: fixed; left: 0; right: 0; bottom: 0; top: auto; max-height: 70vh; border-left: 0; border-top: 1px solid var(--line); box-shadow: 0 -10px 30px rgba(17,18,24,0.12); transform: translateY(100%); transition: transform .2s ease; z-index: 20; }
  .detail.open { transform: none; }
  .day-head { top: 0; }
  .filters { position: static; }
  .row { grid-template-columns: 62px minmax(0, 1fr); }
  .row .tags { grid-column: 2; flex-wrap: wrap; white-space: normal; }
  .pro-grid { grid-template-columns: 1fr; }
  .cell { min-height: 64px; }
  .cell .pip { display: none; }
}

/* Accounts */
.modal { position: fixed; inset: 0; background: rgba(17,18,24,0.45); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.modal[hidden] { display: none; }
.modal-card { background: var(--white); border: 1px solid var(--gold); border-radius: 3px; padding: 26px; max-width: 420px; width: 100%; }
.modal-card h2 { font-size: 26px; margin-bottom: 6px; }
.modal-card input { width: 100%; margin-top: 8px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.account { padding: 30px 28px 60px; max-width: 900px; }
.account-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-top: 18px; }
.card { background: var(--white); border: 1px solid var(--line); border-radius: 3px; padding: 20px; }
.card h3 { font-size: 22px; margin-bottom: 8px; }
.card.pro { border-color: var(--gold); }
.plan-pill { display: inline-block; font-family: var(--serif-head); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; font-size: 12px; padding: 3px 9px; border-radius: 2px; background: var(--ink); color: var(--cream); }
.plan-pill.pro { background: var(--gold); color: var(--ink); }
.saved-list .row { grid-template-columns: 110px minmax(0,1fr) auto; }
.notice { padding: 12px 14px; border: 1px solid var(--gold); background: var(--white); border-radius: 3px; margin: 12px 0; }
@media (max-width: 900px) { .account-grid { grid-template-columns: 1fr; } }
