:root {
  color-scheme: dark;
  --bg: #07111b;
  --panel: #111e29;
  --border: #2c3b47;
  --gold: #ffd383;
  --amber: #d6a54c;
  --blue: #68d8ef;
  --ivory: #f6ead3;
  --text: #f5f7fa;
  --muted: #adbcc8;
  --serif: Georgia, 'Times New Roman', serif;
  font-family: 'Segoe UI', system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: radial-gradient(ellipse at 84% 6%,#0c2536,transparent 45%),var(--bg); color: var(--text); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .55; cursor: wait; }
button, input, textarea, select { border: 1px solid #3c4b56; border-radius: 9px; color: var(--text); background: #15222e; }
button { min-height: 42px; padding: 7px 12px; font-size: .83rem; font-weight: 600; }
button:hover { background: #203343; border-color: #788995; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
h1, h2 { font-family: var(--serif); color: var(--ivory); margin: 0; font-weight: 500; }
small { color: var(--muted); }
.skip { position: absolute; top: 4px; left: 4px; z-index: 5; color: var(--text); background: var(--panel); padding: 8px; transform: translateY(-150%); }
.skip:focus { transform: none; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 232px; display: flex; flex-direction: column;
  padding: 23px 16px 16px; overflow: auto; background: radial-gradient(ellipse at 0% 100%,#0d384e,transparent 40%),#0b141d;
  border-right: 1px solid #2b3946;
}
.identity { display: grid; place-items: center; text-align: center; padding-bottom: 26px; gap: 12px; }
.emblem { width: 86px; height: 86px; object-fit: cover; border-radius: 50%; box-shadow: 0 0 28px #399acd33; }
.wordmark { color: var(--gold); font: 1.45rem var(--serif); white-space: nowrap; }
.wordmark span { display: block; font: 600 .66rem 'Segoe UI',sans-serif; letter-spacing: .31em; margin-top: 6px; color: var(--ivory); }
.sidebar nav { display: grid; gap: 3px; }
.nav-link { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; color: #ccd6de; background: transparent; border-color: transparent; }
.icon { color: var(--gold); display: inline-grid; place-items: center; width: 26px; flex: 0 0 26px; font: 1.4rem 'Segoe UI Symbol',sans-serif; }
.nav-link[aria-current] { color: #ffebc2; background: linear-gradient(105deg,#67481d,#302919); border-color: #916831; box-shadow: inset 0 0 12px #e4a54a12; }
.sidebar-bottom { margin-top: auto; padding: 20px 4px 0; display: grid; gap: 10px; }
.sidebar-bottom span, .eyebrow, footer { color: var(--amber); text-transform: uppercase; font-size: .66rem; letter-spacing: .17em; font-weight: 700; }
.content { margin-left: 232px; padding: 24px clamp(18px,3vw,46px); max-width: 1680px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.toolbar p { margin: 3px 0 0; color: var(--muted); font-size: .85rem; }
.toolbar-actions, .row-actions { display: flex; align-items: center; gap: 8px; }
.avatar { display: grid; place-items: center; background: #332c1e; color: var(--gold); border: 1px solid #99713d; border-radius: 50%; width: 40px; height: 40px; }
.people { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 15px; }
.people button { border-radius: 50px; padding-inline: 13px; min-height: 36px; color: var(--muted); }
.people [aria-pressed=true] { color: var(--gold); border-color: #987645; background: #3b2e1e; }
.hero {
  min-height: 245px; display: flex; align-items: end; justify-content: space-between; gap: 8px;
  padding: clamp(20px,4vw,46px); border: 1px solid #8f7143; border-radius: 18px;
  background: linear-gradient(90deg,#07111bc9,#07111b22), url('/coast.jpg') center / cover;
  box-shadow: 0 12px 44px #0004, inset 0 0 35px #e8b3610d;
}
.hero .eyebrow { margin: 0 0 13px; color: var(--gold); }
.hero h1 { font-size: clamp(2rem,4.9vw,4.5rem); line-height: 1.04; letter-spacing: -.036em; text-shadow: 0 2px 18px #000; }
.hero p:last-child { font: italic clamp(.94rem,2vw,1.19rem) var(--serif); color: #f5ddb6; margin: 13px 0 0; }
.hero time { flex-shrink: 0; padding: 7px 12px; border: 1px solid #a67b48; border-radius: 99px; background: #121719dc; font-size: .75rem; color: var(--ivory); }
.summary { display: grid; grid-template-columns: repeat(4,1fr); margin: 16px 0; background: #101b25; border: 1px solid #354350; border-radius: 14px; }
.stat { display: flex; align-items: center; gap: 10px; padding: 16px; }
.stat + .stat { border-left: 1px solid var(--border); }
.stat strong { display: block; color: var(--ivory); font: 1.48rem var(--serif); margin-top: 4px; }
.stat:nth-child(2) .icon, .stat:nth-child(4) .icon { color: var(--blue); }
.grid { display: grid; gap: 15px; grid-template-columns: repeat(2,minmax(0,1fr)); align-items: start; }
.panel { border: 1px solid var(--border); border-radius: 14px; background: linear-gradient(150deg,#172531,#101a24 70%); min-width: 0; overflow: hidden; }
.panel-head { padding: 13px 16px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid #3d4449; }
.panel h2 { display: flex; align-items: center; gap: 7px; font-size: clamp(1.05rem,2.2vw,1.45rem); }
.soft { color: var(--gold); background: #242523; border-color: #655437; flex-shrink: 0; }
.entries { padding: 0 16px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 9px; padding: 11px 0; }
.row + .row { border-top: 1px solid #33424e; }
.row strong { font-weight: 600; overflow-wrap: anywhere; }
.row small { display: block; margin-top: 3px; white-space: pre-line; overflow-wrap: anywhere; }
.row-actions { justify-content: end; flex-wrap: wrap; }
.pill { display: inline-block; border: 1px solid #405262; border-radius: 50px; padding: 4px 9px; background: #223342; color: #d2dee8; white-space: nowrap; font-size: .72rem; }
.pill.approved,.pill.unlocked,.pill.verified { background: #132d25; border-color: #316653; color: #a8dfbe; }
.pill.pending,.pill.new { background: #382d19; border-color: #7c5d2f; color: #ffd88b; }
.pill.changes,.pill.declined,.pill.paused { background: #3b2528; border-color: #7b484c; color: #fac2c1; }
.empty { padding: 23px 16px; color: var(--muted); font-size: .88rem; }
.progress-footer { padding: 6px 16px 15px; font-size: .75rem; color: var(--muted); }
progress { appearance: none; display: block; width: 100%; height: 6px; border: 0; border-radius: 10px; margin-top: 7px; background: #263746; }
progress::-webkit-progress-bar { background: #263746; border-radius: 10px; }
progress::-webkit-progress-value { background: var(--amber); border-radius: 10px; }
progress.cyan::-webkit-progress-value { background: var(--blue); }
progress::-moz-progress-bar { background: var(--amber); }
progress.cyan::-moz-progress-bar { background: var(--blue); }
.page-title { font-size: clamp(2rem,5vw,3.6rem); margin: 20px 0; }
.history { margin-top: 15px; }
footer { text-align: center; padding-top: 27px; color: var(--muted); }
footer span { color: var(--gold); }
.access { display: grid; place-items: center; min-height: 100svh; padding: 20px; background: linear-gradient(#07111b44,#07111bab),url('/coast.jpg') center / cover; }
.access-card { width: min(100%,430px); background: #0c1722f5; border: 1px solid #8d7149; border-radius: 18px; padding: 28px; box-shadow: 0 20px 70px #0008; }
.access-card h1 { font-size: 2.2rem; }
.access-card p { color: var(--muted); }
form { display: grid; gap: 11px; }
label { display: grid; gap: 5px; color: var(--ivory); font-size: .88rem; }
input,select,textarea { min-height: 42px; width: 100%; padding: 8px 10px; }
.choice { display: flex; align-items: center; gap: 8px; }
.choice input { width: 18px; min-height: 20px; accent-color: var(--amber); }
.primary { background: linear-gradient(105deg,#ffd894,#d6a54c); border-color: #ffd894; color: #1d160b; min-height: 44px; }
.primary:hover { background: #ffe2ac; color: #000; }
dialog { width: min(490px,calc(100vw - 28px)); max-height: calc(100dvh - 28px); border: 1px solid #8d7149; border-radius: 14px; background: #101c26; color: var(--text); padding: 22px; }
dialog::backdrop { background: #04090dc4; }
dialog h2 { margin-bottom: 14px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; }
[role=alert] { color: #ffbcbc; margin: 0; }
#notice { position: fixed; bottom: 17px; right: 17px; max-width: calc(100% - 34px); visibility: hidden; padding: 12px 15px; border-radius: 10px; background: #18352b; color: #d7f9e9; border: 1px solid #4c9875; z-index: 4; }
#notice.show { visibility: visible; }
#notice.error { background: #4c2323; color: #ffdfdf; border-color: #bd6a6a; }
.loading { padding: 25px; }
@media (max-width: 1000px) {
  .sidebar { width: 185px; padding-inline: 10px; }
  .content { margin-left: 185px; }
  .stat { padding: 12px 8px; gap: 4px; }
  .row { align-items: start; }
}
@media (max-width: 740px) {
  .sidebar { position: static; width: auto; padding: 12px 14px 8px; border-right: 0; border-bottom: 1px solid var(--border); }
  .sidebar .identity { display: flex; text-align: left; padding: 0 0 10px; }
  .sidebar .emblem { width: 43px; height: 43px; }
  .sidebar nav { display: flex; overflow-x: auto; margin-inline: -5px; padding: 4px 5px; }
  .nav-link { width: auto; white-space: nowrap; }
  .sidebar-bottom { position: absolute; top: 4px; right: 14px; padding-top: 8px; }
  .sidebar-bottom span { display: none; }
  .content { margin: 0; padding: 15px 14px 24px; }
  .hero { min-height: 200px; padding: 20px; }
  .hero time { display: none; }
  .summary { grid-template-columns: 1fr 1fr; }
  .stat:nth-child(3) { border-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--border); }
  .grid { grid-template-columns: minmax(0,1fr); }
}

/* Family dashboard */
:root {
  --bg:#080d13; --panel:#111b24; --border:#35404a; --gold:#ffcf7b;
  --amber:#d7a857; --blue:#78dcec; --ivory:#fff0d5; --muted:#b8c4ce;
}
body { background:radial-gradient(ellipse at 86% 4%,#102736 0,transparent 48%),var(--bg); }
.sidebar {
  background:radial-gradient(ellipse at 10% 100%,#144358 0,transparent 46%),linear-gradient(155deg,#121c24,#080e15 52%);
  border-color:#233644;
}
.sidebar .emblem { width:124px; height:124px; box-shadow:0 0 36px #38bfff33,0 0 20px #ffbc4820; }
.sidebar .wordmark { text-transform:uppercase; font-size:1.22rem; letter-spacing:.015em; }
.nav-link { font-weight:500; min-height:39px; }
.icon { width:24px; flex-basis:24px; }
.icon svg { width:100%; height:auto; display:block; }
.icon-school,.overview .icon-task { color:var(--blue); }
.nav-link[aria-current] {
  border-color:#c8964c; background:linear-gradient(110deg,#754b20,#33291d);
  box-shadow:inset 0 1px #ffcc8038,0 0 14px #f6a82b13;
}
.content { padding:18px clamp(14px,1.8vw,30px) 24px; }
.toolbar { margin-bottom:12px; }
.people { gap:8px; margin-bottom:12px; }
.people button { display:inline-flex; align-items:center; gap:7px; padding:5px 10px 5px 6px; min-height:36px; background:#101b23; }
.member-icon {
  display:grid; place-items:center; width:24px; height:24px; border:1px solid #447788;
  border-radius:50%; color:#9ee6f3; font-size:.75rem; background:#11303c;
}
.people [aria-pressed=true] .member-icon { border-color:#cf9a4b; color:#ffdeaa; background:#4a321d; }
.hero {
  min-height:172px; padding:22px clamp(20px,3vw,42px); align-items:center;
  background:linear-gradient(90deg,#080e18f5 0%,#101b26e8 24%,#101b2670 66%,#101b2622),url('/coast.jpg') center 51% / cover;
  border-color:#8d6a43; box-shadow:inset 0 0 26px #d6a25216;
}
.hero > div { border-left:2px solid var(--gold); padding-left:17px; }
.hero .eyebrow { margin-bottom:7px; }
.hero h1 { font-size:clamp(2rem,4.1vw,3.8rem); }
.hero p:last-child { margin-top:9px; }
.hero time { align-self:end; }
.dashboard { display:grid; gap:13px; }
.dashboard-overview { display:grid; grid-template-columns:minmax(180px,.9fr) minmax(0,2.35fr); gap:13px; }
.dashboard-cards { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:13px; align-items:stretch; }
.dashboard-featured { grid-template-columns:minmax(0,1.65fr) minmax(0,1fr); }
.panel {
  background:linear-gradient(145deg,#19252e,#101921 58%,#0c151d);
  border-color:#46515a; box-shadow:inset 0 1px #efd1a710,0 6px 20px #0002;
}
.panel-head { padding:10px 12px; border-color:#4e4538; flex-wrap:wrap; }
.panel h2 { font-size:clamp(1.12rem,1.65vw,1.48rem); }
.panel-head .soft { padding:5px 8px; min-height:32px; border-radius:7px; font-size:.74rem; }
.overview .summary { margin:0; border:0; border-radius:0; background:none; grid-template-columns:repeat(5,minmax(0,1fr)); }
.overview .stat { display:flex; flex-direction:column; text-align:center; gap:5px; min-width:0; padding:10px 5px; }
.overview .stat strong { font-size:clamp(1rem,1.8vw,1.6rem); margin:1px 0 2px; white-space:nowrap; }
.overview .stat:nth-child(4) .icon { color:var(--gold); }
.overview .stat small { display:block; font-size:.72rem; }
.overview .stat .icon { width:27px; }
.dashboard .entries { padding:0 12px; }
.dashboard .row { padding:8px 0; }
.dashboard-cards .row { flex-wrap:wrap; font-size:.85rem; gap:5px; }
.dashboard-cards .row > div:first-child { min-width:0; }
.dashboard-cards .row small { display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:2; overflow:hidden; }
.dashboard-cards .row-actions button { min-height:29px; padding:4px 6px; font-size:.72rem; }
.progress-footer { padding:8px 12px 12px; }
progress::-webkit-progress-value { background:linear-gradient(90deg,#d39436,#ffe0a0); }
progress.cyan::-webkit-progress-value { background:linear-gradient(90deg,#2b91af,#84e6f3); }
.allowance-preview { padding:15px 10px 10px; text-align:center; }
.allowance-preview > strong { display:block; font:clamp(1.4rem,2.7vw,2.2rem) var(--serif); color:var(--ivory); }
.allowance-preview dl { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); margin:14px 0 0; border-top:1px solid var(--border); padding-top:12px; }
.allowance-preview dt { color:var(--muted); font-size:.72rem; }
.allowance-preview dd { color:var(--gold); margin:4px 0 0; font-size:.8rem; font-weight:600; overflow-wrap:anywhere; }
.allowance-preview dl > div + div { border-left:1px solid var(--border); }
.quick-actions { display:grid; grid-template-columns:repeat(auto-fit,minmax(75px,1fr)); gap:7px; padding:12px; }
.quick-actions button { display:grid; place-items:center; gap:6px; min-height:68px; line-height:1.2; padding:5px; }
.memory-gallery { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,150px),1fr)); gap:9px; padding:12px; }
.dashboard .memory-gallery { grid-template-columns:repeat(auto-fit,minmax(min(100%,105px),1fr)); }
.memory-gallery figure { margin:0; min-width:0; background:#0d1720; border:1px solid #5a5145; border-radius:10px; overflow:hidden; }
.memory-gallery img { display:block; width:100%; aspect-ratio:16/10; object-fit:cover; }
.memory-gallery figcaption { padding:8px; overflow-wrap:anywhere; }
.memory-gallery small { display:block; margin-top:3px; font-size:.68rem; }
.memory-gallery p { margin:6px 0 0; color:var(--muted); font-size:.82rem; }
.pill.restricted { background:#392329; border-color:#98535d; color:#ffd4d7; }
.tick-item { display:flex; align-items:center; gap:10px; min-height:28px; cursor:pointer; }
.tickbox { width:19px; height:19px; min-height:0; margin:0; flex:0 0 19px; accent-color:#71c3a3; }
.checklist { list-style:none; padding:0; margin:7px 0 10px; }
.checklist li { padding:4px 0; border-bottom:1px solid #33424e; }
.checklist li:last-child { border:0; }
.checklist li small,.checklist-row > div:first-child > small { margin-left:29px; }
.subject-group { padding:12px 0 4px; }
.privilege-row + .privilege-row { border-top:1px solid #33424e; }
.privilege-row details { padding:0 0 9px; }
.privilege-row summary,.scheduled summary { cursor:pointer; color:var(--gold); }
.scheduled { margin-top:15px; }
.scheduled summary { padding:14px; }
.owner-console { max-width:1050px; margin:0 auto; padding:28px 20px; }
.owner-console > .toolbar-actions { margin-top:12px; justify-content:end; }
@media (max-width:1220px) {
  .dashboard-cards { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width:850px) {
  .dashboard-overview,.dashboard-featured { grid-template-columns:minmax(0,1fr); }
}
@media (max-width:740px) {
  .sidebar { padding-top:10px; }
  .sidebar .emblem { width:46px; height:46px; }
  .sidebar .wordmark { font-size:1rem; }
  .sidebar nav { gap:6px; }
  .nav-link { display:grid; place-items:center; gap:4px; min-width:72px; text-align:center; border-color:#3d4650; background:#121e27; padding:6px; font-size:.74rem; }
  .sidebar-bottom { top:5px; right:10px; }
  .sidebar-bottom button { min-height:36px; }
  .hero { padding:18px; min-height:154px; }
  .hero > div { padding-left:12px; }
  .overview .summary { grid-template-columns:repeat(5,minmax(0,1fr)); }
  .overview .stat:nth-child(n+3) { border-top:0; }
  .overview .stat:nth-child(3) { border-left:1px solid var(--border); }
}
@media (max-width:500px) {
  .dashboard-cards { grid-template-columns:minmax(0,1fr); }
  .overview .summary { grid-template-columns:repeat(3,minmax(0,1fr)); }
  .overview .stat:nth-child(4) { border-left:0; }
  .overview .stat:nth-child(n+4) { border-top:1px solid var(--border); }
  .overview .stat small { font-size:.67rem; }
}

/* Mobile navigation keeps each full label inside its own tile. */
@media (max-width:740px) {
  .sidebar { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:10px; }
  .sidebar .identity { min-width:0; padding:0; gap:9px; }
  .sidebar .emblem { flex:0 0 42px; width:42px; height:42px; }
  .sidebar .wordmark { white-space:normal; font-size:clamp(.78rem,3.4vw,1rem); }
  .sidebar .wordmark span { letter-spacing:.22em; font-size:.57rem; }
  .sidebar-bottom { position:static; grid-column:2; grid-row:1; margin:0; padding:0; align-self:center; }
  .sidebar nav { grid-column:1 / -1; width:100%; min-width:0; margin:0; padding:4px 0 8px; gap:8px; }
  .nav-link { flex:0 0 auto; width:max-content; min-width:104px; white-space:nowrap; padding:8px 12px; }
  .nav-link > span:last-child { display:block; width:100%; overflow-wrap:normal; line-height:1.2; }
  .toolbar { flex-wrap:wrap; }
  .panel-head .row-actions { flex-wrap:wrap; }
}

.planner-panel{margin:18px 0}.planner-body{padding:20px}.planner-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(240px,100%),1fr));gap:16px;margin:14px 0}.planner-grid label,.planner-body>label,.planner-day>label{display:grid;gap:7px;margin:10px 0}.planner-body input:not([type=checkbox]),.planner-body select,.planner-body textarea,.planner-review textarea,.planner-review select{width:100%;min-width:0;box-sizing:border-box}.planner-week{display:flex;flex-wrap:wrap;gap:16px}.planner-week label{display:flex;gap:8px;align-items:center}.planner-day{padding:18px;margin:14px 0;border:1px solid #45515a;border-radius:14px;background:#0d1922}.planner-day h3{font-family:inherit;font-size:1rem;margin:0}.planner-day-head{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:10px}.planner-instructions{white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.6}.planner-actions{display:flex;gap:10px;flex-wrap:wrap;margin-top:14px}.planner-plan{border-bottom:1px solid #45515a;padding:16px 0}.planner-plan summary,.planner-settings summary{cursor:pointer;font-weight:600;line-height:1.7}.planner-feedback{white-space:pre-wrap;margin:12px 0;color:#7ddbcf}.planner-feedback.error{color:#ffb4a9}.planner-body a{color:#8adddf;text-decoration:underline}.planner-intro{max-width:75ch;line-height:1.6}.planner-review{max-width:660px;width:calc(100% - 32px);max-height:85vh;overflow:auto;border:1px solid #ad8c4d;border-radius:18px;background:#101c25;color:#f5ead3;padding:22px}.planner-review::backdrop{background:#000a}.planner-review form{display:grid;gap:16px}.planner-review label{display:grid;gap:8px}.planner-docs{overflow-wrap:anywhere}@media(max-width:600px){.planner-body{padding:14px}.planner-day{padding:12px}.planner-actions button{flex:1 1 130px}.planner-week{gap:12px}.planner-day-head h3{line-height:1.5}}
.worksheet-modal{width:min(980px,calc(100% - 24px));max-height:92vh;overflow:auto;background:#101c25;color:#f5ead3;border:1px solid #bfa06a;border-radius:18px;padding:24px;box-sizing:border-box}.worksheet-modal::backdrop{background:#000c}.worksheet-header{display:flex;gap:20px;justify-content:space-between;align-items:center}.worksheet-modal label{display:grid;gap:8px;margin:18px 0}.worksheet-modal textarea,.worksheet-modal input:not([type=checkbox]),.worksheet-modal select{width:100%;box-sizing:border-box;min-width:0}.worksheet-modal canvas{display:block;width:100%;height:auto;touch-action:none;border:2px solid #5cb8c9;border-radius:8px;background:#fff}.worksheet-question{padding:16px;border:1px solid #52616c;border-radius:12px;margin:18px 0}.worksheet-modal a{color:#8adddf;text-decoration:underline}.worksheet-modal [data-sheet-feedback]{color:#ffda8a;white-space:pre-wrap}.worksheet-modal textarea[readonly]{opacity:.9}.worksheet-modal [hidden]{display:none!important}@media(max-width:600px){.worksheet-modal{padding:14px}.worksheet-header h2{font-size:1.15rem}.worksheet-question{padding:12px}}

