/* ==========================================================================
   Treatment Match — page styles
   Used only by /treatment-match/index.html.
   Colour tokens are the site's existing ones (see tailwind.config in each page):
   primary #0A4B8F · secondary #2D9CDB · accent #0F766E · dark #1A202C
   ========================================================================== */

/* Tailwind's .hidden must keep winning over this page's own display rules
   (the .tm-* set below), but it must NOT be page-wide: a global
   `.hidden { display: none !important }` also outranks the shared navbar's
   responsive utilities (`hidden lg:flex`, `hidden md:block`,
   `hidden xl:inline-flex`) and silently hides the entire top navigation —
   which is what made this page's header differ from every other page.
   Everything this page toggles at runtime (#tm-panel-*, #tm-analysing,
   #tm-results-wrap, #tm-upload-area, #tm-consent-box, #tm-lead-*, …) lives
   inside <main>, so scope the override there. The navbar and footer then
   behave exactly as they do on the other 127 pages. */
main .hidden { display: none !important; }

/* ---------------------------------------------------------------- layout -- */

.tm-layout {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 22px;
  align-items: start;
}

.tm-results-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 22px;
  align-items: start;
}

.tm-aside { display: flex; flex-direction: column; gap: 14px; }

.tm-card {
  background: #fff;
  border-radius: 0.5rem;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  border: 1px solid #e6edf6;
}

.tm-pad { padding: 20px; }

.tm-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.tm-grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

.tm-mt8 { margin-top: 8px; }
.tm-mt10 { margin-top: 10px; }
.tm-mt12 { margin-top: 12px; }
.tm-mb10 { margin-bottom: 10px; }
.tm-full { width: 100%; }

/* ------------------------------------------------------------ typography -- */

.tm-h2 { font-size: 20px; font-weight: 600; color: #1a202c; margin-bottom: 14px; }
.tm-h3 { font-size: 18px; font-weight: 600; color: #1a202c; }
.tm-h4 { font-size: 14px; font-weight: 600; color: #1a202c; margin-bottom: 10px; }
.tm-small { font-size: 12.5px; color: #374151; line-height: 1.6; }
.tm-muted { font-size: 12px; color: #6b7280; }
.tm-center { text-align: center; }
.tm-req { color: #991b1b; }
.tm-opt { color: #6b7280; font-weight: 400; text-transform: none; }
.tm-link { color: #0a4b8f; text-decoration: underline; }
.tm-p { font-size: 13px; color: #374151; margin-top: 10px; }

/* ---------------------------------------------------------------- aside --- */

.tm-steps-list { display: flex; flex-direction: column; gap: 12px; }
.tm-steps-item { display: flex; gap: 10px; font-size: 13px; color: #374151; align-items: flex-start; }

.tm-dot {
  width: 24px; height: 24px; border-radius: 999px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; background: #e5e7eb; color: #6b7280;
}
.tm-steps-item .tm-dot { background: #0a4b8f; color: #fff; }

.tm-privacy { border-left: 4px solid #0f766e; }
.tm-plain-list { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: #374151; list-style: none; margin: 0; padding: 0; }
.tm-plain-list a { color: #0a4b8f; text-decoration: underline; }

.tm-quote { background: #f7fafc; }
.tm-quote p { font-size: 12.5px; color: #374151; }
.tm-quote-by { margin-top: 6px; font-size: 12px; }

.tm-aside-note { border-left: 4px solid #2d9cdb; }

/* --------------------------------------------------------------- stepper -- */

.tm-stepper {
  display: flex; align-items: center; gap: 6px;
  margin: 0 0 16px 0; padding: 0; list-style: none;
}
.tm-step { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #6b7280; }
.tm-step.is-on { color: #0a4b8f; font-weight: 600; }
.tm-step.is-on .tm-dot { background: #0a4b8f; color: #fff; }
.tm-step.is-done .tm-dot { background: #0f766e; color: #fff; }
.tm-line { flex: 1; height: 1px; background: #e5e7eb; min-width: 16px; }

/* ----------------------------------------------------------------- modes -- */

.tm-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }

.tm-mode {
  border: 1.5px solid #dce3ec; border-radius: 8px; padding: 14px;
  text-align: left; width: 100%; background: #fff; cursor: pointer;
  transition: border-color .15s, background-color .15s, box-shadow .15s;
  display: block;
}
.tm-mode:hover { border-color: #2d9cdb; }
.tm-mode.is-on { border-color: #0a4b8f; background: #f2f7fc; box-shadow: inset 0 0 0 1px #0a4b8f; }
.tm-mode-icon { font-size: 20px; color: #0a4b8f; }
.tm-mode-title { display: block; font-size: 14px; font-weight: 600; margin-top: 6px; color: #1a202c; }
.tm-mode-sub { display: block; font-size: 12px; color: #374151; }

/* ------------------------------------------------------------- dropzone --- */

.tm-drop {
  border: 2px dashed #c3d2e4; border-radius: 10px; background: #f7fafc;
  padding: 28px 16px; text-align: center; width: 100%; cursor: pointer;
  transition: border-color .15s, background-color .15s; display: block;
}
.tm-drop:hover, .tm-drop.is-over { border-color: #0a4b8f; background: #f2f7fc; }
.tm-drop i { font-size: 26px; color: #2d9cdb; }
.tm-drop-title { display: block; font-size: 14px; font-weight: 600; margin-top: 6px; color: #1a202c; }
.tm-drop-sub { display: block; font-size: 12px; color: #374151; margin-top: 2px; }
.tm-hint { font-size: 12px; color: #6b7280; margin-top: 8px; }

/* ----------------------------------------------------------- file list ---- */

.tm-file-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }

.tm-file {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid #e2e8f0; border-radius: 8px; padding: 9px 12px; background: #fff;
}
.tm-file.is-error { border-color: #fca5a5; background: #fef2f2; }
.tm-file-ic { color: #2d9cdb; }
.tm-file.is-error .tm-file-ic { color: #991b1b; }
.tm-file-main { flex: 1; min-width: 0; }
.tm-file-name { font-size: 13px; font-weight: 500; color: #1a202c; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tm-file-err { font-size: 11.5px; color: #991b1b; margin-top: 2px; }
.tm-bar { height: 4px; background: #eef2f7; border-radius: 4px; margin-top: 5px; }
.tm-bar i { display: block; height: 4px; background: #0f766e; border-radius: 4px; }
.tm-file-size { font-size: 12px; color: #374151; font-weight: 600; white-space: nowrap; }
.tm-file-del {
  border: 0; background: none; color: #9ca3af; font-size: 16px; line-height: 1;
  cursor: pointer; padding: 2px 4px;
}
.tm-file-del:hover { color: #991b1b; }

/* -------------------------------------------------------------- consent --- */

.tm-consent {
  margin-top: 16px; border: 1px solid #bfe3dc; background: #f2faf8;
  border-radius: 8px; padding: 12px;
}
.tm-consent-mini { margin-top: 12px; }
.tm-consent-label { display: flex; gap: 10px; align-items: flex-start; font-size: 12.5px; color: #1a202c; line-height: 1.55; }
.tm-consent-label input { margin-top: 3px; flex: none; width: 16px; height: 16px; accent-color: #0f766e; }
.tm-consent-label a { color: #0a4b8f; text-decoration: underline; }

.tm-inline-error {
  margin-top: 12px; font-size: 12.5px; color: #991b1b;
  background: #fef2f2; border: 1px solid #fca5a5; border-radius: 8px; padding: 8px 12px;
}

/* --------------------------------------------------------------- buttons -- */

.tm-card-foot {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; margin-top: 18px; padding-top: 14px; border-top: 1px solid #eef2f7;
  flex-wrap: wrap;
}
.tm-foot-left { justify-content: flex-start; }

.tm-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .5rem 1rem; min-height: 40px; border-radius: .25rem; border: 0;
  font-size: 14px; font-weight: 500; cursor: pointer; text-decoration: none;
  transition: opacity .15s, background-color .15s;
}
.tm-btn:hover { opacity: .92; }
.tm-btn-primary { background: #0a4b8f; color: #fff; }
.tm-btn-accent { background: #0f766e; color: #fff; }
.tm-btn-ghost { background: #fff; color: #374151; border: 1px solid #d1d5db; }
.tm-btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------------------------------------------------------------- fields -- */

.tm-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.tm-divider { height: 1px; background: #eef2f7; margin: 18px 0 14px; }

.tm-field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.tm-field { display: flex; flex-direction: column; gap: 4px; }
.tm-fld-k {
  font-size: 11px; letter-spacing: .4px; text-transform: uppercase;
  color: #6b7280; font-weight: 600;
}

.tm-fld {
  border: 1px solid #e2e8f0; border-radius: 6px; background: #fff; padding: 10px 12px;
  display: flex; flex-direction: column; gap: 6px;
}
.tm-fld-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.tm-fld-v { font-size: 14px; font-weight: 500; color: #1a202c; }
.tm-fld-v.is-empty { font-weight: 400; color: #9ca3af; font-size: 13px; }
.tm-fld-input {
  height: 36px; width: 100%; border: 1px solid #e2e8f0; border-radius: 6px;
  padding: 0 10px; font-size: 14px; color: #1a202c; background: #fff;
}
.tm-fld-edit {
  align-self: flex-start; border: 0; background: none; padding: 0;
  font-size: 11.5px; color: #0a4b8f; text-decoration: underline; cursor: pointer;
}

.tm-select, .tm-input {
  height: 40px; width: 100%; border: 1px solid #e2e8f0; border-radius: 6px;
  padding: 0 10px; font-size: 14px; color: #1a202c; background: #fff;
}

/* ----------------------------------------------------------------- chips -- */

.tm-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 600; border-radius: 999px; padding: 2px 9px;
  white-space: nowrap;
}
.tm-chip-ok { background: #e6f4f1; color: #0f766e; }
.tm-chip-mid { background: #fef3c7; color: #92400e; }
.tm-chip-low { background: #fee2e2; color: #991b1b; }
.tm-chip-info { background: #e8f1fa; color: #0a4b8f; }

/* ---------------------------------------------------------------- results -- */

.tm-results-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin-bottom: 12px; flex-wrap: wrap;
}

.tm-result-top { padding: 18px; border: 1.5px solid #0a4b8f; margin-bottom: 14px; }
.tm-rank-tag { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.tm-bestfit {
  font-size: 11px; font-weight: 700; color: #fff; background: #0a4b8f;
  border-radius: 4px; padding: 2px 8px;
}
.tm-result-body { display: flex; gap: 16px; align-items: flex-start; }
.tm-result-detail { flex: 1; min-width: 0; }
.tm-result-title { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.tm-result-title a { font-size: 16px; font-weight: 700; color: #0a4b8f; text-decoration: underline; }
.tm-result-name { font-size: 15px; font-weight: 600; color: #1a202c; }

.tm-meta { display: flex; gap: 18px; margin: 8px 0; font-size: 13px; color: #1a202c; flex-wrap: wrap; }
.tm-meta i { color: #2d9cdb; }

.tm-why-label { font-size: 12px; font-weight: 600; color: #6b7280; margin-bottom: 6px; }
.tm-why { font-size: 13px; color: #374151; margin: 0; padding-left: 18px; }
.tm-why li { margin: 2px 0; }

.tm-result-links { display: flex; gap: 14px; margin-top: 12px; font-size: 12.5px; flex-wrap: wrap; }
.tm-result-links a { color: #0a4b8f; text-decoration: underline; }
.tm-result-links i { color: #2d9cdb; }

.tm-result-locked { padding: 18px; margin-bottom: 14px; position: relative; overflow: hidden; }
.tm-result-locked.is-locked .tm-result-body { filter: blur(4px); opacity: .55; user-select: none; }

.tm-lock-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; padding: 12px;
  background: linear-gradient(to bottom, rgba(255,255,255,.2), rgba(255,255,255,.94));
}
.tm-lock-overlay i { color: #0a4b8f; font-size: 18px; }
.tm-lock-title { font-size: 13px; font-weight: 600; margin-top: 6px; color: #1a202c; }
.tm-lock-sub { font-size: 12px; color: #374151; margin: 2px 0 10px; }

.tm-excluded {
  margin-top: 18px; background: #f7fafc; border: 1px solid #e2e8f0;
  border-radius: 8px; padding: 14px 16px;
}
.tm-excluded-head { font-size: 13px; font-weight: 600; color: #1a202c; margin-bottom: 8px; }
.tm-excluded-head i { color: #991b1b; }
.tm-ex { font-size: 12.5px; color: #374151; margin-bottom: 6px; }
.tm-excluded-foot { font-size: 11.5px; color: #6b7280; margin-top: 8px; }

.tm-disclaimer {
  margin-top: 14px; background: #f2faf8; border: 1px solid #bfe3dc;
  border-radius: 8px; padding: 12px 14px; font-size: 12.5px; color: #374151;
}
.tm-disclaimer a { color: #0a4b8f; text-decoration: underline; }

.tm-risk-banner {
  background: #fef3c7; border: 1px solid #fde68a; border-left: 4px solid #d97706;
  border-radius: 8px; padding: 12px 14px; font-size: 13px; color: #92400e;
}

.tm-empty { text-align: center; padding: 14px 6px; }
.tm-empty i { font-size: 26px; color: #c3d2e4; }
.tm-empty h3 { font-size: 15px; font-weight: 600; color: #1a202c; margin-top: 10px; }
.tm-empty p { font-size: 12.5px; color: #374151; margin-top: 6px; }

.tm-audit {
  background: #f7fafc; border-radius: 8px; padding: 12px;
  font-size: 12.5px; color: #374151; margin-top: 8px;
}
.tm-actions-col { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.tm-link-center { text-align: center; font-size: 12px; color: #0a4b8f; text-decoration: underline; }

/* -------------------------------------------------------------- analysing -- */

.tm-analyse-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.tm-spinner {
  width: 26px; height: 26px; border: 3px solid #e5e7eb; border-top-color: #0a4b8f;
  border-radius: 50%; animation: tm-spin 1s linear infinite; flex: none;
}
@keyframes tm-spin { to { transform: rotate(360deg); } }

.tm-stages { display: flex; flex-direction: column; gap: 10px; font-size: 13px; list-style: none; margin: 0; padding: 0; }
.tm-stage { display: flex; align-items: center; gap: 8px; color: #9ca3af; }
.tm-stage.is-done { color: #0f766e; }
.tm-stage.is-active { color: #0a4b8f; }

/* ------------------------------------------------------------------ lead --- */

.tm-lead { border-top: 4px solid #0f766e; }
.tm-summary { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }

.tm-msg { margin-top: 10px; font-size: 12.5px; color: #374151; min-height: 0; }
.tm-msg.is-ok { color: #0f766e; }
.tm-msg.is-error { color: #991b1b; }

/* ------------------------------------------------------------- explainer --- */

.tm-explainer { margin-top: 34px; }

/* ------------------------------------------------------------ a11y focus --- */

.tm-page a:focus-visible,
.tm-card a:focus-visible,
.tm-btn:focus-visible,
.tm-mode:focus-visible,
.tm-drop:focus-visible,
.tm-fld-edit:focus-visible,
.tm-file-del:focus-visible,
.tm-select:focus-visible,
.tm-input:focus-visible,
.tm-fld-input:focus-visible,
.tm-consent-label input:focus-visible {
  outline: 2px solid #2d9cdb;
  outline-offset: 2px;
}

/* ------------------------------------------------------------ responsive -- */

@media (max-width: 1023px) {
  .tm-layout,
  .tm-results-layout { grid-template-columns: 1fr; }
  .tm-grid3 { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .tm-pad { padding: 16px; }
  .tm-grid2,
  .tm-field-grid,
  .tm-modes { grid-template-columns: 1fr; }
  .tm-step-label { display: none; }          /* 375px: keep numbers only */
  .tm-stepper { gap: 4px; }
  .tm-btn { min-height: 44px; }              /* thumb-friendly */
  .tm-card-foot { flex-direction: column-reverse; align-items: stretch; }
  .tm-card-foot .tm-btn { width: 100%; }
  .tm-result-body { gap: 12px; }
  .tm-meta { gap: 10px; font-size: 12.5px; }
  .tm-explainer { margin-top: 24px; }
}
