/* Navodaya Studio — tool layout. Loaded after app.css.
   Chapter rail (scope) on the left for Bank / Cheat sheet / Notes / Insights; the paper maker is a full-width workspace. */
.wrap.wide { max-width: 1500px; }
.hide { display: none !important; }
body.noscroll { overflow: hidden; }
.linkbtn { border: 0; background: none; color: var(--accent); font-weight: 600; min-height: 44px; padding: 0 8px; text-decoration: underline; text-underline-offset: 3px; }
.mast-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* shell */
.shell { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 22px; padding-top: 16px; align-items: start; }
.shell[data-tab="builder"] { grid-template-columns: minmax(0, 1fr); }
.shell[data-tab="builder"] #rail { display: none; }
.content { min-width: 0; padding-bottom: 96px; }
.rail-col { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 112px); max-height: calc(100vh - 128px); overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 12px; scrollbar-width: thin; }
.sc-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sc-head h2 { margin: 0; font-size: 16px; }
.sc-sub { margin: 4px 0 10px; }
.sc-group { margin-bottom: 10px; }
.sc-gh { display: flex; align-items: center; justify-content: space-between; font-weight: 600; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--line); padding-bottom: 2px; margin-bottom: 2px; }
.sc-row { display: flex; align-items: center; gap: 4px; }
.sc-item { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; }
.sc-item input { width: 18px; height: 18px; flex: none; }
.sc-item .nm { flex: 1; min-width: 0; overflow-wrap: anywhere; line-height: 1.35; }
.sc-item .n { font-family: var(--f-mono); font-size: 12px; color: var(--muted); }
.sc-row .linkbtn { font-size: 13px; opacity: .85; }
.scope-btn { max-width: 52vw; }
@media (min-width: 1001px) { .scope-btn { display: none !important; } }
@media (max-width: 1000px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail-col { display: none; }
}
#pmModal .sc-head { margin-bottom: 4px; }

/* bank + browse pages: one column inside the content area */
.bank, .build { display: block; padding-top: 0; }
.bank-top { display: grid; gap: 10px; margin-bottom: 10px; }
.bank-filters { display: grid; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 10px 12px; }
.fgrp { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.fl { font-size: 13px; font-weight: 600; color: var(--muted); min-width: 64px; }
.fgroup h3 { margin: 6px 0 2px; font-size: 14px; }
.grp { margin-bottom: 22px; scroll-margin-top: 130px; }
.grp-h { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 0 0 8px; padding: 8px 12px; font-size: 17px; background: var(--surface2); border-radius: var(--r-md); border-left: 4px solid var(--accent); }
.grp-h small { font-size: 13px; font-weight: 400; color: var(--muted); }
.jump { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 6px 0 12px; }
.jump .jl { font-size: 13px; color: var(--muted); }
.sticky-tools { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 104px); z-index: 5; background: var(--bg); padding: 8px 0; margin: 0 0 6px; }
.sticky-tools .search { flex: 1 1 220px; width: auto; }
.cs-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 760px) { .cs-grid { grid-template-columns: minmax(0, 1fr); } }
.card-act { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
#v-bank .list { grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); align-items: start; }
.ins-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.ins-table th, .ins-table td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.ins-table th:first-child { text-align: left; }
.table-wrap { overflow-x: auto; }
.flags { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 4px; }
.set-sec { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 10px; display: grid; gap: 8px; }
.modal-in.mdx { grid-template-rows: auto minmax(0, 1fr); }
.modal-in.narrow { width: min(560px, 100%); }
.mdx .modal-body { padding: 12px 14px 16px; }

/* paper maker */
.pp { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 16px; align-items: start; padding-top: 4px; }
.pp.pool-open { grid-template-columns: 250px minmax(0, 1fr) 380px; }
@media (max-width: 1100px) { .pp, .pp.pool-open { grid-template-columns: 250px minmax(0, 1fr); } }
@media (max-width: 1000px) { .pp, .pp.pool-open { grid-template-columns: minmax(0, 1fr); } .pp-outline { display: none; } .pp-struct { display: inline-flex; } }
@media (min-width: 1001px) { .pp-struct { display: none; } }
.pp-outline, .pp-pool { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 112px); max-height: calc(100vh - 128px); overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 12px; display: grid; gap: 14px; align-content: start; }
.ol-sec h2 { margin: 0 0 8px; font-size: 15px; }
.ol-list { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 4px; }
.ol-item { width: 100%; display: grid; grid-template-columns: 24px minmax(0, 1fr); column-gap: 8px; text-align: left; min-height: 44px; padding: 4px 8px; border: 1px solid var(--line); background: var(--bg); border-radius: var(--r-md); }
.ol-item:hover { border-color: var(--accent); }
.ol-item b { grid-row: span 2; align-self: center; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: 13px; }
.ol-item .t { overflow-wrap: anywhere; font-weight: 600; }
.ol-item .n { font-size: 12px; color: var(--muted); font-family: var(--f-mono); }
.sv { display: grid; gap: 6px; padding: 8px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg); }
.sv .n { font-weight: 600; overflow-wrap: anywhere; } .sv .s { font-size: 13px; color: var(--muted); }
.btn.danger, .pbtn.danger { color: var(--warn); border-color: var(--warn); }
.pp-work { min-width: 0; }
.pp-bar { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 104px); z-index: 6; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.pp-bar .grp { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; background: none; border: 0; padding: 0; }
.pp-bar .grp.end { margin-left: auto; }
.pp-total { font-weight: 600; font-size: 14px; }
.pp-det { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0 0; padding: 8px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.pp-det label { margin: 0; }
.pp-det input[type=text], .pp-det input[type=number], .pp-det select { min-height: 44px; padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg); width: 100%; }
.pp-det .f-exam { flex: 2 1 260px; } .pp-det label:not(.f-exam) { flex: 1 1 120px; }
.det-school { display: flex; align-items: center; gap: 8px; flex: 1 1 260px; min-width: 0; padding-right: 8px; border-right: 1px solid var(--line); }
.det-school img, .logo-ph { width: 40px; height: 40px; object-fit: contain; border-radius: 6px; flex: none; }
.logo-ph { border: 1px dashed var(--line); }
.det-school .nm { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.pp-det .save-note { flex-basis: 100%; margin: 0; }
.pp-hint { margin: 8px 2px; }
.pp .pm-sheetwrap { margin-top: 6px; padding-bottom: 8px; }
.pp #pvSheet { margin: 0 auto; }
.pp-empty { color: #222; text-align: center; padding: 24px 12px; display: grid; gap: 12px; justify-items: center; }
.pp-empty ol { text-align: left; margin: 0; padding-left: 22px; }
.pp-empty .pm-presets { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); width: 100%; }
.pp-empty .pm-preset { color: #222; background: #f6f6f6; border-color: #ccc; }

/* controls drawn on the sheet — never printed */
.sheet [data-qid] { position: relative; border-radius: 6px; }
.sheet .qa { position: absolute; right: 0; top: -14px; z-index: 3; display: none; flex-wrap: wrap; gap: 4px; padding: 4px; background: #fff; border: 1px solid #5668c9; border-radius: 8px; box-shadow: 0 4px 14px rgba(0,0,0,.18); font-family: var(--f-body); font-size: 13px; font-weight: 400; line-height: 1.2; }
.sheet [data-qid]:hover { background: rgba(45, 79, 214, .06); outline: 1px dashed #5668c9; }
.sheet [data-qid]:hover .qa, .sheet [data-qid]:focus-within .qa, .sheet [data-qid].sel .qa { display: flex; }
.sheet [data-qid].sel { outline: 2px solid #2D4FD6; background: rgba(45, 79, 214, .08); }
.pbtn { min-height: 44px; min-width: 44px; padding: 0 10px; border: 1px solid #aeb6d8; background: #f4f6ff; color: #1a2250; border-radius: 6px; font: inherit; font-size: 13px; }
.pbtn:hover { border-color: #2D4FD6; background: #e7ebff; }
.qh { display: inline-flex; align-items: center; min-height: 44px; padding: 0 8px; cursor: grab; color: #1a2250; border: 1px dashed #aeb6d8; border-radius: 6px; }
.sheet .mv { display: none; }
@media (pointer: coarse) { .sheet .mv { display: inline-flex; align-items: center; justify-content: center; } .qh { display: none; } .sheet [data-qid] .qa { position: static; margin-top: 4px; } .sheet [data-qid].sel .qa { display: flex; } }
.sheet .sh { position: relative; }
.sheet .sh .sh-act { display: inline-flex; flex-wrap: wrap; gap: 4px; margin-left: 10px; font-weight: 400; }
.sheet .ph { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; margin: 6px 0; border: 1px dashed #777; border-radius: 6px; color: #444; font-size: 14px; }
.sheet .ph-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.sheet .ph.add-sec { justify-content: center; border-color: #5668c9; }
.sheet .drop-before { box-shadow: 0 -3px 0 #2D4FD6; }
.sheet .ph.drop-end { background: #e7ebff; border-color: #2D4FD6; }
.sheet .dragging { opacity: .45; }
.sheet.drag-on .ph[data-sid] { border-color: #2D4FD6; }

/* question drawer */
.pool-hd { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pool-hd h2 { margin: 0; font-size: 16px; }
.pool-tools { display: grid; gap: 8px; }
.pool-tools label { display: grid; gap: 3px; font-size: 13px; color: var(--muted); }
.pool-tools select { min-height: 44px; padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg); width: 100%; }
.pool-list { display: grid; gap: 8px; }
.pool-more { text-align: center; }
.pk .m { font-size: 13px; color: var(--muted); }
.pk .q { overflow-wrap: anywhere; }
.pk .o { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; font-size: 14px; color: var(--muted); }
@media (max-width: 1100px) {
  .pp-pool { position: fixed; z-index: 40; top: 0; right: 0; bottom: 0; width: min(420px, 100vw); max-height: none; border-radius: 0; border-width: 0 0 0 1px; box-shadow: -8px 0 30px rgba(0,0,0,.25); padding-top: max(12px, env(safe-area-inset-top, 0px)); padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
}

/* phone: bottom bar for the paper maker */
@media (min-width: 1001px) { #pmbar { display: none !important; } }
@media (max-width: 1000px) {
  .pp-bar { top: calc(env(safe-area-inset-top, 0px) + 100px); }
  .pp-bar .grp.end .pp-total { display: none; }
  .pp-bar .grp.end .btn.primary { display: none; }
  .pp-det .det-school { border-right: 0; flex-basis: 100%; }
}
@media print { .pp-outline, .pp-pool, .pp-bar, .pp-det, .rail-col { display: none !important; } }
#v-bank .list > .grp-h { grid-column: 1 / -1; margin-top: 10px; }
#v-bank .list > .grp-h:first-child { margin-top: 0; }
.sc-row .linkbtn { color: var(--muted); font-weight: 400; font-size: 12px; min-width: 44px; }
.sc-row:hover .linkbtn, .sc-row:focus-within .linkbtn { color: var(--accent); }
@media (max-width: 1000px) {
  .mast-top { flex-wrap: wrap; }
  .mast-actions { flex-wrap: wrap; justify-content: flex-end; min-width: 0; }
  .scope-btn { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .shell, .content, #v-data, #insights, .panel, .row2 { min-width: 0; max-width: 100%; }
  .kpis { flex-wrap: wrap; }
  .row2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1000px) { .pp .pp-outline { display: none; } .rail-col { display: none; } }
@media (min-width: 1001px) { .rail-col { display: block; } .pp .pp-outline { display: grid; } .shell[data-tab="builder"] #rail { display: none; } }
.pp-pool.hide { display: none; }
@media (max-width: 1000px) { .pp-bar { position: static; } }
/* first visit on a phone: just the three starting choices and one Generate button */
@media (max-width: 1000px) { .pp.is-empty .pp-bar, .pp.is-empty .pp-det { display: none; } }
.pp-save { margin: 8px 2px 0; }
.ol-list li { display: flex; align-items: center; gap: 2px; }
.ol-list .ol-item { flex: 1; min-width: 0; }
.pp-outline .sv, #pmModal .sv { display: grid; grid-template-columns: minmax(0, 1fr); }
.pp-outline .sv .s { white-space: normal; }
.inc-btn { max-width: 100%; text-align: left; justify-content: flex-start; }
.inc-btn b { font-weight: 600; }
