/* Credit Hire Direct — portal styles (shared design language with the marketing site:
   Manrope/Inter, yellow #FBBE00 primary on near-black #111111) */
@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Inter:wght@400;500;600&display=swap');
:root {
  --navy: #111111;          /* brand dark (headings, header bar) */
  --navy-dark: #000000;
  --accent: #FBBE00;        /* brand yellow (primary actions) */
  --accent-dark: #e3ab00;
  --blue: #b45309;          /* links: amber-family for brand cohesion */
  --bg: #F8F9FB;
  --card: #ffffff;
  --border: #E8E8E8;
  --text: #111111;
  --muted: #5C6672;
  --green: #10B981;
  --amber: #d97706;
  --red: #dc2626;
  --radius: 12px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Manrope', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }
a { color: var(--blue); text-decoration: none; }
input, select, textarea, button { font-family: 'Inter', 'Manrope', -apple-system, sans-serif; }

/* header — see "SIDEBAR NAVIGATION" at the end of this file */

/* layout */
.container { max-width: 1200px; margin: 0 auto; padding: 28px 20px 60px; }
.page-title { font-size: 1.5rem; color: var(--navy); margin-bottom: 4px; }
.page-sub { color: var(--muted); margin-bottom: 24px; font-size: 0.95rem; }
.grid { display: grid; gap: 18px; }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(min(210px, 100%), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); }

/* cards */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.card h3 { color: var(--navy); font-size: 1.05rem; margin-bottom: 14px; }
.stat { text-align: left; }
.stat .num { font-size: 2rem; font-weight: 700; color: var(--navy); }
.stat .lbl { color: var(--muted); font-size: 0.88rem; margin-top: 2px; }

/* tables */
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; min-width: 640px; }
th { text-align: left; padding: 12px 14px; background: #f8fafc; color: var(--muted); font-weight: 600; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.03em; border-bottom: 1px solid var(--border); }
td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: #f8fafc; }

/* badges */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; white-space: nowrap; }
.badge-green { background: #dcfce7; color: #166534; }
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-amber { background: #fef3c7; color: #92400e; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-grey { background: #f1f5f9; color: #475569; }

/* buttons & forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--accent); color: #111; border: none; border-radius: 30px; padding: 12px 22px; font-size: 0.95rem; font-weight: 700; cursor: pointer; min-height: 48px; font-family: 'Manrope', sans-serif; transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1); }
.btn:hover { background: var(--accent-dark); transform: translateY(-1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-green { background: var(--green); } .btn-green:hover { background: #15803d; }
.btn-red { background: var(--red); } .btn-red:hover { background: #b91c1c; }
.btn-outline { background: transparent; border: 1px solid currentColor; color: inherit; }
.btn-outline:hover { background: rgba(255,255,255,0.12); }
.btn-sm { padding: 6px 12px; min-height: 36px; font-size: 0.85rem; }
.btn-light { background: #f1f3f6; color: #111; } .btn-light:hover { background: #e6e9ee; }
.btn-dark { background: #111111; color: #fff; } .btn-dark:hover { background: #2a2a2a; }
label { display: block; font-size: 0.86rem; font-weight: 600; color: var(--text); margin: 14px 0 6px; }
input, select, textarea { width: 100%; padding: 11px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 0.95rem; font-family: inherit; background: #fff; }
input:focus, select:focus, textarea:focus { outline: 2px solid #bfdbfe; border-color: var(--blue); }
.hint { color: var(--muted); font-size: 0.82rem; margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.error-box { background: #fee2e2; color: #991b1b; border-radius: 8px; padding: 12px 14px; margin: 12px 0; font-size: 0.9rem; display: none; }
.error-box.show { display: block; }

/* modal */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(15,23,42,0.55); z-index: 90; padding: 24px; overflow-y: auto; }
.modal-overlay.open { display: flex; align-items: flex-start; justify-content: center; }
.modal { background: #fff; border-radius: 12px; max-width: 900px; width: 100%; padding: 26px; margin: 20px 0; position: relative; }
.modal-close { position: absolute; top: 14px; right: 16px; background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--muted); }
.modal h2 { color: var(--navy); font-size: 1.25rem; margin-bottom: 16px; padding-right: 30px; }

/* wizard */
.steps { display: flex; gap: 8px; margin-bottom: 26px; flex-wrap: wrap; }
.step { flex: 1; min-width: 120px; text-align: center; padding: 10px; border-radius: 8px; background: #e2e8f0; color: var(--muted); font-size: 0.85rem; font-weight: 600; }
.step.active { background: var(--navy); color: #fff; }
.step.done { background: #bbf7d0; color: #166534; }

/* dropzone / uploads */
.dropzone { border: 2px dashed var(--border); border-radius: 10px; padding: 20px; text-align: center; color: var(--muted); cursor: pointer; transition: all 0.15s; background: #fafbfc; }
.dropzone:hover, .dropzone.drag { border-color: var(--blue); background: #eff6ff; color: var(--blue); }
.doc-slot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.doc-slot .name { font-weight: 600; font-size: 0.9rem; }
.doc-slot .file-info { color: var(--muted); font-size: 0.82rem; }

/* photo gallery */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(140px, 100%), 1fr)); gap: 12px; }
.gallery .ph { position: relative; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); cursor: pointer; aspect-ratio: 4/3; background: #f1f5f9; }
.gallery .ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery .ph .cat { position: absolute; bottom: 0; left: 0; right: 0; background: rgba(15,23,42,0.7); color: #fff; font-size: 0.72rem; padding: 3px 8px; text-transform: capitalize; }
.lightbox { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.9); z-index: 100; align-items: center; justify-content: center; flex-direction: column; gap: 12px; padding: 24px; }
.lightbox.open { display: flex; }
.lightbox img { max-width: 92vw; max-height: 80vh; border-radius: 6px; }
.lightbox .lb-cap { color: #cbd5e1; font-size: 0.9rem; }
.lightbox .lb-close { position: absolute; top: 18px; right: 24px; color: #fff; background: none; border: none; font-size: 2rem; cursor: pointer; }

/* timeline */
.timeline { list-style: none; padding-left: 18px; border-left: 2px solid var(--border); }
.timeline li { position: relative; padding: 0 0 18px 16px; font-size: 0.9rem; }
.timeline li::before { content: ''; position: absolute; left: -7px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--navy); }
.timeline .when { color: var(--muted); font-size: 0.8rem; }

/* signature pad */
#sig-canvas { border: 1px solid var(--border); border-radius: 8px; background: #fff; touch-action: none; width: 100%; max-width: 500px; }

/* car diagram markers */
.chd-diagram { position: relative; max-width: 470px; margin: 0 auto; user-select: none; }
.chd-diagram.placing { cursor: crosshair; }
.chd-marker { position: absolute; transform: translate(-50%, -50%); font-size: 0.78rem; font-weight: 800; text-shadow: 0 0 3px #fff, 0 0 3px #fff; z-index: 5; line-height: 1; }
.chd-marker.chd-dot { width: 9px; height: 9px; background: #111827; border-radius: 50%; }
.defect-palette { display: flex; flex-wrap: wrap; gap: 6px; }
.defect-palette button { border: 1px solid var(--border); background: #f8fafc; border-radius: 6px; padding: 6px 10px; font-size: 0.8rem; font-weight: 700; cursor: pointer; color: #0d9488; min-height: 34px; }
.defect-palette button.active { background: #0d9488; color: #fff; border-color: #0d9488; }
.legend-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 4px 24px; font-size: 0.85rem; }

/* toast */
#chd-toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(80px); background: #16a34a; color: #fff; padding: 12px 22px; border-radius: 8px; font-size: 0.92rem; opacity: 0; transition: all 0.25s; z-index: 200; max-width: 90vw; }
#chd-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#chd-toast.err { background: var(--red); }

/* checklist */
.checklist { list-style: none; }
.checklist li { padding: 6px 0; font-size: 0.9rem; }
.checklist li::before { content: '✗ '; color: var(--red); font-weight: 700; }
.checklist li.ok::before { content: '✓ '; color: var(--green); }

/* misc */
.flex { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; }
.muted { color: var(--muted); font-size: 0.88rem; }
.filters { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.filters select, .filters input { width: auto; min-width: 160px; }

/* login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: linear-gradient(135deg, #111111 0%, #2b2b2b 100%); }
.login-card { background: #fff; border-radius: 20px; padding: 36px; width: 100%; max-width: 440px; border-top: 5px solid var(--accent); }
.login-card h1 { color: var(--navy); font-size: 1.4rem; margin-bottom: 4px; font-family: 'Manrope', sans-serif; }
.login-tabs { display: flex; gap: 6px; margin: 18px 0 6px; }
.login-tabs button { flex: 1; padding: 10px; border: 1px solid var(--border); background: #f8fafc; border-radius: 8px; cursor: pointer; font-weight: 600; color: var(--muted); }
.login-tabs button.active { background: var(--navy); color: #fff; border-color: var(--navy); }

@media (max-width: 768px) {
  .form-row { grid-template-columns: 1fr; }
  .modal { padding: 18px; }
}
@media print {
  #portal-header, .no-print { display: none !important; }
  body { background: #fff; }
  .card { border: none; padding: 0; }
}

/* ==========================================================================
   MOBILE APP SHELL — PORTAL
   Phones get native app chrome: a bottom tab bar, a "More" sheet, and data
   tables reflowed into readable card stacks instead of sideways scrolling.
   ========================================================================== */

:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --tabbar-height: 60px;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  overflow-x: hidden;
  overscroll-behavior-y: contain;
}

img, svg, video, canvas, iframe { max-width: 100%; }
img, video { height: auto; }



/* the bottom tab bar and its overflow sheet are phone-only */
.ph-tabs, .ph-sheet { display: none; }

@media (hover: none) and (pointer: coarse) {
  * { -webkit-tap-highlight-color: transparent; }
  #portal-header, .ph-tabs, .ph-sheet, .btn { -webkit-user-select: none; user-select: none; }
  .btn:active, .ph-tab:active, .ph-sheet-link:active { transform: scale(0.97); transition-duration: 0.06s; }
}

/* ==========================================================================
   PHONE / SMALL TABLET
   ========================================================================== */
@media (max-width: 860px) {
  /* --- header collapses to a title bar; navigation moves to the tab bar --- */

  /* --- bottom tab bar --- */
  .ph-tabs {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 900;
    display: flex;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.06);
    padding-bottom: var(--safe-bottom);
    padding-left: var(--safe-left);
    padding-right: var(--safe-right);
  }

  .ph-tab {
    flex: 1;
    min-width: 0;
    min-height: var(--tabbar-height);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 8px 2px;
    border: none;
    background: none;
    color: var(--muted);
    font-family: inherit;
    font-size: 0.66rem;
    font-weight: 600;
    line-height: 1.15;
    text-align: center;
    cursor: pointer;
    transition: color 0.15s ease;
  }

  .ph-tab svg { width: 22px; height: 22px; flex-shrink: 0; }

  .ph-tab span {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .ph-tab.active { color: var(--navy); }
  .ph-tab.active svg { stroke: var(--navy); }

  /* active tab gets the brand underline, the way app tab bars mark selection */
  .ph-tab.active::after {
    content: '';
    position: absolute;
    bottom: calc(6px + var(--safe-bottom));
    width: 22px;
    height: 3px;
    border-radius: 2px;
    background: var(--accent);
  }
  .ph-tab { position: relative; }

  /* --- "More" bottom sheet --- */
  .ph-sheet {
    position: fixed;
    inset: 0;
    z-index: 1400;
    display: block;
    background: rgba(17, 17, 17, 0.45);
    backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
  }

  .ph-sheet.open { opacity: 1; pointer-events: auto; }

  .ph-sheet-panel {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    background: var(--card);
    border-radius: 18px 18px 0 0;
    padding: 10px 20px calc(20px + var(--safe-bottom));
    transform: translateY(100%);
    transition: transform 0.28s cubic-bezier(0.22, 0.8, 0.3, 1);
    max-height: 85vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .ph-sheet.open .ph-sheet-panel { transform: translateY(0); }

  .ph-sheet-grip {
    width: 40px; height: 4px;
    border-radius: 2px;
    background: #d8dde5;
    margin: 2px auto 14px;
  }

  .ph-sheet-user { margin-bottom: 12px; }
  .ph-sheet-user strong { display: block; color: var(--navy); font-size: 1rem; }
  .ph-sheet-user small { color: var(--muted); text-transform: capitalize; }

  .ph-sheet-links { display: flex; flex-direction: column; gap: 2px; margin-bottom: 16px; }

  .ph-sheet-link {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 50px;
    padding: 8px 12px;
    border-radius: 10px;
    color: var(--text);
    font-weight: 600;
    font-size: 0.95rem;
  }

  .ph-sheet-link svg { width: 20px; height: 20px; stroke: var(--muted); flex-shrink: 0; }
  .ph-sheet-link.active { background: var(--accent); color: #111; }
  .ph-sheet-link.active svg { stroke: #111; }
  .ph-sheet-logout { width: 100%; min-height: 46px; }

  /* --- page body must clear the tab bar --- */
  .container { padding: 20px calc(16px + var(--safe-right)) calc(var(--tabbar-height) + 32px + var(--safe-bottom)) calc(16px + var(--safe-left)); }

  /* --- data tables become card stacks --- */
  .table-wrap {
    background: transparent;
    border: none;
    border-radius: 0;
    overflow: visible;
  }

  table { display: block; min-width: 0; width: 100%; font-size: 0.92rem; }
  thead { display: none; }
  tbody { display: block; }

  tbody tr {
    display: block;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 12px;
    padding: 4px 14px;
  }

  tbody tr:last-child { margin-bottom: 0; }
  tr.clickable:hover { background: var(--card); }
  tr.clickable:active { background: #f8fafc; }

  tbody td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: auto;
    padding: 10px 0;
    border-bottom: 1px solid #f1f5f9;
    text-align: right;
    white-space: normal;
  }

  tbody tr td:last-child { border-bottom: none; }

  tbody td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    max-width: 45%;
    text-align: left;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }

  /* action / unlabelled columns fill the row instead of showing an empty label */
  tbody td:not([data-label])::before,
  tbody td[data-label=""]::before { display: none; }
  tbody td:not([data-label]),
  tbody td[data-label=""] { justify-content: flex-end; }

  /* placeholder rows ("Loading…", "No results") stay as plain full-width text */
  tbody td[colspan] { display: block; text-align: center; padding: 18px 0; border-bottom: none; }
  tbody td[colspan]::before { display: none; }

  /* --- forms and modals --- */
  .form-row { grid-template-columns: 1fr; }
  input, select, textarea { font-size: 16px; }   /* stops iOS zooming on focus */
  .btn { min-height: 44px; }

  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal {
    width: 100%;
    max-width: none !important;
    max-height: 92vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 18px 18px 0 0;
    padding: 20px 18px calc(20px + var(--safe-bottom));
  }

  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

@media (max-width: 380px) {
  .ph-tab span { font-size: 0.6rem; }
  .ph-tab svg { width: 20px; height: 20px; }
}

/* the tab bar is app chrome, never printed */
@media print {
  .ph-tabs, .ph-sheet { display: none !important; }
}

/* ==========================================================================
   SIDEBAR NAVIGATION
   A fixed left rail on desktop; below 860px it gives way to the compact top
   bar plus the bottom tab strip.
   ========================================================================== */

:root { --side-w: 252px; }

#portal-header { color: #fff; }

/* ---- the rail ---- */
.ph-side {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--side-w);
  z-index: 800;
  display: flex;
  flex-direction: column;
  background: var(--navy);
  border-right: 1px solid rgba(255, 255, 255, 0.07);
  padding: 22px 14px calc(16px + var(--safe-bottom, 0px));
  padding-top: calc(22px + var(--safe-top, 0px));
  padding-left: calc(14px + var(--safe-left, 0px));
}

/* ---- brand ---- */
.ph-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 8px 22px;
  margin-bottom: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: #fff;
  text-decoration: none;
}

.ph-brand-mark {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 9px;
  background: var(--accent);
  color: #111;
  font-family: 'Manrope', sans-serif;
  font-weight: 800;
  font-size: 0.82rem;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ph-brand-text {
  font-family: 'Manrope', sans-serif;
  font-weight: 800;
  font-size: 1.02rem;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: #fff;
}

.ph-brand-text span { color: var(--accent); }

/* ---- nav ---- */
.ph-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  margin: 0 -4px;
  padding: 0 4px;
}

.ph-nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 42px;
  padding: 9px 12px;
  border-radius: 9px;
  color: #9AA1AB;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.ph-nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke: currentColor;
}

.ph-nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

/* Active state: a restrained tint plus a brand marker, rather than a solid
   block of yellow, so a long nav does not shout. */
.ph-nav-item.active {
  background: rgba(251, 190, 0, 0.13);
  color: #fff;
  font-weight: 700;
}

.ph-nav-item.active svg { stroke: var(--accent); }

.ph-nav-item.active::before {
  content: '';
  position: absolute;
  left: -4px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}

/* ---- footer: who is signed in, and the way out ---- */
.ph-side-foot {
  padding-top: 14px;
  margin-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.ph-side-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 12px;
  min-width: 0;
}

.ph-avatar {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ph-side-user-text { min-width: 0; line-height: 1.3; }

.ph-side-user-text strong {
  display: block;
  font-size: 0.86rem;
  color: #fff;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ph-side-user-text small {
  display: block;
  font-size: 0.74rem;
  color: #6B7280;
  text-transform: capitalize;
}

.ph-logout {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 40px;
  padding: 9px 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 9px;
  background: none;
  color: #9AA1AB;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.ph-logout svg { width: 17px; height: 17px; flex-shrink: 0; stroke: currentColor; }

.ph-logout:hover {
  background: rgba(220, 38, 38, 0.12);
  border-color: rgba(220, 38, 38, 0.35);
  color: #FCA5A5;
}

/* ---- compact bar (phones only) ---- */
.ph-topbar { display: none; }

/* ---- page offset ---- */
body.has-portal-side { padding-left: var(--side-w); }
body.has-portal-side .container { max-width: 1180px; }

/* ==========================================================================
   PHONE / SMALL TABLET — rail out, top bar and tab strip in
   ========================================================================== */
@media (max-width: 860px) {
  body.has-portal-side { padding-left: 0; }

  .ph-side { display: none; }

  .ph-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--navy);
    padding: 10px calc(16px + var(--safe-right, 0px)) 10px calc(16px + var(--safe-left, 0px));
    padding-top: calc(10px + var(--safe-top, 0px));
  }

  .ph-topbar .ph-brand {
    padding: 0;
    margin: 0;
    border: none;
  }

  .ph-topbar .ph-brand-text { font-size: 1.02rem; }
}

@media print {
  .ph-side, .ph-topbar { display: none !important; }
  body.has-portal-side { padding-left: 0; }
}

/* ==========================================================================
   TWO-FACTOR SIGN-IN
   Injected into the login card by api.js after the password step.
   ========================================================================== */
.tfa { text-align: center; }

.tfa-badge {
  width: 52px; height: 52px;
  margin: 4px auto 16px;
  border-radius: 14px;
  background: rgba(251, 190, 0, 0.14);
  color: var(--navy);
  display: flex; align-items: center; justify-content: center;
}
.tfa-badge svg { width: 24px; height: 24px; }

.tfa-title { font-size: 1.25rem; color: var(--navy); margin-bottom: 6px; font-family: 'Manrope', sans-serif; }

.tfa-sub {
  color: var(--muted); font-size: 0.9rem; line-height: 1.55;
  margin: 0 auto 20px; max-width: 320px;
}
.tfa-sub strong { color: var(--text); font-weight: 700; white-space: nowrap; }

.tfa label {
  display: block; text-align: left;
  font-size: 0.78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--muted); margin-bottom: 6px;
}

/* Wide tracking so six digits read as six distinct characters. */
.tfa-code {
  width: 100%;
  padding: 14px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  font-family: 'Manrope', sans-serif;
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: 0.4em;
  text-align: center;
  text-indent: 0.4em;      /* re-centres text that letter-spacing pushes left */
  color: var(--text);
}
.tfa-code::placeholder { color: #cbd5e1; letter-spacing: 0.35em; font-weight: 700; }
.tfa-code:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(251, 190, 0, 0.15); }

.tfa-submit:disabled { opacity: 0.7; cursor: default; }

.tfa-actions {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px;
  margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border);
}

.tfa-link {
  border: none; background: none; padding: 4px 2px;
  font-family: inherit; font-size: 0.85rem; font-weight: 600;
  color: var(--muted); cursor: pointer; text-decoration: underline;
  text-underline-offset: 3px;
}
.tfa-link:hover:not(:disabled) { color: var(--navy); }
.tfa-link:disabled { opacity: 0.5; cursor: default; text-decoration: none; }

@media (max-width: 480px) {
  .tfa-code { font-size: 1.45rem; letter-spacing: 0.3em; text-indent: 0.3em; }
}
