/* Map-It web: tokens copied from the "Map-it Web" design (Bold theme), which mirrors GeoTagTheme.kt. */
:root {
  color-scheme: dark;
  --bg: #0E171D; --bg2: #0b1318; --surface: #16232B; --surface2: #213139; --surface3: #1B2A33;
  --outline: #2A3C46; --outline2: #1C2A32;
  --on: #FFFFFF; --muted: #A9BAC3; --dim: #7A8D97;
  --primary: #0099FF; --accent: #00D4AA;
  --grad: linear-gradient(135deg, #0099FF 0%, #00B3C8 55%, #00D4AA 100%);
  --error: #EF5350; --success: #4CAF50; --warn: #FFC107;
  --font: 'Roboto', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Roboto Mono', ui-monospace, Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background:
    radial-gradient(120% 260px at 0% 0%, rgba(0,153,255,.16), transparent 70%),
    radial-gradient(80% 220px at 100% 0%, rgba(0,212,170,.11), transparent 70%),
    var(--bg);
  background-repeat: no-repeat;
  color: var(--on);
  font: 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--primary); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.hidden { display: none !important; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Material Symbols */
.ms { font-family: 'Material Symbols Rounded'; font-weight: normal; font-style: normal; font-size: 20px; line-height: 1;
  display: inline-block; white-space: nowrap; direction: ltr; font-feature-settings: 'liga'; -webkit-font-smoothing: antialiased;
  user-select: none; overflow: hidden; width: 1em; flex: none; }
.ms.f { font-variation-settings: 'FILL' 1; }
.ms.s16 { font-size: 16px; } .ms.s18 { font-size: 18px; } .ms.s28 { font-size: 28px; } .ms.s40 { font-size: 40px; } .ms.s56 { font-size: 56px; }

/* ---------- admin shell ---------- */
main { max-width: 1040px; margin: 0 auto; padding: 0 24px 64px; }
.top { display: flex; align-items: center; gap: 12px; padding: 14px 0 8px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { width: 40px; height: 40px; border-radius: 10px; background: #fff; }
.brand b { font-size: 17px; letter-spacing: .2px; }
.brand span { display: block; font-size: 11px; color: var(--dim); font-weight: 400; }
.me { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.av { width: 34px; height: 34px; border-radius: 50%; background: var(--grad); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.crumbs { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; margin-top: 10px; }
.crumbs button { all: unset; cursor: pointer; color: var(--muted); }
.crumbs button:hover { color: var(--on); text-decoration: underline; }
.crumbs .ms { color: var(--dim); }
.head { display: flex; align-items: flex-end; gap: 16px; padding: 6px 0 0; flex-wrap: wrap; }
.head .ttl { flex: 1; min-width: 220px; }
.head h1 { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: .1px; text-wrap: balance; }
.head .sub { color: var(--muted); margin-top: 4px; font-size: 13px; display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.head .sub span { display: inline-flex; align-items: center; gap: 4px; }
.acts { display: flex; gap: 8px; flex-wrap: wrap; }
.tabs { display: flex; gap: 2px; margin-top: 14px; border-bottom: 1px solid var(--outline2); overflow-x: auto; scrollbar-width: none; }
.tabs button { all: unset; cursor: pointer; display: flex; align-items: center; gap: 6px; padding: 10px 14px; color: var(--muted); border-bottom: 2px solid transparent; font-weight: 500; white-space: nowrap; }
.tabs button:hover { color: var(--on); }
.tabs button[aria-selected=true] { color: var(--on); border-image: var(--grad) 1; border-bottom: 2px solid; }
.tabs .n { font-size: 11px; background: var(--surface2); border-radius: 9px; padding: 1px 6px; color: var(--muted); }
.body { padding: 16px 0 0; display: flex; flex-direction: column; gap: 14px; }
.sec { font-size: 12px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); font-weight: 500; margin: 8px 0 -4px; }

/* controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 10px; border: 0;
  background: var(--grad); color: #fff; font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none; box-shadow: 0 4px 14px rgba(0,180,200,.22); }
.btn:hover { filter: brightness(1.07); }
.btn.o { background: var(--surface); border: 1px solid var(--outline); color: var(--on); box-shadow: none; font-weight: 500; }
.btn.o:hover { border-color: var(--accent); filter: none; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.red { background: transparent; border: 1px solid rgba(239,83,80,.5); color: #ff8a80; box-shadow: none; }
.btn.big { height: 44px; width: 100%; }
.btn:disabled { opacity: .45; cursor: default; filter: none; }
.ib { width: 34px; height: 34px; border-radius: 9px; border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.ib:hover { background: var(--surface2); color: var(--on); }
.lnk { all: unset; cursor: pointer; color: var(--primary); font-weight: 500; }
.lnk:hover { text-decoration: underline; }
.small { font-size: 12px; color: var(--muted); }
.dimt { color: var(--dim); }
.error { color: #ff8a80; font-size: 13px; }
.spacer { flex: 1; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.card { background: var(--surface); border-radius: 14px; padding: 16px; border: 1px solid var(--outline2); }
.fld { display: flex; flex-direction: column; gap: 6px; }
.fld label { font-size: 12px; color: var(--muted); font-weight: 500; }
.inp { width: 100%; background: var(--bg); border: 1px solid var(--outline); border-radius: 10px; color: var(--on); padding: 10px 12px; outline: 0; resize: vertical; }
.inp:focus { border-color: var(--accent); }
.pill { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 9px; border-radius: 11px; font-size: 11px; font-weight: 700; letter-spacing: .2px; white-space: nowrap; }
.pill .ms { font-size: 14px; }
.pill.live { background: rgba(0,212,170,.16); color: #66e3cf; }
.pill.off { background: var(--surface2); color: var(--muted); }
.pill.qr { background: rgba(186,104,200,.18); color: #e1bee7; }
.empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 48px 16px; color: var(--muted); text-align: center; }
.empty h3 { margin: 0; color: var(--on); }

/* project cards */
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.pcard { background: var(--surface); border: 1px solid var(--outline2); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 10px; cursor: pointer; text-align: left; color: inherit; }
.pcard:hover { border-color: var(--outline); }
.pcard h3 { margin: 0; font-size: 17px; }
.ico-tile { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; flex: none;
  background: linear-gradient(135deg, rgba(0,153,255,.22), rgba(0,212,170,.22)); color: #66e3cf; }

/* entity table */
.tw { overflow-x: auto; border: 1px solid var(--outline2); border-radius: 14px; background: var(--surface); }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
.t th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 10px 12px; border-bottom: 1px solid var(--outline2); white-space: nowrap; }
.t td { padding: 10px 12px; border-bottom: 1px solid var(--outline2); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t tbody tr:hover { background: var(--surface3); }
.t .tt { font-weight: 600; font-size: 14px; }
.t .sm2 { color: var(--muted); font-size: 12px; }
.t .r { text-align: right; white-space: nowrap; }

/* add-entity bar */
.addbar { display: flex; gap: 8px; flex-wrap: wrap; }
.addbar .inp { flex: 1 1 200px; width: auto; height: 38px; padding: 0 12px; }

/* observations */
.ogrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.obs { padding: 0; overflow: hidden; }
.obs img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; background: var(--surface2); }
.obs .noimg { aspect-ratio: 4/3; display: grid; place-items: center; background: var(--surface2); color: var(--dim); }
.obs .inner { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; }
.obs .meta { font-size: 12px; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.obs .note { white-space: pre-wrap; word-break: break-word; }

/* dialogs */
dialog { border: 1px solid var(--outline); border-radius: 18px; background: #1d2b33; color: var(--on); padding: 22px; width: min(460px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(0,0,0,.6); }
dialog h2 { margin: 0; font-size: 20px; }
.dstack { display: flex; flex-direction: column; gap: 14px; }
.qr-box { background: #fff; padding: 14px; border-radius: 12px; display: grid; place-items: center; }
.qr-box svg { width: 100%; height: auto; max-width: 280px; }
.url { font-family: var(--mono); font-size: 12px; word-break: break-all; color: var(--muted); }
.banner { border-radius: 12px; padding: 12px 14px; display: flex; gap: 10px; align-items: flex-start; font-size: 13px; }
.banner.rev { background: rgba(186,104,200,.14); color: #e1bee7; }
.banner.cond { background: rgba(38,166,154,.14); color: #b2dfdb; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(120% 60% at 0% 0%, rgba(0,153,255,.28), transparent 60%), radial-gradient(90% 50% at 100% 0%, rgba(0,212,170,.22), transparent 60%), var(--bg); }
.lcard { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--outline); border-radius: 20px; padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.lcard > img { width: 120px; height: 120px; border-radius: 26px; background: #fff; align-self: center; }
.lcard h1 { margin: 0; text-align: center; font-size: 24px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--dim); font-size: 12px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--outline); }

/* ---------- public QR page (light, from the design's form page) ---------- */
body.public { background: #f4f7f9; color: #1d2a33; color-scheme: light; }
.wrapf { width: min(460px, 100%); margin: 0 auto; padding: 20px 16px 40px; display: flex; flex-direction: column; gap: 12px; }
.wlogo { display: flex; justify-content: center; }
.wlogo img { width: 72px; height: 72px; border-radius: 16px; }
.wcard { background: #fff; border-radius: 14px; padding: 18px; box-shadow: 0 1px 3px rgba(0,0,0,.08); display: flex; flex-direction: column; gap: 10px; }
.wcard h2 { margin: 0; font-size: 22px; color: #10202b; }
.wcard p { margin: 0; line-height: 1.45; }
.wlab { font-size: 13px; font-weight: 600; color: #10202b; margin-top: 4px; }
.winp { width: 100%; border: 1px solid #cfd8de; border-radius: 10px; padding: 10px 12px; font-size: 15px; color: #10202b; background: #fff; resize: vertical; }
.winp:focus { outline: 2px solid #0099FF; border-color: transparent; }
.wsmall { font-size: 12px; color: #5b6b75; font-weight: 400; }
.wsub { display: flex; align-items: center; gap: 4px; }
.wbtn { height: 50px; border: 0; border-radius: 12px; background: linear-gradient(135deg, #0099FF, #00B3C8 55%, #00D4AA); color: #fff; font-size: 16px; font-weight: 600; cursor: pointer; }
.wbtn:disabled { opacity: .6; cursor: default; }
.wph { display: flex; flex-wrap: wrap; gap: 8px; }
.wph .ph { position: relative; width: 84px; height: 84px; }
.wph .ph img { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; display: block; }
.wph .ph button { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; display: grid; place-items: center; cursor: pointer; padding: 0; }
.wadd { border: 2px dashed #9fb3c0; background: #f8fbfd; color: #0a6fb0; border-radius: 10px; padding: 16px; display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; font-size: 13px; }
.werr { color: #c62828; margin: 0; font-size: 14px; }
.wbusy { display: flex; justify-content: center; padding: 40px 0; color: #5b6b75; }

/* ---------- print: one QR sign per page ---------- */
.print-sheet { display: none; }
@media print {
  body { background: #fff !important; color: #000; }
  main, dialog, .login { display: none !important; }
  .print-sheet { display: block; text-align: center; padding-top: 30px; font-family: var(--font); color: #10202b; }
  .print-sheet img { width: 90px; height: 90px; }
  .print-sheet h1 { font-size: 34px; margin: 10px 0 6px; }
  .print-sheet p { font-size: 20px; margin: 0 0 22px; }
  .print-sheet svg { width: 120mm; height: 120mm; }
}

@media (max-width: 640px) {
  main { padding: 0 16px 48px; }
  .head h1 { font-size: 22px; }
  .t .hide-sm { display: none; }
}
