/* S-Curve Generator: page-specific layer.
   Tokens and shared components come from ../dark.css, ../light.css, ../shared.css.
   The control card (left) holds the set-up and the data tables; the results
   take the rest. The input tables follow the Project Scheduler's sheet:
   bordered cells, headings centred, units in .th-unit, and every editable cell
   a borderless input that fills it, as in a spreadsheet. In the card they are
   compact; ⤢ lifts them into a full-screen view with room for every column. */

.container{max-width:1440px;}
.layout{grid-template-columns:440px minmax(0,1fr);}
main{min-width:0;}
.btn-back{text-decoration:none;display:inline-flex;align-items:center;}
h1{font-size:1.85rem;margin:0 0 4px;}
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;}
.tip-wrap{display:inline-flex;align-items:center;gap:4px;}
.page-footer{max-width:1440px;margin:0 auto;padding:0 24px 24px;}

/* ── Quick Start ── */
.quick-start-row{display:flex;align-items:center;gap:10px;padding:10px 16px;border-bottom:1px solid var(--border);flex-wrap:wrap;}
.quick-start-label{display:inline-flex;align-items:center;gap:5px;font-weight:700;font-size:.82rem;color:var(--muted);white-space:nowrap;flex-shrink:0;}
.quick-start-label .tico{width:1.05em;height:1.05em;}
.quick-start-btns{display:flex;gap:6px;flex-wrap:wrap;}
.quick-start-btn{background:var(--input-bg);border:1.5px solid var(--border);border-radius:var(--radius-md);color:var(--muted);padding:5px 11px;font-size:.78rem;font-weight:600;cursor:pointer;font-family:inherit;white-space:nowrap;transition:color var(--motion-fast),background-color var(--motion-fast),border-color var(--motion-fast);}
.quick-start-btn:hover{border-color:var(--accent);color:var(--text);}
.quick-start-btn.active{border-color:var(--accent2);color:var(--text);background:color-mix(in srgb,var(--accent2) 15%,transparent);}

/* ── Tabs ── */
.ctrl-tab{display:flex;align-items:center;justify-content:center;gap:7px;padding:12px 8px;font-size:.84rem;line-height:1.25;}
.ctrl-tab .tico{width:1.25em;height:1.25em;}
.ctrl-panel>:first-child{margin-top:0;}

/* ── Set-up ── */
.lone-row{padding:0 2px 14px;}
.field-row[hidden]{display:none;}
.field-label{display:inline-flex;align-items:center;gap:4px;}
.field-row select{width:100%;}
.seg-group.sc-seg{display:flex;width:100%;}
.seg-group.sc-seg .seg-btn{flex:1 1 0;font-family:inherit;padding:7px 8px;font-size:.8rem;white-space:nowrap;}
.unit-pair{display:flex;gap:8px;}
.unit-pair select{flex:1 1 0;min-width:0;}
.unit-pair .txt-input{flex:1 1 0;min-width:0;}
.unit-pair .txt-input[hidden]{display:none;}

/* ── Data ── */
.data-card{transition:box-shadow var(--motion-fast);border-radius:var(--radius-md);}
.data-card.is-drop{box-shadow:0 0 0 2px var(--accent);}
.data-head{display:flex;align-items:center;justify-content:space-between;gap:8px;margin:0 0 4px;}
.data-head h3{margin:0;font-size:1rem;line-height:1.35;}
.grid-expand{flex-shrink:0;width:34px;height:32px;font-size:1.2rem;line-height:1;}
.data-note{margin:0 0 12px;color:var(--muted);font-size:.8rem;line-height:1.45;}
.data-note a{color:var(--accent-strong);}
.data-bar{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin:0 0 10px;}
.grid-count{font-size:.76rem;font-weight:600;color:var(--muted);}
.data-bar .grid-count{margin-right:auto;}
.row-tools{display:flex;align-items:center;gap:6px;flex-wrap:wrap;}
.row-tools[hidden]{display:none;}
.btn-tool{display:inline-flex;align-items:center;gap:6px;}
.btn-tool .ico{width:14px;height:14px;}
.btn-clear{width:auto;height:30px;padding:0 8px;font-size:.78rem;font-weight:600;gap:5px;}
.items-block{margin:0 0 16px;}
.items-block[hidden],.sheet-title[hidden]{display:none;}
#readingsBlock{margin:16px 0 0;}
.data-shell h4{margin:0 0 8px;font-size:.86rem;font-weight:700;}

.sheet-wrap{overflow:auto;border:1px solid var(--border);border-radius:var(--radius-md);background:var(--panel);}
.main-wrap{max-height:min(60vh,520px);}
.items-wrap{max-height:none;}
@supports not selector(::-webkit-scrollbar){.sheet-wrap{scrollbar-width:thin;scrollbar-color:var(--scrollbar-thumb) transparent;}}
table.dt{border-collapse:separate;border-spacing:0;font-size:.82rem;font-family:'DM Sans',sans-serif;font-variant-numeric:tabular-nums;}
table.sheet{width:max-content;min-width:100%;}
.dt th{padding:8px 8px;background:var(--input-bg);border-right:1px solid var(--border);border-bottom:1px solid var(--border);white-space:normal;text-align:center;vertical-align:middle;font-size:.76rem;font-weight:700;color:var(--text);line-height:1.25;}
.dt td{padding:0;border-right:1px solid var(--border);border-bottom:1px solid var(--border);vertical-align:middle;height:34px;background:var(--panel);}
.dt th:last-child,.dt td:last-child{border-right:none;}
.dt tbody tr:last-child td{border-bottom:none;}
.sheet thead th{position:sticky;top:0;z-index:3;background:color-mix(in srgb,var(--text) 4.5%,var(--panel));}
.sheet thead tr + tr th{top:var(--head1,33px);}
.th-unit{display:block;font-weight:500;color:var(--muted);font-size:.7rem;margin-top:2px;}

/* Columns in the card: compact, so a period table fits without scrolling
   sideways and a WBS shows its name and dates first. */
.sheet .c-num{position:sticky;left:0;z-index:2;width:32px;min-width:32px;text-align:center;color:var(--muted);font-family:'DM Mono',monospace;font-size:.72rem;}
.sheet thead .c-num{z-index:4;}
.sheet td.c-num{background:var(--panel);}
.sheet .c-per{min-width:118px;text-align:left;}
.sheet thead .c-per{text-align:center;}
.sheet .c-val{min-width:92px;width:96px;}
.sheet .c-sub{min-width:80px;width:84px;}
.sheet .c-item{min-width:160px;}
.sheet .c-iname{min-width:150px;width:170px;}
.sheet .c-wbs{width:50px;min-width:50px;}
.sheet .c-name{min-width:168px;width:180px;}
.sheet .c-date{min-width:120px;width:122px;}
.sheet .c-phase{text-align:left;}
.sheet .c-del{width:34px;min-width:34px;text-align:center;}
.sheet .c-wbs .cell{font-family:'DM Mono',monospace;font-size:.74rem;color:var(--muted);padding:0 7px;}

.cell{display:block;width:100%;height:34px;margin:0;padding:0 8px;border:0;border-radius:0;background:transparent;color:var(--text);font:inherit;font-size:.82rem;outline:none;}
.cell.num{text-align:right;font-family:'DM Mono',monospace;font-size:.78rem;}
.cell::placeholder{color:var(--muted);opacity:.85;font-style:italic;}
.cell:focus{box-shadow:inset 0 0 0 2px var(--accent);background:var(--panel);}
.ro{display:block;padding:0 8px;line-height:34px;color:var(--muted);font-size:.8rem;white-space:nowrap;}
.ro.num{text-align:right;font-family:'DM Mono',monospace;font-size:.78rem;}
/* A period's name, then its dates under it, so a week fits the card. */
.per{display:flex;flex-direction:column;justify-content:center;gap:1px;padding:4px 8px;min-height:34px;line-height:1.25;}
.per b{font-weight:600;font-size:.8rem;color:var(--text);white-space:nowrap;}
.per span{font-size:.72rem;color:var(--muted);white-space:nowrap;}
.name-cell{display:flex;align-items:center;padding-left:calc(var(--lvl,0) * 14px);}
.sheet tr.is-phase .cell[data-f="name"]{font-weight:700;}
.sheet tr.is-phase td{background:color-mix(in srgb,var(--text) 3%,var(--panel));}
.sheet tr.is-phase .ro{font-style:italic;font-size:.76rem;}
.row-del{width:28px;height:28px;margin:0 auto;}
.row-del .ico{width:15px;height:15px;}

.btn-add{display:block;width:100%;margin-top:8px;background:transparent;border:1.5px dashed var(--border);border-radius:var(--radius-md);padding:7px 10px;font-size:.8rem;font-weight:700;color:var(--muted);cursor:pointer;font-family:inherit;white-space:nowrap;transition:color var(--motion-fast),border-color var(--motion-fast);}
.btn-add:hover{border-color:var(--accent);color:var(--text);}

/* What an import said, or why it refused the file. */
.file-report{margin:0 0 12px;padding:10px 12px;border-radius:var(--radius-md);border:1px solid var(--border);background:var(--bg-subtle);font-size:.8rem;line-height:1.5;}
.file-report[hidden]{display:none;}
.file-report.ok{border-color:var(--positive-border);background:var(--positive-bg);}
.file-report.bad{border-color:var(--negative-border);background:var(--negative-bg);}
.file-report.warn{border-color:color-mix(in srgb,var(--warning-text) 40%,transparent);background:var(--warning-bg);}
.fr-head{display:flex;align-items:flex-start;justify-content:space-between;gap:10px;}
.fr-close{flex-shrink:0;margin:-4px -4px 0 0;}
.file-report ul{margin:6px 0 0;padding-left:18px;max-height:200px;overflow:auto;}
.file-report li{margin:2px 0;}

.checks{margin-top:16px;padding:10px 12px 8px;border:1px solid var(--border);border-radius:var(--radius-md);background:var(--bg-subtle);}
.checks[hidden]{display:none;}
.checks h4{margin:0 0 4px;}
.check-list{margin:0;padding-left:18px;font-size:.8rem;line-height:1.5;color:var(--muted);}
.check-list li{margin:3px 0;}
.check-list .ck-error{color:var(--negative-em);}
.check-list .ck-warn{color:var(--warning-text);}

/* ── The tables, enlarged: full screen, every column at full width ── */
.grid-modal-overlay{position:fixed;inset:0;z-index:1000;display:flex;padding:16px;background:rgba(7,12,24,.62);backdrop-filter:blur(2px);}
.grid-modal-overlay[hidden]{display:none;}
body.grid-modal-open{overflow:hidden;}
.grid-modal{display:flex;flex-direction:column;width:100%;height:100%;background:var(--panel);border:1px solid var(--border);border-radius:var(--radius-xl);box-shadow:0 18px 60px rgba(0,0,0,.45);overflow:hidden;}
.grid-modal-head{display:flex;align-items:center;gap:12px;padding:14px 16px 12px 20px;border-bottom:1px solid var(--border);}
.grid-modal-head h2{margin:0;font-size:1.05rem;min-width:0;overflow-wrap:anywhere;}
.grid-modal-head .grid-count{margin-right:auto;white-space:nowrap;}
.grid-modal-close{min-width:34px;height:34px;}
.grid-modal-close .ico{width:18px;height:18px;}
.grid-modal-body{flex:1 1 auto;min-height:0;display:flex;flex-direction:column;padding:16px 20px;overflow:auto;}
.grid-modal-body .data-shell{display:flex;flex-direction:column;min-height:0;flex:1 1 auto;}
.grid-modal-body .data-shell>*{flex:0 0 auto;}
.grid-modal-body .main-wrap{flex:0 1 auto;min-height:140px;max-height:none;}
.grid-modal-body .items-block,.grid-modal-body #readingsBlock{max-width:640px;}
.grid-modal-foot{display:flex;align-items:center;justify-content:flex-end;gap:12px;padding:10px 20px;border-top:1px solid var(--border);}
.grid-modal-note{margin-right:auto;font-size:.76rem;color:var(--muted);}
.grid-modal-foot .btn-primary{padding:8px 20px;flex-shrink:0;white-space:nowrap;}
.grid-modal table.dt{font-size:.86rem;}
.grid-modal .dt th{padding:9px 10px;font-size:.78rem;}
.grid-modal .cell{font-size:.86rem;padding:0 10px;}
.grid-modal .cell.num{font-size:.82rem;}
.grid-modal .sheet .c-num{width:40px;min-width:40px;}
.grid-modal .sheet .c-per{min-width:220px;}
.grid-modal .per{flex-direction:row;align-items:center;gap:6px;}
.grid-modal .per b::after{content:",";}
.grid-modal .per span{font-size:.8rem;}
.grid-modal .sheet .c-val{min-width:130px;width:136px;}
.grid-modal .sheet .c-sub{min-width:100px;width:104px;}
.grid-modal .sheet .c-item{min-width:200px;}
.grid-modal .sheet .c-iname{min-width:220px;width:240px;}
.grid-modal .sheet .c-wbs{width:66px;min-width:66px;}
.grid-modal .sheet .c-name{min-width:280px;width:320px;}
.grid-modal .sheet .c-date{min-width:136px;width:140px;}
.grid-modal .sheet .c-del{width:42px;min-width:42px;}
.grid-modal .name-cell{padding-left:calc(var(--lvl,0) * 18px);}

/* ── The answer ── */
.verdict{margin-bottom:18px;}
.metrics{grid-template-columns:repeat(5,minmax(0,1fr));}
.metric{padding:14px 16px;min-height:96px;}
.metric .label{display:flex;align-items:center;gap:5px;}
.metric .value{font-size:1.25rem;}
.metric .sub{margin-top:5px;color:var(--muted);font-size:.76rem;line-height:1.35;}
.metric.is-bad .value{color:var(--negative-em);}

.chart-card{padding:20px;margin-bottom:18px;}
.chart-opts{display:flex;flex-wrap:wrap;align-items:center;gap:10px 16px;margin:14px 0 6px;}
.chart-opts .opt{display:inline-flex;align-items:center;gap:7px;}
.chk-opt{cursor:pointer;font-size:.82rem;font-weight:600;color:var(--text);}
.chk-opt input{accent-color:var(--accent);width:15px;height:15px;cursor:pointer;margin:0;}
.legend{display:flex;gap:8px 18px;flex-wrap:wrap;margin:8px 0 12px;font-size:.84rem;}
.legend-item{display:flex;align-items:center;gap:7px;cursor:pointer;transition:opacity .15s;}
.legend-item.hidden{opacity:.4;}
.canvas-wrap{height:440px;}
.hover-box{margin-top:12px;color:var(--muted);font-size:.82rem;min-height:22px;line-height:1.5;}

.detail-section{padding:20px;margin-bottom:18px;}
.detail-head{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:8px 12px;margin-bottom:12px;}
.detail-head h2{margin:0;}
.table-wrap{overflow:auto;max-height:min(70vh,680px);border:1px solid var(--border);border-radius:var(--radius-md);}
.result-table{width:100%;}
.result-table thead th{position:sticky;top:0;z-index:2;background:color-mix(in srgb,var(--text) 4.5%,var(--panel));}
.result-table td{padding:8px 12px;height:auto;}
.result-table th{padding:9px 12px;}
.result-table .r-per{text-align:left;white-space:nowrap;}
.result-table td.r-num{text-align:right;font-family:'DM Mono',monospace;font-size:.8rem;white-space:nowrap;}
.result-table td.neg{color:var(--negative-em);}
.result-table tr.is-status td{background:color-mix(in srgb,var(--accent) 8%,var(--panel));font-weight:600;}
.result-table .r-empty{text-align:center;color:var(--muted);padding:18px;}

/* ── Narrower windows ── */
@media (max-width:1300px){
  .metrics{grid-template-columns:repeat(3,minmax(0,1fr));}
  .layout{grid-template-columns:420px minmax(0,1fr);}
}
@media (max-width:1100px){
  .layout{grid-template-columns:1fr;}
  .controls{position:static;max-height:none;}
  .main-wrap{max-height:min(70vh,560px);}
  .canvas-wrap{height:400px;}
}
@media (max-width:760px){
  h1{font-size:1.45rem;}
  .metrics{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;}
  .metric .value{font-size:1.08rem;}
  .canvas-wrap{height:340px;}
  .chart-card,.detail-section{padding:16px 14px;}
}
@media (max-width:600px){
  .container{padding:10px;}
  .page-footer{padding:0 10px 16px;}
  .ctrl-panel{padding:14px 12px 16px;}
  .grid-modal-overlay{padding:0;}
  .grid-modal{border-radius:0;border:0;}
  .grid-modal-head,.grid-modal-body,.grid-modal-foot{padding-left:12px;padding-right:12px;}
  .grid-modal-head .grid-count{display:none;}
  .grid-modal-head h2{margin-right:auto;}
  .grid-modal-note{display:none;}
  .grid-modal .sheet .c-per{min-width:150px;}
  .grid-modal .per{flex-direction:column;align-items:flex-start;gap:1px;}
  .grid-modal .per b::after{content:none;}
  .grid-modal .sheet .c-name{min-width:200px;width:220px;}
}
@media (max-width:480px){
  .seg-group.sc-seg .seg-btn{font-size:.76rem;padding:7px 4px;}
}

/* A date kept from before the cells were pickers that no day could be read
   from: its text shows in the cell, marked to fix. */
.cell.is-bad{box-shadow:inset 0 0 0 1.5px var(--negative);background:var(--negative-bg);}
.cell.is-bad~.sdate-show{color:var(--negative-em);font-style:normal;}
.cell.is-bad:focus{box-shadow:inset 0 0 0 2px var(--accent);}
.import-row{margin:0 0 10px;}
.grid-modal .per{justify-content:flex-start;}
