/* Panels and dialogs: files, drive, start page, equations, material, mass properties, measure, section. Uses the tokens
   of app.css only, so both themes follow. */

/* ---------- shared bits ---------- */
.xpanel .body > .row, .modal .row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 6px 0; }
.xpanel .body > .row input[type=search] { flex: 1; }
.bad { color: var(--bad); }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 99px; background: var(--panel3); color: var(--text2); font-size: 11.5px; }
table.props { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.props td { padding: 4px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.props td:nth-child(2) { text-align: right; white-space: nowrap; }
table.props td:nth-child(3) { width: 1%; white-space: nowrap; }
table.props tr:last-child td { border-bottom: 0; }
table.tensor { border-collapse: collapse; font-size: 12.5px; margin: 4px 0 10px; }
table.tensor th { color: var(--text3); font-weight: 600; padding: 3px 10px; text-align: right; }
table.tensor td { padding: 3px 10px; text-align: right; border: 1px solid var(--line); }
.modal h4 { margin: 14px 0 6px; font-size: 12.5px; color: var(--text2); }
.modal h4:first-child { margin-top: 0; }
.modal p.note, .modal .note { font-size: 12px; color: var(--text3); margin: 8px 0 0; }
.seg button:disabled { opacity: .4; cursor: default; }

/* ---------- measure ---------- */
.mlines { margin: 8px 0; }
.mlines .mpicked { display: flex; gap: 4px; margin-bottom: 6px; }
.mlines .empty { padding: 10px; }
.mlabel { position: absolute; z-index: 6; transform: translate(-50%, -130%); padding: 3px 9px; border-radius: 7px; background: var(--accent); color: var(--accent-ink); font: 600 12px var(--mono); pointer-events: none; white-space: nowrap; box-shadow: 0 3px 12px rgba(0,0,0,.3); }
.xpanel .msg.error { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); }

/* ---------- section ---------- */
.xpanel input[type=range] { width: 100%; accent-color: var(--accent); }
.xpanel .seg { flex-wrap: wrap; }

/* ---------- equations ---------- */
.eqwrap { display: flex; flex-direction: column; gap: 8px; }
.eqtable { width: 100%; border-collapse: collapse; }
.eqtable th { text-align: left; font-size: 11.5px; font-weight: 600; color: var(--text3); padding: 0 4px 6px; }
.eqtable td { padding: 2px 4px; vertical-align: middle; }
.eqtable td:nth-child(1) { width: 18%; } .eqtable td:nth-child(2) { width: 30%; } .eqtable td:nth-child(3) { width: 22%; } .eqtable td:nth-child(5) { width: 1%; text-align: center; color: var(--text3); font-size: 12px; }
.eqtable input { width: 100%; }
.eqtable td.val { font-family: var(--mono); font-size: 12px; color: var(--ok); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.eqtable td.val.bad { color: var(--bad); white-space: normal; font-family: var(--font); }
.eqsum { flex: 1; font-size: 12px; display: flex; align-items: center; gap: 6px; } .eqsum .bad { display: inline-flex; gap: 6px; align-items: center; }

/* ---------- material ---------- */
.matdlg { display: flex; flex-direction: column; gap: 10px; }
.matcols { display: grid; grid-template-columns: minmax(200px, 1fr) 1.4fr; gap: 14px; min-height: 330px; }
.matlist { display: flex; flex-direction: column; gap: 2px; overflow: auto; max-height: 52vh; padding-right: 4px; }
.matitem { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid transparent; border-radius: 7px; background: transparent; text-align: left; }
.matitem:hover { background: var(--panel2); } .matitem.on { background: var(--sel); border-color: var(--accent); }
.sw { width: 14px; height: 14px; border-radius: 4px; flex: none; box-shadow: inset 0 0 0 1px rgba(0,0,0,.25); display: inline-block; }
.matdetail h4 { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); margin: 0 0 8px; }

/* ---------- appearance ---------- */
.swatches { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; margin: 4px 0 8px; }
.swatch { aspect-ratio: 1; border-radius: 7px; border: 1px solid var(--line2); padding: 0; }
.swatch.on { outline: 2px solid var(--accent); outline-offset: 2px; }
.appdlg .fld, .setdlg .fld, .expopts .fld { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.appdlg .fld > label, .setdlg .fld > label, .expopts .fld > label { font-size: 12px; color: var(--text2); }
.setdlg .fld.chk, .expopts .fld.chk { flex-direction: row; align-items: center; gap: 8px; }
.setdlg select { width: 100%; }
input[type=color] { width: 44px; height: 28px; padding: 0 2px; border: 1px solid var(--line2); border-radius: 6px; background: var(--bg2); }

/* ---------- keyboard sheet ---------- */
.keysheet { columns: 2 320px; column-gap: 24px; }
.keysheet section { break-inside: avoid; margin-bottom: 14px; }
.keysheet h4 { margin: 0 0 4px; }
table.keys { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.keys td { padding: 3px 4px; border-bottom: 1px solid var(--line); }
table.keys td:first-child { width: 46%; padding-right: 12px; }
table.keys kbd { display: inline-block; margin: 1px 0; }
table.keys kbd + kbd { margin-left: 4px; }

/* ---------- export ---------- */
.expdlg { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.explist { display: flex; flex-direction: column; gap: 4px; }
.expitem { display: grid; grid-template-columns: auto 1fr; gap: 0 8px; text-align: left; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg2); }
.expitem b { font-size: 13px; } .expitem span { font-family: var(--mono); font-size: 11.5px; align-self: center; }
.expitem small { grid-column: 1 / -1; color: var(--text3); font-size: 11.5px; }
.expitem:hover { border-color: var(--text3); } .expitem.on { border-color: var(--accent); background: var(--sel); }
.expopts h4 { font-size: 15px !important; color: var(--text) !important; }

/* ---------- Drive ---------- */
.drivelist { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.dcard { display: grid; grid-template-columns: 96px 1fr; gap: 9px; padding: 6px; border-radius: 9px; border: 1px solid var(--line); background: var(--bg2); cursor: pointer; }
.dcard:hover { border-color: var(--text3); } .dcard.cur { border-color: var(--accent); }
.dthumb { width: 96px; height: 60px; border-radius: 6px; overflow: hidden; display: grid; place-items: center; background: linear-gradient(var(--vp-bg-top), var(--vp-bg-bottom)); color: var(--text3); }
.dthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dinfo { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.dname { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.dname .badge { font-size: 10px; font-weight: 600; color: var(--accent); border: 1px solid var(--accent); border-radius: 99px; padding: 0 6px; }
.dmeta { font-size: 11px; color: var(--text3); }
.dacts { display: flex; gap: 0; margin-top: auto; } .dacts .ibtn { width: 26px; height: 26px; } .dacts svg.i { width: 15px; height: 15px; }
.drivefoot { font-size: 11.5px; color: var(--text2); padding: 10px 2px; }

/* ---------- Start page (over the viewport) ---------- */
.startpage { position: absolute; inset: 0; z-index: 20; overflow: auto; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); display: flex; justify-content: center; }
.sinner { width: min(1120px, 100%); padding: 26px 30px 40px; }
.shead { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 22px; }
.sbrand { flex: 1; display: flex; gap: 14px; align-items: center; }
.sbrand > svg.i { width: 46px; height: 46px; color: var(--accent); stroke-width: 1.4; }
.sbrand h2 { margin: 0; font-size: 26px; letter-spacing: .3px; } .sbrand h2 .deva { color: var(--text3); font-weight: 500; }
.sbrand p { margin: 2px 0 0; }
.scols { display: grid; grid-template-columns: 250px 1fr; gap: 30px; }
.sside { display: flex; flex-direction: column; gap: 6px; }
.startpage h4 { margin: 4px 0 6px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--text3); }
.sside h4:not(:first-child) { margin-top: 16px; }
.sbtn { display: flex; align-items: center; gap: 11px; text-align: left; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line2); background: var(--panel); color: var(--text); }
.sbtn span { display: flex; flex-direction: column; font-weight: 600; } .sbtn small { font-weight: 400; color: var(--text3); font-size: 11.5px; }
.sbtn:hover { border-color: var(--accent); } .sbtn svg.i { width: 20px; height: 20px; color: var(--accent); }
.sbtn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); } .sbtn.primary svg.i, .sbtn.primary small { color: var(--accent-ink); opacity: .85; }
.sbtn.sm { padding: 6px 10px; border-color: transparent; background: transparent; } .sbtn.sm:hover { background: var(--panel2); } .sbtn.sm span { font-weight: 500; }
.sside .stip { font-size: 12px; color: var(--text2); background: var(--panel2); border-radius: 9px; padding: 9px 11px; margin: 10px 0 4px; border-left: 3px solid var(--accent); }
.sshow { display: flex; gap: 8px; align-items: flex-start; font-size: 12px; color: var(--text2); margin-top: 6px; }
.exgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 26px; }
.excard { display: flex; flex-direction: column; gap: 4px; text-align: left; padding: 10px 12px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); color: var(--text); transition: transform .12s, border-color .12s; }
.excard:hover { border-color: var(--accent); transform: translateY(-2px); }
.excard svg { width: 100%; height: auto; aspect-ratio: 3 / 2; background: linear-gradient(var(--vp-bg-top), var(--vp-bg-bottom)); border-radius: 8px; margin-bottom: 6px;
  stroke: var(--text); fill: none; stroke-width: 1.3; stroke-linejoin: round; stroke-linecap: round; }
.excard svg .a { stroke: var(--accent); } .excard svg .fa { fill: var(--accent); stroke: none; }
.excard b { font-size: 13.5px; } .excard small { color: var(--text3); font-size: 11.5px; line-height: 1.35; }
.srecent { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.rcard { display: flex; flex-direction: column; gap: 3px; text-align: left; padding: 6px 6px 8px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--text); min-width: 0; }
.rcard:hover { border-color: var(--accent); }
.rcard b { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rthumb { display: grid; place-items: center; aspect-ratio: 16 / 10; border-radius: 7px; overflow: hidden; background: linear-gradient(var(--vp-bg-top), var(--vp-bg-bottom)); color: var(--text3); }
.rthumb img { width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 900px) { .scols { grid-template-columns: 1fr; } .expdlg, .matcols { grid-template-columns: 1fr; } }

/* files dragged over the window */
html.dropping #viewport { outline: 3px dashed var(--accent); outline-offset: -8px; }
