/* TerritoryFit admin UI asset v2. */
:root {
    color-scheme: dark;
    --bg: #0a0d12;
    --panel: #111720;
    --panel-2: #171f2b;
    --text: #edf3f9;
    --muted: #94a3b8;
    --line: #283548;
    --accent: #70e1a1;
    --accent-ink: #052313;
    --danger: #ff7a8a;
    --warning: #ffd166;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: radial-gradient(circle at 85% -20%, #17372e 0, transparent 35rem), var(--bg); color: var(--text); min-height: 100vh; }
a { color: var(--accent); }
button, .button, input, select, textarea { font: inherit; }
button, .button { border: 1px solid var(--line); border-radius: .55rem; background: var(--panel-2); color: var(--text); padding: .65rem .9rem; cursor: pointer; text-decoration: none; display: inline-flex; justify-content: center; }
button:hover, .button:hover { border-color: var(--accent); }
.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 750; }
.topbar { position: sticky; top: 0; z-index: 2; height: 4rem; display: flex; align-items: center; justify-content: space-between; padding: 0 1.25rem; background: rgba(10,13,18,.92); border-bottom: 1px solid var(--line); backdrop-filter: blur(14px); }
.brand { color: var(--text); font-weight: 850; text-decoration: none; letter-spacing: -.03em; }
.brand span { color: var(--accent); }
.identity { display: flex; gap: 1rem; align-items: center; color: var(--muted); font-size: .9rem; }
.identity form { margin: 0; }
.link-button { border: 0; padding: 0; background: none; color: var(--accent); }
.shell { display: grid; grid-template-columns: 15rem minmax(0, 1fr); min-height: calc(100vh - 4rem); }
.sidebar { padding: 1.25rem .8rem; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: .25rem; }
.sidebar a { color: var(--muted); text-decoration: none; padding: .7rem .8rem; border-radius: .55rem; }
.sidebar a:hover, .sidebar a[aria-current="page"] { color: var(--text); background: var(--panel-2); }
.sidebar a[aria-current="page"] { box-shadow: inset 3px 0 var(--accent); }
.content { min-width: 0; padding: clamp(1rem, 3vw, 2.5rem); max-width: 112rem; width: 100%; }
.page-header { margin-bottom: 1.5rem; max-width: 70rem; }
.page-header h1, .auth-card h1 { font-size: clamp(1.9rem, 4vw, 3.25rem); letter-spacing: -.05em; margin: .2rem 0 .6rem; }
.page-header p, .auth-card > p { color: var(--muted); line-height: 1.6; }
.eyebrow { color: var(--accent) !important; text-transform: uppercase; font-size: .75rem; font-weight: 800; letter-spacing: .12em; }
.panel { background: linear-gradient(145deg, rgba(23,31,43,.94), rgba(15,21,30,.94)); border: 1px solid var(--line); border-radius: .85rem; margin: 0 0 1.15rem; box-shadow: 0 16px 50px rgba(0,0,0,.18); }
.panel-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding: 1rem 1.15rem; border-bottom: 1px solid var(--line); }
.panel-heading h2 { margin: 0; font-size: 1rem; }
.panel-heading span, .empty { color: var(--muted); font-size: .82rem; }
.empty { padding: 1.25rem; }
.table-scroll { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: .84rem; }
th, td { text-align: left; padding: .72rem 1rem; border-bottom: 1px solid rgba(40,53,72,.65); vertical-align: top; max-width: 28rem; overflow-wrap: anywhere; }
th { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; }
tbody tr:hover { background: rgba(112,225,161,.035); }
.action-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(28rem, 100%), 1fr)); gap: 1rem; margin-bottom: 1rem; }
.action-panel { padding: .95rem 1rem; }
.action-panel summary { cursor: pointer; font-weight: 750; color: var(--accent); }
.action-panel[open] summary { margin-bottom: 1rem; }
.action-panel.critical { border-color: rgba(255,122,138,.5); }
.action-panel.critical summary { color: var(--danger); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem; }
.form-grid label, .auth-card label { display: flex; flex-direction: column; gap: .38rem; color: var(--muted); font-size: .8rem; }
.form-grid .span-2 { grid-column: 1 / -1; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: .5rem; background: #0b1017; color: var(--text); padding: .65rem .7rem; }
textarea { resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(112,225,161,.35); border-color: var(--accent); }
.notice, .error, .warning { padding: .85rem 1rem; margin: 0 0 1rem; border-radius: .65rem; border: 1px solid; }
.notice { color: var(--accent); border-color: rgba(112,225,161,.45); background: rgba(112,225,161,.08); }
.error { color: #ffc4cb; border-color: rgba(255,122,138,.5); background: rgba(255,122,138,.09); }
.warning { color: var(--warning) !important; border-color: rgba(255,209,102,.5); background: rgba(255,209,102,.08); }
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 1.25rem; }
.auth-card { width: min(28rem, 100%); padding: 2rem; background: rgba(17,23,32,.96); border: 1px solid var(--line); border-radius: 1rem; box-shadow: 0 30px 100px rgba(0,0,0,.45); }
.auth-card.wide { width: min(44rem, 100%); }
.auth-card form { display: grid; gap: 1rem; }
.auth-mark { width: 3rem; height: 3rem; border-radius: .8rem; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-weight: 900; }
.secret-block { display: grid; grid-template-columns: 8rem 1fr; gap: .6rem 1rem; background: #0b1017; padding: 1rem; border-radius: .7rem; }
.secret-block dt { color: var(--muted); }.secret-block dd { margin: 0; }.breakable { overflow-wrap: anywhere; }
.recovery-codes { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem 2rem; padding-left: 2rem; }
.error-page { max-width: 48rem; }
code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
details > details { margin-top: 1rem; }
.map-workspace { overflow: hidden; }
.map-heading { align-items: flex-start; }
.map-heading > div { max-width: 64rem; }
.map-heading p { margin: .45rem 0 0; color: var(--muted); font-size: .85rem; line-height: 1.5; }
.map-search { display: grid; grid-template-columns: minmax(16rem, 1fr) 10rem auto; align-items: end; gap: .8rem; padding: 1rem 1.15rem; border-bottom: 1px solid var(--line); }
.map-search label { display: flex; flex-direction: column; gap: .38rem; color: var(--muted); font-size: .8rem; }
.map-search > p { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: .76rem; }
.map-summary { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.map-summary > div { display: flex; flex-direction: column; gap: .2rem; padding: .9rem 1.1rem; border-right: 1px solid var(--line); }
.map-summary > div:last-child { border-right: 0; }
.map-summary strong { color: var(--accent); font-size: 1.25rem; }
.map-summary span { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; }
.map-status { margin: .8rem 1.15rem; }
.map-status.notice, .map-status.error { margin: .8rem 1.15rem; }
.map-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(19rem, .8fr); min-height: 36rem; border-top: 1px solid var(--line); }
.admin-map { min-height: 36rem; background: #0b1017; }
.map-inspector { max-height: 42rem; overflow: auto; padding: 1rem; border-left: 1px solid var(--line); background: rgba(10, 15, 22, .72); }
.map-inspector h3 { margin: 0 0 .4rem; }
.map-inspector > p { color: var(--muted); font-size: .82rem; line-height: 1.45; }
.map-inspector h4 { margin: 1.25rem 0 .6rem; color: var(--accent); font-size: .86rem; }
.map-detail-card { padding: .75rem; margin: 0 0 .65rem; border: 1px solid var(--line); border-radius: .65rem; background: #0b1017; }
.map-detail-card h5 { margin: 0 0 .65rem; overflow-wrap: anywhere; }
.map-detail-card dl { display: grid; grid-template-columns: minmax(7rem, .7fr) minmax(0, 1fr); gap: .35rem .65rem; margin: 0; font-size: .76rem; }
.map-detail-card dt { color: var(--muted); }
.map-detail-card dd { margin: 0; overflow-wrap: anywhere; }
.map-legend { display: flex; flex-wrap: wrap; gap: .8rem 1.15rem; padding: .85rem 1.15rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .76rem; }
.map-legend span { display: inline-flex; align-items: center; gap: .4rem; }
.legend-swatch { width: .8rem; height: .8rem; border-radius: .18rem; border: 1px solid rgba(255,255,255,.65); }
.legend-swatch.user { background: #42d392; }
.legend-swatch.team { background: #7787ff; }
.legend-swatch.neutral { background: #8795a8; }
.legend-swatch.ruins { background: #ff6b6b; }
.legend-swatch.safety { background: rgba(255,180,84,.65); border-style: dashed; }
.maplibregl-ctrl-attrib { color: #1a2330; }
.maplibregl-ctrl-attrib a { color: #174e37; }
@media (max-width: 760px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar { position: static; border-right: 0; border-bottom: 1px solid var(--line); flex-direction: row; overflow-x: auto; }
    .sidebar a { white-space: nowrap; }
    .form-grid { grid-template-columns: 1fr; }
    .form-grid .span-2 { grid-column: auto; }
    .identity > span { display: none; }
    .recovery-codes { grid-template-columns: 1fr; }
    .map-search { grid-template-columns: 1fr; }
    .map-search > p { grid-column: auto; }
    .map-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .map-summary > div { border-bottom: 1px solid var(--line); }
    .map-layout { grid-template-columns: 1fr; }
    .admin-map { min-height: 28rem; }
    .map-inspector { max-height: none; border-left: 0; border-top: 1px solid var(--line); }
}
