/* The Lighter State palette. Square edges, calm and editorial. */
:root {
  --midnight: #1f3550;
  --forest: #30392f;
  --pearl: #f7f3ec;
  --paper: #fcfaf6;
  --sky: #5e9fd6;
  --gold: #c9a464;
  --soft-gold: #dcc28e;
  --deep-gold: #a8843f;
  --sage: #becdb9;
  --line: rgba(31, 53, 80, 0.18);
  --muted: #53647a;
  --serif: 'Lora', Georgia, serif;
  --sans: 'Poppins', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--pearl);
  color: var(--midnight);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
}

h1, h2, h3 { font-family: var(--serif); font-weight: 500; line-height: 1.25; margin: 0 0 12px; }
h1 { font-size: 2.1rem; margin-top: 8px; }
h2 { font-size: 1.4rem; margin-top: 36px; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 14px; }
a { color: var(--midnight); text-decoration-color: var(--deep-gold); text-underline-offset: 3px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.lede { font-size: 1.1rem; max-width: 36em; }

.wrap { max-width: 860px; margin: 0 auto; padding: 32px 16px 80px; }
.wrap.narrow { max-width: 560px; }

/* Header */
.bar {
  background: var(--midnight);
  color: var(--pearl);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px max(16px, calc((100% - 860px) / 2 + 16px));
}
.brand { color: var(--pearl); text-decoration: none; display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-family: var(--serif); font-size: 1.25rem; }
.brand-sub { font-size: 0.68rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--soft-gold); margin-top: 3px; }
.bar nav { display: flex; align-items: center; gap: 20px; font-size: 0.9rem; }
.bar nav a { color: var(--pearl); }
.demo-banner { background: var(--soft-gold); color: var(--midnight); font-size: 0.85rem; padding: 8px 16px; text-align: center; }

/* Buttons and links */
.btn {
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  background: var(--gold);
  color: var(--midnight);
  border: 1px solid var(--gold);
  border-radius: 0;
  padding: 11px 22px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  line-height: 1.4;
}
.btn:hover { background: var(--soft-gold); border-color: var(--soft-gold); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn-quiet { background: transparent; border-color: var(--midnight); }
.btn-quiet:hover { background: rgba(31, 53, 80, 0.07); border-color: var(--midnight); }
.link, .link-light {
  font: inherit; background: none; border: 0; padding: 0; cursor: pointer;
  text-decoration: underline; text-decoration-color: var(--deep-gold); text-underline-offset: 3px;
}
.link { color: var(--midnight); font-size: 0.85rem; margin-left: 14px; }
.link-light { color: inherit; }
:focus-visible { outline: 2px solid var(--sky); outline-offset: 2px; }

/* Forms */
.stack { display: flex; flex-direction: column; gap: 18px; margin-top: 20px; }
.field { display: flex; flex-direction: column; gap: 6px; border: 0; padding: 0; margin: 0 0 18px; }
.field > span, .field > legend { font-weight: 500; font-size: 0.95rem; padding: 0; }
.field small { font-weight: 400; color: var(--muted); }
.optional { font-weight: 400; font-style: italic; color: var(--muted); font-family: var(--serif); }
input, textarea {
  font: inherit; color: var(--midnight); background: var(--paper);
  border: 1px solid var(--line); border-radius: 0; padding: 10px 12px; width: 100%;
}
input:focus, textarea:focus { outline: 2px solid var(--sky); outline-offset: 0; border-color: var(--sky); }
textarea { resize: vertical; }
.form-row { display: flex; flex-wrap: wrap; gap: 12px; }

.step { border: 0; padding: 0; margin: 0; min-width: 0; }
.step legend { font-family: var(--serif); font-size: 1.5rem; margin-bottom: 18px; padding: 0; }
.progress { font-size: 0.8rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--deep-gold); font-weight: 600; margin: 0; }

.scale { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; }
.scale label { display: block; }
.scale input { position: absolute; opacity: 0; width: 0; height: 0; }
.scale span { display: block; text-align: center; padding: 10px 0; border: 1px solid var(--line); background: var(--paper); cursor: pointer; }
.scale input:checked + span { background: var(--midnight); color: var(--pearl); border-color: var(--midnight); }
.scale input:focus-visible + span { outline: 2px solid var(--sky); outline-offset: 2px; }
.scale-ends { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--muted); }

.waiver { background: var(--paper); border: 1px solid var(--line); padding: 16px; margin-bottom: 18px; max-height: 280px; overflow: auto; font-size: 0.9rem; }
.check { display: flex; gap: 12px; align-items: flex-start; }
.check input { width: 22px; height: 22px; flex: none; margin-top: 3px; accent-color: var(--midnight); }

.notice { background: var(--paper); border-left: 4px solid var(--gold); padding: 12px 16px; }
.notice-error { border-left-color: var(--midnight); background: #e9eef4; }

.code-input { font-size: 1.6rem; letter-spacing: 0.35em; text-align: center; max-width: 320px; }
.code-form .link { margin-left: 0; }

.practice { margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--line); }
.practice h2 { margin-top: 0; font-size: 1.1rem; }

/* Tabs */
.tabs { display: flex; gap: 28px; border-bottom: 1px solid var(--line); margin: 20px 0 24px; }
.tabs button {
  font: inherit; font-weight: 500; background: none; border: 0; border-bottom: 3px solid transparent;
  padding: 8px 0; margin-bottom: -1px; color: var(--muted); cursor: pointer;
}
.tabs button[aria-selected='true'] { color: var(--midnight); border-bottom-color: var(--gold); }

/* Action board */
.add-form { background: var(--paper); border: 1px solid var(--line); padding: 14px; margin-bottom: 24px; }
.add-row { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; }
.add-row input[type='date'] { width: auto; }
.more { margin-top: 10px; font-size: 0.9rem; }
.more summary { cursor: pointer; color: var(--muted); }
.more textarea { margin-top: 8px; }

.group { margin-bottom: 28px; }
.group h3, .group > summary { font-family: var(--serif); font-size: 1.15rem; margin-bottom: 8px; }
.group-overdue h3 { color: var(--deep-gold); }
.group > summary { cursor: pointer; color: var(--muted); }
.count { font-family: var(--sans); font-size: 0.75rem; color: var(--muted); border: 1px solid var(--line); padding: 1px 8px; margin-left: 6px; vertical-align: middle; }

.items { list-style: none; margin: 0; padding: 0; }
.item { display: flex; gap: 14px; align-items: flex-start; padding: 14px 4px; border-top: 1px solid var(--line); }
.items .item:last-child { border-bottom: 1px solid var(--line); }
.item-body { flex: 1; min-width: 0; }
.item-title { font-weight: 500; overflow-wrap: anywhere; }
.item-notes { margin: 4px 0 0; color: var(--muted); font-size: 0.9rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.item-meta { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 0.8rem; }
.is-done .item-title { text-decoration: line-through; text-decoration-color: var(--deep-gold); color: var(--muted); }
.chip { border: 1px solid var(--line); padding: 1px 10px; background: var(--paper); }
.chip-overdue { background: var(--soft-gold); border-color: var(--soft-gold); font-weight: 500; }
.chip-done { background: transparent; color: var(--muted); }
.from { color: var(--muted); font-family: var(--serif); font-style: italic; }
.item-editing { display: block; background: var(--paper); padding: 16px; }
.empty { color: var(--muted); font-family: var(--serif); font-style: italic; padding: 12px 0; }

.tick {
  appearance: none; -webkit-appearance: none; flex: none;
  width: 24px; height: 24px; margin: 2px 0 0; padding: 0;
  border: 2px solid var(--midnight); background: var(--paper); border-radius: 0; cursor: pointer; position: relative;
}
.tick::before { content: ''; position: absolute; inset: -10px; }
.tick:checked { background: var(--gold); border-color: var(--gold); }
.tick:checked::after {
  content: ''; position: absolute; left: 6px; top: 1px; width: 6px; height: 12px;
  border: solid var(--midnight); border-width: 0 3px 3px 0; transform: rotate(45deg);
}

/* Coach */
.panel { background: var(--paper); border: 1px solid var(--line); padding: 20px; margin: 20px 0 8px; }
.panel h2 { margin-top: 0; font-size: 1.2rem; }
.panel .add-row { grid-template-columns: 1fr auto; }
.linkbox { display: flex; gap: 10px; margin-top: 12px; }
.linkbox input { flex: 1; }
.plain-list { list-style: none; margin: 0 0 8px; padding: 0; }
.plain-list li { padding: 10px 0; border-top: 1px solid var(--line); }
.invite-row { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.client-list { list-style: none; margin: 0; padding: 0; }
.client-list li { border-top: 1px solid var(--line); }
.client-list li:last-child { border-bottom: 1px solid var(--line); }
.client-list a { display: grid; grid-template-columns: 1fr auto; gap: 2px 16px; padding: 16px 4px; text-decoration: none; }
.client-list a:hover { background: rgba(201, 164, 100, 0.12); }
.client-name { font-family: var(--serif); font-size: 1.2rem; }
.client-email { color: var(--muted); font-size: 0.85rem; grid-row: 2; }
.client-status { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-size: 0.85rem; color: var(--muted); text-align: right; }
.flag { color: var(--deep-gold); }
.back { font-size: 0.85rem; }
.section-title { margin-top: 28px; }

/* Row actions: links on a computer, a ... menu on a phone */
.row-actions { flex: none; }
.inline-actions { white-space: nowrap; }
.menu-wrap { display: none; position: relative; }
.menu-btn { font: inherit; font-size: 2rem; font-weight: 600; line-height: 0.6; padding-bottom: 8px; background: none; border: 1px solid transparent; color: var(--midnight); width: 44px; height: 44px; cursor: pointer; border-radius: 0; }
.menu-btn[aria-expanded='true'] { background: var(--paper); border-color: var(--line); }
.menu { position: absolute; right: 0; top: 100%; z-index: 5; background: var(--paper); border: 1px solid var(--line); box-shadow: 0 6px 18px rgba(31, 53, 80, 0.18); min-width: 150px; }
.menu button { display: block; width: 100%; text-align: left; font: inherit; background: none; border: 0; padding: 14px 18px; min-height: 48px; cursor: pointer; color: var(--midnight); }
.menu button + button { border-top: 1px solid var(--line); }
.menu button:hover { background: rgba(201, 164, 100, 0.15); }

/* Client summary: what is next, and how far along */
.summary { background: var(--midnight); color: var(--pearl); padding: 18px 20px; margin-bottom: 20px; display: flex; flex-direction: column; gap: 14px; }
.nextup { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.nextup .label { font-size: 0.7rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--soft-gold); font-weight: 600; flex-basis: 100%; }
.nextup strong { font-family: var(--serif); font-weight: 500; font-size: 1.2rem; line-height: 1.3; }
.nextup .chip { color: var(--midnight); }
.done-count { display: flex; align-items: center; gap: 14px; font-size: 0.85rem; color: var(--soft-gold); }
.bar-track { flex: 1; height: 6px; background: rgba(247, 243, 236, 0.2); }
.bar-track i { display: block; height: 100%; background: var(--gold); }
.add-toggle { margin-bottom: 24px; }

/* Admin view: a different header colour and layout so it never looks like a client's account */
.admin .bar { background: var(--forest); }
.admin-strip { background: var(--soft-gold); color: var(--midnight); font-size: 0.9rem; padding: 10px max(16px, calc((100% - 860px) / 2 + 16px)); border-bottom: 1px solid var(--gold); }
.admin-strip strong { text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.75rem; margin-right: 10px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); background: var(--paper); margin-bottom: 24px; }
.stats > div { padding: 14px 16px; border-left: 1px solid var(--line); display: flex; flex-direction: column; }
.stats > div:first-child { border-left: 0; }
.stats strong { font-family: var(--serif); font-size: 1.5rem; font-weight: 500; line-height: 1.2; }
.stats span { font-size: 0.8rem; color: var(--muted); }
.stat-flag strong { color: var(--deep-gold); }

.admin-add { background: var(--paper); border: 1px solid var(--line); border-top: 3px solid var(--forest); padding: 18px; margin-bottom: 28px; }
.admin-add h3 { margin-bottom: 14px; }
.admin-add-grid { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; }
.admin-add-grid input[type='date'] { width: auto; }

.filters { display: flex; gap: 8px; margin-bottom: 8px; }
.filters button { font: inherit; font-size: 0.9rem; background: transparent; border: 1px solid var(--line); padding: 6px 14px; cursor: pointer; color: var(--midnight); }
.filters button[aria-pressed='true'] { background: var(--forest); color: var(--pearl); border-color: var(--forest); }
.filters button[aria-pressed='true'] .count { color: var(--pearl); border-color: rgba(247, 243, 236, 0.4); }

.alist { list-style: none; margin: 0; padding: 0; }
.arow { display: grid; grid-template-columns: 84px 1fr auto; gap: 16px; align-items: start; padding: 16px 4px; border-top: 1px solid var(--line); }
.alist .arow:last-child { border-bottom: 1px solid var(--line); }
.arow-editing { display: block; background: var(--paper); padding: 16px; }
.amain { min-width: 0; }
.ameta { margin-top: 6px; font-size: 0.8rem; color: var(--muted); }
.aactions { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.btn-sm { font: inherit; font-size: 0.85rem; font-weight: 500; background: transparent; border: 1px solid var(--midnight); color: var(--midnight); padding: 4px 12px; cursor: pointer; border-radius: 0; }
.btn-sm:hover { background: rgba(31, 53, 80, 0.07); }
.pill { display: inline-block; font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; padding: 3px 10px; border: 1px solid var(--line); background: var(--paper); }
.pill-overdue { background: var(--soft-gold); border-color: var(--soft-gold); }
.pill-done { background: var(--sage); border-color: var(--sage); }
.arow.is-done .item-title { text-decoration: line-through; text-decoration-color: var(--deep-gold); color: var(--muted); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--forest); color: var(--pearl); padding: 12px 20px; display: flex; gap: 20px; align-items: center; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25); max-width: calc(100% - 32px); z-index: 10; }
.toast .link-light { font-weight: 600; color: var(--soft-gold); }

/* Intake answers */
.qa { margin: 0; }
.qa > div { padding: 12px 0; border-top: 1px solid var(--line); }
.qa dt { font-weight: 500; font-size: 0.9rem; color: var(--muted); }
.qa dd { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }

@media (max-width: 600px) {
  body { font-size: 16px; }
  h1 { font-size: 1.7rem; }
  .add-row, .panel .add-row { grid-template-columns: 1fr; }
  .add-row input[type='date'] { width: 100%; }
  .client-list a { grid-template-columns: 1fr; }
  .client-status { grid-column: 1; grid-row: auto; text-align: left; margin-top: 6px; }
  .linkbox { flex-direction: column; }
  .scale { grid-template-columns: repeat(5, 1fr); }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stats > div:nth-child(3) { border-left: 0; }
  .stats > div:nth-child(n + 3) { border-top: 1px solid var(--line); }
  .admin-add-grid { grid-template-columns: 1fr; }
  .admin-add-grid input[type='date'] { width: 100%; }
  .arow { grid-template-columns: 1fr; gap: 8px; }
  .aactions { justify-content: space-between; }
  .bar nav { gap: 6px; }
  .bar nav a, .link-light { padding: 12px 8px; }
  .inline-actions { display: none; }
  .menu-wrap { display: block; }
  .btn-sm { min-height: 44px; padding: 8px 18px; }
  .filters button { min-height: 44px; }
  .tick { width: 30px; height: 30px; }
  .tick:checked::after { left: 8px; top: 2px; width: 7px; height: 14px; }
  .item { padding: 16px 4px; }
  .demo-banner { font-size: 0.75rem; padding: 4px 12px; }
  .add-toggle { width: 100%; }
}

.hint { margin: 8px 0 0; font-size: 0.85rem; color: var(--muted); }

/* Importance scale */
.prio-picker { border: 0; padding: 0; margin: 0 0 18px; }
.prio-picker legend { font-weight: 500; font-size: 0.95rem; padding: 0; margin-bottom: 6px; }
.prio-row { display: flex; flex-wrap: wrap; gap: 8px; }
.prio { position: relative; }
.prio input { position: absolute; opacity: 0; width: 0; height: 0; }
.prio span { display: block; padding: 10px 16px; min-height: 44px; border: 1px solid var(--midnight); background: var(--paper); cursor: pointer; font-size: 0.9rem; font-weight: 500; }
.prio input:focus-visible + span { outline: 2px solid var(--sky); outline-offset: 2px; }
.prio-focus input:checked + span { background: var(--gold); border-color: var(--gold); }
.prio-important input:checked + span { background: var(--soft-gold); border-color: var(--soft-gold); }
.prio-helpful input:checked + span { background: var(--sage); border-color: var(--sage); }
.prio-whenever input:checked + span { background: var(--midnight); color: var(--pearl); border-color: var(--midnight); }

.swatch { display: inline-block; width: 12px; height: 12px; margin-right: 10px; border: 1px solid var(--midnight); vertical-align: baseline; }
.swatch-focus { background: var(--gold); border-color: var(--gold); }
.swatch-important { background: var(--soft-gold); border-color: var(--soft-gold); }
.swatch-helpful { background: var(--sage); border-color: var(--sage); }
.swatch-whenever { background: transparent; }

.ptag { display: inline-block; font-size: 0.72rem; font-weight: 600; padding: 2px 9px; margin-right: 6px; border: 1px solid var(--midnight); color: var(--midnight); }
.ptag-focus { background: var(--gold); border-color: var(--gold); }
.ptag-important { background: var(--soft-gold); border-color: var(--soft-gold); }
.ptag-helpful { background: var(--sage); border-color: var(--sage); }
.ptag-whenever { background: transparent; }

/* Overdue is a flag, separate from the importance colours */
.chip-overdue, .pill-overdue { background: var(--paper); border: 1px solid var(--deep-gold); border-left: 4px solid var(--deep-gold); font-weight: 600; }
.nextup .chip-overdue { color: var(--midnight); }
.filters-level { margin-bottom: 8px; }
.filters-level button { font-size: 0.82rem; padding: 4px 12px; }
.add-form .form-row, .admin-add .form-row { margin-top: 14px; }
.add-form input[type='date'], .admin-add input[type='date'], .edit-form input[type='date'] { max-width: 240px; }
