/* Map App - navy #1b3348, gold #b8893d, cream #f4efe6. Serif headings, sans-serif UI. */
:root {
  --navy: #1b3348;
  --navy-2: #24425c;
  --gold: #b8893d;
  --gold-2: #9a7130;
  --cream: #f4efe6;
  --paper: #fbf8f2;
  --ink: #1f2933;
  --muted: #5b6672;
  --line: #ddd3c2;
  --disc-bg: #f7ecd2;
  --disc-line: #e2c98f;
  --ok: #166534;
  --err: #b42318;
  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --header-h: 56px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--sans); color: var(--ink); background: var(--cream); font-size: 16px; line-height: 1.5; }
h1, h2, h3 { font-family: var(--serif); color: var(--navy); line-height: 1.2; margin: 0 0 .5em; font-weight: 600; }
a { color: var(--navy); }
code { background: rgba(27,51,72,.08); padding: 0 .3em; border-radius: 3px; }

.site-header { height: var(--header-h); background: var(--navy); color: #fff; display: flex; align-items: center; justify-content: space-between; padding: 0 20px; border-bottom: 3px solid var(--gold); position: relative; z-index: 1001; }
.brand { color: #fff; text-decoration: none; font-family: var(--serif); font-size: 21px; letter-spacing: .3px; white-space: nowrap; }
.brand-mark { color: var(--gold); }
.site-header nav { display: flex; gap: 4px; align-items: center; }
.site-header nav a, .linklike { color: #e9e2d3; text-decoration: none; padding: 6px 10px; border-radius: 4px; font: inherit; font-size: 15px; background: none; border: 0; cursor: pointer; }
.site-header nav a:hover, .linklike:hover { background: var(--navy-2); color: #fff; }
.site-header nav a[aria-current="page"] { color: #fff; box-shadow: inset 0 -2px 0 var(--gold); border-radius: 0; }
form.inline { display: inline; margin: 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--navy); color: #fff; border: 1px solid var(--navy); border-radius: 6px; padding: 9px 16px; font: 600 15px var(--sans); text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--navy-2); }
.btn-gold { background: var(--gold); border-color: var(--gold); color: #fff; }
.btn-gold:hover { background: var(--gold-2); }
.btn-ghost { background: transparent; color: var(--navy); border-color: var(--navy); }
.btn-ghost:hover { background: rgba(27,51,72,.07); }
.btn-danger { background: #fff; color: var(--err); border-color: var(--err); }
.btn-lg { padding: 12px 22px; font-size: 17px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-x { background: #111; border-color: #111; width: 100%; }
.pill { font-size: 11px; font-weight: 600; background: rgba(255,255,255,.2); border-radius: 999px; padding: 1px 8px; text-transform: uppercase; letter-spacing: .4px; }

.card { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 20px 22px; box-shadow: 0 1px 2px rgba(27,51,72,.05); }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.ok { color: var(--ok); background: #ecf7ef; border: 1px solid #b7dfc3; padding: 8px 10px; border-radius: 6px; }
.err { color: var(--err); }
p.err:empty { display: none; }
.card .err { background: #fdf0ee; border: 1px solid #f2c4bd; padding: 8px 10px; border-radius: 6px; }
.note { font-size: 14px; padding: 8px 10px; border-radius: 6px; }
.note.warn { background: #fff7e6; border: 1px solid #f1d39a; }
.note.dev { background: #eef3f8; border: 1px solid #c7d6e6; }

.disclaimer { background: var(--disc-bg); border: 1px solid var(--disc-line); border-left: 4px solid var(--gold); border-radius: 6px; padding: 10px 14px; font-size: 14px; color: #4a3b1d; }

/* Home */
.home { max-width: 1120px; margin: 0 auto; padding: 40px 24px 24px; }
.hero { display: grid; grid-template-columns: 1.35fr 1fr; gap: 40px; align-items: start; }
.eyebrow { text-transform: uppercase; letter-spacing: 1.5px; font-size: 12.5px; color: var(--gold-2); font-weight: 700; margin: 0 0 8px; }
.hero h1 { font-size: 46px; margin-bottom: 14px; }
.lead { font-size: 18px; color: #34404c; max-width: 36em; }
.actions { margin: 22px 0; display: flex; gap: 10px; flex-wrap: wrap; }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 44px; border-top: 1px solid var(--line); padding-top: 26px; }
.facts h3 { font-size: 20px; margin-bottom: 4px; }
.facts p { margin: 0; color: var(--muted); font-size: 15px; }
.site-footer { margin-top: 36px; font-size: 13px; color: var(--muted); }
.signin h2 { font-size: 24px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; font-weight: 600; color: #34404c; }
input, select, textarea { font: 15px var(--sans); padding: 9px 10px; border: 1px solid #c9bfae; border-radius: 6px; background: #fff; color: var(--ink); width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: 0; border-color: var(--gold); }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin: 14px 0; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.narrow { max-width: 480px; margin: 40px auto; padding: 0 16px; display: flex; flex-direction: column; gap: 16px; }

/* Map */
.page-map { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.map-wrap { flex: 1; position: relative; min-height: 0; }
#map { position: absolute; inset: 0; background: #dfe7ea; }
.leaflet-container { font-family: var(--sans); }
.map-panel { background: rgba(251,248,242,.97); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,.15); padding: 10px 12px; font-size: 13.5px; color: var(--ink); }
.legend { min-width: 210px; max-width: 280px; max-height: calc(100vh - 200px); overflow: auto; }
.legend h4 { font-family: var(--serif); color: var(--navy); margin: 2px 0 6px; font-size: 15px; }
.legend .sec + .sec { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); }
.legend .row { display: flex; align-items: center; gap: 8px; margin: 3px 0; }
.legend .off { color: var(--muted); font-style: italic; font-size: 12.5px; }
.sw { width: 26px; height: 16px; flex: none; border-radius: 2px; }
.mag-bar { height: 12px; border-radius: 3px; border: 1px solid rgba(0,0,0,.25); opacity: .9;
  background: linear-gradient(to right, #5800f0 0%, #0020f0 6%, #0084f0 12%, #00c61e 19%, #54db00 25%, #d2d200 32%, #eded00 38%, #ffc300 45%, #ffa500 51%, #ff8700 57%, #ff7300 64%, #ff4b00 70%, #ff2800 77%, #ff0f00 83%, #e61e3c 90%, #e600be 96%, #b40090 100%); }
.mag-ends { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 2px; }
.mag-src { font-size: 11px; color: var(--muted); margin-top: 3px; }
.legend-toggle { display: none; }
.map-disclaimer { max-width: 560px; font-size: 12.5px; background: var(--disc-bg); border: 1px solid var(--disc-line); border-left: 4px solid var(--gold); color: #4a3b1d; padding: 6px 10px; border-radius: 6px; box-shadow: 0 1px 4px rgba(0,0,0,.12); cursor: default; }
.map-disclaimer .more { display: none; }
.map-status { font-size: 12px; color: var(--muted); }
.home-ctl a { display: block; background: var(--navy); color: #fff !important; font: 600 13px var(--sans); padding: 6px 10px; border-radius: 4px; text-decoration: none; }
.home-ctl { display: none; }
.leaflet-tooltip.claim-label { background: rgba(27,51,72,.88); color: #fff; border: 0; border-radius: 3px; font: 600 11.5px var(--sans); padding: 1px 5px; box-shadow: none; }
.leaflet-tooltip.claim-label::before { display: none; }
.upcoming-mini { margin: 0; padding-left: 0; list-style: none; }
.upcoming-mini li { margin: 4px 0; }

/* Popup */
.leaflet-popup-content { margin: 12px 14px; font-size: 13.5px; line-height: 1.45; min-width: 230px; }
.pop h3 { font-size: 18px; margin: 0 0 6px; }
.pop dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; margin: 0 0 8px; }
.pop dt { color: var(--muted); }
.pop dd { margin: 0; font-weight: 600; }
.pop .stale { color: #92400e; font-weight: 600; }
.pop .disclaimer { font-size: 11.5px; padding: 6px 8px; margin-top: 8px; }
.pop .checked { font-size: 12px; color: var(--muted); }

/* Upcoming */
.upcoming-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.upcoming-list li { border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; background: #fff; font-size: 14px; }
.upcoming-list li.flag { border-color: #e7b45c; background: #fff7e6; }
.flag-badge { display: inline-block; background: #b45309; color: #fff; font-size: 11px; font-weight: 700; border-radius: 3px; padding: 0 6px; margin-left: 4px; vertical-align: 1px; }
.upcoming-list .when { font-weight: 700; color: var(--navy); }
.upcoming-list .lic { font-weight: 700; }
.upcoming-list .sub { color: var(--muted); font-size: 12.5px; }

/* Sheet */
.sheet { max-width: 1400px; margin: 0 auto; padding: 24px; display: flex; flex-direction: column; gap: 18px; }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.sheet-head h1 { font-size: 32px; margin: 0; }
.sheet-head p { margin: 4px 0 0; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; }
.sheet-grid { display: grid; grid-template-columns: 300px 1fr; gap: 18px; align-items: start; }
.upcoming h2, .users h2 { font-size: 20px; }
.table-card { padding: 0; overflow: hidden; }
.table-card #sheet-msg { padding: 0 14px; }
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #efe7d8; color: var(--navy); font-weight: 700; font-size: 12.5px; text-transform: uppercase; letter-spacing: .4px; white-space: nowrap; }
td.lic { font-weight: 700; white-space: nowrap; }
tr:hover td { background: #fffdf8; }
.tag { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.dot { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.dot.dash { background: transparent !important; border: 2px dashed #9ca3af; }
.users table { margin-top: 10px; }
.row-form { display: flex; gap: 8px; flex-wrap: wrap; }
.row-form input { flex: 1; min-width: 200px; width: auto; }
.row-form select { width: auto; }
dialog { overflow: auto; border: 0; border-radius: 12px; padding: 0; width: min(860px, 96vw); max-height: 92vh; box-shadow: 0 20px 60px rgba(0,0,0,.35); background: var(--paper); }
dialog::backdrop { background: rgba(27,51,72,.45); }
.edit-form { padding: 20px 22px; display: flex; flex-direction: column; gap: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px 14px; margin-bottom: 10px; }
.full { grid-column: 1 / -1; }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px 14px; margin: 0; }
legend { font-weight: 700; color: var(--navy); padding: 0 6px; font-size: 14px; }
fieldset.private { background: #f6f1e8; }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
label.check input { width: auto; }
.dialog-actions { display: flex; gap: 8px; align-items: center; }
.spacer { flex: 1; }
.doc-list { margin: 0 0 10px; padding-left: 18px; font-size: 14px; }
.doc-list button { margin-left: 8px; font-size: 12px; padding: 2px 8px; }
body:not([data-role="admin"]) .admin-only { display: none !important; }

/* Phone: 700 px or less */
@media (max-width: 700px) {
  .site-header { padding: 0 12px; }
  .brand { font-size: 18px; }
  .site-header nav a, .linklike { padding: 6px 7px; font-size: 14px; }
  .home { padding: 24px 16px; }
  .hero { grid-template-columns: 1fr; gap: 24px; }
  .hero h1 { font-size: 34px; }
  .lead { font-size: 16.5px; }
  .facts { grid-template-columns: 1fr; gap: 14px; margin-top: 28px; }
  .actions .btn { flex: 1; }

  /* Map fills the screen */
  .page-map .site-header { display: none; }
  .home-ctl { display: block; }
  .legend-toggle { display: block; }
  .legend-toggle button { background: var(--navy); color: #fff; border: 0; border-radius: 6px; padding: 8px 14px; font: 600 14px var(--sans); box-shadow: 0 1px 5px rgba(0,0,0,.3); cursor: pointer; }
  .legend.closed { display: none; }
  .legend { max-width: calc(100vw - 24px); max-height: 52vh; }
  .map-disclaimer { max-width: calc(100vw - 20px); font-size: 12px; cursor: pointer; }
  .page-map .leaflet-bottom.leaflet-left { bottom: 16px; }
  .page-map .leaflet-control-attribution { font-size: 9.5px; line-height: 1.3; max-width: 100vw; }
  .map-disclaimer.collapsed .full-text { display: none; }
  .map-disclaimer.collapsed .more { display: inline; color: var(--navy); font-weight: 700; text-decoration: underline; }
  .map-disclaimer:not(.collapsed) .short { display: none; }

  .sheet { padding: 14px; }
  .page-sheet { overflow-x: hidden; }
  dialog { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; }
  .edit-form { padding: 16px 14px 0; }
  .dialog-actions { position: sticky; bottom: 0; background: var(--paper); padding: 10px 0 14px; border-top: 1px solid var(--line); flex-wrap: wrap; }
  .sheet-grid { grid-template-columns: 1fr; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .sheet-head h1 { font-size: 26px; }
}
@media (min-width: 701px) {
  .map-disclaimer .short { display: none; }
}
#map.labels-hidden .claim-label { display: none; }
#map.zoomed-in .claim-dot { display: none; }
.leaflet-control-layers label { display: block; flex-direction: initial; font-weight: 500; font-size: 13.5px; color: var(--ink); margin: 2px 0; }
.leaflet-control-layers input { width: auto; padding: 0; margin: 0 6px 0 0; vertical-align: -1px; }
.leaflet-control-layers-expanded { padding: 8px 12px 8px 8px; font-family: var(--sans); }
.btn-sm { padding: 3px 10px; font-size: 13px; margin-left: 8px; vertical-align: 1px; }
/* Minerals (holder-stated) - chip checklist in the sheet editor, pills in the table and popup */
.minerals-field { margin: 12px 0 14px; }
.minerals-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 14px; font-weight: 600; color: #34404c; margin-bottom: 6px; }
.minerals-head .muted { font-weight: 500; }
.link-btn { background: none; border: 0; padding: 2px 4px; color: var(--navy); text-decoration: underline; cursor: pointer; font: inherit; font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
label.chip { display: inline-flex; flex-direction: row; position: relative; gap: 0; font-weight: 600; cursor: pointer; }
label.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; padding: 0; pointer-events: none; }
label.chip span { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 6px 14px; border: 1.5px solid #c9bfae; border-radius: 999px; background: #fff; color: var(--navy); font-size: 14px; line-height: 1; transition: background .12s, border-color .12s, color .12s, box-shadow .12s; user-select: none; }
label.chip span::before { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid #b9ae9b; background: #fff; box-sizing: border-box; flex: none; }
label.chip:hover span { border-color: var(--gold); }
label.chip input:checked + span { background: var(--navy); border-color: var(--navy); color: #fff; box-shadow: 0 1px 3px rgba(27,51,72,.25); }
label.chip input:checked + span::before { border-color: var(--gold); background: var(--gold) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M3.5 7.2l2.3 2.3 4.7-5' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/12px no-repeat; }
label.chip input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }
.min-pills { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.min-pill { display: inline-block; padding: 1px 8px; border-radius: 999px; background: #efe7d8; color: var(--navy); font-size: 12px; font-weight: 600; white-space: nowrap; border: 1px solid #e2d6bf; }
.pop .min-pills { gap: 3px; }
.pop .min-pill { font-size: 11.5px; padding: 0 7px; }
@media (max-width: 700px) {
  .chips { gap: 7px; }
  label.chip span { min-height: 40px; padding: 8px 14px; font-size: 15px; }
}
