:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-size: 15px;
  color: #1f2937;
  background: #f4f6f8;
  --sidebar: #171b23;
  --sidebar-hover: #252b36;
  --sidebar-text: #c6ccd5;
  --sidebar-muted: #788291;
  --surface: #ffffff;
  --surface-subtle: #f7f8fa;
  --page: #f4f6f8;
  --border: #dfe3e8;
  --border-strong: #c7cdd5;
  --text: #1f2937;
  --muted: #667085;
  --blue: #2563eb;
  --blue-soft: #e8f0ff;
  --green: #16803c;
  --green-soft: #e8f6ed;
  --yellow: #9a6700;
  --yellow-soft: #fff6d8;
  --red: #c43232;
  --red-soft: #fdecec;
  --shadow: 0 1px 2px rgb(16 24 40 / 5%);
  --sidebar-width: 248px;
  --topbar-height: 60px;
}

* { box-sizing: border-box; }
[x-cloak] { display: none !important; }
html, body { min-height: 100%; }
body { margin: 0; color: var(--text); background: var(--page); }
button, input, select { font: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled, input:disabled { cursor: not-allowed; opacity: .62; }
a { color: var(--blue); }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: .4rem; font-size: clamp(1.8rem, 4vw, 2.45rem); line-height: 1.15; letter-spacing: -.025em; }
h2 { margin-bottom: 1rem; font-size: 1.15rem; }
h3 { margin-bottom: .45rem; font-size: 1rem; }
small { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.app-shell { min-height: 100vh; }
.topbar {
  position: fixed;
  z-index: 1000;
  inset: 0 0 auto 0;
  height: var(--topbar-height);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  padding: 0 1.1rem;
  border-bottom: 1px solid var(--border);
  background: rgb(255 255 255 / 96%);
  backdrop-filter: blur(12px);
}
.icon-button {
  width: 2.35rem;
  height: 2.35rem;
  display: inline-grid;
  place-items: center;
  padding: 0;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: .45rem;
  background: transparent;
}
.icon-button:hover { color: var(--text); background: var(--surface-subtle); border-color: var(--border); }
.sidebar-toggle { align-content: center; gap: 3px; }
.sidebar-toggle span { width: 17px; height: 2px; display: block; border-radius: 2px; background: currentColor; }
.breadcrumbs { min-width: 0; display: flex; align-items: center; gap: .45rem; overflow: hidden; color: var(--muted); font-size: .9rem; white-space: nowrap; }
.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--blue); }
.breadcrumbs strong { overflow: hidden; color: var(--text); text-overflow: ellipsis; }
.breadcrumb-separator { color: #b4bbc5; }
.topbar-actions { display: flex; align-items: center; gap: .55rem; }
.global-search {
  width: min(24vw, 260px);
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: 0 .65rem;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: .45rem;
  background: var(--surface-subtle);
}
.global-search input { width: 100%; padding: .55rem 0; border: 0; outline: 0; color: var(--text); background: transparent; }
.topbar-button, .user-menu-button {
  min-height: 2.35rem;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .45rem .7rem;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: .45rem;
  background: var(--surface);
  font-weight: 600;
}
.topbar-button:hover, .user-menu-button:hover { background: var(--surface-subtle); border-color: var(--border-strong); }
.avatar { width: 1.65rem; height: 1.65rem; display: inline-grid; place-items: center; border-radius: 50%; color: #fff; background: #344054; font-size: .75rem; }
.menu-wrapper { position: relative; }
.dropdown-menu {
  position: absolute;
  z-index: 1100;
  top: calc(100% + .45rem);
  left: 0;
  width: 190px;
  padding: .4rem;
  border: 1px solid var(--border);
  border-radius: .55rem;
  background: var(--surface);
  box-shadow: 0 12px 30px rgb(16 24 40 / 14%);
}
.dropdown-menu-right { right: 0; left: auto; }
.dropdown-menu a, .dropdown-menu span { display: block; padding: .6rem .7rem; border-radius: .35rem; color: var(--text); text-decoration: none; font-size: .88rem; }
.dropdown-menu a:hover { background: var(--surface-subtle); }
.dropdown-menu span { color: var(--muted); font-size: .78rem; }
.dropdown-form { display: block; }
.dropdown-form button { width: 100%; justify-content: flex-start; padding: .6rem .7rem; color: var(--text); border: 0; background: transparent; font-size: .88rem; }
.dropdown-form button:hover { color: var(--text); border: 0; background: var(--surface-subtle); }

.sidebar {
  position: fixed;
  z-index: 900;
  inset: var(--topbar-height) auto 0 0;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  color: var(--sidebar-text);
  background: var(--sidebar);
  transform: translateX(-100%);
  transition: transform .18s ease;
}
.sidebar-is-open .sidebar { transform: translateX(0); }
.sidebar-brand { display: flex; align-items: center; gap: .65rem; padding: 1.2rem 1.25rem .65rem; color: #fff; text-decoration: none; font-weight: 700; letter-spacing: -.01em; }
.brand-mark { width: 1.75rem; height: 1.75rem; display: grid; place-items: center; border-radius: .35rem; color: #fff; background: var(--blue); font-size: .8rem; }
.sidebar-nav { padding: .35rem .75rem 1.2rem; }
.sidebar-nav p { margin: 1.2rem .65rem .4rem; color: var(--sidebar-muted); font-size: .68rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.sidebar-nav a { display: flex; align-items: center; gap: .72rem; padding: .62rem .7rem; border-radius: .4rem; color: var(--sidebar-text); text-decoration: none; font-size: .9rem; }
.sidebar-nav a > span { width: 1rem; color: #8e98a7; text-align: center; }
.sidebar-nav a:hover { color: #fff; background: var(--sidebar-hover); }
.sidebar-nav a.active { color: #fff; background: #2a3446; box-shadow: inset 3px 0 var(--blue); }
.sidebar-nav a.active > span { color: #88afff; }
.sidebar-footer { margin-top: auto; display: grid; gap: .75rem; padding: 1rem 1.2rem; border-top: 1px solid #2a303b; color: var(--sidebar-muted); font-size: .72rem; }
.theme-picker { display: grid; gap: .35rem; text-transform: uppercase; letter-spacing: .06em; }
.theme-picker select { width: 100%; padding: .48rem .55rem; color: var(--sidebar-text); border: 1px solid #343c49; border-radius: .4rem; background: #11151c; text-transform: none; letter-spacing: 0; }
.sidebar-backdrop { display: none; }

.main-content {
  min-height: 100vh;
  padding: calc(var(--topbar-height) + 2rem) clamp(1rem, 3vw, 2.5rem) 3rem;
  transition: margin-left .18s ease;
}
.sidebar-is-open .main-content { margin-left: var(--sidebar-width); }
.page-container { width: min(1240px, 100%); margin: 0 auto; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 1.5rem; margin-bottom: 1.5rem; }
.page-header p { max-width: 720px; margin-bottom: 0; color: var(--muted); }
.page-actions { display: flex; gap: .6rem; flex-wrap: wrap; }
.eyebrow { margin-bottom: .45rem; color: var(--blue); font-size: .7rem; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.section-heading p { margin-bottom: 0; color: var(--muted); }

.panel, .card, .city-card, .empty-state {
  padding: 1.2rem;
  border: 1px solid var(--border);
  border-radius: .65rem;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.metric-card { padding: 1.1rem; border: 1px solid var(--border); border-radius: .6rem; background: var(--surface); box-shadow: var(--shadow); }
.metric-card span { display: block; color: var(--muted); font-size: .78rem; font-weight: 600; }
.metric-card strong { display: block; margin-top: .4rem; color: var(--text); font-size: 1.65rem; line-height: 1; letter-spacing: -.025em; }
.dashboard-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, .85fr); gap: 1.2rem; align-items: start; }
.stack { display: grid; gap: 1.2rem; }
.priority-groups { display: grid; gap: 1rem; }
.priority-group { padding: 1rem; border: 1px solid var(--border); border-radius: .55rem; background: var(--surface-subtle); }
.priority-group h3 { display: flex; justify-content: space-between; }
.priority-group ol { margin: .75rem 0 0; padding-left: 1.45rem; }
.priority-group li { padding: .3rem 0; color: #344054; }
.status-list { display: grid; gap: .55rem; margin: 0; padding: 0; list-style: none; }
.status-item { display: flex; gap: .6rem; align-items: flex-start; padding: .65rem 0; border-top: 1px solid var(--border); }
.status-item:first-child { border-top: 0; }
.status-dot { width: .55rem; height: .55rem; flex: none; margin-top: .35rem; border-radius: 50%; background: var(--muted); }
.status-dot.warning { background: #e6a700; }
.status-dot.success { background: var(--green); }
.placeholder-copy { color: var(--muted); }

button, .button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  min-height: 2.45rem;
  padding: .58rem .9rem;
  color: #fff;
  border: 1px solid var(--blue);
  border-radius: .45rem;
  background: var(--blue);
  font-weight: 650;
  text-decoration: none;
}
button:hover, .button-link:hover { background: #1d4ed8; border-color: #1d4ed8; }
button.secondary, .secondary-link { color: var(--text); border-color: var(--border); background: var(--surface); }
button.secondary:hover, .secondary-link:hover { border-color: var(--border-strong); background: var(--surface-subtle); }
button.danger { color: var(--red); border-color: #efb4b4; background: var(--surface); }
button.danger:hover { background: var(--red-soft); }
input, select {
  width: 100%;
  min-height: 2.45rem;
  padding: .58rem .7rem;
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: .45rem;
  outline: none;
  background: var(--surface);
}
input:focus, select:focus { border-color: #7aa2f7; box-shadow: 0 0 0 3px rgb(37 99 235 / 12%); }
label { display: grid; gap: .38rem; color: #475467; font-size: .82rem; font-weight: 600; }
.form-grid { display: grid; gap: 1rem; }
.checkbox { display: flex; align-items: center; gap: .5rem; }
.checkbox input { width: auto; min-height: 0; }
.actions, .coordinate-row { display: flex; gap: .6rem; }
.coordinate-row > * { flex: 1; }
.form-error { color: var(--red); }
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.auth-card { width: min(430px, 100%); }
.auth-card h1 { font-size: 2rem; }
.auth-card p:last-child { margin-bottom: 0; text-align: center; }
.alert { padding: .75rem; border: 1px solid var(--border); border-radius: .45rem; background: var(--surface-subtle); }
.alert.error { color: var(--red); border-color: #efb4b4; background: var(--red-soft); }
.alert.success { color: var(--green); border-color: #a7d8b7; background: var(--green-soft); }
.secret-reveal { display: grid; gap: .45rem; margin-bottom: 1rem; padding: 1rem; border: 1px solid #e7ca75; border-radius: .5rem; background: var(--yellow-soft); }
.secret-reveal code { overflow-wrap: anywhere; user-select: all; }
.feature-list { display: grid; }
.feature-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 1rem; padding: .9rem 0; border-top: 1px solid var(--border); }
.feature-row:first-child { border-top: 0; }
.feature-row small { display: block; margin-top: .2rem; }
.credential-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.credential-card { display: grid; align-content: start; gap: 1rem; }
.credential-card p { margin-bottom: .2rem; }
.reference-provenance { display: flex; align-items: flex-start; gap: 1rem; padding: 1rem; border: 1px solid #e7ca75; border-radius: .6rem; background: var(--yellow-soft); }
.reference-provenance p { margin: .25rem 0 0; color: var(--muted); }
.reference-nav { position: sticky; z-index: 20; top: calc(var(--topbar-height) + .5rem); display: flex; gap: .4rem; overflow-x: auto; padding: .55rem; border: 1px solid var(--border); border-radius: .55rem; background: rgb(255 255 255 / 94%); backdrop-filter: blur(10px); }
.reference-nav a { padding: .45rem .65rem; border-radius: .35rem; color: var(--muted); text-decoration: none; white-space: nowrap; }
.reference-nav a:hover { color: var(--blue); background: var(--blue-soft); }
.panel[id], .reference-columns[id] { scroll-margin-top: calc(var(--topbar-height) + 4.5rem); }
.reference-card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .8rem; }
.reference-card { padding: 1rem; border: 1px solid var(--border); border-radius: .5rem; background: var(--surface-subtle); }
.reference-card ul { margin: .4rem 0 1rem; padding-left: 1.2rem; }
.specialization-card { display: grid; align-content: start; gap: .65rem; }
.specialization-card h3,
.specialization-card p,
.specialization-card ul { margin-bottom: 0; }
.tag-list { display: flex; flex-wrap: wrap; gap: .4rem; }
.tag-list span { padding: .25rem .5rem; border: 1px solid var(--border); border-radius: 10rem; background: var(--surface); font-size: .8rem; }
.reference-table thead:first-child tr:first-child th { text-align: center; }
.reference-table th:first-child { text-align: left; }
.reference-table td { text-align: center; }
.strength-stars { color: #d69200; font-size: 1.05rem; letter-spacing: .08em; white-space: nowrap; }
.badge.verified { color: var(--green); background: var(--green-soft); }
.reference-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.2rem; align-items: start; }
.reference-rules { display: grid; gap: .65rem; margin-bottom: 0; padding-left: 1.4rem; }
.reference-subheading { margin-top: 1.5rem; }
.checklist-list { display: grid; }
.checklist-list article { display: flex; gap: .8rem; padding: .85rem 0; border-top: 1px solid var(--border); }
.checklist-list p { margin: .2rem 0; color: var(--text); }
.check-box { width: 1.1rem; height: 1.1rem; flex: none; margin-top: .15rem; border: 2px solid var(--border-strong); border-radius: .2rem; background: var(--surface); }

.city-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }
.city-card { display: grid; gap: .8rem; }
.city-card__top { display: flex; justify-content: space-between; gap: 1rem; }
.city-card h3 { margin: .25rem 0; }
.city-card p { margin-bottom: 0; color: var(--muted); }
.city-card strong { font-size: 1.1rem; }
.city-card-link { color: inherit; text-decoration: none; }
.badge { display: inline-flex; padding: .2rem .45rem; border-radius: 10rem; color: #175cd3; background: var(--blue-soft); font-size: .67rem; font-weight: 750; text-transform: uppercase; }
.add-city summary { cursor: pointer; color: var(--blue); font-weight: 650; }
.add-city[open] summary { margin-bottom: 1rem; }
.welcome { width: min(560px, 100%); margin: 3rem auto; }
.welcome > p { color: var(--muted); }
.detail-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.detail-item { padding: .9rem; border: 1px solid var(--border); border-radius: .5rem; background: var(--surface-subtle); }
.detail-item span, .definition-list dt { display: block; color: var(--muted); font-size: .75rem; }
.detail-item strong { display: block; margin-top: .25rem; }
.definition-list { display: grid; grid-template-columns: 180px 1fr; gap: .75rem 1rem; }
.definition-list dd { margin: 0; }
.city-table-list { display: grid; gap: .55rem; }
.city-row { display: grid; grid-template-columns: minmax(160px, 1.5fr) 1fr 1fr auto; align-items: center; gap: 1rem; padding: .9rem 1rem; color: inherit; border: 1px solid var(--border); border-radius: .5rem; text-decoration: none; }
.city-row:hover { border-color: #9bb6ee; background: #f8faff; }
.city-row span { color: var(--muted); }

.world-map-heading, .viewer-heading { display: flex; justify-content: space-between; gap: 2rem; align-items: end; margin-bottom: 1.5rem; }
.world-map-heading p, .viewer-heading p { color: var(--muted); }
.import-status { display: grid; gap: .25rem; min-width: 15rem; }
.import-status span { color: var(--muted); font-size: .8rem; }
.map-filters { display: grid; grid-template-columns: repeat(5, minmax(8rem, 1fr)); gap: 1rem; align-items: end; margin-bottom: 1rem; }
.map-results { padding: 0; overflow: hidden; }
.map-results .section-heading { padding: 1rem 1.25rem; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .72rem .8rem; border-top: 1px solid var(--border); text-align: right; white-space: nowrap; }
th { color: #475467; background: var(--surface-subtle); font-size: .7rem; text-transform: uppercase; }
td { font-variant-numeric: tabular-nums; }
td small { color: var(--muted); }
.pagination { display: flex; justify-content: center; gap: 1rem; padding: 1rem; }

.unit-comparison-table th:first-child,
.unit-comparison-table td:first-child,
.unit-comparison-table th:nth-child(2),
.unit-comparison-table td:nth-child(2) { text-align: left; }
.unit-comparison-table th:first-child,
.unit-comparison-table td:first-child { white-space: nowrap; }
.unit-comparison-table td:nth-child(2) { min-width: 190px; white-space: normal; }
.unit-comparison-table .numeric { text-align: right; }
.unit-bonus { display: block; margin-top: .25rem; color: var(--blue); line-height: 1.35; }
.table-sort-button { width: 100%; display: inline-flex; justify-content: inherit; align-items: center; gap: .35rem; padding: 0; color: inherit; border: 0; background: transparent; font: inherit; text-transform: inherit; }
.table-sort-button:hover,
.table-sort-button:focus,
.table-sort-button:active { color: inherit; border-color: transparent; background: transparent; }
.table-sort-button::after { content: "↕"; color: var(--muted); font-size: .8rem; opacity: .55; }
th[aria-sort="ascending"] .table-sort-button::after { content: "↑"; color: var(--blue); opacity: 1; }
th[aria-sort="descending"] .table-sort-button::after { content: "↓"; color: var(--blue); opacity: 1; }
.sortable-table th:first-child .table-sort-button,
.sortable-table th:nth-child(2) .table-sort-button { justify-content: flex-start; }
.reference-details { padding: 0; }
.reference-details > summary { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1.1rem 1.25rem; cursor: pointer; }
.reference-details > summary::marker { content: ""; }
.reference-details > summary .eyebrow { display: block; margin-bottom: .2rem; }
.reference-details[open] > summary { border-bottom: 1px solid var(--border); }
.cost-card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .75rem; padding: 1rem; }
.cost-card { padding: .85rem; border: 1px solid var(--border); border-radius: .45rem; background: var(--surface-subtle); }
.cost-card h3 { display: grid; gap: .15rem; }
.cost-card dl { display: grid; gap: .3rem; margin: .7rem 0 0; }
.cost-card dl div { display: flex; justify-content: space-between; gap: 1rem; }
.cost-card dt { color: var(--muted); }
.cost-card dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 650; }
.building-picker { width: min(320px, 100%); }
.building-picker label { display: block; margin-bottom: .35rem; color: var(--muted); font-size: .8rem; font-weight: 650; }
.building-level-table th:first-child,
.building-level-table td:first-child { text-align: right; }
.building-level-table td:nth-child(n+3) { min-width: 150px; text-align: left; white-space: normal; line-height: 1.45; }

.map-viewer-layout { display: grid; grid-template-columns: minmax(0, 3fr) minmax(280px, 1fr); gap: 1rem; }
.map-canvas-panel { position: relative; min-width: 0; padding: 0; overflow: hidden; }
#illyriad-map { width: 100%; height: min(72vh, 760px); min-height: 520px; background: #17241c; }
.map-coordinate { position: absolute; z-index: 500; left: .75rem; bottom: .75rem; padding: .4rem .65rem; color: #fff; border-radius: .35rem; background: rgb(17 24 39 / 88%); font-variant-numeric: tabular-nums; }
.tile-inspector { max-height: min(72vh, 760px); overflow-y: auto; }
.tile-inspector dl { display: grid; grid-template-columns: auto 1fr; gap: .65rem 1rem; }
.tile-inspector dt { color: var(--muted); }
.tile-inspector dd { margin: 0; }
.selected-coordinate { color: var(--muted); }
.terrain-legend { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem; margin-top: 1.2rem; color: var(--muted); }
.terrain-legend span { display: flex; align-items: center; gap: .5rem; }
.terrain-legend i { width: 1rem; height: 1rem; border-radius: .2rem; }
.legend-plains { background: #8c9a61; } .legend-forest { background: #39704a; }
.legend-hills { background: #8b6945; } .legend-mountain { background: #656b68; }
.legend-water { background: #367e9f; } .legend-building { background: #d8ad5d; }
.map-layer-controls { display: grid; gap: .75rem; }
.coordinate-navigation { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; padding-bottom: .9rem; border-bottom: 1px solid var(--border); }
.coordinate-navigation button, .coordinate-navigation .form-error { grid-column: 1 / -1; }
.coordinate-navigation .form-error { min-height: 1.1rem; margin: 0; font-size: .8rem; }
.map-layer-controls + hr { margin: 1.25rem 0; border: 0; border-top: 1px solid var(--border); }
.alliance-options { display: grid; gap: .35rem; max-height: 12rem; overflow: auto; }
.alliance-option { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .5rem; padding: .35rem; border-radius: .3rem; }
.alliance-option:hover { background: var(--surface-subtle); }
.alliance-option input { width: auto; min-height: 0; }
.alliance-option small { color: var(--muted); }
.town-marker { display: grid; place-items: center; border: 2px solid #fff; border-radius: 50%; color: #111; background: var(--marker-color, #d8ad5d); box-shadow: 0 1px 5px #0008; font-weight: 900; }
.town-marker.capital::after { content: "★"; font-size: .65rem; }
.town-cluster { display: grid; place-items: center; border: 2px solid #fff; border-radius: 50%; color: #fff; background: rgb(62 79 110 / 90%); box-shadow: 0 1px 6px #0008; font-weight: 750; }
.leaflet-tooltip.town-tooltip { color: #eef4ef; background: #1f2937; border-color: #475467; box-shadow: 0 2px 8px #0008; }
.leaflet-tooltip.town-tooltip::before { border-top-color: #475467; }
.selected-cell-label { color: #fff; background: var(--blue); border: 0; font-weight: 750; }
.selected-cell-label::before { display: none; }
.leaflet-control-attribution { color: #333; }

html[data-theme="pirate"] {
  --surface: #fffdf7;
  --surface-subtle: #f7f1e4;
  --page: #eee7da;
  --border: #d8c9ae;
  --border-strong: #baa98b;
  --text: #282017;
  --muted: #766956;
  --sidebar: #17130f;
  --sidebar-hover: #2b231b;
  --blue: #8b5a23;
  --blue-soft: #f4e6ce;
}
html[data-theme="pirate"] .brand-mark::after { content: "☠"; font-size: .75rem; }
html[data-theme="pirate"] .brand-mark { font-size: 0; background: #8b5a23; }

@media (max-width: 1050px) {
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .dashboard-layout { grid-template-columns: 1fr; }
  .map-viewer-layout { grid-template-columns: 1fr; }
  .tile-inspector { max-height: none; }
}

@media (max-width: 899px) {
  .sidebar-is-open .main-content { margin-left: 0; }
  .sidebar { z-index: 1200; top: 0; }
  .sidebar-backdrop { position: fixed; z-index: 1150; inset: 0; display: block; padding: 0; border: 0; border-radius: 0; background: rgb(15 23 42 / 48%); }
  .topbar { gap: .5rem; padding: 0 .7rem; }
  .global-search { display: none; }
  .user-name { display: none; }
  .main-content { padding-top: calc(var(--topbar-height) + 1.25rem); }
}

@media (max-width: 640px) {
  .topbar-actions { gap: .3rem; }
  .notification-button { display: none; }
  .topbar-button { padding: .45rem .55rem; }
  .breadcrumbs a:not(:last-of-type), .breadcrumb-separator { display: none; }
  .page-header, .world-map-heading, .viewer-heading { align-items: stretch; flex-direction: column; }
  .page-actions { width: 100%; }
  .page-actions > * { flex: 1; }
  .metric-grid, .detail-grid { grid-template-columns: 1fr 1fr; }
  .map-filters { grid-template-columns: 1fr 1fr; }
  .city-row { grid-template-columns: 1fr auto; }
  .city-row span { display: none; }
  .definition-list { grid-template-columns: 1fr; gap: .25rem; }
  #illyriad-map { min-height: 430px; height: 62vh; }
  .reference-columns { grid-template-columns: 1fr; }
  .credential-grid { grid-template-columns: 1fr; }
}
