/* T-P Tutoring CRM. Same colours and type as the website. */
@font-face { font-family: "Schibsted Grotesk"; src: url(/static/fonts/SchibstedGrotesk.woff2) format("woff2"); font-weight: 400 900; font-display: swap; }

:root {
  --paper: #FFFFFF;
  --desk: #EEF2EC;
  --ink: #1E2533;
  --pencil: #586271;
  --green: #3F6D44;
  --green-deep: #2F5535;
  --green-wash: #E2ECE0;
  --rule: #A9B3BF;
  --hairline: #D3DBD1;
  --redpen: #A3402F;
  --redpen-wash: #F6E7E3;
  --sans: "Schibsted Grotesk", "Helvetica Neue", Arial, sans-serif;
  --radius: 6px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--desk); color: var(--ink);
  font-family: var(--sans); font-size: 1rem; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
h1 { font-size: 1.75rem; line-height: 1.2; letter-spacing: -0.015em; font-weight: 700; }
h2 { font-size: 1.2rem; line-height: 1.3; letter-spacing: -0.01em; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 700; }
a { color: var(--green); text-decoration-thickness: 0.08em; text-underline-offset: 0.2em; }
a:hover { color: var(--green-deep); }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
::selection { background: #CFE0CD; }
.num, td.num, th.num { text-align: right; white-space: nowrap; }
.muted { color: var(--pencil); }
.small { font-size: 0.875rem; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.stack > * + * { margin-top: 1rem; }
.stack-lg > * + * { margin-top: 2.25rem; }
.row { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }
.spread { display: flex; flex-wrap: wrap; gap: 1rem; align-items: baseline; justify-content: space-between; }

/* ---------- Admin frame: section tabs along the top of the desk; the work sits on a sheet of paper ---------- */
body.admin { background: var(--desk); }
.topbar { background: var(--desk); border-bottom: 1px solid var(--hairline); position: sticky; top: 0; z-index: 5; }
.topbar-inner { max-width: 74rem; margin-inline: auto; padding: 0 clamp(1.25rem, 4vw, 2.5rem); display: flex; align-items: flex-end; gap: 2.25rem; min-height: 3.9rem; }
.brand { display: inline-flex; align-items: center; gap: 0.55rem; color: var(--ink); font-weight: 700; font-size: 1.05rem; text-decoration: none; letter-spacing: -0.01em; }
.brand:hover { color: var(--ink); }
.topbar .brand { align-self: center; flex: none; }
.brand-mark { display: inline-grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; background: var(--green); color: #fff; font-size: 0.8rem; font-weight: 800; letter-spacing: -0.02em; }
.tabs { flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 0.2rem; }
.tabs a {
  position: relative; display: flex; align-items: center; padding: 0.75rem 1.05rem 0.8rem; margin-bottom: -1px;
  color: var(--pencil); font-weight: 600; text-decoration: none; white-space: nowrap;
  border: 1px solid transparent; border-bottom: 0; border-radius: var(--radius) var(--radius) 0 0;
}
.tabs a:hover { color: var(--ink); background: rgba(255, 255, 255, 0.55); }
.tabs a[aria-current="page"] { background: var(--paper); color: var(--ink); border-color: var(--hairline); }
.tabs a[aria-current="page"]::before { content: ""; position: absolute; left: -1px; right: -1px; top: -1px; height: 3px; background: var(--green); border-radius: var(--radius) var(--radius) 0 0; }
.topbar-end { align-self: center; flex: none; display: flex; gap: 1.25rem; align-items: center; font-size: 0.925rem; }
.topbar-end form { margin: 0; }
.topbar-end a, .quiet-link { color: var(--pencil); font-weight: 600; text-decoration: none; }
.topbar-end a:hover, .quiet-link:hover { color: var(--ink); }
.topbar-end a[aria-current="page"] { color: var(--ink); text-decoration: underline; text-decoration-color: var(--green); text-decoration-thickness: 2px; text-underline-offset: 0.35em; }
.count { display: inline-block; min-width: 1.3rem; margin-left: 0.45rem; padding: 0 0.35rem; border-radius: 999px; background: var(--green); color: #fff; font-size: 0.75rem; font-weight: 700; line-height: 1.3rem; text-align: center; }
@media (max-width: 52em) {
  .topbar { position: static; }
  .topbar-inner { flex-wrap: wrap; gap: 0.5rem 1rem; padding-top: 0.85rem; }
  .tabs { order: 3; flex-basis: 100%; margin-inline: calc(-1 * clamp(1.25rem, 4vw, 2.5rem)); padding-inline: clamp(1.25rem, 4vw, 2.5rem); }
  .topbar-end { margin-left: auto; }
}

.sheet { background: var(--paper); min-height: calc(100vh - 3.9rem); }
.sheet-inner { max-width: 74rem; margin-inline: auto; padding: clamp(1.5rem, 3vw, 2.5rem) clamp(1.25rem, 4vw, 2.5rem) 4rem; }
.page-head { display: flex; flex-wrap: wrap; gap: 1rem 2rem; align-items: flex-end; justify-content: space-between; padding-bottom: 1.25rem; margin-bottom: 1.75rem; border-bottom: 1px solid var(--hairline); }
.page-head p { color: var(--pencil); margin-top: 0.35rem; }
.page-head.has-tabs { padding-bottom: 0; }
.crumbs { font-size: 0.875rem; margin-bottom: 0.4rem; }
.crumbs a { color: var(--pencil); }
.section-head { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; align-items: baseline; justify-content: space-between; margin-bottom: 0.75rem; }

/* Tabs inside a section */
.subtabs { flex-basis: 100%; overflow-x: auto; scrollbar-width: none; }
.subtabs::-webkit-scrollbar { display: none; }
.subtabs ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 1.9rem; }
.subtabs a { display: flex; align-items: center; padding: 0.55rem 0 0.75rem; margin-bottom: -1px; color: var(--pencil); font-weight: 600; text-decoration: none; white-space: nowrap; border-bottom: 2px solid transparent; }
.subtabs a:hover { color: var(--ink); border-bottom-color: var(--rule); }
.subtabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--green); }

/* ---------- Flash ---------- */
.flash { margin-bottom: 1.5rem; padding: 0.7rem 1rem; border-radius: var(--radius); background: var(--green-wash); color: var(--green-deep); font-weight: 600; }
.flash.error { background: var(--redpen-wash); color: var(--redpen); }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 0.8rem; font-weight: 600; color: var(--pencil); padding: 0 0.75rem 0.45rem 0; border-bottom: 1px solid var(--rule); }
.table td { padding: 0.65rem 0.75rem 0.65rem 0; border-bottom: 1px solid var(--hairline); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table th:last-child, .table td:last-child { padding-right: 0; }
.table tfoot td { border-top: 1px solid var(--rule); border-bottom: 0; font-weight: 700; }
.table .actions { text-align: right; white-space: nowrap; }
.table-wrap { overflow-x: auto; }
.empty { padding: 1.25rem 0; color: var(--pencil); }
.empty a { font-weight: 600; }

/* ---------- The ledger: who owes what ---------- */
.ledger { width: 100%; border-collapse: collapse; }
.ledger th { text-align: left; font-size: 0.8rem; font-weight: 600; color: var(--pencil); padding: 0 1rem 0.5rem 0; border-bottom: 1px solid var(--rule); }
.ledger td { padding: 0.9rem 1rem 0.9rem 0; border-bottom: 1px solid var(--hairline); vertical-align: middle; }
.ledger td.who { width: 100%; }
.ledger .who a { font-weight: 700; color: var(--ink); text-decoration: none; font-size: 1.05rem; }
.ledger .who a:hover { text-decoration: underline; }
.ledger .owed { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.01em; }
.ledger .owed.zero { color: var(--pencil); font-weight: 400; font-size: 1rem; }
.ledger .actions { white-space: nowrap; text-align: right; padding-right: 0; }
.margin-note { color: var(--ink); font-size: 0.925rem; font-weight: 600; line-height: 1.3; white-space: nowrap; }
.margin-note.late { color: var(--redpen); }
.margin-note .sub { display: block; font-size: 0.85rem; font-weight: 400; color: var(--pencil); }
@media (max-width: 48em) {
  .ledger thead { display: none; }
  .ledger tr { display: grid; grid-template-columns: 1fr auto; gap: 0.3rem 1rem; padding: 0.9rem 0; border-bottom: 1px solid var(--hairline); }
  .ledger td { padding: 0; border: 0; }
  .ledger .actions { grid-column: 1 / -1; text-align: left; }
}

/* ---------- Summary figures ---------- */
.figures { display: flex; flex-wrap: wrap; gap: 0.5rem 2.5rem; }
.figure dt { font-size: 0.85rem; color: var(--pencil); }
.figure dd { font-size: 1.5rem; font-weight: 700;  letter-spacing: -0.01em; }
.figure.owing dd { color: var(--redpen); }
.figure .note { font-size: 0.85rem; color: var(--pencil); margin-top: 0.1rem; }
.figure dd a { color: inherit; text-decoration: none; }
.figure dd a:hover { text-decoration: underline; }
.figures.boxed { gap: 0; border: 1px solid var(--hairline); border-radius: var(--radius); }
.figures.boxed .figure { flex: 1 1 12rem; padding: 1rem 1.25rem; border-left: 1px solid var(--hairline); }
.figures.boxed .figure:first-child { border-left: 0; }
@media (max-width: 48em) { .figures.boxed .figure { border-left: 0; border-top: 1px solid var(--hairline); } .figures.boxed .figure:first-child { border-top: 0; } }

/* ---------- Two-column record layout ---------- */
.cols { display: grid; gap: 2.5rem; }
@media (min-width: 62em) { .cols { grid-template-columns: minmax(0, 1.7fr) minmax(16rem, 1fr); gap: 3.5rem; } .cols > aside { border-left: 1px solid var(--hairline); padding-left: 2rem; } }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.35rem 1.25rem; }
.facts dt { color: var(--pencil); }
.facts dd { min-width: 0; overflow-wrap: anywhere; }

/* ---------- To-do list ---------- */
.todo { list-style: none; padding: 0; margin: 0; }
.todo li { display: grid; gap: 0.1rem; padding: 0.6rem 0 0.6rem 0.9rem; border-left: 3px solid var(--green); }
.todo li + li { margin-top: 0.5rem; }
.todo a { font-weight: 600; }
tr.muted td, tr.muted td a { color: var(--pencil); }

/* ---------- Status words ---------- */
.tag { display: inline-block; padding: 0.05rem 0.5rem; border-radius: 999px; font-size: 0.8rem; font-weight: 600; background: var(--desk); color: var(--pencil); white-space: nowrap; }
.tag.green { background: var(--green-wash); color: var(--green-deep); }
.tag.red { background: var(--redpen-wash); color: var(--redpen); }
.tag.ink { background: var(--ink); color: #fff; }
.strike { text-decoration: line-through; color: var(--pencil); }

/* ---------- Forms ---------- */
.form { display: grid; gap: 1.1rem; max-width: 40rem; }
.form.wide { max-width: none; }
.form-grid { display: grid; gap: 1.1rem 1.25rem; }
@media (min-width: 40em) { .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); } .form-grid .span-all { grid-column: 1 / -1; } }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { padding: 0; font-weight: 700; font-size: 1.05rem; margin-bottom: 0.75rem; }
.fieldset-box { border-top: 1px solid var(--hairline); padding-top: 1.25rem; }
.field { display: grid; gap: 0.3rem; }
.field > label, .label { font-weight: 600; font-size: 0.925rem; }
.hint { font-size: 0.85rem; color: var(--pencil); }
input[type="text"], input[type="email"], input[type="tel"], input[type="date"], input[type="time"], input[type="number"], input[type="search"], input:not([type]), select, textarea {
  width: 100%; font: inherit; color: inherit; background: var(--paper);
  border: 1px solid var(--rule); border-radius: var(--radius); padding: 0.5rem 0.65rem;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--green); outline-offset: 0; border-color: var(--green); }
textarea { min-height: 6rem; resize: vertical; line-height: 1.45; }
.money-input { position: relative; }
.money-input::before { content: "£"; position: absolute; left: 0.65rem; top: 50%; transform: translateY(-50%); color: var(--pencil); pointer-events: none; }
.money-input input { padding-left: 1.5rem; }
.choices { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; }
.choice { display: inline-flex; gap: 0.45rem; align-items: center; }
.choice input { width: 1.05rem; height: 1.05rem; accent-color: var(--green); margin: 0; }
.form-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; padding-top: 0.25rem; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  font: inherit; font-weight: 600; line-height: 1.2; text-decoration: none; cursor: pointer;
  padding: 0.55rem 1rem; border-radius: var(--radius);
  border: 1px solid var(--green); background: var(--green); color: #fff;
}
.btn:hover { background: var(--green-deep); border-color: var(--green-deep); color: #fff; }
.btn.secondary { background: var(--paper); color: var(--green-deep); border-color: var(--rule); }
.btn.secondary:hover { border-color: var(--green); background: var(--green-wash); color: var(--green-deep); }
.btn.quiet { background: none; border-color: transparent; color: var(--green); padding-inline: 0.4rem; }
.btn.quiet:hover { background: var(--green-wash); color: var(--green-deep); }
.btn.danger { background: var(--paper); color: var(--redpen); border-color: var(--rule); }
.btn.danger:hover { background: var(--redpen-wash); border-color: var(--redpen); }
.btn.small { padding: 0.3rem 0.65rem; font-size: 0.875rem; }
.btn.big { padding: 0.85rem 1.4rem; font-size: 1.1rem; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.inline-form { display: inline; }
.linkish { font: inherit; background: none; border: 0; padding: 0; color: var(--green); text-decoration: underline; text-decoration-thickness: 0.08em; text-underline-offset: 0.2em; cursor: pointer; }

/* ---------- Disclosure ---------- */
details.drawer { border-top: 1px solid var(--hairline); }
details.drawer:last-of-type { border-bottom: 1px solid var(--hairline); }
details.drawer > summary { list-style: none; cursor: pointer; padding: 0.85rem 0; display: flex; gap: 0.75rem; align-items: center; justify-content: space-between; }
details.drawer > summary > * { white-space: nowrap; }
details.drawer > summary .grow { white-space: normal; }
details.drawer > summary::-webkit-details-marker { display: none; }
details.drawer > summary::before { content: ""; flex: none; width: 0.5rem; height: 0.5rem; border-right: 2px solid var(--pencil); border-bottom: 2px solid var(--pencil); transform: rotate(-45deg); margin-right: 0.25rem; transition: transform 0.15s; align-self: center; }
details.drawer[open] > summary::before { transform: rotate(45deg); }
details.drawer > summary .grow { flex: 1; }
details.drawer > .drawer-body { padding: 0 0 1.25rem 1.25rem; }
@media (prefers-reduced-motion: reduce) { details.drawer > summary::before { transition: none; } }

/* ---------- Week view ---------- */
.week { display: grid; gap: 0; border-top: 1px solid var(--rule); }
@media (min-width: 70em) { .week { grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 0; } }
.day { padding: 0.75rem 0; border-bottom: 1px solid var(--hairline); }
@media (min-width: 70em) { .day { padding: 0 0.6rem 1rem; border-bottom: 0; border-left: 1px solid var(--hairline); min-height: 14rem; } .day:first-child { border-left: 0; padding-left: 0; } }
.day-head { display: flex; gap: 0.5rem; align-items: baseline; margin-bottom: 0.5rem; }
@media (min-width: 70em) { .day-head { display: block; border-bottom: 1px solid var(--rule); padding-bottom: 0.4rem; margin-bottom: 0.6rem; } }
.day-name { font-weight: 700; }
.day-date { color: var(--pencil); font-size: 0.875rem; }
.day.today .day-name { color: var(--green); }
.day.today .day-head { border-bottom-color: var(--green); }
.slot { display: block; padding: 0.45rem 0.55rem; margin-bottom: 0.45rem; border-radius: var(--radius); background: var(--green-wash); border-left: 3px solid var(--green); color: var(--ink); text-decoration: none; font-size: 0.9rem; line-height: 1.3; }
.slot:hover { background: #D3E3D0; color: var(--ink); }
.slot .t {  font-weight: 700; }
.slot.off { background: var(--desk); border-left-color: var(--rule); color: var(--pencil); }
.slot.off .who { text-decoration: line-through; }
.slot.charged { background: var(--redpen-wash); border-left-color: var(--redpen); }
.slot .note { display: block; font-size: 0.8rem; color: var(--pencil); }

/* ---------- Message drafts ---------- */
.draft-box textarea { min-height: 10rem; font-size: 1rem; }
.send-row { display: flex; flex-wrap: wrap; gap: 0.6rem; }

/* ---------- Sign-in & family pages: phone first ---------- */
.solo { min-height: 100vh; display: grid; align-content: start; justify-items: center; padding: clamp(1.25rem, 6vw, 4rem) 1.25rem 3rem; }
.solo-card { width: min(100%, 28rem); background: var(--paper); border: 1px solid var(--hairline); border-radius: 10px; padding: clamp(1.25rem, 5vw, 2rem); }
.solo-card h1 { font-size: 1.5rem; }
.solo .brand { margin-bottom: 1.5rem; }
.code-input { font-size: 1.6rem !important; letter-spacing: 0.35em; text-align: center;  }
.dev-note { margin-top: 1rem; padding: 0.7rem 0.9rem; border-radius: var(--radius); border: 1px dashed var(--rule); font-size: 0.9rem; color: var(--pencil); }
.dev-note strong { color: var(--ink);  letter-spacing: 0.1em; }

.family { max-width: 40rem; margin-inline: auto; padding: 1.25rem 1.25rem 4rem; }
.family-top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding-bottom: 1.25rem; }
.family-top form { margin: 0; }
.child { background: var(--paper); border: 1px solid var(--hairline); border-radius: 10px; padding: 1.25rem; }
.child + .child { margin-top: 1.25rem; }
.balance { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; padding: 1.1rem 0 1.25rem; border-bottom: 1px solid var(--hairline); margin-bottom: 0.5rem; }
.balance .amount { font-size: 2.4rem; font-weight: 700; line-height: 1; letter-spacing: -0.02em;  }
.balance .label { font-weight: 400; color: var(--pencil); display: block; margin-bottom: 0.35rem; }
.paid-mark { display: inline-block; padding: 0.3rem 0.75rem; border-radius: 999px; background: var(--green-wash); color: var(--green-deep); font-weight: 600; }
.bank { background: var(--desk); border-radius: var(--radius); padding: 0.9rem 1rem; }
.bank dl { display: grid; grid-template-columns: max-content 1fr; gap: 0.2rem 1rem; }
.bank dt { color: var(--pencil); }
.bank dd { font-weight: 600;  }

/* Pay page */
.pay-amount { font-size: 3rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1;  margin: 0.5rem 0 0.25rem; }
.pay-lines { width: 100%; border-collapse: collapse; font-size: 0.925rem; }
.pay-lines td { padding: 0.4rem 0; border-bottom: 1px solid var(--hairline); }
.pay-lines td.num { padding-left: 1rem; }
.pay-lines tr:last-child td { border-bottom: 0; }
.or { display: flex; align-items: center; gap: 0.75rem; color: var(--pencil); font-size: 0.875rem; margin: 1.25rem 0; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--hairline); }
.btn.block { width: 100%; }

@media print {
  .topbar, .subtabs, .page-head .row, .form-actions, .btn { display: none !important; }
  .sheet-inner { padding: 0; }
  body { background: #fff; }
}

/* ---------- Privacy notice and other long text ---------- */
.prose { max-width: 36rem; }
.prose h2 { font-size: 1.05rem; margin: 1.6rem 0 0.4rem; }
.prose p, .prose ul { margin: 0 0 0.75rem; }
.prose ul { padding-left: 1.2rem; }
.prose li + li { margin-top: 0.3rem; }
.solo-card:has(.prose) { width: min(100%, 42rem); }
