/* SgXl (sg_xl.js): Excel inside the Spherography lessons. sgx- classes only (all /assets stylesheets load on every
   page). The grid looks like the real thing on purpose (white sheet, grey headers, green selection): the students
   move between this page and Excel. The drill and the marks inside a lesson's text keep the map's dark look. */

.sgx { --xg: #107c41; position: relative; display: block; width: 100%; min-width: 0; overflow: hidden; outline: none; border-radius: 10px;
  border: 1px solid rgba(255,255,255,.2); background: #fff; color: #1f1f1f; box-shadow: 0 6px 22px rgba(0,0,0,.4);
  font-family: "Segoe UI", Calibri, system-ui, sans-serif; font-size: 13px; line-height: 1.25; user-select: none; }
.sgx *, .sgx *::before, .sgx *::after { box-sizing: border-box; }
.sgx:focus-visible { border-color: #7fe0a8; }

/* name box + formula bar */
.sgx .sgx-bar { display: flex; align-items: stretch; min-height: 28px; background: #f3f3f3; border-bottom: 1px solid #d4d4d4; }
.sgx .sgx-name { flex: 0 0 58px; display: flex; align-items: center; justify-content: center; background: #fff; border-right: 1px solid #d4d4d4; font-size: 12px; color: #333; }
.sgx .sgx-fx { flex: 0 0 34px; display: flex; align-items: center; justify-content: center; border-right: 1px solid #d4d4d4; color: #777; font-family: Cambria, Georgia, serif; font-size: 13px; }
.sgx .sgx-fx i { font-style: italic; }
.sgx .sgx-ftxt { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; padding: 3px 9px; background: #fff; color: #111; white-space: nowrap; overflow-x: auto;
  font-family: Consolas, "Cascadia Mono", "SF Mono", monospace; font-size: 12.5px; user-select: text; scrollbar-width: thin; }
.sgx .sgx-ftxt b { font-weight: 600; }
.sgx .sgx-hint { color: #8a8a8a; font-family: "Segoe UI", system-ui, sans-serif; font-style: italic; }

/* the grid */
.sgx .sgx-wrap { overflow: auto; max-height: min(54vh, 500px); background: #fff; scrollbar-width: thin; }
.sgx .sgx-grid { border-collapse: separate; border-spacing: 0; table-layout: fixed; width: max-content; min-width: 100%; margin: 0; }
.sgx .sgx-grid col.sgx-rn { width: 34px; }
.sgx .sgx-grid th { position: sticky; top: 0; z-index: 2; height: 20px; padding: 0; background: #f3f3f3; color: #555; font-weight: 400; font-size: 11.5px; text-align: center;
  border-right: 1px solid #d4d4d4; border-bottom: 1px solid #c8c8c8; }
.sgx .sgx-grid tbody th { top: auto; left: 0; z-index: 1; }
.sgx .sgx-grid th.sgx-corner { left: 0; z-index: 3; }
.sgx .sgx-grid th.on { background: #d8e9df; color: #0b5c30; font-weight: 600; }
.sgx .sgx-grid td { position: relative; height: 22px; padding: 1px 6px; border-right: 1px solid #e3e3e3; border-bottom: 1px solid #e3e3e3; background: #fff; color: #1f1f1f;
  white-space: nowrap; overflow: hidden; font-variant-numeric: tabular-nums; cursor: cell; }
.sgx .sgx-grid td.n { text-align: right; }
.sgx .sgx-grid td.t { text-align: left; }
.sgx .sgx-grid td.s-h { overflow: visible; font-weight: 700; font-size: 13.5px; color: #1f4e79; border-right-color: transparent; }
.sgx .sgx-grid td.s-th { height: auto; padding: 3px 5px; background: #f2f2f2; font-weight: 700; text-align: center; white-space: normal; line-height: 1.15; border-bottom: 1px solid #7f7f7f; }
.sgx .sgx-grid td.s-tot { font-weight: 700; }
.sgx .sgx-grid td.n.s-tot { border-top: 1px solid #555; }
.sgx .sgx-grid td.in { background: #fff2cc; color: #0000c0; cursor: text; }
.sgx .sgx-grid td.in.chg { background: #ffe08a; }
.sgx .sgx-grid td.err { color: #c00000; }
.sgx .sgx-grid td.sel { box-shadow: inset 0 0 0 2px var(--xg) !important; }
.sgx .sgx-grid td.flash { animation: sgx-flash .8s ease-out; }
@keyframes sgx-flash { 0% { background: #a9e5bd; } }
.sgx .sgx-grid.formulas td.f { text-align: left; font-family: Consolas, "Cascadia Mono", monospace; font-size: 12px; color: #111; }
.sgx .sgx-grid td.edit { padding: 0 4px; background: #fff; box-shadow: inset 0 0 0 2px var(--xg) !important; }
.sgx .sgx-grid td input.sgx-in, .sgx .sgx-grid td select.sgx-in { width: 100%; height: 20px; margin: 0; padding: 0; border: 0; border-radius: 0; outline: 0; background: transparent;
  color: #0000c0; font: inherit; font-size: 13px; text-align: right; }     /* (the selectors outweigh the app's own dark form controls) */
.sgx .sgx-grid td select.sgx-in, .sgx .sgx-grid td input[type=date].sgx-in { text-align: left; }

/* the strip under the grid */
.sgx .sgx-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px 8px; background: #f3f3f3; border-top: 1px solid #d4d4d4; color: #444; font-size: 12px; }
.sgx .sgx-b, .sgx-drill .sgx-b { display: inline-flex; align-items: center; gap: 6px; height: 26px; margin: 0; padding: 0 10px; border-radius: 6px; border: 1px solid #c8c8c8; background: #fff;
  color: #222; font: inherit; font-size: 12px; line-height: 1; cursor: pointer; text-decoration: none; white-space: nowrap; }
.sgx .sgx-b:hover { border-color: var(--xg); color: #0b5c30; }
.sgx .sgx-b.on, .sgx .sgx-b.acc { background: var(--xg); border-color: var(--xg); color: #fff; }
.sgx .sgx-sp { flex: 1 1 auto; }
.sgx .sgx-lab { color: #666; }
.sgx .sgx-seg { display: inline-flex; overflow: hidden; border: 1px solid #c8c8c8; border-radius: 6px; }
.sgx .sgx-seg button { height: 24px; margin: 0; padding: 0 8px; border: 0; border-right: 1px solid #e0e0e0; background: #fff; color: #333; font: inherit; font-size: 11.5px; cursor: pointer; white-space: nowrap; }
.sgx .sgx-seg button:last-child { border-right: 0; }
.sgx .sgx-seg button.on { background: var(--xg); color: #fff; }

/* Goal Seek: Excel's dialog */
.sgx .sgx-gs { position: absolute; inset: 0; z-index: 5; display: none; align-items: center; justify-content: center; background: rgba(255,255,255,.5); }
.sgx .sgx-gs.on { display: flex; }
.sgx .sgx-gs-card { width: 312px; max-width: calc(100% - 16px); padding: 0 14px 12px; border-radius: 8px; border: 1px solid #8a8a8a; background: #f0f0f0; color: #1f1f1f; font-size: 12.5px;
  box-shadow: 0 12px 34px rgba(0,0,0,.35); user-select: text; }
.sgx .sgx-gs-h { display: flex; align-items: center; justify-content: space-between; margin: 0 -14px 8px; padding: 7px 8px 7px 14px; border-radius: 8px 8px 0 0; border-bottom: 1px solid #d0d0d0; background: #fff; font-weight: 600; }
.sgx .sgx-gs-x { width: 24px; height: 22px; border: 0; background: transparent; color: #555; font-size: 16px; line-height: 1; cursor: pointer; }
.sgx .sgx-gs-x:hover { background: #e81123; color: #fff; }
.sgx .sgx-gs-path { margin-bottom: 8px; color: #666; font-size: 11px; }
.sgx .sgx-gs-card label { display: flex; align-items: center; gap: 8px; margin: 0 0 7px; font-weight: 400; }
.sgx .sgx-gs-card label span { flex: 0 0 126px; }
.sgx .sgx-gs-card label input { flex: 1 1 auto; width: auto; min-width: 0; height: 24px; padding: 0 6px; border: 1px solid #adadad; border-radius: 0; background: #fff; color: #111;
  font: inherit; font-size: 12.5px; }
.sgx .sgx-gs-card label input:focus { border-color: var(--xg); }
.sgx .sgx-gs-card label input[readonly] { background: #f7f7f7; color: #333; }
.sgx .sgx-gs-msg { min-height: 36px; margin: 4px 0 8px; font-size: 12px; line-height: 1.4; }
.sgx .sgx-gs-msg b { color: #0b5c30; }
.sgx .sgx-gs-b { display: flex; justify-content: flex-end; gap: 8px; }
.sgx .sgx-gs-b button { min-width: 78px; height: 26px; border-radius: 4px; border: 1px solid #adadad; background: #e1e1e1; color: #111; font: inherit; cursor: pointer; }
.sgx .sgx-gs-b .sgx-gs-ok { border-color: var(--xg); box-shadow: inset 0 0 0 1px var(--xg); }

/* "Your turn in Excel" */
.sgx-drill { margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: rgba(16,124,65,.12); border: 1px solid rgba(60,190,120,.45); color: #e8e8e8;
  font-family: "Segoe UI", system-ui, sans-serif; user-select: text; }
.sgx-drill *, .sgx-drill *::before, .sgx-drill *::after { box-sizing: border-box; }
.sgx-drill .sgx-d-h { margin-bottom: 6px; color: #7fe0a8; font-size: .7rem; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.sgx-drill .sgx-d-h em { margin-left: 8px; font-style: normal; color: #b5f5c8; text-transform: none; letter-spacing: 0; }
.sgx-drill .sgx-d-q { color: #fff; font-size: .92rem; line-height: 1.5; }
.sgx-drill .sgx-d-q b { color: #ffe7a8; }
.sgx-drill .sgx-d-a { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.sgx-drill .sgx-d-a input.sgx-d-in { flex: 0 0 170px; width: 170px; height: 32px; padding: 0 10px; border-radius: 8px; border: 1px solid rgba(255,255,255,.25); background: rgba(0,0,0,.35);
  color: #fff; font: inherit; font-size: .95rem; font-variant-numeric: tabular-nums; }
.sgx-drill .sgx-d-a input.sgx-d-in:focus { outline: none; border-color: #7fe0a8; }
.sgx-drill .sgx-d-u { margin-left: -3px; color: #9fb3c8; }
.sgx-drill .sgx-b { height: 32px; background: rgba(255,255,255,.07); border-color: rgba(255,255,255,.2); color: #e8e8e8; font-size: .8rem; }
.sgx-drill .sgx-b:hover { border-color: #7fe0a8; }
.sgx-drill .sgx-b.acc { background: #1f9d57; border-color: #1f9d57; color: #fff; font-weight: 600; }
.sgx-drill .sgx-b:disabled { opacity: .5; cursor: default; }
.sgx-drill .sgx-d-r { margin-top: 8px; }
.sgx-drill .sgx-d-msg { padding: 8px 10px; border-radius: 9px; font-size: .84rem; line-height: 1.45; }
.sgx-drill .sgx-d-msg.ok { background: rgba(63,191,127,.14); border: 1px solid rgba(63,191,127,.45); }
.sgx-drill .sgx-d-msg.ok b { color: #8ff0b4; }
.sgx-drill .sgx-d-msg.ko { background: rgba(230,103,103,.1); border: 1px solid rgba(230,103,103,.4); }
.sgx-drill .sgx-d-msg.ko b { color: #ffaaa3; }
.sgx-drill .sgx-d-sol { margin-top: 8px; color: #dfe7ee; font-size: .84rem; line-height: 1.6; }
.sgx-drill .sgx-d-sol b { color: #fff; }

/* a formula and a word of Excel's interface inside a lesson's text */
code.sgx-f { padding: 1px 5px; border-radius: 5px; background: rgba(60,190,120,.14); border: 1px solid rgba(60,190,120,.35); color: #c9f5da;
  font-family: Consolas, "Cascadia Mono", "SF Mono", monospace; font-size: .92em; overflow-wrap: anywhere; }
.sgx-ui { color: #c9f5da; font-weight: 650; }

@media (prefers-reduced-motion: reduce) { .sgx .sgx-grid td.flash { animation: none; } }
