:root { --border: #ddd; --muted: #666; --bg: #fafafa; --card: #fff; --shadow: 0 2px 8px rgba(0,0,0,.06); }
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; background: var(--bg); color: #111; }
a { color: inherit; }
main { padding: 10px; }

.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-bottom: 1px solid var(--border); background: #fff;
  position: sticky; top: 0; z-index: 10;
}
.brand-link { text-decoration: none; font-weight: 700; letter-spacing: .2px; }
.topnav { margin-left: 10px; }
.navlink { text-decoration: none; padding: 6px 8px; border-radius: 8px; }
.navlink:hover { background: #f1f1f1; }

.auth { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.hidden { display: none !important; }

.userchip { display: flex; align-items: center; gap: 8px; }
.userpic { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; background: #eee; }
.username { font-size: 14px; font-weight: 600; }

.layout {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 10px;
  height: calc(100vh - 64px);
}
.layout.single { grid-template-columns: 1fr; height: auto; }

.panel.left { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.panel.map { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: #fff; box-shadow: var(--shadow); }
#map { width: 100%; height: 100%; min-height: 480px; }

.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.panel-header h1 { margin: 6px 0; font-size: 20px; }
.sub { color: var(--muted); font-size: 13px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: var(--shadow);
}
.stack { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }

.btn {
  border: 1px solid #bbb; background: #111; color: #fff;
  padding: 8px 10px; border-radius: 10px; cursor: pointer;
}
.btn.small { padding: 6px 8px; font-size: 13px; color:white;}
.btn.ghost { background: #fff; color: #111; }
.btn:hover { opacity: .9; }

input, select {
  padding: 8px 10px; border-radius: 10px;
  border: 1px solid #bbb; background: #fff;
}

.list { display: flex; flex-direction: column; gap: 8px; overflow: auto; min-height: 0; padding-right: 4px; }
.item {
  border: 1px solid var(--border); border-radius: 12px;
  background: #fff; padding: 10px; cursor: pointer;
}
.item:hover { background: #f6f6f6; }
.item-title { font-weight: 700; }
.item-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }

.hint { color: var(--muted); font-size: 12px; }
.small { color: var(--muted); font-size: 12px; }

.modal { border: 1px solid var(--border); border-radius: 12px; padding: 14px; width: min(520px, 92vw); }
.audit { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace; font-size: 12px; max-height: 240px; overflow: auto; white-space: pre-wrap; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; height: auto; }
  #map { min-height: 380px; }
}


body:not(.signed-in) #btn-new { display: none !important; }

.h2 { margin: 0 0 8px 0; font-size: 16px; }

body:not(.is-admin) #nav-admin { display: none !important; }

/* Sign out only when signed in */
body:not(.signed-in) #btn-logout { display: none !important; }
body.signed-in #btn-logout { display: inline-flex; }

/* Optional: hide Google sign-in when signed in */
body.signed-in #signin-area { display: none !important; }

/* Optional: hide user chip when signed out (JS also does this) */
body:not(.signed-in) #user-chip { display: none !important; }


/* How-to card: show different text signed-in vs signed-out */
body.signed-in .howto-signedout { display: none !important; }
body:not(.signed-in) .howto-signedin { display: none !important; }
