:root {
    --tf-ink: #172a2b;
    --tf-muted: #687a79;
    --tf-paper: #edf3f1;
    --tf-panel: #ffffff;
    --tf-line: #d1ddda;
    --tf-green: #236846;
    --tf-green-dark: #184b35;
    --tf-green-light: #dcebe3;
    --tf-copper: #c97942;
    --tf-cyan: #5db4ab;
    --tf-shadow: 0 16px 44px rgba(24, 61, 49, .09);
}

.tf-page {
    min-height: 76vh;
    color: var(--tf-ink);
    background: var(--tf-paper);
    font-family: "Segoe UI", Arial, sans-serif;
    font-variant-numeric: tabular-nums lining-nums;
}

.tf-page-width { width: min(1480px, calc(100% - 48px)); margin: 0 auto; }
.tf-hero { position: relative; overflow: hidden; color: #f4faf6; background: #173c2d; }
.tf-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    opacity: .22;
    background:
        radial-gradient(circle at 73% 28%, transparent 0 4px, rgba(128, 212, 171, .8) 4.5px 5.5px, transparent 6px),
        radial-gradient(circle at 82% 69%, transparent 0 4px, rgba(221, 158, 105, .82) 4.5px 5.5px, transparent 6px),
        linear-gradient(126deg, transparent 0 57%, rgba(134, 204, 168, .25) 57.1% 57.25%, transparent 57.35%),
        linear-gradient(38deg, transparent 0 73%, rgba(134, 204, 168, .22) 73.1% 73.25%, transparent 73.35%);
    background-size: 155px 92px, 178px 113px, auto, auto;
}
.tf-hero::after { content: ""; position: absolute; top: -160px; right: -100px; width: 620px; height: 620px; border: 1px solid rgba(163, 218, 190, .15); border-radius: 50%; box-shadow: 0 0 0 82px rgba(163, 218, 190, .035), 0 0 0 170px rgba(163, 218, 190, .025); }
.tf-hero-grid { position: relative; z-index: 1; display: grid; grid-template-columns: 1fr minmax(350px, .62fr); gap: 90px; align-items: center; min-height: 290px; padding: 42px 0 45px; }
.tf-kicker, .tf-section-label { margin: 0 0 9px; color: #9bd1b4; font-family: "Arial Narrow", "Segoe UI", sans-serif; font-size: .72rem; font-weight: 800; letter-spacing: .18em; }
.tf-hero h2 { margin: 0; color: #fff; font-family: Georgia, "Times New Roman", serif; font-size: clamp(3.1rem, 5.6vw, 5.25rem); font-weight: 400; line-height: .91; letter-spacing: -.052em; }
.tf-hero h2 span { color: #b7d9c5; }
.tf-deck { max-width: 730px; margin: 19px 0 0; color: #c8ddd1; font-size: 1rem; line-height: 1.65; }
.tf-hero-key { padding: 22px 25px 20px; border: 1px solid rgba(203, 231, 215, .21); border-top: 3px solid var(--tf-copper); background: rgba(8, 36, 24, .5); box-shadow: 0 18px 44px rgba(5, 27, 18, .18); }
.tf-hero-key > p { margin: 0 0 13px; color: #90aa9c; font-size: .65rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.tf-hero-key > div { display: grid; grid-template-columns: 42px 1fr; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid rgba(210, 233, 220, .13); }
.tf-hero-key strong { display: grid; place-items: center; width: 37px; height: 27px; color: #fff; border: 1px solid rgba(186, 222, 202, .3); font-family: Arial, sans-serif; font-size: .72rem; font-style: normal; }
.tf-hero-key span { color: #d3e2d9; font-size: .78rem; }
.tf-hero-key small { display: block; margin-top: 10px; color: #94aa9e; font-size: .65rem; line-height: 1.45; }

.tf-content { padding: 28px 0 64px; }
.tf-loading { display: flex; align-items: center; justify-content: center; gap: 11px; min-height: 360px; color: var(--tf-muted); }
.tf-loading > span { width: 20px; height: 20px; border: 2px solid #b7cbc2; border-top-color: var(--tf-green); border-radius: 50%; animation: tf-spin .75s linear infinite; }
@keyframes tf-spin { to { transform: rotate(360deg); } }
.tf-error { padding: 18px 20px; color: #843e36; border-left: 4px solid #b65d4f; background: #fff2ef; box-shadow: var(--tf-shadow); }
#tf-app { transition: opacity .16s; }
#tf-app.is-refreshing { opacity: .56; pointer-events: none; }

.tf-summary { display: grid; grid-template-columns: repeat(4, 1fr); margin-bottom: 22px; border: 1px solid var(--tf-line); background: var(--tf-panel); box-shadow: var(--tf-shadow); }
.tf-summary > div { position: relative; padding: 16px 21px; border-right: 1px solid var(--tf-line); }
.tf-summary > div:last-child { border-right: 0; }
.tf-summary > div::after { content: ""; position: absolute; right: 0; bottom: 0; left: 0; height: 2px; background: linear-gradient(90deg, var(--tf-green), transparent 76%); }
.tf-summary span { display: block; color: var(--tf-muted); font-size: .66rem; font-weight: 800; letter-spacing: .055em; text-transform: uppercase; }
.tf-summary strong { display: block; margin-top: 4px; color: var(--tf-green-dark); font-family: Arial, "Helvetica Neue", sans-serif; font-size: 1.45rem; font-style: normal; font-weight: 700; }

.tf-atlas-card, .tf-records-card { overflow: hidden; border: 1px solid var(--tf-line); background: var(--tf-panel); box-shadow: var(--tf-shadow); }
.tf-records-card { margin-top: 22px; transition: opacity .16s; }
.tf-records-card.is-loading { opacity: .58; }
.tf-section-head { display: flex; justify-content: space-between; gap: 28px; align-items: flex-start; padding: 23px 27px 19px; border-bottom: 1px solid var(--tf-line); }
.tf-section-label { color: var(--tf-green); }
.tf-section-head h3 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 1.48rem; font-weight: 400; letter-spacing: -.018em; }
.tf-section-head p:last-child { margin: 7px 0 0; color: var(--tf-muted); font-size: .75rem; line-height: 1.5; }
.tf-type-switch { display: grid; grid-template-columns: 1fr 1fr; flex: 0 0 178px; padding: 3px; border: 1px solid #bfd0c7; background: #edf4f0; }
.tf-type-switch button { height: 34px; color: #60746a; border: 0; background: transparent; font-family: Arial, sans-serif; font-size: .72rem; font-weight: 800; }
.tf-type-switch button.active { color: #fff; background: var(--tf-green-dark); box-shadow: 0 4px 10px rgba(24,75,53,.17); }
.tf-type-switch button:focus-visible, .tf-family-matrix button:focus-visible, .tf-download:focus-visible, .tf-filters button:focus-visible, .tf-pagination button:focus-visible { outline: 3px solid rgba(201,121,66,.38); outline-offset: 2px; }

.tf-matrix-wrap { max-height: 575px; overflow: auto; background: #fafcfb; }
.tf-family-matrix { width: 100%; min-width: 970px; border-collapse: separate; border-spacing: 0; table-layout: fixed; font-family: Arial, "Helvetica Neue", sans-serif; font-size: .69rem; font-style: normal; }
.tf-family-matrix th, .tf-family-matrix td { height: 38px; padding: 0; border-right: 1px solid #e0e8e4; border-bottom: 1px solid #e0e8e4; text-align: center; }
.tf-family-matrix thead th { position: sticky; top: 0; z-index: 3; height: 47px; padding: 6px 4px; color: #52675d; background: #edf4f0; box-shadow: inset 0 -1px #c8d7d0; font-size: .61rem; font-weight: 800; letter-spacing: .02em; }
.tf-family-matrix .tf-family-column { left: 0; z-index: 4; width: 165px; padding-left: 18px; text-align: left; }
.tf-family-matrix .tf-total-column { width: 76px; }
.tf-family-matrix tbody th { position: sticky; left: 0; z-index: 2; padding: 0 10px 0 18px; background: #fff; text-align: left; }
.tf-family-matrix tbody th button { width: 100%; overflow: hidden; padding: 7px 0; color: var(--tf-green-dark); border: 0; background: transparent; font-size: .68rem; font-weight: 750; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.tf-family-matrix tbody td button { width: 100%; height: 100%; color: #183d2e; border: 0; background: rgba(35, 104, 70, var(--cell-alpha)); font-family: Arial, sans-serif; font-size: .67rem; font-style: normal; font-weight: 700; transition: transform .1s, box-shadow .1s; }
.tf-family-matrix tbody td button:hover, .tf-family-matrix tbody td button.active { position: relative; z-index: 1; box-shadow: inset 0 0 0 2px var(--tf-copper); transform: scale(1.04); }
.tf-family-matrix .tf-row-total { color: #425a4e; background: #f1f5f3; font-weight: 800; }
.tf-family-matrix tr.tf-selected-family th { box-shadow: inset 3px 0 var(--tf-copper); background: #fff9f4; }
.tf-atlas-card > footer { display: flex; gap: 8px; align-items: center; min-height: 42px; padding: 9px 27px; color: #788982; background: #f5f8f6; font-size: .64rem; }
.tf-atlas-card > footer i { display: inline-block; width: 18px; height: 8px; margin-right: 2px; border: 1px solid rgba(35,104,70,.16); }
.tf-scale-low { background: rgba(35,104,70,.13); }
.tf-scale-high { background: rgba(35,104,70,.78); }
.tf-atlas-card > footer b { margin-left: auto; color: #54675e; font-weight: 700; }

.tf-download { flex: 0 0 auto; padding: 9px 13px; color: var(--tf-green-dark); border: 1px solid #b7cbbf; background: #fff; font-size: .7rem; font-weight: 750; }
.tf-download:hover { border-color: var(--tf-green); background: #f1f7f3; }
.tf-download i { margin-right: 6px; }
.tf-filters { display: grid; grid-template-columns: minmax(240px, 1.4fr) repeat(3, minmax(155px, .72fr)) auto; gap: 12px; align-items: end; padding: 17px 27px; border-bottom: 1px solid var(--tf-line); background: #f7faf8; }
.tf-filters label > span { display: block; margin: 0 0 5px; color: #52675c; font-size: .63rem; font-weight: 800; letter-spacing: .035em; text-transform: uppercase; }
.tf-filters input, .tf-filters select { width: 100%; height: 39px; color: #31493e; border: 1px solid #c5d4cc; border-radius: 0; outline: none; background: #fff; font-family: "Segoe UI", Arial, sans-serif; font-size: .73rem; }
.tf-filters select { padding: 0 28px 0 9px; }
.tf-search-field > div { position: relative; }
.tf-search-field i { position: absolute; top: 50%; left: 11px; color: #87968f; font-size: .7rem; transform: translateY(-50%); }
.tf-search-field input { padding: 0 10px 0 31px; }
.tf-filters input:focus, .tf-filters select:focus { border-color: var(--tf-green); box-shadow: 0 0 0 3px rgba(35,104,70,.1); }
.tf-filters > button { height: 39px; padding: 0 12px; color: #66786f; border: 1px solid #c8d5ce; background: #fff; font-size: .67rem; font-weight: 750; white-space: nowrap; }
.tf-filters > button:hover { color: var(--tf-green-dark); border-color: #91af9d; }

.tf-table-wrap { overflow-x: auto; }
.tf-record-table { width: 100%; min-width: 980px; border-collapse: collapse; font-size: .71rem; }
.tf-record-table th { padding: 11px 12px; color: #5b6e65; border-bottom: 1px solid #cbd8d1; background: #eef4f1; font-size: .61rem; font-weight: 800; letter-spacing: .035em; text-align: left; text-transform: uppercase; white-space: nowrap; }
.tf-record-table th:first-child, .tf-record-table td:first-child { padding-left: 27px; }
.tf-record-table td { padding: 10px 12px; color: #42564d; border-bottom: 1px solid #e2e9e5; vertical-align: middle; }
.tf-record-table tbody tr:hover { background: #f8fbf9; }
.tf-genome-name { color: var(--tf-green-dark) !important; font-weight: 750; white-space: nowrap; }
.tf-gene-id { color: #253f34 !important; font-family: "SFMono-Regular", Consolas, monospace; font-size: .68rem; font-weight: 700; white-space: nowrap; }
.tf-family-pill { padding: 4px 7px; color: var(--tf-green-dark); border: 1px solid #bfd2c6; background: #edf5f0; font-size: .63rem; font-weight: 800; }
.tf-family-pill:hover { border-color: var(--tf-green); background: #e1eee6; }
.tf-type-cell { font-family: Arial, sans-serif; font-size: .64rem; font-style: normal; font-weight: 800; }
.tf-type-tf { color: var(--tf-green) !important; }
.tf-type-tr { color: #9a5b31 !important; }
.tf-full-family { min-width: 150px; color: #62736b !important; }
.tf-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 270px; color: #7a8d83; }
.tf-empty i { color: #87a395; font-size: 1.7rem; }
.tf-empty strong { margin-top: 13px; color: #40584c; font-family: Georgia, serif; font-size: 1.05rem; font-weight: 400; }
.tf-empty span { margin-top: 5px; font-size: .72rem; }

.tf-pagination { display: grid; grid-template-columns: 1fr auto 1fr; gap: 20px; align-items: center; min-height: 54px; padding: 9px 27px; color: var(--tf-muted); background: #f7faf8; font-size: .67rem; }
.tf-pagination > div { display: flex; align-items: center; gap: 11px; }
.tf-pagination button { display: grid; place-items: center; width: 30px; height: 30px; color: var(--tf-green-dark); border: 1px solid #c5d4cc; background: #fff; }
.tf-pagination button:disabled { color: #b1beb7; background: #f0f3f1; }
.tf-pagination b { min-width: 95px; color: #52675c; font-family: Arial, sans-serif; font-style: normal; font-weight: 700; text-align: center; }
.tf-pagination > label { justify-self: end; }
.tf-pagination select { margin-left: 5px; padding: 4px 6px; color: #52675c; border: 1px solid #c5d4cc; background: #fff; font-size: .67rem; }

@media (max-width: 1080px) {
    .tf-hero-grid { grid-template-columns: 1fr minmax(310px, .7fr); gap: 42px; }
    .tf-filters { grid-template-columns: 1.2fr 1fr 1fr; }
    .tf-filters label:nth-of-type(4), .tf-filters > button { grid-row: 2; }
}

@media (max-width: 760px) {
    .tf-page-width { width: min(100% - 26px, 680px); }
    .tf-hero-grid { grid-template-columns: 1fr; gap: 28px; padding: 37px 0; }
    .tf-hero h2 { font-size: clamp(2.8rem, 14vw, 4.3rem); }
    .tf-summary { grid-template-columns: 1fr 1fr; }
    .tf-summary > div:nth-child(2) { border-right: 0; }
    .tf-summary > div:nth-child(-n+2) { border-bottom: 1px solid var(--tf-line); }
    .tf-section-head { display: block; padding: 20px; }
    .tf-type-switch, .tf-download { margin-top: 14px; }
    .tf-type-switch { width: 178px; }
    .tf-atlas-card > footer { flex-wrap: wrap; padding: 10px 18px; }
    .tf-atlas-card > footer b { flex-basis: 100%; margin-left: 0; }
    .tf-filters { grid-template-columns: 1fr; padding: 16px 20px; }
    .tf-filters label:nth-of-type(4), .tf-filters > button { grid-row: auto; }
    .tf-pagination { grid-template-columns: 1fr auto; padding: 9px 18px; }
    .tf-pagination > label { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .tf-loading > span { animation-duration: 1.8s; }
    #tf-app, .tf-records-card, .tf-family-matrix tbody td button { transition: none; }
}
