/* Shared styles for every page, in the style of AdminLTE: a light grey
   workspace, white cards with a soft shadow and a coloured top edge, and
   Bootstrap-like controls. Community branding sets --brand and --accent at
   runtime (see branding.js); everything else derives from them. */

:root {
  --brand: #1f6f5c;
  --brand-ink: #ffffff;          /* text on --brand, set for contrast */
  --accent: #f2a541;
  --bg: #f4f6f9;
  --card: #ffffff;
  --text: #212529;
  --muted: #6c757d;
  --line: #dee2e6;
  --input-line: #ced4da;
  --danger: #dc3545;
  --ok: #28a745;
  --info: #17a2b8;
  --warning: #ffc107;
  --radius: 8px;
  --card-line: #e4e8ee;          /* card outlines */
  --shadow: 0 0 1px rgba(0,0,0,.125), 0 1px 3px rgba(0,0,0,.2);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #181b1f;
    --card: #23272c;
    --text: #f1f3f5;
    --muted: #a3abb4;
    --line: #353b42;
    --input-line: #4b535c;
    --danger: #e4606d;
    --ok: #3cb95a;
    --shadow: 0 0 1px rgba(0,0,0,.4), 0 1px 3px rgba(0,0,0,.5);
    --card-line: #31373e;
    color-scheme: dark;
  }
  /* Brand colours are often dark; lighten links so they stay readable. */
  a:not(.button) { color: color-mix(in srgb, var(--brand) 45%, #ffffff); }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}
[hidden] { display: none !important; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; font-weight: 500; }
h1 { font-size: 26px; font-weight: 400; margin: 0 0 16px; }
h2 { font-size: 18px; margin: 0 0 12px; }
h3 { font-size: 16px; margin: 0 0 8px; font-weight: 600; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
svg.icon { flex: none; vertical-align: middle; }

/* ---------- simple pages without the sidebar (login, shared post) ---------- */
.topbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line);
  border-top: 3px solid var(--brand);
}
.topbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 18px; margin-right: auto; min-width: 0; color: var(--text); }
.topbar .brand img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: #fff; box-shadow: var(--shadow); }
.topbar .brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.container { max-width: 1200px; margin: 0 auto; padding: 16px; }
.narrow { max-width: 420px; margin: 0 auto; padding: 16px; }

/* ---------- cards ---------- */
/* Cards: flat, rounded, with a thin outline; a heading starts the card
   without a separate header bar. */
.card {
  background: var(--card); border: 1px solid var(--card-line); border-radius: 14px;
  box-shadow: 0 1px 2px rgba(16,24,40,.05); padding: 20px 22px; margin-bottom: 16px; position: relative;
}
.card > h2:first-child, .card > .spread:first-child { margin: 0 0 14px; font-size: 17px; font-weight: 600; }
.card > .spread:first-child h2 { margin: 0; font-size: 17px; font-weight: 600; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.spread > h1 { margin: 0; }
/* A page heading with a button beside it: keep the usual gap below it. */
.spread:has(> h1) { margin-bottom: 16px; }
.page > .spread:first-child, .page > h1:first-child { margin-bottom: 16px; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a {
  padding: 8px 14px; text-decoration: none; color: var(--muted); border: 1px solid transparent;
  border-radius: var(--radius) var(--radius) 0 0; margin-bottom: -1px; white-space: nowrap;
}
.tabs a.active { color: var(--text); background: var(--card); border-color: var(--line) var(--line) var(--card); }

/* ---------- forms ---------- */
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-weight: 600; font-size: 14px; margin-bottom: 4px; }
label.field .hint { display: block; font-weight: normal; color: var(--muted); font-size: 13px; margin-top: 4px; }
label.field .error { display: block; color: var(--danger); font-size: 13px; margin-top: 4px; }
input[type=text], input[type=email], input[type=tel], input[type=number], input[type=url], input[type=search],
input[type=date], input[type=datetime-local], input[type=time], select, textarea {
  width: 100%; font: inherit; color: inherit; background: var(--card);
  padding: 7px 12px; border: 1px solid var(--input-line); border-radius: var(--radius); min-height: 38px;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: 0; border-color: color-mix(in srgb, var(--brand) 60%, #fff);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent);
}
button:focus-visible, .button:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
textarea { min-height: 90px; resize: vertical; }
input[type=color] { width: 48px; height: 38px; padding: 2px; border: 1px solid var(--input-line); border-radius: var(--radius); background: var(--card); }
.input-prefix { display: flex; align-items: stretch; }
.input-prefix > span {
  display: flex; align-items: center; padding: 0 10px; border: 1px solid var(--input-line); border-right: 0;
  border-radius: var(--radius) 0 0 var(--radius); background: var(--bg); color: var(--muted); font-size: 14px; white-space: nowrap;
}
.input-prefix > input { border-radius: 0 var(--radius) var(--radius) 0; }
.input-suffix > span { order: 2; border: 1px solid var(--input-line); border-left: 0; border-radius: 0 var(--radius) var(--radius) 0; }
.input-suffix > input { border-radius: var(--radius) 0 0 var(--radius); }
.code-input { font-size: 28px !important; letter-spacing: 10px; text-align: center; font-variant-numeric: tabular-nums; }

button, .button {
  font: inherit; font-weight: 400; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 6px 14px; border-radius: var(--radius); border: 1px solid var(--input-line); background: var(--card); color: var(--text);
  text-decoration: none; min-height: 38px; line-height: 1.4; transition: filter .15s;
}
button:hover, .button:hover { text-decoration: none; filter: brightness(.96); }
/* Action buttons, one standard: a solid colour with a soft dark grey shadow. primary = add / save / go (the community colour), edit =
   orange, danger = delete / remove (red). */
button.primary, .button.primary { --btn: var(--brand); --btn-ink: var(--brand-ink); }
button.edit, .button.edit { --btn: #e8710a; --btn-ink: #ffffff; }
button.danger, .button.danger { --btn: #dc3545; --btn-ink: #ffffff; }
:is(button, .button):is(.primary, .edit, .danger) {
  background: var(--btn); border-color: var(--btn); color: var(--btn-ink); font-weight: 600;
  box-shadow: 0 4px 12px -4px rgba(20,23,26,.55);
  transition: box-shadow .15s, transform .15s, filter .15s;
}
:is(button, .button):is(.primary, .edit, .danger):hover {
  filter: brightness(1.06); transform: translateY(-1px);
  box-shadow: 0 6px 16px -4px rgba(20,23,26,.65);
}
:is(button, .button):is(.primary, .edit, .danger):active { transform: none; box-shadow: 0 2px 6px -2px rgba(20,23,26,.55); }
:is(button, .button):is(.primary, .edit, .danger):disabled { transform: none; box-shadow: none; filter: none; }
button.link { border: 0; background: none; color: var(--brand); padding: 0; min-height: 0; text-decoration: underline; }
button.small, .button.small { padding: 3px 10px; min-height: 30px; font-size: 13.5px; }
button:disabled { opacity: .55; cursor: default; filter: none; }
.block { width: 100%; }

/* ---------- lists ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .title { font-weight: 600; overflow-wrap: anywhere; }
a.rowlink { color: inherit; text-decoration: none; }
a.rowlink:hover .title { text-decoration: underline; color: var(--brand); }
.thumb { width: 44px; height: 44px; border-radius: var(--radius); object-fit: cover; background: var(--line); flex: none; }

/* Badges (AdminLTE "badge") */
.pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--line); color: var(--text); margin-left: 6px; white-space: nowrap; }
.pill.ok { background: var(--ok); color: #fff; }
.pill.warn { background: var(--warning); color: #1f2d3d; }
.pill.bad { background: var(--danger); color: #fff; }

/* ---------- small boxes (dashboard tiles) ---------- */
.small-boxes { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 16px; }
/* Stat tiles: a flat card with a big number, a label, the icon in a tinted
   square and a link in the tile's colour (--tile, from its bg-* class). */
.small-box {
  position: relative; display: block; text-decoration: none; overflow: hidden;
  background: var(--card); color: var(--text); border: 1px solid var(--card-line); border-radius: 14px;
  box-shadow: 0 1px 2px rgba(16,24,40,.05); transition: border-color .15s, transform .15s;
}
.small-box:hover { text-decoration: none; border-color: color-mix(in srgb, var(--tile) 45%, var(--card-line)); transform: translateY(-1px); }
.small-box .inner { padding: 16px 70px 8px 18px; }
.small-box .inner b { display: block; font-size: 30px; font-weight: 700; line-height: 1.15; color: var(--text); }
.small-box .inner span { font-size: 14px; color: var(--muted); }
.small-box svg.icon {
  position: absolute; right: 16px; top: 16px; width: 42px; height: 42px; padding: 9px; border-radius: 10px;
  color: color-mix(in srgb, var(--tile) 85%, var(--text)); background: color-mix(in srgb, var(--tile) 14%, transparent);
}
.small-box .more { display: block; padding: 0 18px 14px; font-size: 13.5px; font-weight: 600; color: color-mix(in srgb, var(--tile) 75%, var(--text)); }
.bg-info { --tile: var(--info); }
.bg-success { --tile: var(--ok); }
.bg-warning { --tile: #d39e00; }
.bg-danger { --tile: var(--danger); }
.bg-brand { --tile: var(--brand); }

/* ---------- feedback ---------- */
.notice {
  padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; border-left: 4px solid var(--warning);
  background: var(--card); box-shadow: var(--shadow);
}
.notice.error { border-left-color: var(--danger); }
.notice.warning { border-left-color: var(--warning); margin-bottom: 12px; }
#toast {
  position: fixed; right: 16px; top: 70px; z-index: 100;
  background: var(--ok); color: #fff; padding: 10px 16px; border-radius: var(--radius); max-width: min(360px, calc(100vw - 32px));
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
}
#toast.error { background: var(--danger); }
.empty { color: var(--muted); text-align: center; padding: 24px 0; }

/* ---------- login (AdminLTE "login-box") ---------- */
/* Centred both ways; auto margins (not align-items) so a tall form on a short
   screen still scrolls to its top instead of being cut off. */
/* A suburb photo (by day, or in the evening in dark mode), in the size
   closest to the screen so it's never blown up and blurry. */
body.login-page {
  min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; padding: 16px 16px 0;
  background: #8a9aa8 url('/shared/login-day-1280.jpg') center / cover no-repeat;
  --login-card: #ffffff;
}
@media (min-width: 900px), (min-resolution: 2dppx) {
  body.login-page { background-image: url('/shared/login-day-1920.jpg'); }
}
@media (min-width: 1700px), (min-width: 1100px) and (min-resolution: 1.5dppx) {
  body.login-page { background-image: url('/shared/login-day-2560.jpg'); }
}
@media (prefers-color-scheme: dark) {
  body.login-page { background-color: #1a2742; background-image: url('/shared/login-evening-1280.jpg'); --login-card: #1b1f23; }
}
@media (prefers-color-scheme: dark) and (min-width: 900px), (prefers-color-scheme: dark) and (min-resolution: 2dppx) {
  body.login-page { background-image: url('/shared/login-evening-1920.jpg'); }
}
@media (prefers-color-scheme: dark) and (min-width: 1700px), (prefers-color-scheme: dark) and (min-width: 1100px) and (min-resolution: 1.5dppx) {
  body.login-page { background-image: url('/shared/login-evening-2560.jpg'); }
}
.login-head { text-align: center; margin: 0 0 16px; }
.login-head img { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; margin-bottom: 10px; box-shadow: var(--shadow); background: #fff; }
.login-head .mark {
  width: 84px; height: 84px; border-radius: 50%; margin: 0 auto 10px; display: flex; align-items: center; justify-content: center;
  background: var(--brand); color: var(--brand-ink); font-size: 34px; font-weight: 700; box-shadow: var(--shadow);
}
.login-head h1 { font-size: 30px; font-weight: 300; margin-bottom: 4px; }
/* One near-solid card over the photo; the form steps inside it are plain. */
.login-page > main {
  width: 100%; max-width: 420px; margin: auto; padding: 32px 28px 14px; border-radius: 16px;
  background: color-mix(in srgb, var(--login-card) 96%, transparent);
  box-shadow: 0 12px 40px rgba(0,0,0,.35);
}
.login-page .card { background: none; box-shadow: none; border: 0; padding: 0; margin: 0 0 18px; }
.login-page .card > h2:first-child { margin: 0 0 12px; padding: 0; border: 0; }
.login-page input, .login-page button.block { min-height: 44px; border-radius: 8px; }

/* Links styled as tiles keep their own colours (beats the dark-mode link colour). */
a.small-box, a.small-box:hover { color: var(--text); }
#view > .spread:first-child, #view > h1:first-child { margin-bottom: 16px; }
.small-box .inner b { font-size: clamp(24px, 3vw, 30px); }
/* Grid cells and inputs may shrink below their natural width (date pickers
   are wide), so fields never spill out of their card. */
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 640px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }
input, select, textarea { min-width: 0; max-width: 100%; }

.center { text-align: center; }
/* Privacy notice */
/* Privacy notice: a full-width header over the suburb photo, then the
   sections as cards that fill the width (one column on phones). */
.privacy-hero {
  padding: 48px 24px 40px; color: #fff; text-align: center;
  background: linear-gradient(rgba(10,20,30,.55), rgba(10,20,30,.55)), #3b4a56 url('/shared/login-day-1920.jpg') center 40% / cover no-repeat;
}
.privacy-hero h1 { font-size: 34px; font-weight: 300; margin: 0 0 8px; }
.privacy-hero p { max-width: 720px; margin: 0 auto; opacity: .9; }
.privacy {
  display: grid; gap: 16px; padding: 24px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr));
}
.privacy .card { margin: 0; }
/* "Your rights" closes the page across the full width. */
.privacy .card:last-child { grid-column: 1 / -1; }
.privacy ul { padding-left: 20px; }
.privacy li { margin: 4px 0; }
.privacy-foot { text-align: center; padding: 0 24px 40px; }
.login-page .app-version { margin-top: -10px; font-size: 12px; }

/* National emergency numbers along the bottom of the login and privacy pages.
   Sticky: it stays on screen while scrolling, and at the end of the page it
   sits in its own space below the content, so it never covers the last lines. */
.emergency-bar {
  position: sticky; bottom: 0; z-index: 20; box-shadow: 0 -4px 14px rgba(0,0,0,.25);
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px 12px;
  padding: 10px 16px max(10px, env(safe-area-inset-bottom)); background: #a4161a; color: #fff; font-size: 14px;
}
.emergency-bar strong { text-transform: uppercase; letter-spacing: .06em; font-size: 12.5px; }
.emergency-bar a, .emergency-bar a:hover {
  color: #fff; text-decoration: none; white-space: nowrap;
  padding: 5px 12px; border-radius: 999px; background: rgba(255,255,255,.16);
}
.emergency-bar a:hover { background: rgba(255,255,255,.28); }
.emergency-bar b { font-weight: 700; margin-left: 4px; }
.login-page .emergency-bar { margin: 16px -16px 0; }
@media (max-width: 480px) {
  .emergency-bar { gap: 6px; padding-top: 8px; font-size: 13px; }
  .emergency-bar strong { width: 100%; text-align: center; font-size: 11.5px; }
  .emergency-bar a { padding: 4px 9px; }
}

/* Register to join (web/join) and its link on the login page. */
.join-link { margin: 4px 0 18px; }
.join-link .button { margin-left: 6px; }
.login-page .trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Pop-up forms (report, remove, reject...). */
dialog.sheet { border: 1px solid var(--card-line); border-radius: 14px; padding: 0; width: min(500px, calc(100vw - 32px)); background: var(--card); color: var(--text); box-shadow: 0 10px 30px rgba(0,0,0,.3); }
dialog.sheet form { padding: 16px 20px; }
dialog.sheet h2 { margin: 0 0 14px; font-size: 17px; font-weight: 600; }
dialog.sheet::backdrop { background: rgba(0,0,0,.5); }

/* Tick boxes and radio buttons: the browser default (13px) is hard to see and tap. */
input[type=checkbox], input[type=radio] { width: 20px; height: 20px; margin: 0; flex: none; accent-color: var(--brand); cursor: pointer; }
.check { align-items: center; }
.check input[type=checkbox], .check input[type=radio] { margin-top: 0; }

/* Login code step: the help line, then two equal buttons side by side. */
.code-help { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); text-align: center; }
.code-help p { margin: 0 0 10px; }
.code-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.code-actions button { width: 100%; }
@media (max-width: 360px) { .code-actions { grid-template-columns: 1fr; } }
/* Keep the countdown's digits from making the button jiggle. */
#resend { font-variant-numeric: tabular-nums; }
