:root {
  --navy: #102b29;
  --navy-soft: #183b36;
  --blue: #166e67;
  --blue-deep: #0f5752;
  --lime: #d9edae;
  --page: #f4f5f1;
  --card: #ffffff;
  --line: #dfe5df;
  --line-soft: #edf0eb;
  --ink: #172b28;
  --muted: #60716c;
  --subtle: #84918a;
  --shadow: 0 12px 32px rgba(19, 49, 42, .045);
}
body { background: var(--page); }
.site-header { background: #102b29; border-bottom-color: rgba(255,255,255,.08); box-shadow: 0 3px 18px rgba(16,43,41,.12); }
.header-inner { min-height: 76px; }
.brand { gap: 12px; font-size: 18px; font-weight: 760; letter-spacing: -.045em; white-space: nowrap; }
.brand > span:last-child { display: block; }
.brand-light { color: #cbdfd4; font-size: inherit; font-weight: 480; letter-spacing: inherit; }
.brand-mark { width: 42px; height: 42px; border: 0; border-radius: 50%; color: #16342e; background: #d9edae; box-shadow: none; }
.brand-mark svg { width: 27px; height: 27px; }
.primary-nav { gap: 5px; }
.nav-link { padding: 11px 16px; border-radius: 999px; color: #c0d2ca; font-size: 14px; font-weight: 620; }
.nav-link.active { color: #14352c; background: #d9edae; box-shadow: none; }
.nav-link:hover { background: rgba(255,255,255,.12); }
.nav-link.active:hover { background: #e5f3c7; }
.btn { border-radius: 10px; font-size: 13px; }
.btn-primary { background: var(--blue); box-shadow: none; }
.btn-primary:hover { background: var(--blue-deep); }
.btn-header { font-size: 12px; }
.main-shell, .admin-main { width: min(1460px, calc(100% - 52px)); }
.welcome-band { padding: 27px 3px 24px; }
.welcome-greeting { color: #527666; font-size: 13px; font-weight: 560; }
.welcome-greeting strong { color: #17664d; font-weight: 760; }
.user-chip #who { display: inline-block; max-width: 165px; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
.eyebrow { color: #5f8577; font-size: 11px; font-weight: 800; letter-spacing: .12em; }
.eyebrow-light { color: #397960; }
.welcome-band h1 { margin: 8px 0 5px; font-size: clamp(33px,3.5vw,49px); font-weight: 760; letter-spacing: -.06em; }
.welcome-band p { color: #536a62; font-size: 15px; }
.scan-badge { min-width: 225px; padding: 14px 17px; border-radius: 14px; background: #fff; box-shadow: var(--shadow); }
.scan-badge strong { color: #365a4d; font-size: 13px; }
.scan-badge small { max-width: none; color: #61716b; font-size: 12px; }
#scanAgo { color: #1a7968; font-weight: 730; }
.overview-grid { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 0; margin-bottom: 20px; overflow: hidden; border: 1px solid var(--line); border-radius: 17px; background: #fff; }
.admin-main .overview-grid { grid-template-columns: repeat(4,minmax(0,1fr)); }
.overview-card { min-height: 99px; gap: 17px; padding: 18px 20px; border: 0; border-right: 1px solid var(--line-soft); border-radius: 0; box-shadow: none; }
.overview-card:last-child { border-right: 0; }
.overview-icon { width: 45px; height: 45px; border-radius: 13px; }
.overview-icon svg { width: 27px; height: 27px; }
.icon-players { color: #1b6d6a; background: #e7f4ef; }
.icon-alliance { color: #9a622c; background: #fff0df; }
.icon-states { color: #5f65a9; background: #eeeffb; }
.metric-label { color: #62716c; font-size: 13px; font-weight: 620; }
.metric-value { margin-top: 5px; font-size: 27px; font-weight: 760; }
.directory-panel { border-radius: 18px; box-shadow: var(--shadow); }
.filter-bar { padding: 22px 24px 19px; }
.filter-heading { margin-bottom: 13px; }
.filter-heading h2 { margin-top: 4px; font-size: 24px; font-weight: 750; }
.filter-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.tier-switch { display: inline-flex; gap: 3px; padding: 4px; border: 1px solid #d8e3da; border-radius: 12px; background: #f2f6f1; }
.tier-switch-button { min-height: 34px; padding: 7px 13px; border: 0; border-radius: 9px; color: #576e62; background: transparent; font-size: 13px; font-weight: 720; }
.tier-switch-button.active { color: #164a3c; background: #fff; box-shadow: 0 1px 4px rgba(22,70,55,.11); }
.tier-thresholds { margin: 1px 0 16px; }
.tier-thresholds-label { margin-bottom: 7px; color: #50685c; font-size: 11px; font-weight: 760; }
.tier-options-note { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
.tier-threshold-choice { display: grid; gap: 4px; min-width: 0; padding: 9px 12px; border: 1px solid #e2e9e2; border-radius: 10px; color: #63766b; background: #fafcf9; font-size: 12px; line-height: 1.45; }
.tier-threshold-choice strong { color: #50665b; font-size: 12px; font-weight: 700; }
.tier-threshold-choice small { margin-left: 5px; color: #267252; font-size: 10px; font-weight: 800; }
.tier-threshold-choice.is-selected { border-color: #9cc6a7; color: #3d5e4a; background: #f0f7ed; box-shadow: inset 0 0 0 1px rgba(90,145,102,.08); }
.tier-threshold-choice.is-selected strong { color: #185f40; font-weight: 820; }
.filters { gap: 13px; }
.filters.filter-player { grid-template-columns: minmax(150px,190px); }
.filter-field label, .field-label { color: #4c6259; font-size: 12px; font-weight: 700; }
.select, .input, .search-wrap { height: 44px; border-color: #cbd9d0; border-radius: 10px; color: #1c322d; font-size: 14px; }
.search-wrap input { height: 40px; font-size: 14px; }
.search-wrap span { color: #6c8377; }
.player-filters { display: grid; grid-template-columns: minmax(180px,1.3fr) minmax(120px,.65fr) minmax(180px,1fr) minmax(140px,.75fr); gap: 13px; margin-top: 14px; padding-top: 15px; border-top: 1px solid var(--line-soft); }
.player-filters .filter-field { gap: 7px; }
.table-toolbar { justify-content: flex-end; min-height: 60px; padding: 10px 22px; background: #fff; }
.btn-export { min-height: 37px; padding: 8px 13px; font-size: 12px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.data-table th { padding: 14px 11px; color: #61756a; background: #f5f8f3; font-size: 11px; font-weight: 800; letter-spacing: .035em; }
.data-table td { padding: 15px 11px; color: #273d35; font-size: 14px; line-height: 1.4; }
.data-table .sort-button { min-width: 0; line-height: 1.2; }
.data-table .sort-button .sort-label { flex: 1 1 auto; min-width: 0; color: inherit; font-size: inherit; font-weight: inherit; letter-spacing: inherit; line-height: inherit; white-space: normal; }
.data-table .sort-button .sort-indicator { flex: 0 0 auto; color: #789087; font-size: 12px; line-height: 1; }
.data-table tbody tr.summary-row:hover td { background: #f7faf6; }
.entity-copy { gap: 3px; }
.entity-copy strong { color: #1b322a; font-size: 15px; font-weight: 760; }
.entity-copy small { color: #688076; font-size: 12px; }
.rank-number { min-width: 27px; height: 27px; border-radius: 8px; color: #416654; background: #edf4ec; font-size: 12px; }
.icon-button { width: 31px; height: 31px; border-radius: 9px; color: #1c7866; font-size: 19px; }
.tier-pill, .tier-count { gap: 5px; min-height: 27px; padding: 4px 9px; font-size: 12px; font-weight: 780; }
.tier-pill { margin-top: 6px; }
.tier-counts { gap: 5px; margin-top: 7px; }
.tier-count strong { font-size: 12px; }
.detail-card { padding: 20px; border-radius: 14px; }
.detail-card-head h3, .state-detail-heading h3 { font-size: 18px; }
.detail-card-head p, .state-detail-heading p { font-size: 12px; }
.detail-metrics { gap: 9px; }
.detail-metric { min-height: 68px; padding: 11px 13px; border-radius: 10px; background: #f7faf6; }
.detail-metric span { color: #63796d; font-size: 11px; font-weight: 700; }
.detail-metric strong { color: #213f33; font-size: 18px; font-weight: 760; }
.detail-metric small { font-size: 10px; }
.tag-pill { font-size: 11px; }
.member-count { font-size: 11px; }
.state-alliance-card { padding: 15px; border-radius: 12px; }
.state-alliance-metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
.state-rank { width: 27px; height: 27px; font-size: 11px; }
.alliance-table th:nth-child(1) { width: 4%; }
.alliance-table th:nth-child(2) { width: 27%; }
.alliance-table th:nth-child(3) { width: 8%; }
.alliance-table th:nth-child(n+4):nth-child(-n+7) { width: 14%; }
.alliance-table th:nth-child(8) { width: 5%; }
.state-table th:nth-child(1) { width: 4%; }
.state-table th:nth-child(2) { width: 21%; }
.state-table th:nth-child(3) { width: 10%; }
.state-table th:nth-child(n+4):nth-child(-n+7) { width: 13%; }
.state-table th:nth-child(8) { width: 9%; }
.state-table th:nth-child(9) { width: 4%; }
.player-table th:nth-child(1) { width: 3.5%; }
.player-table th:nth-child(2) { width: 13%; }
.player-table th:nth-child(3) { width: 4.5%; }
.player-table th:nth-child(4) { width: 12%; }
.player-table th:nth-child(n+5):nth-child(-n+9) { width: 8%; }
.player-table th:nth-child(10) { width: 10.5%; }
.player-table th:nth-child(11) { width: 12.5%; }
.player-table th:nth-child(12) { width: 4%; }
.admin-heading h1 { font-size: clamp(30px,3vw,43px); }
.admin-card-head h2 { font-size: 21px; }
.admin-card-head p, .admin-subcard > p { font-size: 12px; }
.admin-footnote, .admin-status { font-size: 11px; }
.admin-subcard h3 { font-size: 16px; }
.admin-player-info strong { font-size: 13px; }
.admin-player-info span { font-size: 11px; }
.admin-player-info code { font-size: 10px; }
.admin-tab { font-size: 13px; }
.admin-tab { color: #506b5d; }
.admin-tab span { color: #698274; }
.admin-tab:hover { color: #1b5945; background: #f0f6ed; }
.admin-tab.active { color: #215d43; background: #e8f3e8; }
.admin-tab.active span { color: #2d7554; }
.admin-subcard { background: #fafcf9; }
.admin-subcard h3, .admin-player-info strong { color: #1b322a; }
.admin-result, .admin-access-row, .scan-summary { border-color: #e1e9e1; }
.admin-account-row { display: grid; grid-template-columns: minmax(0,1fr); align-items: start; }
.admin-account-row .admin-player-info { width: 100%; }
.admin-account-row .admin-player-info code { white-space: nowrap; overflow-wrap: normal; font-variant-numeric: tabular-nums; }
.admin-account-row.is-roster-missing { border-color: #e8d8b4; background: #fffdf8; }
.admin-account-row.is-roster-missing .admin-player-info > span:first-of-type { color: #8b641d; white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.4; }
.admin-account-actions { display: flex; grid-column: 1 / -1; align-items: center; justify-content: flex-start; flex-wrap: wrap; gap: 7px; }
.issued-access-code { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid #c9dfcc; border-radius: 9px; background: #f1f8ef; }
.issued-access-code > div { display: grid; gap: 4px; min-width: 0; }
.issued-access-code > div > span { color: #50685c; font-size: 11px; font-weight: 700; }
.issued-access-code code { color: #174f3c; font-size: 15px; font-weight: 800; letter-spacing: .08em; overflow-wrap: anywhere; }
.upload-drop { border-color: #afc9b3; background: #f8fbf7; }
.upload-icon { color: #1e7657; background: #e4f3e7; }
.progress-track > span { background: #3a9a6c; }
.admin-filter-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; margin-bottom: 9px; }
.admin-filter-grid .filter-field { gap: 5px; }
.activity-summary { margin-bottom: 15px; padding: 12px 15px; border-radius: 10px; color: #275d4b; background: #eaf5ec; font-size: 13px; font-weight: 720; }
.activity-badge { flex: 0 0 auto; padding: 6px 9px; border-radius: 999px; color: #7b6952; background: #f3eee7; font-size: 11px; font-weight: 750; }
.activity-badge.is-active { color: #13704e; background: #e1f4e8; }
.tier-option-admin { margin-bottom: 16px; }
.tier-option-admin p { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.tier-setting { font-size: 13px; }
.tier-band-preview { font-size: 12px; }
.login-screen { background: radial-gradient(700px 450px at 50% 0%,#254d42,transparent 72%),linear-gradient(140deg,#0e2927,#132e2a); }
.login-card { border-radius: 20px; background: #15332e; }
.site-footer { color: #71827a; font-size: 11px; }
@media (max-width: 1180px) {
  .data-table tbody tr.summary-row td { padding: 11px; font-size: 14px; }
  .data-table tbody tr.summary-row td::before { font-size: 10px; }
  .admin-main .overview-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .admin-main .overview-card:nth-child(2) { border-right: 0; }
  .admin-main .overview-card:nth-child(n+3) { border-top: 1px solid var(--line-soft); }
}
@media (max-width: 860px) {
  .header-inner, .main-shell, .admin-main { width: min(100% - 28px,1460px); }
  .primary-nav { background: #183b36; }
  .player-filters { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .player-filters .filter-field:first-child { grid-column: span 2; }
  .admin-sidebar { grid-template-columns: repeat(4,minmax(0,1fr)); }
  .admin-sidebar-title { grid-column: span 4; }
}
@media (max-width: 600px) {
  .header-inner, .main-shell, .admin-main { width: calc(100% - 22px); }
  .brand { font-size: 14px; }
  .brand-light { font-size: inherit; }
  .brand-mark { width: 34px; height: 34px; }
  .brand-mark svg { width: 23px; height: 23px; }
  .welcome-band { padding: 14px 2px 19px; }
  .welcome-band h1 { font-size: 34px; }
  .welcome-band p { font-size: 13px; }
  .scan-badge { width: 100%; }
  .overview-grid { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 0; }
  .admin-main .overview-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .overview-card { flex-direction: column; align-items: flex-start; gap: 6px; min-height: 108px; padding: 10px; }
  .overview-icon { width: 31px; height: 31px; }
  .overview-icon svg { width: 21px; height: 21px; }
  .metric-label { font-size: 10px; }
  .metric-value { font-size: 19px; }
  .filter-bar { padding: 16px 13px; }
  .filter-heading { align-items: flex-start; flex-direction: column; }
  .filter-heading h2 { font-size: 22px; }
  .filter-actions { width: 100%; justify-content: space-between; }
  .tier-threshold-choice { padding: 8px; font-size: 11px; }
  .tier-threshold-choice strong { font-size: 11px; }
  .tier-switch-button { min-height: 33px; padding: 6px 10px; font-size: 11px; }
  .player-filters { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
  .select, .input, .search-wrap { height: 42px; font-size: 13px; }
  .data-table tbody tr.summary-row td { padding: 9px; }
  .entity-copy strong { font-size: 14px; }
  .entity-copy small { font-size: 11px; }
  .tier-count { font-size: 10px; }
  .tier-count strong { font-size: 10px; }
  .detail-metric { min-height: 66px; padding: 9px; }
  .detail-metric span { font-size: 10px; }
  .detail-metric strong { font-size: 16px; }
  .admin-sidebar { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .admin-sidebar-title { grid-column: span 2; }
  .admin-tab { font-size: 11px; }
  .admin-filter-grid { grid-template-columns: 1fr; }
  .admin-search { flex-wrap: wrap; }
  .admin-search .input { flex-basis: 100%; }
  .admin-account-row { grid-template-columns: 1fr; }
  .admin-account-actions { justify-content: flex-start; }
  .issued-access-code { align-items: flex-start; flex-direction: column; }
  .site-footer { font-size: 10px; }
}

.metric-cell-stack { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.metric-change { display: block; font-size: 10px; font-weight: 750; line-height: 1.1; white-space: nowrap; }
.metric-change.is-up { color: #14805d; }
.metric-change.is-down { color: #bd4d53; }
.metric-change.is-flat, .metric-change.is-neutral { color: #8a98a8; }
.presence-badge { display: inline-flex; width: fit-content; margin-top: 5px; padding: 3px 7px; border: 1px solid #f0d49a; border-radius: 999px; color: #845d16; background: #fff8e6; font-size: 10px; font-weight: 750; }
.player-history { margin-top: 16px; padding-top: 14px; border-top: 1px solid #e6ece7; }
.player-history h4 { margin: 0 0 9px; color: #25433d; font-size: 13px; }
.player-history > p, .presence-note { color: #63796f; font-size: 12px; }
.history-list { display: grid; gap: 7px; }
.history-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 10px; border: 1px solid #e5ece7; border-radius: 9px; background: #fbfdfb; }
.history-row > span:first-child { display: grid; gap: 4px; }
.history-row strong { color: #203b35; font-size: 12px; }
.history-row small { color: #72837c; font-size: 11px; }
.history-score { display: grid; justify-items: end; gap: 4px; }
.history-score strong { font-variant-numeric: tabular-nums; }
.presence-note { margin: 9px 0 0; }

.migration-route { display: block; color: var(--muted); font-weight: 650; margin-top: .3rem; }
.migration-intake { margin: .75rem 0; }
.migration-intake h4 { margin: 0 0 .5rem; }

.movement-buttons { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .45rem; }
.movement-buttons .btn { padding: .35rem .55rem; font-size: .75rem; }
.movement-buttons [aria-expanded="true"] { background: var(--sage, #e8f0e7); }
.movement-roster { max-height: 28rem; overflow: auto; }
.movement-roster table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.movement-roster th, .movement-roster td { padding: .55rem; text-align: left; border-bottom: 1px solid var(--line, #dde6df); }
.movement-roster small { display: block; color: var(--muted); }
.movement-note { color: var(--muted); font-size: .8rem; }
