/*
 * portal.css - the customer Service Portal (/portal/).
 *
 * Purpose: phone-first layout on top of Bootstrap 5.3.2. The phone is not a
 *   cut-down version (CLAUDE.md RULE 15): everything works at 360px wide with
 *   no sideways scroll, every control is at least 44px tall, and on a desktop
 *   the page sits in one centred column.
 * Colours come only from Bootstrap's own variables, so the dark theme
 *   (portal.js follows the phone's setting) needs nothing extra here.
 * ASCII only: the Gateway embeds this file in a Pascal unit.
 * History: 2026-09-29: Created.
 */

body.portal {
  background-color: var(--bs-tertiary-bg);
  min-height: 100vh;
}

/* One centred column on a desktop, the full width on a phone. */
.portal-wrap {
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 12px;
  padding-right: 12px;
}

/* Long unbroken text (an email, a link, a part code) wraps instead of
   pushing the page sideways. */
.portal-wrap,
.portal .modal-content {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* ---- top bar ----------------------------------------------------------- */
.portal-topbar {
  position: sticky;
  top: 0;
  z-index: 1020;
  background-color: var(--bs-body-bg);
  border-bottom: 1px solid var(--bs-border-color);
}
.portal-topbar .portal-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 56px;
}
.portal-brand {
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 44px;
  color: var(--bs-body-color);
  text-decoration: none;
}
.portal-brand:hover,
.portal-brand:focus {
  color: var(--bs-body-color);
}
.portal-brand-name {
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.2;
}
.portal-company {
  font-size: .8rem;
  color: var(--bs-secondary-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.portal-company:empty {
  display: none;
}
#portal-menu {
  flex: 0 0 auto;
}
/* The company picker: a second row of the top bar, shown only to an
   administrator of more than one company. */
.portal-topbar .portal-picker {
  min-height: 0;
  padding-bottom: 8px;
}
.portal-picker-label {
  flex: 0 0 auto;
  font-size: .875rem;
  color: var(--bs-secondary-color);
}
.portal-picker .form-select {
  flex: 1 1 auto;
  min-width: 0;
}
/* Dusty's HD staff view, said above every screen. */
.portal-banner {
  margin: 12px 0 0;
}
.portal .dropdown-menu {
  min-width: 240px;
  max-width: calc(100vw - 24px);
}
.portal-menu-who {
  white-space: normal;
  overflow-wrap: anywhere;
}

/* ---- tap targets: 44px minimum ---------------------------------------- */
.portal .btn,
.portal .form-control,
.portal .form-select,
.portal .dropdown-item,
.portal .nav-link,
.portal .list-group-item-action {
  min-height: 44px;
}
.portal .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.portal .dropdown-item,
.portal .nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
}
/* A long title ("Disable <a long name>?") wraps; it must not squeeze the close
   button below 44px, which a flex item otherwise allows. */
.portal .modal-header .btn-close {
  box-sizing: content-box;
  flex: 0 0 auto;
  padding: 14px;
  margin: -14px -14px -14px auto;
}
.portal .modal-title {
  min-width: 0;
}

/* ---- page parts -------------------------------------------------------- */
#portal-main {
  padding-top: 16px;
  padding-bottom: 32px;
}
.portal-title {
  font-size: 1.5rem;
  margin-bottom: 12px;
}
.portal-card {
  margin-bottom: 16px;
}
.portal-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 24px 0;
  color: var(--bs-secondary-color);
}
.portal-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--bs-secondary-color);
  background-color: var(--bs-body-bg);
  border: 1px dashed var(--bs-border-color);
  border-radius: var(--bs-border-radius);
}
.portal-back {
  margin-bottom: 4px;
  text-decoration: none;
}
/* A primary action: full width on a phone, its own size on a desktop. */
.portal-cta {
  width: 100%;
  margin-bottom: 12px;
}
@media (min-width: 576px) {
  .portal-cta {
    width: auto;
  }
}
.portal-pre {
  white-space: pre-wrap;
}
.portal-clamp {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.portal-or {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 12px;
  font-size: .9rem;
  color: var(--bs-secondary-color);
}
.portal-or::before,
.portal-or::after {
  content: "";
  flex: 1 1 auto;
  border-top: 1px solid var(--bs-border-color);
}

/* ---- search box -------------------------------------------------------- */
.portal-search {
  position: relative;
}
.portal-search .bi {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--bs-secondary-color);
  pointer-events: none;
}
.portal-search .form-control {
  padding-left: 40px;
}

/* ---- lists ------------------------------------------------------------- */
.portal-list {
  margin-bottom: 16px;
}
.portal-item {
  display: flex;
  align-items: center;
  gap: 12px;
}
.portal-item-main {
  flex: 1 1 auto;
  min-width: 0;
}
.portal-item-chevron {
  flex: 0 0 auto;
  color: var(--bs-secondary-color);
}
.portal-rego {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: .02em;
  line-height: 1.2;
}
.portal-rego-lg {
  font-size: 1.75rem;
}
.portal-group-head {
  margin: 16px 0 8px;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--bs-secondary-color);
}
.portal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.portal-actions .btn {
  flex: 1 1 auto;
}
@media (min-width: 576px) {
  .portal-actions .btn {
    flex: 0 0 auto;
  }
}

/* ---- tabs -------------------------------------------------------------- */
.portal-tabs {
  gap: 4px;
  margin: 16px 0 12px;
  padding: 4px;
  background-color: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: var(--bs-border-radius-lg);
}
.portal-tabs .nav-link {
  justify-content: center;
}

/* ---- job detail -------------------------------------------------------- */
.portal-task {
  margin-bottom: 8px;
}
.portal-subhead {
  margin-top: 10px;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--bs-secondary-color);
}
.portal-lines {
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
}
.portal-lines li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  border-top: 1px solid var(--bs-border-color-translucent);
}
.portal-line-text {
  flex: 1 1 auto;
  min-width: 0;
}
.portal-line-num {
  flex: 0 0 auto;
  white-space: nowrap;
  color: var(--bs-secondary-color);
}

/* ---- invitation link --------------------------------------------------- */
.portal-link-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.portal-link-actions .btn {
  flex: 1 1 auto;
}

/* ---- truck page: actions, the unsafe line, big answer buttons ---------- */
.portal-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.portal-card-actions .portal-cta {
  margin-bottom: 0;
}
.portal-unsafe {
  font-weight: 600;
}
/* Reporting a fault: two parts of the truck to a row on a phone (three on a
   desktop), one fault or severity to a row. Every answer is a big button. */
.portal-choice-grid,
.portal-choice-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.portal-choice-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}
@media (min-width: 576px) {
  .portal-choice-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.portal .portal-choice {
  min-height: 56px;
  white-space: normal;
}
.portal-choice-list .portal-choice {
  justify-content: flex-start;
  text-align: left;
}
/* A tick box row: the whole row is the tap target, never just the box. */
.portal-check {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding-left: 0;
  margin-bottom: 4px;
}
.portal-check .form-check-input {
  flex: 0 0 auto;
  float: none;
  width: 1.5em;
  height: 1.5em;
  margin: 0;
}
.portal-check .form-check-label {
  flex: 1 1 auto;
  align-self: stretch;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  min-height: 44px;
  padding: 8px 0;
}
/* Three tabs on a phone stay on one row, equal widths; a long name wraps
   inside its own tab instead of pushing a tab onto a second row. */
.portal .portal-tabs {
  flex-wrap: nowrap;
}
.portal .portal-tabs .nav-link {
  flex: 1 1 0;
  min-width: 0;
  padding-left: 8px;
  padding-right: 8px;
  line-height: 1.2;
  text-align: center;
  overflow-wrap: normal;   /* break between words, never inside "Faults" */
  word-break: normal;
}

/* ---- what a driver or a workshop can see ------------------------------- */
/* The chip is the value itself, and tapping it changes it (gate 13). */
.portal .portal-chip {
  display: flex;
  justify-content: flex-start;
  width: 100%;
  text-align: left;
  white-space: normal;
  font-size: .875rem;
}
@media (min-width: 576px) {
  .portal .portal-chip {
    width: auto;
  }
}
.portal-chip-off {
  display: flex;
  align-items: center;
  gap: 6px;
}
.portal-truck-pick {
  margin: 4px 0 8px 28px;
}
