/* Lesson Log — tablet-first. Big targets, plain language, high contrast.
   Colours and heavy italic headings follow the M.K. Driving School branding. */
:root {
  --ink: #141414;
  --ink-2: #4a4a4a;
  --ink-3: #767676;
  --paper: #f4f4f2;
  --card: #ffffff;
  --line: #dfdfdb;
  --amber: #ffd100;   /* brand yellow */
  --amber-ink: #111111;
  --brand-red: #d7141a;
  --brand-black: #111111;
  --display: "Arial Black", "Helvetica Neue", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  --green: #1f7a55;
  --green-bg: #e3f3ea;
  --warn: #9a5b00;
  --warn-bg: #fff3d6;
  --red: #b3261e;
  --red-bg: #fde8e6;
  --blue: #1e5aa8;
  --radius: 14px;
  --tap: 52px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #f2f2f2; --ink-2: #c4c4c4; --ink-3: #969696;
    --paper: #121212; --card: #1d1d1d; --line: #333333; --brand-red: #ff5a5f;
    --green: #5fd09d; --green-bg: #173326; --warn: #f2c35e; --warn-bg: #3a2e12;
    --red: #ff8a80; --red-bg: #3d1a18; --blue: #8ab4f8;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 18px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--blue); }
h1 {
  font-family: var(--display); font-weight: 900; font-style: italic;
  font-size: 1.75rem; line-height: 1.15; margin: .2em 0 .7em; letter-spacing: -.01em;
}
h1::after { content: ""; display: block; width: 56px; height: 5px; margin-top: 8px; background: var(--amber); border-radius: 2px; }
h2 { font-size: 1.15rem; margin: 0 0 .5em; }
p { margin: 0 0 .75em; }

/* ---- top bar ---- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 10px 20px; padding-top: max(10px, env(safe-area-inset-top));
  background: var(--brand-black); color: #fff;
  border-bottom: 5px solid var(--amber);
}
.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; line-height: 1.05; }
.brand-text { display: flex; flex-direction: column; }
.brand-name { font-family: var(--display); font-weight: 900; font-style: italic; font-size: 1.1rem; letter-spacing: .01em; text-transform: uppercase; }
.brand-name b { color: #ff3b40; }
.brand-sub { font-size: .8rem; font-weight: 600; color: var(--amber); letter-spacing: .04em; }
.wordmark { font-family: var(--display); font-weight: 900; font-style: italic; text-transform: uppercase; line-height: .95; margin: 8px 0 4px; }
.wordmark .mk { display: block; color: var(--brand-red); font-size: 3.2rem; }
.wordmark .ds { display: block; font-size: 1.9rem; color: var(--ink); }
.wordmark .ds b { color: var(--brand-red); }
.auth h1 { font-family: inherit; font-style: normal; font-weight: 700; font-size: 1.15rem; color: var(--ink-2); margin-top: 6px; }
.auth h1::after { margin: 10px auto 0; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-left: auto; }
.tabs a {
  color: #d7dde5; text-decoration: none; padding: 10px 14px; border-radius: 10px;
  min-height: 44px; display: flex; align-items: center; font-weight: 600; font-size: .95rem;
}
.tabs a.on { background: var(--amber); color: #111; }
.tabs a:not(.on):active { background: rgba(255,255,255,.12); }

/* ---- layout ---- */
.wrap { max-width: 1040px; margin: 0 auto; padding: 24px 20px 64px; padding-bottom: max(64px, env(safe-area-inset-bottom)); }
.wrap.narrow { max-width: 640px; }
.pagehead { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.pagehead h1 { margin: 0; }
.block { margin: 28px 0; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1 1 200px; min-width: 0; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.stack > * + * { margin-top: 16px; }
.stack-tight { display: flex; flex-direction: column; gap: 8px; }
.cards3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin-top: 16px; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; align-items: start; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.hint { color: var(--ink-2); font-size: .95rem; }
.fine { color: var(--ink-3); font-size: .85rem; margin-top: 16px; }
.mono { font-family: ui-monospace, Menlo, monospace; word-break: break-all; }
.opt { color: var(--ink-3); font-weight: 400; font-size: .85rem; }
.empty { color: var(--ink-2); padding: 18px; border: 2px dashed var(--line); border-radius: var(--radius); text-align: center; }
.count { display: inline-block; min-width: 1.8em; padding: 0 .5em; border-radius: 99px; background: var(--line); font-size: .85rem; text-align: center; vertical-align: middle; }
.warn-text { color: var(--warn); font-weight: 600; }

/* ---- forms ---- */
label { display: block; font-weight: 600; }
label > input, label > select, label > textarea, label > .row { margin-top: 6px; }
input, select, textarea {
  font: inherit; color: var(--ink); width: 100%;
  min-height: var(--tap); padding: 10px 14px;
  background: var(--card); border: 2px solid var(--line); border-radius: 12px;
}
textarea { min-height: 80px; resize: vertical; }
.check-option { display: flex; align-items: center; gap: 12px; min-height: var(--tap); cursor: pointer; }
.check-option > input[type="checkbox"] {
  flex: 0 0 24px; width: 24px; height: 24px; min-height: 24px; margin: 0; padding: 0;
  accent-color: var(--brand-black); cursor: pointer;
}
.user-cards details { margin-top: 16px; }
.pw-wrap { position: relative; display: block; margin-top: 6px; }
label > .pw-wrap > input { margin-top: 0; padding-right: 84px; }
.pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  min-height: 40px; min-width: 68px; padding: 6px 12px; border-radius: 9px;
  border: 2px solid var(--line); background: var(--paper); color: var(--ink);
  font: inherit; font-size: .9rem; font-weight: 700; cursor: pointer;
}
.pw-toggle:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; border-color: var(--ink-3); }
small { display: block; color: var(--ink-3); font-weight: 400; font-size: .85rem; margin-top: 4px; }
.row > input, .row > select { width: auto; }
.w-rego { flex: 0 0 140px; text-transform: uppercase; }

fieldset.names { border: 0; padding: 0; margin: 0; min-width: 0; display: grid; gap: 12px; }
fieldset.names legend { font-weight: 700; padding: 0; margin-bottom: 4px; }
fieldset.names small { margin-top: -4px; }
.seg { border: 0; padding: 0; margin-left: 0; margin-right: 0; min-width: 0; }
.seg legend { font-weight: 600; margin-bottom: 6px; padding: 0; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg legend { grid-column: 1 / -1; }
.seg-opt { position: relative; }
.seg-opt input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.seg-opt span {
  display: flex; align-items: center; justify-content: center; text-align: center;
  min-height: 60px; padding: 8px 12px; border: 2px solid var(--line); border-radius: 12px;
  background: var(--card); font-weight: 700;
}
.seg-opt input:checked + span { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.seg-opt input:focus-visible + span { outline: 3px solid var(--amber); outline-offset: 2px; }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 10px 20px; border-radius: 12px; border: 2px solid transparent;
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn-primary { background: var(--amber); color: var(--amber-ink); border-color: var(--brand-black); }
.btn-primary:active { transform: translateY(1px); filter: brightness(.95); }
.btn-quiet { background: var(--card); color: var(--ink); border-color: var(--line); }
.btn-danger { background: var(--red); color: #fff; }
.btn-block { width: 100%; }
.btn-xl { min-height: 64px; font-size: 1.15rem; padding: 12px 28px; }
.linkish { background: none; border: 0; padding: 8px 0; color: var(--blue); font: inherit; font-size: .95rem; cursor: pointer; text-decoration: underline; min-height: 44px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; min-height: 44px; padding: 6px 16px;
  border-radius: 99px; border: 2px solid var(--line); background: var(--card);
  color: var(--ink); text-decoration: none; font: inherit; font-size: .95rem; font-weight: 600; cursor: pointer;
}
.chip.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* ---- notices ---- */
.flash, .notice { padding: 14px 18px; border-radius: 12px; margin: 0 0 16px; font-size: .98rem; }
.flash-ok { background: var(--green-bg); color: var(--green); font-weight: 600; }
.flash-error { background: var(--red-bg); color: var(--red); font-weight: 600; }
.notice-warn, .notice-late { background: var(--warn-bg); color: var(--warn); }
.notice-void { background: var(--red-bg); color: var(--red); }
.notice a { color: inherit; font-weight: 700; }

/* ---- dashboard ---- */
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.hero h1 { margin: 0; font-size: 2rem; }
.eyebrow { color: var(--ink-2); font-weight: 600; margin: 0; }
.quick { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.quick-btn {
  display: flex; align-items: center; min-height: 64px; padding: 10px 16px;
  background: var(--card); border: 2px solid var(--line); border-radius: 12px;
  color: var(--ink); font-weight: 700; text-decoration: none;
}
.quick-btn::before { content: "+"; display: inline-grid; place-items: center; width: 28px; height: 28px; margin-right: 10px; border-radius: 8px; background: var(--brand-red); color: #fff; font-weight: 900; flex: none; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 28px 0; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; text-decoration: none; color: var(--ink); }
.stat { border-top: 4px solid var(--brand-red); }
.stat .n { display: block; font-family: var(--display); font-style: italic; font-size: 2rem; font-weight: 900; line-height: 1.1; }
.stat .l { color: var(--ink-2); font-size: .9rem; }
.stat-warn .n { color: var(--warn); }

/* ---- lists ---- */
.list { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.item + .item { border-top: 1px solid var(--line); }
.item-link { display: flex; align-items: center; gap: 16px; padding: 14px 18px; min-height: 68px; color: var(--ink); text-decoration: none; }
.item-link:active { background: var(--paper); }
.item-when { flex: 0 0 auto; min-width: 120px; display: flex; flex-direction: column; }
.item-when .d { font-weight: 700; }
.item-when .t { color: var(--ink-2); font-size: .9rem; }
.item-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.item-main .meta { color: var(--ink-2); font-size: .9rem; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.item-flags { flex: 0 0 auto; }
.item.voided .item-main strong, .item.voided .item-when .d { text-decoration: line-through; color: var(--ink-3); }
.list.compact .item-link { min-height: 56px; }
.tag { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: .8rem; font-weight: 700; white-space: nowrap; }
.tag-practical { background: var(--green-bg); color: var(--green); }
.tag-theory { background: #e6eefb; color: var(--blue); }
@media (prefers-color-scheme: dark) { .tag-theory { background: #1a2a44; } }
.tag-late { background: var(--warn-bg); color: var(--warn); }
.tag-void { background: var(--red-bg); color: var(--red); }
.rego { font-family: ui-monospace, Menlo, monospace; font-weight: 700; font-size: .85rem; padding: 1px 8px; border: 2px solid var(--ink-2); border-radius: 6px; letter-spacing: .05em; }

.range { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.range-custom { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.range-custom label { font-size: .85rem; color: var(--ink-2); }
.range-custom input { width: auto; min-height: 44px; }
.filter-row { display: flex; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.filter-row select { max-width: 320px; }

.details { display: grid; gap: 12px; margin: 0 0 16px; }
.details dt { color: var(--ink-3); font-size: .85rem; font-weight: 600; }
.details dd { margin: 0; white-space: pre-line; }

details.danger { margin-top: 20px; }
details.danger summary { cursor: pointer; font-weight: 700; color: var(--red); min-height: 44px; display: flex; align-items: center; }
details.danger[open] summary { margin-bottom: 8px; }

ul.plain { list-style: none; padding: 0; margin: 0 0 14px; }
ul.plain li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
ul.plain li.inactive span { color: var(--ink-3); }

.table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: var(--radius); overflow: hidden; font-size: .95rem; }
.table th, .table td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.table-wrap { max-width: 100%; overflow-x: auto; }
.table-wrap .table { min-width: 640px; }
.wrap.platform-account { padding-top: 16px; padding-bottom: 0; justify-content: space-between; }
.platform-account .hint { margin: 0; }
.platform-details { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 10px 20px; }
.platform-details dt { font-weight: 600; }
.platform-details dd { margin: 0; overflow-wrap: anywhere; }
.nw { white-space: nowrap; }

.auth { text-align: center; padding-top: 6vh; }
.auth form { text-align: left; margin-top: 20px; }
.lede { color: var(--ink-2); }

@media (max-width: 640px) {
  body { font-size: 17px; }
  .topbar { padding: 8px 12px; }
  .brand-name { font-size: 1rem; }
  .wordmark .mk { font-size: 2.6rem; }
  .wordmark .ds { font-size: 1.5rem; }
  .tabs { margin-left: 0; width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .tabs a { padding: 8px 12px; flex: none; }
  .wrap { padding: 16px 16px 48px; }
  .stats { grid-template-columns: 1fr; }
  .item-link { flex-wrap: wrap; gap: 4px 12px; }
  .item-when { min-width: 0; flex-direction: row; gap: 8px; width: 100%; }
  .hero .btn-xl { width: 100%; }
}

/* ---- lesson planner (Form 1536) ---- */
.w-trans { flex: 0 0 auto; width: auto; min-height: 44px; padding: 6px 10px; font-size: .9rem; }
ul.plain li form + form { margin-left: 0; }
.tag-planner { background: var(--green-bg); color: var(--green); }
.planner-link { margin-top: 20px; }
.planner-status { margin-bottom: 16px; border-left: 6px solid var(--warn); }
.planner-status.is-signed { border-left-color: var(--green); }
.planner-sub { margin: 28px 0 0; padding-top: 16px; border-top: 2px solid var(--line); }
fieldset.planner-fields { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.planner-fields > * + * { margin-top: 16px; }
fieldset.planner-fields[disabled] textarea, fieldset.planner-fields[disabled] input,
fieldset.planner-fields[disabled] select { background: var(--paper); color: var(--ink); opacity: 1; -webkit-text-fill-color: var(--ink); }
details.page2 summary { cursor: pointer; font-weight: 700; min-height: 44px; display: flex; align-items: center; }
details.page2[open] summary { margin-bottom: 12px; }
.prewrap { white-space: pre-line; }
.attest { font-weight: 700; font-size: 1.05rem; }
.sig-field { display: flex; flex-direction: column; gap: 6px; }
.sig-head { display: flex; justify-content: space-between; align-items: center; }
.sig-pad {
  display: block; width: 100%; height: 190px; touch-action: none; cursor: crosshair;
  background: #fff; border: 2px dashed var(--ink-3); border-radius: 12px;
}
.sig-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.sig-view { margin: 0; padding: 8px; background: #fff; color: #0d1a59; border: 1px solid var(--line); border-radius: 10px; }
.sig-view svg { display: block; width: 100%; height: 70px; }
.sig-view figcaption { color: #555; font-size: .8rem; text-align: center; }

/* ---- driving tests ---- */
.seg.seg3 { grid-template-columns: repeat(3, 1fr); }
.tag-passed { background: var(--green-bg); color: var(--green); }
.tag-failed { background: var(--red-bg); color: var(--red); }


/* Shared product identity; school portals retain their existing school appearance. */
.theme-product {
  --amber: #2563eb; --amber-ink: #ffffff; --brand-red: #2563eb; --brand-black: #0f172a;
  --display: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}
.theme-product h1, .theme-product .brand-name { font-style: normal; text-transform: none; }
.theme-product .brand-sub { color: #cbd5e1; }
.theme-product .tabs a.on { color: #ffffff; }
.product-wordmark { font: 800 clamp(1.6rem, 5vw, 2.5rem)/1.2 var(--display); letter-spacing: -.05em; margin-bottom: 12px; }
.product-wordmark span { color: var(--amber); }
.product-tagline { color: var(--ink-2); font-size: 1rem; }
.school-wordmark { font-size: clamp(1.8rem, 5vw, 2.8rem); color: var(--brand-red); line-height: 1.1; }

.library-head { margin: 24px 0 4px; font-size: 1rem; }

/* ---- neutral notes ---- */
.notice-info { background: var(--paper); color: var(--ink-2); border: 1px solid var(--line); }
label.check { display: flex; gap: 10px; align-items: center; font-weight: 600; margin-top: 8px; }
label.check input { width: 22px; min-height: 22px; height: 22px; flex: none; margin: 0; }
.tag-quiet { background: var(--line); color: var(--ink-2); }
.pagehead h2 { margin: 0; }

/* Licence scan: a framing guide, followed by explicit review before form fill. */
.scan-panel { margin-bottom: 20px; }
.scan-status { margin: 12px 0; min-height: 1.5em; }
.scan-viewfinder { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: #111; border-radius: 12px; margin: 14px 0; }
.scan-viewfinder video { display: block; width: 100%; height: 100%; object-fit: cover; }
.scan-guide { position: absolute; left: 6%; width: 88%; top: 50%; transform: translateY(-50%); aspect-ratio: 1.586; border: 3px solid #fff; border-radius: 12px; box-shadow: 0 0 0 1000px #0007; pointer-events: none; }
.scan-photo { display: block; max-width: 100%; max-height: 360px; object-fit: contain; border-radius: 10px; }
.scan-result { display: grid; gap: 12px; align-items: start; }
.scan-filled { border-color: var(--green); background: var(--green-bg); }
.scan-uncertain { border-color: var(--warn); background: var(--warn-bg); }
.caps { text-transform: uppercase; }
.scan-panel [hidden] { display: none !important; }
@media (min-width: 600px) { .scan-result { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }

fieldset.address { border: 0; padding: 0; margin: 0; min-width: 0; display: grid; gap: 12px; }
fieldset.address legend { font-weight: 700; padding: 0; margin-bottom: 4px; }
.address-place { display: grid; grid-template-columns: 1fr 5.5em 6em; gap: 10px; }
@media (max-width: 420px) { .address-place { grid-template-columns: 1fr 1fr; } .address-place label:first-child { grid-column: 1 / -1; } }

.item-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 18px 14px; }
.item-actions form { margin: 0; }
.block-confirm { border-left: 4px solid var(--amber); padding-left: 12px; }
select.time-select { font-size: 1.1rem; }
[hidden] { display: none !important; }
