/* ==========================================================================
   AERONEX OPS TERMINAL — text-based admin console (TUI) theme.
   Loaded only by admin/index.html, after style.css, so it can override the
   site's normal light theme with a dark terminal look. All admin-console
   text is English by design — this is an internal ops tool, not a
   customer-facing page.
   ========================================================================== */

body.tui {
  background: #05070a;
  color: #baffc9;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
}
body.tui * { border-radius: 0 !important; box-shadow: none !important; }
body.tui a { color: #6fe3ff; }

/* ---- top bar: terminal title bar ---- */
body.tui .topbar {
  background: #05070a;
  border-bottom: 1px solid #1d3b28;
}
body.tui .topbar .brand span {
  font-family: var(--mono);
  letter-spacing: 1px;
}
body.tui .topbar .brand span::before { content: "> "; color: #4fffa0; }
body.tui .topbar .brand span::after { content: " OPS TERMINAL"; color: #5c8f74; }
body.tui #whoami { color: #5c8f74; }
body.tui #whoami::before { content: "USER: "; color: #3a5b48; }

body.tui .btn {
  background: #0b120e;
  border: 1px solid #2c5940;
  color: #baffc9;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}
body.tui .btn:hover { background: #142019; border-color: #4fffa0; color: #eaffef; }
body.tui .btn-primary { background: #123d26; border-color: #4fffa0; color: #eaffef; }
body.tui .btn-primary:hover { background: #1a5636; }
body.tui .btn-danger { border-color: #ff5f5f; color: #ffb3b3; }
body.tui .btn-danger:hover { background: #2a1010; }

body.tui, html:has(body.tui) { height: 100%; }
body.tui { margin: 0; display: flex; flex-direction: column; overflow: hidden; }

/* ---- terminal shell: scrolling output pane + pinned input line ---- */
body.tui #termWrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #05070a;
}
body.tui #termOutput {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 22px;
}
body.tui .term-line { margin: 2px 0; white-space: pre-wrap; word-break: break-word; }
body.tui .term-cmd { color: #6fe3ff; }
body.tui .term-ok { color: #4fffa0; }
body.tui .term-err { color: #ff5f5f; }
body.tui .term-dim { color: #5c8f74; }
body.tui .term-banner { color: #4fffa0; margin: 4px 0 10px; font-size: 11px; line-height: 1.15; overflow-x: auto; }
body.tui .term-table { margin: 4px 0 10px; color: #baffc9; font-size: 12px; overflow-x: auto; }
body.tui .term-sig { max-width: 260px; margin-top: 4px; background: #fff; border: 1px solid #2c5940; }

body.tui #termInputLine {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-top: 1px solid #1d3b28;
  background: #05070a;
}
body.tui #termPrompt { color: #4fffa0; white-space: nowrap; font-size: 13px; }
body.tui #termInput {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #baffc9;
  font-family: var(--mono);
  font-size: 13px;
  caret-color: #4fffa0;
}
body.tui #termInput:disabled { opacity: 0.5; }

/* ---- scrollbars, to keep the terminal illusion consistent ---- */
body.tui ::-webkit-scrollbar { width: 10px; height: 10px; }
body.tui ::-webkit-scrollbar-track { background: #05070a; }
body.tui ::-webkit-scrollbar-thumb { background: #1d3b28; border: 2px solid #05070a; }

/* ---- blinking cursor accent on the topbar brand, purely decorative ---- */
body.tui .brand::after {
  content: "_";
  color: #4fffa0;
  margin-left: 4px;
  animation: tui-blink 1s steps(1) infinite;
}
@keyframes tui-blink { 50% { opacity: 0; } }

/* ---- "searching..." style loading line used for the async lookup delay ---- */
body.tui .tui-loading::before { content: "> "; color: #4fffa0; }

/* ==========================================================================
   DOS-style boot / interface-chooser overlay.
   Modeled on classic full-screen TUI apps (Turbo C IDE, Midnight Commander):
   solid blue background, a boxed dialog with a double-line border, and
   keyboard-only navigation. There is deliberately no click handling on the
   option rows — arrow keys + Enter, the way these programs actually worked.
   ========================================================================== */
.dos-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: #0000aa;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono);
  color: #dcdcdc;
  user-select: none;
}
.dos-overlay.hidden { display: none; }
.dos-screen { width: min(560px, 92vw); }
.dos-titlebar {
  background: #00aaaa; color: #000; font-size: 12px; font-weight: 700;
  padding: 3px 10px; letter-spacing: 0.5px; text-align: center;
}
.dos-banner {
  color: #55ffff; font-size: 10px; line-height: 1.1; text-align: center;
  margin: 10px 0 4px; overflow-x: auto; white-space: pre;
}
.dos-box {
  background: #aaaaaa; color: #000; border: 3px double #000;
  box-shadow: 0 0 0 1px #000, 6px 6px 0 rgba(0,0,0,0.55);
  padding: 20px 22px; margin-top: 6px;
}
.dos-box h3 { margin: 0 0 12px; font-size: 14px; text-align: center; letter-spacing: 0.5px; }
.dos-box p { margin: 0 0 10px; font-size: 12.5px; line-height: 1.5; text-align: center; }
.dos-options { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.dos-option {
  font-family: var(--mono); font-size: 13px; text-align: center; padding: 8px 10px;
  border: 1px solid #000; background: #c6c6c6; letter-spacing: 0.5px;
}
.dos-option .arrow { visibility: hidden; }
.dos-option.selected {
  background: #000080; color: #fff; border-color: #000; font-weight: 700;
}
.dos-option.selected .arrow { visibility: visible; }
.dos-hint {
  color: #55ffff; font-size: 11.5px; text-align: center; margin-top: 12px; letter-spacing: 0.3px;
}
.dos-hint.err { color: #ff5f5f; }

/* ==========================================================================
   AERONEX OPS TERMINAL — panel-style TUI console (/admin/tui.html).
   A menu-driven text UI in the same dark "body.tui" theme as the CMD
   terminal, but navigated with a two-pane layout (sections on the left,
   content on the right) instead of typed commands. No click handlers are
   attached anywhere inside the console — only Tab / arrow keys / Enter / Esc.
   ========================================================================== */
body.tui .mc-shell { flex: 1; min-height: 0; display: flex; flex-direction: column; background: #05070a; }
body.tui .mc-wrap { flex: 1; min-height: 0; display: flex; }

body.tui .mc-side {
  width: 230px; flex: none; overflow-y: auto;
  border-right: 1px solid #1d3b28;
  padding: 14px 0;
}
body.tui .mc-side-item {
  padding: 7px 18px; color: #5c8f74; white-space: nowrap; font-size: 12.5px; letter-spacing: 0.3px;
}
body.tui .mc-side-item.active { color: #baffc9; }
body.tui .mc-side-item.cur { background: #123d26; color: #eaffef; font-weight: 700; }
body.tui .mc-side-item.cur-dim { outline: 1px solid #2c5940; outline-offset: -1px; color: #baffc9; }

body.tui .mc-main { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: 14px 22px; overflow: hidden; }
body.tui .mc-breadcrumb { color: #5c8f74; font-size: 12px; margin-bottom: 10px; letter-spacing: 0.3px; text-transform: uppercase; }
body.tui .mc-rows { flex: 1; min-height: 0; overflow-y: auto; }
body.tui .mc-row {
  padding: 6px 10px; white-space: pre-wrap; word-break: break-word; font-size: 13px; margin-bottom: 1px;
}
body.tui .mc-row.sel { background: #123d26; color: #eaffef; }
body.tui .mc-row.sel-dim { outline: 1px solid #2c5940; outline-offset: -1px; }
body.tui .mc-text {
  color: #baffc9; font-family: var(--mono); font-size: 12.5px; white-space: pre-wrap; word-break: break-word;
  margin: 0 0 12px; padding: 10px 12px; border: 1px solid #1d3b28; background: #070b08;
}
body.tui .mc-empty { color: #3a5b48; font-style: italic; padding: 10px; font-size: 13px; }

body.tui .mc-prompt-line {
  display: flex; gap: 10px; align-items: center; padding: 8px 10px; margin-top: 4px;
  border: 1px solid #2c5940; background: #0b120e;
}
body.tui .mc-prompt-line label { color: #5c8f74; white-space: nowrap; font-size: 12.5px; }
body.tui .mc-prompt-line input {
  flex: 1; background: transparent; border: none; outline: none; color: #baffc9;
  font-family: var(--mono); font-size: 13px; caret-color: #4fffa0; border-bottom: 1px dashed #2c5940;
}

body.tui .mc-status { padding: 6px 22px; font-size: 12px; min-height: 18px; border-top: 1px solid #1d3b28; color: #5c8f74; }
body.tui .mc-status.ok { color: #4fffa0; }
body.tui .mc-status.err { color: #ff5f5f; }
body.tui .mc-hotkeys { padding: 6px 22px 12px; font-size: 11.5px; color: #5c8f74; border-top: 1px solid #0d1712; letter-spacing: 0.3px; }
body.tui .mc-hotkeys b { color: #baffc9; }
