/* Dubai Smart Geodetic Calculator — Dubai Municipality theme
   navy #3D3F5A sampled from the DM logo; gold accent from the Government of Dubai crest */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy:     #3D3F5A;   /* DM logo */
  --navy-dk:  #2B2D43;
  --navy-lt:  #E6E7EF;
  --gold:     #B8964C;   /* crest accent, use sparingly */
  --bg:       #F6F7FA;
  --card:     #FFFFFF;
  --text:     #2B2D3A;
  --muted:    #6E7185;
  --border:   #DDDFE8;
  --warn-bg:  #FFF6E0;
  --warn-bd:  #D9A93A;
  --err-bg:   #FDECEC;
  --err-bd:   #D05050;
  --radius:   8px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.55; font-size: 15px;
  display: flex; flex-direction: column; min-height: 100vh;
}
main { flex: 1; }
a { color: var(--navy); }
.container { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
h1 { font-size: 1.45rem; color: var(--navy); margin: 22px 0 6px; }
h2 { font-size: 1.1rem; color: var(--navy); margin: 18px 0 8px; }
p.lead { color: var(--muted); margin-bottom: 16px; }

/* ── nav ── */
nav.topnav { background: #fff; position: sticky; top: 0; z-index: 1100;
  box-shadow: 0 2px 10px rgba(43,45,67,.10); border-bottom: 3px solid var(--navy); }
.nav-inner { max-width: 1180px; margin: 0 auto; padding: 0 20px; height: 64px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand img { height: 40px; width: auto; display: block; }
.brand-text { color: var(--navy); font-weight: 800; font-size: .95rem; line-height: 1.15;
  border-left: 1.5px solid var(--border); padding-left: 12px; }
.brand-text small { display: block; color: var(--gold); font-weight: 700; font-size: .6rem;
  letter-spacing: 1.2px; text-transform: uppercase; }
nav.topnav ul { list-style: none; display: flex; gap: 2px; align-items: center; flex-wrap: wrap; }
nav.topnav ul a { color: var(--navy); font-size: .87rem; padding: 7px 12px; border-radius: 6px;
  text-decoration: none; }
nav.topnav ul a:hover { background: var(--navy-lt); }
nav.topnav ul a.active { background: var(--navy); color: #fff; font-weight: 700; }

.demo-ribbon { background: var(--navy-lt); color: var(--muted); font-size: .78rem;
  text-align: center; padding: 5px 12px; border-bottom: 1px solid var(--border); }
.demo-ribbon strong { color: var(--navy); }

/* ── footer ── */
footer.sitefoot { background: #fff; border-top: 1px solid var(--border); margin-top: 32px;
  padding: 14px 0; font-size: .78rem; color: var(--muted); }
footer .container { display: flex; justify-content: space-between; align-items: center; gap: 16px;
  flex-wrap: wrap; }
footer img { height: 34px; width: auto; vertical-align: middle; }

/* ── cards, forms, tables ── */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 16px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
input[type=text], input[type=number], input[type=search], input[type=password], select {
  font: inherit; padding: 6px 9px; border: 1px solid var(--border); border-radius: 6px; background: #fff; }
button, .btn { font: inherit; font-weight: 600; padding: 7px 14px; border-radius: 6px; border: 1px solid var(--navy);
  background: var(--navy); color: #fff; cursor: pointer; text-decoration: none; display: inline-block; }
button.secondary, .btn.secondary { background: #fff; color: var(--navy); }
button:disabled { opacity: .5; cursor: default; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border: 1px solid var(--border);
  border-radius: 14px; background: #fff; font-size: .82rem; cursor: pointer; user-select: none; }
.chip input { margin: 0; }
.dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; border: 1px solid rgba(0,0,0,.35); }

table.data { width: 100%; border-collapse: collapse; background: #fff; font-size: .84rem; }
table.data th, table.data td { padding: 5px 8px; border-bottom: 1px solid var(--border); text-align: left;
  white-space: nowrap; }
table.data th { background: var(--navy-lt); color: var(--navy); position: sticky; top: 0; cursor: pointer; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tr:hover td { background: #FAFAFD; }
.table-wrap { max-height: 70vh; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.muted { color: var(--muted); }
.msg { padding: 9px 12px; border-radius: 6px; margin: 10px 0; font-size: .88rem; }
.msg.warn { background: var(--warn-bg); border: 1px solid var(--warn-bd); }
.msg.err { background: var(--err-bg); border: 1px solid var(--err-bd); }

/* ── map page ── */
.map-layout { display: grid; grid-template-columns: 290px 1fr; gap: 14px; padding: 14px 20px; }
#map { height: calc(100vh - 170px); min-height: 480px; border-radius: var(--radius);
  border: 1px solid var(--border); }
.side .card { padding: 12px 14px; }
.side h2 { margin-top: 0; font-size: .95rem; }
.type-list label { display: flex; align-items: center; gap: 7px; padding: 2px 0; font-size: .85rem; cursor: pointer; }
.type-list .count { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.legend-bar { height: 10px; border-radius: 3px; margin: 4px 0 2px; }
.legend-row { display: flex; justify-content: space-between; font-size: .75rem; color: var(--muted); }
.search-results { max-height: 180px; overflow: auto; font-size: .84rem; }
.search-results div { padding: 3px 6px; cursor: pointer; border-radius: 4px; }
.search-results div:hover, .search-results div.sel { background: var(--navy-lt); }
@media (max-width: 860px) { .map-layout { grid-template-columns: 1fr; } #map { height: 60vh; } }

/* ── datasheet ── */
.sheet { background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px 26px; margin: 16px auto; max-width: 900px; }
.sheet-head { display: flex; justify-content: space-between; align-items: center;
  border-bottom: 3px solid var(--navy); padding-bottom: 10px; margin-bottom: 14px; }
.sheet-head img { height: 52px; }
.sheet-head .title { text-align: right; }
.sheet-head .title b { font-size: 1.35rem; color: var(--navy); display: block; }
.sheet-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.sheet table { width: 100%; border-collapse: collapse; font-size: .85rem; margin-bottom: 10px; }
.sheet th { text-align: left; color: var(--navy); font-weight: 600; padding: 3px 6px; width: 45%; }
.sheet td { padding: 3px 6px; font-variant-numeric: tabular-nums; }
.sheet tr { border-bottom: 1px solid var(--border); }
.sheet .minimap { height: 240px; border-radius: 6px; border: 1px solid var(--border); }
.sheet .foot { font-size: .72rem; color: var(--muted); margin-top: 12px; border-top: 1px solid var(--border);
  padding-top: 6px; }
.page-break { page-break-after: always; }

@media print {
  nav.topnav, .demo-ribbon, footer.sitefoot, .no-print { display: none !important; }
  body { background: #fff; }
  .sheet { border: none; margin: 0; max-width: none; padding: 0; }
}
