:root {
  --ink:       #1c1a17;
  --ink-soft:  #6b655c;
  --paper:     #f4f1ea;
  --card:      #fffdf8;
  --line:      #e2dcd0;
  --accent:    #c2410c;       /* terracotta */
  --accent-2:  #0d5c63;       /* deep teal  */
  --accent-wash:#fbe9df;
  --shadow:    0 1px 2px rgba(28,26,23,.04), 0 8px 28px rgba(28,26,23,.07);
  --radius:    14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Spline Sans", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
h1, h2 { font-family: "Fraunces", Georgia, serif; font-weight: 600; letter-spacing: -.01em; }

/* ── Brand ───────────────────────────────────────────────────────── */
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 600; }
.brand-mark { font-size: 1.15rem; filter: saturate(1.2); }
.brand-name { font-family: "Fraunces", serif; font-size: 1.05rem; }

/* ── Landing / sign-in ───────────────────────────────────────────── */
.landing {
  min-height: 100vh; display: grid; place-items: center; position: relative; overflow: hidden;
}
.bg-grid {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    radial-gradient(circle at 18% 22%, var(--accent-wash) 0, transparent 38%),
    radial-gradient(circle at 84% 78%, #d9ece9 0, transparent 42%),
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: auto, auto, 56px 56px, 56px 56px;
  opacity: .5;
}
.signin-card {
  position: relative; z-index: 1;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 2.6rem 2.4rem; width: min(92vw, 26rem); text-align: left;
  animation: rise .6s cubic-bezier(.2,.7,.2,1) both;
}
.signin-card h1 { font-size: 2.1rem; margin: 1.4rem 0 .4rem; }
.signin-card .sub { color: var(--ink-soft); margin: 0 0 1.8rem; line-height: 1.5; }
.gbtn {
  display: flex; align-items: center; justify-content: center; gap: .7rem;
  width: 100%; padding: .85rem 1rem; border: 1px solid var(--line);
  border-radius: 10px; background: #fff; color: var(--ink);
  font: inherit; font-weight: 500; text-decoration: none; cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.gbtn:hover { transform: translateY(-1px); box-shadow: var(--shadow); border-color: #cfc7b8; }
.fineprint { margin: 1.6rem 0 0; font-size: .78rem; color: var(--ink-soft); letter-spacing: .03em; text-transform: uppercase; }

/* ── App shell ───────────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.5rem; border-bottom: 1px solid var(--line);
  background: var(--card); position: sticky; top: 0; z-index: 5;
}
.who { display: flex; align-items: center; gap: 1rem; font-size: .9rem; }
.who-email { color: var(--ink-soft); }
.logout { color: var(--accent); text-decoration: none; font-weight: 500; }
.logout:hover { text-decoration: underline; }

.wrap { max-width: 64rem; margin: 0 auto; padding: 2rem 1.5rem 4rem; }

.cal-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 1.4rem; gap: 1rem; flex-wrap: wrap; }
.cal-head h1 { font-size: 2.3rem; margin: 0; }
.month-total { margin: .25rem 0 0; color: var(--ink-soft); }
.nav { display: flex; gap: .5rem; }
.navbtn {
  font: inherit; border: 1px solid var(--line); background: var(--card);
  border-radius: 9px; padding: .5rem .8rem; cursor: pointer; color: var(--ink);
  transition: background .12s ease, border-color .12s ease;
}
.navbtn:hover { background: #fff; border-color: #cfc7b8; }
.navbtn.today { font-weight: 500; }

/* ── Calendar ────────────────────────────────────────────────────── */
.dow {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: .55rem;
  margin-bottom: .55rem; padding: 0 .1rem;
  font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft);
}
.dow span { text-align: left; padding-left: .2rem; }
.grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: .55rem; }

.cell {
  position: relative; aspect-ratio: 1 / .9; min-height: 84px;
  background: var(--card); border: 1px solid var(--line); border-radius: 11px;
  padding: .5rem .55rem; cursor: pointer; text-align: left;
  display: flex; flex-direction: column; justify-content: space-between;
  transition: transform .1s ease, box-shadow .12s ease, border-color .12s ease;
  font: inherit; color: var(--ink);
}
.cell:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: #cfc7b8; }
.cell.empty { background: transparent; border: none; cursor: default; }
.cell.empty:hover { transform: none; box-shadow: none; }
.cell .num { font-size: .9rem; color: var(--ink-soft); }
.cell.today { border-color: var(--accent); }
.cell.today .num { color: var(--accent); font-weight: 600; }
.cell.future { opacity: .55; }

.cell .logged {
  align-self: flex-start;
  font-family: "Fraunces", serif; font-size: 1.25rem; font-weight: 600;
  color: var(--accent-2);
}
.cell .logged small { font-size: .7rem; font-weight: 400; color: var(--ink-soft); }
.cell.has-note::after {
  content: ""; position: absolute; right: .55rem; bottom: .55rem;
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
}

/* ── Dialog ──────────────────────────────────────────────────────── */
.overlay {
  position: fixed; inset: 0; z-index: 20; display: grid; place-items: center;
  background: rgba(28,26,23,.38); backdrop-filter: blur(3px);
  animation: fade .15s ease both;
}
.dialog {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.8rem; width: min(92vw, 26rem);
  animation: rise .25s cubic-bezier(.2,.7,.2,1) both;
}
.dialog h2 { margin: 0 0 1.2rem; font-size: 1.4rem; }
.field { display: block; margin-bottom: 1rem; }
.field span { display: block; font-size: .85rem; margin-bottom: .35rem; color: var(--ink-soft); }
.field em { font-style: normal; opacity: .7; }
.field input, .field textarea {
  width: 100%; font: inherit; padding: .6rem .7rem; border: 1px solid var(--line);
  border-radius: 9px; background: #fff; color: var(--ink); resize: vertical;
}
.field input:focus, .field textarea:focus { outline: 2px solid var(--accent-wash); border-color: var(--accent); }
.dlg-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: .4rem; }
.btn { font: inherit; font-weight: 500; padding: .6rem 1.1rem; border-radius: 9px; cursor: pointer; border: 1px solid transparent; }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn.ghost:hover { background: var(--paper); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: #a8350a; }
.dlg-err { color: var(--accent); font-size: .85rem; margin: .8rem 0 0; }

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

@media (max-width: 560px) {
  .cell { min-height: 64px; }
  .cell .logged { font-size: 1rem; }
  .cal-head h1 { font-size: 1.8rem; }
}

.banner {
  background: var(--accent-wash); border: 1px solid var(--accent);
  color: #7a2708; border-radius: 10px; padding: .7rem .9rem; margin-bottom: 1rem;
  font-size: .9rem;
}
