/* Auth feature styles: the standalone login page (Figma screen 06), the header
   avatar menu, and the admin settings modal. Design tokens come from tokens.css,
   which every page links first (the local :root copy was consolidated there in
   rel-2.0.0). */

/* ----------------------------------------------------------------- login page */
/* Full-bleed navy with the pipeline artwork; no card. The artwork is user-supplied
   (login-hero.png) — until it exists the gradient carries the page. */
body.auth-page {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: #fff;
  font-family: var(--font);
  background-color: var(--header-bg);
  /* Layered top-to-bottom: the artwork paints over a gradient that mirrors its
     own composition (flat navy sky above, near-black ground below), so if the
     file is ever missing the page still reads as designed rather than broken. */
  background-image:
    url('/img/login-hero.png'),
    linear-gradient(180deg,
      #052070 0%, #0A2C8F 32%, #06183F 66%, #050A16 100%);
  background-repeat: no-repeat;
  background-size: cover, cover;
  background-position: center bottom;
  -webkit-font-smoothing: antialiased;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 46px 56px 0;
}
.login-logo { display: block; height: 42px; width: auto; }
.login-brand-divider { width: 1px; height: 32px; background: rgb(255 255 255 / .6); }
.login-brand-title {
  font-size: 24px;
  font-weight: 500;
  letter-spacing: .1em;
  color: #fff;
  white-space: nowrap;
}

.login-main {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10vh 24px 24px;
}

.login-word {
  margin: 0 0 16px;
  font-size: 24px;
  font-weight: 400;
  color: rgb(255 255 255 / .95);
}

/* Microsoft SSO: white pill with the 4-square mark inline. */
.login-btn--sso {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  color: var(--ink);
  border: none;
  border-radius: 999px;
  padding: 12px 30px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  text-decoration: none;
  box-shadow: var(--shadow-lg);
  transition: transform .15s ease, box-shadow .2s ease;
}
.login-btn--sso:hover { transform: translateY(-1px); text-decoration: none; }
.login-btn--sso:active { transform: translateY(0); }
.login-btn--sso:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.login-btn--sso .ms-logo { display: block; flex-shrink: 0; }

.login-error {
  margin: 18px 0 0;
  min-height: 1em;
  font-size: 13px;
  font-weight: 500;
  color: #FFD3D3;
  text-align: center;
  text-shadow: 0 1px 2px rgb(0 0 0 / .4);
}

.login-version {
  margin: 0 0 16px;
  text-align: center;
  font-size: 11px;
  color: rgb(255 255 255 / .85);
  letter-spacing: .04em;
  /* The label sits over the artwork's pale pipework, where plain white washes
     out — the shadow keeps it readable whatever it lands on. */
  text-shadow: 0 1px 3px rgb(0 0 0 / .65);
}

/* ------------------------------------------------------------- header avatar menu */
.user-menu-mount { display: flex; flex: 0 0 auto; }

.user-menu { position: relative; display: flex; font-family: var(--font); }

/* Initials circle on the navy bar ("SF" in the Figma). */
.user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: none;
  background: #fff;
  color: var(--header-bg);
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: .02em;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: box-shadow .2s ease;
}
.user-avatar:hover { box-shadow: 0 0 0 3px rgb(255 255 255 / .28); }
.user-avatar:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.user-menu-pop {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 90;
  min-width: 230px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 14px;
}
.user-menu-pop[hidden] { display: none; }

.user-menu-email {
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Default button (Sign out): brand blue. */
.user-menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  padding: 8px 13px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  color: var(--navy);
  background: #fff;
  border: 1px solid var(--navy);
  border-radius: 8px;
  cursor: pointer;
  transition: background .2s ease, color .2s ease;
}

.user-menu-btn:hover { background: var(--navy); color: #fff; }
.user-menu-btn:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

/* Settings button: brand green. */
.user-menu-btn--settings {
  color: var(--green);
  border-color: var(--green);
}

.user-menu-btn--settings:hover { background: var(--green); color: #fff; }

/* Knowledge base console: cyan rule to tell it apart from Settings at a glance. The TEXT
   stays navy in both states — --cyan on white (and white on --cyan) both miss WCAG AA at
   13px, so the accent carries the border only. */
.user-menu-btn--kb { border-color: var(--cyan); }
.user-menu-btn--kb:hover { background: var(--navy); color: #fff; border-color: var(--navy); }

/* --------------------------------------------------------------- settings modal */
.auth-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgb(1 26 118 / .42);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 1000;
}

.auth-modal {
  width: 100%;
  max-width: 560px;
  max-height: 86vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  font-family: var(--font);
  color: var(--ink);
}

.auth-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
}

.auth-modal-head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: var(--navy);
}

.auth-modal-close {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  color: var(--gray);
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.auth-modal-close:hover { background: var(--bg-soft); color: var(--ink); }
.auth-modal-close:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

.auth-modal-body {
  padding: 20px 24px 24px;
  overflow-y: auto;
}

.auth-modal-section-title {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--gray);
}

.auth-modal-hint {
  margin: -4px 0 12px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--gray);
}

.user-list {
  list-style: none;
  margin: 0 0 22px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.user-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}

.user-list li:last-child { border-bottom: none; }

.user-list .ul-email {
  font-size: 14px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-list .ul-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 600;
  color: var(--navy);
  background: rgb(1 169 208 / .14);
  border-radius: 999px;
  vertical-align: middle;
}

.user-list .ul-remove {
  flex: none;
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  color: var(--red);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  cursor: pointer;
  transition: background .2s ease, border-color .2s ease;
}

.user-list .ul-remove:hover { background: rgb(161 33 32 / .07); border-color: rgb(161 33 32 / .4); }
.user-list .ul-remove:disabled { opacity: .4; cursor: not-allowed; }
.user-list .ul-remove:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

.add-user-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.add-user-form input[type="email"] {
  flex: 1 1 200px;
  min-width: 0;
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 9px;
}

.add-user-form input[type="email"]:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgb(1 169 208 / .18);
}

.add-user-form button {
  flex: none;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  color: #fff;
  background: var(--navy);
  border: none;
  border-radius: 9px;
  cursor: pointer;
  transition: background .2s ease;
}

.add-user-form button:hover { background: var(--navy-ink); }
.add-user-form button:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

.auth-modal-error {
  margin: 12px 0 0;
  min-height: 1em;
  font-size: 13px;
  color: var(--red);
}

.auth-modal-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.logs-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 15px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  color: var(--navy);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 9px;
  cursor: pointer;
  text-decoration: none;
  transition: background .2s ease;
}

.logs-link:hover { background: #eef0f7; }
.logs-link:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

/* ------------------------------------------------------ IM knowledge bundle panel */
.im-bundle-panel {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.im-bundle-status {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.im-bundle-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.im-bundle-pill {
  display: inline-block;
  padding: 3px 11px;
  font-size: 12px;
  font-weight: 700;
  text-transform: capitalize;
  letter-spacing: .02em;
  border-radius: 999px;
  color: var(--gray);
  background: rgb(96 101 105 / .12);
}

.im-bundle-pill--loaded { color: var(--green); background: rgb(1 158 29 / .12); }
.im-bundle-pill--missing { color: var(--gray); background: rgb(96 101 105 / .12); }
.im-bundle-pill--error { color: var(--red); background: rgb(161 33 32 / .10); }

.im-bundle-version {
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
}

.im-bundle-built {
  font-size: 12px;
  color: var(--gray);
}

.im-bundle-counts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.im-bundle-count {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 6px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.im-bundle-count-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--navy);
}

.im-bundle-count-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--gray);
}

.im-bundle-meta {
  margin: 0;
  font-size: 13px;
  color: var(--ink);
}

.im-bundle-statuserror {
  margin: 0;
  font-size: 13px;
  color: var(--red);
}

/* Launcher for the Knowledge Base console (kbconsole.css). Full width so it reads as
   "there is more here", not as a third button competing with the upload dropzone. */
.im-bundle-console-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  margin-top: 14px;
  padding: 10px 14px;
  font-size: 13.5px;
  font-weight: 600;
  font-family: inherit;
  text-align: left;
  color: var(--navy);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  transition: background .2s ease, border-color .2s ease;
}
.im-bundle-console-link::after { content: "\2192"; color: var(--gray); }
.im-bundle-console-link:hover { background: #eef0f7; border-color: var(--cyan); }
.im-bundle-console-link:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

.im-bundle-dropzone {
  margin-top: 14px;
  padding: 20px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 13px;
  color: var(--gray);
  background: var(--bg-soft);
  border: 1.5px dashed var(--warm-gray);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color .2s ease, background .2s ease, color .2s ease;
}

.im-bundle-dropzone:hover,
.im-bundle-dropzone:focus-visible {
  outline: none;
  border-color: var(--cyan);
  color: var(--navy);
}

.im-bundle-dropzone.drag-over {
  border-color: var(--cyan);
  background: rgb(1 169 208 / .08);
  color: var(--navy);
}

.im-bundle-dropzone.uploading {
  cursor: progress;
  border-style: solid;
  border-color: var(--cyan);
  color: var(--navy);
}

.im-bundle-error {
  margin: 12px 0 0;
  min-height: 1em;
  font-size: 13px;
  color: var(--red);
}

.im-bundle-notice {
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--green);
}

/* The bundle loaded, but it is not the whole knowledge base — or nothing in it says whether it
   is. Gold reads as caution; --gold fails AA as small text, so it carries the rule and tint only
   and the sentence itself stays --ink. */
.im-bundle-warning {
  margin: 10px 0 0;
  padding: 8px 10px;
  font-size: 13px;
  color: var(--ink);
  background: rgb(217 165 20 / .12);
  border-left: 3px solid var(--gold);
  border-radius: 8px;
}

/* A KNOWN-partial knowledge base is not an advisory. Red rule + tint + weight so an admin
   cannot skim past it while deciding whether this bundle is fit to serve. */
.im-bundle-warning--critical {
  font-weight: 600;
  background: rgb(161 33 32 / .10);
  border-left-color: var(--red);
}

/* ------------------------------------------------------------
   Coverage: discovered vs indexed, straight from the bundle's own ledger
   ------------------------------------------------------------ */

.im-coverage {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 13px;
  color: var(--ink);
}

.im-coverage-pill {
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.im-coverage--complete .im-coverage-pill { color: var(--green); background: rgb(1 158 29 / .12); }
.im-coverage--incomplete .im-coverage-pill { color: var(--red); background: rgb(161 33 32 / .12); }
.im-coverage--unverifiable .im-coverage-pill {
  color: var(--gray);
  background: rgb(96 101 105 / .12);
}
/* The count is the claim, so it inherits the verdict's colour rather than staying grey. */
.im-coverage--incomplete .im-coverage-count { color: var(--red); font-weight: 600; }

.im-coverage-detail {
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--ink);
}
.im-coverage-detail > summary {
  cursor: pointer;
  color: var(--navy-ink);
  font-weight: 600;
}
.im-coverage-root { margin: 6px 0 0; color: var(--gray); word-break: break-all; }

.im-coverage-reason {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}
.im-coverage-reason-n {
  flex: 0 0 auto;
  min-width: 2.5em;
  text-align: right;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* The full exclusion list can run to hundreds of rows; scroll it rather than pushing the
   upload dropzone below the fold. */
.im-coverage-files {
  margin: 8px 0 0;
  padding-left: 18px;
  max-height: 180px;
  overflow-y: auto;
  color: var(--gray);
  word-break: break-all;
}
.im-coverage-file-reason { margin-left: 6px; color: var(--red); }
