/* Daily Timebox Planner — theme modelled on timeboxplanners.com:
   warm cream paper, deep-navy ink, Fraunces serif titles, Inter labels,
   Caveat handwriting placeholders. Flat and paper-like: hairline rules,
   radio-circle checks, no heavy card chrome. */

:root {
  /* "Cadence" identity — clean cream paper, deep charcoal-green ink, a sage accent.
     Ink is near-black for crisp contrast; the accent is a muted olive/sage. */
  --cream:     oklch(0.981 0.008 105);  /* page / paper */
  --paper:     oklch(0.995 0.005 105);  /* slightly lifted surface */
  --ink:       oklch(0.205 0.014 172);  /* near-black charcoal-green ink (text) */
  --accent:    oklch(0.47 0.098 133);   /* sage / olive — buttons / marks */
  --accent-deep: oklch(0.40 0.092 133);
  --ink-70:    oklch(0.205 0.014 172 / 0.78);
  --ink-55:    oklch(0.205 0.014 172 / 0.62);
  --ink-45:    oklch(0.205 0.014 172 / 0.50);
  --ink-30:    oklch(0.205 0.014 172 / 0.36);
  --ink-15:    oklch(0.205 0.014 172 / 0.16);
  --ink-08:    oklch(0.205 0.014 172 / 0.08);
  --work:      oklch(0.955 0.018 125);  /* faint sage wash for working hours */
  --good:      oklch(0.5 0.12 150);

  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans:  "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --maxw: 1200px;   /* the app "box" — header, sub-bar and content all align to this */
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

/* ---- top bar / brand / nav ---- */
.topbar {
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 22px 32px 12px;
  flex-wrap: wrap;
}
.brandwrap { display: flex; align-items: center; gap: 13px; }
.logo {
  width: 52px; height: 52px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: var(--cream); font-size: 28px;
  box-shadow: inset 0 0 0 1px var(--ink-15);
}
.brandtext { display: flex; flex-direction: column; line-height: 0.95; }
.brandtext .b1 { font-family: var(--serif); font-weight: 600; font-size: 42px; letter-spacing: -1.2px; }
.brandtext .b2 { font-family: var(--serif); font-weight: 400; font-size: 23px; color: var(--ink-70); letter-spacing: -0.3px; }

.mainnav { display: flex; gap: 2px; margin-left: auto; flex-wrap: wrap; }
.mainnav a {
  text-decoration: none;
  color: var(--ink-55);
  font-size: 12px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase;
  padding: 9px 13px; border-radius: 6px;
}
.mainnav a:hover { color: var(--ink); background: var(--ink-08); }
.mainnav a.active { color: var(--ink); border-bottom: 2px solid var(--accent); border-radius: 0; }

/* ---- sub bar (metrics + controls) ---- */
.subbar {
  max-width: var(--maxw);
  margin: 0 auto 20px;
  display: flex; align-items: flex-end; gap: 24px;
  padding: 8px 32px 16px;
  border-bottom: 1px solid var(--ink-15);
  flex-wrap: wrap;
}
.metric { display: flex; flex-direction: column; gap: 3px; }
.metric .k { font-size: 10px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: var(--ink-55); }
.metric .v { font-family: var(--serif); font-size: 24px; font-weight: 600; }
.datewrap { display: flex; align-items: center; gap: 4px; }
.datewrap input[type="date"] {
  border: none; background: transparent; color: var(--ink);
  font-family: var(--serif); font-size: 22px; font-weight: 600; padding: 0;
}
.iconbtn {
  border: none; background: transparent; color: var(--ink-45);
  font-size: 20px; cursor: pointer; padding: 0 4px; line-height: 1;
}
.iconbtn:hover { color: var(--ink); }

.txtbtn {
  border: none; background: transparent; cursor: pointer;
  font-size: 11px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase;
  color: var(--ink-45); padding: 6px 4px;
}
.txtbtn:hover { color: var(--ink); }

.btn {
  border: 1px solid var(--accent); background: var(--accent); color: var(--cream);
  border-radius: 6px; cursor: pointer;
  font-size: 11px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase;
  padding: 7px 13px; font-family: var(--sans);
}
.btn:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
.btn.outline { background: transparent; color: var(--ink); border-color: var(--ink-30); }
.btn.outline:hover { background: var(--ink-08); filter: none; }

.save-status { font-size: 11px; color: var(--ink-45); margin-left: auto; }
.save-status.saved { color: var(--good); }

/* ---- day sheet ---- */
.sheet {
  max-width: var(--maxw); margin: 0 auto; padding: 0 32px 40px;
  display: grid; grid-template-columns: 1fr 1.05fr; gap: 48px; align-items: start;
}
.left { display: flex; flex-direction: column; gap: 28px; }

.sec-label {
  font-size: 11px; font-weight: 600; letter-spacing: 1.4px; text-transform: uppercase;
  color: var(--ink-70); padding-bottom: 8px; margin-bottom: 2px;
  border-bottom: 1px solid var(--ink-15);
}

/* line lists */
.line-list { display: flex; flex-direction: column; }
.line {
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--ink-08); padding: 2px 0;
}
.line:hover { background: var(--ink-08); }

/* radio-circle check */
input.radio {
  appearance: none; -webkit-appearance: none;
  width: 18px; height: 18px; border-radius: 50%;
  border: 1.5px solid var(--ink-30); background: transparent;
  cursor: pointer; flex: 0 0 auto; position: relative; margin: 0 0 0 2px;
}
input.radio:hover { border-color: var(--accent); }
input.radio:checked { background: var(--accent); border-color: var(--accent); }
input.radio:checked::after {
  content: ""; position: absolute; left: 5.5px; top: 2px;
  width: 4.5px; height: 9px; border: solid var(--cream); border-width: 0 1.7px 1.7px 0;
  transform: rotate(45deg);
}

input.line-text {
  flex: 1; border: none; outline: none; background: transparent;
  padding: 10px 2px; font-size: 16px; font-weight: 500; color: var(--ink); min-width: 0;
}
input.line-text.done { text-decoration: line-through; color: var(--ink-45); }
::placeholder { font-family: var(--serif); font-style: italic; font-size: 16px; color: var(--ink-30); opacity: 1; }

/* estimate / spent time boxes on task rows */
.timebox { display: inline-flex; align-items: baseline; gap: 3px; flex: 0 0 auto; }
.timebox em { font-style: normal; font-size: 10px; font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase; color: var(--ink-45); }
input.num {
  width: 44px; text-align: right; border: none; outline: none;
  border-bottom: 1px solid var(--ink-15); background: transparent;
  font-family: var(--sans); font-size: 14px; font-weight: 500; color: var(--ink); padding: 5px 2px;
  -moz-appearance: textfield; appearance: textfield;
}
input.num::-webkit-outer-spin-button,
input.num::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input.num:focus { border-bottom-color: var(--accent); }
input.num.spent { color: var(--accent); font-weight: 600; }

.addlink {
  align-self: flex-start; margin-top: 8px; border: none; background: transparent;
  cursor: pointer; color: var(--ink-45);
  font-size: 10px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; padding: 4px 0;
}
.addlink:hover { color: var(--accent); }

.line.carried::before { content: "↳"; color: var(--accent); font-size: 12px; margin-left: 2px; }

/* star toggle — mark a task as a today's priority */
.line .star {
  flex: 0 0 auto; border: none; background: transparent; cursor: pointer;
  padding: 0; width: 20px; font-size: 16px; line-height: 1; color: var(--ink-30);
}
.line .star:hover { color: var(--accent); }
.line.priority { background: color-mix(in oklch, var(--accent) 7%, transparent); box-shadow: inset 2px 0 0 var(--accent); }
.line.priority .star { color: var(--accent); }
.line.priority .line-text { font-weight: 600; }

.sec-label .sec-hint {
  font-weight: 400; text-transform: none; letter-spacing: 0;
  color: var(--ink-30); font-size: 11px;
}

/* read-only priorities mirror (membership controlled by the star in All Tasks) */
.prio-list { display: flex; flex-direction: column; }
.prio-item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 2px; border-bottom: 1px solid var(--ink-08);
  font-size: 16px; font-weight: 600; color: var(--ink);
}
.prio-item .prio-star { color: var(--accent); font-size: 14px; flex: 0 0 auto; }
.prio-item.done .prio-text { text-decoration: line-through; color: var(--ink-45); font-weight: 500; }
.prio-empty { padding: 9px 2px; font-size: 14px; color: var(--ink-30); font-style: italic; font-family: var(--serif); }

textarea#notes {
  width: 100%; border: none; outline: none; resize: vertical; margin-top: 8px;
  font-family: var(--sans); font-size: 16px; font-weight: 500; color: var(--ink); background: transparent; min-height: 78px;
}

/* ---- schedule grid ---- */
.schedule { font-family: var(--sans); }
.sched-head, .sched-row { display: grid; grid-template-columns: 46px 1fr 1fr; }
.sched-head {
  color: var(--ink-45); font-size: 11px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase;
  border-bottom: 1px solid var(--ink-30);
}
.sched-head .col { padding: 7px 12px; }
.sched-row { border-bottom: 1px solid var(--ink-08); }
.sched-row:first-child { border-top: none; }
.sched-row .hourlabel {
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: var(--ink-45); border-right: 1px solid var(--ink-08);
}
.sched-row input {
  border: none; outline: none; background: transparent; color: var(--ink);
  padding: 13px 12px; font-size: 14px; font-weight: 500; font-family: var(--sans); min-width: 0;
}
.sched-row input:nth-of-type(1) { border-right: 1px dashed var(--ink-15); }
.sched-row input.work { background: var(--work); }
.sched-row input:focus { background: color-mix(in oklch, var(--accent) 8%, transparent) !important; }
/* meeting-title hint inside empty schedule cells (small italic, not the serif default) */
.sched-row input::placeholder { font-family: var(--sans); font-style: italic; font-size: 13px; color: var(--ink-45); }

.legend { display: flex; align-items: center; gap: 6px; margin-top: 12px; font-size: 11px; color: var(--ink-45); }
.legend .swatch { display: inline-block; width: 14px; height: 12px; border: 1px solid var(--ink-15); border-radius: 3px; vertical-align: middle; }
.legend .swatch.work { background: var(--work); }
.legend .sep { width: 12px; }

/* ---- generic pages (week/month/analytics/settings) ---- */
.page { max-width: var(--maxw); margin: 0 auto; padding: 0 32px 48px; }
.page-title { font-family: var(--serif); font-size: 34px; font-weight: 600; letter-spacing: -0.6px; margin: 4px 0 18px; }
.range-label { font-family: var(--serif); font-size: 20px; font-weight: 600; }

.card {
  background: var(--paper); border: 1px solid var(--ink-15); border-radius: 8px;
  padding: 18px 20px; margin-bottom: 18px;
}
.card h2 {
  margin: 0 0 12px; font-size: 11px; font-weight: 600; letter-spacing: 1.4px; text-transform: uppercase;
  color: var(--ink-70); border-bottom: 1px solid var(--ink-15); padding-bottom: 8px;
}
.hint { color: var(--ink-45); font-size: 13px; margin: 8px 0 0; }

.row-toggle { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 14px; }
.row-toggle input { width: 16px; height: 16px; }
.row-inline { display: flex; align-items: center; gap: 18px; margin-top: 12px; flex-wrap: wrap; }
.row-inline label { display: flex; align-items: center; gap: 6px; font-size: 14px; }
select, input[type="color"] {
  border: 1px solid var(--ink-15); border-radius: 6px; padding: 5px 7px; font-size: 13px;
  font-family: var(--sans); background: var(--paper); color: var(--ink);
}
input[type="color"] { padding: 2px; height: 30px; width: 44px; }

.blocks { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.block-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; border: 1px solid var(--ink-08); border-radius: 8px; padding: 8px 10px; }
.block-label { border: 1px solid var(--ink-15); border-radius: 6px; padding: 6px 8px; font-size: 14px; min-width: 150px; background: var(--paper); }
.wd-group { display: flex; gap: 2px; }
.wd { display: flex; flex-direction: column; align-items: center; font-size: 10px; color: var(--ink-45); cursor: pointer; }
.wd input { margin: 0; }
.time-range { display: flex; align-items: center; gap: 6px; }
button.ghost { border: 1px solid var(--ink-15); background: var(--paper); border-radius: 6px; padding: 6px 10px; cursor: pointer; font-size: 13px; color: var(--ink); }
button.ghost:hover { background: var(--ink-08); }
button.ghost.danger:hover { background: color-mix(in oklch, red 10%, var(--paper)); color: #b02020; }
.primary { border: 1px solid var(--accent); background: var(--accent); color: var(--cream); border-radius: 6px; padding: 8px 14px; cursor: pointer; font-size: 11px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; }
.page-controls { display: flex; align-items: center; gap: 10px; }

/* stat tiles */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.tile { background: var(--paper); border: 1px solid var(--ink-15); border-radius: 8px; padding: 14px 16px; }
.tile .label { font-size: 11px; font-weight: 600; letter-spacing: 0.4px; text-transform: uppercase; color: var(--ink-45); }
.tile .value { font-family: var(--serif); font-size: 34px; font-weight: 600; margin-top: 6px; letter-spacing: -0.5px; }
.tile .sub { font-size: 12px; color: var(--ink-45); margin-top: 3px; }
.tile.accent .value { color: var(--accent); }
.section-title { font-size: 11px; font-weight: 600; letter-spacing: 1.4px; text-transform: uppercase; color: var(--ink-45); margin: 22px 0 8px; }
@media (max-width: 780px) { .tiles { grid-template-columns: repeat(2, 1fr); } }

/* week strip */
.week-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; }
.day-card { background: var(--paper); border: 1px solid var(--ink-15); border-radius: 8px; padding: 10px; min-height: 120px; cursor: pointer; text-decoration: none; color: var(--ink); display: flex; flex-direction: column; gap: 6px; }
.day-card:hover { border-color: var(--accent); }
.day-card.today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.day-card .dc-head { display: flex; justify-content: space-between; align-items: baseline; }
.day-card .dc-wd { font-size: 10px; font-weight: 600; letter-spacing: 1px; color: var(--ink-45); text-transform: uppercase; }
.day-card .dc-num { font-family: var(--serif); font-weight: 600; font-size: 18px; }
.day-card .dc-prios { font-size: 12px; display: flex; flex-direction: column; gap: 2px; }
.day-card .dc-prios .p { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.day-card .dc-prios .p.done { text-decoration: line-through; color: var(--ink-45); }
.day-card .dc-meta { margin-top: auto; font-size: 11px; color: var(--ink-45); display: flex; gap: 8px; }
@media (max-width: 900px) { .week-strip { grid-template-columns: repeat(2, 1fr); } }

/* month calendar */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal .cal-head { font-size: 10px; font-weight: 600; letter-spacing: 1px; color: var(--ink-45); text-align: center; text-transform: uppercase; padding-bottom: 4px; }
.cal-cell { background: var(--paper); border: 1px solid var(--ink-15); border-radius: 8px; min-height: 74px; padding: 6px; text-decoration: none; color: var(--ink); display: flex; flex-direction: column; gap: 4px; }
.cal-cell.empty { background: transparent; border: none; }
.cal-cell:hover { border-color: var(--accent); }
.cal-cell.today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.cal-cell .cc-num { font-family: var(--serif); font-size: 14px; font-weight: 600; }
.cal-cell .cc-bar { height: 4px; border-radius: 2px; background: var(--ink-08); overflow: hidden; }
.cal-cell .cc-bar > span { display: block; height: 100%; background: var(--accent); }
.cal-cell .cc-meta { font-size: 10.5px; color: var(--ink-45); margin-top: auto; }

/* charts */
.chart-card svg { width: 100%; height: auto; display: block; }
.chart-legend { display: flex; gap: 16px; font-size: 12px; color: var(--ink-45); margin-top: 8px; flex-wrap: wrap; }
.chart-legend .k { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

@media (max-width: 820px) {
  .sheet { grid-template-columns: 1fr; gap: 28px; }
}

/* ---- auth: login / register ---- */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; }
.login-card { width: 100%; max-width: 380px; background: var(--paper); border: 1px solid var(--ink-15); border-radius: 12px; padding: 28px 26px 22px; }
.login-brand { justify-content: center; margin-bottom: 18px; }
.login-tabs { display: flex; gap: 4px; background: var(--ink-08); border-radius: 8px; padding: 3px; margin-bottom: 14px; }
.login-tabs button { flex: 1; border: none; background: transparent; cursor: pointer; padding: 8px; border-radius: 6px; font-size: 13px; font-weight: 600; color: var(--ink-55); font-family: var(--sans); }
.login-tabs button.active { background: var(--paper); color: var(--ink); box-shadow: 0 1px 2px var(--ink-08); }
.login-intro { font-size: 13px; color: var(--ink-45); margin: 0 0 16px; }
#authForm { display: flex; flex-direction: column; gap: 10px; }
#authForm input { border: 1px solid var(--ink-15); border-radius: 8px; padding: 11px 12px; font-size: 15px; font-family: var(--sans); color: var(--ink); background: var(--cream); }
#authForm input:focus { outline: none; border-color: var(--accent); }
.login-submit { margin-top: 4px; padding: 11px; font-size: 12px; }
.auth-error { color: #b02020; font-size: 13px; min-height: 16px; }
.login-skip { display: block; text-align: center; margin-top: 16px; font-size: 12.5px; color: var(--ink-45); text-decoration: none; }
.login-skip:hover { color: var(--ink); }

/* nav account chip */
.nav-account { display: inline-flex; align-items: center; gap: 10px; margin-left: 8px; }
.nav-account .user-email { font-size: 11px; color: var(--ink-45); max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-account .nav-signin, .nav-account .nav-logout { font-size: 11px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: var(--accent); text-decoration: none; padding: 9px 6px; }
.nav-account .nav-signin:hover, .nav-account .nav-logout:hover { color: var(--accent-deep); }

/* ---- account: avatar dropdown (far right of the top bar) ---- */
.nav-account { position: relative; display: inline-flex; align-items: center; margin-left: 10px; }
.nav-account .nav-signin { font-size: 11px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: var(--accent); text-decoration: none; padding: 9px 6px; }
.nav-account .nav-signin:hover { color: var(--accent-deep); }
.avatar-btn {
  width: 36px; height: 36px; border-radius: 50%; padding: 0;
  border: 1px solid var(--ink-15); background: color-mix(in oklch, var(--accent) 12%, var(--paper));
  color: var(--accent-deep); cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.avatar-btn:hover { border-color: var(--accent); }
.avatar-menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 210px;
  background: var(--paper); border: 1px solid var(--ink-15); border-radius: 10px;
  box-shadow: 0 10px 28px oklch(0.2 0.02 170 / 0.14); padding: 6px; z-index: 50;
}
.avatar-menu[hidden] { display: none; }
.avatar-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--ink-08); margin-bottom: 4px; }
.avatar-name { font-weight: 600; font-size: 14px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar-sub { font-size: 12px; color: var(--ink-45); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar-item {
  display: block; width: 100%; text-align: left; box-sizing: border-box; border: none;
  background: transparent; cursor: pointer; padding: 9px 10px; border-radius: 6px;
  font-size: 13px; color: var(--ink); font-family: var(--sans); text-decoration: none;
}
.avatar-item:hover { background: var(--ink-08); }

/* ---- profile form ---- */
.field { display: flex; flex-direction: column; gap: 5px; margin-top: 12px; }
.field:first-of-type { margin-top: 0; }
.field label { font-size: 12px; font-weight: 600; color: var(--ink-70); }
.field input { border: 1px solid var(--ink-15); border-radius: 8px; padding: 10px 12px; font-size: 15px; font-family: var(--sans); color: var(--ink); background: var(--cream); }
.field input:focus { outline: none; border-color: var(--accent); }
.profile-actions { display: flex; align-items: center; gap: 14px; margin-top: 16px; }
.profile-status { font-size: 13px; color: var(--ink-45); }
.profile-status.ok { color: var(--good); }
.profile-status.err { color: #b02020; }

/* form action row at the bottom of a form (settings) — left-aligned like the profile page */
.form-actions { display: flex; align-items: center; gap: 14px; margin-top: 4px; }
.form-actions .save-status { margin-left: 0; }

/* month calendar: tint day-cells that have content a soft blue */
.cal-cell.filled { background: oklch(0.94 0.04 245); border-color: oklch(0.86 0.05 245); }
.cal-cell.filled .cc-bar { background: oklch(0.88 0.03 245); }
.cal-cell.today { border-color: var(--accent); }   /* keep today's ring above .filled */
