/* SCC dispatch position. The CAD half is a Windows-classic dispatch application (grey chrome,
   bevelled buttons, dense colour-coded grids, menu bar, toolbar and a command line), the radio half
   an MCC 7500 Elite style console. Sizes are in rem off a root that follows the screen width:
   1920 wide is 12 px. */

:root {
  --face: #d4d0c8;
  --face2: #e4e1db;
  --hi: #ffffff;
  --lite: #dfdfdf;
  --shadow: #808080;
  --dark: #404040;
  --win: #ffffff;
  --text: #000000;
  --gray: #6b6b6b;
  --navy: #0a246a;
  --navy2: #a6caf0;
  --sel: #0a246a;
  --grid: #d8d8d8;

  /* row colours */
  --p1: #ff8f8f; --p2: #ffc58a; --p3: #fff38a; --p4: #ffffff;
  --st-avail: #b8f0b0;
  --st-enrt: #fff27a;
  --st-scene: #ffb3a0;
  --st-busy: #d8cdf0;
  --st-trans: #a8e6ef;
  --st-off: #c8c8c8;
  --em: #ff2020;

  /* radio console */
  --rc-bg: #2f343c;
  --rc-bar: #444b55;
  --rc-tile: #c5c9cf;
  --rc-head: #1d4c8c;
  --rc-rx: #35c24a;
  --rc-tx: #e02424;

  --ui: Tahoma, 'Segoe UI', Verdana, Arial, sans-serif;
  --grid-font: Arial, Tahoma, sans-serif;
  --mono: 'Lucida Console', 'Courier New', monospace;

  --raised: inset -1px -1px var(--dark), inset 1px 1px var(--hi), inset -2px -2px var(--shadow), inset 2px 2px var(--lite);
  --sunken: inset 1px 1px var(--shadow), inset -1px -1px var(--hi), inset 2px 2px var(--dark), inset -2px -2px var(--lite);
  --pressed: inset 1px 1px var(--dark), inset -1px -1px var(--hi), inset 2px 2px var(--shadow), inset -2px -2px var(--lite);
}

* { box-sizing: border-box; }
html { font-size: clamp(9px, calc(100vw / 1920 * 12), 15px); }
html, body { margin: 0; height: 100%; overflow: hidden; background: transparent; color: var(--text); font-family: var(--ui); font-size: 1rem; user-select: none; }
button { font: inherit; color: inherit; cursor: default; }
input, textarea, select { font: inherit; color: inherit; }
::-webkit-scrollbar { width: 1.3rem; height: 1.3rem; background: #ece9e3; }
::-webkit-scrollbar-thumb { background: var(--face); box-shadow: var(--raised); }
::-webkit-scrollbar-track { background: repeating-conic-gradient(#d4d0c8 0 25%, #ffffff 0 50%) 0 0 / 2px 2px; }
::-webkit-scrollbar-corner { background: var(--face); }

.layer { position: fixed; inset: 0; display: none; }
body.show-signon #signon { display: flex; }
body.show-app #app { display: flex; }

/* ------------------------------------------------------------------ chrome */
.tb { display: flex; align-items: center; gap: 0.4rem; height: 1.6rem; padding: 0 0.15rem 0 0.35rem; background: linear-gradient(90deg, #808080, #c0c0c0); color: #d4d0c8; font-weight: bold; font-size: 0.95rem; white-space: nowrap; flex: 0 0 auto; }
.tb.active, .win.focus > .tb { background: linear-gradient(90deg, var(--navy), var(--navy2)); color: #fff; }
.tb-t { overflow: hidden; text-overflow: ellipsis; }
.tb-ico { font-family: var(--mono); font-size: 0.7rem; padding: 0 0.2rem; border: 1px solid currentColor; letter-spacing: 0.05em; }
.tb-c { font-weight: normal; padding: 0 0.35rem; background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.35); }
.tb-btns { margin-left: auto; display: flex; gap: 2px; }
.tb-btns b { width: 1.35rem; height: 1.15rem; display: grid; place-items: center; background: var(--face); color: #000; box-shadow: var(--raised); font-size: 0.75rem; }
.tb-btns b:active { box-shadow: var(--pressed); }
.tb-btns b.dis { color: var(--shadow); }
.tb-tabs { margin-left: auto; display: flex; gap: 2px; }
.tb-tabs b { font-weight: normal; padding: 0 0.5rem; height: 1.2rem; line-height: 1.2rem; background: var(--face); color: #000; box-shadow: var(--raised); font-size: 0.85rem; }
.tb-tabs b.on { box-shadow: var(--pressed); background: #eeebe5; font-weight: bold; }
.tb-find { margin-left: auto; font-weight: normal; display: flex; align-items: center; gap: 0.3rem; }
.tb-find input { width: 8rem; height: 1.2rem; }

.tx { height: 1.65rem; padding: 0 0.3rem; background: var(--win); border: 0; box-shadow: var(--sunken); outline: none; user-select: text; font-size: 1rem; }
.tx:disabled { background: var(--face); color: var(--gray); }
textarea.tx { height: auto; padding: 0.3rem; resize: vertical; }
select.tx { padding: 0 0.1rem; }
.b { min-width: 6.3rem; height: 1.9rem; padding: 0 0.8rem; background: var(--face); border: 0; box-shadow: var(--raised); }
.b:active:not(:disabled) { box-shadow: var(--pressed); }
.b:focus-visible { outline: 1px dotted #000; outline-offset: -4px; }
.b.def { box-shadow: 0 0 0 1px #000, var(--raised); }
.b:disabled { color: var(--shadow); text-shadow: 1px 1px #fff; }
.b.sm { min-width: 0; height: 1.5rem; padding: 0 0.5rem; font-size: 0.9rem; }
/* inside a grid row: Force ACK on a sent unit */
.b.xs { min-width: 0; height: 1.2rem; padding: 0 0.35rem; font-size: 0.8rem; line-height: 1; font-family: var(--ui); font-style: normal; color: #000; }

/* ------------------------------------------------------------------ sign-on */
#signon { align-items: center; justify-content: center; background: #3a6ea5; }
.dlg { background: var(--face); box-shadow: var(--raised), 2px 2px 0 rgba(0,0,0,.35); padding: 3px; display: flex; flex-direction: column; }
.so-dlg { width: 40rem; }
.dlg-body { padding: 0.8rem 0.9rem 0.3rem; display: flex; flex-direction: column; gap: 0.6rem; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 0.5rem; padding: 0.4rem 0.9rem 0.8rem; }
.so-banner { display: flex; align-items: center; gap: 0.8rem; padding: 0.6rem; background: #fff; box-shadow: var(--sunken); }
.so-mark { width: 3.6rem; height: 3.6rem; display: grid; place-items: center; background: var(--navy); color: #fff; font-family: var(--mono); font-weight: bold; font-size: 1.1rem; letter-spacing: 0.08em; }
.so-title { font-size: 1.35rem; font-weight: bold; }
.so-sub { color: var(--gray); }
fieldset.grp { margin: 0; padding: 0.4rem 0.6rem 0.6rem; border: 1px solid var(--shadow); box-shadow: 1px 1px 0 var(--hi), inset 1px 1px 0 var(--hi); }
fieldset.grp legend { padding: 0 0.25rem; }
.so-agencies { display: flex; flex-direction: column; gap: 0.15rem; background: #fff; box-shadow: var(--sunken); padding: 3px; max-height: 12rem; overflow-y: auto; }
.so-ag > * { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.so-ag { display: grid; grid-template-columns: 4.5rem minmax(0, 1fr) 6rem 9rem; gap: 0.5rem; text-align: left; padding: 0.15rem 0.35rem; border: 0; background: transparent; align-items: center; }
.so-ag b { font-family: var(--mono); }
.so-ag small { color: var(--gray); font-size: 0.9rem; }
.so-ag small.taken { color: #a00000; }
.so-ag.on { background: var(--sel); color: #fff; }
.so-ag.on small { color: #cfd8ff; }
.frow { display: flex; align-items: center; gap: 0.4rem; }
.frow label { white-space: nowrap; }
.frow .tx { flex: 1; min-width: 0; }
.so-error { min-height: 1.3rem; color: #c00000; }

/* ------------------------------------------------------------------ application frame */
#app { flex-direction: column; background: var(--face); box-shadow: var(--raised); padding: 2px; }
.menubar { display: flex; height: 1.65rem; align-items: stretch; padding: 0 0.2rem; flex: 0 0 auto; }
.menubar span { padding: 0 0.6rem; display: flex; align-items: center; }
.menubar span:hover, .menubar span.on { background: var(--sel); color: #fff; }
.toolbar { display: flex; align-items: center; gap: 2px; padding: 0.15rem 0.2rem; border-top: 1px solid var(--shadow); border-bottom: 1px solid var(--shadow); box-shadow: inset 0 1px var(--hi), 0 1px var(--hi); flex: 0 0 auto; }
.tbb { display: flex; align-items: center; gap: 0.35rem; height: 1.95rem; padding: 0 0.55rem; border: 0; background: transparent; }
.tbb:hover { box-shadow: inset -1px -1px var(--shadow), inset 1px 1px var(--hi); }
.tbb:active { box-shadow: inset 1px 1px var(--shadow), inset -1px -1px var(--hi); }
.tbb i { font-style: normal; color: var(--gray); font-size: 0.8rem; }
.tsep { width: 2px; height: 1.6rem; margin: 0 0.25rem; border-left: 1px solid var(--shadow); border-right: 1px solid var(--hi); }
.cmd-l { margin-left: 0.2rem; font-weight: bold; }
.cmd { flex: 1; min-width: 12rem; font-family: var(--mono); text-transform: uppercase; height: 1.75rem; }
.cmd::placeholder { text-transform: none; color: #999; font-family: var(--ui); }

#desk {
  flex: 1; min-height: 0; display: grid; gap: 3px; padding: 3px 1px;
  grid-template-columns: minmax(0, 1.32fr) minmax(0, 1fr);
  grid-template-rows: minmax(0, 0.92fr) minmax(0, 0.92fr) minmax(0, 1.45fr);
  grid-template-areas: 'pend units' 'act units' 'det map';
}
#wPending { grid-area: pend; } #wActive { grid-area: act; } #wDetail { grid-area: det; } #wUnits { grid-area: units; } #wMap { grid-area: map; }
.win { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--face); box-shadow: var(--raised); padding: 3px; }
.grid-wrap { flex: 1; min-height: 0; overflow: auto; background: var(--win); box-shadow: var(--sunken); padding: 2px; margin-top: 2px; }

/* ------------------------------------------------------------------ grids */
.grid { width: 100%; border-collapse: collapse; table-layout: fixed; font-family: var(--grid-font); font-size: 0.98rem; }
.grid th { position: sticky; top: 0; z-index: 1; height: 1.55rem; padding: 0 0.3rem; text-align: left; font-weight: normal; background: var(--face); box-shadow: var(--raised); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: var(--ui); }
.grid td { height: 1.5rem; padding: 0 0.3rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-right: 1px solid var(--grid); border-bottom: 1px solid var(--grid); }
.grid td.m { font-family: var(--mono); font-size: 0.92rem; }
.grid td.c { text-align: center; }
.grid td.b { font-weight: bold; }
.grid tr[data-call], .grid tr[data-unit] { cursor: default; }
.grid tr.p1 td { background: var(--p1); }
.grid tr.p2 td { background: var(--p2); }
.grid tr.p3 td { background: var(--p3); }
.grid tr.st-avail td { background: var(--st-avail); }
.grid tr.st-enrt td { background: var(--st-enrt); }
.grid tr.st-scene td { background: var(--st-scene); }
.grid tr.st-busy td { background: var(--st-busy); }
.grid tr.st-trans td { background: var(--st-trans); }
.grid tr.st-off td { background: var(--st-off); }
.grid tr.closed td { color: #555; background: #f2f2f2; }
.grid tr.sel td { background: var(--sel) !important; color: #fff !important; }
.grid tr.drop td { background: #0a6a1e !important; color: #fff !important; }
.grid tr.em td { animation: emrow 0.7s steps(2) infinite; }
.grid tr.dragging td { opacity: .5; }
.grid td .late { color: #c00000; font-weight: bold; }
.grid td .later { color: #c00000; font-weight: bold; animation: blink 0.8s steps(2) infinite; }
.grid tr.sel td .late, .grid tr.sel td .later { color: #ffd0d0; }
.grid .h { font-weight: bold; text-decoration: underline; }
/* sent to an LASD unit that has not pressed ACK yet */
.grid .sent { color: #7a5a00; font-style: italic; }
.grid tr.sel .sent { color: #ffe9a8; }
.grid tr.sent-row td { color: #7a5a00; font-style: italic; background: #fffbe6; }
.grid .noradio { color: #8a8a8a; }
.grid .txing { background: #0a7a1e; color: #fff; padding: 0 0.25rem; }
.grid .sup { font-size: 0.8rem; color: #8a5a00; font-weight: bold; }
.grid-empty td { color: var(--gray); text-align: center; height: 3rem; background: #fff !important; border: 0; font-style: italic; }

/* ------------------------------------------------------------------ incident detail */
#detail { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 3px; padding-top: 3px; }
.d-none { flex: 1; display: grid; place-items: center; color: var(--gray); background: var(--win); box-shadow: var(--sunken); text-align: center; line-height: 1.7; padding: 1rem; }
.d-form { display: grid; grid-template-columns: 4.6rem minmax(0, 1fr) 4.6rem minmax(0, 1fr) 4rem minmax(0, 0.8fr); gap: 2px 0.4rem; align-items: center; }
.d-form label { text-align: right; white-space: nowrap; color: #000; }
.fv { height: 1.5rem; line-height: 1.5rem; padding: 0 0.3rem; background: var(--win); box-shadow: var(--sunken); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; user-select: text; font-family: var(--grid-font); }
.fv.m { font-family: var(--mono); font-size: 0.92rem; }
.fv.pri { font-weight: bold; text-align: center; }
.fv.wide { grid-column: span 3; }
.d-lower { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.4fr); gap: 4px; }
.d-col { display: flex; flex-direction: column; min-height: 0; }
.d-cap { font-weight: bold; padding: 0.1rem 0; display: flex; align-items: center; gap: 0.4rem; }
.d-cap small { font-weight: normal; color: var(--gray); }
.d-col .grid-wrap { margin-top: 0; }
.d-col .grid-wrap.drop { box-shadow: var(--sunken), inset 0 0 0 3px #0a7a1e; }
.d-hint { color: var(--gray); text-align: center; padding: 0.4rem; font-style: italic; }
.d-rmk { display: flex; gap: 3px; margin-top: 3px; }
.d-rmk .tx { flex: 1; min-width: 0; text-transform: uppercase; }
.d-btns { display: flex; gap: 3px; flex-wrap: wrap; }
.nar td.t { color: #333; }
.nar td.a { color: #0a246a; font-weight: bold; }
.nar tr.log td { color: #555; }
/* a remark wraps onto as many lines as it needs: the whole 911 narrative is on the screen, not
   cut at the column edge */
.grid.nar td { height: auto; min-height: 1.5rem; padding-top: 0.15rem; padding-bottom: 0.15rem; line-height: 1.2rem; vertical-align: top; }
.grid.nar td:last-child { white-space: pre-wrap; overflow-wrap: anywhere; text-overflow: clip; user-select: text; }

/* ------------------------------------------------------------------ map */
#mapWrap { position: relative; flex: 1; min-height: 0; margin-top: 2px; box-shadow: var(--sunken); background: #8ab4d4; overflow: hidden; }
#map { position: absolute; inset: 2px; width: calc(100% - 4px); height: calc(100% - 4px); cursor: default; }
#map.drag { cursor: move; }
#map.pick { cursor: crosshair; }
.map-pick { display: none; position: absolute; top: 0.5rem; left: 50%; transform: translateX(-50%); padding: 0.25rem 0.6rem; background: #ffffe1; border: 1px solid #000; font-size: 0.95rem; }
#mapWrap.picking .map-pick { display: block; }
.map-nodata { display: none; position: absolute; inset: 0; align-items: center; justify-content: center; color: #333; pointer-events: none; }
.map-nodata.on { display: flex; }

/* ------------------------------------------------------------------ radio console (MCC 7500 Elite style) */
/* fixed height: min-height 0 + overflow hidden stop the Activity Log's lines from growing the panel up over the desk */
#radio { flex: 0 0 15.8rem; min-height: 0; overflow: hidden; display: flex; flex-direction: column; background: var(--rc-bg); box-shadow: var(--sunken); padding: 2px; margin: 1px 1px 2px; color: #e8ecf1; }
.rc-bar { display: flex; align-items: center; gap: 3px; height: 2.15rem; padding: 0 0.3rem; background: var(--rc-bar); border-bottom: 1px solid #22262c; flex: 0 0 auto; }
.rc-name { font-weight: bold; padding-right: 0.4rem; }
.rc-sys { font-family: var(--mono); color: #b5c3d4; font-size: 0.9rem; padding-right: 0.6rem; border-right: 1px solid #2b3036; margin-right: 0.3rem; }
.eb { height: 1.7rem; padding: 0 0.65rem; border: 1px solid #1f2328; background: linear-gradient(#6a7380, #4c545f); color: #f0f3f6; border-radius: 2px; box-shadow: inset 0 1px rgba(255,255,255,.22); white-space: nowrap; font-size: 0.92rem; }
.eb:hover { background: linear-gradient(#77818f, #565f6b); }
.eb:active, .eb.on { background: linear-gradient(#2d6fd0, #1d4c8c); border-color: #0f2a52; }
.eb.live { background: linear-gradient(#ef3a3a, #b11515); border-color: #6a0b0b; }
.eb.alarm { background: linear-gradient(#ff4a4a, #c41616); animation: blink 0.8s steps(2) infinite; }
.rc-folders { display: flex; gap: 2px; margin-left: 0.6rem; }
.rc-folders .eb { padding: 0 0.5rem; }
.rc-sel { margin-left: auto; font-size: 0.92rem; color: #b5c3d4; white-space: nowrap; }
.rc-sel b { color: #ffd84a; font-family: var(--mono); }
.rc-row { flex: 1; min-height: 0; display: flex; gap: 4px; padding: 4px; }
.rc-tiles { flex: 1; min-width: 0; display: flex; gap: 5px; overflow-x: auto; overflow-y: hidden; }
.rc-off { margin: auto; text-align: center; color: #c6ceda; line-height: 1.7; }
.rc-log { width: 23rem; flex: 0 0 auto; min-height: 0; display: flex; flex-direction: column; background: #1c1f24; border: 1px solid #14171b; }
.rc-log-h { padding: 0.15rem 0.4rem; background: #3a414b; font-weight: bold; font-size: 0.9rem; }
.rc-log-list { flex: 1; min-height: 0; overflow-y: auto; font-family: var(--mono); font-size: 0.86rem; padding: 0.15rem 0.3rem; user-select: text; }
.rc-log-list div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.35; }
.rc-log-list .tx { color: #ff8a8a; } .rc-log-list .rx { color: #8ef59c; } .rc-log-list .em { color: #ff5555; font-weight: bold; } .rc-log-list .sys { color: #9fb4d0; }

.res { width: 13.6rem; flex: 0 0 auto; display: flex; flex-direction: column; background: var(--rc-tile); color: #111; border: 1px solid #15181c; border-radius: 3px; overflow: hidden; box-shadow: inset 0 1px rgba(255,255,255,.6); }
.res.sel { outline: 3px solid #ffd84a; outline-offset: -3px; }
.res.msel .res-hd { background: linear-gradient(#a46d10, #7a4f08); }
.res.drop { outline: 3px solid #35c24a; outline-offset: -3px; }
.res.muted { filter: saturate(.4) brightness(.92); }
.res.em .res-hd { animation: emhead 0.7s steps(2) infinite; }
.res-hd { display: flex; align-items: center; gap: 0.3rem; height: 1.9rem; padding: 0 0.4rem; background: linear-gradient(#2a62ad, var(--rc-head)); color: #fff; font-weight: bold; cursor: default; }
.res-hd .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); }
.res-hd .bdg { margin-left: auto; display: flex; gap: 2px; }
.res-hd .bdg i.mkr { background: #c00; border-color: #fff; font-weight: bold; }
.res-hd .bdg i {font-style: normal; font-size: 0.72rem; padding: 0 0.2rem; border: 1px solid rgba(255,255,255,.6); font-weight: normal; }
.spk { width: 1.2rem; height: 1rem; flex: 0 0 auto; position: relative; }
.spk::before { content: ''; position: absolute; left: 0; top: 0.3rem; width: 0.35rem; height: 0.4rem; background: currentColor; }
.spk::after { content: ''; position: absolute; left: 0.25rem; top: 0.05rem; border-style: solid; border-width: 0.45rem 0.45rem 0.45rem 0; border-color: transparent currentColor transparent transparent; }
.res:not(.sel) .spk { opacity: .45; }
.res.sel .spk { color: #ffd84a; }
.res-st { height: 1.6rem; display: flex; align-items: center; padding: 0 0.4rem; background: #2a2f36; color: #9aa5b3; font-family: var(--mono); font-size: 0.92rem; gap: 0.4rem; white-space: nowrap; overflow: hidden; }
.res.rx .res-st { background: var(--rc-rx); color: #000; font-weight: bold; }
.res.tx .res-st { background: var(--rc-tx); color: #fff; font-weight: bold; }
.res-zone { padding: 0.1rem 0.4rem; font-size: 0.8rem; color: #3d4652; border-bottom: 1px solid #a5abb3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.res-units { flex: 1; min-height: 0; overflow-y: auto; padding: 0.2rem 0.3rem; display: flex; flex-wrap: wrap; align-content: flex-start; gap: 2px; background: #d9dce0; }
.rchip { display: inline-flex; align-items: center; gap: 0.2rem; height: 1.25rem; padding: 0 0.3rem; font-family: var(--mono); font-size: 0.86rem; background: var(--sc, #fff); border: 1px solid #555; cursor: default; }
.rchip.scan { background: transparent; border-style: dotted; color: #555; }
.rchip.talk { background: var(--rc-rx); border-color: #0b5a16; font-weight: bold; }
.rchip.em { background: var(--em); color: #fff; border-color: #700; }
.t-none { color: #59626e; font-size: 0.85rem; font-style: italic; }
.res-ctl { display: flex; gap: 2px; padding: 3px; background: #b3b8bf; border-top: 1px solid #8e949c; }
.res-ctl button { flex: 1; height: 1.75rem; border: 1px solid #555c66; background: linear-gradient(#f2f3f5, #c9cdd3); border-radius: 2px; font-size: 0.82rem; font-weight: bold; color: #1b1f24; padding: 0; }
.res-ctl button.on { background: linear-gradient(#ffe27a, #e0b31c); border-color: #7a5d00; }
.res-ctl button.open { background: linear-gradient(#ffb04a, #e07a10); border-color: #7a3e00; }
.res-ctl .ptt { flex: 1.6; background: linear-gradient(#e2e5e9, #b7bcc3); }
.res-ctl .ptt.live { background: linear-gradient(#ff4c4c, #c21b1b); color: #fff; border-color: #6a0b0b; }

/* ------------------------------------------------------------------ status bar */
.statusbar { display: flex; gap: 2px; height: 1.6rem; flex: 0 0 auto; padding-top: 1px; }
.sb { display: flex; align-items: center; padding: 0 0.5rem; box-shadow: inset 1px 1px var(--shadow), inset -1px -1px var(--hi); white-space: nowrap; font-size: 0.92rem; }
.sb.grow { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.sb.emerg.on { background: var(--em); color: #fff; font-weight: bold; animation: blink 0.8s steps(2) infinite; }
.sb.pendhot { color: #b00000; font-weight: bold; }
#sbClock { font-family: var(--mono); }

/* ------------------------------------------------------------------ menus, dialogs, balloons */
.ctx { position: fixed; display: none; min-width: 13rem; padding: 2px; background: var(--face); box-shadow: var(--raised), 2px 2px 0 rgba(0,0,0,.35); z-index: 50; }
.ctx.on { display: block; }
.ctx .h { padding: 0.15rem 0.6rem; font-weight: bold; background: var(--face2); border-bottom: 1px solid var(--shadow); margin-bottom: 2px; white-space: nowrap; }
.ctx button { display: flex; width: 100%; align-items: center; gap: 0.5rem; height: 1.6rem; padding: 0 1.4rem; border: 0; background: transparent; text-align: left; white-space: nowrap; }
.ctx button:hover:not(:disabled) { background: var(--sel); color: #fff; }
.ctx button:disabled { color: var(--shadow); text-shadow: 1px 1px #fff; }
.ctx button i { width: 0.7rem; height: 0.7rem; border: 1px solid #000; background: var(--sc); margin-left: -1rem; }
.ctx button .k { margin-left: auto; padding-left: 1.5rem; }
.ctx .sep { height: 2px; border-top: 1px solid var(--shadow); border-bottom: 1px solid var(--hi); margin: 3px 2px; }
.ctx .sub { padding: 0.15rem 0.6rem; color: var(--gray); font-size: 0.9rem; }

.modal { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; background: rgba(0,0,0,.08); z-index: 40; }
.modal.on { display: flex; }
.mbox { width: 46rem; max-height: 92vh; display: flex; flex-direction: column; background: var(--face); box-shadow: var(--raised), 3px 3px 0 rgba(0,0,0,.35); padding: 3px; }
.mbox.narrow { width: 34rem; }
.mbox .tb { background: linear-gradient(90deg, var(--navy), var(--navy2)); color: #fff; }
.mbody { padding: 0.7rem 0.8rem; overflow-y: auto; display: flex; flex-direction: column; gap: 0.5rem; }
.mrow { display: flex; gap: 0.6rem; align-items: flex-end; }
.fld { display: flex; flex-direction: column; gap: 0.15rem; flex: 1; min-width: 0; }
.fld > span { white-space: nowrap; }
.fld .tx { width: 100%; }
.mfoot { display: flex; justify-content: flex-end; align-items: center; gap: 0.4rem; padding: 0.5rem 0.8rem 0.7rem; }
.mfoot .note { margin-right: auto; color: var(--gray); }
.combo { position: relative; }
.combo-list { position: absolute; left: 0; right: 0; top: 100%; max-height: 15rem; overflow-y: auto; background: #fff; border: 1px solid #000; z-index: 5; display: none; }
.combo-list.on { display: block; }
.combo-list div { display: grid; grid-template-columns: 4.5rem 1fr 2.5rem; padding: 0.1rem 0.35rem; font-family: var(--grid-font); }
.combo-list div:hover, .combo-list div.hl { background: var(--sel); color: #fff; }
.combo-list div b { font-family: var(--mono); font-weight: normal; }
.dispos { display: flex; flex-direction: column; background: #fff; box-shadow: var(--sunken); padding: 2px; max-height: 15rem; overflow-y: auto; }
.dispo { display: grid; grid-template-columns: 4rem 1fr; text-align: left; border: 0; background: transparent; padding: 0.15rem 0.35rem; font-family: var(--grid-font); }
.dispo b { font-family: var(--mono); font-weight: normal; }
.dispo.on { background: var(--sel); color: #fff; }
.picklist { background: #fff; box-shadow: var(--sunken); padding: 2px; max-height: 18rem; overflow-y: auto; }
.picklist label { display: grid; grid-template-columns: 1.4rem 4.5rem 5rem 1fr; align-items: center; padding: 0.1rem 0.3rem; font-family: var(--grid-font); }
.picklist label:hover { background: #e8eefc; }
.picklist label b { font-family: var(--mono); font-weight: normal; }
.warn-line { color: #7a0000; }

#toasts { position: fixed; bottom: 18.3rem; right: 0.8rem; display: flex; flex-direction: column; gap: 4px; z-index: 60; pointer-events: none; align-items: flex-end; }
.toast { pointer-events: auto; min-width: 20rem; max-width: 30rem; padding: 0.35rem 0.5rem; background: #ffffe1; border: 1px solid #000; box-shadow: 2px 2px 0 rgba(0,0,0,.3); font-size: 0.98rem; display: flex; gap: 0.5rem; align-items: center; }
.toast .tt { flex: 1; }
.toast .tt b { display: block; }
.toast.bad { background: #ff2a2a; color: #fff; }
.toast.warn { background: #fff1a8; }
.toast.good { background: #e3f7df; }
.toast .b { min-width: 4.5rem; color: #000; }
.toast.out { opacity: 0; transition: opacity .25s; }

#dragGhost { position: fixed; top: -100px; left: -100px; padding: 0.1rem 0.4rem; background: #ffffe1; border: 1px solid #000; font-family: var(--mono); pointer-events: none; z-index: 70; }

@keyframes blink { 50% { opacity: .3; } }
@keyframes emrow { 0% { background: var(--em); color: #fff; } 100% { background: #ffd0d0; color: #000; } }
@keyframes emhead { 0% { background: #e01b1b; } 100% { background: #ff8a00; } }
