/* Mission Portal — shared Miltech visual language (Knowledge Base and Bugs Portal).
   Plain values, floats and flexbox only: no custom properties or grid, so the same
   sheet works in the simulator's embedded browser.
   Palette: header #101010, page #ffffff, side #fafafa, ink #262626, muted #666666,
   line #e3e3e3, soft #f4f4f4, primary-soft #eeeeee. */

@font-face {
  font-family: "Jost";
  src: url("/fonts/jost-bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: #ffffff;
  color: #262626;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 14px;
}

a {
  color: #333333;
}

button {
  border: 1px solid #101010;
  border-radius: 6px;
  background: #101010;
  color: #ffffff;
  padding: 9px 14px;
  font-weight: 600;
  cursor: pointer;
}

button:hover {
  background: #292929;
  border-color: #292929;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid #777777;
  outline-offset: 2px;
}

button:disabled {
  opacity: 0.55;
  cursor: wait;
}

input {
  width: 100%;
  border: 1px solid #e3e3e3;
  border-radius: 6px;
  background: #ffffff;
  color: #262626;
  padding: 9px 11px;
  outline: none;
}

input:focus {
  border-color: #101010;
}

input::placeholder {
  color: #8a8a8a;
}

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn-icon,
.btn-label {
  display: inline-block;
  vertical-align: middle;
}

.btn-icon {
  height: 18px;
  line-height: 0;
}

.btn-label {
  margin-left: 7px;
}

button.icon-only {
  width: 40px;
  min-width: 40px;
  height: 40px;
  padding: 0;
  line-height: 38px;
  text-align: center;
}

button.icon-only .btn-label {
  display: none;
}

#portal {
  min-height: 100vh;
  background: #ffffff;
}

/* Masthead */

.topbar {
  display: flex;
  align-items: center;
  height: 78px;
  padding: 0 32px 0 20px;
  background: #101010;
  border-bottom: 1px solid #000000;
  color: #ffffff;
}

.topbar .back-btn {
  flex: none;
  margin-right: 14px;
  border-color: transparent;
  background: transparent;
  color: #e6e6e6;
}

.topbar .back-btn:hover {
  background: #252525;
  border-color: #252525;
}

.brand {
  flex: none;
  display: block;
  color: #ffffff;
  text-decoration: none;
  line-height: 1.2;
}

.brand-logo {
  display: block;
  width: 240px;
  height: auto;
}

.brand small {
  display: block;
  margin-top: 4px;
  color: #bdbdbd;
  font-size: 9px;
  letter-spacing: 0.24em;
}

.top-divider {
  flex: none;
  width: 1px;
  height: 27px;
  margin: 0 22px;
  background: #3a3a3a;
}

.top-label {
  color: #bdbdbd;
  font-size: 14px;
  white-space: nowrap;
}

.top-actions {
  margin-left: auto;
}

.top-actions button {
  margin-left: 8px;
  border-color: #454545;
  background: #252525;
  color: #ffffff;
}

.top-actions button:hover {
  background: #333333;
  border-color: #5a5a5a;
}

.top-actions button.icon-only {
  border-radius: 6px;
}

#fileInput {
  display: none;
}

/* Layout */

.layout {
  display: flex;
  min-height: calc(100vh - 78px);
}

.sidebar {
  flex: none;
  width: 272px;
  padding: 26px 20px 24px;
  background: #fafafa;
  border-right: 1px solid #e3e3e3;
}

.content {
  flex: 1;
  min-width: 0;
  max-width: 1300px;
  padding: 44px 56px 64px;
}

/* Sidebar */

.nav-caption,
.panel-block h2.nav-caption,
.generator-section > h2.nav-caption {
  display: block;
  margin: 0 10px 10px;
  color: #666666;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.panel-block {
  margin-bottom: 22px;
  padding-bottom: 22px;
  border-bottom: 1px solid #e3e3e3;
}

.panel-block label {
  display: block;
  margin: 0 10px 8px;
  color: #262626;
  font-size: 13px;
  font-weight: 600;
}

.account-links > p,
.account-links > a,
.account-links > button,
.account-links > section {
  margin-left: 10px;
  margin-right: 10px;
}

.profile-label {
  margin: 0 0 2px;
  color: #666666;
  font-size: 12px;
}

.greeting {
  margin: 0;
  color: #262626;
  font-family: "Jost", Arial, sans-serif;
  font-size: 21px;
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: break-word;
}

.portal-account {
  margin: 6px 0 0;
  color: #666666;
  font-size: 13px;
  overflow-wrap: break-word;
}

.connection-status {
  margin: 10px 0 0;
  color: #666666;
  font-size: 13px;
}

.connection-status:before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 50%;
  background: #b0b0b0;
  vertical-align: 1px;
}

.connection-status.connected {
  color: #25603b;
}

.connection-status.connected:before {
  background: #2d9654;
}

.account-links a {
  display: block;
  color: #333333;
  font-size: 14px;
}

.stat-row,
.category-list button {
  display: block;
  overflow: hidden;
  width: 100%;
  margin: 0;
  padding: 8px 10px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #666666;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.4;
  text-align: left;
}

.stat-row span {
  float: left;
}

.stat-row strong,
.category-count {
  float: right;
  color: #666666;
  font-size: 12px;
  font-weight: 400;
  line-height: 19.6px;
  font-variant-numeric: tabular-nums;
}

.category-list button:hover {
  background: #f4f4f4;
  color: #262626;
}

.category-list button.active {
  background: #eeeeee;
  color: #262626;
  font-weight: 600;
}

.inline-form {
  overflow: hidden;
  margin: 0 10px;
}

.inline-form input {
  float: left;
  width: calc(100% - 48px);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.inline-form button {
  float: right;
  width: 40px;
  min-width: 40px;
  height: 40px;
  line-height: 38px;
}

/* Main column */

.breadcrumbs {
  margin-bottom: 16px;
  color: #333333;
  font-size: 11px;
  font-weight: 550;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.breadcrumbs span {
  margin-right: 10px;
}

.page-title {
  margin: 0 0 12px;
  color: #262626;
  font-family: "Jost", Arial, sans-serif;
  font-size: 44px;
  font-weight: 700;
  line-height: 1.15;
}

.page-intro {
  margin: 0 0 26px;
  color: #666666;
  font-size: 16px;
}

.search-row {
  position: relative;
  margin-bottom: 38px;
}

.search-row .search-icon {
  position: absolute;
  left: 20px;
  top: 19px;
  width: 20px;
  height: 20px;
  color: #262626;
}

.search-row input {
  height: 60px;
  padding-left: 54px;
  border-color: #bfbfbf;
  border-radius: 7px;
  font-size: 16px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
}

.search-row input:hover,
.search-row input:focus {
  border-color: #101010;
}

.row-section {
  margin-bottom: 36px;
}

.row-section h2 {
  margin: 0 0 16px;
  color: #262626;
  font-family: "Jost", Arial, sans-serif;
  font-size: 19px;
  font-weight: 700;
}

.card-row {
  display: flex;
  flex-wrap: wrap;
  margin-right: -14px;
}

/* Mission cards, after the Knowledge Base product card */

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: calc(33.333% - 14px);
  min-height: 218px;
  margin: 0 14px 14px 0;
  padding: 18px 20px;
  background: #ffffff;
  border: 1px solid #e3e3e3;
  border-radius: 7px;
  cursor: pointer;
  transition: border-color 0.16s, box-shadow 0.16s, transform 0.16s;
}

.card:hover {
  border-color: #a0a0a0;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.035);
  transform: translateY(-2px);
}

.card-top {
  overflow: hidden;
}

.card-top .badge {
  float: left;
}

.badge,
.card .badge {
  display: inline-block;
  margin-top: 2px;
  padding: 0 9px;
  border: 0;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.1em;
  line-height: 22px;
  text-transform: uppercase;
}

/* Category colours, from the Bugs Portal pill palette. */
.badge.cat-search-and-rescue { background: #ffedd5; color: #9a3412; }
.badge.cat-firefighting { background: #fee2e2; color: #991b1b; }
.badge.cat-emergency { background: #fce7f3; color: #9d174d; }
.badge.cat-training { background: #e0e7ff; color: #3730a3; }
.badge.cat-professional { background: #dbeafe; color: #1e40af; }
.badge.cat-passenger { background: #cffafe; color: #155e75; }
.badge.cat-cargo { background: #fef9c3; color: #854d0e; }
.badge.cat-campaign { background: #ede9fe; color: #5b21b6; }
.badge.cat-patrol { background: #ccfbf1; color: #115e59; }
.badge.cat-exploration { background: #d1fae5; color: #065f46; }
.badge.cat-custom-mission { background: #ecfccb; color: #3f6212; }
.badge.cat-career { background: #fecdd3; color: #881337; }
.badge.cat-automated { background: #e0f2fe; color: #075985; }

.category-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 9px;
  border-radius: 50%;
  vertical-align: 1px;
}

.category-dot.cat-search-and-rescue { background: #ea580c; }
.category-dot.cat-firefighting { background: #dc2626; }
.category-dot.cat-emergency { background: #db2777; }
.category-dot.cat-training { background: #4f46e5; }
.category-dot.cat-professional { background: #2563eb; }
.category-dot.cat-passenger { background: #0891b2; }
.category-dot.cat-cargo { background: #ca8a04; }
.category-dot.cat-campaign { background: #7c3aed; }
.category-dot.cat-patrol { background: #0d9488; }
.category-dot.cat-exploration { background: #059669; }
.category-dot.cat-custom-mission { background: #65a30d; }

.heart {
  float: right;
  width: 26px;
  min-width: 26px;
  height: 26px;
  padding: 2px;
  border: 0;
  background: transparent;
  color: #8a8a8a;
}

.heart:hover {
  background: transparent;
  color: #dc2626;
}

.heart svg {
  width: 19px;
  height: 19px;
}

.heart.faved {
  color: #dc2626;
}

.heart.faved svg {
  fill: #dc2626;
  stroke: #dc2626;
}

.card h3 {
  margin: 10px 0 8px;
  color: #262626;
  font-family: "Jost", Arial, sans-serif;
  font-size: 19px;
  font-weight: 700;
  line-height: 1.3;
}

.card p {
  max-height: 63px;
  overflow: hidden;
  margin: 0 0 18px;
  color: #666666;
  font-size: 14px;
  line-height: 1.5;
}

.card-bottom {
  overflow: hidden;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid #ededed;
}

.author {
  float: left;
  max-width: 55%;
  color: #666666;
  font-size: 12px;
  line-height: 34px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.card-actions {
  float: right;
}

.small-btn {
  min-width: 34px;
  margin-left: 6px;
  padding: 0;
  border-color: #e3e3e3;
  background: #ffffff;
  color: #262626;
}

.small-btn.icon-only {
  width: 34px;
  min-width: 34px;
  height: 34px;
  line-height: 32px;
}

.small-btn svg {
  width: 16px;
  height: 16px;
}

.small-btn:hover {
  border-color: #101010;
  background: #101010;
  color: #ffffff;
}

.delete-btn {
  color: #8a2a2a;
}

.delete-btn:hover {
  border-color: #8a2a2a;
  background: #8a2a2a;
  color: #ffffff;
}

/* Banners, after Knowledge Base callouts */

.banner {
  margin: 0 0 24px;
  padding: 10px 16px;
  border: 1px solid #e3e3e3;
  border-left-width: 3px;
  border-radius: 5px;
  background: #fafafa;
  color: #262626;
  font-size: 14px;
}

.banner.error {
  background: #fff0f0;
  border-color: #f2bcbc;
  border-left-color: #8c2b2b;
  color: #8c2b2b;
}

.banner.notice {
  background: #eef5fd;
  border-color: #bcd4f1;
  border-left-color: #467bbc;
  color: #213e64;
}

.hidden {
  display: none;
}

.mission-loading {
  padding: 64px 20px;
  color: #666666;
  font-size: 15px;
  text-align: center;
}

.loading-spinner {
  display: block;
  width: 30px;
  height: 30px;
  margin: 0 auto 14px;
  border: 3px solid #e3e3e3;
  border-top-color: #101010;
  border-radius: 50%;
  animation: mission-loading-spin 0.8s linear infinite;
}

@keyframes mission-loading-spin {
  to {
    transform: rotate(360deg);
  }
}

#portalWelcome {
  margin: 0;
  color: #666666;
  font-size: 16px;
}

/* Mission details */

.modal-overlay {
  position: fixed;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  padding: 24px;
  background: rgba(0, 0, 0, 0.38);
  z-index: 50;
}

.modal {
  position: relative;
  top: 50%;
  width: 640px;
  max-width: 100%;
  max-height: 86vh;
  overflow-y: auto;
  margin: 0 auto;
  padding: 30px 32px;
  background: #ffffff;
  color: #262626;
  border: 1px solid #e3e3e3;
  border-radius: 12px;
  box-shadow: 0 18px 70px rgba(0, 0, 0, 0.16);
  transform: translateY(-50%);
  -webkit-transform: translateY(-50%);
}

.modal-close {
  position: absolute;
  right: 14px;
  top: 14px;
  border-color: #e3e3e3;
  background: #f4f4f4;
  color: #666666;
  font-size: 14px;
}

.modal-close.icon-only {
  width: 32px;
  min-width: 32px;
  height: 32px;
  line-height: 30px;
  border-radius: 4px;
}

.modal-close:hover {
  background: #eeeeee;
  border-color: #bdbdbd;
  color: #262626;
}

.modal h2 {
  margin: 8px 40px 4px 0;
  font-family: "Jost", Arial, sans-serif;
  font-size: 30px;
  font-weight: 700;
  line-height: 1.2;
}

.modal p {
  font-size: 15px;
}

#modalAuthor {
  margin: 0 0 18px;
  color: #666666;
  font-size: 14px;
}

.modal h3 {
  margin: 0 0 8px;
  color: #262626;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.modal-meta {
  overflow: hidden;
  margin: 18px 0 24px;
  border: 1px solid #e3e3e3;
  border-radius: 5px;
}

.modal-meta div {
  float: left;
  width: 33.333%;
  padding: 12px 14px;
  border-right: 1px solid #e3e3e3;
}

.modal-meta div:last-child {
  border-right: 0;
}

.modal-meta span {
  display: block;
  color: #666666;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.modal-meta strong {
  display: block;
  margin-top: 2px;
  color: #262626;
  font-size: 15px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.briefing {
  margin: 0;
  white-space: pre-wrap;
  color: #262626;
  font-size: 15px;
  line-height: 1.7;
}

.modal-actions {
  overflow: hidden;
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid #e3e3e3;
}

.modal-actions button {
  float: left;
  margin: 0 8px 8px 0;
  padding: 9px 14px;
  font-size: 14px;
}

.modal-actions button:first-child {
  border-color: #e3e3e3;
  background: #ffffff;
  color: #262626;
}

.modal-actions button:first-child:hover {
  border-color: #101010;
}

.modal-actions button.faved {
  border-color: #fca5a5;
  background: #fef2f2;
  color: #991b1b;
}

.modal-actions button.faved svg {
  fill: #dc2626;
  stroke: #dc2626;
}

/* Scrollbars */

.modal::-webkit-scrollbar,
.generator-cards::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  background: #cfcfcf;
  border: 2px solid #ffffff;
  border-radius: 8px;
}

::-webkit-scrollbar-thumb:hover {
  background: #a0a0a0;
}

::-webkit-scrollbar-track {
  background: #f4f4f4;
  border-radius: 8px;
}

::-webkit-scrollbar-corner {
  background: transparent;
}

/* Narrower panels */

@media (max-width: 1200px) {
  .top-divider,
  .top-label {
    display: none;
  }

  .content {
    padding: 36px 36px 56px;
  }

  .card {
    width: calc(50% - 14px);
  }
}

@media (max-width: 800px) {
  .topbar {
    height: 66px;
    padding: 0 16px 0 10px;
  }

  .brand-logo {
    width: 190px;
  }

  .brand small {
    font-size: 8px;
    letter-spacing: 0.19em;
  }

  .layout {
    display: block;
  }

  .sidebar {
    width: auto;
    border-right: 0;
    border-bottom: 1px solid #e3e3e3;
  }

  .content {
    padding: 28px 18px 48px;
  }

  .page-title {
    font-size: 34px;
  }

  .card {
    width: calc(100% - 14px);
  }

  .modal-overlay {
    padding: 16px;
  }

  .modal {
    width: auto;
    padding: 24px 20px;
  }

  .modal-meta div {
    float: none;
    width: auto;
    border-right: 0;
    border-bottom: 1px solid #e3e3e3;
  }

  .modal-meta div:last-child {
    border-bottom: 0;
  }
}

@media (max-width: 430px) {
  .brand-logo {
    width: 150px;
  }

  .top-actions .btn-label {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .card {
    transition: none;
  }

  .card:hover {
    transform: none;
  }
}

/* MissionGen panel and history, light theme (overrides the shared portal-generator.css). */
#portal .generator-section { margin: 0 0 22px; padding-bottom: 22px; border-bottom: 1px solid #e3e3e3; }
#portal .generator-section > h2 { font-size: 12px; margin: 0 10px 10px; }
#portal .generator-section > p { margin: 0 10px 16px; color: #666666; font-size: 14px; word-wrap: break-word; }
#portal .generator-section > p a { color: #333333; text-decoration: underline; text-underline-offset: 3px; }
#portal .generator-section > .panel-block { margin-bottom: 0; padding-bottom: 0; border-bottom: 0; }
#portal .generator-panel { margin: 18px 10px 0; padding-top: 16px; border-top: 1px solid #e3e3e3; font-size: 14px; }
#portal .generator-panel [hidden], #portal .generator-history[hidden], #portal .generator-history [hidden] { display: none !important; }
#portal .generator-panel h2 { font-size: 15px; margin: 0 0 8px; color: #262626; }
#portal .generator-panel h3 { font-size: 14px; margin: 8px 0; color: #262626; }
#portal .generator-panel p { margin: 8px 0; color: #666666; overflow-wrap: break-word; }
#portal .generator-panel label { margin: 12px 0 6px; }
#portal .generator-panel input { display: block; width: 100%; box-sizing: border-box; margin: 6px 0 10px; }
#portal .generator-panel button { margin: 5px 5px 5px 0; }
#portal .generator-panel button:disabled { opacity: .5; cursor: default; }
#portal .generator-panel a { color: #333333; text-decoration: underline; }
#portal .generator-panel img { display: block; max-width: 100%; width: auto; height: auto; background: #ffffff; margin-top: 12px; border: 1px solid #e3e3e3; border-radius: 5px; }
#portal .generator-panel strong { font-size: 1.15em; letter-spacing: .08em; color: #262626; }
#portal .generator-panel .generator-notice, #portal .generator-history .generator-notice { padding: 8px 12px; border: 1px solid #bcd4f1; border-left: 3px solid #467bbc; border-radius: 5px; background: #eef5fd; color: #213e64; }
#portal .generator-history { margin: 36px 0; }
#portal .generator-history > h2 { margin: 0 0 12px; font-size: 19px; }
#portal .generator-history p { color: #666666; word-wrap: break-word; }
#portal .generator-history a { color: #333333; text-decoration: underline; }
#portal .generator-history button { margin: 5px 0 12px; padding: 9px 14px; border: 1px solid #101010; border-radius: 6px; background: #101010; color: #ffffff; }
#portal .generator-history button:disabled { opacity: .5; cursor: default; }
#portal .generator-cards { overflow-x: auto; white-space: nowrap; padding: 8px 0 12px; }
#portal .generator-history .generator-mission { display: inline-block; vertical-align: top; white-space: normal; width: 280px; max-width: 100%; box-sizing: border-box; padding: 18px 20px; margin-right: 14px; border: 1px solid #e3e3e3; border-radius: 7px; background: #ffffff; }
#portal .generator-history .generator-mission h3 { font-family: "Jost", Arial, sans-serif; font-size: 17px; margin: 0 0 10px; color: #262626; }

/* Account linking stays usable in the simulator's embedded browser. */
[hidden] { display: none !important; }
.device-link { margin: 12px 10px; overflow-wrap: break-word; font-size: 14px; }
.qr-loading { padding: 24px 0; color: #666666; text-align: center; }
.device-link img { display: block; background: #ffffff; max-width: 100%; height: auto; border: 1px solid #e3e3e3; border-radius: 5px; }
.device-link a { color: #333333; }
.device-link input { display: block; width: 100%; margin: 12px 0; padding: 10px; }
.device-link button, .account-links button { margin: 12px 10px 0; }
.device-link button { margin-left: 0; }
#traditionalSignIn { margin-top: 14px; font-size: 14px; }
