/* Bangladesh Location Data — shared styles */
:root {
  --paper: #ffffff;
  --mist: #f3f7f5;
  --rule: #dce5e0;
  --rule-2: #c4d2cb;
  --ink: #1a2622;
  --muted: #53655d;
  --faint: #74857d;
  --green: #0a6b4f;
  --green-2: #07553e;
  --green-tint: #e3f1e9;
  --red: #b8322a;
  --red-tint: #fbecea;
  --font: "Anek Bangla", "Hind Siliguri", "Noto Sans Bengali", "Kohinoor Bangla", "Bangla Sangam MN", "Nirmala UI", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.65;
  color: var(--ink); background: var(--paper); -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, dl, dd, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: var(--green-2); text-underline-offset: 3px; }
a:hover { color: var(--green); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }

/* ---------- header ---------- */
.site-header { background: var(--paper); border-bottom: 1px solid var(--rule); flex: none; }
.site-header .in { max-width: 1180px; margin: 0 auto; padding: 0 20px; height: 56px; display: flex; align-items: center; gap: 32px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 16px; color: var(--ink); text-decoration: none; white-space: nowrap; }
.brand:hover { color: var(--ink); }
.brand svg { width: 24px; height: 15px; flex: none; }
.site-nav { display: flex; align-self: stretch; gap: 22px; margin-left: auto; }
.site-nav a { display: flex; align-items: center; color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500; border-bottom: 2px solid transparent; padding-top: 2px; }
.site-nav a:hover { color: var(--ink); }
.site-nav a[aria-current="page"] { color: var(--green-2); border-bottom-color: var(--green); }

/* ---------- buttons & fields ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px;
  border: 1px solid var(--rule-2); border-radius: 6px; background: var(--paper); color: var(--ink);
  font-size: 14px; font-weight: 500; text-decoration: none; white-space: nowrap; transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--mist); border-color: var(--faint); color: var(--ink); }
.btn:disabled { opacity: .45; cursor: default; background: var(--paper); border-color: var(--rule-2); }
.btn-primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-2); border-color: var(--green-2); color: #fff; }
.btn-danger { color: var(--red); border-color: #e4bcb8; }
.btn-danger:hover { background: var(--red-tint); border-color: var(--red); color: var(--red); }
.btn-sm { height: 30px; padding: 0 11px; font-size: 13px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--green-2); font-size: 13px; font-weight: 500; }
.link-btn:hover { text-decoration: underline; text-underline-offset: 3px; }

.field { display: block; margin-top: 14px; }
.field > label, .field > .lbl { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.field input, .field select, .field textarea {
  width: 100%; height: 38px; padding: 0 11px; border: 1px solid var(--rule-2); border-radius: 6px; background: var(--paper); font-size: 14px;
}
.field input:focus, .field select:focus { outline: 2px solid var(--green); outline-offset: -1px; border-color: var(--green); }
.field .hint { margin-top: 4px; font-size: 12px; color: var(--muted); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
select {
  appearance: none; -webkit-appearance: none; padding-right: 32px !important;
  background: var(--paper) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%2353655d' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1.5 1.75 6 6.25l4.5-4.5'/%3E%3C/svg%3E") no-repeat right 11px center;
}
select:disabled { background-color: var(--mist); color: var(--faint); cursor: not-allowed; }

/* ---------- search ---------- */
.search { position: relative; }
.search input {
  width: 100%; height: 44px; padding: 0 14px 0 42px; border: 1px solid var(--rule-2); border-radius: 8px; font-size: 16px;
  background: var(--paper) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%2374857d' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='8' cy='8' r='5.5'/%3E%3Cpath d='m12.5 12.5 3.5 3.5'/%3E%3C/svg%3E") no-repeat 14px 50%;
}
.search input::-webkit-search-cancel-button { display: none; }
.search input:focus { outline: 2px solid var(--green); outline-offset: -1px; border-color: var(--green); }
.search.sm input { height: 36px; font-size: 14px; padding-left: 38px; background-position: 12px 50%; }
.pop {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 30; background: var(--paper);
  border: 1px solid var(--rule-2); border-radius: 8px; box-shadow: 0 14px 30px -14px rgba(26, 38, 34, .3);
  max-height: min(62vh, 440px); overflow-y: auto;
}
.pop[hidden] { display: none; }
.pop a { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; padding: 9px 14px; border-bottom: 1px solid var(--rule); color: var(--ink); text-decoration: none; }
.pop a:last-child { border-bottom: 0; }
.pop a:hover, .pop a:focus-visible { background: var(--mist); outline: none; }
.pop .p1 { font-weight: 500; }
.pop .p1 small { font-weight: 400; color: var(--muted); font-size: 13px; margin-left: 6px; }
.pop .p2 { display: block; font-size: 12.5px; color: var(--muted); }
.pop .pc { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pop .none { padding: 14px; color: var(--muted); font-size: 14px; }

/* ---------- code & tables ---------- */
.codebox { position: relative; }
.code { background: var(--mist); border: 1px solid var(--rule); border-radius: 6px; padding: 12px 14px; font: 13px/1.7 var(--mono); overflow-x: auto; white-space: pre; margin: 0; }
.codebox .code { padding-right: 76px; }
.codebox .copy { position: absolute; top: 8px; right: 8px; }
code { font-family: var(--mono); font-size: .88em; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-weight: 600; font-size: 13px; color: var(--muted); padding: 8px 16px 8px 0; border-bottom: 1px solid var(--rule-2); }
.tbl td { padding: 10px 16px 10px 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.tbl td:last-child, .tbl th:last-child { padding-right: 0; }

/* ---------- app shell (explorer, admin) ---------- */
body.app { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.toolbar { display: flex; align-items: center; gap: 16px; padding: 9px 20px; border-bottom: 1px solid var(--rule); background: var(--paper); flex: none; }
.toolbar .grow { flex: 1; min-width: 0; }
.crumbs { display: flex; align-items: center; gap: 2px; overflow-x: auto; white-space: nowrap; scrollbar-width: none; font-size: 14px; }
.crumbs::-webkit-scrollbar { display: none; }
.crumbs button { background: none; border: 0; padding: 4px 6px; border-radius: 4px; color: var(--muted); font-size: 14px; }
.crumbs button:hover { background: var(--mist); color: var(--ink); }
.crumbs button:last-of-type { color: var(--ink); font-weight: 600; }
.crumbs svg { width: 12px; height: 12px; color: var(--faint); flex: none; }
.toolbar .search { width: 300px; flex: none; }

.workspace { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 360px; }
.cols { display: flex; overflow-x: auto; background: var(--mist); min-height: 0; }
.col { flex: 0 0 252px; min-height: 0; display: flex; flex-direction: column; background: var(--paper); border-right: 1px solid var(--rule); overflow-y: auto; }
.group { position: sticky; top: 0; z-index: 1; display: flex; justify-content: space-between; align-items: center; padding: 7px 16px; background: #f8fbf9; border-bottom: 1px solid var(--rule); font-size: 12.5px; font-weight: 600; color: var(--muted); }
.group .link-btn { font-size: 12.5px; }
.row { position: relative; display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 16px; text-align: left; background: none; border: 0; border-bottom: 1px solid #edf2ef; }
.row:hover { background: var(--mist); }
.row[aria-selected="true"] { background: var(--green-tint); }
.row[aria-selected="true"]::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--green); }
.row:focus-visible { outline-offset: -2px; }
.row .n { flex: 1; min-width: 0; }
.row .n b { display: block; font-weight: 500; font-size: 15px; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .n span { display: block; font-size: 12px; color: var(--muted); line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row[aria-selected="true"] .n b { color: var(--green-2); font-weight: 600; }
.row .pc { font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.row .chev { width: 12px; height: 12px; color: var(--faint); flex: none; }
.row.off .n b, .row.off .n span { text-decoration: line-through; color: var(--faint); }
.cols-empty { padding: 28px 24px; color: var(--muted); max-width: 320px; }

.panel { background: var(--paper); border-left: 1px solid var(--rule); overflow-y: auto; min-height: 0; }
.panel-in { padding: 20px 22px 28px; }
.panel h2 { font-size: 22px; line-height: 1.3; font-weight: 700; }
.panel .sub { color: var(--muted); font-size: 14px; margin-top: 2px; }
.panel h3 { font-size: 14px; font-weight: 650; margin: 24px 0 6px; }
.dl { display: grid; grid-template-columns: 108px minmax(0, 1fr); margin-top: 16px; font-size: 14px; }
.dl dt, .dl dd { padding: 8px 0; border-bottom: 1px solid var(--rule); }
.dl dt { color: var(--muted); }
.dl dd { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; word-break: break-word; }
.dl dd.strong { font-weight: 650; font-size: 16px; }
.dl code { font-size: 12.5px; }
.dl dt.wide { grid-column: 1 / -1; border-bottom: 0; padding-bottom: 0; }
.dl dd.wide { grid-column: 1 / -1; padding-top: 3px; }
.po { width: 100%; border-collapse: collapse; font-size: 14px; }
.po td { padding: 6px 0; border-bottom: 1px solid var(--rule); }
.po td:last-child { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.empty { padding: 36px 22px; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }
.tag { display: inline-block; padding: 0 7px; border-radius: 4px; font-size: 12px; font-weight: 500; background: var(--mist); color: var(--muted); border: 1px solid var(--rule); }
.tag.off { background: var(--red-tint); border-color: #efc9c5; color: var(--red); }

/* ---------- dialog & toast ---------- */
dialog { border: 1px solid var(--rule-2); border-radius: 10px; padding: 0; width: min(440px, calc(100vw - 32px)); color: var(--ink); box-shadow: 0 24px 60px -20px rgba(26, 38, 34, .4); }
dialog::backdrop { background: rgba(26, 38, 34, .35); }
dialog form, dialog .dlg { padding: 22px 24px 20px; }
dialog h2 { font-size: 18px; font-weight: 700; }
dialog .sub { color: var(--muted); font-size: 14px; margin-top: 2px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.radio { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--rule-2); border-radius: 6px; margin-top: 10px; cursor: pointer; font-size: 14px; }
.radio input { margin-top: 5px; accent-color: var(--green); }
.radio small { display: block; color: var(--muted); font-size: 12.5px; }
.radio:has(input:checked) { border-color: var(--green); background: var(--green-tint); }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 9px 16px; border-radius: 6px; font-size: 14px; z-index: 50; }
.toast[hidden] { display: none; }

@media (max-width: 900px) {
  .site-header .in { gap: 16px; }
  .brand span { font-size: 15px; }
  body.app { height: auto; min-height: 100dvh; overflow: visible; }
  .toolbar { flex-wrap: wrap; padding: 10px 16px; }
  .toolbar .search { width: 100%; order: 3; }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .cols { height: 56vh; }
  .col { flex-basis: 100%; }
  .col:not(:last-child) { display: none; }
  .panel { border-left: 0; border-top: 1px solid var(--rule); }
}
@media (max-width: 560px) {
  .site-nav { gap: 14px; }
  .brand span { display: none; }
  .field-row { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
