/* MASL Tender Finder - red & white search UI (scoped to .tf-app) */
.tf-app {
  --tf-red: #c8102e; --tf-red-d: #9b0d23; --tf-red-dd: #6e0918; --tf-red-l: #fff1f2; --tf-red-m: #fecdd3;
  --tf-ink: #1c1917; --tf-ink-2: #44403c; --tf-muted: #78716c; --tf-line: #ece4e4; --tf-bg: #fffafa;
  --tf-green: #15803d; --tf-amber: #b45309;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color: var(--tf-ink); font-size: 15px; line-height: 1.5; max-width: 1240px; margin: 0 auto;
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px;
}
.tf-app *, .tf-app *::before, .tf-app *::after { box-sizing: border-box; }
.tf-app > * { min-width: 0; }
.tf-app [hidden] { display: none !important; }
.tf-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tf-card { background: #fff; border: 1px solid var(--tf-line); border-radius: 16px; padding: 22px; box-shadow: 0 14px 34px -26px rgba(110, 9, 24, .55); }
.tf-muted { color: var(--tf-muted); margin: 4px 0 0; font-size: .9rem; }

/* Search */
.tf-search { border-top: 5px solid var(--tf-red); }
.tf-bar { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 16px; border: 2px solid var(--tf-red); border-radius: 14px; background: #fff; box-shadow: 0 8px 20px -14px var(--tf-red); }
.tf-bar:focus-within { box-shadow: 0 0 0 4px rgba(200, 16, 46, .15); }
.tf-ico { width: 22px; height: 22px; color: var(--tf-red); flex: none; }
.tf-bar input { flex: 1; min-width: 0; border: 0 !important; outline: 0; box-shadow: none !important; font: inherit; font-size: 1.05rem; padding: 10px 2px; background: transparent; color: var(--tf-ink); }
.tf-go { min-height: 48px; padding: 0 26px; font-size: 1rem; }
.tf-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 4px; }
.tf-chip { border: 1px solid var(--tf-red-m); background: var(--tf-red-l); color: var(--tf-red-d); border-radius: 999px; padding: 6px 14px; font: inherit; font-size: .86rem; font-weight: 600; cursor: pointer; }
.tf-chip:hover { background: var(--tf-red); color: #fff; border-color: var(--tf-red); }
.tf-filters { margin-top: 14px; border-top: 1px dashed var(--tf-line); padding-top: 12px; }
.tf-filters summary { cursor: pointer; font-weight: 700; color: var(--tf-red-d); padding: 4px 0; }
.tf-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px 16px; margin-top: 10px; }
.tf-field label { display: block; font-size: .75rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--tf-ink-2); margin-bottom: 5px; }
.tf-app select, .tf-app input[type="text"], .tf-app input[type="number"] { width: 100%; min-height: 42px; padding: 8px 11px; border: 1px solid #ddd2d2; border-radius: 10px; background: #fff; color: var(--tf-ink); font: inherit; font-size: .93rem; }
.tf-app select:focus, .tf-app input[type="text"]:focus, .tf-app input[type="number"]:focus { outline: none; border-color: var(--tf-red); box-shadow: 0 0 0 3px rgba(200, 16, 46, .14); }
.tf-range { display: flex; align-items: center; gap: 6px; } .tf-range span { color: var(--tf-muted); }
.tf-filter-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }

/* Buttons */
.tf-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 8px 18px; border-radius: 10px; border: 1px solid transparent; font: inherit; font-weight: 700; font-size: .92rem; text-decoration: none !important; cursor: pointer; transition: background .15s, color .15s, border-color .15s, transform .15s; }
.tf-btn:focus-visible, .tf-chip:focus-visible, .tf-portal:focus-visible, .tf-tab:focus-visible, .tf-pager button:focus-visible, .tf-seg button:focus-visible { outline: 3px solid rgba(200, 16, 46, .45); outline-offset: 2px; }
.tf-btn-red { background: var(--tf-red); color: #fff !important; }
.tf-btn-red:hover { background: var(--tf-red-d); transform: translateY(-1px); }
.tf-btn-outline { background: #fff; color: var(--tf-red-d) !important; border-color: var(--tf-red-m); }
.tf-btn-outline:hover { border-color: var(--tf-red); background: var(--tf-red-l); }
.tf-btn-ghost { background: transparent; color: var(--tf-ink-2) !important; border-color: var(--tf-line); }
.tf-btn-ghost:hover { border-color: var(--tf-red); color: var(--tf-red) !important; }
.tf-btn-sm { min-height: 36px; padding: 5px 12px; font-size: .84rem; }
.tf-btn:disabled { opacity: .55; cursor: wait; }

/* Stats */
.tf-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.tf-stat { background: linear-gradient(135deg, var(--tf-red) 0%, var(--tf-red-d) 100%); color: #fff; border-radius: 14px; padding: 14px 16px; box-shadow: 0 12px 24px -18px var(--tf-red-dd); }
.tf-stat:nth-child(2) { background: #fff; color: var(--tf-red-d); border: 2px solid var(--tf-red); }
.tf-stat:nth-child(3) { background: var(--tf-red-dd); }
.tf-stat:nth-child(4) { background: #fff; color: var(--tf-ink); border: 1px solid var(--tf-line); }
.tf-stat strong { display: block; font-size: 1.7rem; line-height: 1.15; font-variant-numeric: tabular-nums; }
.tf-stat strong.tf-small { font-size: 1.05rem; padding: 6px 0 4px; }
.tf-stat span { font-size: .8rem; opacity: .9; }

/* Portals */
.tf-portals h3 { margin: 0; font-size: 1.05rem; color: var(--tf-red-d); }
.tf-portal-list { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.tf-portal { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 10px; border: 1px solid var(--tf-red-m); background: #fff; color: var(--tf-ink); font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer; }
.tf-portal:hover { background: var(--tf-red); color: #fff; border-color: var(--tf-red); }
.tf-pi { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; background: var(--tf-red-l); color: var(--tf-red); font-size: .8rem; }
.tf-portal:hover .tf-pi { background: rgba(255,255,255,.2); color: #fff; }

/* Results */
.tf-tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--tf-line); margin: -6px 0 14px; }
.tf-tab { position: relative; padding: 10px 16px; border: 0; background: transparent; font: inherit; font-weight: 700; color: var(--tf-muted); cursor: pointer; }
.tf-tab.is-on { color: var(--tf-red); }
.tf-tab.is-on::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -2px; height: 3px; border-radius: 3px; background: var(--tf-red); }
.tf-n { margin-left: 4px; font-size: .75rem; padding: 1px 8px; border-radius: 999px; background: var(--tf-red-l); color: var(--tf-red-d); }
.tf-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.tf-count { margin: 0; font-size: 1.05rem; color: var(--tf-ink); }
.tf-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tf-seg { display: inline-flex; border: 1px solid var(--tf-red-m); border-radius: 10px; overflow: hidden; }
.tf-seg button { border: 0; background: #fff; padding: 7px 12px; font: inherit; font-size: .84rem; font-weight: 700; color: var(--tf-ink-2); cursor: pointer; }
.tf-seg button[aria-pressed="true"] { background: var(--tf-red); color: #fff; }
.tf-list { display: grid; gap: 12px; }
.tf-item { position: relative; border: 1px solid var(--tf-line); border-left: 0; border-radius: 14px; padding: 16px 18px; background: #fff; transition: box-shadow .15s, border-color .15s; overflow: hidden; }
.tf-item::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--tf-green); }
.tf-item.tf-st-soon::before { background: var(--tf-amber); }
.tf-item.tf-st-closed::before { background: #a8a29e; }
.tf-item:hover { box-shadow: 0 14px 30px -22px rgba(110, 9, 24, .7); border-color: var(--tf-red-m); }
.tf-item-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tf-badge { display: inline-block; font-size: .72rem; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; }
.tf-b-live { background: #dcfce7; color: #166534; } .tf-b-soon { background: #fef3c7; color: #92400e; } .tf-b-closed { background: #e7e5e4; color: #44403c; } .tf-b-corr { background: var(--tf-red-l); color: var(--tf-red-d); }
.tf-src { font-size: .78rem; color: var(--tf-muted); }
.tf-left { margin-left: auto; font-size: .8rem; font-weight: 700; color: var(--tf-red-d); }
.tf-title { margin: 8px 0 2px; font-size: 1.05rem; line-height: 1.35; }
.tf-title a { color: var(--tf-ink); text-decoration: none; } .tf-title a:hover { color: var(--tf-red); text-decoration: underline; }
.tf-org { margin: 0; color: var(--tf-ink-2); font-weight: 600; font-size: .9rem; }
.tf-ids { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 4px 0 0; font-size: .8rem; color: var(--tf-muted); overflow-wrap: anywhere; }
.tf-ids b { color: var(--tf-ink-2); font-weight: 600; }
.tf-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 14px; margin: 12px 0 0; padding: 10px 12px; background: var(--tf-bg); border-radius: 10px; }
.tf-facts div { min-width: 0; } .tf-facts dt { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--tf-muted); }
.tf-facts dd { margin: 0; font-weight: 600; font-size: .9rem; overflow-wrap: anywhere; }
.tf-facts .tf-due dd { color: var(--tf-red); }
.tf-desc { margin: 10px 0 0; font-size: .88rem; color: var(--tf-ink-2); }
.tf-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.tf-save.is-saved { color: var(--tf-red) !important; border-color: var(--tf-red); background: var(--tf-red-l); }

.tf-table-wrap { overflow: auto; border: 1px solid var(--tf-line); border-radius: 12px; max-height: 75vh; }
.tf-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .86rem; }
.tf-table th { position: sticky; top: 0; z-index: 1; background: var(--tf-red); color: #fff; text-align: left; padding: 10px; white-space: nowrap; }
.tf-table td { padding: 9px 10px; border-bottom: 1px solid var(--tf-line); vertical-align: top; }
.tf-table tbody tr:nth-child(even) td { background: var(--tf-bg); }
.tf-table tbody tr:hover td { background: var(--tf-red-l); }
.tf-tt { min-width: 300px; } .tf-tt a { color: var(--tf-ink); font-weight: 600; text-decoration: none; } .tf-tt a:hover { color: var(--tf-red); }
.tf-nw { white-space: nowrap; }
.tf-table small { color: var(--tf-muted); }
.tf-icon-btn { width: 32px; height: 32px; border: 1px solid var(--tf-red-m); background: #fff; border-radius: 8px; color: var(--tf-red); cursor: pointer; margin-right: 4px; font-size: .95rem; }
.tf-icon-btn:hover { background: var(--tf-red); color: #fff; }

.tf-pager { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; margin-top: 16px; }
.tf-pager button { min-width: 40px; min-height: 40px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--tf-line); background: #fff; font: inherit; font-weight: 700; color: var(--tf-ink-2); cursor: pointer; }
.tf-pager button.is-on { background: var(--tf-red); color: #fff; border-color: var(--tf-red); }
.tf-pager button:hover:not(:disabled):not(.is-on) { border-color: var(--tf-red); color: var(--tf-red); }
.tf-pager button:disabled { opacity: .4; cursor: default; }
.tf-empty { padding: 30px 16px; text-align: center; color: var(--tf-muted); background: var(--tf-bg); border-radius: 12px; margin: 0; }
.tf-loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 34px; color: var(--tf-muted); }
.tf-spin { width: 20px; height: 20px; border-radius: 50%; border: 3px solid var(--tf-red-m); border-top-color: var(--tf-red); animation: tf-spin .8s linear infinite; }
@keyframes tf-spin { to { transform: rotate(360deg); } }
.tf-toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); max-width: calc(100% - 32px); background: var(--tf-ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-size: .9rem; box-shadow: 0 16px 34px -14px #000; opacity: 0; transition: .2s; z-index: 9999; }
.tf-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 700px) {
  .tf-card { padding: 16px; }
  .tf-bar { flex-wrap: wrap; padding: 8px; }
  .tf-bar .tf-ico { display: none; }
  .tf-bar input { flex: 1 1 100%; padding: 8px 6px; }
  .tf-go { flex: 1 1 100%; }
  .tf-left { margin-left: 0; width: 100%; }
  .tf-toolbar { align-items: flex-start; }
  .tf-actions .tf-btn { flex: 1 1 auto; }
}
@media (prefers-reduced-motion: reduce) { .tf-app * { animation: none !important; transition: none !important; } }
