:root {
  color-scheme: dark;
  --bg: #070b13;
  --surface: #101724;
  --surface-2: #151f30;
  --line: #26344a;
  --text: #edf4ff;
  --muted: #91a1b9;
  --blue: #4c8dff;
  --blue-2: #286ce5;
  --green: #52d6a0;
  --red: #ff737d;
  --amber: #f5bb62;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.general-column-sort { background: transparent; border: 0; color: inherit; font: inherit; padding: 4px 0; white-space: nowrap; cursor: pointer; }
.general-column-sort:hover { color: var(--blue); }
.general-column-sort:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); overflow-x: hidden; }
body:has(#terrainDesignerView:not(.hidden)) { overflow:hidden; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.terrain-editor { margin-top: 14px; padding: 16px; border: 1px solid rgba(88,230,255,.28); border-radius: 12px; background: rgba(9,25,31,.94); }
.terrain-editor .inline-form { align-items: end; }
.terrain-cell-override { stroke: #07161b; stroke-width: 1.5px; pointer-events: none; }
.terrain-grid-cell { fill-opacity: .76; stroke: rgba(6,18,22,.65); stroke-width: .6px; cursor: crosshair; }
.terrain-grid-cell:hover { fill-opacity: 1; stroke: #58e6ff; stroke-width: 1.8px; }
.terrain-grid-cell.authored { stroke: #ffd166; stroke-width: 1.6px; }
.terrain-grid-cell.blocked { stroke: #ef5548; }
.terrain-grid-cell.river-source { stroke: #58e6ff; stroke-width: 3px; }
.terrain-grid-cell.selected { stroke:#fff; stroke-width:3px; filter:drop-shadow(0 0 4px rgba(255,255,255,.8)); }
.terrain-designer-panel { min-width:0; }
.workspace:has(#terrainDesignerView:not(.hidden)) { height:100vh; overflow:hidden; display:flex; flex-direction:column; padding-bottom:24px; }
.workspace:has(#terrainDesignerView:not(.hidden)) > #adminViews { flex:1; min-height:0; }
#terrainDesignerView { height:100%; min-height:0; }
#terrainDesignerView > .terrain-designer-panel { display:flex; height:100%; min-height:0; flex-direction:column; }
.terrain-designer-panel > .panel-heading { display:flex; flex-wrap:wrap; gap:10px; }
.terrain-designer-panel > .panel-heading select { width:auto; max-width:100%; }
.terrain-generation { margin-top:14px; border-top:1px solid #45617e; padding-top:12px; }
.terrain-generation summary { cursor:pointer; font-weight:700; }
.terrain-generation > label { display:flex; align-items:center; gap:8px; margin:12px 0; }
.terrain-generation input[type=checkbox] { width:auto; }
.topbar-province { width:160px; max-width:100%; flex:0 0 auto; min-height:34px; padding:6px 11px; border:1px solid var(--line); border-radius:9px; background:var(--surface-2); }
.terrain-designer-province { min-width:min(300px,100%); color:var(--muted); font-size:12px; }
.terrain-designer-province select { margin-top:5px; }
.terrain-designer-map { position:relative; display:grid; flex:1; place-items:center; min-height:0; overflow:hidden; border:1px solid #29435a; border-radius:12px; background:#081723; }
.terrain-designer-map canvas { display:block; width:100%; height:auto; aspect-ratio:20 / 13; cursor:crosshair; touch-action:none; }
.terrain-designer-map.select-mode canvas { cursor:pointer; }
.terrain-designer-map canvas.panning { cursor:grabbing; }
.terrain-designer-map + .hint { margin:10px 2px 0; }
.terrain-designer-map > .map-navigation { position:absolute; z-index:3; top:14px; left:14px; max-width:calc(100% - 422px); margin:0; padding:8px; border:1px solid rgba(69,97,126,.9); border-radius:10px; background:rgba(7,17,29,.9); box-shadow:0 12px 30px rgba(0,0,0,.38); backdrop-filter:blur(8px); }
#terrainDesignerControls { position:absolute; z-index:2; top:14px; right:14px; width:min(380px,calc(100% - 28px)); max-height:calc(100% - 28px); overflow:auto; }
#terrainDesignerControls .terrain-editor { margin:0; padding:14px; box-shadow:0 18px 45px rgba(0,0,0,.5); backdrop-filter:blur(8px); }
.terrain-tool-handle { width:100%; min-height:28px; margin:-6px 0 10px; padding:4px 8px; border:1px dashed #45617e; background:#102236; color:#9fb3c9; cursor:move; font-size:11px; letter-spacing:.06em; text-transform:uppercase; touch-action:none; }
.terrain-tool-handle.dragging { cursor:grabbing; }
#terrainDesignerControls .panel-heading { display:grid; grid-template-columns:1fr auto; }
#terrainDesignerControls .panel-heading > .hint,#terrainDesignerControls .panel-heading > form { grid-column:1 / -1; }
#terrainDesignerControls .inline-form { grid-template-columns:repeat(2,minmax(120px,1fr)); }
#terrainDesignerControls .inline-form > .actions { grid-column:1 / -1; }
.tool-toggle { display:flex; }
.tool-toggle button { border-radius:0; }
.tool-toggle button:first-child { border-radius:9px 0 0 9px; }
.tool-toggle button:last-child { border-radius:0 9px 9px 0; }
.tool-toggle button.active { border-color:#6ea0f8; background:#234b82; color:#fff; }
.grid-props { color:#a9bad0; font:700 11px ui-monospace,SFMono-Regular,Consolas,monospace; }
.biome-key { grid-column:1 / -1; display:flex; flex-wrap:wrap; gap:6px; }
.biome-key-item { position:relative; min-height:26px; padding:4px 8px 4px 22px; border:1px solid #34465b; background:#101c29; color:#cbd7e6; font-size:11px; text-transform:capitalize; }
.biome-key-item::before { content:""; position:absolute; left:7px; top:50%; width:9px; height:9px; border-radius:50%; background:var(--biome-color); transform:translateY(-50%); }
.biome-key-item::after { content:attr(data-description); visibility:hidden; position:absolute; z-index:5; left:0; bottom:calc(100% + 7px); width:220px; padding:8px 10px; border:1px solid #45617e; border-radius:7px; background:#07111d; color:#e5edf7; box-shadow:0 8px 24px rgba(0,0,0,.55); opacity:0; pointer-events:none; text-align:left; text-transform:none; line-height:1.4; transition:opacity .12s; }
.biome-key-item:hover::after,.biome-key-item:focus-visible::after { visibility:visible; opacity:1; }
.biome-key-item.active { border-color:#7aa9ef; box-shadow:0 0 0 2px rgba(76,141,255,.2); color:#fff; }
.biome-procedural { --biome-color:#91a1b9; }
.biome-grassland { --biome-color:#738052; }.biome-forest { --biome-color:#31583a; }.biome-desert { --biome-color:#b99a62; }.biome-rock { --biome-color:#77736d; }.biome-snow { --biome-color:#d8e1df; }.biome-marsh { --biome-color:#536b59; }.biome-water { --biome-color:#39758b; }
.selected-hex { display:inline-flex; align-items:center; min-height:32px; padding:0 10px; border:1px solid #30588e; border-radius:999px; color:#8ebcff; background:#10294b; font:700 11px ui-monospace,SFMono-Regular,Consolas,monospace; }
#terrainDesignerCanvas { will-change:transform; }
.river-tool { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: end; margin: 4px 0; padding: 12px; border: 1px solid rgba(76,141,255,.35); border-radius: 10px; }
.river-tool .actions { grid-column:1 / -1; }
.river-tool legend { padding: 0 7px; color: #6ea0f8; font-size: 12px; font-weight: 800; letter-spacing: .08em; }
.ambient { position: fixed; border-radius: 50%; filter: blur(100px); opacity: .22; pointer-events: none; }
.ambient-one { width: 460px; height: 460px; background: #205fd3; top: -180px; left: -120px; }
.ambient-two { width: 380px; height: 380px; background: #164f75; bottom: -180px; right: -80px; }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 28px; position: relative; }
.login-card { width: min(440px, 100%); padding: 42px; border: 1px solid var(--line); border-radius: 22px; background: rgba(16,23,36,.94); box-shadow: 0 30px 80px rgba(0,0,0,.45); }
.brand-mark { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 14px; background: linear-gradient(145deg,var(--blue),#284d9c); font-family: Georgia,serif; font-size: 28px; font-weight: 700; box-shadow: 0 10px 28px rgba(49,116,244,.32); }
.brand-mark.small { width: 38px; height: 38px; border-radius: 11px; font-size: 22px; }
.eyebrow { color: #6ea0f8; letter-spacing: .14em; font-size: 11px; font-weight: 800; margin: 20px 0 8px; }
h1,h2,p { margin-top: 0; }
h1 { font-size: 32px; margin-bottom: 10px; }
h2 { font-size: 21px; margin-bottom: 0; }
.muted,.hint { color: var(--muted); line-height: 1.55; }
.hint { font-size: 12px; margin: 14px 0 0; }
.stack { display: grid; gap: 16px; margin-top: 28px; }
.stack.compact { margin-top: 20px; gap: 13px; }
label { display: grid; gap: 7px; color: #c4d0e1; font-size: 13px; font-weight: 650; }
input,select,textarea { width: 100%; min-height: 42px; border: 1px solid var(--line); border-radius: 9px; background: #0b111c; color: var(--text); padding: 9px 12px; outline: none; }
input:focus,select:focus,textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(76,141,255,.15); }
select { cursor:pointer; background-color:#0b111c; }
select:hover:not(:disabled) { border-color:#45658f; background-color:#0e1725; }
select:disabled { cursor:not-allowed; color:var(--muted); opacity:.62; }
select option { background:var(--surface); color:var(--text); }
select option:checked { background:#1d3e70; color:#fff; }
select option:disabled { color:var(--muted); }
@supports (appearance: base-select) {
  select,::picker(select) { appearance:base-select; }
  select { align-items:center; gap:10px; transition:border-color .15s ease,background-color .15s ease,box-shadow .15s ease; }
  select::picker-icon { margin-left:auto; color:#8eb5fb; transition:transform .16s ease; }
  select:open::picker-icon { transform:rotate(180deg); }
  ::picker(select) { max-height:min(360px,70vh); margin-top:6px; padding:6px; border:1px solid #344966; border-radius:11px; background:#0d1522; box-shadow:0 18px 45px rgba(0,0,0,.48); }
  option { min-height:40px; padding:9px 11px; border-radius:7px; background:transparent; color:#dce8f9; cursor:pointer; }
  option:hover,option:focus-visible { background:#172944; color:#fff; }
  option:checked { background:#1d3e70; color:#fff; font-weight:700; }
  option::checkmark { color:#8eb5fb; }
  option:disabled { cursor:not-allowed; color:#6f8099; }
}
button { border: 0; border-radius: 9px; min-height: 40px; padding: 9px 15px; color: white; font-weight: 700; }
button:disabled { cursor:not-allowed; opacity:.5; }
.primary { background: linear-gradient(180deg,var(--blue),var(--blue-2)); box-shadow: 0 8px 20px rgba(41,107,222,.22); }
.primary:hover { filter: brightness(1.08); }
.secondary { background: var(--surface-2); border: 1px solid var(--line); color: #dce8f9; }
.small-button { min-height: 34px; padding: 6px 12px; }
.text-button { background: transparent; color: #8eb5fb; padding: 0; min-height: 30px; text-align: left; }
.danger-button,.edit-button { min-height: 30px; padding: 5px 9px; background: transparent; border: 1px solid #34445d; color: #a9b9cf; font-size: 12px; }
.danger-button { border-color: #61333b; color: #ff939b; }
.status { min-height: 20px; margin: 14px 0 0; color: #ff9299; font-size: 13px; }
.status.success { color: var(--green); }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 238px 1fr; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 238px; display: flex; flex-direction: column; padding: 24px 18px; background: rgba(10,15,25,.97); border-right: 1px solid #1d293a; z-index: 2; }
.logo-row { display: flex; align-items: center; gap: 12px; padding: 0 8px 28px; }
.logo-row strong,.logo-row span { display: block; }
.logo-row span { color: var(--muted); font-size: 12px; margin-top: 2px; }
nav { display: grid; gap: 6px; }
.nav-item { text-align: left; background: transparent; color: #8f9db2; font-weight: 650; }
.nav-item:hover,.nav-item.active { background: #152137; color: #eff5ff; }
.nav-item.active { box-shadow: inset 3px 0 var(--blue); }
.nav-with-count { display:flex; align-items:center; justify-content:space-between; }
.nav-count { min-width:24px; padding:2px 7px; border-radius:999px; background:#1e3150; color:#a9c8ff; text-align:center; font-size:11px; }
.nav-group-label { padding:18px 12px 4px; color:#5f718a; font-size:10px; font-weight:850; letter-spacing:.12em; text-transform:uppercase; }
.nav-subitem { padding-left:24px; min-height:36px; font-size:13px; }
.sidebar-foot { margin-top: auto; display: grid; padding: 16px 10px 0; border-top: 1px solid var(--line); color: #d5dfec; font-size: 13px; }
.workspace { grid-column: 2; min-width: 0; padding: 34px 42px 50px; position: relative; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.topbar .eyebrow { margin-top: 0; }
.topbar h1 { margin-bottom: 0; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.build-badge { color: var(--muted); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11px; white-space: nowrap; }
.environment,.pill { display: inline-flex; align-items: center; border-radius: 999px; padding: 6px 10px; border: 1px solid #30588e; background: #10294b; color: #8ebcff; font-size: 11px; font-weight: 850; letter-spacing: .08em; }
.environment.uat { border-color: #815f25; background: #352810; color: var(--amber); }
.global { margin: -10px 0 18px; }
.metrics { display: grid; grid-template-columns: repeat(5,minmax(130px,1fr)); gap: 16px; }
.metric,.panel { border: 1px solid var(--line); background: rgba(16,23,36,.9); border-radius: 15px; }
.metric { padding: 20px; }
.metric span,.metric small { display: block; color: var(--muted); }
.metric span { font-size: 12px; font-weight: 750; text-transform: uppercase; letter-spacing: .08em; }
.metric strong { display: block; font-size: 34px; margin: 12px 0 5px; }
.metric small { font-size: 12px; }
.panel { padding: 22px; }
.welcome-panel { margin-top: 18px; min-height: 190px; display: flex; align-items: center; justify-content: space-between; gap: 32px; overflow: hidden; position: relative; }
.welcome-panel:after { content:""; position:absolute; width:300px; height:300px; border-radius:50%; background:#1d5dc4; filter:blur(75px); opacity:.16; right:-80px; }
.welcome-panel > * { position: relative; z-index: 1; }
.welcome-panel .primary { flex: 0 0 auto; }
.split-grid { display: grid; grid-template-columns: minmax(280px,360px) minmax(0,1fr); gap: 18px; align-items: start; }
.panel-heading { display: flex; align-items: start; justify-content: space-between; gap: 15px; margin-bottom: 18px; }
.panel-heading .eyebrow { margin-top: 0; }
.table-panel { min-width: 0; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { color: #718299; text-align: left; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; padding: 10px; border-bottom: 1px solid var(--line); }
td { padding: 12px 10px; border-bottom: 1px solid #1c293a; color: #cbd6e5; vertical-align: middle; }
td strong,td small { display:block; }
td small { color: #74859c; margin-top: 3px; }
.tag { display:inline-block; padding:4px 7px; border-radius:6px; background:#182a44; color:#8db8ff; font-size:10px; font-weight:800; text-transform:uppercase; }
.tag.seed { background:#143529; color:#72deb1; }
.tag.admin { background:#3a2a13; color:#f5c26d; }
.avatar-portrait { width:40px; height:40px; display:block; border:1px solid #31588e; border-radius:50%; background-image:url("avatar_sheet.png"); background-repeat:no-repeat; background-size:240px 160px; box-shadow:0 3px 12px rgba(0,0,0,.35); }
.actions { display:flex; gap:6px; justify-content:flex-end; }
.empty-row { text-align:center; color:var(--muted); padding:28px 10px; }
.region-grid { display:grid; grid-template-columns:minmax(360px,.85fr) minmax(500px,1.15fr); gap:18px; align-items:start; }
.province-map-panel { padding:26px; }
.subcity-map-label { fill:#b8d7ff; font-size:11px; font-weight:700; paint-order:stroke; stroke:#08111d; stroke-width:3px; stroke-linejoin:round; pointer-events:none; }
.province-toolbar { display:flex; align-items:end; justify-content:space-between; gap:18px; margin-bottom:18px; }
.active-province { display:inline-flex; align-items:center; gap:7px; color:var(--muted); font-size:12px; }
.active-province strong { color:var(--text); font-size:14px; }
.form-context { align-self:end; min-height:42px; padding:10px 0; }
.province-selector { width:min(460px,100%); font-size:14px; }
.province-selector select { min-height:48px; font-size:15px; }
.province-import-replace { margin-top:-6px; }
.province-map { min-height:clamp(360px,32vw,500px); display:grid; place-items:center; position:relative; overflow:hidden; border:1px solid #21334b; border-radius:12px; background:radial-gradient(circle at 50% 42%,#12283a,#08111d 72%); }
.province-map svg { width:100%; height:clamp(360px,32vw,500px); }
.details-modal { width:min(920px,calc(100vw - 32px)); max-height:calc(100vh - 32px); padding:0; border:0; border-radius:16px; background:transparent; color:var(--text); overflow:auto; box-shadow:0 30px 90px rgba(0,0,0,.65); }
.details-modal::backdrop { background:rgba(2,6,12,.78); backdrop-filter:blur(4px); }
.details-modal .province-details { margin:0; }
.province-shape { fill:#163c4c; stroke:none; fill-rule:evenodd; }
.province-context-backdrop { fill:#081723; pointer-events:none; }
.province-context-grid-line { fill:none; stroke:#477188; stroke-width:.55; }
.province-outline { fill:none; stroke:#e5bd68; stroke-width:2.4; vector-effect:non-scaling-stroke; pointer-events:none; }
.city-area-shape { stroke:#78d9f2; stroke-width:1.1; opacity:.72; vector-effect:non-scaling-stroke; fill-rule:evenodd; pointer-events:all; cursor:pointer; }
.city-area-shape.selected { stroke:#ffd166; stroke-width:3; opacity:1; filter:drop-shadow(0 0 5px #ffd166); }
.area-color-0 { fill:#205f70; }.area-color-1 { fill:#315d86; }.area-color-2 { fill:#4b557d; }.area-color-3 { fill:#265f58; }
.area-color-4 { fill:#65536e; }.area-color-5 { fill:#536843; }.area-color-6 { fill:#73544a; }.area-color-7 { fill:#3c6178; }
.city-area-label { fill:#eaf7fb; font-size:10px; font-weight:700; text-anchor:middle; dominant-baseline:middle; paint-order:stroke; stroke:#071018; stroke-width:3px; stroke-linejoin:round; pointer-events:none; }
.map-city { fill:#f4f7fb; stroke:#071018; stroke-width:1.5; vector-effect:non-scaling-stroke; }
.map-city.spawn { fill:#56d69e; }
.map-subcity { fill:#78b7ff; stroke:#071018; stroke-width:1; vector-effect:non-scaling-stroke; }
.legend-subcity { background:#78b7ff; }
.city-area-map { min-height:clamp(320px,28vw,440px); margin:2px 0 0; }
.city-area-map svg { height:clamp(320px,28vw,440px); }
.province-map .map-city { cursor:grab; stroke:#071018; stroke-width:2.5; filter:drop-shadow(0 2px 3px rgba(0,0,0,.65)); touch-action:none; }
.province-map .map-city:hover,.province-map .map-city.dragging { stroke:#fff2bf; stroke-width:3.5; }
.province-map .map-city.dragging { cursor:grabbing; }
.map-layer-hidden { display:none; }
.map-navigation { display:flex; flex-wrap:wrap; align-items:center; gap:10px; margin-bottom:12px; }
.map-navigation output { min-width:48px; text-align:center; font-size:13px; }
.map-navigation label { display:flex; align-items:center; gap:7px; }
.map-navigation input { width:auto; min-height:auto; }
.map-navigation .hint { margin:0; }
#provinceMapSvg { touch-action:none; cursor:grab; }
#provinceMapSvg.panning { cursor:grabbing; }
#provinceMapSvg.hide-map-names .city-map-label,#provinceMapSvg.hide-map-names .city-area-label { display:none; }
.city-area-map .map-subcity { cursor:grab; touch-action:none; stroke-width:2; }
.city-area-map .map-subcity:hover,.city-area-map .map-subcity.dragging { stroke:#fff2bf; stroke-width:3; }
.city-area-map .map-subcity.dragging { cursor:grabbing; }
.city-map-label { fill:#fff; font-size:11px; font-weight:800; text-anchor:middle; paint-order:stroke; stroke:#071018; stroke-width:3px; stroke-linejoin:round; pointer-events:none; }
.city-area-map-footer,.map-footer { display:flex; align-items:start; justify-content:space-between; gap:20px; margin-bottom:18px; }
.city-area-map-footer .map-legend { margin-top:12px; }
.city-area-map-footer .hint,.map-footer .hint { margin-top:10px; text-align:right; }
.map-terrain { stroke:#071018; stroke-width:1.5; vector-effect:non-scaling-stroke; }
.map-terrain.mountain { fill:#b5c1cf; }.map-terrain.volcano { fill:#ff765f; }.map-terrain.river { fill:#4ea9ff; }
.map-empty { position:absolute; color:var(--muted); max-width:260px; text-align:center; line-height:1.5; }
.map-legend { display:flex; flex-wrap:wrap; gap:16px; margin-top:13px; color:var(--muted); font-size:12px; }
.map-legend button { display:flex; align-items:center; gap:6px; min-height:28px; padding:3px 5px; border-radius:6px; background:transparent; color:var(--muted); font-size:12px; font-weight:650; }
.map-legend button:hover { color:var(--text); background:#172236; }
.map-legend button[aria-pressed="false"] { opacity:.42; text-decoration:line-through; }
.map-legend i { width:11px; height:11px; border-radius:3px; display:inline-block; }
.legend-province { background:#163c4c; border:1px solid #e5bd68; }.legend-area { background:#315d86; border:1px solid #49c9ee; }.legend-city { background:#f4f7fb; border-radius:50%!important; }.legend-terrain { background:#ff765f; transform:rotate(45deg); }
.inline-form { display:grid; grid-template-columns:100px minmax(150px,1fr) auto; gap:10px; align-items:end; padding:14px; margin-bottom:16px; border-radius:11px; background:#0b111c; border:1px solid #1d2a3b; }
.inline-form.city-form { grid-template-columns:minmax(130px,1fr) 100px minmax(140px,1fr) auto; }
.inline-form.province-form { grid-template-columns:repeat(3,minmax(120px,1fr)); }
.inline-form.terrain-form { grid-template-columns:minmax(140px,1fr) 130px minmax(180px,1fr) 130px 130px auto; }
.inline-form .wide-field { grid-column:1 / -1; }
.inline-form .check-label { display:flex; align-items:center; gap:8px; }
.inline-form .check-label input { width:auto; min-height:auto; }
.import-replace { display:flex; align-items:center; gap:8px; margin:-5px 0 15px; color:var(--muted); font-size:12px; }
.import-replace input { width:auto; min-height:auto; }
.source-tools { display:grid; gap:8px; margin:0 0 16px; padding:12px; border:1px solid var(--line); border-radius:10px; background:#0b111c; }
.source-tools > div:first-child { display:flex; justify-content:space-between; gap:12px; }
.source-tools a { color:#7fb0ff; }
.source-tools .check-label { display:flex; align-items:center; gap:8px; }
.source-tools .check-label input { width:auto; min-height:auto; }
.inline-form input,.inline-form select { min-height:38px; }
.region-table { max-height:500px; }
.city-hierarchy { min-width:190px; }
.city-hierarchy > div + div { margin-top:9px; padding-top:9px; border-top:1px solid #26344a; }
.city-hierarchy strong { color:#edf4ff; }
.city-hierarchy small { line-height:1.45; }
.filter-label { max-width:220px; margin: 0 0 12px auto; }
.section-toolbar { display:grid; grid-template-columns:minmax(180px,260px) minmax(360px,1fr); gap:16px; align-items:start; margin-bottom:16px; }
.city-area-selector-toolbar { grid-template-columns:repeat(2,minmax(180px,320px)); align-items:end; }
.section-toolbar .source-tools { margin:0; }
.terrain-hint { margin:-5px 0 14px; }
@media (max-width: 1050px) {
  .metrics { grid-template-columns:repeat(2,1fr); }
  .split-grid,.region-grid { grid-template-columns:1fr; }
  .inline-form.terrain-form { grid-template-columns:repeat(2,1fr); }
	.terrain-designer-map > .map-navigation { max-width:calc(100% - 28px); }
	#terrainDesignerControls { top:96px; }
	.river-tool { grid-template-columns:repeat(2,1fr); }
	.river-tool .actions { grid-column:1 / -1; }
}
@media (max-width: 720px) {
  .app-shell { display:block; }
  .sidebar { position:static; width:auto; min-height:auto; }
  nav { grid-template-columns:repeat(2,1fr); }
  .nav-group-label { grid-column:1 / -1; }
  .sidebar-foot { display:none; }
  .workspace { padding:24px 16px 40px; }
  .topbar { align-items:flex-start; flex-direction:column; }
  .metrics { grid-template-columns:1fr 1fr; }
  .city-area-map-footer,.map-footer { flex-direction:column; gap:0; }
  .city-area-map-footer .hint,.map-footer .hint { text-align:left; }
  .inline-form,.inline-form.city-form,.inline-form.terrain-form,.section-toolbar { grid-template-columns:1fr; }
	.river-tool { grid-template-columns:1fr; }
  .province-map-panel { padding:18px; }
  .province-toolbar { align-items:stretch; flex-direction:column; }
  .province-map,.province-map svg { min-height:380px; height:380px; }
  .welcome-panel { align-items:flex-start; flex-direction:column; }
}
.city-area-selector-toolbar label:first-child { display: none; }
#newProvinceButton { display: none; }

/* The Province page contains two independent editing maps. Keep them visible
   together so the broad province and detailed city-area coordinates can be
   compared while dragging. */
@media (min-width: 1100px) {
  .workspace:has(#provincesView:not(.hidden)) > #adminViews {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
    gap: 18px;
  }
  .workspace:has(#provincesView:not(.hidden)) > #adminViews > #provincesView,
  .workspace:has(#provincesView:not(.hidden)) > #adminViews > #cityAreasView:not(.hidden) {
    display: block !important;
    min-width: 0;
  }
}
.general-biography { white-space: pre-wrap; overflow-wrap: anywhere; }
.general-identity { min-width: 10rem; }
.general-portrait { display:inline-flex; position:relative; width:48px; height:48px; flex-shrink:0; align-items:center; justify-content:center; vertical-align:middle; margin-right:10px; overflow:hidden; border-radius:8px; background:#21334b; color:var(--text); font-size:24px; }
.general-portrait img { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; }
.general-details { padding:24px; background:#101c2b; width:min(640px,calc(100vw - 32px)); }
.general-details .general-portrait { width:112px; height:112px; font-size:48px; }
.general-biography-source { color:var(--muted); overflow-wrap:anywhere; }


.general-model-preview canvas { display:block; width:100%; height:300px; border-radius:8px; touch-action:none; }

.editor-modal { padding:24px; background:#101c2b; }
.editor-modal .inline-form { margin:0; }
.editor-modal #recruitmentName, .editor-modal #recruitmentStatus { grid-column:1 / -1; }


#provinceMapSvg .map-city, #cityAreaMapSvg .map-city { cursor:move; touch-action:none; }

.map-member-shape { fill:#194554; stroke:#72a8b8; stroke-width:1.2; fill-rule:evenodd; cursor:pointer; }
.map-member-shape:hover,.map-member-shape:focus,.map-member-shape.selected { fill:#267088; stroke:#ffd166; stroke-width:2.5; outline:none; }
.geographic-reference #provinceDetailsButton,.geographic-reference #newProvinceButton,.geographic-reference #importProvincesButton,.geographic-reference #exportProvincesButton,.geographic-reference .province-import-replace,.geographic-reference .province-toolbar,.geographic-reference #provinceMapDragStatus,.geographic-reference #cityAreaDragStatus,.geographic-reference #cityAreaDetailsButton,.geographic-reference .active-province { display:none; }
@media (min-width:1400px) {
  .workspace:has(#mapOverviewView:not(.hidden)) > #adminViews { grid-template-columns:repeat(3,minmax(0,1fr)); }
}
@media (max-width:1399px) {
  .workspace:has(#mapOverviewView:not(.hidden)) > #adminViews { display:grid; grid-template-columns:minmax(0,1fr); }
}

.geographic-reference [data-layer="cities"],.geographic-reference [data-layer="terrain"],.geographic-reference .map-navigation label { display:none; }

.province-map .geographic-city { pointer-events:none; cursor:default; }

#mapOverviewSvg .geographic-city { stroke-width:0.75; filter:none; }

#mapOverviewSvg { touch-action:none; cursor:grab; }
#mapOverviewSvg.panning,#mapOverviewSvg.panning * { cursor:grabbing; }
