/* ============================================================
   MSP COMMAND THEME
   Opt-in console layout. Classic dark/light remains unchanged.
   ============================================================ */

body.theme-command {
  --command-bg: #07110f;
  --command-surface: rgba(11, 25, 23, 0.94);
  --command-surface-2: rgba(17, 35, 32, 0.92);
  --command-line: rgba(125, 211, 190, 0.20);
  --command-line-strong: rgba(125, 211, 190, 0.42);
  --command-text: #eefcf8;
  --command-muted: #96b9b0;
  --command-cyan: #45d6c8;
  --command-green: #63d471;
  --command-amber: #f0b64f;
  --command-red: #ff6b6b;
  --command-violet: #b494ff;
  --bg-main: var(--command-bg);
  --bg-alt: var(--command-surface);
  --card-bg: var(--command-surface-2);
  --text-main: var(--command-text);
  --text-muted: var(--command-muted);
  --border-subtle: var(--command-line);
  --accent: var(--command-cyan);
  --accent-blue: var(--command-cyan);
  --glass-bg: rgba(13, 30, 27, 0.86);
  --glass-bg-hover: rgba(20, 45, 40, 0.96);
  --glass-border: var(--command-line);
  --glass-shadow: 0 18px 50px rgba(0, 0, 0, 0.34);
  background:
    linear-gradient(135deg, rgba(7, 17, 15, 1), rgba(11, 31, 28, 0.98) 44%, rgba(24, 25, 42, 0.96));
  color: var(--command-text);
}

body.theme-command .app-shell {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  height: 100vh;
  gap: 10px;
  padding: 10px;
}

body.theme-command .app-header {
  grid-column: 1;
  grid-row: 1 / 5;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 16px;
  padding: 10px 8px;
  border: 1px solid var(--command-line);
  border-radius: 8px;
  background: rgba(4, 12, 11, 0.88);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.03);
  overflow: hidden;
}

body.theme-command .header-logo-overlay {
  position: static;
  transform: none;
  width: 100%;
  order: 0;
}

body.theme-command .header-logo-overlay img {
  width: 46px;
  height: auto;
  display: block;
  margin: 0 auto;
  filter: drop-shadow(0 0 14px rgba(69, 214, 200, 0.28));
}

body.theme-command .logo-title {
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  min-width: 0;
}

body.theme-command .logo-circle {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(69,214,200,0.95), rgba(99,212,113,0.90));
  box-shadow: 0 0 22px rgba(69, 214, 200, 0.32);
}

body.theme-command h1 {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: 0;
  text-transform: uppercase;
  max-height: 210px;
  overflow: hidden;
}

body.theme-command .header-subline,
body.theme-command .header-badge,
body.theme-command #currentUserEmail,
body.theme-command .header-pill span:not(.pill-icon) {
  display: none;
}

body.theme-command .header-right {
  margin-top: auto;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

body.theme-command .header-pill,
body.theme-command .btn-icon,
body.theme-command .btn-new-interface {
  width: 44px;
  min-width: 44px;
  height: 38px;
  padding: 0;
  justify-content: center;
  border-radius: 8px;
  border-color: var(--command-line);
  background: rgba(16, 34, 31, 0.88);
  color: var(--command-text);
}

body.theme-command .btn-new-interface {
  font-size: 0;
}

body.theme-command .btn-new-interface::before {
  content: "EX";
  font-size: 0.72rem;
  font-weight: 800;
}

body.theme-command .search-panel {
  grid-column: 2;
  grid-row: 1;
  display: grid;
  grid-template-columns: auto minmax(260px, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 12px;
  min-height: 66px;
  border: 1px solid var(--command-line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(9, 24, 22, 0.96), rgba(18, 36, 33, 0.92));
  position: relative;
}

body.theme-command .search-panel::before {
  content: "Operations Command";
  position: absolute;
  top: 8px;
  left: 118px;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
  color: var(--command-cyan);
}

body.theme-command #btnToggleView {
  height: 40px;
  border-radius: 8px;
  border-color: var(--command-line-strong);
  background: rgba(69, 214, 200, 0.12);
  color: var(--command-cyan);
}

body.theme-command .search-input-group {
  width: auto !important;
  padding-top: 12px;
}

body.theme-command .search-input {
  height: 40px;
  border-radius: 8px;
  border: 1px solid var(--command-line);
  background: rgba(3, 9, 8, 0.72);
  color: var(--command-text);
}

body.theme-command .severity-sort,
body.theme-command .search-actions .btn,
body.theme-command .services-toolbar-actions .service-pill {
  height: 40px;
  border-radius: 8px;
}

body.theme-command .search-actions {
  display: flex;
  gap: 8px;
}

body.theme-command .services-toolbar {
  grid-column: 2;
  grid-row: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 0;
}

body.theme-command .services-bar {
  padding: 8px;
  border: 1px solid var(--command-line);
  border-radius: 8px;
  background: rgba(6, 18, 16, 0.78);
}

body.theme-command .service-pill {
  border-radius: 8px;
  border-color: var(--command-line);
  background: rgba(16, 34, 31, 0.82);
  color: var(--command-text);
}

body.theme-command .service-pill:hover {
  transform: translateY(-1px);
  border-color: var(--command-cyan);
}

body.theme-command .main-layout {
  grid-column: 2;
  grid-row: 3;
  display: grid;
  grid-template-columns: minmax(520px, 1.1fr) 8px minmax(380px, 0.9fr);
  min-height: 0;
  border-radius: 8px;
  border-color: var(--command-line);
  background: transparent;
  overflow: hidden;
}

body.theme-command .pane {
  border: 1px solid var(--command-line);
  border-radius: 8px;
  background: rgba(6, 18, 16, 0.76);
  padding: 10px;
}

body.theme-command .pane-left {
  grid-column: 1;
  width: auto !important;
  flex-basis: auto !important;
}

body.theme-command .pane-divider {
  grid-column: 2;
  width: 8px;
  min-width: 8px;
  border: 0;
  background: transparent;
}

body.theme-command .pane-divider::after {
  background: var(--command-line-strong);
}

body.theme-command .pane-right {
  grid-column: 3;
  width: auto !important;
  min-width: 0;
}

body.theme-command .pane-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  padding: 0 0 10px;
  border-bottom: 1px solid var(--command-line);
}

body.theme-command .pane-asset-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

body.theme-command .pane-asset-tab {
  border-radius: 8px;
  border: 1px solid var(--command-line);
  background: rgba(12, 29, 26, 0.84);
  color: var(--command-muted);
}

body.theme-command .pane-asset-tab.active {
  border-color: var(--command-cyan);
  background: rgba(69, 214, 200, 0.16);
  color: var(--command-text);
}

body.theme-command .pane-header-right {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

body.theme-command .stats-bar {
  display: grid;
  grid-template-columns: repeat(5, minmax(86px, 1fr));
  gap: 8px;
}

body.theme-command .stats-pill {
  border-radius: 8px;
  border: 1px solid var(--command-line);
  background: rgba(12, 29, 26, 0.84);
  padding: 8px 10px;
}

body.theme-command .stats-count {
  font-size: 1.05rem;
  font-weight: 900;
}

body.theme-command .stats-red { color: var(--command-red); }
body.theme-command .stats-amber { color: var(--command-amber); }
body.theme-command .stats-green { color: var(--command-green); }
body.theme-command .stats-offline { color: var(--command-violet); }

body.theme-command .list-header {
  border-radius: 8px;
  border: 1px solid var(--command-line);
  background: rgba(6, 18, 16, 0.96);
}

body.theme-command .card-list:not(.list-view) {
  grid-auto-flow: row;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)) !important;
  gap: 10px;
}

body.theme-command .system-card {
  width: auto;
  min-width: 0;
  max-width: none;
  border-radius: 8px;
  background: rgba(12, 29, 26, 0.88);
  border-color: var(--command-line);
  box-shadow: none;
}

body.theme-command .system-card:hover {
  background: rgba(18, 42, 38, 0.95);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.28);
}

body.theme-command .system-card.selected {
  border-color: var(--command-cyan);
  box-shadow: 0 0 0 1px rgba(69, 214, 200, 0.45);
}

body.theme-command .card-list.list-view .system-row {
  border-radius: 8px;
  border-color: var(--command-line);
  background: rgba(12, 29, 26, 0.78);
}

body.theme-command .card-list.list-view .system-row:hover {
  background: rgba(18, 42, 38, 0.95);
}

body.theme-command .details-wrapper {
  min-height: 0;
}

body.theme-command .details-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--command-line);
}

body.theme-command .details-title {
  text-align: left;
  color: var(--command-cyan);
  font-weight: 900;
  letter-spacing: 0;
}

body.theme-command .details-header-right {
  justify-content: flex-end;
  flex-wrap: wrap;
}

body.theme-command .details-action-menu,
body.theme-command .details-header-actions {
  gap: 6px;
}

body.theme-command .d-btn {
  border-radius: 8px;
}

body.theme-command .details-bubble,
body.theme-command .details-section,
body.theme-command .capability-summary,
body.theme-command .diagnostic-popover {
  border-radius: 8px;
  border-color: var(--command-line);
  background: rgba(12, 29, 26, 0.86);
}

body.theme-command .details-tab-btn {
  border-radius: 8px;
}

body.theme-command .details-tab-btn.active {
  background: rgba(69, 214, 200, 0.16);
  border-color: var(--command-cyan);
  color: var(--command-text);
}

body.theme-command .details-placeholder {
  border-radius: 8px;
  border: 1px dashed var(--command-line);
  min-height: 320px;
  background:
    repeating-linear-gradient(
      0deg,
      rgba(125, 211, 190, 0.05) 0,
      rgba(125, 211, 190, 0.05) 1px,
      transparent 1px,
      transparent 24px
    );
}

body.theme-command .app-footer {
  grid-column: 2;
  grid-row: 4;
  border-radius: 8px;
  border-color: var(--command-line);
  background: rgba(6, 18, 16, 0.78);
}

body.theme-command .settings-panel,
body.theme-command .user-panel,
body.theme-command #lookupPanel {
  border-radius: 8px 0 0 8px;
  background: rgba(7, 17, 15, 0.98);
  border-color: var(--command-line);
}

body.theme-command input,
body.theme-command select,
body.theme-command textarea {
  border-radius: 8px;
}

@media (max-width: 1180px) {
  body.theme-command .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  }

  body.theme-command .app-header {
    grid-column: 1;
    grid-row: 1;
    flex-direction: row;
    align-items: center;
  }

  body.theme-command h1 {
    writing-mode: horizontal-tb;
    transform: none;
    max-height: none;
  }

  body.theme-command .header-right {
    margin-top: 0;
    margin-left: auto;
    flex-direction: row;
    width: auto;
  }

  body.theme-command .search-panel,
  body.theme-command .services-toolbar,
  body.theme-command .main-layout,
  body.theme-command .app-footer {
    grid-column: 1;
  }

  body.theme-command .search-panel { grid-row: 2; }
  body.theme-command .services-toolbar { grid-row: 3; }
  body.theme-command .main-layout {
    grid-row: 4;
    display: flex;
  }
  body.theme-command .app-footer { grid-row: 5; }
}

@media (max-width: 760px) {
  body.theme-command .search-panel,
  body.theme-command .services-toolbar,
  body.theme-command .pane-header-right,
  body.theme-command .main-layout {
    display: flex;
    flex-direction: column;
  }

  body.theme-command .search-panel::before {
    position: static;
    order: -1;
  }

  body.theme-command .stats-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
