/* ------------------------------------------------------------------
   Your numbers — the stats dashboard
   Same paper, ink and terracotta as the room.
------------------------------------------------------------------- */

:root {
  --paper:      #f6efe3;
  --ink:        #2b2620;
  --ink-soft:   #6b6154;
  --line:       rgba(43, 38, 32, .12);
  --terra:      #c4775a;
  --terra-deep: #a95c41;
  --sage:       #7c8b6d;
  --brass:      #c9a34a;
  --card:       rgba(255, 252, 246, .74);
  --shadow:     0 24px 60px -34px rgba(74, 54, 32, .5);
  --serif: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: ui-sans-serif, -apple-system, "Segoe UI", Inter, system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100%;
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(1200px 700px at 18% -10%, #fffaf1 0%, transparent 55%),
    radial-gradient(900px 600px at 95% 8%, #f3e3cd 0%, transparent 60%),
    linear-gradient(160deg, #f8f2e7 0%, #efe4d3 55%, #e8dac6 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

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

/* ── top bar ─────────────────────────────────────────── */

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 16px;
  height: 62px; padding: 0 22px;
  border-bottom: 1px solid rgba(30, 34, 22, .45);
  background:
    radial-gradient(700px 120px at 12% -40%, rgba(255, 255, 255, .1), transparent 70%),
    linear-gradient(to bottom, #5f6751, #545c45);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .09);
}
.brand { display: flex; align-items: center; gap: 10px; flex: none; color: #f7f0e2; text-decoration: none; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 10px; overflow: hidden; flex: none;
  background: #f6efe3;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .22), 0 9px 18px -11px rgba(0, 0, 0, .7);
  transition: transform .3s cubic-bezier(.34, 1.56, .64, 1), box-shadow .3s ease;
}
.brand:hover .brand-mark {
  transform: rotate(-4deg) scale(1.04);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .32), 0 12px 20px -11px rgba(0, 0, 0, .6);
}
.brand-mark img { display: block; width: 100%; height: 100%; }
.brand-text { display: flex; flex-direction: column; gap: 2px; line-height: 1; }
.brand-name {
  font-family: var(--serif); font-size: 18px; font-weight: 600;
  letter-spacing: -.015em; color: #fbf5e8;
}
.brand-sub {
  font-size: 8.5px; font-weight: 600; letter-spacing: .15em;
  text-transform: uppercase; color: rgba(247, 240, 226, .62);
}
.topbar-mid {
  display: flex; align-items: center; gap: 8px;
  padding-left: 17px; border-left: 1px solid rgba(255, 255, 255, .18);
  font-size: 12.5px; color: rgba(247, 240, 226, .76); letter-spacing: .01em;
}
.topbar-dot {
  width: 6px; height: 6px; border-radius: 50%; flex: none;
  background: #d9c884;
  box-shadow: 0 0 0 3px rgba(217, 200, 132, .2);
}
.ghost-btn {
  margin-left: auto;
  display: inline-flex; align-items: center;
  font-size: 12.5px; color: rgba(250, 244, 232, .84); text-decoration: none;
  padding: 7px 13px; border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .2); background: rgba(255, 255, 255, .08);
  transition: .22s ease;
}
.ghost-btn:hover { color: #fffdf8; background: rgba(255, 255, 255, .18); }

/* ── page ────────────────────────────────────────────── */

.page {
  max-width: 1080px; margin: 0 auto;
  padding: 40px 22px 64px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}
.lede, .summary, .foot { grid-column: 1 / -1; }

.lede h1 {
  font-family: var(--serif); font-weight: 600; letter-spacing: -.02em;
  font-size: clamp(28px, 3.4vw, 40px); margin: 6px 0 6px;
}
.lede p { margin: 0; color: var(--ink-soft); font-size: 14px; max-width: 60ch; line-height: 1.5; }

.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }

.stat {
  padding: 14px 16px 15px; border-radius: 16px;
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, .7);
  box-shadow: var(--shadow);
}
.stat dt {
  font-size: 9px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-soft); margin-bottom: 6px;
}
.stat dd {
  margin: 0; font-family: var(--serif); font-size: 25px; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.stat .hint { margin: 6px 0 0; font-size: 11px; color: rgba(107, 97, 84, .9); line-height: 1.35; }

.card {
  padding: 18px 20px 20px; border-radius: 20px;
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, .7);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}
.card.wide { grid-column: 1 / -1; }
.card-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; }
.card-head h2 {
  font-family: var(--serif); font-size: 18px; font-weight: 600;
  letter-spacing: -.01em; margin: 0;
}
.card-head .sub {
  font-size: 9.5px; letter-spacing: .13em; text-transform: uppercase;
  color: var(--ink-soft);
}
.note { margin: 12px 0 0; font-size: 11.5px; color: var(--ink-soft); }

.empty { margin: 6px 0 2px; font-size: 12.5px; color: var(--ink-soft); }

/* ── focus by day ────────────────────────────────────── */

.days { display: flex; align-items: flex-end; gap: 6px; height: 190px; }
.day { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; }
.day .track {
  flex: 1; width: 100%; display: flex; align-items: flex-end;
  border-radius: 7px; background: rgba(43, 38, 32, .045);
  overflow: hidden;
}
.day .bar {
  width: 100%; border-radius: 7px 7px 0 0;
  background: linear-gradient(180deg, #d09272, var(--terra));
  transition: height .5s cubic-bezier(.2, .8, .2, 1);
}
.day .bar.zero { height: 3px !important; background: rgba(43, 38, 32, .16); }
.day.is-today .bar { background: linear-gradient(180deg, var(--brass), #b1862f); }
.day .lab { font-size: 10px; color: var(--ink-soft); letter-spacing: .04em; }
.day.is-today .lab { color: var(--ink); font-weight: 650; }
.day .val {
  font-size: 9.5px; color: var(--ink-soft); font-variant-numeric: tabular-nums;
  height: 13px;
}

/* ── by hour ─────────────────────────────────────────── */

.hours { display: flex; align-items: flex-end; gap: 3px; height: 132px; }
.hour { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; }
.hour .track {
  flex: 1; width: 100%; display: flex; align-items: flex-end;
  border-radius: 4px; background: rgba(43, 38, 32, .04);
}
.hour .bar { width: 100%; border-radius: 4px 4px 0 0; background: var(--sage); }
.hour.is-peak .bar { background: var(--terra); }
.hour .tick { font-size: 8.5px; color: var(--ink-soft); height: 12px; margin-top: 3px; }

/* ── finished vs quit ────────────────────────────────── */

.ratio { display: grid; gap: 14px; }
.ratio-row .top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.ratio-row .name { font-size: 12.5px; color: var(--ink); }
.ratio-row .num { font-family: var(--serif); font-size: 19px; font-variant-numeric: tabular-nums; }
.ratio-row .num span { font-family: var(--sans); font-size: 11px; color: var(--ink-soft); margin-left: 4px; }
.ratio-row .bar { height: 9px; border-radius: 999px; background: rgba(43, 38, 32, .07); overflow: hidden; }
.ratio-row .bar i { display: block; height: 100%; border-radius: 999px; }
.ratio-row.done .bar i { background: linear-gradient(90deg, #8d9c7d, var(--sage)); }
.ratio-row.quit .bar i { background: linear-gradient(90deg, #d09272, var(--terra)); }

/* ── tasks ───────────────────────────────────────────── */

.tasks { display: grid; gap: 9px; }
.task { display: grid; grid-template-columns: minmax(90px, 1.4fr) 3fr auto; gap: 12px; align-items: center; }
.task .name {
  font-size: 12.5px; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.task .bar { height: 8px; border-radius: 999px; background: rgba(43, 38, 32, .06); overflow: hidden; }
.task .bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #cfa07f, var(--terra)); }
.task .min { font-size: 11px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

.foot {
  margin: 6px 0 0; font-size: 11px; line-height: 1.55; color: rgba(107, 97, 84, .9);
}
.foot code {
  font-size: 10.5px; padding: 1px 5px; border-radius: 5px;
  background: rgba(43, 38, 32, .06);
}

@media (max-width: 760px) {
  .page { padding: 26px 14px 48px; grid-template-columns: 1fr; }
  .card.wide, .lede, .summary, .foot { grid-column: auto; }
  .topbar-mid, .brand-sub { display: none; }
  .brand-mark { width: 28px; height: 28px; border-radius: 9px; }
  .brand-name { font-size: 16px; }
  .days { height: 150px; gap: 4px; }
  .day .val { display: none; }
  .task { grid-template-columns: minmax(80px, 1fr) 2fr auto; gap: 8px; }
}

/* installed on a phone: leave room for the notch and the home bar */
@supports (padding: max(0px)) {
  .topbar {
    height: calc(62px + env(safe-area-inset-top));
    padding-top: env(safe-area-inset-top);
    padding-left: calc(22px + env(safe-area-inset-left));
    padding-right: calc(22px + env(safe-area-inset-right));
  }
  .page { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
}
