:root {
  --ink: #171717;
  --muted: #6e6e6e;
  --faint: #a3a3a3;
  --line: #dcdcdc;
  --line-strong: #171717;
  --panel: #f6f6f5;
  --hover: #f1f1ef;
  --accent: #d0021b; /* the red dot in LEAD.SELL.GROW. */
  --accent-tint: #fdecee;
  --bg: #ffffff;
  --font: "Proxima Nova", "proxima-nova", -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { font-size: 15.2px; } /* 95% of 16px, per Dave */

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }

button { cursor: pointer; }

/* ---------- app frame ---------- */

#app { display: flex; flex-direction: column; height: 100vh; }

.topbar {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.7rem 1.4rem;
  border-bottom: 1px solid var(--line);
  -webkit-app-region: drag;
}
.topbar button, .topbar input { -webkit-app-region: no-drag; }

.wordmark {
  font-weight: 900;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.wordmark i { font-style: normal; color: var(--accent); }
.wordmark b { color: var(--accent); }
.wordmark small {
  display: block;
  font-size: 0.42em;
  font-weight: 700;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 0.1em;
}

.views {
  display: flex;
  margin: 0 auto;
  background: var(--panel);
  border-radius: 10px;
  padding: 4px;
}
.views button {
  border: 0;
  background: transparent;
  padding: 0.45rem 1.2rem;
  border-radius: 7px;
  font-weight: 700;
  color: var(--muted);
}
.views button[aria-selected="true"] {
  background: var(--bg);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.actions { display: flex; gap: 0.6rem; }

.solid, .ghost, .danger {
  border-radius: 8px;
  padding: 0.5rem 1.1rem;
  font-weight: 700;
  border: 1.5px solid var(--ink);
}
.solid { background: var(--ink); color: #fff; }
.ghost { background: transparent; }
.danger { background: transparent; border-color: var(--accent); color: var(--accent); }
.solid:hover { background: #000; }
.ghost:hover { background: var(--hover); }
.danger:hover { background: var(--accent-tint); }

#screen {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 1rem 1.4rem 1.2rem;
}

/* ---------- title row (shared with print) ---------- */

.title-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: 1em;
  padding-bottom: 0.55em;
  border-bottom: 2px solid var(--line-strong);
}
.t-center { text-align: center; }
.t-center h1 {
  margin: 0;
  font-size: 1.7em;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  line-height: 1.05;
}
.t-sub { color: var(--muted); font-weight: 600; font-size: 0.85em; margin-top: 0.2em; }
.t-field { display: flex; align-items: baseline; gap: 0.6em; }
.t-field.right { justify-content: flex-end; }
.t-label { font-weight: 800; font-size: 0.8em; text-transform: uppercase; letter-spacing: 0.06em; }
.t-value { font-weight: 600; }
.income {
  border: 0;
  border-bottom: 1.5px solid var(--ink);
  width: 10em;
  font-weight: 700;
  font-size: 1.1em;
  padding: 0.1em 0.2em;
  outline: none;
  background: transparent;
}
.income-print {
  display: inline-block;
  min-width: 9em;
  border-bottom: 1.5px solid var(--ink);
  font-weight: 800;
}

.legend { display: flex; gap: 1.1em; color: var(--muted); font-size: 0.8em; font-weight: 600; }
.legend > span { display: inline-flex; align-items: center; gap: 0.35em; }

/* ---------- items ---------- */

.list {
  list-style: none;
  margin: 0;
  padding: 0;
  min-height: 1.6em; /* keeps empty lists droppable */
}

.item {
  display: flex;
  align-items: flex-start;
  gap: 0.55em;
  padding: 0.42em 0.4em;
  border-bottom: 1px solid var(--line);
  cursor: grab;
  border-radius: 4px;
  line-height: 1.3;
}
#screen .item:hover { background: var(--hover); }
.item { position: relative; }

/* trash button: hidden until the row is hovered, far right of the row */
.trash {
  position: absolute;
  right: 0.3em;
  top: 50%;
  transform: translateY(-50%);
  display: none;
  align-items: center;
  justify-content: center;
  width: 1.9em;
  height: 1.9em;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 0.95em;
}
#screen .item:hover { padding-right: 2.4em; } /* make room so a target's number slides left, not under the icon */
#screen .item:hover .trash { display: inline-flex; }
.trash:hover { color: var(--accent); background: var(--accent-tint); }
.drag-item .trash, .ghost-item .trash { display: none !important; }
.body { flex: 1; min-width: 0; }
.line { display: flex; gap: 0.6em; align-items: baseline; }
.text { flex: 1; overflow-wrap: break-word; }
.target { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sec-targets .text { font-weight: 700; }
.done .text, .done .target { text-decoration: line-through; color: var(--faint); }

.meta { display: flex; flex-wrap: wrap; gap: 0.35em; margin-top: 0.25em; }
.chip {
  font-size: 0.68em;
  font-weight: 700;
  padding: 0.12em 0.5em;
  border-radius: 4px;
  background: var(--panel);
  color: var(--muted);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.chip.due.soon { color: var(--ink); background: #ececec; }
.chip.due.late { color: var(--accent); background: var(--accent-tint); }
.chip.carried { color: var(--accent); background: transparent; box-shadow: inset 0 0 0 1px var(--accent); }

/* markers: ring = target, # = number, square = item */
.mark {
  flex: none;
  width: 1em;
  height: 1em;
  margin-top: 0.15em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.mark.num { color: var(--accent); font-weight: 900; font-size: 1em; line-height: 1; }
input.check, .mark.box, .mark.ring, .mark.sq {
  appearance: none;
  -webkit-appearance: none;
  border: 2px solid var(--ink);
  border-radius: 3px;
  background: var(--bg);
  margin: 0.15em 0 0;
  position: relative;
}
.sec-targets input.check, .sec-targets .mark.box, .mark.ring { border-radius: 50%; }
input.check { cursor: pointer; }
input.check:checked, .mark.box.on { background: var(--ink); }
input.check:checked::after, .mark.box.on::after {
  content: "";
  position: absolute;
  left: 30%;
  top: 8%;
  width: 28%;
  height: 55%;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.legend .mark { margin-top: 0; width: 0.95em; height: 0.95em; }

.quick {
  width: 100%;
  border: 0;
  border-bottom: 1px dashed transparent;
  background: transparent;
  padding: 0.4em 0.4em;
  outline: none;
  color: var(--ink);
}
.quick::placeholder { color: var(--faint); }
.quick:hover::placeholder { color: var(--muted); }
.quick:focus { border-bottom-color: var(--ink); }

/* drag states */
.ghost-item { opacity: 0.35; background: var(--accent-tint) !important; }
.chosen-item { background: var(--hover); }
.drag-item { box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18); background: #fff; cursor: grabbing; }

/* ---------- 90-day board ---------- */

/* One grid, shared rows: column heads / Targets / Important Items */
.gboard {
  display: grid;
  grid-template-columns: 1.3fr 1.3fr 1fr 1fr;
  grid-template-rows: auto auto 1fr;
}
.gcell { min-width: 0; border-right: 1px solid var(--line); padding: 0 0.9em; }
.gcell.last { border-right: 0; }
.col-head { padding: 0.75em 0.9em 0.55em; border-bottom: 1.5px solid var(--line-strong); }
.col-label { font-weight: 900; font-size: 0.78em; text-transform: uppercase; letter-spacing: 0.08em; }
.col-month { font-weight: 800; font-size: 1.45em; line-height: 1.15; }
.col-m0 .col-label { color: var(--accent); }

.gsec { padding-top: 0.8em; padding-bottom: 0.6em; }
.sec-head {
  margin: 0 0 0.15em;
  font-size: 0.72em;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.5em;
}
.count {
  background: var(--panel);
  border-radius: 99px;
  padding: 0 0.55em;
  font-size: 0.95em;
  color: var(--muted);
}

#screen.screen-board .sboard { flex: 1; min-height: 0; overflow-y: auto; align-content: stretch; }
.sboard .col-head { position: sticky; top: 0; z-index: 2; background: var(--bg); }
/* divider so the Important Items row reads straight across all three months */
.sboard .gsec.sec-items { border-top: 1px solid var(--line); }

.cap-note { padding: 0.4em; font-size: 0.8em; font-weight: 700; color: var(--faint); }
.quick.full { border-bottom-color: var(--accent); }
.quick.full::placeholder { color: var(--accent); }
.ed-error { margin: 0; color: var(--accent); font-weight: 700; font-size: 0.9rem; }
.ed-error[hidden] { display: none; }

/* ---------- 12-month plan ---------- */

.year { display: flex; flex-direction: column; gap: 0.8em; }
.year-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-template-rows: 1fr 1fr;
  border-top: 0;
  border-left: 1px solid var(--line);
}
.mbox {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 0 0.6em 0.4em;
}
.mbox-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5em;
  padding: 0.55em 0.1em 0.4em;
  border-bottom: 1.5px solid var(--line-strong);
}
.mname { font-weight: 900; font-size: 1.05em; text-transform: uppercase; letter-spacing: 0.03em; }
.myear { font-size: 0.7em; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.mbox.now .mname, .mbox.now .myear { color: var(--accent); }
.mbox .list { flex: 1; }
.mbox .item { font-size: 0.9em; padding: 0.35em 0.2em; }
.mbox .line { flex-wrap: wrap; column-gap: 0.4em; row-gap: 0; }
.mbox .quick { font-size: 0.85em; padding: 0.35em 0.2em; }

.later { border: 1px solid var(--line); padding: 0 0.7em 0.4em; }
.later .mbox-head { border-bottom-width: 1px; }
.later-list { display: flex; flex-wrap: wrap; gap: 0 1.5em; }
.later-list .item { border-bottom: 0; font-size: 0.9em; }

#screen.screen-year .year { flex: 1; min-height: 0; margin-top: 0.8em; }
#screen.screen-year .year-grid { flex: 1; min-height: 0; }
#screen.screen-year .mbox .list { overflow-y: auto; }
#screen.screen-year .later { max-height: 22vh; overflow-y: auto; }

/* ---------- editor ---------- */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 20, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}
.modal[hidden] { display: none; }
.sheet {
  background: var(--bg);
  width: min(640px, calc(100vw - 32px));
  border-radius: 14px;
  padding: 1.4rem 1.5rem 1.2rem;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
.sheet h2 { margin: 0; font-size: 1.3rem; font-weight: 900; }
.field { display: flex; flex-direction: column; gap: 0.3rem; flex: 1; }
.field[hidden] { display: none; }
.field > span { font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.field input, .field select, .field textarea {
  border: 1.5px solid var(--line);
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
  background: var(--bg);
  outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--ink); }
.field textarea { resize: vertical; }
.row { display: flex; gap: 0.8rem; }
.sheet-actions { display: flex; gap: 0.6rem; margin-top: 0.3rem; }
.spacer { flex: 1; }

/* ---------- one-page print layout ---------- */

#print-root { display: none; }

@page { size: letter landscape; margin: 0.4in; }

body.printing #app, body.printing .modal { display: none !important; }
body.printing #print-root { display: block; }

.page {
  width: 10.2in;
  height: 7.7in;
  overflow: hidden;
  background: #fff;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
.page .year { margin-top: 0.4em; }
.page .year-grid { grid-template-rows: auto auto; }
.page .item { cursor: default; padding: 0.24em 0.15em; line-height: 1.22; }
.page .item.blank .mark { visibility: hidden; }

/* 90 Day Plan page: one grid, shared rows across all four columns */
.pboard { grid-template-rows: auto auto auto; margin-top: 0.4em; }
.pboard .gcell { min-height: 0; overflow: hidden; padding: 0 0.6em; }
.pboard .col-head { padding: 0.4em 0.6em 0.35em; }
.pboard .gsec { padding-top: 0.55em; padding-bottom: 0; }
.pboard .gsec .sec-head { margin-bottom: 0.1em; }
.page .mbox { overflow: hidden; }
.page .mbox .item { font-size: 0.86em; }
.page .later-list .item { font-size: 0.86em; }
.page .chip { font-size: 0.62em; }
.page-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.5em;
}
.page-foot .wordmark { font-size: 1em; text-align: right; }

/* ---------- web build: sign-in pages ---------- */

body.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 16px; background: var(--panel); }
.auth-card {
  background: var(--bg);
  width: min(460px, 100%);
  border-radius: 14px;
  padding: 2rem 1.8rem 1.6rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.1);
}
.auth-card .wordmark { font-size: 1.15rem; margin-bottom: 1.4rem; }
.auth-card h1 { margin: 0 0 0.4rem; font-size: 1.6rem; font-weight: 900; }
.auth-card form { display: flex; flex-direction: column; gap: 0.9rem; }
.auth-lead { margin: 0; color: var(--muted); }
.auth-msg { margin: 0; font-weight: 700; font-size: 0.9rem; min-height: 1.2em; }
.auth-msg.good { color: var(--ink); }
.auth-msg.bad { color: var(--accent); }
.auth-note { margin: 1.4rem 0 0; font-size: 0.78rem; color: var(--muted); }
.wide { width: 100%; padding: 0.75rem 1rem; }
button:disabled { opacity: 0.6; cursor: default; }

/* ---------- web build: top bar ---------- */

.plan-switch-wrap {
  -webkit-app-region: no-drag;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  padding: 0.4rem 0.7rem;
  font-weight: 700;
  background: var(--bg);
  max-width: 20rem;
  cursor: pointer;
}
.plan-switch-wrap:hover { border-color: var(--faint); }
.plan-switch-wrap:focus-within { border-color: var(--ink); }
.plan-switch-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plan-switch-chevron { display: inline-flex; color: var(--muted); flex: none; }
.plan-switch { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font: inherit; }
.save-status { align-self: center; font-size: 0.8rem; font-weight: 700; color: var(--faint); min-width: 5em; text-align: right; }
.save-status.bad { color: var(--accent); }
.account { position: relative; -webkit-app-region: no-drag; }
.account-btn { width: 2.6rem; height: 2.6rem; padding: 0; border-radius: 50%; font-weight: 800; font-size: 0.85rem; }
.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 20;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
  min-width: 15rem;
  padding: 0.35rem;
  display: flex;
  flex-direction: column;
}
.menu[hidden] { display: none; }
.menu-head { display: flex; flex-direction: column; padding: 0.5rem 0.7rem 0.6rem; border-bottom: 1px solid var(--line); margin-bottom: 0.3rem; }
.menu-head span { font-size: 0.78rem; color: var(--muted); }
.menu button { text-align: left; border: 0; background: transparent; padding: 0.5rem 0.7rem; border-radius: 6px; font-weight: 600; }
.menu button:hover { background: var(--hover); }
.plan-name { color: var(--ink); }

/* ---------- web build: dialogs and toasts ---------- */

.dlg-body { display: flex; flex-direction: column; gap: 0.5rem; max-height: 60vh; overflow-y: auto; }
.dlg-note { margin: 0 0 0.3rem; color: var(--muted); font-size: 0.92rem; }
.check-row { display: flex; align-items: center; gap: 0.6rem; padding: 0.35rem 0; }
.check-row small { color: var(--muted); }
.hist-row, .person { display: flex; align-items: center; gap: 0.8rem; padding: 0.45rem 0; border-bottom: 1px solid var(--line); }
.hist-when { font-weight: 700; min-width: 9em; }
.hist-who { flex: 1; color: var(--muted); }
.hist-count { color: var(--muted); font-size: 0.85rem; }
.person > div { flex: 1; display: flex; flex-direction: column; }
.person small { color: var(--muted); font-size: 0.8rem; }
.person.inactive { opacity: 0.5; }
.add-person { margin-top: 0.8rem; display: flex; flex-direction: column; gap: 0.6rem; }
.add-person h3 { margin: 0; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.add-person input, .add-person select { border: 1.5px solid var(--line); border-radius: 8px; padding: 0.45rem 0.6rem; flex: 1; min-width: 0; }
.add-person .solid { align-self: flex-start; }
.small { padding: 0.3rem 0.7rem; font-size: 0.82rem; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 0.7rem 1.1rem;
  border-radius: 10px;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  z-index: 30;
  max-width: min(560px, calc(100vw - 32px));
  transition: opacity 0.4s;
}
.toast.out { opacity: 0; }
.add-person input[type="checkbox"] { flex: none; }
.share-list { display: flex; flex-direction: column; }
.share-row { display: flex; align-items: center; gap: 0.8rem; padding: 0.45rem 0; border-bottom: 1px solid var(--line); }
.share-row > div { flex: 1; display: flex; flex-direction: column; }
.share-row small { color: var(--muted); font-size: 0.8rem; }
.dlg-body select, .invite-row input, .dlg-body .field input { border: 1.5px solid var(--line); border-radius: 8px; padding: 0.45rem 0.6rem; background: var(--bg); }
.invite-row { align-items: center; }
.invite-row input { flex: 1; min-width: 0; }
.coach-row { margin-top: 0.4rem; font-weight: 700; }
.add-person input[hidden], .add-person .row[hidden] { display: none; }
.menu .danger-item { color: var(--accent); }

/* Official logo (from leadsellgrow.com), replacing the typed wordmark */
.logo { display: block; height: 0.7rem; width: auto; flex: none; }
.auth-brand { margin-bottom: 1.4rem; }
.auth-brand .logo { height: 0.85rem; }
.auth-brand small, .page-brand small {
  display: block;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 0.35rem;
}
.page-brand { display: flex; flex-direction: column; align-items: flex-end; }
.page-brand .logo { height: 0.75em; }
.page-brand small { font-size: 0.42em; margin-top: 0.35em; }

/* Business-Life Plan: one-line header and slim month headers, so the boxes get the room */
.title-row.compact { align-items: center; padding-bottom: 0.35em; border-bottom-width: 1.5px; }
.title-row.compact .t-center { display: flex; align-items: baseline; justify-content: center; gap: 0.7em; }
.title-row.compact h1 { font-size: 1.15em; }
.title-row.compact .t-sub { margin: 0; font-size: 0.8em; }
.title-row.compact .income { font-size: 1em; padding: 0 0.2em; }
.screen-year .mbox-head, .page-year .mbox-head { padding: 0.35em 0.1em 0.25em; border-bottom-width: 1px; }
.screen-year .mname, .page-year .mname { font-size: 0.85em; }
#screen.screen-year .year { margin-top: 0.4em; }
.foot-left { display: flex; align-items: center; gap: 1.6em; }
.foot-plan { font-size: 0.8em; font-weight: 700; color: var(--muted); }
