/* Tender Pack Engine — premium dark design system (matches the landing page) */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,700&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --navy: #081a30; --navy-2: #0f2a47; --ink: #0b1220;
  --gold: #e0b34a; --gold-2: #f2d287; --green: #2ecc8a; --red: #ff6b6b; --amber: #f0b429;
  --mist: #c7d3e3; --mist-2: #93a5bd; --text: #eaf0f8;
  --glass: rgba(255,255,255,.06); --glass-2: rgba(255,255,255,.09); --glass-b: rgba(255,255,255,.12);
  --radius: 18px; --radius-sm: 12px;
  /* Legacy token names used by earlier templates */
  --tpe-navy: var(--navy); --tpe-navy-2: var(--navy-2); --tpe-green: var(--green); --tpe-gold: var(--gold);
  --tpe-red: var(--red); --tpe-amber: var(--amber); --tpe-grey: #7b8ca3; --tpe-bg: var(--navy);
  --bs-body-bg: var(--navy); --bs-body-color: var(--text);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body.tpe { margin: 0; min-height: 100vh; font-family: Inter, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--text); background: var(--navy); }
body.tpe::before { content: ""; position: fixed; inset: 0; z-index: -2; background:
  radial-gradient(1100px 600px at 12% -10%, rgba(224,179,74,.20), transparent 60%),
  radial-gradient(900px 500px at 100% 20%, rgba(46,204,138,.14), transparent 60%),
  radial-gradient(800px 800px at 50% 120%, rgba(36,92,143,.45), transparent 60%),
  linear-gradient(180deg, #071427 0%, #0b1f3a 60%, #081a30 100%); }
body.tpe::after { content: ""; position: fixed; inset: 0; z-index: -1; opacity: .06; pointer-events: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/></filter><rect width='160' height='160' filter='url(%23n)' opacity='.6'/></svg>"); }
.tpe h1, .tpe h2, .tpe h3, .tpe .h1, .tpe .h2, .tpe .h3 { font-family: Fraunces, Georgia, serif; font-weight: 700; letter-spacing: -.01em; }
.tpe a { color: var(--gold-2); }
.tpe a:hover { color: #fff; }
.tpe ::selection { background: rgba(224,179,74,.35); }

/* ---------- Navigation ---------- */
.tpe .navbar.tpe-nav { background: rgba(8,26,48,.72); backdrop-filter: blur(14px); border-bottom: 1px solid var(--glass-b); padding: .55rem 0; position: sticky; top: 0; z-index: 1030; }
.tpe .navbar-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: #fff !important; }
.tpe .navbar-brand .mark { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, var(--gold), #b8860b); display: grid; place-items: center; color: #1a1400; font-size: 17px; box-shadow: 0 8px 24px rgba(224,179,74,.3); }
.tpe .navbar .nav-link { color: var(--mist); font-weight: 500; padding: .45rem .75rem; border-radius: 10px; }
.tpe .navbar .nav-link:hover { color: #fff; background: var(--glass); }
.tpe .navbar .nav-link.active { color: #fff; background: rgba(224,179,74,.14); border: 1px solid rgba(224,179,74,.25); }
.tpe .navbar-toggler { border-color: var(--glass-b); }
.tpe .navbar-toggler-icon { background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='30' height='30' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(234,240,248,.9)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e"); }
.tpe .dropdown-menu { background: #0e2440; border: 1px solid var(--glass-b); box-shadow: 0 20px 50px rgba(0,0,0,.45); }
.tpe .dropdown-item { color: var(--mist); }
.tpe .dropdown-item:hover { background: var(--glass); color: #fff; }
.tpe .user-chip { display: inline-flex; align-items: center; gap: 8px; }
.tpe .user-chip .avatar { width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(135deg, var(--gold-2), var(--gold)); color: #1a1400; font-weight: 700; font-size: .8rem; display: grid; place-items: center; }

/* ---------- Hero / headers ---------- */
.tpe-hero { position: relative; overflow: hidden; background: linear-gradient(160deg, rgba(255,255,255,.09), rgba(255,255,255,.03)); border: 1px solid var(--glass-b); border-radius: 22px; padding: 1.5rem 1.7rem; backdrop-filter: blur(14px); box-shadow: 0 30px 80px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.12); color: var(--text); }
.tpe-hero::after { content: ""; position: absolute; right: -80px; top: -80px; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(circle, rgba(224,179,74,.22), transparent 70%); pointer-events: none; }
.tpe-hero h1 { font-size: clamp(1.25rem, 2.2vw, 1.7rem); margin: 0; line-height: 1.2; }
.tpe-hero .meta { color: var(--mist); font-size: .9rem; }
.tpe-chip, .eyebrow { display: inline-flex; align-items: center; gap: 6px; padding: .22rem .65rem; border-radius: 999px; background: var(--glass); border: 1px solid var(--glass-b); font-size: .78rem; margin: .35rem .35rem 0 0; color: var(--mist); }
.eyebrow { color: var(--gold-2); background: rgba(224,179,74,.1); border-color: rgba(224,179,74,.25); letter-spacing: .1em; text-transform: uppercase; font-size: .72rem; }
.countdown { font-family: Fraunces, serif; font-weight: 700; font-size: 1.15rem; color: #fff; }
.countdown.danger { color: #ffb3b3; }

/* ---------- Cards ---------- */
.tpe .card, .tpe-card, .stat-tile { background: var(--glass); border: 1px solid var(--glass-b); border-radius: var(--radius); color: var(--text); box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.tpe .card:hover { border-color: rgba(224,179,74,.3); }
.tpe .card-header { background: transparent; border-bottom: 1px solid var(--glass-b); font-weight: 700; color: #fff; padding: .85rem 1.1rem; }
.tpe .card-header.bg-primary, .tpe .card-header.bg-success, .tpe .card-header.bg-light, .tpe .card-header.bg-info, .tpe .card-header.bg-warning { background: transparent !important; color: #fff !important; }
.tpe .card-footer { background: transparent; border-top: 1px solid var(--glass-b); }
.tpe .card-title { color: #fff; }
.tpe .card-text, .tpe .text-muted, .tpe .hint, .tpe .tiny, .tpe .form-text { color: var(--mist-2) !important; }
.tpe .tiny { font-size: .75rem; } .tpe .hint { font-size: .82rem; }
.tpe .list-group-item { background: transparent; color: var(--text); border-color: var(--glass-b); }
.stat-tile { padding: 1rem 1.2rem; }
.stat-tile .n { font-family: Fraunces, serif; font-size: 1.9rem; font-weight: 700; color: #fff; line-height: 1; }
.stat-tile .l { color: var(--mist-2); font-size: .82rem; margin-top: .25rem; }
.brief { background: rgba(224,179,74,.08); border-left: 4px solid var(--gold); padding: .75rem 1rem; border-radius: 8px; font-size: .9rem; white-space: pre-wrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* ---------- Verdict banner ---------- */
.verdict { border-radius: var(--radius); padding: 1rem 1.25rem; color: #fff; display: flex; align-items: center; gap: 1rem; border: 1px solid var(--glass-b); background: var(--glass); }
.verdict .score { font-family: Fraunces, serif; font-size: 2.2rem; font-weight: 700; line-height: 1; min-width: 86px; }
.verdict.READY { background: linear-gradient(135deg, rgba(46,204,138,.28), rgba(46,204,138,.08)); border-color: rgba(46,204,138,.4); }
.verdict.READY .score { color: var(--green); }
.verdict.AT-RISK, .verdict.AT_RISK { background: linear-gradient(135deg, rgba(240,180,41,.28), rgba(240,180,41,.08)); border-color: rgba(240,180,41,.4); }
.verdict.AT-RISK .score, .verdict.AT_RISK .score { color: var(--gold-2); }
.verdict.NON-RESPONSIVE { background: linear-gradient(135deg, rgba(255,107,107,.28), rgba(255,107,107,.08)); border-color: rgba(255,107,107,.4); }
.verdict.NON-RESPONSIVE .score { color: #ffb3b3; }
.verdict.CLOSED { background: linear-gradient(135deg, rgba(255,255,255,.12), rgba(255,255,255,.04)); }
.verdict.CLOSED .score { color: var(--mist); }
.verdict.INCOMPLETE { background: linear-gradient(135deg, rgba(74,111,165,.4), rgba(74,111,165,.12)); border-color: rgba(120,160,220,.4); }
.verdict.INCOMPLETE .score { color: #bcd2f5; }
.verdict .btn-light { background: var(--glass-2); border: 1px solid var(--glass-b); color: #fff; }
.verdict .btn-light:hover { background: rgba(255,255,255,.16); color: #fff; }

/* ---------- Pills / statuses ---------- */
.pill { display: inline-block; font-size: .68rem; font-weight: 700; letter-spacing: .05em; padding: .25rem .55rem; border-radius: 6px; text-transform: uppercase; white-space: nowrap; }
.pill.ok, .pill.done, .pill.valid { background: rgba(46,204,138,.2); color: #8ff0c5; }
.pill.expiring, .pill.warning, .pill.pending, .pill.unknown { background: rgba(224,179,74,.2); color: var(--gold-2); }
.pill.expired, .pill.missing { background: rgba(255,107,107,.2); color: #ffb3b3; }
.pill.manual, .pill.not_applicable { background: var(--glass-2); color: var(--mist); }
.tpe .badge.bg-success { background: rgba(46,204,138,.25) !important; color: #8ff0c5; }
.tpe .badge.bg-warning { background: rgba(224,179,74,.25) !important; color: var(--gold-2); }
.tpe .badge.bg-danger { background: rgba(255,107,107,.25) !important; color: #ffb3b3; }
.tpe .badge.bg-secondary { background: var(--glass-2) !important; color: var(--mist); }

/* ---------- Checklist / lists ---------- */
.check-row { border-bottom: 1px solid var(--glass-b); padding: .65rem .25rem; }
.check-row:last-child { border-bottom: 0; }
.check-row .lbl { font-weight: 600; color: #fff; }
.check-row .msg { color: var(--mist); font-size: .88rem; }
.check-row .act { color: var(--gold-2); font-size: .84rem; }
.check-row.mandatory .lbl::after { content: " *"; color: #ffb3b3; }
.fact { display: flex; justify-content: space-between; gap: .75rem; padding: .4rem 0; border-bottom: 1px dashed var(--glass-b); font-size: .88rem; }
.fact b { color: #fff; overflow-wrap: anywhere; } .fact span { text-align: right; color: var(--mist); }
.trap { font-size: .84rem; color: var(--mist); padding: .4rem 0; border-bottom: 1px dashed var(--glass-b); }
.trap .pg { color: var(--gold-2); font-weight: 600; }
.doc-folder h6 { color: var(--gold-2); font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; margin-top: .9rem; }
.doc-file { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: .15rem .75rem; padding: .45rem 0; font-size: .88rem; border-bottom: 1px solid var(--glass-b); }
.doc-file > :first-child { flex: 1 1 12rem; min-width: 0; }          /* min-width:0 lets a flex item shrink below its content */
.doc-file > .tiny { flex: 0 0 auto; margin-left: auto; white-space: nowrap; }
.doc-file a { color: var(--text); } .doc-file a:hover { color: var(--gold-2); }
.doc-file .filled { color: #8ff0c5; font-weight: 600; }
.audit-row { font-size: .82rem; padding: .35rem 0; border-bottom: 1px dashed var(--glass-b); color: var(--mist); }
.audit-row code { font-size: .72rem; color: var(--mist-2); }
.drop, .upload-zone { border: 2px dashed rgba(199,211,227,.35); border-radius: var(--radius); padding: 1.2rem; text-align: center; color: var(--mist); background: var(--glass); cursor: pointer; transition: border-color .2s, background .2s; }
.drop:hover, .upload-zone:hover, .drop.dragover, .upload-zone.dragover { border-color: var(--gold); background: rgba(224,179,74,.08); }
.upload-zone { padding: 2.2rem 1.2rem; }
.upload-zone .display-1 { color: var(--gold-2) !important; font-size: 3rem; }
.file-item { background: var(--glass); border: 1px solid var(--glass-b) !important; border-radius: var(--radius-sm); padding: .6rem .8rem; margin: .4rem 0; color: var(--text); }
.progress-step { padding: .9rem 1rem; margin: .6rem 0; border-radius: var(--radius-sm); border-left: 4px solid var(--gold); background: var(--glass); color: var(--text); }
.progress-step.success { border-color: var(--green); background: rgba(46,204,138,.12); }
.progress-step.error { border-color: var(--red); background: rgba(255,107,107,.12); }
.progress-step.warning, .progress-step.info { border-color: var(--amber); background: rgba(240,180,41,.12); }
.tender-card, .dashboard-card { background: var(--glass); border: 1px solid var(--glass-b); border-radius: var(--radius); }

/* ---------- Buttons ---------- */
.tpe .btn { border-radius: 11px; font-weight: 600; }
.btn-tpe, .tpe .btn-primary, .btn-gold { background: linear-gradient(135deg, var(--gold-2), var(--gold)); color: #1a1400 !important; border: 0; box-shadow: 0 8px 24px rgba(224,179,74,.25); }
.btn-tpe:hover, .tpe .btn-primary:hover, .btn-gold:hover { filter: brightness(1.05); transform: translateY(-1px); color: #1a1400 !important; }
.btn-tpe-green, .tpe .btn-success { background: linear-gradient(135deg, #3fe19c, #1fa86f); color: #05261a !important; border: 0; }
.btn-tpe-green:hover, .tpe .btn-success:hover { filter: brightness(1.05); color: #05261a !important; }
.tpe .btn-warning { background: linear-gradient(135deg, var(--gold-2), var(--gold)); color: #1a1400 !important; border: 0; }
.tpe .btn-danger { background: rgba(255,107,107,.18); color: #ffb3b3 !important; border: 1px solid rgba(255,107,107,.4); }
.tpe .btn-info { background: rgba(120,180,255,.18); color: #cfe3ff !important; border: 1px solid rgba(120,180,255,.4); }
.tpe .btn-light, .tpe .btn-secondary, .btn-ghost { background: var(--glass-2); border: 1px solid var(--glass-b); color: #fff !important; }
.tpe .btn-light:hover, .tpe .btn-secondary:hover, .btn-ghost:hover { background: rgba(255,255,255,.16); color: #fff !important; }
.tpe .btn-outline-primary, .tpe .btn-outline-secondary, .tpe .btn-outline-info, .tpe .btn-outline-success, .tpe .btn-outline-warning, .tpe .btn-outline-danger { border-color: var(--glass-b); color: var(--mist); }
.tpe .btn-outline-primary:hover, .tpe .btn-outline-secondary:hover, .tpe .btn-outline-info:hover, .tpe .btn-outline-success:hover, .tpe .btn-outline-warning:hover { background: var(--glass-2); color: #fff; border-color: rgba(224,179,74,.4); }
.tpe .btn-outline-danger:hover { background: rgba(255,107,107,.18); color: #ffb3b3; border-color: rgba(255,107,107,.4); }
.tpe .btn:disabled { opacity: .45; }

/* ---------- Forms / tables / modals / alerts ---------- */
.tpe .form-control, .tpe .form-select { background: rgba(8,26,48,.55); border: 1px solid var(--glass-b); color: #fff; border-radius: 10px; }
.tpe .form-control:focus, .tpe .form-select:focus { border-color: var(--gold); box-shadow: 0 0 0 .2rem rgba(224,179,74,.2); background: rgba(8,26,48,.75); color: #fff; }
.tpe .form-control::placeholder { color: var(--mist-2); }
.tpe .form-select { background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23c7d3e3' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e"); background-repeat: no-repeat; background-position: right .75rem center; background-size: 16px 12px; padding-right: 2.2rem; }
.tpe .form-select option { background: #0e2440; color: #fff; }
.tpe .form-label { color: var(--mist); }
.tpe .form-check-input { background-color: rgba(8,26,48,.6); border-color: var(--glass-b); }
.tpe .form-check-input:checked { background-color: var(--gold); border-color: var(--gold); }
.tpe .table { color: var(--text); --bs-table-bg: transparent; --bs-table-color: var(--text); border-color: var(--glass-b); }
.tpe .table td, .tpe .table th { border-color: var(--glass-b); }
.tpe .modal-content { background: #0e2440; border: 1px solid var(--glass-b); color: var(--text); border-radius: var(--radius); }
.tpe .modal-header, .tpe .modal-footer { border-color: var(--glass-b); }
.tpe .btn-close { filter: invert(1) grayscale(1); }
.tpe .alert { border-radius: var(--radius-sm); border: 1px solid var(--glass-b); background: var(--glass-2); color: var(--text); }
.tpe .alert-success { background: rgba(46,204,138,.15); border-color: rgba(46,204,138,.35); color: #c9f5e2; }
.tpe .alert-warning { background: rgba(224,179,74,.15); border-color: rgba(224,179,74,.35); color: #fbe9bd; }
.tpe .alert-danger { background: rgba(255,107,107,.15); border-color: rgba(255,107,107,.35); color: #ffd3d3; }
.tpe .alert a { color: #fff; text-decoration: underline; }
.tpe .progress { background: var(--glass-2); }
.tpe .nav-pills .nav-link { color: var(--mist); border-radius: 10px; }
.tpe .nav-pills .nav-link.active { background: rgba(224,179,74,.18); color: #fff; border: 1px solid rgba(224,179,74,.3); }
.tpe hr { border-color: var(--glass-b); opacity: 1; }
.tpe footer, .tpe .tpe-footer { background: transparent !important; color: var(--mist-2) !important; border-top: 1px solid var(--glass-b); font-size: .85rem; }
.tpe .spinner-border.text-primary { color: var(--gold) !important; }
.tpe details summary { cursor: pointer; }
.tpe .text-primary { color: var(--gold-2) !important; }
.tpe .text-success { color: #8ff0c5 !important; }
.tpe .text-danger { color: #ffb3b3 !important; }
.tpe .text-warning, .tpe .text-info { color: var(--gold-2) !important; }
.tpe .bg-white, .tpe .bg-light { background: transparent !important; }

/* ---------- Opportunities ---------- */
.opp { border-left: 4px solid var(--glass-b); }
.opp.hot { border-left-color: var(--green); } .opp.warm { border-left-color: var(--gold); }
.score-ring { width: 54px; height: 54px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-family: Fraunces, serif; font-weight: 700; font-size: 1.1rem; color: #061223; flex-shrink: 0; }
.reason { display: inline-block; background: var(--glass-2); border: 1px solid var(--glass-b); color: var(--mist); border-radius: 6px; padding: .12rem .5rem; font-size: .74rem; margin: .15rem .25rem .15rem 0; }
.claude-box { background: rgba(224,179,74,.08); border-left: 4px solid var(--gold); border-radius: 8px; padding: .6rem .8rem; font-size: .86rem; }
.rec-BID { color: #8ff0c5; } .rec-CONSIDER { color: var(--gold-2); } .rec-SKIP { color: #ffb3b3; }

/* ---------- Busy overlay ---------- */
.busy-overlay { position: fixed; inset: 0; background: rgba(4,12,24,.65); backdrop-filter: blur(6px); z-index: 2000; display: flex; align-items: center; justify-content: center; }
.busy-overlay .box { background: #0e2440; border: 1px solid var(--glass-b); border-radius: var(--radius); padding: 1.5rem 1.25rem; min-width: min(300px, 88vw); max-width: 90vw; text-align: center; color: #fff; box-shadow: 0 30px 80px rgba(0,0,0,.5); }

/* ---------- Auth ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(440px, 100%); background: linear-gradient(160deg, rgba(255,255,255,.09), rgba(255,255,255,.03)); border: 1px solid var(--glass-b); border-radius: 24px; padding: 2rem; backdrop-filter: blur(14px); box-shadow: 0 30px 80px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.12); }
.auth-card h1 { font-size: 1.7rem; margin: .6rem 0 .2rem; }
.auth-card .sub { color: var(--mist); font-size: .92rem; margin-bottom: 1.3rem; }
.auth-card label { font-size: .8rem; color: var(--mist); margin-bottom: .3rem; display: block; }
.auth-card .form-control { padding: .7rem .9rem; margin-bottom: .9rem; }
.auth-card .switch { text-align: center; color: var(--mist-2); font-size: .88rem; margin-top: 1rem; }

/* ---------- Responsive ---------- */
@media (max-width: 991px) {
  .tpe .navbar.tpe-nav { position: sticky; }
  .tpe .navbar-collapse { position: absolute; top: calc(100% + 8px); left: 12px; right: 12px; z-index: 1040; background: rgba(10,30,56,.94); backdrop-filter: blur(18px); border: 1px solid var(--glass-b); border-radius: 16px; padding: .6rem; box-shadow: 0 30px 60px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.1); transform-origin: top right; }
  .tpe .navbar-collapse.collapsing { height: auto !important; transition: none; opacity: 0; transform: translateY(-6px) scale(.98); }
  .tpe .navbar-collapse.show { animation: tpeMenuIn .18s ease-out; }
  .tpe .navbar-collapse .nav-link { padding: .65rem .85rem; }
  .tpe .navbar-collapse .navbar-nav + .navbar-nav { border-top: 1px solid var(--glass-b); margin-top: .35rem; padding-top: .35rem; }
  .tpe .navbar-collapse .dropdown-menu { position: static !important; transform: none !important; background: transparent; border: 0; box-shadow: none; padding-left: .5rem; }
  @keyframes tpeMenuIn { from { opacity: 0; transform: translateY(-6px) scale(.98); } to { opacity: 1; transform: none; } }
  .verdict { flex-direction: column; align-items: flex-start; }
  .verdict .score { min-width: 0; }
  .tpe-hero { padding: 1.2rem 1.2rem; }
  .fact { flex-direction: column; gap: .1rem; } .fact span { text-align: left; }
  .check-row .form-check { order: -1; }
}
@media (max-width: 575px) {
  .tpe .container, .tpe .container-fluid { padding-left: 12px; padding-right: 12px; }
  .stat-tile .n { font-size: 1.5rem; }
  .verdict .btn { flex: 1 1 auto; }
  .score-ring { width: 46px; height: 46px; font-size: .95rem; }
  .opp .card-body { flex-direction: column; }
}


/* ---------- Touch targets ----------
   Phones and tablets get 44px minimum hit areas (Apple HIG) without making the
   desktop UI bulky. Keyed on a coarse pointer, so a small laptop window is unaffected. */
@media (hover: none) and (pointer: coarse) {
  .tpe .btn { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
  .tpe .btn-sm { min-height: 44px; padding-left: .9rem; padding-right: .9rem; }
  .tpe .btn-sm > i:only-child { min-width: 1.4rem; }   /* icon-only buttons keep a square hit area */
  .tpe .form-control, .tpe .form-select { min-height: 44px; font-size: 16px; }  /* 16px stops iOS zooming on focus */
  .tpe .form-check-input { width: 24px; height: 24px; margin-top: 0; }
  /* Give the checkbox a full 44px tap area without moving it visually */
  .check-row .form-check { padding: 10px; margin: -10px; min-width: 44px; min-height: 44px; display: flex; align-items: center; }
  /* A tender title can run ten lines of display type on a phone; show four and reveal on tap */
  .tpe-hero h1 { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; }
  .tpe-hero h1.expanded { -webkit-line-clamp: unset; }
  .tpe .nav-link, .tpe .dropdown-item { min-height: 44px; display: flex; align-items: center; }
  /* Page-reference links sit inside dense text; grow the hit area, not the type */
  .check-row a, .trap a, .doc-file a, .audit-row a { display: inline-block; padding: .45rem .3rem; margin: -.45rem -.3rem; }
  .tpe .tiny, .tpe .hint { font-size: .8rem; }
  .pill { font-size: .72rem; }   /* 11px uppercase is legible on a monitor, not on a phone in daylight */
  .tpe .btn-close { width: 1.2em; height: 1.2em; padding: .75rem; }
  .score-ring { width: 52px; height: 52px; }
  /* Stack the workspace action bar so every button is full width and reachable */
  .verdict .d-flex.flex-wrap { width: 100%; }
  .verdict .btn { flex: 1 1 45%; }
}

/* Respect users who ask for less motion */
@media (prefers-reduced-motion: reduce) {
  .tpe *, .tpe *::before, .tpe *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}


/* ---------- Mobile layout integrity ----------
   Two failure modes fixed here:
   1. A .btn is inline-flex with a 44px min-height on touch devices. Two of them on a
      wrapping line produce boxes taller than the line box, so they overlap. Any element
      holding more than one button is therefore laid out as a flex row.
   2. Card headers that pair a title with a right-aligned note squeeze both into slivers
      on a narrow screen. They wrap instead. */
@media (max-width: 640px) {
  .tpe .btn-group, .tpe .card-footer .btn-group { display: flex; flex-wrap: wrap; gap: .4rem; }
  .tpe .btn-group > .btn { flex: 1 1 auto; border-radius: 11px !important; }

  .tpe .card-header.d-flex, .tpe .card-header > .d-flex { flex-wrap: wrap; row-gap: .25rem; }
  .tpe .card-header .hint, .tpe .card-header .tiny { flex-basis: 100%; text-align: left; }

  /* Any row pairing text with actions: let the text shrink, never the buttons */
  .check-row > .flex-grow-1 { min-width: 0; }
  .check-row .lbl, .check-row .msg { overflow-wrap: anywhere; }

  /* Section headings with a trailing action button */
  .tpe h2 .btn, .tpe h2 .float-end { float: none !important; display: block; margin-top: .5rem; }
}

/* Buttons that sit next to each other must never share a line box */
.tpe .d-flex > .btn { flex-shrink: 0; min-width: 0; max-width: 100%; overflow-wrap: anywhere; }


/* ---------- Range slider ----------
   Native sliders render about 18px tall, which is not draggable with a thumb.
   Custom track and thumb, sized up on touch devices. */
.tpe input[type=range] { -webkit-appearance: none; appearance: none; background: transparent; height: 28px; width: 100%; max-width: 180px; vertical-align: middle; cursor: pointer; }
.tpe input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--gold) 0%, var(--gold) var(--fill,50%), rgba(255,255,255,.15) var(--fill,50%)); }
.tpe input[type=range]::-moz-range-track { height: 6px; border-radius: 3px; background: rgba(255,255,255,.15); }
.tpe input[type=range]::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--gold); }
.tpe input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 20px; height: 20px; margin-top: -7px; border-radius: 50%; background: #fff; border: 2px solid var(--gold); box-shadow: 0 2px 6px rgba(0,0,0,.4); }
.tpe input[type=range]::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 2px solid var(--gold); }
.tpe input[type=range]:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 3px; }

@media (hover: none) and (pointer: coarse) {
  .tpe input[type=range] { height: 44px; }
  .tpe input[type=range]::-webkit-slider-thumb { width: 28px; height: 28px; margin-top: -11px; }
  .tpe input[type=range]::-moz-range-thumb { width: 28px; height: 28px; }
}


/* ---------- Narrow phones (375px and below) ----------
   The brand plus the toggler exceeded the bar width, so the hamburger wrapped onto
   its own line. Keep them on one row and let the brand text shrink instead. */
@media (max-width: 430px) {
  .tpe .navbar > .container-fluid, .tpe .navbar > .container { flex-wrap: nowrap; gap: .5rem; }
  .tpe .navbar-brand { min-width: 0; font-size: 1rem; }
  .tpe .navbar-brand > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tpe .navbar-brand .mark { flex: 0 0 auto; }
  .tpe .navbar-toggler { flex: 0 0 auto; padding: .35rem .6rem; }

  /* Action buttons read as one phrase, not a broken line */
  .verdict .btn { white-space: nowrap; flex: 1 1 100%; }
  .tpe-hero .d-flex.flex-wrap > .btn { flex: 1 1 100%; }
}


/* ---------- Long unbreakable tokens ----------
   Filenames like RFQ-SUPPLY_AND_DELIVERY_OF_VIBAC_PULMONARY_FILTERS_6.pdf, bid numbers,
   e-mail addresses and SHA-256 hashes have no natural break point. Left alone they push
   out of their flex item and collide with whatever sits beside them. */
.doc-file a, .doc-file span, .check-row .lbl, .check-row .msg, .fact span, .fact b, .trap,
.audit-row, .opp .card-body, .reason, .mono, .brief, td, .list-group-item,
.file-item, .progress-step, .tpe .alert, .tpe .card-title, .tpe .card-text,
#fillReport, #pricingReport, #processingSteps, #fileList, #tendersGrid, #businessesGrid,
#criteriaGrid, #criteriaModalBody, #manifest, #audit, #docs, #toastHost .alert {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Rows that pair flowing text with a rigid control: the text shrinks, the control does not */
.file-item { gap: .5rem; }
.file-item > div:first-child { flex: 1 1 auto; min-width: 0; }
.file-item > .btn { flex-shrink: 0; }
.progress-step .d-flex > div { min-width: 0; }
.progress-step .d-flex > i { flex-shrink: 0; }
.list-group-item > .d-flex > .text-truncate { min-width: 0; }
.card-body > .d-flex > .pill { flex: 0 1 auto; min-width: 0; }
.tpe .table td, .tpe .table th { overflow-wrap: anywhere; }
/* Auto layout is right at every width: `overflow-wrap: anywhere` on the cells already
   lets long tokens break, so a table never needs equal-width columns to stay in bounds. */
.tpe .table { width: 100%; }

/* Any flex row pairing flowing text with a fixed-size element */
.tpe .d-flex > .flex-grow-1, .check-row > .flex-grow-1, .opp .flex-grow-1 { min-width: 0; }

@media (max-width: 640px) {
  /* Metadata drops under the filename rather than fighting it for width */
  .doc-file > .tiny { flex-basis: 100%; margin-left: 0; white-space: normal; }
}


/* ---------- Responsiveness checklist rows ----------
   Desktop: [status 92px] [text flexes] [tick box].
   At phone width three columns leave ~150px for the text and a wide status such as
   "NOT APPLICABLE" overflows its fixed column and lands on top of the label.
   On phones the row becomes two lines: status + tick box, then the text full width. */
.check-status { flex: 0 0 92px; width: 92px; }

@media (max-width: 640px) {
  .check-row { flex-wrap: wrap; gap: .5rem .75rem !important; }
  .check-status { flex: 0 0 auto; width: auto; padding-top: 0 !important; }
  #checklist .check-row > .flex-grow-1 { flex: 1 1 100%; order: 3; }
  #checklist .check-row .form-check { order: 2; margin-left: auto; padding-top: 0 !important; }
  .pill { white-space: normal; }   /* e.g. "PRICE, FUNCTIONALITY & PREFERENCE" is 260px on one line */
}


/* ---------- Fixes from the multi-agent sweep ---------- */

/* A hard min-width on a flex item cannot shrink; at 320px the hero content box is ~232px
   and these selects were pinned at 250-260px, bursting the action bar. */
.biz-select { min-width: 0 !important; width: 100%; max-width: 320px; }

/* The toast layer must never intercept taps aimed at the page beneath it. */
#toastHost { pointer-events: none; }
#toastHost > * { pointer-events: auto; }

/* Anchors and programmatic scrolls landed underneath the sticky navbar. */
.tpe [id] { scroll-margin-top: 76px; }

/* The floating mobile menu must scroll rather than run off a short viewport. */
@media (max-width: 991px) {
  .tpe .navbar-collapse { max-height: calc(100vh - 90px); overflow-y: auto; -webkit-overflow-scrolling: touch; }
}

/* .tiny carried !important and was stripping the link colour off text links. */
.tpe a.tiny, .tpe .tiny a, .tpe a.hint { color: var(--gold-2) !important; }

/* The decorative disc is sized for a desktop hero; on a phone it washed out the heading. */
@media (max-width: 640px) {
  .tpe-hero::after { width: 150px; height: 150px; right: -60px; top: -60px; opacity: .55; }
}

/* Legibility floor: these four sat between 10.9px and 11.8px on touch. */
@media (hover: none) and (pointer: coarse) {
  .reason, .eyebrow, .audit-row code { font-size: .78rem; }
  .pill, .tpe .badge { font-size: .75rem; }   /* Bootstrap badges inherit .75em and fell under 11.5px */
  .eyebrow { letter-spacing: .06em; }
}
