/* =====================================================================================================
   Rev. 9 (2026-10-21), easier to use for students: header order, labelled tools, fixed-width unit chips,
   start-up bar, tabbed left panel (Plant / Instructor), quiet alarm bar, Manual/Off/Auto wording,
   welcome screen and guided missions. Loaded after themes.css, before keycaps.css.
   ===================================================================================================== */

/* ---- header: unit controls | find / go to / plant | missions, learn | tools | link | E-STOP ---- */
header { gap: 8px; }
.hnav { display: flex; align-items: center; gap: 6px; }
.find input { width: 150px; }
select.views { max-width: 130px; }
.tools { gap: 4px; }
/* icon over a small label, so every tool says what it is */
button.tl { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-width: 48px; padding: 3px 6px 2px !important; line-height: 1; }
button.tl .ico { width: 16px !important; height: 16px !important; margin: 0 !important; }
button.tl span { font-size: 9.5px; letter-spacing: .02em; text-transform: none; font-family: inherit; white-space: nowrap; }
.theme-smh button.tl span { font: 500 8.5px "IBM Plex Mono", monospace; letter-spacing: .06em; text-transform: uppercase; }
.instr-only { display: none !important; }
body.instructor .instr-only { display: inline-flex !important; }
/* E-STOP on its own at the far right, away from Stop; it sticks to the edge so it can never scroll out of reach */
#estop { margin-left: 10px; position: sticky; right: 0; z-index: 2; flex: none; }
/* big UI (98" touch screen): the header is zoomed, so use the compact header whatever the window width */
body.big-ui header { gap: 6px; }
body.big-ui button.tl span { display: none; } body.big-ui button.tl { min-width: 34px; }
body.big-ui #conn { font-size: 0; padding: 4px 7px; }
body.big-ui .find input { width: 100px; } body.big-ui select.views { max-width: 100px; }
body.big-ui .pills { display: none; }
header .spacer { min-width: 4px; }
#conn { padding: 4px 8px; font-size: 11px; }

/* unit chips keep one width whatever the unit is doing; the dot carries the state */
.chip.train { width: 62px; display: inline-flex !important; align-items: center; justify-content: center; gap: 6px; padding-left: 6px !important; padding-right: 6px !important; }
.chip.train .sdot { width: 8px; height: 8px; border-radius: 50%; background: #6b7480; box-shadow: inset 0 1px 1px rgba(0,0,0,.4); flex: none; }
.chip.train.ok .sdot { background: #2fbf71; box-shadow: 0 0 5px #2fbf71aa; }
.chip.train.warn .sdot { background: #f0b31e; box-shadow: 0 0 5px #f0b31eaa; animation: sdot 1s ease-in-out infinite; }
@keyframes sdot { 50% { opacity: .45; } }
.theme-smh .chip.train::before { display: none; }

@media (max-width: 1600px) { #conn { font-size: 0; padding: 4px 7px; gap: 0; } #conn .ico { width: 11px; height: 11px; } }
@media (max-width: 1500px) { header { gap: 6px; padding: 0 8px; } .find input { width: 100px; } select.views { max-width: 100px; } #estop { margin-left: 4px; }
  button.missionhdr, button.learnhdr { padding-left: 9px !important; padding-right: 9px !important; } .hgroup { gap: 5px; }
  body.instructor button.tl span { display: none; } body.instructor button.tl { min-width: 34px; } }
@media (max-width: 1340px) { button.tl span { display: none; } button.tl { min-width: 34px; } .hnav button.tl span { display: none; } }

/* ---- start / stop sequence of the selected unit, under the header ---- */
.seqbar { position: fixed; top: 58px; left: 90px; z-index: 6; display: none; align-items: center; gap: 10px; flex-wrap: wrap; max-width: min(900px, calc(100vw - 40px));
  padding: 6px 12px; border-radius: 8px; background: #141920f2; border: 1px solid #3c4655; box-shadow: 0 6px 20px #0007; font-size: 12px; }
.seqbar.open { display: flex; }
.seqbar .sq-what { color: #9aa6b4; }
.seqbar ol { display: flex; gap: 4px; margin: 0; padding: 0; list-style: none; }
.seqbar li { padding: 3px 8px; border-radius: 999px; background: #222a33; color: #7f8b99; white-space: nowrap; }
.seqbar li.done { background: #1f5133; color: #9ff0bf; }
.seqbar li.done::before { content: "✓ "; }
.seqbar li.now { background: #5a4a1a; color: #ffd98a; animation: sdot 1.2s ease-in-out infinite; }
.seqbar .sq-msg { color: #ffd98a; } .seqbar .sq-msg.bad { color: #ffb3b6; font-weight: 600; }
.theme-scada .seqbar { background: var(--s-panel); border: 1px solid #000; border-radius: 1px; box-shadow: 3px 3px 0 #0006; font-family: "IBM Plex Mono", Consolas, monospace; }
.theme-scada .seqbar li { border-radius: 1px; background: var(--s-field); color: var(--s-dim); }
.theme-scada .seqbar li.done { background: #173d27; color: #8ef0b0; } .theme-scada .seqbar li.now { background: #f2c200; color: #000; }
.theme-smh .seqbar { background: var(--paper); border: 1px solid var(--line); border-top: 2px solid var(--teal); border-radius: 0; box-shadow: 0 12px 30px rgba(12,21,23,.14); color: var(--ink); font-family: "IBM Plex Mono", monospace; }
.theme-smh .seqbar .sq-what { color: var(--mute); }
.theme-smh .seqbar li { border-radius: 0; background: var(--paper2); color: var(--mute); font-size: 11px; }
.theme-smh .seqbar li.done { background: #d9f2ea; color: var(--teald); } .theme-smh .seqbar li.now { background: #fde7d6; color: #b4560d; }
.theme-smh .seqbar .sq-msg { color: #b4560d; }

/* ---- left panel: Plant overview, and the instructor station as a tab (it no longer covers the overview) ---- */
.kpi { width: 320px; max-height: calc(100% - 52px - 120px - 24px); transition: top .2s; }
body.seq-on .kpi { top: 106px; }
.kpi-title { align-items: center; gap: 6px; cursor: default; }
.ktabs { display: none; gap: 4px; flex: 1; min-width: 0; }
.ktitle { flex: 1; font-weight: 700; }
body.instructor .ktabs { display: flex; } body.instructor .ktitle { display: none; }
.ktab { padding: 5px 9px !important; font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.kcol { padding: 3px 6px !important; flex: none; }
.kpi.collapsed .kpi-pane, .kpi.collapsed .kpi-body { display: none; }
.kpi.tab-instructor .kpi-body { display: none; }
.kpi.tab-instructor { width: 340px; border-color: #6b4b0a; }
.kpi > .kpi-pane > #instructor.drawer { position: static; display: none; width: auto; max-height: none; overflow: visible; margin: 8px 0 0; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; }
.kpi > .kpi-pane > #instructor.drawer.open { display: block; }
.kpi > .kpi-pane > #instructor h3 { display: none; }
.kpi > .kpi-pane > #instructor h4:first-of-type { margin-top: 2px; }
.theme-scada .kpi-title .ktab { font-size: 11.5px; }
.theme-smh .kpi.tab-instructor { border-top-color: #b4560d; }

/* ---- alarm bar: one line when there is nothing to show ---- */
.al-head { gap: 10px; }
.alnone { color: #7f8b99; font-size: 12.5px; display: none; }
.alhint { color: #7f8b99; font-size: 11.5px; }
#ackall { margin-left: auto; }
#ackall[hidden] { display: none; }
body.al-quiet footer { height: 36px; }
body.al-quiet .al-list, body.al-quiet .alhint { display: none; }
body.al-quiet .alnone { display: inline; }
body.al-quiet #view { bottom: 36px; }
body.al-quiet .learn { bottom: 48px; }
body.al-quiet .kpi { max-height: calc(100% - 52px - 36px - 24px); }
body.big-ui.al-quiet #view { bottom: 47px; }
body.big-ui.al-quiet footer { height: 36px; }
.al { grid-template-columns: 74px 64px 1fr 104px; }
.al > span:nth-child(2) { font-weight: 600; }
.al > span:last-child { text-align: right; }

/* ---- faceplate: Manual / Off / Auto, and why START is locked ---- */
.modeseg button { padding: 5px 9px !important; font-size: 12px; }
.mhint { margin: 2px 0 8px; padding: 7px 9px; border-radius: 6px; font-size: 12px; line-height: 1.45; background: #10253dcc; border: 1px solid #2f5f95; color: #cfe3f8; }
.mhint.m-M { background: #3a300ecc; border-color: #8a6a12; color: #ffe2a8; }
.mhint button.mini { margin-left: 4px; padding: 3px 8px !important; font-size: 11.5px; vertical-align: 1px; }
.theme-scada .mhint { border-radius: 1px; background: var(--s-field); border-color: #000; color: var(--s-text); }
.theme-scada .mhint.m-M { color: #f2c200; }
.theme-smh .mhint { border-radius: 0; background: #e6f4f2; border-color: #b9dfda; color: var(--ink2); }
.theme-smh .mhint.m-M { background: #fdf0e4; border-color: #f3c9a1; }

/* ---- guided missions ---- */
.mission { position: fixed; left: 12px; bottom: 132px; width: 330px; max-height: calc(100% - 52px - 132px - 70px); overflow: auto; z-index: 8; display: none;
  background: #141920f5; border: 1px solid #f0b31e88; border-radius: 10px; padding: 12px 14px; box-shadow: 0 10px 30px #0009; }
.mission.open { display: block; }
body.al-quiet .mission { bottom: 48px; max-height: calc(100% - 52px - 48px - 70px); }
body.studio-on .mission, body.learning .mission { left: auto; right: 12px; }
.m-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.m-kicker { display: inline-flex; align-items: center; gap: 6px; color: #f0b31e; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.m-kicker .ico { width: 15px; height: 15px; }
.m-title { font-size: 17px; font-weight: 700; margin: 2px 0 8px; }
.m-intro { color: #9aa6b4; font-size: 12.5px; margin: 0 0 10px; }
.m-list { display: flex; flex-direction: column; gap: 8px; }
button.m-item { display: grid !important; grid-template-columns: 28px 1fr auto; align-items: center; gap: 10px; text-align: left; padding: 9px 10px !important; }
.m-num { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 12px; background: #0f1318; color: #f0b31e; }
.m-item.is-done .m-num { background: #1f5133; color: #9ff0bf; } .m-num .ico { width: 14px; height: 14px; }
.m-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; } .m-txt b { font-size: 13.5px; } .m-txt small { font-size: 11.5px; opacity: .75; line-height: 1.35; white-space: normal; }
.m-min { font-size: 11px; opacity: .7; white-space: nowrap; }
.m-now { background: #0f1318; border-radius: 8px; padding: 10px 11px; }
.m-stepno { color: #f0b31e; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.m-steptitle { font-size: 15px; font-weight: 700; margin: 2px 0 4px; }
.m-now p { margin: 0; font-size: 13px; line-height: 1.5; color: #cfd8e3; }
.m-live { margin-top: 8px; padding: 6px 8px; border-radius: 6px; background: #10253d; border: 1px solid #2f5f95; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.m-q { margin: 10px 0 6px; font-weight: 700; font-size: 13px; }
.m-opts { display: flex; flex-direction: column; gap: 8px; } .m-opts button { text-align: left; white-space: normal; line-height: 1.3; }
.m-fb { margin: 8px 0 0 !important; padding: 6px 8px; border-radius: 6px; }
.m-fb.ok { background: #1f5133; color: #c9f5da !important; } .m-fb.no { background: #5a2427; color: #ffd0d2 !important; }
.m-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; }
.m-win { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; background: #1f5133; color: #c9f5da; font-weight: 600; margin-bottom: 6px; }
.m-win .ico { width: 18px; height: 18px; }
.m-steps { margin: 10px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: #8b97a5; }
.m-steps li { display: flex; align-items: center; gap: 8px; } .m-steps li.done { color: #9ff0bf; } .m-steps li.now { color: #fff; font-weight: 600; }
.m-dot { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 10.5px; background: #222a33; flex: none; }
.m-steps li.done .m-dot { background: #1f5133; } .m-steps li.now .m-dot { background: #f0b31e; color: #000; } .m-dot .ico { width: 11px; height: 11px; }
.theme-scada .mission { background: var(--s-panel); border: 1px solid #000; border-top: 3px solid #f2c200; border-radius: 1px; box-shadow: 3px 3px 0 #0006; }
.theme-scada .m-now, .theme-scada .m-num, .theme-scada .m-live { background: var(--s-field); border-radius: 1px; } .theme-scada .m-live { border-color: #000; }
.theme-scada .m-kicker, .theme-scada .m-stepno { color: #f2c200; font-family: "IBM Plex Mono", Consolas, monospace; }
.theme-scada .m-title { font-family: "IBM Plex Mono", Consolas, monospace; text-transform: uppercase; font-size: 14px; letter-spacing: .04em; }
.theme-smh .mission { background: color-mix(in srgb, var(--paper) 97%, transparent); color: var(--ink); border: 1px solid var(--line); border-top: 3px solid var(--orange); border-radius: 0; box-shadow: 0 18px 40px rgba(12,21,23,.16); }
.theme-smh .m-kicker, .theme-smh .m-stepno { color: #b4560d; font-family: "IBM Plex Mono", monospace; font-weight: 500; }
.theme-smh .m-title, .theme-smh .m-steptitle { font-family: "Space Grotesk", sans-serif; letter-spacing: -.01em; }
.theme-smh .m-now { background: #fff; border: 1px solid var(--line); border-radius: 0; } .theme-smh .m-now p { color: var(--ink2); }
.theme-smh .m-live { background: var(--night); border: 0; border-radius: 0; color: var(--ntext); }
.theme-smh .m-intro, .theme-smh .m-steps { color: var(--mute); } .theme-smh .m-steps li.now { color: var(--ink); } .theme-smh .m-steps li.done { color: var(--teald); }
.theme-smh .m-num, .theme-smh .m-dot { background: var(--paper2); color: #b4560d; } .theme-smh .m-steps li.now .m-dot { background: var(--orange); color: #fff; }
.theme-smh .m-item.is-done .m-num, .theme-smh .m-steps li.done .m-dot { background: #d9f2ea; color: var(--teald); }
.theme-smh .m-win, .theme-smh .m-fb.ok { background: #d9f2ea; color: var(--teald) !important; border-radius: 0; } .theme-smh .m-fb.no { background: #fde7d6; color: #8a3a06 !important; border-radius: 0; }

/* the control to use next pulses (outline: keycaps own the box-shadow) */
.coach { outline: 3px solid #f0b31e !important; outline-offset: 3px; animation: coach 1.3s ease-in-out infinite; position: relative; z-index: 3; }
@keyframes coach { 50% { outline-color: #f0b31e33; outline-offset: 6px; } }
.coach-flash { animation: coach .45s ease-in-out 4; }
.theme-smh .coach { outline-color: var(--orange) !important; }
@media (prefers-reduced-motion: reduce) { .coach, .coach-flash, .chip.train.warn .sdot, .seqbar li.now { animation: none; } }

/* ---- welcome ---- */
.w-lead { color: #b8c3cf; margin: 6px 0 14px; font-size: 14px; }
.w-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.w-step { background: #1d242d; border: 1px solid #333d49; border-radius: 10px; padding: 14px; }
.w-step > b { display: block; font-size: 15px; margin: 8px 0 4px; } .w-step p { margin: 0; color: #b8c3cf; font-size: 13px; line-height: 1.5; }
.w-n { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #f0b31e; color: #000; font-weight: 800; }
.w-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
@media (max-width: 900px) { .w-steps { grid-template-columns: 1fr; } }
.theme-scada .w-step { background: var(--s-panel2); border: 1px solid #000; border-radius: 1px; } .theme-scada .w-n { border-radius: 1px; background: #f2c200; }
.theme-scada .w-lead, .theme-scada .w-step p { color: var(--s-dim); }
.theme-smh .w-step { background: #fff; border: 1px solid var(--line); border-radius: 0; } .theme-smh .w-n { background: var(--orange); color: #fff; border-radius: 0; }
.theme-smh .w-lead, .theme-smh .w-step p { color: var(--ink2); }
