:root {
    --purple-950: #24103f;
    --purple-900: #321357;
    --purple-800: #4e218d;
    --purple-700: #6534a7;
    --green-700: #08734c;
    --green-600: #0b8a5b;
    --green-100: #dcf7e9;
    --amber-700: #8a5600;
    --amber-100: #fff2cf;
    --red-700: #9b2440;
    --red-100: #ffedf1;
    --ink: #211b30;
    --muted: #686174;
    --surface: #ffffff;
    --background: #f5f5fa;
    --line: #dfdce7;
    --shadow: 0 12px 34px rgba(45, 24, 77, .08);
    --focus: #ffb000;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--background); color: var(--ink); font: 15px/1.5 Arial, Helvetica, sans-serif; }
a { color: var(--purple-800); text-decoration-thickness: .08em; text-underline-offset: .18em; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
img, svg, object { max-width: 100%; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.skip-link { position: fixed; z-index: 100; top: 8px; left: 8px; padding: 10px 14px; color: #fff; background: var(--purple-950); border-radius: 8px; transform: translateY(-150%); }
.skip-link:focus { transform: none; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }

.app { min-height: 100vh; display: flex; min-width: 0; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 20; width: 270px; display: flex; flex-direction: column; overflow-y: auto; padding: 22px 14px; color: #f8f3ff; background: linear-gradient(180deg, var(--purple-950), #4b2082); }
.brand { display: flex; gap: 11px; align-items: center; padding: 0 8px 20px; color: inherit; font-weight: 900; letter-spacing: .12em; }
.brand:hover { text-decoration: none; }
.brand b { display: grid; place-items: center; flex: 0 0 40px; width: 40px; height: 40px; border-radius: 12px; color: #0d3728; background: #66d6a3; font-size: 22px; }
.brand small { display: block; max-width: 165px; margin-top: 2px; font-size: 9px; line-height: 1.35; letter-spacing: .06em; opacity: .78; }
.nav-group p { margin: 17px 10px 5px; color: #cbbce0; font-size: 10px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.navlink { display: block; margin: 2px 0; padding: 10px 11px; border-left: 3px solid transparent; border-radius: 8px; color: #eee4fa; }
.navlink:hover, .navlink.active { color: #fff; background: rgba(255,255,255,.11); text-decoration: none; }
.navlink.active { border-left-color: #65d5a1; }
.env { margin-top: auto; padding: 16px 8px 2px; border-top: 1px solid rgba(255,255,255,.16); color: #d8cce9; font-size: 12px; }
.nav-backdrop { display: none; }

.main { width: calc(100% - 270px); min-width: 0; margin-left: 270px; }
.topbar { position: sticky; top: 0; z-index: 10; min-height: 78px; display: grid; grid-template-columns: minmax(170px, auto) minmax(260px, 520px) auto; gap: 22px; align-items: center; padding: 11px 30px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); backdrop-filter: blur(8px); }
.topbar-title small, .eyebrow { display: block; color: var(--green-700); font-size: 10px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.topbar-title strong { font-size: 18px; }
.menu { display: none; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--purple-800); padding: 9px 11px; font-weight: 800; }
.top-search { display: flex; min-width: 0; }
.top-search input { min-width: 0; border-radius: 9px 0 0 9px; }
.top-search button { border: 0; border-radius: 0 9px 9px 0; padding: 0 14px; color: #fff; background: var(--purple-800); font-weight: 800; }
.user { display: flex; justify-content: flex-end; align-items: center; gap: 9px; font-weight: 700; }
.user form { display: inline; }
.user-name { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
main { width: 100%; min-width: 0; max-width: 1500px; margin: auto; padding: 30px; }

.notice { display: flex; gap: 8px; align-items: baseline; margin-bottom: 16px; padding: 12px 14px; border-radius: 9px; }
.notice.good, .good { color: #0a6544; background: var(--green-100); }
.notice.bad, .bad { color: var(--red-700); background: var(--red-100); }
.muted { color: var(--muted); }
.break { overflow-wrap: anywhere; }

.pagehead, .hero, .cardhead { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; min-width: 0; margin-bottom: 20px; }
.pagehead > *, .hero > *, .cardhead > *, .topbar > *, .grid > *, .filters > *, .form-grid > * { min-width: 0; }
.pagehead > :first-child, .cardhead > :first-child { flex: 1 1 auto; }
.pagehead > .button, .pagehead > .actions { flex: 0 0 auto; }
.pagehead h1, .hero h1 { margin: 4px 0; font-size: clamp(26px, 3vw, 36px); line-height: 1.18; }
.pagehead h1, .hero h1, .card h2, .card h3, .panel h2 { overflow-wrap: anywhere; }
.pagehead p, .hero p { max-width: 780px; margin: 0; color: var(--muted); overflow-wrap: anywhere; }
.hero { padding: clamp(22px, 4vw, 36px); border-radius: 18px; color: #fff; background: linear-gradient(120deg, #2d1252, #5b2995); box-shadow: var(--shadow); }
.hero p { color: #eee6f7; }
.hero .eyebrow { color: #91ebbd; }
.hero-actions, .actions { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; }

.button, button.button { display: inline-block; border: 1px solid transparent; border-radius: 9px; padding: 10px 14px; color: #fff; background: var(--purple-800); font-weight: 800; line-height: 1.25; text-align: center; }
.button:hover { color: #fff; background: var(--purple-700); text-decoration: none; }
.button.secondary { border-color: #cbbce2; color: var(--purple-800); background: #fff; }
.button.secondary:hover { color: var(--purple-950); background: #f6f1fb; }
.button.danger { background: var(--red-700); }
.button.compact { padding: 7px 10px; }
.linkbutton { border: 0; padding: 7px; color: var(--purple-800); background: none; font-weight: 800; }

.grid { display: grid; min-width: 0; gap: 16px; }
.two { grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr); }
.three { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 13px; margin: 18px 0; }
.metric, .card, .panel { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: 0 4px 20px rgba(45,24,77,.035); }
.metric { display: block; padding: 17px; color: var(--ink); }
.metric:hover { border-color: #a986d1; text-decoration: none; }
.metric strong { display: block; margin: 4px 0; font-size: 29px; line-height: 1; }
.metric span, .metric small { color: var(--muted); font-size: 12px; }
.metric small { color: var(--purple-800); font-weight: 800; }
.card, .panel { min-width: 0; padding: 20px; overflow-wrap: anywhere; }
.card h2, .panel h2 { margin: 0 0 12px; font-size: 19px; }
.card h3 { margin: 15px 0 6px; font-size: 15px; }
.card + .card { margin-top: 16px; }
.cardhead { margin-bottom: 12px; }
.cardhead h2 { margin: 0; }

.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); gap: 10px; align-items: end; min-width: 0; margin: 15px 0 20px; padding: 15px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.filter-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.stack { display: grid; gap: 10px; }
.stack label, .filters label, .field label { display: block; margin-bottom: 4px; color: #40384e; font-size: 12px; font-weight: 800; }
input, select, textarea { width: 100%; min-height: 42px; border: 1px solid #cfcad9; border-radius: 8px; padding: 9px 10px; color: var(--ink); background: #fff; }
textarea { min-height: 105px; resize: vertical; }
input::placeholder, textarea::placeholder { color: #777080; opacity: 1; }
.inline-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-top: 14px; }
.inline-form > * { flex: 1 1 150px; }
.inline-form > button { flex: 0 0 auto; }
.check { display: flex; gap: 8px; align-items: flex-start; }
.check input { width: auto; min-height: 0; margin-top: 4px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid .span-2 { grid-column: span 2; }
.disclosure > summary, .nested-disclosure > summary { display: flex; justify-content: space-between; gap: 16px; align-items: center; cursor: pointer; color: var(--purple-800); }
.disclosure > summary span { color: var(--muted); font-size: 12px; font-weight: 400; }
.disclosure-body { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.nested-disclosure { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.nested-disclosure .disclosure-body { max-height: 540px; overflow-y: auto; padding-right: 5px; }

.tablewrap { width: 100%; max-width: 100%; min-width: 0; overflow-x: auto; padding: 0; border-radius: 13px; }
.tablewrap table, .table { width: 100%; border-collapse: collapse; }
.tablewrap th, .tablewrap td, .table th, .table td { padding: 13px 15px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.tablewrap th, .table th { color: var(--muted); font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
td small, td strong { display: block; }
.empty { padding: 30px !important; color: var(--muted); text-align: center; }
.empty-state { padding: 28px; border: 1px dashed #c8c1d3; border-radius: 12px; color: var(--muted); text-align: center; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 999px; color: #4f396e; background: #eee8f6; font-size: 11px; font-weight: 800; }
.badge.followed, .badge.active, .confirmed, .classified, .completed { color: #096344; background: var(--green-100); }
.ambiguous, .pending_review, .disabled { color: var(--amber-700); background: var(--amber-100); }
.rejected, .failed { color: var(--red-700); background: var(--red-100); }
.plain, .statuslist, .result-list, .territory-links { margin: 0; padding: 0; list-style: none; }
.plain li, .statuslist li, .result-list li { display: flex; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.result-list li { align-items: center; }
.result-kind { flex: 0 0 110px; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.result-copy { flex: 1; min-width: 0; }
.result-copy small { display: block; color: var(--muted); }
.pagination { margin: 20px 0; }
.atlas-pagination { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 20px; align-items: center; margin: 20px 0; }
.pagination > .atlas-pagination { margin: 0; }
.atlas-pagination__summary { margin: 0; color: var(--muted); font-size: 13px; }
.atlas-pagination__summary strong { color: var(--ink); }
.atlas-pagination__pages { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; margin: 0; padding: 0; list-style: none; }
.atlas-pagination__control, .atlas-pagination__page, .atlas-pagination__ellipsis { min-width: 38px; min-height: 38px; display: inline-flex; justify-content: center; gap: 6px; align-items: center; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--purple-800); background: #fff; font-size: 13px; font-weight: 800; line-height: 1; text-decoration: none; }
.atlas-pagination__control:hover, .atlas-pagination__page:hover { border-color: #8c66bd; color: var(--purple-900); background: #f2ecf9; text-decoration: none; }
.atlas-pagination__page.is-current { border-color: var(--purple-800); color: #fff; background: var(--purple-800); }
.atlas-pagination__control.is-disabled { color: #827a8c; background: #f2f0f5; cursor: not-allowed; }
.atlas-pagination__ellipsis { min-width: 28px; padding-inline: 5px; border-color: transparent; background: transparent; }
.atlas-pagination__icon { flex: 0 0 16px; width: 16px; min-width: 16px; max-width: 16px; height: 16px; min-height: 16px; max-height: 16px; }
dl { margin: 0; }
dt { margin-top: 13px; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }
dd { min-width: 0; margin: 3px 0; overflow-wrap: anywhere; }
.detail-list a { overflow-wrap: anywhere; }
.review-actions-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 14px; }
.review-actions-grid--three { grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.action-card { min-width: 0; margin: 0; padding: 16px; border: 1px solid var(--line); border-radius: 11px; background: #fbfafd; }
.action-card h3, .action-card p { margin-top: 0; }
.action-card select[multiple] { min-height: 142px; }
.action-card .button { align-self: start; }

.map-layout { display: grid; grid-template-columns: minmax(340px, 1.15fr) minmax(250px, .85fr); gap: 18px; }
.map-shell { position: relative; min-height: 0; display: grid; place-items: center; overflow: hidden; padding: clamp(12px, 2vw, 24px); border: 1px solid var(--line); border-radius: 16px; background: radial-gradient(circle at center, #fff 0, #f2f0f7 72%); }
.brazil-map { display: block; width: min(100%, 520px); height: auto; aspect-ratio: 1000 / 912; border: 0; }
.compact-map .brazil-map { width: min(100%, 360px); }
.map-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; color: var(--muted); font-size: 12px; }
.map-legend span::before { content: ''; display: inline-block; width: 11px; height: 11px; margin-right: 6px; border-radius: 3px; background: #ddd7e8; vertical-align: -1px; }
.map-legend .legend-followed::before { background: #16a06c; }
.map-legend .legend-commercial::before { background: #f0a51a; }
.map-legend .legend-both::before { background: #6534a7; }
.map-layer-controls { display: flex; justify-content: space-between; gap: 18px; align-items: end; margin-bottom: 18px; }
.map-layer-controls h2 { margin: 0 0 4px; }
.map-layer-controls p { margin: 0; }
.map-layer-controls .inline-form { flex: 0 1 650px; justify-content: flex-end; align-items: end; }
.map-layer-controls label { min-width: 170px; }
.map-layer-summary { display: grid; gap: 3px; margin-top: 12px; color: var(--muted); font-size: 12px; }
.map-layer-summary strong { color: var(--ink); }
.map-layer-legend .legend-none::before { background: #d9d3e3; }
.map-layer-legend .legend-low::before { background: #d88984; }
.map-layer-legend .legend-medium::before { background: #efbd55; }
.map-layer-legend .legend-high::before { background: #16a06c; }
.territory-links { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.territory-links a { display: flex; justify-content: space-between; gap: 5px; padding: 9px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: #fff; font-weight: 800; }
.territory-links a:hover { border-color: #9e7dcc; text-decoration: none; }
.territory-links small { color: var(--muted); font-weight: 400; }

.territory-hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px; align-items: start; margin-bottom: 18px; padding: 24px; border-radius: 16px; color: #fff; background: linear-gradient(125deg, #2b124d, #56308b); }
.territory-hero h1 { margin: 4px 0; font-size: clamp(28px, 4vw, 42px); }
.territory-hero p { margin: 0; color: #e8ddf4; }
.territory-hero .eyebrow { color: #91ebbd; }
.territory-tabs { position: sticky; top: 78px; z-index: 5; display: flex; gap: 5px; overflow-x: auto; margin: 0 0 18px; padding: 7px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,.97); }
.territory-tabs a { flex: 0 0 auto; padding: 8px 10px; border-radius: 7px; color: #483a59; font-size: 12px; font-weight: 800; }
.territory-tabs a:hover { background: #f1ecf7; text-decoration: none; }
.section-anchor { scroll-margin-top: 150px; }
.indicator-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 11px; }
.indicator { min-height: 125px; padding: 15px; border: 1px solid var(--line); border-radius: 11px; background: #fbfafd; }
.indicator strong { display: block; margin: 5px 0; font-size: 23px; }
.indicator small { color: var(--muted); }
.news-card { display: grid; gap: 7px; padding: 15px 0; border-bottom: 1px solid var(--line); }
.news-meta { display: flex; flex-wrap: wrap; gap: 8px 15px; color: var(--muted); font-size: 12px; }
.briefing-header { display: none; }

.section-gap { margin-top: 18px; }
.sf-search { border-top: 4px solid var(--green-600); }
.searchbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.searchbar > label { flex: 0 1 220px; color: #40384e; font-size: 12px; font-weight: 800; }
.searchbar > .grow, .grow { flex: 1 1 300px; }
.searchbar label > span { display: block; margin-bottom: 4px; }
.compact-head { margin-bottom: 14px; }
.search-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(230px, 300px); gap: 16px; align-items: start; }
.search-workspace { padding: 16px; }
.primary-search { margin-top: 12px; }
.preset-list { display: flex; flex-wrap: wrap; gap: 7px; }
.preset-chip { padding: 7px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); background: #fff; font-size: 12px; font-weight: 800; text-decoration: none; }
.preset-chip:hover, .preset-chip.active { border-color: #8c66bd; color: var(--purple-900); background: #f2ecf9; text-decoration: none; }
.inline-disclosure { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.inline-disclosure > summary { color: var(--purple-800); cursor: pointer; font-size: 12px; font-weight: 800; }
.filter-panel { display: grid; grid-template-columns: minmax(300px, 1fr) minmax(180px, .5fr) auto; gap: 14px; align-items: end; margin-top: 12px; }
.filter-panel fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.filter-panel legend, .filter-panel label > span { display: block; margin-bottom: 5px; font-size: 12px; font-weight: 800; }
.check-grid { display: flex; flex-wrap: wrap; gap: 7px 13px; }
.check-grid label { white-space: nowrap; font-size: 12px; }
.saved-searches { position: sticky; top: 94px; padding: 16px; }
.saved-search-row { align-items: flex-start !important; }
.saved-search-row > a { min-width: 0; }
.saved-search-row small { display: block; max-width: 170px; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.saved-search-row form { flex: 0 0 auto; }
.danger-text { color: var(--red-700); font-size: 11px; }
.hint { margin: 10px 0 0; color: var(--muted); font-size: 12px; }
.hint code { padding: 2px 5px; border-radius: 5px; color: #3e245d; background: #f0ebf7; }
.result-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 13px; }
.result-card { display: grid; gap: 9px; padding: 17px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.result-card:hover { border-color: #a889ce; box-shadow: var(--shadow); }
.result-card.compact, .compact { padding: 10px 12px; }
.internal-note { margin-top: 16px; padding: 13px; border-left: 4px solid var(--amber-700); border-radius: 7px; color: #5c410f; background: var(--amber-100); }
.internal-note p { margin: 5px 0 0; }
.timeline { position: relative; margin: 0; padding: 0; list-style: none; }
.timeline::before { content: ''; position: absolute; top: 7px; bottom: 7px; left: 8px; width: 2px; background: var(--line); }
.timeline li { position: relative; display: grid; grid-template-columns: 18px 1fr; gap: 10px; padding: 8px 0; }
.timeline li > div { display: grid; gap: 2px; }
.timeline li small { color: var(--muted); }
.timeline-dot { position: relative; z-index: 1; width: 16px; height: 16px; margin-top: 3px; border: 3px solid #fff; border-radius: 50%; background: #8b8199; box-shadow: 0 0 0 1px #8b8199; }
.timeline-dot.pending { background: #f0a51a; box-shadow: 0 0 0 1px #c57c00; }
.timeline-dot.accepted, .timeline-dot.no_changes { background: var(--green-600); box-shadow: 0 0 0 1px var(--green-700); }
.timeline-dot.rejected, .timeline-dot.failed { background: var(--red-700); box-shadow: 0 0 0 1px var(--red-700); }
.diff-new { display: inline-block; padding: 3px 6px; border-radius: 5px; color: #075d3e; background: var(--green-100); font-weight: 800; }
.decision-bar { position: sticky; bottom: 12px; z-index: 4; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; margin-top: 18px; padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.96); box-shadow: var(--shadow); }

.auth { min-height: 100vh; display: grid; place-items: center; padding: 18px; background: linear-gradient(135deg, #281049, #5a2a9d); }
.authcard { width: min(100%, 470px); padding: 32px; border-radius: 18px; background: #fff; box-shadow: 0 25px 70px rgba(0,0,0,.35); }
.authcard .brand { color: var(--purple-950); }
.authcard h1 { margin: 8px 0; }
.authcard p { color: var(--muted); }
.authcard form { display: grid; gap: 12px; }
.detail { display: grid; grid-template-columns: 150px 1fr; }
.detail dt, .detail dd { padding: 10px 0; border-bottom: 1px solid var(--line); }
.detail dd { margin: 0; }
.qr { margin: 15px 0; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; text-align: center; }
.qr img { display: inline-block; height: auto; }
.codes { display: grid; grid-template-columns: repeat(2,1fr); gap: 8px; padding: 0; list-style: none; }
.codes li { padding: 9px; border-radius: 7px; background: #f1edfa; font: 700 16px monospace; }
.narrow { max-width: 680px; }
.narrow-form { width: min(100%, 980px); }

@media (max-width: 1100px) {
    .topbar { grid-template-columns: auto minmax(190px, 1fr) auto; gap: 12px; }
    .topbar-title { display: none; }
    .menu { display: inline-flex; gap: 6px; align-items: center; }
    .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
    .nav-open .sidebar { transform: none; }
    .nav-open { overflow: hidden; }
    .nav-backdrop { position: fixed; inset: 0; z-index: 15; width: 100%; border: 0; background: rgba(23, 13, 36, .54); }
    .nav-open .nav-backdrop { display: block; }
    .main { width: 100%; margin-left: 0; }
    .map-layout { grid-template-columns: 1fr; }
    .map-layer-controls { align-items: stretch; flex-direction: column; }
    .map-layer-controls .inline-form { flex-basis: auto; justify-content: flex-start; }
    .search-layout { grid-template-columns: 1fr; }
    .saved-searches { position: static; }
}

@media (max-width: 720px) {
    main { padding: 20px 14px; }
    .topbar { grid-template-columns: auto minmax(0, 1fr) auto; padding: 10px 13px; }
    .top-search input { font-size: 16px; }
    .top-search button { padding: 0 10px; }
    .user-name { display: none; }
    .pagehead, .hero, .cardhead, .territory-hero { grid-template-columns: 1fr; flex-direction: column; }
    .pagehead > .button, .pagehead > .actions { flex: 0 1 auto; }
    .two, .three { grid-template-columns: 1fr; }
    .map-shell { min-height: 0; }
    .brazil-map { height: auto; }
    .territory-links { grid-template-columns: repeat(2, 1fr); }
    .inline-form { display: grid; }
    .inline-form > button { width: 100%; }
    .searchbar { display: grid; }
    .searchbar > *, .searchbar > .grow { width: 100%; }
    .filter-panel { grid-template-columns: 1fr; }
    .decision-bar .button { flex: 1 1 100%; }
    .detail { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .form-grid .span-2 { grid-column: auto; }
    .codes { grid-template-columns: 1fr; }
    .tablewrap table { min-width: 620px; }
    .filter-actions .button { flex: 1 1 140px; }
    .atlas-pagination { align-items: stretch; flex-direction: column; }
    .atlas-pagination__summary { text-align: center; }
    .atlas-pagination__pages { justify-content: space-between; }
    .atlas-pagination__optional { display: none; }
    .atlas-pagination__control { min-height: 44px; padding-inline: 14px; }
}

@media (max-width: 420px) {
    .top-search button { width: 44px; overflow: hidden; color: transparent; position: relative; }
    .top-search button::after { content: '⌕'; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 21px; }
    .territory-links { grid-template-columns: 1fr; }
    .map-shell { min-height: 0; }
    .brazil-map { height: auto; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

@media print {
    @page { margin: 14mm; }
    body { color: #000; background: #fff; font-size: 11pt; }
    .sidebar, .topbar, .skip-link, .nav-backdrop, .territory-tabs, .no-print, .button, form { display: none !important; }
    .main { width: 100%; margin: 0; }
    main { max-width: none; padding: 0; }
    .briefing-header { display: block; margin-bottom: 18px; border-bottom: 2px solid #321357; }
    .card, .panel, .metric, .territory-hero { break-inside: avoid; box-shadow: none; }
    .territory-hero { color: #000; background: #fff; border: 1px solid #777; }
    .territory-hero p, .territory-hero .eyebrow { color: #333; }
    a { color: #000; text-decoration: none; }
    a[href^="http"]::after { content: ' (' attr(href) ')'; font-size: 8pt; overflow-wrap: anywhere; }
}
