/* Target Search (asCss/pg/ts.css). Built by .claude/design/pages-build/mk_ts_new.py: the tool's own stylesheet in layer pgpage, then the CF2 re-skin (ts_pg.css) in layer pg. */
@layer pgpage {

.target-modal {
    /* AreaSearch brand palette */
    --tm-teal: #005F6E;
    --tm-teal-light: #007A8C;
    --tm-teal-dark: #004555;
    --tm-orange: #ED8B00;
    --tm-orange-warm: #F68911;
    --tm-orange-glow: rgba(237, 139, 0, 0.12);
    --tm-green: #1ABC9C;
    --tm-mint: #1ABC9C;
    --tm-burgundy: #6E0F31;

    /* Surface palette (light) — cool analyst greys */
    --tm-darker: #EDF0F2;
    --tm-dark: #ffffff;
    --tm-card: #FBFCFD;
    --tm-slate: #ffffff;
    --tm-slate-light: #FDFDFC;
    --tm-text: #1E2A2E;
    --tm-text-dim: #6C7B81;
    --tm-border: #CAD2D5;
    --tm-border-light: #E3E8EA;

    /* Dark surfaces — header only */
    --tm-header-from: #143039;
    --tm-header-to: #0a171c;

    /* Design tokens */
    --tm-radius: 10px;
    --tm-radius-sm: 6px;
    --tm-radius-xs: 4px;
    --tm-shadow-sm: 0 1px 2px rgba(16,34,40,0.06);
    --tm-shadow-md: 0 6px 18px rgba(16,34,40,0.10);
    --tm-shadow-pop: 0 12px 38px rgba(16,34,40,0.20);
    --tm-ease: cubic-bezier(0.4, 0, 0.2, 1);
    --tm-focus-ring: 0 0 0 3px rgba(0, 95, 110, 0.18);

    --tm-font-display: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --tm-font-body: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --tm-font-mono: 'Instrument Sans', 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;

    font-family: var(--tm-font-body);
    background: var(--tm-darker);
    color: var(--tm-text);
    height: 85vh;
    display: flex;
    flex-direction: column;
    border-radius: var(--tm-radius);
    overflow: hidden;
    border: 1px solid rgba(16,34,40,0.14);
    box-shadow: 0 2px 6px rgba(16,34,40,0.10), 0 30px 70px rgba(16,34,40,0.28);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

.target-modal h1, .target-modal h2, .target-modal h3, .target-modal h4, .target-modal h5, .target-modal h6 {
    font-family: var(--tm-font-display);
    font-weight: 500;
    line-height: 1.2;
}

#sectorModal .modal-dialog:has(.target-modal) {
    max-width: 1300px;
    width: calc(100% - 2rem);
    margin: 1rem auto;
}

#sectorModal .modal-content:has(.target-modal) {
    background: transparent;
    border: none;
    box-shadow: none;
}

/* Header */
.tm-head {
    background:
        radial-gradient(120% 160% at 88% -40%, rgba(237,139,0,0.18) 0%, rgba(237,139,0,0) 55%),
        radial-gradient(90% 140% at 0% 130%, rgba(26,188,156,0.12) 0%, rgba(26,188,156,0) 50%),
        linear-gradient(135deg, var(--tm-header-from) 0%, var(--tm-header-to) 100%);
    padding: 0.9rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(0,0,0,0.25);
    position: relative;
    flex-shrink: 0;
}

.tm-head::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--tm-orange) 0%, var(--tm-orange-warm) 32%, var(--tm-mint) 100%);
}

.tm-title { display: flex; align-items: center; gap: 0.9rem; position: relative; }

.tm-header-actions { display: flex; align-items: center; gap: 0.5rem; }

.tm-pro-badge {
    background: linear-gradient(135deg, var(--tm-orange-warm) 0%, var(--tm-orange) 100%);
    color: #fff;
    font-family: var(--tm-font-display);
    font-size: 0.6rem;
    font-weight: 700;
    padding: 0.32rem 0.6rem;
    border-radius: var(--tm-radius-xs);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    box-shadow: 0 1px 0 rgba(255,255,255,0.28) inset, 0 2px 8px rgba(237,139,0,0.35);
}

.tm-plan-pill {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.16);
    color: rgba(255,255,255,0.9);
    font-family: var(--tm-font-display);
    font-size: 0.62rem;
    font-weight: 600;
    padding: 0.35rem 0.65rem;
    border-radius: var(--tm-radius-xs);
    letter-spacing: 0.04em;
    white-space: nowrap;
    backdrop-filter: blur(4px);
}
.tm-plan-pill b { color: var(--tm-orange); font-weight: 700; font-family: var(--tm-font-mono); font-variant-numeric: tabular-nums; }

.tm-pro-locked {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(110, 15, 49, 0.3);
    border: 1px solid rgba(214, 51, 108, 0.5);
    color: #fff;
    font-family: var(--tm-font-display);
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.38rem 0.75rem;
    border-radius: var(--tm-radius-xs);
    cursor: pointer;
    transition: background 0.2s var(--tm-ease), border-color 0.2s var(--tm-ease), transform 0.2s var(--tm-ease);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.tm-pro-locked:hover { background: rgba(110, 15, 49, 0.5); border-color: rgba(214, 51, 108, 0.85); color: #fff; transform: translateY(-1px); }
.tm-pro-locked :is(i,.pg-i) { font-size: 0.7rem; color: #ff9aaf; }

.tm-info-btn, .tm-close {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: var(--tm-radius-sm);
    width: 34px; height: 34px;
    display: flex; align-items: center; justify-content: center;
    color: rgba(255,255,255,0.72);
    cursor: pointer;
    transition: all 0.2s var(--tm-ease);
}
.tm-info-btn:hover { background: rgba(255,255,255,0.12); color: var(--tm-orange); border-color: rgba(237,139,0,0.5); }
.tm-close:hover { background: rgba(214, 51, 108, 0.28); color: #fff; border-color: rgba(214,51,108,0.6); }

.tm-title-icon {
    width: 40px; height: 40px;
    background: linear-gradient(150deg, rgba(237,139,0,0.24), rgba(237,139,0,0.07));
    border: 1px solid rgba(237,139,0,0.55);
    border-radius: var(--tm-radius-sm);
    display: flex; align-items: center; justify-content: center;
    color: var(--tm-orange);
    font-size: 1rem;
    box-shadow: 0 2px 10px rgba(237,139,0,0.18), 0 1px 0 rgba(255,255,255,0.12) inset;
}

.tm-title h4 {
    margin: 0 0 2px 0;
    font-size: 1.08rem;
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.045em;
    text-transform: uppercase;
}

.tm-title span {
    font-family: var(--tm-font-display);
    font-size: 0.62rem;
    color: rgba(255,255,255,0.55);
    text-transform: uppercase;
    letter-spacing: 0.2em;
    font-weight: 600;
}

/* Body Layout */
.tm-body { display: flex !important; flex: 1; overflow: hidden; min-height: 0; flex-direction: row; }

/* Sidebar */
.tm-sidebar {
    width: 224px; min-width: 224px;
    background: var(--tm-card);
    border-right: 1px solid var(--tm-border-light);
    display: flex !important;
    flex-direction: column;
    flex-shrink: 0;
}

.tm-categories { flex: 1; overflow-y: auto; padding: 0.6rem 0.5rem; }

.tm-cat-btn {
    display: flex; align-items: center; gap: 10px;
    width: 100%;
    padding: 0.52rem 0.7rem 0.52rem 0.75rem;
    background: transparent;
    border: none;
    border-radius: var(--tm-radius-xs);
    color: var(--tm-text-dim);
    font-family: var(--tm-font-display);
    font-size: 0.72rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: background 0.18s var(--tm-ease), color 0.18s var(--tm-ease), box-shadow 0.18s var(--tm-ease);
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    position: relative;
}
.tm-cat-btn::before {
    content: '';
    position: absolute;
    left: 0; top: 50%;
    transform: translateY(-50%) scaleY(0);
    width: 3px; height: 58%;
    background: var(--tm-orange);
    border-radius: 0 3px 3px 0;
    transition: transform 0.18s var(--tm-ease);
}
.tm-cat-btn:hover { background: rgba(0, 95, 110, 0.07); color: var(--tm-teal-dark); }
.tm-cat-btn.active {
    background: linear-gradient(100deg, var(--tm-teal) 0%, var(--tm-teal-light) 100%);
    color: #fff;
    box-shadow: var(--tm-shadow-sm);
}
.tm-cat-btn.active::before { transform: translateY(-50%) scaleY(1); }
.tm-cat-btn :is(i,.pg-i) { width: 16px; color: var(--tm-orange); font-size: 0.78rem; transition: color 0.18s var(--tm-ease); }
.tm-cat-btn.active :is(i,.pg-i) { color: #fff; }
.tm-cat-btn span:first-of-type { flex: 1; }
.tm-cat-btn .tm-cat-lock {
    margin-left: auto;
    font-size: 0.6rem;
    color: var(--tm-text-dim);
    opacity: 0.7;
}
.tm-cat-btn.active .tm-cat-lock { color: rgba(255,255,255,0.7); }
.tm-cat-btn .tm-cat-sel {
    margin-left: auto;
    background: var(--tm-orange);
    color: #fff;
    border-radius: 9px;
    font-family: var(--tm-font-mono);
    font-variant-numeric: tabular-nums;
    font-size: 0.6rem;
    font-weight: 700;
    min-width: 18px; height: 18px;
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0 5px;
    box-shadow: 0 1px 3px rgba(237,139,0,0.4);
}
.tm-cat-btn.active .tm-cat-sel { background: #fff; color: var(--tm-teal); box-shadow: none; }

/* Sidebar Controls */
.tm-controls { padding: 0.85rem; border-top: 1px solid var(--tm-border-light); background: var(--tm-dark); }

.tm-control-label {
    font-family: var(--tm-font-display);
    font-size: 0.63rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--tm-text-dim);
    margin-bottom: 0.45rem;
    display: block;
    font-weight: 700;
}

/* States: even 4-across grid; Area Type: even 2-across grid. */
.tm-state-chips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin-bottom: 0.8rem; }
.tm-state-chips.tm-chips-2 { grid-template-columns: repeat(2, 1fr); }

.tm-state-chip {
    padding: 0.34rem 0.5rem;
    background: #fff;
    border: 1px solid var(--tm-border);
    border-radius: var(--tm-radius-xs);
    color: var(--tm-text-dim);
    font-family: var(--tm-font-display);
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.18s var(--tm-ease);
    font-weight: 600;
    letter-spacing: 0.02em;
    text-align: center;
    white-space: nowrap;
}
.tm-state-chip:hover { border-color: var(--tm-teal); color: var(--tm-teal-dark); background: rgba(0,95,110,0.06); transform: translateY(-1px); }
.tm-state-chip.active { background: var(--tm-teal); border-color: var(--tm-teal); color: #fff; box-shadow: 0 2px 6px rgba(0,95,110,0.25); }
.tm-state-chip.metro { background: var(--tm-orange-glow); border-color: rgba(237,139,0,0.35); color: #9a5b00; }
.tm-state-chip.metro:hover { border-color: var(--tm-orange); color: #7a4700; }
.tm-state-chip.metro.active { background: var(--tm-orange); border-color: var(--tm-orange); color: #fff; box-shadow: 0 2px 6px rgba(237,139,0,0.3); }
/* Metro/Regional show "… Only" when it's the sole area type selected
   (not when both are on — that means all areas). Driven by JS. */
.tm-state-chip.metro.tm-only::after { content: ' Only'; }

/* Credit-cost info icon next to Max Results */
.tm-credit-info {
    font-size: 0.72rem;
    color: var(--tm-text-dim);
    cursor: help;
    margin-left: 3px;
    transition: color 0.15s var(--tm-ease);
    vertical-align: baseline;
}
.tm-credit-info:hover, .tm-credit-info:focus { color: var(--tm-orange); outline: none; }

.tm-max-row { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.8rem; }

.tm-max-input {
    width: 62px;
    padding: 0.42rem;
    background: var(--tm-slate);
    border: 1px solid var(--tm-border);
    border-bottom: 2px solid var(--tm-border);
    border-radius: var(--tm-radius-xs);
    color: var(--tm-text);
    font-family: var(--tm-font-mono);
    font-variant-numeric: tabular-nums;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    transition: border-color 0.18s var(--tm-ease), box-shadow 0.18s var(--tm-ease);
}
.tm-max-input:focus { outline: none; border-bottom-color: var(--tm-orange); box-shadow: var(--tm-focus-ring); }

.tm-btn-row { display: flex; gap: 0.5rem; }

.tm-btn-reset {
    flex: 1;
    padding: 0.58rem;
    background: #EAEEEF;
    border: 1px solid var(--tm-border);
    border-radius: var(--tm-radius-xs);
    color: var(--tm-text);
    font-family: var(--tm-font-display);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s var(--tm-ease);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.tm-btn-reset:hover { background: #DDE3E5; border-color: var(--tm-text-dim); }

.tm-btn-search {
    flex: 2;
    padding: 0.58rem;
    background: linear-gradient(135deg, var(--tm-orange-warm) 0%, var(--tm-orange) 100%);
    border: none;
    border-radius: var(--tm-radius-xs);
    color: #fff;
    font-family: var(--tm-font-display);
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.18s var(--tm-ease);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    box-shadow: 0 2px 8px rgba(237,139,0,0.3), 0 1px 0 rgba(255,255,255,0.25) inset;
}
.tm-btn-search:hover { filter: brightness(1.06); box-shadow: 0 4px 14px rgba(237,139,0,0.4), 0 1px 0 rgba(255,255,255,0.25) inset; transform: translateY(-1px); }
.tm-btn-search:active { transform: translateY(0); }
.tm-btn-search:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; filter: none; transform: none; }

/* Main Content */
.tm-main {
    flex: 1;
    display: flex !important;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
    background: var(--tm-darker);
    perspective: 1800px;          /* 3D depth for the cube-face view rotation */
}

/* 3D stage holding the active view panel; rotated by setView() on change. */
.tm-stage {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    transform-style: preserve-3d;
    backface-visibility: hidden;
    transform-origin: center center;
    will-change: transform;
}
@media (prefers-reduced-motion: reduce) {
    .tm-stage { transition: none !important; }
}

/* Criteria chip bar */
.tm-crit-bar {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    padding: 0.6rem 1.25rem;
    background: var(--tm-dark);
    border-bottom: 1px solid var(--tm-border-light);
    flex-shrink: 0;
    min-height: 46px;
    box-shadow: var(--tm-shadow-sm);
    position: relative;
    z-index: 2;
}
.tm-crit-count {
    font-family: var(--tm-font-display);
    font-size: 0.64rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--tm-text-dim);
    margin-right: 0.35rem;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}
.tm-crit-count b {
    color: #fff;
    background: var(--tm-teal);
    font-family: var(--tm-font-mono);
    font-variant-numeric: tabular-nums;
    padding: 0.04rem 0.42rem;
    border-radius: 999px;
    font-size: 0.68rem;
}
.tm-crit-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(180deg, rgba(0,95,110,0.10), rgba(0,95,110,0.05));
    border: 1px solid rgba(0, 95, 110, 0.28);
    color: var(--tm-teal-dark);
    font-family: var(--tm-font-display);
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: var(--tm-radius-xs);
    padding: 0.28rem 0.55rem;
    max-width: 260px;
    white-space: nowrap;
    overflow: hidden;
    box-shadow: var(--tm-shadow-sm);
    transition: border-color 0.18s var(--tm-ease), box-shadow 0.18s var(--tm-ease);
}
.tm-crit-chip:hover { border-color: var(--tm-teal); box-shadow: 0 2px 8px rgba(0,95,110,0.18); }
.tm-crit-chip .tm-crit-range {
    font-family: var(--tm-font-mono);
    font-variant-numeric: tabular-nums;
    color: var(--tm-orange);
    font-weight: 700;
    background: var(--tm-orange-glow);
    padding: 0 0.3rem;
    border-radius: 3px;
}
.tm-crit-chip .tm-crit-x { cursor: pointer; color: var(--tm-text-dim); font-size: 0.7rem; transition: color 0.15s var(--tm-ease), transform 0.15s var(--tm-ease); }
.tm-crit-chip .tm-crit-x:hover { color: var(--tm-burgundy); transform: scale(1.2); }
.tm-crit-empty {
    font-family: var(--tm-font-display);
    font-size: 0.72rem;
    color: var(--tm-text-dim);
    font-style: italic;
}

/* Metric filter box */
.tm-filter-wrap {
    position: relative;
    margin-left: auto;
    flex-shrink: 0;
}
.tm-filter-input {
    width: 230px;
    padding: 0.44rem 0.65rem 0.44rem 1.9rem;
    background: var(--tm-slate);
    border: 1px solid var(--tm-border);
    border-bottom: 2px solid var(--tm-border);
    border-radius: var(--tm-radius-xs);
    color: var(--tm-text);
    font-family: var(--tm-font-body);
    font-size: 0.78rem;
    transition: border-color 0.18s var(--tm-ease), box-shadow 0.18s var(--tm-ease);
}
.tm-filter-input:focus { outline: none; border-bottom-color: var(--tm-orange); box-shadow: var(--tm-focus-ring); }
.tm-filter-input::placeholder { color: var(--tm-text-dim); }
.tm-filter-wrap :is(i,.pg-i) {
    position: absolute;
    left: 0.6rem; top: 50%;
    transform: translateY(-50%);
    font-size: 0.72rem;
    color: var(--tm-text-dim);
    pointer-events: none;
    transition: color 0.18s var(--tm-ease);
}
.tm-filter-wrap:focus-within :is(i,.pg-i) { color: var(--tm-orange); }

/* Form Area */
.tm-form-area { flex: 1; overflow-y: auto; padding: 1.1rem 1.25rem 1.5rem; min-height: 200px; }

.tm-section { display: none; }
.tm-section.active { display: block; }

.tm-section-title {
    font-family: var(--tm-font-display);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--tm-teal);
    margin: 0 0 0.75rem 0;
    padding-bottom: 0.45rem;
    border-bottom: 2px solid transparent;
    border-image: linear-gradient(90deg, var(--tm-orange) 0%, var(--tm-orange) 42%, transparent 100%) 1;
    font-weight: 700;
    display: block;
}
.tm-section-title::before {
    content: '';
    display: inline-block;
    width: 6px; height: 6px;
    background: var(--tm-orange);
    border-radius: 50%;
    margin-right: 0.5rem;
    vertical-align: middle;
    transform: translateY(-1px);
}
.tm-section-title:not(:first-child) { margin-top: 1.25rem; }

/* Locked sub-sector heading (retail/medical the user has no access to) */
.tm-section-title.tm-title-locked {
    color: var(--tm-text-dim);
    border-image: linear-gradient(90deg, var(--tm-burgundy) 0%, rgba(110,15,49,0.35) 42%, transparent 100%) 1;
}
.tm-section-title.tm-title-locked::before { background: var(--tm-burgundy); opacity: 0.55; }
.tm-title-lock { font-size: 0.6rem; color: var(--tm-burgundy); opacity: 0.7; margin-left: 0.35rem; }

/* Limited-coverage tag (e.g. NSW-only property sales data) */
.tm-geo-tag {
    display: inline-block;
    vertical-align: middle;
    margin-left: 0.4rem;
    padding: 0.08rem 0.4rem;
    background: var(--tm-orange-glow);
    border: 1px solid rgba(237,139,0,0.4);
    border-radius: 2px;
    color: #8a5400;
    font-family: var(--tm-font-display);
    font-size: 0.58rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
    cursor: help;
}

.tm-field-row {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.6rem;
    border-bottom: 1px solid var(--tm-border-light);
    border-radius: var(--tm-radius-xs);
    margin: 0 -0.6rem;
    transition: background 0.15s var(--tm-ease), box-shadow 0.15s var(--tm-ease);
    position: relative;
}
.tm-field-row:hover { background: rgba(0, 95, 110, 0.045); }
.tm-field-row:has(.tm-has-value) { background: rgba(0, 95, 110, 0.05); box-shadow: inset 3px 0 0 var(--tm-teal); }

.tm-field-row.tm-locked { opacity: 1; }
.tm-field-row.tm-locked .tm-field-name { color: var(--tm-text-dim); }
.tm-field-row.tm-locked:hover { background: rgba(110, 15, 49, 0.035); }

.tm-field-name { flex: 1; font-family: var(--tm-font-body); font-size: 0.83rem; font-weight: 500; color: var(--tm-text); line-height: 1.3; }

.tm-field-meta {
    display: block;
    font-size: 0.63rem;
    color: var(--tm-text-dim);
    letter-spacing: 0.03em;
    margin-top: 2px;
    font-weight: 400;
}

.tm-field-crumb {
    display: none;
    font-size: 0.6rem;
    color: var(--tm-teal);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    margin-top: 2px;
}
.tm-filtering .tm-field-crumb { display: block; }

.tm-field-inputs { display: flex; align-items: center; gap: 0.5rem; }

.tm-field-input {
    width: 80px;
    padding: 0.45rem 0.6rem;
    background: var(--tm-slate);
    border: 1px solid var(--tm-border);
    border-bottom: 2px solid var(--tm-border);
    border-radius: var(--tm-radius-xs);
    color: var(--tm-text);
    font-family: var(--tm-font-mono);
    font-variant-numeric: tabular-nums;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    transition: border-color 0.18s var(--tm-ease), box-shadow 0.18s var(--tm-ease), background 0.18s var(--tm-ease);
}
.tm-field-input:focus { outline: none; border-bottom-color: var(--tm-orange); box-shadow: var(--tm-focus-ring); }
.tm-field-input:disabled { opacity: 0.35; cursor: not-allowed; }
.tm-field-input::placeholder { color: var(--tm-text-dim); font-size: 0.72rem; font-weight: 400; letter-spacing: 0.03em; }
.tm-field-input.tm-has-value { border-color: rgba(0,95,110,0.4); border-bottom-color: var(--tm-teal); background: rgba(0, 95, 110, 0.05); color: var(--tm-teal-dark); }

.tm-field-hint {
    font-family: var(--tm-font-display);
    font-size: 0.62rem;
    color: var(--tm-text-dim);
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    opacity: 0.75;
}

/* Lock chip on gated rows */
.tm-lock-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: linear-gradient(180deg, rgba(110, 15, 49, 0.09), rgba(110, 15, 49, 0.05));
    border: 1px solid rgba(110, 15, 49, 0.28);
    color: var(--tm-burgundy);
    font-family: var(--tm-font-display);
    font-size: 0.61rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: var(--tm-radius-xs);
    padding: 0.3rem 0.55rem 0.3rem 0.5rem;
    white-space: nowrap;
    cursor: help;
    transition: background 0.18s var(--tm-ease), border-color 0.18s var(--tm-ease);
}
.tm-lock-chip:hover { background: rgba(110, 15, 49, 0.12); border-color: rgba(110, 15, 49, 0.45); }
.tm-lock-chip :is(i,.pg-i) { font-size: 0.58rem; opacity: 0.85; }

/* Results Area */
/* ---- View toggle bar: Search | Data | Map ---- */
.tm-viewbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.55rem 1.1rem;
    background: linear-gradient(180deg, #ffffff, #F4F7F8);
    border-bottom: 1px solid var(--tm-border);
    flex-shrink: 0;
    box-shadow: var(--tm-shadow-sm);
    position: relative;
    z-index: 3;
}

.tm-view-toggle {
    display: inline-flex;
    background: #ECEFF1;
    border: 1px solid var(--tm-border);
    border-radius: 999px;
    padding: 3px;
    gap: 2px;
    box-shadow: inset 0 1px 3px rgba(16,34,40,0.08);
}

.tm-view-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.4rem 1.05rem;
    background: transparent;
    border: none;
    border-radius: 999px;
    color: var(--tm-text-dim);
    font-family: var(--tm-font-display);
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    cursor: pointer;
    transition: all 0.18s var(--tm-ease);
    white-space: nowrap;
}
.tm-view-btn :is(i,.pg-i) { font-size: 0.8rem; }
.tm-view-btn:not(:disabled):hover { color: var(--tm-teal-dark); background: rgba(255,255,255,0.7); }
.tm-view-btn.active {
    background: linear-gradient(135deg, var(--tm-teal) 0%, var(--tm-teal-light) 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(0,95,110,0.35);
}
.tm-view-btn:disabled { opacity: 0.4; cursor: not-allowed; }
/* subtle lock cue on Data/Map until a search has run */
.tm-view-btn.tm-view-locked:not(:disabled) { color: var(--tm-text-dim); }

.tm-view-meta { display: flex; align-items: center; gap: 0.85rem; }

.tm-results-count {
    background: linear-gradient(135deg, var(--tm-orange) 0%, var(--tm-orange-warm) 100%);
    padding: 0.28rem 0.8rem;
    border-radius: 999px;
    font-family: var(--tm-font-mono);
    font-variant-numeric: tabular-nums;
    font-size: 0.74rem;
    color: #fff;
    font-weight: 700;
    letter-spacing: 0.03em;
    box-shadow: 0 2px 6px rgba(237,139,0,0.3);
}
.tm-results-count::after { content: ' results'; font-family: var(--tm-font-display); font-size: 0.62rem; font-weight: 700; opacity: 0.85; }

.tm-credits-note {
    font-family: var(--tm-font-display);
    font-size: 0.68rem;
    color: var(--tm-text-dim);
    letter-spacing: 0.03em;
}

.tm-copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.42rem 0.85rem;
    background: #fff;
    border: 1px solid var(--tm-border);
    border-radius: var(--tm-radius-xs);
    color: var(--tm-teal-dark);
    font-family: var(--tm-font-display);
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.18s var(--tm-ease);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.tm-copy-btn:hover { background: var(--tm-teal); border-color: var(--tm-teal); color: #fff; }
.tm-copy-btn.tm-copied { background: var(--tm-green); border-color: var(--tm-green); color: #fff; }

/* ---- View panels ---- */
.tm-view-panel { display: none; flex: 1; min-height: 0; flex-direction: column; overflow: hidden; }
.tm-view-panel.active { display: flex; }

.tm-results-table-wrap { flex: 1; overflow: auto; padding: 1rem 1.1rem; background: var(--tm-darker); }

#tm-map-panel { position: relative; background: var(--tm-card); }

.tm-results-table {
    width: max-content;
    min-width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.82rem;
    background: #fff;
    border-radius: var(--tm-radius-sm);
    overflow: hidden;
    box-shadow: var(--tm-shadow-md);
}

.tm-results-table th {
    background: var(--tm-teal-dark);
    color: rgba(255,255,255,0.92);
    font-family: var(--tm-font-display);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.66rem;
    letter-spacing: 0.1em;
    padding: 0.72rem 1rem;
    text-align: left;
    position: sticky;
    top: 0;
    z-index: 1;
    white-space: nowrap;
    border-bottom: 2px solid var(--tm-orange);
}
.tm-results-table th:first-child { border-top-left-radius: var(--tm-radius-sm); }
.tm-results-table th:last-child { border-top-right-radius: var(--tm-radius-sm); }

.tm-results-table td {
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--tm-border-light);
    color: var(--tm-text);
    white-space: nowrap;
    font-family: var(--tm-font-mono);
    font-variant-numeric: tabular-nums;
    font-feature-settings: 'tnum';
    vertical-align: middle;
}

.tm-results-table td:nth-child(3) {
    font-family: var(--tm-font-display);
    font-variant-numeric: normal;
    font-feature-settings: normal;
    font-weight: 600;
}

.tm-results-table tbody tr { transition: background 0.12s var(--tm-ease); }
.tm-results-table tbody tr:hover td { background: rgba(0, 95, 110, 0.05); }
.tm-results-table tbody tr:last-child td { border-bottom: none; }

.tm-results-table a { color: var(--tm-teal); text-decoration: none; font-weight: 600; transition: color 0.15s var(--tm-ease); }
.tm-results-table a:hover { color: var(--tm-orange); }
/* Area name reads clearly as a link: underline + open-in-new icon. */
.tm-results-table a.tm-area-link {
    text-decoration: underline;
    text-decoration-color: rgba(0,95,110,0.45);
    text-underline-offset: 2px;
}
.tm-results-table a.tm-area-link :is(i,.pg-i) { font-size: 0.6rem; opacity: 0.65; margin-left: 2px; }
.tm-results-table a.tm-area-link:hover { text-decoration-color: var(--tm-orange); }

.tm-pct-sub {
    display: block;
    font-size: 0.62rem;
    color: var(--tm-text-dim);
    letter-spacing: 0.02em;
    font-weight: 500;
    margin-top: 1px;
}

.tm-score-badge {
    display: inline-block;
    min-width: 46px;
    text-align: center;
    padding: 0.22rem 0.5rem;
    border-radius: var(--tm-radius-xs);
    font-family: var(--tm-font-mono);
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    font-size: 0.74rem;
    background: rgba(26, 188, 156, 0.14);
    color: var(--tm-teal);
    border: 1px solid rgba(26, 188, 156, 0.35);
    box-shadow: var(--tm-shadow-sm);
}

#tm-map { width: 100%; height: 100%; }

/* Loading */
.tm-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    color: var(--tm-text-dim);
    font-family: var(--tm-font-display);
    font-size: 0.82rem;
    letter-spacing: 0.04em;
    gap: 0.3rem;
}
.tm-loading :is(i,.pg-i) { font-size: 1.7rem; color: var(--tm-teal-light); margin-bottom: 0.6rem; }
.tm-loading p { margin: 0; }

/* Error/Alert */
.tm-alert {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.75rem 1rem;
    border-radius: var(--tm-radius-sm);
    margin: 0.85rem;
    font-size: 0.82rem;
    font-weight: 500;
    border: 1px solid transparent;
    border-left-width: 3px;
    box-shadow: var(--tm-shadow-sm);
}
.tm-alert :is(i,.pg-i) { font-size: 0.9rem; flex-shrink: 0; }
.tm-alert-error { background: rgba(110, 15, 49, 0.06); border-color: rgba(110,15,49,0.2); border-left-color: var(--tm-burgundy); color: var(--tm-burgundy); }
.tm-alert-warning { background: rgba(237, 139, 0, 0.08); border-color: rgba(237,139,0,0.25); border-left-color: var(--tm-orange); color: #8a5400; }
.tm-alert-info { background: rgba(26, 188, 156, 0.08); border-color: rgba(26,188,156,0.25); border-left-color: var(--tm-mint); color: var(--tm-teal); }

/* Marker styles */
.tm-marker {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 25px; height: 25px;
    background: linear-gradient(135deg, var(--tm-orange-warm), var(--tm-orange));
    border: 2px solid #fff;
    border-radius: 50%;
    color: #fff;
    font-family: var(--tm-font-mono);
    font-variant-numeric: tabular-nums;
    font-size: 0.66rem;
    font-weight: 700;
    box-shadow: 0 2px 7px rgba(16,34,40,0.35);
    cursor: pointer;
    transition: transform 0.15s var(--tm-ease), box-shadow 0.15s var(--tm-ease);
}
.tm-marker:hover { transform: scale(1.12); box-shadow: 0 4px 12px rgba(237,139,0,0.5); }

/* Map Popup */
.tm-popup .mapboxgl-popup-content {
    width: 320px;
    border-radius: 12px;
    padding: 0;
    box-shadow: var(--tm-shadow-pop);
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    overflow: hidden;
    background: #fff;
    border: 1px solid rgba(16,34,40,0.08);
}
.tm-popup .mapboxgl-popup-close-button { font-size: 20px; color: #fff; right: 8px; top: 5px; z-index: 2; opacity: 0.85; }
.tm-popup .mapboxgl-popup-close-button:hover { opacity: 1; background: transparent; }
.tm-popup-header { background: linear-gradient(135deg, #005F6E 0%, #14799f 100%); padding: 13px 15px 11px; }
.tm-popup-header h5 { margin: 0 0 2px 0; font-size: 0.95rem; font-weight: 600; color: #fff; line-height: 1.3; }
/* Area name reads clearly as a link: underlined with an open-in-new icon. */
.tm-popup-header h5 a {
    color: #fff;
    text-decoration: underline;
    text-decoration-color: rgba(255,255,255,0.6);
    text-underline-offset: 3px;
    display: inline-flex;
    align-items: baseline;
    gap: 5px;
}
.tm-popup-header h5 a :is(i,.pg-i) { font-size: 0.68rem; opacity: 0.85; }
.tm-popup-header h5 a:hover { text-decoration-color: #fff; }
.tm-popup-header .tm-popup-hint { display: block; font-size: 0.6rem; font-weight: 600; color: rgba(255,255,255,0.6); text-transform: uppercase; letter-spacing: 0.08em; margin-top: 1px; }
.tm-popup-links { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.tm-popup-links a, .tm-popup-links button {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 11px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    font-family: var(--tm-font-body);
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: transform 0.15s var(--tm-ease), opacity 0.15s var(--tm-ease);
}
.tm-popup-links a:hover, .tm-popup-links button:hover { opacity: 0.92; transform: translateY(-1px); }
.tm-link-custom { background: #ED8B00; color: #fff !important; box-shadow: 0 2px 6px rgba(237,139,0,0.4); border: none; }
.tm-link-bound { background: rgba(255,255,255,0.18); color: #fff !important; border: 1px solid rgba(255,255,255,0.45); }
.tm-link-bound.tm-bound-on { background: #fff; color: #005F6E !important; border-color: #fff; }
.tm-link-abs { background: rgba(255,255,255,0.18); color: #fff !important; border: 1px solid rgba(255,255,255,0.45); }
.tm-popup-body { padding: 11px 15px 8px; }
.tm-popup-stats { list-style: none; margin: 0; padding: 0; }
.tm-popup-stats li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    font-size: 0.8rem;
    color: #333;
    border-bottom: 1px solid #f0f0f0;
}
.tm-popup-stats li:last-child { border-bottom: none; }
.tm-popup-stats .tm-stat-label { color: #666; font-weight: 400; }
.tm-popup-stats .tm-stat-value { font-weight: 700; color: #005F6E; font-family: 'Instrument Sans', 'Outfit', sans-serif; font-variant-numeric: tabular-nums; }

/* Explainer Modal */
.tm-explainer-overlay {
    display: none;
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(237, 240, 242, 0.86);
    backdrop-filter: blur(8px) saturate(1.1);
    -webkit-backdrop-filter: blur(8px) saturate(1.1);
    z-index: 100;
    overflow-y: auto;
    padding: 3rem 2.5rem;
    animation: tmFade 0.25s var(--tm-ease);
}
.tm-explainer-overlay.active { display: block; }
@keyframes tmFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes tmRise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

.tm-explainer-content {
    max-width: 640px;
    margin: 0 auto;
    background: #fff;
    border: 1px solid var(--tm-border-light);
    border-radius: var(--tm-radius);
    padding: 2rem 2.25rem 2.25rem;
    box-shadow: var(--tm-shadow-pop);
    animation: tmRise 0.3s var(--tm-ease);
}

.tm-explainer-content h3 {
    font-family: var(--tm-font-display);
    color: var(--tm-teal-dark);
    font-size: 1.3rem;
    margin: 0 0 0.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    letter-spacing: 0.01em;
    font-weight: 600;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--tm-border-light);
}
.tm-explainer-content h3 :is(i,.pg-i) { color: var(--tm-orange); font-size: 1.1rem; }
.tm-explainer-content > p { color: var(--tm-text); font-size: 0.92rem; line-height: 1.65; margin: 1.1rem 0; }
.tm-explainer-content > p strong { color: var(--tm-teal); }
.tm-explainer-content ul { margin: 0; padding-left: 1.2rem; }
.tm-explainer-content li { color: var(--tm-text-dim); font-size: 0.87rem; margin-bottom: 0.5rem; line-height: 1.55; }
.tm-explainer-content li:last-child { margin-bottom: 0; }
.tm-explainer-content li strong { color: var(--tm-text); font-weight: 600; }

.tm-explainer-section {
    background: linear-gradient(180deg, #FBFCFD, #F6F8F9);
    border: 1px solid var(--tm-border-light);
    border-radius: var(--tm-radius-sm);
    padding: 1.1rem 1.25rem 1.15rem 1.4rem;
    margin-bottom: 1rem;
    position: relative;
    overflow: hidden;
}
.tm-explainer-section::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 4px; height: 100%;
    background: linear-gradient(180deg, var(--tm-orange), var(--tm-orange-warm));
}
.tm-explainer-section h4 {
    font-family: var(--tm-font-display);
    color: var(--tm-orange);
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin: 0 0 0.65rem 0;
    font-weight: 700;
}

.tm-explainer-close {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.75rem;
    padding: 0.65rem 1.6rem;
    background: linear-gradient(135deg, var(--tm-teal) 0%, var(--tm-teal-light) 100%);
    border: none;
    border-radius: var(--tm-radius-xs);
    color: #fff;
    font-family: var(--tm-font-display);
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.18s var(--tm-ease);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    box-shadow: 0 2px 8px rgba(0,95,110,0.3);
}
.tm-explainer-close:hover { filter: brightness(1.08); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0,95,110,0.4); }

/* Mobile Dropdown Selectors (hidden on desktop) */
.tm-mobile-controls { display: none; }
.tm-mobile-actions { display: none; }

.tm-mobile-select {
    width: 100%;
    padding: 0.55rem 0.8rem 0.45rem;
    background: var(--tm-slate);
    border: 1px solid var(--tm-border);
    border-bottom: 2px solid var(--tm-border);
    border-radius: var(--tm-radius-xs);
    color: var(--tm-text);
    font-family: var(--tm-font-body);
    font-size: 0.85rem;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%236C7B81'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 1.2rem;
    transition: border-color 0.18s var(--tm-ease), box-shadow 0.18s var(--tm-ease);
}
.tm-mobile-select:focus { outline: none; border-bottom-color: var(--tm-orange); box-shadow: var(--tm-focus-ring); }
.tm-mobile-select option { background: #fff; color: var(--tm-text); padding: 0.5rem; }

.tm-mobile-row { display: flex; gap: 0.5rem; margin-bottom: 0.5rem; }
.tm-mobile-row .tm-mobile-select { flex: 1; }

.tm-mobile-label {
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--tm-text-dim);
    margin-bottom: 0.35rem;
    display: block;
    font-weight: 700;
}

/* Custom scrollbars — form, sidebar and results */
.tm-categories, .tm-form-area, .tm-results-table-wrap {
    scrollbar-width: thin;
    scrollbar-color: var(--tm-border) transparent;
}
.tm-categories::-webkit-scrollbar,
.tm-form-area::-webkit-scrollbar,
.tm-results-table-wrap::-webkit-scrollbar { width: 11px; height: 11px; }
.tm-categories::-webkit-scrollbar-track,
.tm-form-area::-webkit-scrollbar-track,
.tm-results-table-wrap::-webkit-scrollbar-track { background: transparent; }
.tm-categories::-webkit-scrollbar-thumb,
.tm-form-area::-webkit-scrollbar-thumb,
.tm-results-table-wrap::-webkit-scrollbar-thumb {
    background: var(--tm-border);
    border-radius: 999px;
    border: 3px solid transparent;
    background-clip: content-box;
}
.tm-categories::-webkit-scrollbar-thumb:hover,
.tm-form-area::-webkit-scrollbar-thumb:hover,
.tm-results-table-wrap::-webkit-scrollbar-thumb:hover {
    background: var(--tm-teal-light);
    background-clip: content-box;
}

/* Mobile */
@media (max-width: 768px) {
    .target-modal { height: 100vh; border-radius: 0; }

    #sectorModal .modal-dialog:has(.target-modal) {
        margin: 0; width: 100%; max-width: 100%; height: 100vh; max-height: 100vh;
    }

    .tm-head { padding: 0.75rem 1rem; }
    .tm-title-icon { width: 32px; height: 32px; font-size: 0.85rem; }
    .tm-title h4 { font-size: 0.95rem; }
    .tm-title span { font-size: 0.58rem; }
    .tm-plan-pill { display: none; }

    .tm-body { flex-direction: column; flex: 1; min-height: 0; }

    .tm-sidebar { display: none !important; }

    .tm-mobile-controls {
        display: block;
        padding: 0.75rem;
        background: var(--tm-card);
        border-bottom: 1px solid var(--tm-border-light);
        flex-shrink: 0;
    }

    .tm-main { flex: 1; min-height: 0; display: flex; flex-direction: column; }

    .tm-crit-bar { padding: 0.45rem 0.75rem; }
    .tm-filter-wrap { width: 100%; margin: 0.25rem 0 0 0; }
    .tm-filter-input { width: 100%; }

    .tm-form-area { flex: 1; overflow-y: auto; padding: 0.75rem; -webkit-overflow-scrolling: touch; }

    .tm-field-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.4rem;
        padding: 0.5rem 0.4rem;
        margin: 0 -0.4rem;
    }
    .tm-field-name { font-size: 0.78rem; width: 100%; }
    .tm-field-inputs { width: 100%; justify-content: flex-start; }
    .tm-field-input { width: 70px; padding: 0.45rem 0.5rem; font-size: 0.8rem; }
    .tm-field-hint { font-size: 0.65rem; }

    .tm-section-title { font-size: 0.68rem; margin: 0.5rem 0 0.6rem 0; padding-bottom: 0.4rem; }

    .tm-mobile-actions {
        display: flex;
        gap: 0.5rem;
        padding: 0.75rem;
        background: var(--tm-dark);
        border-top: 1px solid var(--tm-border-light);
        flex-shrink: 0;
    }
    .tm-mobile-actions .tm-btn-reset { flex: 0 0 auto; width: 44px; padding: 0.6rem; }
    .tm-mobile-actions .tm-btn-search { flex: 1; padding: 0.6rem; }

    /* View toggle bar wraps to fit narrow screens */
    .tm-viewbar { padding: 0.5rem 0.7rem; flex-wrap: wrap; gap: 0.5rem; }
    .tm-view-btn { padding: 0.38rem 0.7rem; font-size: 0.7rem; }
    .tm-view-btn span, .tm-view-meta .tm-credits-note { display: none; }

    .tm-results-table-wrap { flex: 1; overflow: auto; padding: 0.5rem; min-height: 0; }
    .tm-results-table { font-size: 0.75rem; }
    .tm-results-table th, .tm-results-table td { padding: 0.5rem 0.6rem; }

    .tm-controls { display: none; }
    .tm-mobile-actions { display: flex; }

    .tm-explainer-overlay { padding: 1.5rem; }
    .tm-explainer-content h3 { font-size: 1.1rem; }
    .tm-explainer-content p, .tm-explainer-content li { font-size: 0.82rem; }
}

/* Tablet breakpoint */
@media (min-width: 769px) and (max-width: 900px) {
    .target-modal { height: 95vh; }

    #sectorModal .modal-dialog:has(.target-modal) { margin: 0; width: 100%; max-width: 100%; }

    .tm-body { flex-direction: column; }

    .tm-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--tm-border);
        max-height: 180px;
    }

    .tm-categories { display: flex; flex-wrap: nowrap; overflow-x: auto; padding: 0.4rem; gap: 0.3rem; }
    .tm-cat-btn { flex-shrink: 0; padding: 0.4rem 0.6rem; font-size: 0.7rem; }

    .tm-controls { display: flex; flex-wrap: wrap; gap: 0.4rem; padding: 0.5rem; }
    .tm-state-chips { flex: 1; margin-bottom: 0; }
}
		/* ------------------------------------------------------------------
		   Page-mode overrides for the Target Search tool.
		   The tool's own stylesheet above is byte-identical to the modal's; the
		   modal sized itself to the dialog (85vh) — on a page it has to size to
		   the viewport minus the site nav, and leave room for the in-page dock
		   / mobile pill bar that publicNav.js adds.
		   ------------------------------------------------------------------ */
		.ts-tool-shell {
			max-width: 1500px;
			margin: 0 auto 3.5rem;
			padding: 0 0.5rem;
		}

		#tmRoot.target-modal {
			height: calc(100vh - 150px);
			min-height: 620px;
			max-height: 1080px;
		}

		@media (min-width: 769px) and (max-width: 900px) {
			/* nav + pill bar clearance, so the Search button stays above the fold */
			#tmRoot.target-modal { height: calc(100vh - 158px); min-height: 560px; }
		}

		@media (max-width: 768px) {
			/* Vertical budget: the fixed top nav (~91px once shrunk) plus the in-page
			   pill bar (57px) sit above the tool, so that is what we subtract. svh
			   (below) keeps the height stable while the mobile URL bar shows and
			   hides — dvh would resize the map mid-scroll, and plain vh overflows
			   underneath the bar on iOS. */
			#tmRoot.target-modal {
				height: calc(100vh - 152px);
				min-height: 440px;
				border-radius: 10px;
			}
			.ts-tool-shell { padding: 0; }

			/* The modal sizes its mobile chrome for a dialog. On the page that left
			   the metric list only ~214px of a 674px tool — three rows. Everything
			   below reclaims that space for the list rather than the furniture. */
			#tmRoot .tm-head { padding: 0.5rem 0.85rem; }
			#tmRoot .tm-title { gap: 0.6rem; }
			#tmRoot .tm-title-icon { width: 28px; height: 28px; font-size: 0.75rem; }
			#tmRoot .tm-title h4 { font-size: 0.9rem; }
			#tmRoot .tm-title span { display: none; }
			#tmRoot .tm-info-btn { width: 30px; height: 30px; }

			#tmRoot .tm-mobile-controls { padding: 0.5rem 0.75rem 0.45rem; }
			#tmRoot .tm-mobile-row { gap: 0.4rem; margin-bottom: 0.35rem; }
			#tmRoot .tm-mobile-row:last-child { margin-bottom: 0; }
			#tmRoot .tm-mobile-label { font-size: 0.6rem; margin-bottom: 0.12rem; }
			#tmRoot .tm-mobile-select { padding: 0.35rem 0.55rem 0.3rem; }

			#tmRoot .tm-viewbar { padding: 0.4rem 0.6rem; }

			/* Keep the filter on the criteria-count line instead of letting it claim a
			   full second row, and drop the hint sentence (it's in How to Use). */
			#tmRoot .tm-crit-bar { padding: 0.4rem 0.75rem; min-height: 0; gap: 0.35rem; }
			#tmRoot .tm-crit-empty { display: none; }
			#tmRoot .tm-filter-wrap { width: auto; flex: 1 1 120px; margin: 0 0 0 auto; }
			#tmRoot .tm-filter-input { width: 100%; }

			#tmRoot .tm-form-area { padding: 0.5rem 0.6rem 0.75rem; }
			#tmRoot .tm-section-title { margin: 0.35rem 0 0.45rem 0; padding-bottom: 0.3rem; }

			/* Metric name and its Min/Max share one line (the modal stacks them on
			   mobile, which cost ~45px per metric). Long names wrap in their column. */
			#tmRoot .tm-field-row { flex-direction: row; align-items: center; gap: 0.5rem; padding: 0.35rem 0.4rem; margin: 0 -0.4rem; }
			#tmRoot .tm-field-name { flex: 1 1 auto; min-width: 0; width: auto; font-size: 0.76rem; line-height: 1.25; }
			#tmRoot .tm-field-inputs { width: auto; flex: 0 0 auto; justify-content: flex-end; }
			#tmRoot .tm-field-input { width: 60px; padding: 0.42rem 0.5rem; font-size: 0.75rem; }
			#tmRoot .tm-field-hint { display: none; }

			#tmRoot .tm-mobile-actions { padding: 0.5rem 0.75rem; }
			#tmRoot .tm-mobile-actions .tm-btn-reset,
			#tmRoot .tm-mobile-actions .tm-btn-search { padding: 0.5rem; }
		}

		@supports (height: 100svh) {
			@media (max-width: 768px) {
				#tmRoot.target-modal { height: calc(100svh - 152px); }
			}
		}

		/* ------------------------------------------------------------------
		   Server-rendered SEO content (visible to crawlers and logged-out
		   visitors with no JavaScript). Scoped under .ts-seo so nothing here
		   can reach into the tool or the shared nav/footer.
		   ------------------------------------------------------------------ */
		.ts-seo {
			font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
			color: #1E2A2E;
		}
		.ts-seo-section { padding: 2.75rem 0 0.5rem; }
		/* deep links (/targetSearch#faq) and dock jumps clear the sticky top nav */
		#overview, #targetTool, #catalogue, #faq, #more { scroll-margin-top: 120px; }
		.ts-seo-section + .ts-seo-section { border-top: 1px solid #E3E8EA; margin-top: 2.5rem; }
		.ts-seo h2 {
			font-size: 1.6rem;
			font-weight: 600;
			color: #143039;
			margin: 0 0 0.35rem;
			letter-spacing: -0.01em;
		}
		.ts-seo .ts-kicker {
			display: inline-block;
			font-size: 0.68rem;
			font-weight: 700;
			letter-spacing: 0.14em;
			text-transform: uppercase;
			color: #ED8B00;
			margin-bottom: 0.5rem;
		}
		.ts-seo p { font-size: 1rem; line-height: 1.7; color: #445157; max-width: 78ch; }
		.ts-seo .ts-lead { font-size: 1.1rem; color: #2C3B41; }

		.ts-points { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1rem; margin: 1.6rem 0 0.5rem; padding: 0; list-style: none; }
		.ts-points li {
			background: #FBFCFD;
			border: 1px solid #E3E8EA;
			border-radius: 10px;
			padding: 1rem 1.1rem;
			font-size: 0.92rem;
			line-height: 1.55;
			color: #445157;
		}
		.ts-points li strong { display: block; color: #143039; font-size: 0.95rem; margin-bottom: 0.25rem; }
		.ts-points li :is(i,.pg-i) { color: #ED8B00; margin-right: 0.4rem; }

		/* The catalogue is ~685 metric names. Every name is in the HTML for
		   crawlers; <details> just keeps the page navigable for humans. */
		.ts-cat-grid { display: flex; flex-direction: column; gap: 0.6rem; margin-top: 1.6rem; }
		.ts-cat-block {
			background: #FBFCFD;
			border: 1px solid #E3E8EA;
			border-radius: 10px;
		}
		.ts-cat-block > summary {
			display: flex;
			align-items: center;
			justify-content: space-between;
			gap: 1rem;
			padding: 0.85rem 1.2rem;
			cursor: pointer;
			list-style: none;
			border-radius: 10px;
		}
		.ts-cat-block > summary::-webkit-details-marker { display: none; }
		.ts-cat-block > summary::after {
			content: '\f078';
			font-family: 'Font Awesome 6 Free';
			font-weight: 900;
			font-size: 0.7rem;
			color: #6C7B81;
			transition: transform 0.18s ease;
		}
		.ts-cat-block[open] > summary::after { transform: rotate(180deg); }
		.ts-cat-block > summary:hover { background: #F3F6F7; }
		.ts-cat-block .ts-cat-count { font-size: 0.75rem; color: #6C7B81; margin-left: auto; white-space: nowrap; }
		.ts-cat-body { padding: 0 1.2rem 1.2rem; }
		.ts-cat-block h3 {
			font-size: 0.95rem;
			font-weight: 600;
			color: #005F6E;
			margin: 0;
		}
		.ts-cat-block h3 :is(i,.pg-i) { color: #ED8B00; margin-right: 0.45rem; }
		.ts-cat-block h4 {
			font-size: 0.72rem;
			font-weight: 700;
			letter-spacing: 0.09em;
			text-transform: uppercase;
			color: #6C7B81;
			margin: 0.9rem 0 0.4rem;
		}
		.ts-cat-body h4:first-of-type { margin-top: 0; }
		.ts-metric-list { display: flex; flex-wrap: wrap; gap: 0.3rem; list-style: none; margin: 0; padding: 0; }
		.ts-metric-list li {
			background: #fff;
			border: 1px solid #E3E8EA;
			border-radius: 5px;
			padding: 0.16rem 0.5rem;
			font-size: 0.76rem;
			color: #445157;
		}

		.ts-faq { margin-top: 1.4rem; }
		.ts-faq-item { border-bottom: 1px solid #E3E8EA; padding: 1.1rem 0; }
		.ts-faq-item:last-child { border-bottom: none; }
		.ts-faq-item h3 { font-size: 1.02rem; font-weight: 600; color: #143039; margin: 0 0 0.45rem; }
		.ts-faq-item p { margin: 0; font-size: 0.95rem; }

		.ts-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0.85rem; margin-top: 1.5rem; padding: 0; list-style: none; }
		.ts-links a {
			display: block;
			background: #fff;
			border: 1px solid #E3E8EA;
			border-radius: 10px;
			padding: 0.95rem 1.1rem;
			text-decoration: none;
			color: #143039;
			font-weight: 600;
			font-size: 0.94rem;
			transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
		}
		.ts-links a span { display: block; font-weight: 400; font-size: 0.83rem; color: #6C7B81; margin-top: 0.2rem; line-height: 1.45; }
		.ts-links a:hover { border-color: #ED8B00; box-shadow: 0 6px 18px rgba(16, 34, 40, 0.08); transform: translateY(-1px); }
		.ts-links a :is(i,.pg-i) { color: #ED8B00; margin-right: 0.45rem; }

		@media (max-width: 768px) {
			.ts-seo h2 { font-size: 1.32rem; }
			.ts-seo p { font-size: 0.95rem; }
			.ts-seo-section { padding-top: 2rem; }
		}
/* This copy gives the working tool priority; reference content stays in native,
   keyboard-accessible disclosures below it. Shared styles and tool logic stay intact. */
.ts-workspace-page .ts-workspace-intro { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.15rem 0; font-family: 'Outfit', sans-serif; }
.ts-workspace-page .ts-workspace-intro p { margin: 0; display: flex; align-items: center; flex-wrap: wrap; gap: .75rem; }
.ts-workspace-page .ts-workspace-intro strong { color: #16333c; font-size: .95rem; font-weight: 600; }
.ts-workspace-page .ts-workspace-intro p span { color: #64767c; font-size: .8rem; }
.ts-workspace-page .ts-workspace-intro a { flex-shrink: 0; color: #005f6e; font-size: .8rem; text-decoration: none; }
.ts-workspace-page .ts-workspace-intro a :is(i,.pg-i) { margin-left: .35rem; font-size: .65rem; }
.ts-workspace-page .ts-tool-shell { padding: 0 24px; margin-bottom: 2.5rem; }
.ts-workspace-page #tmRoot { box-shadow: 0 4px 24px rgba(16,34,40,.09); border-color: #d3dce0; }
.ts-workspace-page .ts-reference-heading { display: flex; align-items: baseline; gap: 1rem; padding: 0 0 .85rem; font-family: 'Outfit', sans-serif; }
.ts-workspace-page .ts-reference-heading > span { color: #53676e; font-size: .75rem; font-weight: 600; }
.ts-workspace-page .ts-reference-heading p { color: #687b82; font-size: .8rem; margin: 0; }
.ts-workspace-page .ts-reference { margin: 0; border-top: 1px solid #dce4e7; background: transparent; }
.ts-workspace-page .ts-reference:last-child { border-bottom: 1px solid #dce4e7; }
.ts-workspace-page .ts-reference > summary { display: flex; align-items: center; gap: 1rem; padding: 1.15rem .3rem; cursor: pointer; list-style: none; }
.ts-workspace-page .ts-reference > summary::-webkit-details-marker { display: none; }
.ts-workspace-page .ts-reference > summary:hover { background: #edf2f4; }
.ts-workspace-page .ts-reference-icon { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid #dae4e7; border-radius: 10px; background: #fff; color: #47727c; font-size: .85rem; flex-shrink: 0; }
.ts-workspace-page .ts-reference-label { flex: 1; min-width: 0; }
.ts-workspace-page .ts-reference h2 { font-size: .95rem; font-weight: 500; margin: 0; color: #213e47; letter-spacing: 0; }
.ts-workspace-page .ts-reference-label > span { display: block; color: #687b82; font-size: .78rem; margin-top: .2rem; }
.ts-workspace-page .ts-reference-toggle { color: #52747d; font-size: 1.25rem; font-weight: 400; line-height: 1; transition: transform .15s ease; margin: 0 .5rem; }
.ts-workspace-page .ts-reference[open] > summary .ts-reference-toggle { transform: rotate(45deg); }
.ts-workspace-page .ts-reference-body { padding: .5rem 0 1.7rem 3.4rem; }
.ts-workspace-page .ts-reference-body p { font-size: .9rem; line-height: 1.7; color: #53666e; max-width: 90ch; }
.ts-workspace-page .ts-guide-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; max-width: 1000px; margin: 1.25rem 0; }
.ts-workspace-page .ts-guide-grid h3 { font-size: .9rem; color: #234650; margin: 0 0 .5rem; }
.ts-workspace-page .ts-guide-grid p { margin: 0; }
.ts-workspace-page .ts-reference-note { padding-top: 1rem; border-top: 1px solid #e1e8eb; }
.ts-workspace-page .ts-cat-grid { margin-top: 1rem; }
.ts-workspace-page .ts-cat-block { background: #fff; border-radius: 8px; }
.ts-workspace-page .ts-faq { margin-top: 0; max-width: 1000px; }
.ts-workspace-page .ts-faq-item { padding: .85rem 0; }
.ts-workspace-page .ts-faq-item > summary { color: #234650; font-size: .9rem; cursor: pointer; }
.ts-workspace-page .ts-faq-item p { margin: .7rem 0 0 1rem; }
.ts-workspace-page .ts-links { margin-top: 1rem; }
.ts-workspace-page .ts-links a { box-shadow: none; font-size: .88rem; }
.ts-workspace-page .ts-reference summary:focus-visible,
.ts-workspace-page .ts-workspace-intro a:focus-visible { outline: 2px solid #007a8c; outline-offset: 4px; border-radius: 4px; }
@media (max-width: 768px) {
    .ts-workspace-page .ts-tool-shell { padding: 0 10px; margin-bottom: 1.75rem; }
    .ts-workspace-page .ts-workspace-intro { padding: .85rem 0; }
    .ts-workspace-page .ts-workspace-intro p { gap: .15rem; flex-direction: column; align-items: flex-start; }
    .ts-workspace-page .ts-workspace-intro p span { font-size: .72rem; }
    .ts-workspace-page .ts-reference-heading { display: block; }
    .ts-workspace-page .ts-reference-heading p { margin-top: .2rem; }
    .ts-workspace-page .ts-reference > summary { gap: .75rem; padding: 1rem 0; }
    .ts-workspace-page .ts-reference h2 { font-size: .9rem; }
    .ts-workspace-page .ts-reference-body { padding-left: 0; }
    .ts-workspace-page .ts-guide-grid { grid-template-columns: 1fr; gap: 1rem; }
}
@media (prefers-reduced-motion: reduce) {
    .ts-workspace-page .ts-reference-toggle { transition: none; }
}
.ts-workspace-page .tm-metric-title { display: flex; align-items: baseline; gap: .35rem; }
.ts-workspace-page .tm-metric-title > span { min-width: 0; }
.ts-workspace-page .tm-metric-info { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #65848e; cursor: pointer; font-size: .8rem; }
.ts-workspace-page .tm-metric-info:hover { background: #e0edef; color: #005f6e; }
.ts-workspace-page .tm-metric-info:focus-visible { outline: 2px solid #007a8c; outline-offset: 2px; }
.tm-metric-details[hidden] { display: none; }
.tm-metric-details { position: fixed; z-index: 1045; width: min(390px, calc(100vw - 24px)); max-height: calc(100vh - 24px); overflow: auto; box-sizing: border-box; padding: 1.05rem 1.15rem .8rem; border: 1px solid #c8dadd; border-top: 3px solid #007a8c; border-radius: 10px; background: #fff; color: #25444d; box-shadow: 0 12px 36px rgba(16,34,40,.2); font-family: 'Outfit', sans-serif; text-align: left; }
.tm-metric-details h3 { font-family: inherit; font-size: .95rem; font-weight: 600; line-height: 1.4; margin: 0 0 .65rem; text-transform: none; letter-spacing: 0; }
.tm-metric-details .tm-metric-definition { font-size: .84rem; line-height: 1.6; white-space: pre-line; margin: 0 0 .85rem; color: #526b74; }
.tm-metric-details dl { margin: 0; font-size: .78rem; line-height: 1.55; }
.tm-metric-details dl > div { display: grid; grid-template-columns: 82px minmax(0,1fr); gap: .65rem; padding: .5rem 0; border-top: 1px solid #e6edef; }
.tm-metric-details dt { font-weight: 500; color: #647c84; margin: 0; }
.tm-metric-details dd { margin: 0; overflow-wrap: anywhere; }
.tm-metric-details .tm-metric-code { font-size: .68rem; color: #738890; margin: .65rem 0 0; overflow-wrap: anywhere; }
@media (max-width: 768px) {
    .ts-workspace-page .tm-metric-info { width: 28px; height: 28px; }
    .ts-workspace-page .tm-field-meta { font-size: .61rem; line-height: 1.4; letter-spacing: 0; }
}
/* showModal() places this guide above ancestor clipping and every page layer. */
.ts-workspace-page dialog.tm-explainer-overlay { position: fixed; inset: 0; margin: auto; width: min(760px, calc(100vw - 32px)); max-width: none; height: fit-content; max-height: calc(100vh - 32px); max-height: calc(100svh - 32px); padding: 0; border: 1px solid #d5e1e5; border-radius: 14px; background: #fff; color: var(--tm-text); overflow-y: auto; overscroll-behavior: contain; backdrop-filter: none; -webkit-backdrop-filter: none; box-shadow: 0 24px 80px rgba(8,27,34,.28); }
.ts-workspace-page dialog.tm-explainer-overlay:not([open]) { display: none; }
.ts-workspace-page dialog.tm-explainer-overlay[open] { display: block; }
.ts-workspace-page dialog.tm-explainer-overlay::backdrop { background: rgba(9,26,34,.52); backdrop-filter: blur(4px); }
.ts-workspace-page .tm-explainer-content { max-width: none; margin: 0; padding: 0; border: 0; border-radius: 0; box-shadow: none; animation: none; }
.ts-workspace-page .tm-explainer-heading { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 1rem; padding: 1.2rem 1.5rem; background: #fff; border-bottom: 1px solid #e1e9ec; }
.ts-workspace-page .tm-explainer-heading h3 { flex: 1; min-width: 0; padding: 0; margin: 0; border: 0; font-size: 1.2rem; }
.ts-workspace-page .tm-explainer-dismiss { flex-shrink: 0; display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 50%; background: #edf3f5; color: #335d69; font-size: 1.5rem; line-height: 1; cursor: pointer; }
.ts-workspace-page .tm-explainer-dismiss:hover { background: #dcebee; }
.ts-workspace-page .tm-explainer-dismiss:focus-visible,
.ts-workspace-page .tm-explainer-close:focus-visible { outline: 2px solid #007a8c; outline-offset: 3px; }
.ts-workspace-page .tm-explainer-body { padding: 1.1rem 1.5rem 1.5rem; }
.ts-workspace-page .tm-explainer-body > p { color: var(--tm-text); font-family: var(--tm-font-body); font-size: .92rem; line-height: 1.65; margin: 0 0 1.25rem; }
.ts-workspace-page .tm-explainer-body > p strong { color: var(--tm-teal); }
@media (max-width: 768px) {
    .ts-workspace-page dialog.tm-explainer-overlay { width: calc(100vw - 20px); max-height: calc(100vh - 20px); max-height: calc(100svh - 20px); border-radius: 10px; }
    .ts-workspace-page .tm-explainer-heading { padding: 1rem; gap: .65rem; }
    .ts-workspace-page .tm-explainer-heading h3 { font-size: 1rem; line-height: 1.35; }
    .ts-workspace-page .tm-explainer-body { padding: 1rem; }
    .ts-workspace-page .tm-explainer-body > p { font-size: .84rem; }
    .ts-workspace-page .tm-explainer-section { padding: .9rem 1rem; }
}
}

/* ===== CF2 re-skin of Target Search (layer pg: beats the tool's own CSS in layer pgpage) ===== */
@layer pg {
  /* the tool's palette, type and corners take CF2's token roles */
  .target-modal, .tm-metric-details {
    --tm-teal: var(--teal); --tm-teal-light: var(--teal-2); --tm-teal-dark: var(--navy-7);
    --tm-orange: var(--orange); --tm-green: var(--mint); --tm-mint: var(--mint); --tm-burgundy: var(--burgundy);
    /* the tool is a light panel in either theme (its table, guide and pop-ups are white): its surfaces and text use the brand constants, not the theme roles that flip in dark mode */
    color-scheme: light;
    /* the light-panel values of the roles the dark theme overrides (same values as tokens.css, light) */
    --teal-2: #0E6E7C; --link: #0E6E7C; --focus: #0E6E7C; --warn: #8A4B00; --orange-ink: #8A4B00;
    --tm-darker: var(--cream); --tm-dark: var(--white); --tm-card: var(--white); --tm-slate: var(--white); --tm-slate-light: var(--paper);
    --tm-text: var(--navy-9); --tm-text-dim: color-mix(in srgb, var(--navy-9) 62%, var(--white)); --tm-border: color-mix(in srgb, var(--navy-9) 22%, var(--white)); --tm-border-light: color-mix(in srgb, var(--navy-9) 10%, var(--white));
    --tm-header-from: var(--navy-8); --tm-header-to: var(--navy-9);
    --tm-radius: var(--r-2); --tm-radius-sm: var(--r-1); --tm-radius-xs: 2px;
    --tm-font-display: var(--f); --tm-font-body: var(--f); --tm-font-mono: var(--f);
  }
  .ts-seo, .ts-workspace-page .ts-workspace-intro, .ts-workspace-page .ts-reference-heading { font-family: var(--f); }

  /* the hero: a short band (the tool is the page) */
  .pg-ts-hero { min-block-size: 0; padding-block: var(--s-4) var(--s-5); }
  .pg-ts-hero .pg-h1 { font-size: var(--t-xl); }
  .pg-ts-hero .pg-sub { margin-block-start: var(--s-2); }

  /* page body */
  .pg-ts-wrap { max-inline-size: 94rem; margin-inline: auto; padding-inline: var(--gutter); }
  .ts-workspace-page .ts-tool-shell { max-inline-size: none; padding: 0; margin: 0 0 var(--s-6); }
  .ts-workspace-page .ts-workspace-intro { padding-block: var(--s-4) var(--s-3); }
  .ts-workspace-page .ts-workspace-intro strong { color: var(--fg); }
  .ts-workspace-page .ts-workspace-intro p span { color: var(--fg-3); }
  .ts-workspace-page .ts-workspace-intro a { color: var(--link); }
  .pg-ts-ref { padding-block-end: var(--s-8); }
  .ts-workspace-page #tmRoot { box-shadow: var(--e-1); border-color: var(--hair-2); }

  /* square corners, no round pills */
  #tmRoot :is(.tm-view-toggle, .tm-view-btn, .tm-results-count, .tm-crit-count b, .tm-explainer-dismiss, .tm-explainer-close, .tm-lock-chip, .tm-state-chip, .tm-crit-chip, .tm-pro-locked, .tm-pro-badge, .tm-plan-pill, .tm-copy-btn, .tm-btn-search, .tm-btn-reset, .tm-info-btn, .tm-metric-info, .tm-title-icon, .tm-mobile-select, .tm-max-input, .tm-filter-input) { border-radius: var(--r-1); }
  .ts-workspace-page dialog.tm-explainer-overlay { border-radius: var(--r-2); }
  .ts-workspace-page .ts-reference-icon, .ts-workspace-page .ts-cat-block, .ts-points li, .ts-links a { border-radius: var(--r-1); }

  /* the reference accordions */
  .ts-workspace-page .ts-reference { border-color: var(--hair); }
  .ts-workspace-page .ts-reference:last-child { border-bottom-color: var(--hair); }
  .ts-workspace-page .ts-reference > summary:hover { background: var(--alt); }
  .ts-workspace-page .ts-reference h2 { color: var(--fg); font-weight: var(--w-med); }
  .ts-workspace-page .ts-reference-label > span, .ts-workspace-page .ts-reference-heading p, .ts-workspace-page .ts-reference-heading > span { color: var(--fg-3); }
  .ts-workspace-page .ts-reference-body p { color: var(--fg-2); }
  .ts-workspace-page .ts-reference-toggle { color: var(--fg-3); }
  .ts-workspace-page .ts-reference-icon { background: var(--surface); border-color: var(--hair); color: var(--teal-2); }
  .ts-workspace-page .ts-guide-grid h3, .ts-workspace-page .ts-faq-item > summary, .ts-cat-block h3 { color: var(--fg); }
  .ts-workspace-page .ts-cat-block { background: var(--surface); border-color: var(--hair); }
  .ts-metric-list li { background: var(--bg); border-color: var(--hair); color: var(--fg-2); border-radius: 2px; }
  .ts-links a { background: var(--surface); border-color: var(--hair); color: var(--fg); }
  .ts-links a span { color: var(--fg-3); }
  .ts-links a:hover { border-color: var(--orange); transform: none; }
  .ts-links .pg-i, .ts-cat-block h3 .pg-i { color: var(--orange-dk); margin-inline-end: .45rem; }
  /* the catalogue's chevron was a Font Awesome glyph */
  .ts-cat-block > summary::after { content: ''; font-family: inherit; inline-size: .5rem; block-size: .5rem; margin-inline-start: .5rem; border: solid var(--fg-3); border-width: 0 2px 2px 0; transform: rotate(45deg); transition: transform .18s var(--ease); }
  .ts-cat-block[open] > summary::after { transform: rotate(-135deg); }

  .tm-view-btn.active, .tm-view-btn.tm-view-locked.active { color: #fff; }   /* the tool left Data/Map dim while active */

  /* spinner (was fa-spin) */
  .tm-spin { animation: pgTsSpin .9s linear infinite; }
  @keyframes pgTsSpin { to { transform: rotate(360deg); } }
  @media (prefers-reduced-motion: reduce) { .tm-spin { animation-duration: 3s; } }
  .tm-loading .pg-i { font-size: 1.7rem; color: var(--teal-2); margin-block-end: .6rem; }
}

/* round markers are for the map; in the table the rank is a square */
@layer pg {
  .tm-results-table .tm-marker { border-radius: var(--r-1); }
  .tm-results-table th { white-space: normal; min-inline-size: 7rem; max-inline-size: 12rem; line-height: 1.25; vertical-align: bottom; }
  .tm-results-table th:nth-child(-n+5) { min-inline-size: 0; }
  .ts-workspace-page dialog.tm-explainer-overlay:focus { outline: none; }
  .pg-swipe { margin: 0; padding: var(--s-2) var(--s-3) 0; font-size: var(--t-xs); font-weight: var(--w-strong); letter-spacing: .04em; color: var(--fg-3); text-align: end; background: var(--tm-darker); }
}
@media (min-width: 40.01rem) { .pg-swipe { display: none !important; } }

/* phone */
@property --pg-edge { syntax: '<length>'; inherits: false; initial-value: 1.5rem; }
@keyframes pgEdgeOff { to { --pg-edge: 0rem; } }
@media (max-width: 40rem) {
  @layer pg {
    /* the tool is the page: a short hero, the intro on one line */
    .pg-ts-hero { padding-block: var(--s-3) var(--s-4); }
    .pg-ts-hero .pg-h1 { font-size: var(--t-lg); }
    .pg-ts-hero .pg-sub { display: none; }
    .ts-workspace-page .ts-workspace-intro { padding-block: var(--s-3) var(--s-2); }
    .ts-workspace-page .ts-workspace-intro p { flex-direction: row; align-items: center; gap: .5rem; }
    .ts-workspace-page .ts-workspace-intro strong { display: none; }

    /* 44px tap targets */
    #tmRoot .tm-field-input { min-block-size: 2.75rem; }
    #tmRoot .tm-lock-chip { min-block-size: 2.75rem; display: inline-flex; align-items: center; }
    #tmRoot .tm-crit-chip { align-items: center; }
    #tmRoot .tm-crit-x { box-sizing: border-box; padding: 0; margin: -.6rem -.5rem -.6rem 0; }
    #tmRoot .tm-metric-info { inline-size: 2.75rem; block-size: 2.75rem; margin: -.7rem -.55rem -.7rem -.45rem; }
    #tmRoot .tm-view-btn, #tmRoot .tm-btn-search, #tmRoot .tm-btn-reset, #tmRoot .tm-copy-btn { min-block-size: 2.75rem; }
    #tmRoot .tm-info-btn { inline-size: 2.75rem; block-size: 2.75rem; }

    /* the results table is wider than the screen: its right edge fades, and a line says so */
    .tm-results-table-wrap { mask-image: linear-gradient(to right, #000 calc(100% - var(--pg-edge)), transparent); -webkit-mask-image: linear-gradient(to right, #000 calc(100% - var(--pg-edge)), transparent); }
    @supports (animation-timeline: scroll(self inline)) {
      .tm-results-table-wrap { animation: pgEdgeOff linear both; animation-timeline: scroll(self inline); animation-range: calc(100% - 2rem) 100%; }
    }
  }
}

@media (max-width: 40rem) {
  @layer pg {
    .pg-ts-hero { padding-block: var(--s-3) var(--s-3); }
    .pg-sm-hide { display: none; }
    /* the rows keep 44px targets without the extra air: narrower boxes give the metric name its room back */
    #tmRoot .tm-field-row { padding-block: .15rem; gap: .35rem; }
    #tmRoot .tm-field-input { inline-size: 3.25rem; padding-inline: .25rem; }
    #tmRoot .tm-field-inputs { gap: .3rem; }
    /* Data and Map views use the whole tool: the category / state pickers belong to the Search view */
    #tmRoot:has(#tm-search-panel:not(.active)) .tm-mobile-controls { display: none; }
    /* the guide: the Got it button stays at the foot of the dialog, so there is always a way out and a sign there is more */
    .tm-explainer-close { position: sticky; inset-block-end: 0; inline-size: 100%; box-shadow: 0 -.75rem .75rem -.5rem var(--white); }
  }
}

@media (max-width: 40rem) {
  @layer pg {
    .pg-ts-hero { padding-block: var(--s-2) var(--s-3); }
    /* the tool's title says what the page title already says: icon and plan pill get the row, on one line */
    #tmRoot .tm-title > div:last-child { position: absolute; inline-size: 1px; block-size: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
    #tmRoot .tm-pro-locked, #tmRoot .tm-pro-badge { white-space: nowrap; }
    #tmRoot .tm-header-actions { margin-inline-start: auto; }
    /* criteria chips: one scrolling row instead of a stack */
    #tmRoot #tm-crit-chips { display: flex; flex-wrap: nowrap; gap: .35rem; inline-size: 100%; overflow-x: auto; scrollbar-width: none; }
    #tmRoot #tm-crit-chips::-webkit-scrollbar { display: none; }
    #tmRoot #tm-crit-chips .tm-crit-chip { flex: none; margin: 0; }
  }
}

@media (max-width: 40rem) {
  @layer pg {
    /* the tool ends inside the first screen once it is scrolled to: the SEARCH button is never below the fold */
    #tmRoot.target-modal { height: calc(100svh - 12rem); min-height: 30rem; }
    #tmRoot #tm-crit-chips { mask-image: linear-gradient(to right, #000 calc(100% - 1.5rem), transparent); -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 1.5rem), transparent); }
  }
}

/* review fixes (Sol, 23 Oct): contrast, targets, keyboard */
@layer pg {
  /* navy on orange fills (brand rule); orange text on a surface uses the warm ink role */
  #tmRoot :is(.tm-btn-search, .tm-results-count) { color: var(--navy-9); }
  #tmRoot .tm-score-badge { color: var(--navy-9) !important; }
  #tmRoot .tm-explainer-section h4, .ts-workspace-page .tm-explainer-section h4 { color: var(--warn); }
  /* the criterion remove control is a button now */
  #tmRoot .tm-crit-x { background: none; border: 0; color: inherit; cursor: pointer; font: inherit; line-height: 1; display: inline-grid; place-items: center; }
  #tmRoot :is(.tm-field-input, .tm-filter-input, .tm-max-input, .tm-mobile-select):focus-visible,
  #tmRoot :is(.tm-crit-x, .tm-btn-search, .tm-btn-reset, .tm-view-btn, .tm-copy-btn, .tm-cat-btn, .tm-info-btn, .tm-metric-info, .tm-state-chip):focus-visible,
  .tm-explainer-dismiss:focus-visible, .tm-explainer-close:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
  .tm-explainer-dismiss { inline-size: 2.75rem; block-size: 2.75rem; }
}
@media (max-width: 40rem) {
  @layer pg {
    #tmRoot .tm-mobile-select, #tmRoot .tm-filter-input { min-block-size: 2.75rem; }
    #tmRoot .tm-results-table td > a[style] { min-block-size: 2.75rem; padding-inline: .8rem !important; }
  }
}

@layer pg {
  .tm-map-retry { min-block-size: 2.75rem; padding: .5rem 1.1rem; border: 0; border-radius: var(--r-1); background: var(--teal); color: var(--white); font: var(--w-strong) var(--t-sm)/1.2 var(--f); cursor: pointer; }
  .pg-swipe { color: var(--tm-text-dim); }
  #tmRoot .tm-crit-x { min-inline-size: 2.75rem; min-block-size: 2.75rem; }
}
@media (max-width: 40rem) {
  @layer pg {
    /* the scroller gives way, so the Search / Reset row at the foot of the tool is always whole */
    #tmRoot .tm-form-area { min-height: 0; }
    #tmRoot .tm-mobile-actions { flex: none; }
  }
}
