/* ===========================================================================
   Shared look for the app's settings pages — Notifications, Turbines, Users &
   permissions. Loaded AFTER each page's own <style>, so these tokens and the
   refinements below win; the page keeps only what is particular to it.
   Palette = the rest of the app: night (dark) base, html.light the default.
   =========================================================================== */
:root {
  --bg: #0f1613; --surface: #172019; --surface-2: #111915;
  --border: #2a3530; --border-soft: rgba(255, 255, 255, 0.07);
  --text: #e7ece7; --muted: #9aa8a0; --faint: #6d7a73;
  --accent: #7cc49b; --accent-ink: #0f1613; --accent-hover: #93d2ad; --accent-soft: rgba(124, 196, 155, 0.14);
  --ok-bg: rgba(108, 195, 145, 0.12); --ok-line: rgba(108, 195, 145, 0.3); --ok: #8fd3ad;
  --mid-bg: rgba(233, 180, 76, 0.12); --mid-line: rgba(233, 180, 76, 0.3); --mid: #e9b44c;
  --bad-bg: rgba(240, 138, 126, 0.12); --bad-line: rgba(240, 138, 126, 0.3); --bad: #f2a097;
  --info-bg: rgba(141, 184, 214, 0.13); --info: #8db8d6;
  --gold-bg: rgba(224, 168, 107, 0.14); --gold: #e0a86b;
  --shadow: 0 18px 44px -30px rgba(0, 0, 0, 0.7);
  --serif: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
html.light {
  --bg: #f5f2ea; --surface: #fffdf8; --surface-2: #f3efe6;
  --border: #e2ddd0; --border-soft: rgba(29, 38, 33, 0.07);
  --text: #1d2621; --muted: #5d6a62; --faint: #8a948d;
  --accent: #2f6b4f; --accent-ink: #ffffff; --accent-hover: #285d44; --accent-soft: rgba(47, 107, 79, 0.09);
  --ok-bg: rgba(47, 125, 82, 0.08); --ok-line: rgba(47, 125, 82, 0.22); --ok: #2f7d52;
  --mid-bg: rgba(185, 120, 20, 0.09); --mid-line: rgba(185, 120, 20, 0.25); --mid: #95600f;
  --bad-bg: rgba(180, 56, 44, 0.07); --bad-line: rgba(180, 56, 44, 0.2); --bad: #b4382c;
  --info-bg: rgba(47, 95, 127, 0.08); --info: #2f5f7f;
  --gold-bg: rgba(154, 90, 31, 0.09); --gold: #9a5a1f;
  --shadow: 0 18px 44px -30px rgba(29, 38, 33, 0.35);
  color-scheme: light;
}

html, body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); background-image: none; color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* ---- page header: icon tile + serif title, round back button ---- */
.top { min-height: 48px; margin-bottom: 10px; }
.top h1 { font-family: var(--serif); font-weight: 600; font-size: clamp(1.45rem, 6vw, 1.9rem); letter-spacing: -0.01em; gap: 12px; }
.top .ico {
  width: 42px; height: 42px; border-radius: 13px;
  background: var(--accent-soft); border: 0; color: var(--accent);
}
.top .ico svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
a.back {
  display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px 0 10px;
  border-radius: 999px; background: var(--surface); border: 1px solid var(--border);
  color: var(--text); font-weight: 600;
}
a.back:hover { background: var(--surface); border-color: var(--muted); }
a.back svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.lede { color: var(--muted); font-size: 0.9rem; }
.lede b { color: var(--text); }

/* ---- cards, numbers ---- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow); }
.card h2 { font-family: var(--serif); font-weight: 600; font-size: 1.2rem; display: flex; align-items: center; gap: 8px; }
.card h2 svg { width: 19px; height: 19px; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.card .hint { color: var(--muted); }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: none; }
.stat .num { font-family: var(--serif); font-weight: 600; font-size: 2rem; }
.stat .lbl { color: var(--muted); letter-spacing: 0.06em; }

/* ---- fields + buttons ---- */
input[type=text], input[type=number], input[type=email], input[type=password], input:not([type]), textarea, select {
  background: var(--surface-2); color: var(--text); border-color: var(--border);
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); }
input::placeholder, textarea::placeholder { color: var(--faint); }
button.primary { background: var(--accent); color: var(--accent-ink); border-radius: 12px; box-shadow: none; }
button.primary:hover { background: var(--accent-hover); }
button.primary:disabled, button.primary[disabled] { background: var(--border); color: var(--muted); }
.btn-sm, button.ghost {
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  border-radius: 999px; display: inline-flex; align-items: center; gap: 6px;
}
.btn-sm:hover, button.ghost:hover { background: var(--surface-2); border-color: var(--muted); }
.btn-sm svg, button.ghost svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.btn-sm.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-sm.danger { color: var(--bad); }
.btn-sm.del, .del { background: var(--bad-bg); border-color: var(--bad-line); color: var(--bad); }
.msg.ok { color: var(--ok); } .msg.err, .editor-msg.err, td.err { color: var(--bad); }

/* ---- switches (same as the map menu) ---- */
.sw input:checked + .knob { background: var(--accent); }
.sw .knob { background: var(--border); }
.sw .t1 { color: var(--text); }
.sw .t2 { color: var(--muted); }
.sw:hover { background: var(--surface-2); }

/* ---- badges / pills ---- */
.badge { border-radius: 999px; font-weight: 700; }
.badge.admin, .pill.on { background: var(--ok-bg); color: var(--ok); }
.badge.super { background: var(--gold-bg); color: var(--gold); }
.badge.viewer { background: var(--info-bg); color: var(--info); }
.badge.user, .pill { background: var(--surface-2); color: var(--muted); }

/* ---- sheets / dialogs (Notifications setup guide) ---- */
.sheet { background: rgba(10, 14, 12, 0.5); }
.sheet-box { background: var(--bg); box-shadow: 0 -12px 40px -20px rgba(0, 0, 0, 0.5); }
.sheet-head h2 { font-family: var(--serif); font-weight: 600; font-size: 1.3rem; }
.x { background: var(--surface); border: 1px solid var(--border); color: var(--text); border-radius: 50%; width: 38px; height: 38px; padding: 0; display: grid; place-items: center; }

/* Small line icons used in place of emoji inside text. */
.ii { display: inline-block; width: 1.05em; height: 1.05em; vertical-align: -0.17em; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.dot-i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; vertical-align: 1px; background: var(--faint); }
.dot-i.on { background: var(--ok); }
.sw .knob::after { background: #fff; }
/* Title + description pairs that are inline elements in the markup: one per line. */
.state .st1, .state .st2, .type .tt, .type .td { display: block; }
.place-head button { white-space: nowrap; }
.state { border-radius: 14px; }
.state.on { background: var(--ok-bg); border: 1px solid var(--ok-line); }
.state.off { background: var(--mid-bg); border: 1px solid var(--mid-line); }
.state.bad { background: var(--bad-bg); border: 1px solid var(--bad-line); }

/* ===========================================================================
   Wider pages (Notifications, Users & permissions): a dashboard layout.
   =========================================================================== */
.wrap.wide { max-width: 1120px; }
@media (min-width: 760px) { .wrap.wide { padding-left: 28px; padding-right: 28px; } }

/* ---- Notifications ---- */
.nf-hero { padding: 22px 20px; }
.nf-state { background: none !important; border: 0 !important; padding: 0; margin-bottom: 16px; align-items: center; gap: 16px; }
.nf-bell { position: relative; flex: none; width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center;
  background: var(--mid-bg); color: var(--mid); }
.nf-bell svg { width: 32px; height: 32px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nf-bell .dot { position: absolute; top: 12px; right: 13px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--surface); background: var(--mid); }
.nf-state.on .nf-bell { background: var(--ok-bg); color: var(--ok); } .nf-state.on .nf-bell .dot { background: var(--ok); }
.nf-state.bad .nf-bell { background: var(--bad-bg); color: var(--bad); } .nf-state.bad .nf-bell .dot { background: var(--bad); }
.nf-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.nf-eyebrow { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.nf-state .st1 { font-family: var(--serif); font-weight: 600; font-size: clamp(1.3rem, 5.4vw, 1.7rem); line-height: 1.15; }
.nf-state .st2 { font-size: 0.86rem; color: var(--muted); line-height: 1.5; }
.nf-actions { gap: 8px; }
.nf-note { margin: 12px 0 0 !important; }
.nf-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.nf-grid .card { margin-bottom: 0; }
.nf-events { display: grid; grid-template-columns: 1fr; gap: 8px; }
.nf-ev { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; background: var(--surface-2); }
.nf-ev-ico { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--surface); color: var(--accent); }
.evg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.evg.fill { width: 30px; height: 15px; fill: currentColor; stroke: none; }
.ev-find_bat .nf-ev-ico { color: #5b4bb0; } .ev-find_bird .nf-ev-ico { color: #c0702a; }
.ev-find_other .nf-ev-ico { color: var(--gold); } .ev-gone .nf-ev-ico { color: var(--bad); } .ev-walk_start .nf-ev-ico, .ev-walk_finish .nf-ev-ico { color: var(--info); }
:root:not(.light) .ev-find_bat .nf-ev-ico { color: #9d92ea; } :root:not(.light) .ev-find_bird .nf-ev-ico { color: #d39a5c; }
.nf-ev-txt { display: flex; flex-direction: column; min-width: 0; }
.nf-ev-txt b { font-weight: 650; font-size: 0.92rem; }
.nf-ev-txt small { color: var(--muted); font-size: 0.76rem; line-height: 1.35; }
.nf-chan { display: grid; gap: 8px; margin: 2px 0 10px; }
.nf-ch { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface-2); }
.nf-ch-ico { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--surface); color: var(--muted); }
.nf-ch-ico svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nf-ch b { display: block; font-size: 0.92rem; }
.nf-ch small { color: var(--muted); font-size: 0.78rem; word-break: break-all; }
.nf-ch.on { border-color: var(--ok-line); background: var(--ok-bg); }
.nf-ch.on .nf-ch-ico { color: var(--ok); }
.nf-h-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.nf-timeline { position: relative; padding-left: 18px; }
.nf-timeline::before { content: ''; position: absolute; left: 5px; top: 8px; bottom: 8px; width: 2px; border-radius: 2px; background: var(--border); }
.nf-timeline .item { position: relative; border-bottom: 0; padding: 8px 0 10px; }
.nf-timeline .item::before { content: ''; position: absolute; left: -17px; top: 13px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--accent); }
.nf-timeline .item .ttl { font-weight: 650; }
.nf-timeline .item .bd { color: var(--muted); }
.nf-timeline .item .meta { color: var(--faint); }
.nf-timeline .empty { margin-left: -18px; }
@media (min-width: 860px) {
  .nf-hero { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 6px 24px; padding: 26px 28px; }
  .nf-state { margin: 0; grid-row: span 2; }
  .nf-actions { justify-content: flex-end; max-width: 420px; }
  .nf-hero .msg, .nf-note { grid-column: 1 / -1; }
  .nf-grid { grid-template-columns: 1.3fr 1fr; align-items: start; }
  .nf-events { grid-template-columns: repeat(2, 1fr); }
  .nf-history { grid-column: 1 / -1; }
}

/* ---- Users & permissions ---- */
.ad-stats { grid-template-columns: repeat(2, 1fr) !important; }
.stat.online .num { color: var(--ok); }
.stat.online .num::before { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--ok);
  margin-right: 8px; vertical-align: 6px; box-shadow: 0 0 0 4px var(--ok-bg); }
@media (min-width: 640px) { .ad-stats { grid-template-columns: repeat(4, 1fr) !important; } }
.ad-layout { display: flex; flex-direction: column-reverse; gap: 16px; }
.ad-main, .ad-side { min-width: 0; }
.ad-side { display: flex; flex-direction: column; gap: 12px; }
.ad-side .card { margin-bottom: 0; }
.ad-fold > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; }
.ad-fold > summary::-webkit-details-marker { display: none; }
.ad-fold > summary h2 { margin: 0; }
.ad-fold > summary::after { content: ''; width: 9px; height: 9px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg); margin-right: 6px; transition: transform 0.15s ease; }
.ad-fold[open] > summary::after { transform: rotate(-135deg); }
.ad-fold[open] > summary { margin-bottom: 8px; }
.ad-users { padding: 20px; }
.ad-users-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ad-users-head h2 { margin: 0; }
.ad-tools input { width: 220px; max-width: 100%; height: 40px; padding: 0 14px; border-radius: 999px; font-size: 0.9rem; }
.ad-filters { display: flex; gap: 6px; overflow-x: auto; margin: 12px 0 6px; padding-bottom: 2px; }
.ad-chip { flex: none; font: inherit; font-size: 0.82rem; font-weight: 600; padding: 7px 13px; border-radius: 999px; cursor: pointer;
  background: var(--surface-2); color: var(--muted); border: 1px solid transparent; }
.ad-chip.on { background: var(--surface); color: var(--text); border-color: var(--text); }
.ad-grid { display: grid; grid-template-columns: 1fr; gap: 12px; margin-top: 10px; }
.ad-grid > .user { background: var(--surface-2); border: 1px solid var(--border); border-radius: 18px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.ad-grid > .user:last-child { border-bottom: 1px solid var(--border); }
.ad-grid > .user.online { border-color: var(--ok-line); }
.ad-grid > .user:has(.editor) { grid-column: 1 / -1; background: var(--surface); }
.ad-grid .avatar { border-radius: 50%; width: 44px; height: 44px; font-size: 1rem; color: #fff; }
.ad-grid > .user.online .avatar { box-shadow: 0 0 0 3px var(--surface-2), 0 0 0 5px var(--ok); }
.ad-grid .name { font-size: 1.02rem; font-weight: 650; }
.ad-sess { font-size: 0.78rem; color: var(--muted); margin-top: 2px; }
.ad-sess b { color: var(--text); font-weight: 600; }
.ad-grid .when { font-size: 0.72rem; }
.ad-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.ad-c { display: inline-flex; align-items: center; gap: 4px; font-size: 0.72rem; font-weight: 600; padding: 3px 9px; border-radius: 999px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.ad-c.act { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.ad-c.all { background: var(--ok-bg); border-color: transparent; color: var(--ok); }
.ad-c.place { color: var(--gold); }
.ad-c.view { background: var(--info-bg); border-color: transparent; color: var(--info); }
.ad-c.warn { background: transparent; border-style: dashed; color: var(--mid); }
.ad-notify { font-size: 0.78rem; color: var(--muted); margin: 0; line-height: 1.5; }
.ad-notify b { color: var(--text); }
.ad-grid > .user .acts { margin-top: 2px; padding-top: 10px; border-top: 1px solid var(--border-soft); }
.ad-grid .editor { margin-top: 4px; background: var(--surface-2); border-color: var(--border); }
.ad-grid .none { color: var(--mid); }
@media (min-width: 700px) { .ad-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 980px) {
  .ad-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; align-items: start; gap: 18px; }
  .ad-side { position: sticky; top: 16px; }
}
.sw .t1, .sw .t2 { display: block; }
.nf-hero .nf-state { grid-row: auto; }
.nf-hero .msg:empty { display: none; }

/* Language switch beside the Menu link — same pill as the link. */
.top .lang-switch { height: 40px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--text); padding: 0 12px; }
.top .lang-switch:hover { border-color: var(--muted); }
@media (max-width: 420px) { .top h1 { font-size: 1.35rem; } .top .lang-switch { padding: 0 9px; } }

/* Phones: slightly larger text everywhere (all sizes are rem-based). */
@media (max-width: 480px) { html { font-size: 17px; } }
