/* ps-fs (งบการเงิน — js/pages/fis/fs.js) and the statement-structure modal (⚙ ตั้งค่างบ — js/pages/fis/nodecfg.js).
   Scoped to .fis-scope (the view root and the modal both carry it); colours are the prototype tokens
   (--p-*, css/fis-theme.css), which follow all six themes. */

/* ── ps-fs ── */
.fis-scope .fs-wrap{display:flex;flex-direction:column;gap:14px;min-width:0;}
.fis-scope .fs-meta{margin:0;}
.fis-scope .fs-col{display:flex;flex-direction:column;gap:14px;min-width:0;}
/* the control card (prototype #fs first card ~407–412) */
.fis-scope .fs-top{height:auto;}
.fis-scope .fs-top-row{display:flex;flex-wrap:wrap;gap:12px;align-items:center;justify-content:space-between;}
.fis-scope .fs-top-t{min-width:0;}
.fis-scope .fs-top .fis-head-t{font-size:calc(15px*var(--fz,1));font-weight:600;margin:0 0 2px;}
.fis-scope .fs-top-ctl{display:flex;gap:8px;flex-wrap:wrap;}
.fis-scope .fs-col > .fis-card{height:auto;}
#fsRoot.fs-busy{opacity:.55;transition:opacity .15s;}

.fis-scope .fs-tbl{width:100%;border-collapse:collapse;font-size:calc(13px*var(--fz,1));color:var(--p-ink);font-variant-numeric:tabular-nums;}
.fis-scope .fs-tbl th{text-align:left;font-weight:500;color:var(--p-muted);padding:8px 6px;border-bottom:1px solid var(--p-line);white-space:nowrap;}
.fis-scope .fs-tbl td{padding:6px 6px;border-bottom:1px solid var(--p-line);line-height:1.4;}
.fis-scope .fs-tbl .n{text-align:right;white-space:nowrap;}
.fis-scope .fs-tbl .neg,.fis-scope .fs-checks .neg,.nc-modal .neg{color:var(--p-bad);}
.fis-scope .pass{color:var(--p-good);font-weight:700;}
.fis-scope .fs-code{font-size:calc(11px*var(--fz,1));color:var(--p-muted);margin-right:2px;}
/* row styles of cfgRenderTable (L1719) */
.fis-scope .fs-hd td{font-weight:700;padding-top:12px;color:var(--p-accent);border-bottom:0;}
.fis-scope .fs-st-bold td{font-weight:600;}
.fis-scope .fs-st-sub td{font-weight:600;background:var(--p-soft);}
.fis-scope .fs-st-total td{font-weight:700;border-top:2px solid var(--p-ink);}
.fis-scope .fs-st-grand td{font-weight:700;border-top:2px solid var(--p-ink);border-bottom:3px double var(--p-ink);}
.fis-scope .fs-st-pct td{color:var(--p-muted);font-size:calc(12px*var(--fz,1));}
.fis-scope .fs-d{display:none;}
.fis-scope .fs-det-on .fs-d{display:table-row;}
.fis-scope .fs-d td{color:var(--p-muted);font-size:calc(12px*var(--fz,1));}
/* cash flow (cfTable L1272–1275) */
.fis-scope .fs-sec td{font-weight:700;padding-top:14px;color:var(--p-accent);border-bottom:0;}
.fis-scope .fs-cf-l3 td:first-child{padding-left:26px;color:var(--p-muted);}
.fis-scope .fs-cf-sub td{font-weight:600;background:var(--p-soft);}
.fis-scope .fs-cf-tot td{font-weight:700;border-top:2px solid var(--p-ink);}

.fis-scope .fs-checks{margin-top:10px;display:flex;flex-direction:column;}
.fis-scope .fs-stat,.nc-modal .fs-stat{display:flex;justify-content:space-between;align-items:center;gap:6px 12px;flex-wrap:wrap;
  padding:8px 0;border-bottom:1px solid var(--p-line);font-size:calc(13px*var(--fz,1));}
.fis-scope .fs-stat:last-child{border-bottom:0;}
.fis-scope .fs-stat > span:last-child{text-align:right;margin-left:auto;}
.fis-scope .fs-warn{background:var(--p-bad-bg);border-radius:8px;padding:6px 8px;border-bottom:0;}
.fis-scope .fs-notes{margin:0;padding-left:18px;font-size:calc(12.5px*var(--fz,1));line-height:1.7;color:var(--p-muted);}

/* ── the topbar gear (hidden while there is no period — #perStrip hidden) ── */
.nc-gear{display:inline-flex;align-items:center;gap:6px;border:1px solid var(--p-line);background:var(--p-card);color:var(--p-ink);
  border-radius:10px;padding:7px 11px;cursor:pointer;font:inherit;font-size:calc(13px*var(--fz,1));font-weight:500;white-space:nowrap;}
.nc-gear:hover{border-color:var(--p-accent);}
.nc-gear:focus-visible{outline:2px solid var(--p-accent);outline-offset:1px;}
.nc-gear svg{color:var(--p-accent);transition:transform .4s;}
.nc-gear:hover svg{transform:rotate(90deg);}
.shell:has(#perStrip[style*="none"]) .nc-gear{display:none;}
@media (max-width:767.98px){ .nc-gear span{display:none;} }

/* ── the modal (prototype .cfgModal / .cfgDlg, L165–173) ── */
.nc-modal{position:fixed;inset:0;z-index:1200;background:rgba(15,20,30,.55);display:flex;align-items:flex-start;justify-content:center;padding:28px 16px;overflow:auto;}
.nc-modal[hidden]{display:none;}
body.nc-open{overflow:hidden;}
.nc-dlg{background:var(--p-bg);color:var(--p-ink);font-family:var(--p-font);line-height:1.55;border-radius:16px;width:min(1320px,100%);box-shadow:0 24px 60px -20px rgba(0,0,0,.5);
  border:1px solid var(--p-line);display:flex;flex-direction:column;max-height:calc(100vh - 56px);}
.nc-head{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:14px 20px;border-bottom:1px solid var(--p-line);
  background:var(--p-card);border-radius:16px 16px 0 0;}
.nc-kick{font-size:calc(11.5px*var(--fz,1));font-weight:700;letter-spacing:.12em;color:var(--p-accent);}
.nc-head h2{margin:2px 0 0;font-size:calc(19px*var(--fz,1));font-weight:700;}
.nc-head-r{display:flex;align-items:center;gap:10px;min-width:0;}
.nc-status{font-size:calc(12px*var(--fz,1));font-weight:600;padding:2px 8px;border-radius:99px;background:var(--p-soft);color:var(--p-muted);}
.nc-status.ok{color:var(--p-good);background:var(--p-good-bg);}
.nc-status.dirty,.nc-status.busy{color:var(--p-warn);background:var(--p-warn-bg);}
.nc-status.bad{color:var(--p-bad);background:var(--p-bad-bg);}
.nc-close{flex:none;border:1px solid var(--p-line);background:var(--p-bg);color:var(--p-ink);width:36px;height:36px;border-radius:50%;cursor:pointer;font-size:calc(16px*var(--fz,1));}
.nc-close:hover{border-color:var(--p-accent);color:var(--p-accent);}
.nc-body{padding:16px 20px;overflow:auto;display:flex;flex-direction:column;gap:14px;min-height:0;}
.nc-modal :focus-visible{outline:2px solid var(--p-accent);outline-offset:1px;}

.nc-bar{display:flex;flex-direction:column;gap:8px;}
.nc-bar-t{font-size:calc(12.5px*var(--fz,1));color:var(--p-muted);line-height:1.5;}
.nc-modal code{font-size:calc(12px*var(--fz,1));padding:0 4px;border-radius:4px;background:var(--p-soft);}
.nc-ctl{display:flex;flex-wrap:wrap;gap:6px;align-items:center;margin:6px 0;}
.nc-modal select,.nc-modal input:not([type=checkbox]),.nc-modal textarea{font:inherit;font-size:calc(13px*var(--fz,1));padding:5px 8px;border-radius:7px;
  border:1px solid var(--p-line);background:var(--p-card);color:var(--p-ink);min-width:0;}
.nc-modal textarea{width:100%;resize:vertical;font-family:ui-monospace,Consolas,monospace;}
.nc-modal .fis-btn.sm{font-size:calc(11px*var(--fz,1));padding:2px 8px;}
.nc-modal .fis-btn.danger{color:var(--p-bad);}
.nc-msg{flex:1 1 220px;font-size:calc(12.5px*var(--fz,1));color:var(--p-good);opacity:0;transition:opacity .2s;}
.nc-msg.on{opacity:1;}
.nc-sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;}

.nc-grid{display:grid;grid-template-columns:minmax(0,1.1fr) minmax(0,1fr);gap:14px;align-items:start;}
.nc-side{display:flex;flex-direction:column;gap:14px;min-width:0;}
.nc-modal .fis-card{height:auto;}
.nc-lhead{display:flex;justify-content:space-between;align-items:center;gap:8px;flex-wrap:wrap;}
.nc-list{max-height:min(680px,60vh);overflow:auto;}
.nc-row{display:flex;align-items:center;gap:8px;padding:6px 8px;border-bottom:1px solid var(--p-line);border-radius:6px;cursor:pointer;font-size:calc(13px*var(--fz,1));user-select:none;}
.nc-row:hover{background:var(--p-soft);}
.nc-row.sel{background:color-mix(in srgb,var(--p-accent) 14%,transparent);outline:1px solid var(--p-accent);}
.nc-row.hid{opacity:.45;}
.nc-row.dragging{opacity:.4;}
.nc-row.dropB{box-shadow:inset 0 3px 0 var(--p-accent);}
.nc-row.dropA{box-shadow:inset 0 -3px 0 var(--p-accent);}
.nc-row.t-header .nc-name{font-weight:700;color:var(--p-accent);}
.nc-row.s-total .nc-name,.nc-row.s-grand .nc-name{font-weight:700;}
.nc-grip{color:var(--p-muted);cursor:grab;font-size:calc(15px*var(--fz,1));line-height:1;padding:0 2px;}
.nc-code{font-family:ui-monospace,Menlo,Consolas,monospace;font-size:calc(11.5px*var(--fz,1));color:var(--p-muted);min-width:46px;}
.nc-name{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.nc-val{font-variant-numeric:tabular-nums;text-align:right;min-width:80px;white-space:nowrap;}
.nc-pill{font-size:calc(10.5px*var(--fz,1));font-weight:600;padding:1px 7px;border-radius:99px;background:var(--p-soft);color:var(--p-muted);white-space:nowrap;}
.nc-pill.f{color:var(--p-accent);}

.nc-form{display:grid;grid-template-columns:repeat(auto-fill,minmax(140px,1fr));gap:10px 12px;align-items:end;margin:6px 0;font-size:calc(13px*var(--fz,1));}
.nc-form label{display:flex;flex-direction:column;gap:4px;font-size:calc(12px*var(--fz,1));color:var(--p-muted);}
.nc-form label.nc-chk{flex-direction:row;align-items:center;gap:6px;grid-column:1/-1;color:var(--p-ink);}
.nc-sec{border-top:1px dashed var(--p-line);margin-top:14px;padding-top:12px;font-size:calc(13px*var(--fz,1));}
.nc-chips{display:flex;flex-wrap:wrap;gap:6px;margin:6px 0;}
.nc-chip{display:inline-flex;align-items:center;gap:4px;font-family:ui-monospace,Menlo,Consolas,monospace;font-size:calc(12px*var(--fz,1));padding:3px 4px 3px 9px;border-radius:999px;
  background:color-mix(in srgb,var(--p-accent) 14%,transparent);color:var(--p-ink);border:1px solid color-mix(in srgb,var(--p-accent) 40%,transparent);}
.nc-chip.ex{background:color-mix(in srgb,var(--p-bad) 12%,transparent);border-color:color-mix(in srgb,var(--p-bad) 40%,transparent);}
.nc-chip button{border:0;background:transparent;color:var(--p-muted);cursor:pointer;font-size:calc(14px*var(--fz,1));line-height:1;padding:0 4px;border-radius:50%;}
.nc-chip button:hover{background:var(--p-soft);color:var(--p-ink);}
.nc-scroll{max-height:260px;overflow:auto;margin-top:6px;}
.nc-scroll.sm{max-height:150px;}
.nc-tbl{width:100%;border-collapse:collapse;font-size:calc(12.5px*var(--fz,1));}
.nc-tbl td{padding:3px 6px;border-bottom:1px solid var(--p-line);}
.nc-tbl .n{text-align:right;white-space:nowrap;font-variant-numeric:tabular-nums;}
.nc-dim{color:var(--p-muted);}
.nc-small{font-size:calc(12px*var(--fz,1));}
.nc-foot{margin-top:12px;}

/* full-screen sheet on a phone (prototype @media max-width:600px, L173) */
@media (max-width:767.98px){
  .nc-modal{padding:0;}
  .nc-dlg{border-radius:0;max-height:100vh;min-height:100vh;height:100vh;width:100%;}
  .nc-head{border-radius:0;padding:10px 12px;flex-wrap:wrap;}
  .nc-head h2{font-size:calc(16px*var(--fz,1));}
  .nc-body{padding:10px 12px;}
  .nc-grid{grid-template-columns:minmax(0,1fr);}
  .nc-list{max-height:45vh;}
  .nc-head-r{width:100%;justify-content:space-between;order:3;}
}
