/* ───────── Ysabeau Office: saved inside the app, so it looks the same on Windows and iPhone, also offline.
   License (free, SIL Open Font License): assets/fonts/YsabeauOffice-OFL.txt */
@font-face { font-family: 'Ysabeau Office'; font-weight: 300; font-display: swap; src: url('assets/fonts/ysabeau-office-latin-300-normal.woff2') format('woff2'); }
@font-face { font-family: 'Ysabeau Office'; font-weight: 400; font-display: swap; src: url('assets/fonts/ysabeau-office-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Ysabeau Office'; font-weight: 600; font-display: swap; src: url('assets/fonts/ysabeau-office-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Ysabeau Office'; font-weight: 700; font-display: swap; src: url('assets/fonts/ysabeau-office-latin-700-normal.woff2') format('woff2'); }

/* ───────── Colors: pastel and cozy (warm cream page, warm brown text) ───────── */
:root {
  --pergamino: #f3e6d0;
  --tinta: #4a3b2c;            /* warm brown text instead of near-black */
  --sepia: #8a7458;
  --hongo: #d98f8a;
  --ocre: #d6ae6b;             /* soft honey: rewards and stars */
  --castano: #b07f57;          /* caramel: the main accent */

  --fondo: #fffaf2;            /* warm cream page */
  --texto: var(--tinta);
  --suave: var(--sepia);
  --cafe: var(--castano);
  --cafe-soft: #ecd5bb;        /* pastel caramel for button fills (dark text on top) */
  --on: #3d3024;               /* text on pastel fills */
  --linea: #eee2cf;
  --luna: #efe3c9;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fondo: #221c17; --texto: #f0e6d4; --suave: #bfae8e; --cafe: #d4a57a; --cafe-soft: #5a4636; --on: #2a211a;
    --linea: #3b3229; --luna: #3b3229; --pergamino: #3a3026;
    color-scheme: dark;
  }
}

/* ───────── Page ───────── */
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--fondo); color: var(--texto);
  font-family: "Ysabeau Office", Corbel, "Segoe UI", -apple-system, system-ui, sans-serif;
  font-size: 15px; line-height: 1.5;
  overflow-wrap: break-word; -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-align: left; }
.sheet { position: relative; display: flex; flex-direction: column; width: min(40rem, 100%); height: 100%; margin: 0 auto; }
#screen { flex: 1; overflow-y: auto; padding: 1.4rem clamp(16px, 6vw, 2.5rem) 2rem; }

/* ───────── Header: otter, name, date and moon ───────── */
header {
  display: grid; grid-template-columns: auto 1fr auto; column-gap: .8rem; align-items: center;
  margin-bottom: 2.2rem;
}
header img { grid-row: 1 / 3; width: 64px; height: auto; }
h1 { grid-column: 2; font-size: 2.1rem; font-weight: 700; margin: 0; line-height: 1.1; letter-spacing: -.02em; }
h1 em { color: var(--cafe); font-style: normal; }
.date { grid-column: 2; margin: .2rem 0 0; color: var(--suave); font-size: 1rem; }

/* right side: the moon on top, bedtime below */
/* right side: the moon with "Finish day" under it */
.side { grid-column: 3; grid-row: 1 / 3; display: flex; flex-direction: column; align-items: center; gap: .4rem; }
.moonbox { display: flex; }
.moon { width: 40px; height: 40px; flex: none; }
.moon-dark { fill: var(--luna); }
.moon-lit { fill: var(--ocre); }
.bed { font-size: .85rem; font-weight: 600; color: var(--texto); }
.bed:hover { color: var(--cafe); }

/* ───────── Section labels: "today ─────── 0 ★  choose →" ───────── */
section { margin-bottom: 2.2rem; }
h2 { display: flex; align-items: center; gap: .8rem; margin: 0 0 .5rem; font-size: .88rem; font-weight: 600; }
h2 span { color: var(--cafe); }
/* the section name before the line ("TODAY", "PER MONTH"...) is in capitals, slightly spaced */
h2 > span:first-child { text-transform: uppercase; letter-spacing: .1em; font-size: .78rem; }
section[style] h2 span { color: var(--accent); }
h2 .balance { color: var(--ocre); letter-spacing: .04em; }
.rule { flex: 1; height: 1px; background: var(--linea); }
.link { font-size: .85rem; font-weight: 600; color: var(--texto); }
.link:hover { color: var(--cafe); }

/* ───────── To-do rows ───────── */
.row { display: flex; align-items: center; gap: .9rem; padding: .45rem 0; }
.row .t { flex: 1; font-size: 1rem; }
.row .t:hover { color: var(--cafe); }
.row .d { display: block; font-size: .78rem; color: var(--suave); }
.row .cat { color: var(--accent); font-weight: 600; }
.row.finished .t, .row.canceled .t { color: var(--suave); text-decoration: line-through; }
.row.canceled .t { opacity: .55; }
.st { font-size: 1.15rem; line-height: 1; color: var(--accent, var(--ocre)); width: 1.5rem; text-align: center; }
.st:hover { transform: scale(1.15); }
.icon { color: var(--suave); opacity: .35; font-size: .85rem; }
.icon:hover { color: var(--cafe); opacity: 1; }
.empty { color: var(--suave); padding: .3rem 0; }

/* ───────── Lists ───────── */
.list {
  display: flex; align-items: center; gap: .7rem; width: 100%;
  padding: .55rem 0; border-bottom: 1px solid var(--linea);
}
.list::before { content: ""; width: .55rem; height: .55rem; border-radius: 50%; background: var(--accent); flex: none; }
.list .n { flex: 1; font-size: 1.05rem; font-weight: 600; transition: color .15s; }
.list .c { font-size: .85rem; font-weight: 600; color: var(--suave); }
.list::after { content: "›"; color: var(--suave); font-size: 1.2rem; line-height: 1; }
.list:hover .n { color: var(--accent); }

/* ───────── Inputs: just a line to write on ───────── */
form { display: flex; gap: .5rem; }
input {
  flex: 1; min-width: 0; font: inherit; color: var(--texto);
  background: transparent; border: 0; border-bottom: 1px solid var(--linea); border-radius: 0; padding: .45rem 0;
}
input::placeholder { color: var(--suave); opacity: .7; }
input:focus { outline: 0; border-bottom-color: var(--cafe); }
.newcat { margin-top: .4rem; }

/* ───────── Inner screens ───────── */
.back { font-size: .85rem; font-weight: 600; color: var(--suave); margin: .3rem 0 1.2rem; }
.back:hover { color: var(--cafe); }
.vt { font-size: 1.5rem; font-weight: 700; line-height: 1.2; margin: 0 0 1.8rem; }
.vt::after { content: ""; display: block; width: 2.2rem; height: 3px; background: var(--accent); margin-top: .5rem; }

/* choose today: tap a to-do to tick it */
.pick { display: flex; align-items: center; gap: .9rem; width: 100%; padding: .45rem 0; }
.pick .check {
  flex: none; width: 1.3rem; height: 1.3rem; border-radius: 50%; border: 2px solid var(--linea);
  display: grid; place-items: center; font-size: .72rem; color: var(--on);
}
.pick:hover .check { border-color: var(--accent); }
.pick.on .check { background: var(--accent); border-color: var(--accent); }
.pick .d { display: block; font-size: .78rem; color: var(--suave); }

/* new / edit form */
.newform { flex-direction: column; gap: 1.5rem; }
.field { display: flex; flex-direction: column; gap: .35rem; font-size: .85rem; font-weight: 600; color: var(--suave); }
.field input { font-size: 1.05rem; letter-spacing: 0; text-transform: none; font-weight: 400; }
.field input[type=date] { flex: none; width: 11rem; font-size: .95rem; }
.chips { display: flex; flex-wrap: wrap; gap: .3rem 1.1rem; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-block; cursor: pointer; font-size: 1rem; font-weight: 600; letter-spacing: 0; text-transform: none;
  color: var(--suave); padding-bottom: .1rem; border-bottom: 2px solid transparent;
}
.chip span:hover { color: var(--texto); }
.chip input:checked + span { color: var(--texto); border-bottom-color: var(--accent); }
.chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 3px; }

.primary {
  display: block; width: 100%; text-align: center; margin-top: .4rem; border-radius: 14px;
  background: var(--cafe-soft); color: var(--on); padding: .8rem; font-weight: 700;
}
.primary:hover { filter: brightness(1.1); }


/* ───────── Bottom tabs ───────── */
#tabs { display: flex; border-top: 1px solid var(--linea); background: var(--fondo); }
#tabs button {
  flex: 1; text-align: center; padding: .85rem 0 .8rem; position: relative;
  font-size: .82rem; font-weight: 600; color: var(--suave);
}
#tabs button:hover { color: var(--texto); }
#tabs button.on { color: var(--texto); }
#tabs button.on::before { content: ""; position: absolute; top: -1px; left: 30%; right: 30%; height: 3px; background: var(--cafe); }

.soon { text-align: center; padding-top: 3rem; color: var(--suave); }
.soon img { width: 110px; opacity: .9; }

/* "Delete List" at the bottom of a list: quiet until pointed at */
.danger { display: block; margin: 1.5rem auto 0; font-size: .85rem; font-weight: 600; color: var(--suave); opacity: .7; }
.danger:hover { color: var(--cafe); opacity: 1; text-decoration: underline; }

/* ───────── Time tab: activity squares ───────── */
/* tiles in an even grid: same width, as many per row as fit, filling the whole row */
.squares { display: grid; grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr)); gap: .7rem; padding-top: .3rem; }
.sq {
  min-height: 5.6rem; padding: .7rem .6rem; border-radius: 14px; text-align: center;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .15rem;
  background: color-mix(in srgb, var(--accent) 13%, var(--fondo));
  transition: transform .12s, background .12s;
}
.sq:hover { transform: translateY(-2px); background: color-mix(in srgb, var(--accent) 22%, var(--fondo)); }
.sq .ini { font-size: 1.5rem; font-weight: 700; line-height: 1; color: var(--accent); }
.sq .nm { font-size: .78rem; font-weight: 600; line-height: 1.2; overflow-wrap: break-word; } /* the full name, on up to a few lines */
.add-sq { background: none; border: 2px dashed color-mix(in srgb, var(--accent) 40%, var(--linea)); }
.add-sq .ini { font-weight: 300; }
.add-sq:hover { background: color-mix(in srgb, var(--accent) 8%, var(--fondo)); }

.field input[name=newact] { font-size: .95rem; margin-top: .3rem; }

/* icons inside the activity squares */
.sq .ini .ic { width: 1.7rem; height: 1.7rem; display: block; }


/* ───────── Icon picker (activity form) ───────── */
/* closed: the current icon and a "Choose Icon" link; open: search box and grid */
.iconpick summary { display: flex; align-items: center; gap: .8rem; cursor: pointer; list-style: none; padding-top: .2rem; }
.iconpick summary::-webkit-details-marker { display: none; }
.iconpick .cur {
  display: grid; place-items: center; width: 2.8rem; height: 2.8rem; border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 13%, var(--fondo)); color: var(--accent);
}
.iconpick .cur .ic { width: 1.5rem; height: 1.5rem; }
.iconpick .lnk { font-weight: 600; color: var(--texto); }
.iconpick summary:hover .lnk { color: var(--accent); }
.iconpick[open] .lnk::after { content: " ▴"; }
.iconpick:not([open]) .lnk::after { content: " ▾"; }
.iconsearch { width: 100%; margin: .8rem 0 .5rem; font-weight: 400; }

/* the grid of icons: the chosen one is filled with the list color */
.icons { display: grid; grid-template-columns: repeat(auto-fill, minmax(2.6rem, 1fr)); gap: .35rem; max-height: 17rem; overflow-y: auto; }
.icopt {
  display: grid; place-items: center; height: 2.6rem; border-radius: 10px; text-align: center;
  color: var(--suave);
}
.icopt:hover { background: color-mix(in srgb, var(--accent) 10%, var(--fondo)); color: var(--accent); }
.icopt.on { background: var(--accent); color: var(--on); }
.icopt .ic { width: 1.3rem; height: 1.3rem; }
.aa { font-size: .95rem; font-weight: 700; }
.iconnote { grid-column: 1 / -1; margin: .3rem 0 0; font-weight: 400; color: var(--suave); }

/* "+ Add a to-do" line at the end of a list and of Today: type and press Enter */
.quick { margin-top: .3rem; }
.quick input { font-size: 1rem; border-bottom-color: transparent; }
.quick input:hover { border-bottom-color: var(--linea); }
.quick input:focus { border-bottom-color: var(--cafe); }

/* dropdown (activity in the to-do form): looks like the other lines to write on */
select {
  font: inherit; font-size: 1.05rem; font-weight: 400; color: var(--texto); cursor: pointer;
  background: transparent; border: 0; border-bottom: 1px solid var(--linea); border-radius: 0;
  padding: .45rem 0; max-width: 20rem;
}
select:focus { outline: 0; border-bottom-color: var(--cafe); }
select option { background: var(--fondo); color: var(--texto); }

/* ───────── Color choice (activity form) ───────── */
/* one even row of 12 circles that always fills the full width: list color, 10 colors, eyedropper */
.swatches { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); justify-items: center; gap: .2rem; padding-top: .3rem; }
.sw { position: relative; cursor: pointer; width: 100%; display: flex; justify-content: center; }
.sw input[type=radio] { position: absolute; opacity: 0; pointer-events: none; }
.sw span {
  display: grid; place-items: center; width: min(1.75rem, 100%); aspect-ratio: 1; border-radius: 50%; background: var(--c); /* shrinks on narrow screens */
  transition: transform .12s, box-shadow .12s;
}
.sw:hover span { transform: scale(1.1); }
.sw input:checked + span { box-shadow: 0 0 0 2px var(--fondo), 0 0 0 4px var(--c); } /* a ring around the chosen color */
/* the list color: a thin dashed ring shows it is the automatic one */
.sw.auto span { outline: 1.5px dashed var(--c); outline-offset: 2px; }
.sw.auto input:checked + span { outline: 0; }
/* the eyedropper: an outlined circle with the icon; after picking a color it fills with it */
.sw.custom span { border: 1.5px solid var(--linea); color: var(--suave); }
.sw.custom span .ic { width: .95rem; height: .95rem; }
.sw.custom.has span { border-color: transparent; color: var(--on); }
.sw.custom input:checked + span { box-shadow: 0 0 0 2px var(--fondo), 0 0 0 4px var(--suave); }
.sw.custom.has input:checked + span { box-shadow: 0 0 0 2px var(--fondo), 0 0 0 4px var(--c); }
/* the real color picker sits invisibly on top of the eyedropper circle, so a tap opens it */
.sw input[type=color] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; flex: none; }

/* ───────── Timers (step 2b) ───────── */
/* each activity tile sits in a wrapper so the small pencil can sit in its corner */
.sqwrap { position: relative; display: grid; }
.sqwrap .sq { width: 100%; }
.sqedit {
  position: absolute; top: .3rem; right: .3rem; width: 1.6rem; height: 1.6rem; border-radius: 8px;
  display: grid; place-items: center; color: var(--suave); opacity: .35; transition: opacity .12s, background .12s;
}
.sqedit .ic { width: .9rem; height: .9rem; }
.sqwrap:hover .sqedit { opacity: .8; }
.sqedit:hover { opacity: 1; background: color-mix(in srgb, var(--accent) 18%, var(--fondo)); color: var(--accent); }
/* time under the name: today's total, or the running clock */
.sq .tm { font-size: .72rem; font-weight: 600; color: var(--suave); font-variant-numeric: tabular-nums; margin-top: .1rem; }
/* a running tile is filled with its color */
.sq.on { background: var(--accent); color: var(--on); box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent); }
.sq.on .ini, .sq.on .tm { color: var(--on); }
.sq.on:hover { background: var(--accent); filter: brightness(1.06); }
.sqwrap:has(.sq.on) .sqedit { color: var(--on); }

.lead { color: var(--suave); margin: -1rem 0 1.6rem; }
.lead b { color: var(--texto); }

/* the bar above the tabs while a timer runs, on every tab */
#nowbar {
  display: flex; align-items: center; gap: .7rem; padding: .55rem clamp(16px, 6vw, 2.5rem);
  background: color-mix(in srgb, var(--accent) 12%, var(--fondo)); border-top: 1px solid var(--linea);
}
#nowbar[hidden] { display: none; }
#nowbar .what { flex: 1; display: flex; align-items: center; gap: .45rem; min-width: 0; color: var(--accent); }
#nowbar .what b { color: var(--texto); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#nowbar .what .ic { width: 1.1rem; height: 1.1rem; flex: none; }
#nowbar .clock { font-weight: 700; font-variant-numeric: tabular-nums; }
#nowbar button { background: var(--accent); color: var(--on); font-weight: 600; font-size: .85rem; padding: .3rem .9rem; border-radius: 999px; }
#nowbar button:hover { filter: brightness(1.1); }
/* a softly pulsing dot: "recording" */
.pulse { width: .55rem; height: .55rem; border-radius: 50%; background: var(--accent); flex: none; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }

/* ───────── Time log and entries (step 2c) ───────── */
/* one entry: icon | activity and to-do | duration and times */
.entry { display: flex; align-items: center; gap: .75rem; width: 100%; padding: .5rem 0; border-bottom: 1px solid var(--linea); }
.entry:last-of-type { border-bottom: 0; }
.entry:hover .et b { color: var(--accent); }
.entry .ei {
  flex: none; width: 2rem; height: 2rem; border-radius: 9px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--accent) 14%, var(--fondo)); color: var(--accent); font-weight: 700;
}
.entry .ei .ic { width: 1.05rem; height: 1.05rem; }
.entry .et { flex: 1; min-width: 0; }
.entry .et b { font-weight: 600; }
.entry .er { text-align: right; font-variant-numeric: tabular-nums; }
.entry .er b { font-weight: 600; }
.entry .d { display: block; font-size: .78rem; color: var(--suave); }
.daytotal { font-size: .8rem; font-weight: 600; color: var(--suave); }

/* "+ Add Past Time" */
.addtime { display: block; margin-top: .5rem; color: var(--suave); font-weight: 600; }
.addtime:hover { color: var(--cafe); }

/* entry form: "14:30 to 15:15  45 min" */
.timerow { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.timerow input { flex: none; width: 8.4rem; } /* room for "10:30 AM" too */
.timerow span { color: var(--suave); font-weight: 400; }

/* ───────── Records page and Settings ───────── */
/* the Time tab's sub-tabs: Activities · Records · Analysis */
.rtabs { display: flex; border-bottom: 1px solid var(--linea); margin: -.8rem 0 1.4rem; }
.rtabs button { flex: 1; text-align: center; padding: .6rem 0; font-weight: 600; color: var(--suave); position: relative; }
.rtabs button:hover { color: var(--texto); }
.rtabs button.on { color: var(--texto); }
.rtabs button.on::after { content: ""; position: absolute; left: 25%; right: 25%; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--cafe); }

/* period choice: Week · Month · Year · All */
.periods { display: flex; gap: .3rem; margin-bottom: .9rem; }
.periods button { padding: .3rem .85rem; border-radius: 999px; font-size: .85rem; font-weight: 600; color: var(--suave); }
.periods button:hover { color: var(--texto); }
.periods button.on { background: color-mix(in srgb, var(--cafe) 12%, var(--fondo)); color: var(--cafe); }

/* ‹ day or period › */
.daynav { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: 1.2rem; }
.daynav button { width: 2.2rem; height: 2.2rem; border-radius: 50%; text-align: center; font-size: 1.3rem; line-height: 1; color: var(--suave); }
.daynav button:hover { background: color-mix(in srgb, var(--cafe) 10%, var(--fondo)); color: var(--cafe); }
.daynav span { font-weight: 600; }
.daynav.small { margin-bottom: 1.4rem; }
/* the day name; the real date picker sits invisibly on top of it, so tapping the name opens it */
.daypick { position: relative; cursor: pointer; text-align: center; flex: 1; }
.daypick span { border-bottom: 1px dashed var(--linea); padding-bottom: .1rem; }
.daypick:hover span { color: var(--cafe); border-bottom-color: var(--cafe); }
.daypick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; border: 0; }
.daypick input::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: 100%; height: 100%; cursor: pointer; }


/* time per day: thin columns on a baseline, rounded at the top, hover for the value */
.cols { display: flex; align-items: flex-end; gap: 2px; height: 8rem; padding-top: .3rem; }
.col { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; align-items: center; }
.cbar { flex: 1; width: 100%; max-width: 1.6rem; display: flex; align-items: flex-end; border-bottom: 1px solid var(--linea); }
.cfill { width: 100%; background: var(--bar, var(--cafe)); border-radius: 4px 4px 0 0; }
.col:hover .cfill { filter: brightness(1.15); }
.col:hover .cbar { background: color-mix(in srgb, var(--bar, var(--cafe)) 7%, transparent); }
.clab { height: 1.1rem; font-size: .68rem; color: var(--suave); line-height: 1.6; }

/* ranked bars: name and value on top, a thin bar in the activity's or list's color below */
.brow { padding: .45rem 0; }
.bhead { display: flex; align-items: center; gap: .5rem; margin-bottom: .3rem; }
.bi { width: 1.5rem; height: 1.5rem; border-radius: 7px; display: grid; place-items: center; flex: none;
  background: color-mix(in srgb, var(--accent) 14%, var(--fondo)); color: var(--accent); font-size: .8rem; font-weight: 700; }
.bi .ic { width: .9rem; height: .9rem; }
.bdot { width: .6rem; height: .6rem; border-radius: 50%; background: var(--accent); flex: none; margin: 0 .2rem; }
.bn { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bv { font-size: .85rem; color: var(--suave); white-space: nowrap; font-variant-numeric: tabular-nums; }
.bv b { color: var(--texto); font-weight: 600; }
.btrack { height: 8px; border-radius: 4px; background: color-mix(in srgb, var(--linea) 55%, transparent); }
.bfill { height: 100%; border-radius: 4px; background: var(--accent); }

/* Settings */
.hint { color: var(--suave); font-size: .85rem; margin: .4rem 0 0; }

/* the Settings gear at the right end of the bottom tabs */
#tabs .gear { flex: 0 0 3rem; display: grid; place-items: center; }
#tabs .gear .ic { width: 1.15rem; height: 1.15rem; }

/* "Total time: 1 h 34 min" under the times in the time entry form */
.totalline { margin: .5rem 0 0; font-size: .95rem; font-weight: 400; color: var(--suave); }
.totalline b { color: var(--texto); font-weight: 700; }

/* ───────── Analytics of one activity or list ───────── */
/* the ranked bars can be tapped to open that activity or list */
button.brow { display: block; width: 100%; border-radius: 8px; }
button.brow:hover .bn { color: var(--accent); }
.brow .btrack, .brow .bfill { display: block; } /* spans inside a button, shown as bars */
.brow .chev { color: var(--suave); font-size: 1.1rem; line-height: 1; margin-left: .2rem; }

/* "← All Activities" and the name of the open one */
.backall { font-size: .85rem; font-weight: 600; color: var(--suave); margin-bottom: .6rem; }
.backall:hover { color: var(--cafe); }
.focushead { display: flex; align-items: center; gap: .6rem; margin-bottom: 1rem; font-size: 1.2rem; }
.focushead .bi { width: 2.1rem; height: 2.1rem; border-radius: 10px; font-size: 1rem; }
.focushead .bi .ic { width: 1.2rem; height: 1.2rem; }
.focushead .bdot { width: .8rem; height: .8rem; }

/* "In Numbers": a compact list, one fact per line: name on the left, value on the right */
.facts { padding-top: .1rem; }
.fact { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: .4rem 0; border-bottom: 1px solid var(--linea); }
.fact:last-child { border-bottom: 0; }
.fact span { color: var(--suave); }
.fact b { font-weight: 600; font-variant-numeric: tabular-nums; }

/* ───────── Stars (step 2d) ───────── */
/* "+90 ★" after an entry's times */
.st-earned { color: var(--ocre); font-weight: 600; }

/* the message that appears for a moment, e.g. "+90 ★ for Writing" */
.toast {
  position: absolute; left: 50%; bottom: 5.2rem; transform: translateX(-50%); z-index: 20;
  background: var(--texto); color: var(--fondo); padding: .55rem 1.1rem; border-radius: 999px;
  font-weight: 600; font-size: .9rem; white-space: nowrap; box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
  animation: toastin .25s ease-out; transition: opacity .5s;
}
.toast.out { opacity: 0; }
@keyframes toastin { from { opacity: 0; transform: translate(-50%, .6rem); } }

/* Rewards screen: the balance, and the stars earned, day by day */
.balance-line { font-size: 1.1rem; color: var(--suave); margin: 0 0 1.6rem; }
.balance-line b { color: var(--texto); font-weight: 700; }
.earn { display: flex; align-items: center; gap: .75rem; padding: .45rem 0; border-bottom: 1px solid var(--linea); }
.earn:last-child { border-bottom: 0; }
.earn .ei {
  flex: none; width: 2rem; height: 2rem; border-radius: 9px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--accent, var(--ocre)) 14%, var(--fondo)); color: var(--accent, var(--ocre)); font-weight: 700;
}
.earn .ei .ic { width: 1.05rem; height: 1.05rem; }
.earn .ei.bonus { background: var(--ocre); color: var(--on); }
.earn .et { flex: 1; min-width: 0; }
.earn .et b { font-weight: 600; }
.earn .d { display: block; font-size: .78rem; color: var(--suave); }
.earn .ev { font-weight: 600; color: var(--ocre); white-space: nowrap; }

/* Settings → Stars: one line per list with its rate */
.hint.top { margin: 0 0 .7rem; }
.rate { display: flex; align-items: center; gap: .7rem; padding: .35rem 0; }
.rate::before { content: ""; width: .55rem; height: .55rem; border-radius: 50%; background: var(--accent); flex: none; }
.rate .rn { flex: 1; font-weight: 600; }
.rate input { flex: none; width: 4.5rem; text-align: right; }
.rate .ru { color: var(--suave); font-size: .85rem; width: 6.2rem; }

/* ───────── Rewards (step 2e) ───────── */
/* chart colors for stars earned and spent, checked for color blindness in light and dark */
:root { --earned: #c4954a; --spent: #8a6cba; }
@media (prefers-color-scheme: dark) { :root { --earned: #d0a25a; --spent: #a58ad0; } }

.nudge { margin: -1rem 0 1.4rem; color: var(--ocre); font-weight: 600; }

/* one reward: icon + name + time on the left; "Enjoy This" or its price on the right */
.reward { display: flex; align-items: center; gap: .8rem; padding: .5rem 0; border-bottom: 1px solid var(--linea); }
.reward:last-of-type { border-bottom: 0; }
.reward .rw { flex: 1; min-width: 0; display: flex; align-items: center; gap: .75rem; }
.reward .rw:hover b { color: var(--accent, var(--ocre)); }
.reward .ei {
  flex: none; width: 2.2rem; height: 2.2rem; border-radius: 10px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--accent, var(--ocre)) 18%, var(--fondo)); color: var(--accent, var(--ocre)); font-weight: 700;
}
.reward.ready .ei { background: var(--accent, var(--ocre)); color: var(--on); }
.reward .ei .ic { width: 1.15rem; height: 1.15rem; }
.reward .et { min-width: 0; }
.reward .et b { font-weight: 600; }
.reward .d { display: block; font-size: .8rem; color: var(--suave); }
.enjoy { flex: none; background: var(--accent, var(--ocre)); color: var(--on); font-weight: 600; font-size: .85rem; padding: .4rem .9rem; border-radius: 999px; }
.enjoy:hover { filter: brightness(1.08); }
.reward .price { flex: none; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--texto); }

/* earned vs spent per week: a legend, then two thin bars per week */
.legend { display: flex; gap: 1rem; font-size: .8rem; color: var(--texto); margin-bottom: .5rem; }
.legend span { display: flex; align-items: center; gap: .35rem; }
.legend i { width: .7rem; height: .7rem; border-radius: 3px; display: inline-block; }
.legend i.earned { background: var(--earned); }
.legend i.spent { background: var(--spent); }
.legend .lg-note { margin-left: auto; color: var(--suave); }
.weeks { display: flex; gap: .35rem; height: 7.5rem; }
.wk { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; }
.wbars { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 2px; border-bottom: 1px solid var(--linea); }
.wk:hover .wbars { background: color-mix(in srgb, var(--ocre) 7%, transparent); }
.wb { width: min(.75rem, 40%); border-radius: 4px 4px 0 0; }
.wb.earned { background: var(--earned); }
.wb.spent { background: var(--spent); }

/* a reward enjoyed, in the history, with ✕ to undo it */
.earn.spent .ei { background: color-mix(in srgb, var(--spent) 14%, var(--fondo)); color: var(--spent); }
.earn.spent .ev { color: var(--spent); }
.earn .icon { margin-left: .2rem; }

/* number boxes in the reward form ("2 h 30 min") */
.timerow input[type=number] { width: 4.5rem; }
.wk .clab { white-space: nowrap; font-size: .62rem; } /* "16 Nov" on one line */

/* ───────── Habits (step 3a) ───────── */
.daynav button:disabled { opacity: .25; cursor: default; background: none; }
/* "3 of 5 done" and a thin bar */
.hprogress { display: flex; justify-content: space-between; font-size: .85rem; color: var(--suave); margin-bottom: .35rem; }
.hprogress + .btrack { margin-bottom: 1.6rem; height: 6px; }
.hprogress + .btrack .bfill { background: var(--ocre); transition: width .3s; }

/* one habit: icon and name on the left, its control on the right */
.habit { display: flex; align-items: center; gap: .8rem; padding: .55rem 0; border-bottom: 1px solid var(--linea); }
.habit:last-of-type { border-bottom: 0; }
.habit .hname { flex: 1; min-width: 0; display: flex; align-items: center; gap: .75rem; }
.habit .hname:hover b { color: var(--accent); }
.habit .ei {
  flex: none; width: 2.2rem; height: 2.2rem; border-radius: 10px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--accent) 14%, var(--fondo)); color: var(--accent); font-weight: 700;
}
.habit.done .ei { background: var(--accent); color: var(--on); }
.habit .ei .ic { width: 1.15rem; height: 1.15rem; }
.habit .et { min-width: 0; }
.habit .et b { font-weight: 600; }
.habit .d { display: block; font-size: .78rem; color: var(--suave); }
.hctl { flex: none; display: flex; align-items: center; gap: .4rem; }

/* yes / no: a round tick */
.hcheck { width: 2rem; height: 2rem; border-radius: 50%; border: 2px solid var(--linea); text-align: center; color: var(--on); font-size: .95rem; }
.hcheck:hover { border-color: var(--accent); }
.hcheck.on { background: var(--accent); border-color: var(--accent); }
/* number: − value + */
.hnum { display: flex; align-items: center; border: 1px solid var(--linea); border-radius: 999px; }
.hnum button { width: 1.9rem; height: 1.9rem; text-align: center; color: var(--suave); font-size: 1.05rem; }
.hnum button:hover { color: var(--accent); }
.hnum input { width: 2.6rem; text-align: center; border: 0; padding: .2rem 0; font-weight: 600; -moz-appearance: textfield; }
.hnum input::-webkit-outer-spin-button, .hnum input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.hunit { font-size: .8rem; color: var(--suave); }
/* time of day: a small pill button */
.hbtn { padding: .35rem .9rem; border-radius: 999px; border: 1px solid var(--accent); color: var(--accent); font-weight: 600; font-size: .85rem; }
.hbtn:hover { background: var(--accent); color: var(--on); }
.hctl input[type=time] { flex: none; width: 7.8rem; }
/* scale: five small numbers */
.hscale { display: flex; gap: .2rem; }
.hscale button { width: 1.8rem; height: 1.8rem; border-radius: 50%; text-align: center; font-size: .85rem; font-weight: 600; color: var(--suave);
  background: color-mix(in srgb, var(--accent) 8%, var(--fondo)); }
.hscale button:hover { color: var(--accent); }
.hscale button.on { background: var(--accent); color: var(--on); }

/* habit form: the type choice, as small cards */
.htypes { display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: .45rem; padding-top: .2rem; }
.htype input { position: absolute; opacity: 0; pointer-events: none; }
.htype span { display: block; height: 100%; padding: .55rem .7rem; border-radius: 10px; border: 1px solid var(--linea); cursor: pointer; }
.htype span b { display: block; color: var(--texto); font-size: .9rem; }
.htype span em { font-style: normal; font-weight: 400; font-size: .75rem; color: var(--suave); }
.htype span:hover { border-color: var(--ocre); }
.htype input:checked + span { border-color: var(--ocre); background: color-mix(in srgb, var(--ocre) 10%, var(--fondo)); }
.htype input:focus-visible + span { outline: 2px solid var(--ocre); outline-offset: 2px; }
.hsw { grid-template-columns: repeat(10, minmax(0, 1fr)); }
.field[hidden] { display: none; } /* e.g. "Unit" only for number habits */
/* Settings → Habits: "All of the day's habits done" sits apart from the habits above it, with no dot */
.rate.allh { margin-top: .4rem; padding-top: .7rem; border-top: 1px solid var(--linea); }

/* ───────── Sleep (step 3b) ───────── */

/* last night: moon, length, bedtime → wake-up, stars */
.sleeprow { display: flex; align-items: center; gap: .75rem; width: 100%; padding: .5rem 0; }
.sleeprow .ei {
  flex: none; width: 2.2rem; height: 2.2rem; border-radius: 10px; display: grid; place-items: center;
  background: var(--accent); color: var(--on);
}
.sleeprow.none .ei { background: color-mix(in srgb, var(--accent) 14%, var(--fondo)); color: var(--accent); }
.sleeprow .ei .ic { width: 1.15rem; height: 1.15rem; }
.sleeprow .et { flex: 1; min-width: 0; }
.sleeprow .et b { font-weight: 600; font-size: 1.05rem; }
.sleeprow.none .et b { font-weight: 400; font-size: 1rem; color: var(--suave); }
.sleeprow .d { display: block; font-size: .8rem; color: var(--suave); }
.sleeprow .ev { font-weight: 600; color: var(--ocre); }
button.sleeprow:hover .et b { color: var(--accent); }

/* the last 14 nights, with the good range (7 to 9 h) as a soft band behind the columns */
.sleepchart { position: relative; margin-top: .8rem; }
.sleepchart .cols { height: 7rem; position: relative; }
.sleepchart .band {
  /* the bars' area is the chart's 7rem minus .3rem on top and 1.1rem of day letters: 5.6rem */
  position: absolute; left: 0; right: 0;
  bottom: calc(1.1rem + 5.6rem * var(--lo)); height: calc(5.6rem * (var(--hi) - var(--lo)));
  background: color-mix(in srgb, #4f6f8a 10%, transparent); border-top: 1px dashed color-mix(in srgb, #4f6f8a 45%, transparent);
  border-bottom: 1px dashed color-mix(in srgb, #4f6f8a 45%, transparent); pointer-events: none;
}
.sleepchart + .facts { margin-top: .6rem; }

/* Settings: a time box among the number boxes */
.rate input[type=time] { width: 7.8rem; }

/* ───────── The night screen: a giant otter over the whole app while sleeping ───────── */
#night {
  position: absolute; inset: 0; z-index: 50; display: grid; place-items: center;
  background: radial-gradient(ellipse at 50% 30%, #3a3124 0%, #221c15 60%, #17130f 100%);
  color: #efe6d2; animation: nightin .6s ease-out;
}
#night[hidden] { display: none; }
@keyframes nightin { from { opacity: 0; } }
.night-in { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 2rem; }
.night-in img { width: min(62vw, 15rem); height: auto; filter: drop-shadow(0 12px 30px rgba(0, 0, 0, .45)); animation: otterin .8s ease-out; }
@keyframes otterin { from { opacity: 0; transform: translateY(1.5rem) scale(.96); } }
.night-in .moonbig { align-self: flex-end; margin: 0 1rem -1rem 0; } /* the moon in the sky, top right of the otter */
.night-in .moonbig .moon { width: 2.6rem; height: 2.6rem; }
.night-in .moon-dark { fill: #4a3f30; }
.night-in .nt { display: block; margin: 1rem 0 .3rem; font-size: 2rem; font-weight: 700; letter-spacing: -.01em; color: #efe6d2; }
.night-in .ns { margin: 0 0 2rem; color: #c9b892; }
.startday {
  background: var(--ocre); color: var(--on); font-weight: 700; font-size: 1.05rem; padding: .85rem 2.4rem; border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .35); text-align: center;
}
.startday:hover { filter: brightness(1.08); }

/* ───────── Alignment: every row starts with a marker in the same column ───────── */
/* Rows with an icon show the icon (2.2rem tile). Rows without one show the standard bullet: a small
   round dot in the row's color, centered in a 1rem column. "+" lines put the + in that same column,
   so their text lines up with the rows above. */
:root { --dot: .5rem; --mk: 1rem; --mkgap: .75rem; }
.row, .list, .fact, .rate { gap: var(--mkgap); }
.row::before, .list::before, .fact::before, .rate::before {
  content: ""; flex: none; width: var(--dot); height: var(--dot); border-radius: 50%;
  background: var(--accent, var(--ocre)); margin: 0 calc((var(--mk) - var(--dot)) / 2);
}
.list::before { background: var(--accent); }
/* "In Numbers" and sleep facts: dot, name, value */
.fact { justify-content: flex-start; }
.fact span { flex: 1; }
.facts { --accent: var(--suave); }
section[style] .facts { --accent: inherit; }
/* settings rows: dot, name, value, unit, with values lined up on the right */
.rate .rn { flex: 1; }
.rate select { flex: none; width: 9rem; }
.rate input[type=time] { width: 9rem; }
.rate .ru { width: 8.5rem; }
/* "Add a to-do" and "New List": the + sits in the dot column, the text where the names start */
.quick, .newcat { position: relative; }
.quick::before, .newcat::before {
  content: "+"; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: var(--mk); text-align: center; color: var(--suave); font-size: 1.05rem; pointer-events: none;
}
.quick input, .newcat input { padding-left: calc(var(--mk) + var(--mkgap)); }
.newcat input { text-transform: none; letter-spacing: 0; font-size: 1rem; }
/* "+ New Habit", "+ New Reward", "+ Add Past Time": the + sits in the icon column (2.2rem) */
.addtime { display: flex; align-items: center; gap: var(--mkgap); }
.addtime .plus { width: 2.2rem; text-align: center; font-size: 1.1rem; }

/* Habits tab: the day ‹ › comes right under the title bar */
.daynav:first-child { margin-top: -.6rem; }

/* No visible scrollbars anywhere; scrolling with the wheel, touchpad or touch still works */
* { scrollbar-width: none; }
*::-webkit-scrollbar { display: none; }

/* Records: the timer running now, on top, with its clock ticking */
.entry.running .et .d { display: flex; align-items: center; gap: .35rem; color: var(--accent); font-weight: 600; }
.entry.running .pulse { width: .45rem; height: .45rem; }
.entry.running .er b { font-variant-numeric: tabular-nums; }
.entry.running { border-bottom: 1px solid var(--linea); } /* keeps its line, though it is the only div among the entry buttons */

/* ───────── Calendar (step 4) ───────── */
:root { --linea-dot: #b9ab90; }
/* "December 2026", ‹ › and Today */
.calhead { display: flex; align-items: center; gap: .4rem; margin: -.4rem 0 .8rem; }
.calhead button:not(.link):not(.calname) { width: 2.2rem; height: 2.2rem; border-radius: 50%; text-align: center; font-size: 1.3rem; line-height: 1; color: var(--suave); }
.calhead button:not(.link):not(.calname):hover { background: color-mix(in srgb, var(--cafe) 10%, var(--fondo)); color: var(--cafe); }
.calhead .link { margin-left: .3rem; }
/* the month: 7 columns, Monday first */
.calgrid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; margin-bottom: 1.6rem; }
.calgrid .wd { text-align: center; font-size: .72rem; font-weight: 600; color: var(--suave); padding-bottom: .3rem; }
.cday { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: .2rem;
  height: 3.1rem; padding-top: .35rem; border-radius: 10px; text-align: center; }
.cday .n { width: 1.8rem; height: 1.8rem; line-height: 1.8rem; border-radius: 50%; font-size: .9rem; font-weight: 600; }
.cday:hover { background: color-mix(in srgb, var(--pergamino) 45%, var(--fondo)); }
.cday.out .n { color: var(--suave); opacity: .45; font-weight: 400; }
.cday.today .n { box-shadow: inset 0 0 0 1.5px var(--cafe); color: var(--cafe); }
.cday.sel .n { background: var(--cafe); color: var(--on); box-shadow: none; }
.cday .dots { display: flex; gap: 2px; height: .4rem; }
.cday .dots i { width: .38rem; height: .38rem; border-radius: 50%; }

/* the day's agenda: "All day" / "During the day" as small headings */
.sub { margin: .6rem 0 .1rem; font-size: .75rem; font-weight: 600; color: var(--suave); }
/* one event: the standard bullet in its color, title (and how it repeats), time on the right */
.evrow { display: flex; align-items: center; gap: var(--mkgap); width: 100%; padding: .5rem 0; border-bottom: 1px solid var(--linea); }
.evrow::before { content: ""; flex: none; width: var(--dot); height: var(--dot); border-radius: 50%; background: var(--accent);
  margin: 0 calc((var(--mk) - var(--dot)) / 2); }
.evrow .et { flex: 1; min-width: 0; }
.evrow .et b { font-weight: 600; }
.evrow .d { display: block; font-size: .78rem; color: var(--suave); }
.evrow .er { font-size: .85rem; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.evrow:hover .et b { color: var(--accent); }

/* event form */
.check-line { display: flex; align-items: center; gap: .5rem; color: var(--texto); cursor: pointer; font-weight: 600; }
.check-line input { flex: none; width: 1.05rem; height: 1.05rem; accent-color: var(--cafe); }
.chip input[type=checkbox] { position: absolute; opacity: 0; pointer-events: none; }
.dangers { display: flex; justify-content: center; gap: 1.6rem; }
.dangers .danger { margin: 1.5rem 0 0; }

/* ───────── Own Time and Scheduled ───────── */
/* the small "Scheduled" tag on entries and linked events */
.sched { display: inline-block; padding: 0 .4rem; border-radius: 999px; font-size: .68rem; font-weight: 700;
  background: color-mix(in srgb, var(--suave) 14%, var(--fondo)); color: var(--suave); }
/* bars: own time solid, scheduled the same color but lighter, side by side with a 2px gap */
.brow .btrack { display: flex; gap: 2px; }
.bfill.sch { background: color-mix(in srgb, var(--accent) 42%, var(--fondo)); }
/* per-day columns: scheduled on top of own time */
.cbar { flex-direction: column; justify-content: flex-end; align-items: stretch; gap: 2px; }
.cfill.sch { background: color-mix(in srgb, var(--bar, var(--cafe)) 42%, var(--fondo)); }
.cfill.sch + .cfill { border-radius: 0; }
/* legend: "■ Own Time ■ Scheduled" */
.legend.kinds i.own { background: var(--accent); }
.legend.kinds i.sch { background: color-mix(in srgb, var(--accent) 42%, var(--fondo)); }
.kindtotals { margin-top: .3rem; }

/* ───────── Time blocking (the day in the Calendar) ───────── */
/* a column of hours (3rem each): the hour on the left, a thin line, and the blocks on top */
.tl { --hh: 3rem; --lab: 3.6rem; position: relative; height: calc(var(--hh) * var(--hours)); margin: .4rem 0 .6rem; }
.tl-hour { display: block; width: 100%; height: var(--hh); border-top: 1px solid var(--linea); position: relative; }
.tl-hour:hover { background: color-mix(in srgb, var(--pergamino) 35%, transparent); }
.tl-lab { position: absolute; left: 0; top: -.55rem; width: calc(var(--lab) - .4rem); padding-right: .3rem; text-align: right;
  font-size: .7rem; color: var(--suave); background: var(--fondo); font-variant-numeric: tabular-nums; }
.tl-hour:first-child .tl-lab { top: .1rem; background: none; }
/* one block: placed by its time, side by side with anything at the same time */
.tl-block {
  position: absolute; top: calc(var(--hh) * var(--top) + 1px); height: calc(var(--hh) * var(--h) - 2px);
  left: calc(var(--lab) + (100% - var(--lab)) * var(--col) / var(--cols)); width: calc((100% - var(--lab)) / var(--cols) - 3px);
  display: flex; flex-direction: column; justify-content: flex-start; align-items: stretch; gap: .05rem; overflow: hidden; text-align: left;
  padding: .25rem .5rem; border-radius: 8px; border-left: 3px solid var(--c);
  background: color-mix(in srgb, var(--c) 22%, var(--fondo)); color: var(--texto); font-size: .8rem; line-height: 1.25;
}
.tl-block b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-block span { font-size: .72rem; color: var(--suave); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-block em { font-style: normal; font-size: .65rem; font-weight: 700; color: var(--suave); }
.tl-block.short { padding-top: .1rem; padding-bottom: 0; justify-content: center; }
button.tl-block:hover { background: color-mix(in srgb, var(--c) 32%, var(--fondo)); }
/* own time: a very light fill and its colored bar, no outline; the timer running now also pulses gently */
.tl-block.entry, .tl-block.running { background: color-mix(in srgb, var(--c) 9%, var(--fondo)); border: 0; border-left: 3px solid var(--c); } /* own time: a very light fill, no outline */
.tl-block.running { animation: softpulse 2.4s ease-in-out infinite; }
@keyframes softpulse { 50% { opacity: .72; } }
/* the current time */
.tl-now { position: absolute; left: calc(var(--lab) - .3rem); right: 0; top: calc(var(--hh) * var(--top)); height: 2px; background: var(--cafe); pointer-events: none; }
.tl-now::before { content: ""; position: absolute; left: -.25rem; top: -.2rem; width: .5rem; height: .5rem; border-radius: 50%; background: var(--cafe); }

/* a thin block (under 30 minutes): one small line, centered in its height */
.tl-block.tiny { padding: 0 .45rem; justify-content: center; border-radius: 5px; font-size: .68rem; line-height: 1.1; }
.tl-block.tiny b { font-weight: 600; }

/* Calendar: the month name folds and unfolds the month */
.calhead .calname { flex: 1; text-align: center; font-weight: 700; font-size: 1.05rem; color: var(--texto); }
.calhead .calname i { font-style: normal; font-size: .8rem; color: var(--suave); }
.calhead .calname:hover, .calhead .calname:hover i { color: var(--cafe); }


/* ───────── Settings: on/off switches (Startup, Reminders) ───────── */
.rate input.switch {
  appearance: none; -webkit-appearance: none; flex: none; width: 2.6rem; height: 1.45rem; padding: 0; margin: 0;
  border: 0; border-radius: 999px; background: var(--linea); position: relative; cursor: pointer; transition: background .15s;
}
.rate input.switch::after {
  content: ""; position: absolute; top: .18rem; left: .2rem; width: 1.1rem; height: 1.1rem; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .15s;
}
.rate input.switch:checked { background: var(--cafe); }
.rate input.switch:checked::after { transform: translateX(1.1rem); }
.rate input.switch:focus-visible { outline: 2px solid var(--cafe); outline-offset: 2px; }

/* ───────── Habits → Analysis ───────── */
/* one card per habit: icon, name, "18 of 30 days · 60%", then its days, then streaks and averages */
.hcard { padding: .8rem 0 .4rem; border-bottom: 1px solid var(--linea); }
.hcard:last-of-type { border-bottom: 0; }
.hchead { display: flex; align-items: center; gap: .75rem; margin-bottom: .55rem; }
.hchead .ei { flex: none; width: 2.2rem; height: 2.2rem; border-radius: 10px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--accent) 14%, var(--fondo)); color: var(--accent); font-weight: 700; }
.hchead .ei .ic { width: 1.15rem; height: 1.15rem; }
.hchead > b { flex: 1; min-width: 0; font-weight: 600; }
.hcv { font-size: .82rem; color: var(--suave); white-space: nowrap; }
.hcv b { color: var(--texto); font-weight: 600; }
/* a square per day: filled when done; days still to come are fainter */
.hdays { display: grid; gap: 3px; margin: 0 0 .4rem; }
.hdays.week { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.hdays.month { grid-template-columns: repeat(auto-fill, minmax(.85rem, 1fr)); }
.hdays i { aspect-ratio: 1; border-radius: 3px; background: color-mix(in srgb, var(--accent) 12%, var(--fondo)); }
.hdays.week i { aspect-ratio: auto; height: 1.6rem; border-radius: 6px; }
.hdays i.on { background: var(--accent); }
.hdays i.future { opacity: .35; }
/* a column per month (Year) */
.hmonths { display: flex; align-items: flex-end; gap: 2px; height: 4.5rem; margin-bottom: .4rem; --bar: var(--accent); }

/* dragging to change the order */
/* the floating copy: above everything, with room around its content, rounded, with a soft shadow */
.drag-ghost { position: fixed; top: 0; left: 0; z-index: 1000; pointer-events: none; margin: 0;
  box-sizing: border-box; border-radius: 14px; background: var(--fondo); opacity: .97;
  box-shadow: 0 14px 32px rgba(46, 38, 25, .22), 0 2px 8px rgba(46, 38, 25, .12); }
.drag-ghost.line { padding-left: 14px; padding-right: 14px; border: 1px solid var(--linea); }
.drag-ghost.tile { border-radius: 16px; }
.drag-ghost.tile .sq { transform: scale(1.06); box-shadow: 0 14px 30px rgba(46, 38, 25, .25); }
/* where it will land: a soft, filled empty space (no outline, no content) */
.drag-place { border-radius: 12px; border-color: transparent; background: color-mix(in srgb, var(--pergamino) 55%, var(--fondo)); }
.drag-place > *, .drag-place::before, .drag-place::after { visibility: hidden; }
body.dragging-item, body.dragging-item * { user-select: none; cursor: grabbing !important; }
/* the sleep row's length on the right, like a value */
.habit .hval { font-weight: 600; font-variant-numeric: tabular-nums; }

/* ───────── Design review fixes ───────── */
/* Settings rows: short units, so names fit on one line; values and units still line up */
.rate .ru { width: 3.2rem; }
.rate select, .rate input[type=time] { width: 7.6rem; }
.rate input[type=number] { width: 4.2rem; }
/* forms: a short number box under its name, with its unit beside it */
.field input.short { flex: none; width: 6rem; }
.field .unitline { display: flex; align-items: center; gap: .5rem; font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--suave); }
/* Habits → Today: no lines between the habits (the owner removed them); a little more room instead */
.habit { border-bottom: 0; padding: .6rem 0; }
/* Time → Records: no lines between the entries (the owner removed them) */
.entry:not(.tl-block) { border-bottom: 0; padding: .55rem 0; } /* not the calendar's blocks, which share the name */

/* Settings: no lines; each value sits in a soft rounded box instead of on an underline */
.rate input:not(.switch), .rate select {
  border: 0; border-radius: 8px; padding: .35rem .6rem;
  background: color-mix(in srgb, var(--pergamino) 45%, var(--fondo));
}
.rate input:not(.switch):focus, .rate select:focus { box-shadow: 0 0 0 2px color-mix(in srgb, var(--cafe) 35%, transparent); }

/* Settings: a very short line under each setting's name; number boxes wide enough for 0.045 */
.rate .rn { display: flex; flex-direction: column; line-height: 1.25; }
.rate .rn small { font-size: .75rem; font-weight: 400; color: var(--suave); }
.rate input[type=number]:not(.switch) { width: 4.8rem; }

/* ───────── Cozy: softer and rounder ───────── */
.sq, .reward .ei, .habit .ei, .entry .ei, .earn .ei, .hchead .ei, .bi, .iconpick .cur { border-radius: 16px; }
.sq { border-radius: 18px; }
.tl-block { border-radius: 12px; }
.enjoy, .hbtn, .gplus, #nowbar button, .startday { font-weight: 700; }
.enjoy { color: var(--on); }
.toast { border-radius: 18px; }
.rtabs button.on::after, #tabs button.on::before { border-radius: 3px; }
.vt { letter-spacing: 0; }
h1 { letter-spacing: 0; }

/* ───────── Background patterns (Settings → Appearance) ─────────
   All in one color (soft caramel), very faint, and they scroll with the page (drawn on #screen). */
body[data-pattern] #screen { background-attachment: local; }
body[data-pattern=paper] #screen { 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%3CfeColorMatrix values='0 0 0 0 .69 0 0 0 0 .5 0 0 0 0 .34 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E"); }
body[data-pattern=dots] #screen { background-image: radial-gradient(rgba(176, 127, 87, .11) 1.1px, transparent 1.2px); background-size: 20px 20px; }
body[data-pattern=paws] #screen { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100'%3E%3Cg fill='%23b07f57' fill-opacity='.065'%3E%3Cellipse cx='22' cy='26' rx='5' ry='4'/%3E%3Ccircle cx='15' cy='18' r='2'/%3E%3Ccircle cx='20' cy='15' r='2'/%3E%3Ccircle cx='25' cy='15' r='2'/%3E%3Ccircle cx='30' cy='18' r='2'/%3E%3Cellipse cx='72' cy='76' rx='5' ry='4'/%3E%3Ccircle cx='65' cy='68' r='2'/%3E%3Ccircle cx='70' cy='65' r='2'/%3E%3Ccircle cx='75' cy='65' r='2'/%3E%3Ccircle cx='80' cy='68' r='2'/%3E%3C/g%3E%3C/svg%3E"); }
body[data-pattern=flowers] #screen { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cg fill='%23b07f57' fill-opacity='.075'%3E%3Cg transform='translate(28 30)'%3E%3Ccircle cx='0' cy='-4' r='2.6'/%3E%3Ccircle cx='3.8' cy='-1.2' r='2.6'/%3E%3Ccircle cx='2.4' cy='3.3' r='2.6'/%3E%3Ccircle cx='-2.4' cy='3.3' r='2.6'/%3E%3Ccircle cx='-3.8' cy='-1.2' r='2.6'/%3E%3C/g%3E%3Cg transform='translate(86 88) scale(.8)'%3E%3Ccircle cx='0' cy='-4' r='2.6'/%3E%3Ccircle cx='3.8' cy='-1.2' r='2.6'/%3E%3Ccircle cx='2.4' cy='3.3' r='2.6'/%3E%3Ccircle cx='-2.4' cy='3.3' r='2.6'/%3E%3Ccircle cx='-3.8' cy='-1.2' r='2.6'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E"); }
body[data-pattern=leaves] #screen { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cg opacity='.08' fill='none' stroke='%23b07f57' stroke-width='1.3' stroke-linecap='round'%3E%3Cg transform='translate(26 32) rotate(-25)'%3E%3Cpath d='M0 10V-10'/%3E%3Cpath d='M0 4C-5 2-6-2-5-5C-1-4 0-1 0 4ZM0-2C5-4 6-8 5-11C1-10 0-7 0-2Z' fill='%23b07f57' fill-opacity='.5'/%3E%3C/g%3E%3Cg transform='translate(88 84) rotate(30) scale(.85)'%3E%3Cpath d='M0 10V-10'/%3E%3Cpath d='M0 4C-5 2-6-2-5-5C-1-4 0-1 0 4ZM0-2C5-4 6-8 5-11C1-10 0-7 0-2Z' fill='%23b07f57' fill-opacity='.5'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E"); }
/* the bars at the bottom keep a solid background, so the pattern only shows behind the page */
#tabs, #nowbar { position: relative; z-index: 1; }
/* Corbel draws numbers in "old style" (uneven heights) by default: use normal, even numbers everywhere */
* { font-feature-settings: "lnum" 1; }

/* Settings → Archived items: a row that opens a screen */
button.rate.linkrow { width: 100%; text-align: left; }
button.rate.linkrow:hover .rn { color: var(--cafe); }
.rate .acount { font-weight: 600; color: var(--suave); }
/* Archived: one row per item, with Restore */
.arow { display: flex; align-items: center; gap: var(--mkgap); padding: .5rem 0; }
.arow .an { flex: 1; min-width: 0; font-weight: 600; }
.arow .adot { flex: none; width: var(--dot); height: var(--dot); border-radius: 50%; background: var(--accent); margin: 0 calc((var(--mk) - var(--dot)) / 2); }
.arow .ei { flex: none; width: 2.2rem; height: 2.2rem; border-radius: 16px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--accent) 16%, var(--fondo)); color: var(--accent); font-weight: 700; }
.arow .ei .ic { width: 1.15rem; height: 1.15rem; }

/* ───────── Sparkles when a to-do is finished or a habit is done (sparkle() in app.js) ───────── */
.sparkles { position: fixed; width: 0; height: 0; pointer-events: none; z-index: 50; }
.sparkles i {
  position: absolute; left: 0; top: 0; font-style: normal; line-height: 1;
  font-size: calc(17px * var(--s)); color: var(--c); text-shadow: 0 0 1px var(--c); transform: translate(-50%, -50%) scale(.2); opacity: 0;
  animation: sparkle 900ms cubic-bezier(.2, .7, .3, 1) var(--d) forwards;
}
.sparkles i:empty { width: calc(7px * var(--s)); height: calc(7px * var(--s)); border-radius: 50%; background: var(--c); }
@keyframes sparkle {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.2) rotate(0); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y))) scale(1) rotate(160deg); }
}

/* Settings, tighter (the owner found too much space): sections closer together, every value
   ends at the same right edge, and a unit sits inside its value's box ("0.11 ★/min") */
.settings section { margin-bottom: 1.4rem; }
.settings .rate { padding: .3rem 0; }
.settings .rate .ru:empty { display: none; }
.settings .rate .ru { width: auto; }
.settings .rate input:not(.switch), .settings .rate select { font-size: .95rem; }
.settings .rate input:not(.switch):has(+ .ru:not(:empty)) { border-radius: 8px 0 0 8px; padding-right: .25rem; }
.settings .rate input:not(.switch) + .ru:not(:empty) {
  margin-left: calc(-1 * var(--mkgap)); align-self: stretch; display: flex; align-items: center;
  padding: 0 .6rem 0 .1rem; border-radius: 0 8px 8px 0; font-size: .8rem;
  background: color-mix(in srgb, var(--pergamino) 45%, var(--fondo));
}
.settings .rate input:not(.switch):has(+ .ru:not(:empty)):focus { box-shadow: none; }
.settings .rate .acount + .ru { width: auto; padding-left: .1rem; }

/* ───────── Login (sync.js): once per device ───────── */
.login { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: var(--fondo); padding: 1.5rem; }
.login form { width: min(20rem, 100%); display: flex; flex-direction: column; align-items: center; gap: .7rem; text-align: center; }
.login img { width: 6rem; }
.login h1 { margin: 0 0 .6rem; font-size: 2rem; }
.login h1 em { font-style: normal; color: var(--cafe); }
.login input { width: 100%; font: inherit; color: var(--texto); border: 0; border-radius: 10px; padding: .7rem .8rem;
  background: color-mix(in srgb, var(--pergamino) 45%, var(--fondo)); }
.login input:focus { outline: 2px solid color-mix(in srgb, var(--cafe) 35%, transparent); }
.login .primary { width: 100%; }
.login .lerr { min-height: 1.2em; margin: 0; color: #b0626f; font-size: .85rem; }
.login p { color: var(--suave); }
.login .lskip { color: var(--suave); font-size: .85rem; text-align: center; }
/* Settings → Sync: the Log In / Log Out button on the right */
.settings .rate .hbtn { flex: none; }
/* iPhone: room for the home bar and the notch */
#tabs { padding-bottom: env(safe-area-inset-bottom); }
#screen { padding-top: calc(1.4rem + env(safe-area-inset-top, 0px)); }
