/* Command shell layout — adapted from the LYT Futura deck. */
* { box-sizing: border-box; }
html, body { margin: 0; }
body.futura-deck {
  font-family: var(--f-font);
  color: var(--f-text);
  min-height: 100vh;
  background:
    linear-gradient(var(--f-grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--f-grid-line) 1px, transparent 1px),
    linear-gradient(180deg, var(--f-bg-mid) 0%, var(--f-bg-deep) 60%);
  background-size: 42px 42px, 42px 42px, 100% 100%;
}

.command-deck {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.hud {
  position: sticky;
  top: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(0, 1fr) minmax(0, auto) minmax(0, auto) minmax(0, auto);
  align-items: center;
  gap: 0.45rem 1rem;
  padding: 0.55rem 1.25rem;
  background: linear-gradient(180deg, rgba(8, 16, 28, 0.98) 0%, rgba(8, 16, 28, 0.88) 100%);
  border-bottom: 1px solid var(--f-border);
  box-shadow: 0 4px 32px rgba(0, 0, 0, 0.4);
}
.hud-brand h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--f-accent);
}
.hud-brand .hud-sub {
  margin: 0.15rem 0 0;
  font-size: 0.72rem;
  color: var(--f-muted);
}
.hud-brand .hud-company {
  margin: 0.2rem 0 0;
  font-size: 0.68rem;
  color: var(--f-muted);
  max-width: 28rem;
}
.hud-brand .hud-company a {
  color: var(--f-accent);
  font-weight: 600;
  text-decoration: none;
}
.hud-brand .hud-company a:hover { text-decoration: underline; }
.hud-search {
  min-width: 0;
}
.hud-search input {
  width: 100%;
  max-width: 26rem;
  padding: 0.45rem 0.75rem;
  font-size: 0.85rem;
  color: var(--f-text);
  background: rgba(6, 12, 22, 0.8);
  border: 1px solid var(--f-border);
  border-radius: 6px;
}
.hud-search input:focus {
  outline: none;
  border-color: var(--f-accent);
  box-shadow: 0 0 8px var(--f-accent-glow);
}
.hud-clock {
  font-family: var(--f-mono);
  font-size: 0.85rem;
  color: var(--f-muted);
  white-space: nowrap;
}
.hud-conn {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--f-border);
  white-space: nowrap;
}
.hud-conn[data-state="live"] { color: var(--f-success); border-color: rgba(52, 211, 153, 0.5); }
.hud-conn[data-state="poll"] { color: var(--f-warn); border-color: rgba(251, 191, 36, 0.5); }
.hud-conn[data-state="down"] { color: var(--f-danger); border-color: rgba(248, 113, 113, 0.5); }

.hud-menu-toggle {
  display: none;
  font-size: 0.72rem;
  padding: 0.35rem 0.65rem;
}

.deck-body {
  display: flex;
  flex: 1;
  min-height: 0;
}

.command-rail {
  width: var(--f-rail-w);
  flex-shrink: 0;
  padding: 1rem 0.65rem;
  border-right: 1px solid var(--f-border);
  background: rgba(6, 12, 22, 0.6);
}
.command-rail nav { display: flex; flex-direction: column; gap: 0.35rem; }
.rail-phase {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--f-muted);
  margin: 0.75rem 0 0.25rem;
  padding-left: 0.35rem;
}
.rail-phase:first-child { margin-top: 0; }
.command-rail a {
  display: block;
  padding: 0.35rem 0.5rem;
  font-size: 0.78rem;
  color: var(--f-text);
  text-decoration: none;
  border-radius: 6px;
  border: 1px solid transparent;
}
.command-rail a:hover,
.command-rail a.rail-active {
  background: var(--f-accent-dim);
  border-color: var(--f-border);
  color: var(--f-accent);
}
.rail-toggle { display: none; margin-bottom: 0.5rem; }
.rail-company-cta {
  margin: 1rem 0.35rem 0;
  padding-top: 0.65rem;
  border-top: 1px solid var(--f-border);
  font-size: 0.65rem;
  line-height: 1.45;
  color: var(--f-muted);
}
.rail-company-cta a {
  color: var(--f-accent);
  font-weight: 600;
  text-decoration: none;
}
.rail-company-cta a:hover { text-decoration: underline; }

.mobile-tabs {
  display: none;
}

.company-cta-bar {
  flex-shrink: 0;
  padding: 0.4rem 1.25rem;
  font-size: 0.72rem;
  text-align: center;
  color: var(--f-text);
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.08), rgba(34, 211, 238, 0.1), rgba(245, 158, 11, 0.08));
  border-bottom: 1px solid var(--f-border);
}
.company-cta-bar strong { color: var(--f-live); }
.company-cta-bar a {
  color: var(--f-accent);
  font-weight: 700;
  text-decoration: none;
  margin-left: 0.35rem;
}
.company-cta-bar a:hover { text-decoration: underline; }

.company-cta-inline {
  margin: 0 0 0.75rem;
  padding: 0.45rem 0.65rem;
  font-size: 0.78rem;
  color: var(--f-text);
  background: var(--f-accent-dim);
  border: 1px solid var(--f-border);
  border-radius: 6px;
}
.company-cta-inline a {
  color: var(--f-accent);
  font-weight: 700;
  text-decoration: none;
}
.company-cta-inline a:hover { text-decoration: underline; }

.ops-main {
  flex: 1;
  min-width: 0;
  padding: 1rem 1.25rem 2.5rem;
  overflow: auto;
}

.panel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1rem;
  align-items: start;
}
.panel-grid .span-2 { grid-column: span 2; }

@media (max-width: 900px) {
  .hud {
    grid-template-columns: minmax(0, 1fr) minmax(0, auto);
    row-gap: 0.35rem;
  }
  .hud-brand { grid-column: 1 / -1; }
  .hud-search { grid-column: 1 / -1; }
  .panel-grid .span-2 { grid-column: span 1; }
}

@media (max-width: 768px) {
  :root {
    --f-mobile-tabs-h: 3.25rem;
  }

  body {
    padding-bottom: calc(var(--f-footer-h) + var(--f-mobile-tabs-h));
  }

  .hud-menu-toggle {
    display: inline-block;
    grid-column: 1;
    justify-self: start;
    min-height: 2.5rem;
    min-width: 3.5rem;
    touch-action: manipulation;
  }

  .hud-clock,
  .hud-conn {
    grid-column: 2;
  }

  .hud-trust {
    grid-column: 1 / -1;
    justify-self: end;
  }

  .company-cta-bar {
    display: none;
  }

  .command-rail {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(var(--f-footer-h) + var(--f-mobile-tabs-h));
    width: 100%;
    max-height: min(72vh, 32rem);
    overflow: auto;
    z-index: 200;
    transform: translateY(105%);
    transition: transform 0.24s var(--f-ease-deck);
    border-right: none;
    border-top: 1px solid var(--f-border);
    border-radius: 14px 14px 0 0;
    box-shadow: 0 -12px 48px rgba(0, 0, 0, 0.55);
    padding-bottom: 0.5rem;
  }
  .command-rail.open {
    transform: translateY(0);
  }

  .rail-backdrop {
    position: fixed;
    inset: 0;
    z-index: 190;
    background: rgba(2, 6, 12, 0.55);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }
  .rail-backdrop.open {
    opacity: 1;
    pointer-events: auto;
  }

  .ops-main {
    padding: 0.75rem 0.85rem 1.5rem;
  }

  .panel-grid {
    grid-template-columns: 1fr;
  }

  .stage-columns {
    grid-template-columns: 1fr;
  }

  .mobile-tabs {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed;
    left: 0;
    right: 0;
    bottom: var(--f-footer-h);
    z-index: 130;
    background: rgba(8, 16, 28, 0.98);
    border-top: 1px solid var(--f-border);
    padding: 0.25rem 0.15rem calc(0.25rem + env(safe-area-inset-bottom, 0px));
  }

  .mobile-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.1rem;
    min-height: 2.75rem;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--f-muted);
    text-decoration: none;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.2rem 0.1rem;
    touch-action: manipulation;
  }

  .mobile-tab:hover,
  .mobile-tab.mobile-tab-active {
    color: var(--f-accent);
  }

  .mobile-tab-more {
    color: var(--f-live);
  }
}
