/* v4.9.0 — the form viewer (every screen size) and the desktop layout (≥1024 px wide only; phones are as in v4.8.0). */

/* ---------- form viewer: zoom by width inside a scroll box, so the left / top edge is always reachable ---------- */
.fv-bar{display:flex;flex-wrap:wrap;align-items:center;gap:6px;margin:0 0 8px}
.fv-b{min-width:36px;height:34px;padding:0 10px;border-radius:10px;border:1px solid var(--line);background:var(--card);color:var(--text);font:inherit;font-size:15px;font-weight:750;line-height:1;cursor:pointer}
.fv-b.fv-t{font-size:13px;font-weight:700}
.fv-b.on{border-color:var(--accent);color:var(--accent);background:#eef3ff}
.fv-b:disabled{opacity:.4;cursor:default}
.fv-pct{min-width:46px;text-align:center;font-size:13.5px;font-weight:750;font-variant-numeric:tabular-nums;color:var(--muted)}
.fv-pg{display:inline-flex;align-items:center;gap:6px;margin-left:auto}
.fv-pgn{font-size:13px;font-weight:700;color:var(--muted);white-space:nowrap}
@media (max-width:520px){.fv-bar{gap:4px}.fv-b{min-width:32px;height:32px;padding:0 8px}.fv-b.fv-t{font-size:12.5px}.fv-pct{min-width:40px;font-size:12.5px}}
.rv-img.fv-sc,.fv-sc{display:block;overflow:auto;text-align:left;cursor:zoom-in;position:relative;overscroll-behavior:contain}
.fv-sc img{display:block;width:100%;height:auto;max-width:none;margin:0 auto;-webkit-user-drag:none;user-select:none}
.fv-sc.fv-big{cursor:zoom-out}
.fv-sc.fv-drag{cursor:grabbing}
.fv-sc>.muted{display:block;padding:14px}
.fv-sc:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.dk-brand{display:none}
/* Families: By family | By child (every screen size); a search in By family keeps the children under their family */
.f-grp{display:flex;flex-direction:column;gap:6px;margin:0 0 10px}
.f-grp-h{display:flex;flex-wrap:wrap;align-items:baseline;gap:2px 10px;width:100%;padding:4px 4px 0;border:0;background:none;font:inherit;color:var(--text);text-align:left;cursor:pointer}
.f-grp-h b{font-size:14px;font-weight:800}
.f-grp-a{font-size:12px;color:var(--muted);flex:1 1 auto;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.f-grp-n{font-size:12px;color:var(--accent);font-weight:700;margin-left:auto}
.im-seg{display:flex;margin:0 0 10px;padding:3px;border-radius:12px;background:var(--card2);border:1px solid var(--line);gap:3px}
.im-seg button{flex:1 1 0;border:0;background:none;border-radius:9px;padding:8px 10px;font:inherit;font-size:14px;font-weight:700;color:var(--muted);cursor:pointer}
.im-seg button[aria-pressed="true"]{background:var(--card);color:var(--accent);box-shadow:0 1px 3px rgba(31,42,68,.12)}
.sr{position:absolute!important;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}

@media (min-width:1024px){
  /* ---------- shell: side menu on the left, content uses the width ---------- */
  body.has-tb{padding-bottom:0;padding-left:236px}
  .tabbar{top:0;bottom:0;left:0;right:auto;width:236px;border-top:0;border-right:1px solid var(--line);padding:0;background:var(--card);-webkit-backdrop-filter:none;backdrop-filter:none}
  .tb-in{flex-direction:column;align-items:stretch;max-width:none;margin:0;padding:18px 12px;gap:4px;height:100%}
  .dk-brand{display:flex;align-items:center;gap:10px;padding:4px 10px 22px;font-family:"MB Serif",Georgia,serif;font-size:18px;line-height:1.2;color:var(--text)}
  .dk-brand img{width:34px;height:34px;border-radius:9px;flex:none}
  .tb-btn{flex:none;flex-direction:row;justify-content:flex-start;gap:12px;width:100%;height:46px;padding:0 14px;font-size:15px;font-weight:650;color:var(--muted)}
  .tb-btn svg{width:22px;height:22px;flex:none}
  .tb-btn span{line-height:1.2}
  .tb-btn:hover{background:var(--card2);color:var(--text)}
  .tb-btn[aria-current="page"]{background:#eef3ff;color:var(--accent)}
  .tb-btn:active svg{transform:none}
  .tb-badge,.tb-dot{position:static;margin-left:auto}
  .tb-btn .tb-badge{right:auto;top:auto}
  .tb-keys[hidden]{display:block}
  .tb-keys{display:block;margin-top:auto;padding:10px 12px;font-size:12px;line-height:1.5;color:var(--tick)}
  .tb-keys kbd{font:inherit;font-weight:800;border:1px solid var(--line);border-radius:5px;padding:0 5px;background:var(--card2);color:var(--muted)}
  #app{max-width:1400px;padding:26px 40px 48px}
  .top h1{font-size:34px}
  .toast{bottom:28px;left:calc(50% + 118px)}

  /* ---------- Home: stats in one row, cards side by side ---------- */
  #pg-home:not([hidden]){display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);column-gap:20px;align-items:start}
  #pg-home>*{grid-column:1/-1}
  #pg-home>#h-fu:not([hidden]){grid-column:1}
  #pg-home>#h-fu:not([hidden])~#h-due{grid-column:2}
  .im-stats{grid-template-columns:repeat(6,minmax(0,1fr))}
  .im-hero .im-acts{max-width:520px}

  /* ---------- search + filters at the top ---------- */
  .im-bar{flex-wrap:nowrap;align-items:center}
  .im-bar input[type=search]{flex:1 1 auto;max-width:560px}
  .im-bar select{flex:0 0 auto;width:230px}

  /* ---------- tables ---------- */
  .dk-tw{background:var(--card);border:1px solid var(--line);border-radius:16px;box-shadow:var(--shadow);overflow:clip;margin:0 0 12px}
  .dk-tbl{width:100%;border-collapse:separate;border-spacing:0;font-size:14px;line-height:1.35}
  .dk-tbl th{position:sticky;top:0;z-index:1;background:var(--card2);text-align:left;font-size:11.5px;font-weight:800;color:var(--label);text-transform:uppercase;letter-spacing:.05em;padding:10px 12px;border-bottom:1px solid var(--line);white-space:nowrap}
  .dk-tbl th:has(.dk-sort){padding:0}
  .dk-sort{all:unset;box-sizing:border-box;display:flex;align-items:center;gap:6px;width:100%;padding:10px 12px;cursor:pointer;font:inherit;color:inherit;text-transform:inherit;letter-spacing:inherit}
  .dk-sort:hover{color:var(--text)}
  .dk-sort:focus-visible{outline:2px solid var(--accent);outline-offset:-2px;border-radius:6px}
  .dk-ar{font-size:10px;opacity:.4}
  .dk-sort.on{color:var(--accent)}.dk-sort.on .dk-ar{opacity:1}
  .dk-tbl td{padding:11px 12px;border-bottom:1px solid var(--line);vertical-align:top;background:var(--card)}
  .dk-tbl tbody tr:last-child td{border-bottom:0}
  .dk-row{cursor:pointer}
  .dk-row:hover td{background:#f5f8ff}
  .dk-nm{all:unset;cursor:pointer;color:var(--text);font-weight:700;font-size:15px}
  .dk-nm b{font-weight:750}
  .dk-nm:hover b,.dk-nm:focus-visible b{color:var(--accent);text-decoration:underline}
  .dk-nm:focus-visible{outline:2px solid var(--accent);outline-offset:2px;border-radius:4px}
  .dk-nm .yid{font-size:13px;color:var(--muted);font-weight:600}
  .dk-tbl .v48-addr{display:block;font-size:12.5px;color:var(--muted);margin-top:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .dk-sub{display:block;font-size:12px;color:var(--muted);margin-top:2px}
  .dk-lnk{all:unset;cursor:pointer;color:var(--accent);font-weight:650}
  .dk-lnk:hover{text-decoration:underline}
  .dk-lnk:focus-visible{outline:2px solid var(--accent);outline-offset:2px;border-radius:4px}
  .dk-none{color:var(--tick)}
  .dk-miss{color:var(--down);font-weight:650}
  .dk-c-dob,.dk-c-cls,.dk-c-fu{white-space:nowrap}
  .dk-c-st .im-badge{white-space:nowrap}
  .dk-mt{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .dk-note{display:block}
  .dk-note b{display:block;font-weight:700;color:var(--accent)}
  .dk-note.od b{color:var(--down)}.dk-note.today b{color:var(--amber)}
  .dk-nt{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#46505e}
  .dk-nt.dk-wrap{white-space:normal}
  .dk-c-act{white-space:nowrap;text-align:right}
  .dk-open{margin:-4px 0 0;min-height:0;padding:6px 14px}
  /* fixed column widths: long text is cut with … (the whole text is on the child's page) */
  .dk-kids,.dk-fus,.dk-fams,.dk-rev,.dk-done{table-layout:fixed}
  .dk-tbl td{overflow:hidden;overflow-wrap:anywhere}
  .dk-tbl .dk-sub,.dk-tbl .v48-addr,.dk-nt,.dk-mt{max-width:100%}
  .dk-kids th:nth-child(1){width:21%}.dk-kids th:nth-child(2){width:14%}.dk-kids th:nth-child(3){width:10%}.dk-kids th:nth-child(4){width:10%}.dk-kids th:nth-child(5){width:17%}.dk-kids th:nth-child(7){width:92px}
  .dk-fus th:nth-child(1){width:118px}.dk-fus th:nth-child(2){width:21%}.dk-fus th:nth-child(3){width:10%}.dk-fus th:nth-child(4){width:10%}.dk-fus th:nth-child(6){width:13%}.dk-fus th:nth-child(7){width:92px}
  .dk-fams th:nth-child(1){width:17%}.dk-fams th:nth-child(2){width:25%}.dk-fams th:nth-child(3){width:17%}.dk-fams th:nth-child(4){width:13%}.dk-fams th:nth-child(6){width:92px}
  .dk-rev th:nth-child(1){width:20%}.dk-rev th:nth-child(2){width:16%}.dk-rev th:nth-child(3){width:9%}.dk-rev th:nth-child(4){width:21%}.dk-rev th:nth-child(6){width:110px}
  .dk-done th:nth-child(1){width:28%}.dk-done th:nth-child(2){width:28%}.dk-done th:nth-child(3){width:8%}.dk-done th:nth-child(4){width:16%}.dk-done th:nth-child(6){width:92px}
  .dk-tbl tr.dk-grp td{overflow:visible}
  .page .btn-row{justify-content:flex-start}
  .page .btn-row>button{flex:0 0 auto;min-width:170px}
  .dk-tbl .v48-fud{font-size:14px;font-weight:750;color:var(--text);text-align:left}
  .dk-tbl .v48-fud.od,.dk-fust{color:var(--down)}
  .dk-tbl tr.today .v48-fud{color:var(--amber)}
  .dk-tbl tr.v48-fu.today .dk-fust{color:var(--amber)}
  .dk-tbl tr.v48-fu.od td{background:var(--r-soft)}
  .dk-tbl tr.v48-fu.od td:first-child{box-shadow:inset 4px 0 0 var(--down)}
  .dk-tbl tr.v48-fu.today td{background:var(--amber-soft)}
  .dk-tbl tr.v48-fu.today td:first-child{box-shadow:inset 4px 0 0 var(--amber)}
  .dk-tbl tr.rev td:first-child{box-shadow:inset 4px 0 0 var(--accent)}
  .dk-tbl tr.dk-grp td{background:var(--card2);padding:9px 12px 7px;border-bottom:1px solid var(--line)}
  .dk-tbl tr.dk-grp:hover td{background:#eef2fa}
  .dk-gsub{display:inline-block;margin-left:12px;font-size:12.5px;color:var(--muted)}
  .dk-grouped tbody tr:not(.dk-grp) td:first-child{padding-left:26px}
  .dk-why{color:var(--down);font-size:13px;max-width:300px}
  .dk-c-chips .chips{display:flex;flex-wrap:wrap;gap:4px}
  .dk-chip{font:inherit;font-size:12px;cursor:pointer}
  .dk-seg{display:inline-flex;border:1px solid var(--line);border-radius:12px;overflow:hidden;margin:0 0 10px;background:var(--card)}
  .dk-seg button{border:0;background:none;padding:8px 18px;font:inherit;font-size:14px;font-weight:700;color:var(--muted);cursor:pointer}
  .dk-seg button[aria-pressed="true"]{background:var(--accent);color:#fff}
  #f-list.im-list,#r-list.im-list,#r-done.im-list{gap:0}
  .im-seg{display:inline-flex;min-width:300px}

  /* ---------- More: cards in two columns ---------- */
  #pg-more:not([hidden]){columns:2;column-gap:20px}
  #pg-more>*{break-inside:avoid}
  #pg-more>.card:first-child{margin-top:0}

  /* ---------- full views (child, family, form review): a wide page next to the side menu, not a phone panel ---------- */
  #view{left:236px;align-items:stretch;justify-content:center;background:var(--bg)}
  #view>.sheet-bg{display:none}
  #view .view-card{max-width:1000px;width:100%;height:100%;max-height:none;border-radius:0;box-shadow:none;padding:16px 40px 48px;background:var(--bg)}
  #view .view-card[data-kind="kid"],#view .view-card[data-kind="rev"],#view .view-card[data-kind="fam"]{max-width:1400px}
  .v-head{top:-16px;padding:12px 0}
  .v-head h2{font-size:28px}
  /* form review: the page on the left (60 %), what was read on the right */
  .rv-grid{flex-direction:row;gap:24px;align-items:flex-start}
  .rv-page{flex:0 0 60%;min-width:0;position:sticky;top:76px}
  .rv-fields{flex:1 1 0;min-width:0}
  .rv-img.fv-sc,#view .rv-img{height:calc(100vh - 230px);min-height:420px;max-height:none}
  .rv-acts{position:static}
  /* child page: the form on the left, the details / status / notes on the right */
  .dk-kid{display:grid;grid-template-columns:minmax(0,3fr) minmax(0,2fr);gap:24px;align-items:start}
  .dk-kl{position:sticky;top:76px;min-width:0}
  .dk-kr{min-width:0}
  .dk-kr>.card:first-child,.dk-kr>:first-child{margin-top:0}
  .dk-kl-top{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:0 0 8px;min-height:34px}
  .dk-kl-top select{font:inherit;font-size:14px;padding:7px 10px;border-radius:10px;border:1px solid var(--line);background:var(--card);max-width:420px}
  .dk-kfn{margin:0;font-size:14px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .dk-ksc{height:calc(100vh - 250px);min-height:420px;background:#fff;border:1px solid var(--line);border-radius:12px}
  .dk-kempty{background:var(--card);border:1px dashed var(--line);border-radius:16px;padding:40px 28px;text-align:center;min-height:320px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px}
  .dk-kempty-t{margin:0;font-size:17px;font-weight:700}
  /* family page: the children two per row */
  #view-card[data-kind="fam"] .im-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}

  /* ---------- dialogs: centred, a sensible width (the forms' own two-column rows stay) ---------- */
  .sheet{align-items:center;padding:24px}
  .sheet-card{max-width:680px;max-height:88vh;border-radius:22px;padding:24px 26px 22px;box-shadow:0 24px 60px rgba(15,20,30,.28)}
  .kp-ov{align-items:center}
  .kp-sheet{height:min(84vh,760px);max-width:640px;border-radius:20px;overflow:hidden}
  .ask-card{max-width:440px}
}
@media (min-width:1024px) and (max-width:1279px){
  #app{padding:22px 24px 40px}
  #view .view-card{padding:12px 24px 40px}
  .dk-tbl td,.dk-tbl th{padding-left:9px;padding-right:9px}
  .dk-sort{padding:10px 9px}
  .dk-c-fam .dk-sub{display:none}
  .rv-page{flex-basis:55%}
  .rv-fields .two{grid-template-columns:1fr}
  .dk-kid{grid-template-columns:minmax(0,11fr) minmax(0,9fr)}
}
