
/* Layout: a working desk. Controls on the left, the printed A4 sheets stacked on the right like paper on a table. */
:root {
  --bg: #e9eef1;
  --surface: #ffffff;
  --surface-2: #f4f7f9;
  --ink: #1b2830;
  --muted: #5b6b75;
  --line: #d3dce2;
  --accent: #2e5c9a;       /* Montessori blue bead */
  --accent-ink: #ffffff;
  --pink: #c9577c;         /* pink tower */
  --pink-soft: #f7dfe7;
  --danger: #b3261e;
  --shadow: 0 1px 2px rgba(20,40,60,.08), 0 8px 24px rgba(20,40,60,.10);
  --f-display: "Baloo 2", "Kohinoor Devanagari", "Nirmala UI", system-ui, sans-serif;
  --f-body: "Mukta", "Kohinoor Devanagari", "Nirmala UI", system-ui, sans-serif;
  --r: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11181d; --surface: #19232a; --surface-2: #1f2b33; --ink: #e4ebef; --muted: #9aabb5;
    --line: #2d3b45; --accent: #7fa6e3; --accent-ink: #0d1a2b; --pink: #e693ae; --pink-soft: #3a2530;
    --danger: #f2998f; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #11181d; --surface: #19232a; --surface-2: #1f2b33; --ink: #e4ebef; --muted: #9aabb5;
  --line: #2d3b45; --accent: #7fa6e3; --accent-ink: #0d1a2b; --pink: #e693ae; --pink-soft: #3a2530;
  --danger: #f2998f; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35); color-scheme: dark;
}
* { box-sizing: border-box; }
body { background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 16px; line-height: 1.5; margin: 0; }
.wrap { max-width: 1320px; margin: 0 auto; padding-inline: 20px; padding-block: 20px 48px; }
header.top { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
header.top svg { width: 40px; height: 40px; flex: none; }
header.top h1 { font-family: var(--f-display); font-weight: 700; font-size: 1.7rem; line-height: 1.1; margin: 0; text-wrap: balance; }
header.top p { margin: 0; color: var(--muted); font-size: .98rem; }
.grid { display: grid; grid-template-columns: minmax(0, 400px) minmax(0, 1fr); gap: 22px; align-items: start; }
@media (max-width: 920px) { .grid { grid-template-columns: minmax(0, 1fr); } }
.panel { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.card h2 { font-family: var(--f-display); font-weight: 600; font-size: 1.12rem; margin: 0; line-height: 1.2; }
label.lab { font-size: .8rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); display: block; margin-bottom: 4px; }
textarea, input[type=text], select {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 8px; padding: 9px 11px; min-width: 0;
}
textarea { resize: vertical; min-height: 110px; line-height: 1.45; }
textarea:focus, input:focus, select:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font: inherit; font-size: .86rem; line-height: 1.3; text-align: left; background: var(--pink-soft); color: var(--ink); border: 1px solid transparent; border-radius: 999px; padding: 5px 11px; cursor: pointer; }
.chip:hover { border-color: var(--pink); }
.btns { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
button.btn { font: inherit; font-weight: 600; border-radius: 8px; padding: 9px 16px; cursor: pointer; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); }
button.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.btn:disabled { opacity: .5; cursor: not-allowed; }
button.btn.small { padding: 4px 10px; font-size: .88rem; font-weight: 500; }
.status { font-size: .92rem; color: var(--muted); min-height: 1.4em; }
.status.err { color: var(--danger); }
.check { display: flex; gap: 8px; align-items: center; font-size: .95rem; }
.seclist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.seclist li { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; align-items: center; background: var(--surface-2); border-radius: 8px; padding: 7px 8px 7px 11px; }
.seclist .t { font-size: .92rem; line-height: 1.3; min-width: 0; overflow-wrap: anywhere; }
.seclist .t b { font-weight: 600; }
.seclist .t span { color: var(--muted); }
.seclist .acts { display: flex; gap: 2px; }
.icon { font: inherit; width: 30px; height: 30px; border-radius: 6px; border: 1px solid transparent; background: transparent; color: var(--ink); cursor: pointer; display: grid; place-items: center; }
.icon:hover { background: var(--surface); border-color: var(--line); }
.icon svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.hist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.hist li { display: flex; gap: 8px; align-items: center; justify-content: space-between; font-size: .92rem; }
.hist button.link { font: inherit; background: none; border: 0; padding: 2px 0; color: var(--accent); cursor: pointer; text-align: left; min-width: 0; overflow-wrap: anywhere; }
.hist small { color: var(--muted); white-space: nowrap; }
.preview { min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.toolbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 2; background: var(--bg); padding-block: 6px; display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.toolbar .meta { min-width: 0; }
.toolbar .meta b { font-family: var(--f-display); font-weight: 600; font-size: 1.1rem; display: block; line-height: 1.2; overflow-wrap: anywhere; }
.toolbar .meta small { color: var(--muted); }
.tag { display: inline-block; font-size: .72rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; background: var(--pink-soft); color: var(--pink); border-radius: 4px; padding: 1px 6px; margin-left: 6px; vertical-align: 2px; }
.sheets { display: flex; flex-direction: column; gap: 18px; align-items: center; }
.sheet { width: 100%; max-width: 780px; background: #fff; box-shadow: var(--shadow); border-radius: 2px; line-height: 0; }
.sheet svg { width: 100%; height: auto; display: block; }
.pgnum { font-size: .8rem; color: var(--muted); margin-top: -10px; }
.note { font-size: .88rem; color: var(--muted); }
@media (prefers-reduced-motion: no-preference) { .busy-dot { animation: pulse 1.2s ease-in-out infinite; } }
@keyframes pulse { 50% { opacity: .35; } }

/* ---- page chrome for the hosted app */
html { background: var(--bg); }
input[type=password] { width: 100%; font: inherit; color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; min-width: 0; }
header.top .grow { flex: 1 1 320px; min-width: 0; }
.who { display: flex; align-items: center; gap: 10px; font-size: .92rem; color: var(--muted); flex-wrap: wrap; }
.who b { color: var(--ink); font-weight: 600; }
.login-body { min-height: 100vh; display: grid; place-items: center; padding-inline: 16px; padding-block: 32px; }
.login { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 12px; }
.login h1 { font-family: var(--f-display); font-weight: 700; font-size: 1.6rem; line-height: 1.15; margin: 0; text-wrap: balance; }
.login .sub { margin: 0 0 6px; color: var(--muted); }
.login-kite { width: 48px; height: 48px; }
.login .status:empty { display: none; }
.login .btn { width: 100%; }

@media print {
  @page { size: A4; margin: 0; }
  html, body { background: #fff !important; margin: 0; padding: 0; }
  .wrap { padding: 0 !important; max-width: none; }
  header.top, .panel, .toolbar, #dlStatus, .pgnum { display: none !important; }
  .grid { display: block; }
  .sheets { gap: 0; display: block; }
  .sheet { box-shadow: none; max-width: none; width: 210mm; height: 297mm; border-radius: 0; break-after: page; page-break-after: always; overflow: hidden; }
  .sheet:last-of-type { break-after: auto; page-break-after: auto; }
  .sheet svg { width: 210mm; height: 297mm; }
}

/* ---- change-password dialog */
dialog#pwDialog { border: 0; padding: 0; background: transparent; width: min(420px, calc(100vw - 32px)); color: var(--ink); }
dialog#pwDialog::backdrop { background: rgba(10, 20, 30, .45); }
dialog#pwDialog .card { box-shadow: var(--shadow); }
.status.ok { color: var(--accent); }

/* ---- editable question wording in the Sections list */
.seclist .t { display: flex; flex-direction: column; gap: 4px; }
.seclist .secText { font-size: .92rem; padding: 5px 8px; background: var(--surface); }
