/* Wygląd nawiązuje do pierwszej wersji aplikacji: ciemne, rozmyte tło,
   jasne zaokrąglone karty, niebieskie przyciski i czerwony aktywny status. */
:root {
  --ink: #1d2228;
  --muted: #6b7380;
  --line: rgba(29, 34, 40, 0.12);
  --card: rgba(255, 255, 255, 0.92);
  --field: #f3f5f8;
  --info: #2972fa;
  --info-dark: #1f5fd6;
  --active: #fb4143;
  --garden: #f08c00;
  --home: #0caa4c;
  --danger: #d92d20;
  --radius: 20px;
  --font: "Nunito Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-head: "Montserrat", var(--font);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--ink);
  background: #0a0a0a;
  font: 16px/1.45 var(--font);
}

/* Tło: ciemny zielony gradient, a jeśli jest plik static/img/tlo.jpg, to zdjęcie (base.html). Zawsze rozmyte. */
body::before {
  content: "";
  position: fixed;
  inset: -40px;
  z-index: -1;
  background:
    linear-gradient(rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0.45)),
    var(--bg-photo, none) center / cover no-repeat,
    radial-gradient(ellipse at 20% 10%, #3c6b4a 0%, transparent 55%),
    radial-gradient(ellipse at 85% 80%, #2b4f63 0%, transparent 55%),
    linear-gradient(160deg, #22382c 0%, #121a16 60%, #0a0a0a 100%);
  filter: blur(10px);
}

a { color: var(--info); }

.wrap {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 16px max(32px, env(safe-area-inset-bottom));
}

/* Nagłówek */
.topbar { text-align: center; margin: 8px 0 18px; }
.brand {
  display: inline-block; color: #fff; text-decoration: none;
  font: 700 30px/1.1 var(--font-head); letter-spacing: -0.01em;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}
.topbar nav {
  display: flex; gap: 4px; margin: 14px auto 0; padding: 4px;
  background: rgba(255, 255, 255, 0.14); border-radius: 999px;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.topbar nav a {
  flex: 1; padding: 8px 6px; border-radius: 999px; text-decoration: none;
  color: rgba(255, 255, 255, 0.85); font-weight: 700; font-size: 14px; white-space: nowrap;
}
.topbar nav a.active { background: #fff; color: var(--ink); }

/* Teksty na tle */
.on-bg { color: #fff; text-shadow: 0 1px 8px rgba(0, 0, 0, 0.4); }
h1 { font: 700 24px/1.2 var(--font-head); margin: 4px 0 6px; }
main > h1, main > .lead { color: #fff; text-shadow: 0 1px 8px rgba(0, 0, 0, 0.4); }
h2 {
  font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 800;
  color: rgba(255, 255, 255, 0.85); margin: 26px 4px 10px; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.4);
}
p.lead { margin: 0 0 18px; opacity: 0.92; }

/* Karty */
.card {
  background: var(--card); border-radius: var(--radius); padding: 18px;
  margin-bottom: 14px; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
}
.card h3 { font: 700 20px/1.2 var(--font-head); margin: 0 0 4px; }

.banner {
  background: rgba(255, 244, 214, 0.95); border-radius: 14px; padding: 12px 14px;
  margin-bottom: 14px; font-size: 15px;
}

/* Formularze */
form .field, .field { margin-bottom: 14px; }
label { display: block; font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.hint { color: var(--muted); font-size: 13px; margin: 4px 0 0; }
input[type=email], input[type=password], input[type=text], input[type=number], select {
  width: 100%; padding: 12px 14px; font: inherit; font-size: 16px; color: var(--ink);
  background: var(--field); border: 1px solid var(--line); border-radius: 12px;
}
input:focus, select:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--info); outline-offset: 1px; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.check input { width: 22px; height: 22px; accent-color: var(--info); flex: none; }

button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 10px 18px; font: inherit; font-weight: 800; border-radius: 12px;
  cursor: pointer; border: 1px solid var(--line); background: #fff; color: var(--ink);
  text-decoration: none; -webkit-tap-highlight-color: transparent;
}
button.primary, .btn.primary { background: var(--info); border-color: var(--info); color: #fff; }
button.primary:active, .btn.primary:active { background: var(--info-dark); }
button.danger { color: var(--danger); }
button.link { background: none; border: none; padding: 0; min-height: 0; color: var(--info); font-weight: 800; }
button.wide, .btn.wide { width: 100%; }
button:disabled { opacity: 0.55; cursor: default; }

.msg { font-size: 14px; margin: 10px 0 0; }
.msg:empty { display: none; }
.msg.error { color: var(--danger); }
.msg.ok { color: var(--home); }

.links { margin: 18px 4px 0; display: flex; flex-direction: column; gap: 10px; font-weight: 700; }
.links a { color: #fff; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.4); }

.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }

/* Mój pies */
.dog-name { font: 700 24px/1.2 var(--font-head); margin: 0; }
.live {
  display: block; margin-top: 2px; color: var(--info);
  font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}
.live[data-code=walk] { color: var(--active); }
.live[data-code=garden] { color: var(--garden); }
.live[data-code=home] { color: var(--home); }
.expires { color: var(--muted); font-size: 12px; font-weight: 600; margin-top: 2px; }
.expected { color: var(--muted); font-size: 13px; font-weight: 700; margin-top: 2px; }
.expected.late { color: var(--active); }
.note { margin: 8px 0 0; font-size: 15px; overflow-wrap: anywhere; }
.note::before { content: "„"; }
.note::after { content: "”"; }

.status-buttons { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.status-btn {
  flex-direction: column; gap: 6px; min-height: 84px; padding: 12px 4px;
  background: var(--info); border-color: var(--info); color: #fff;
  font-size: 15px; letter-spacing: 0.03em; transition: transform 0.08s ease, background 0.15s ease;
}
.status-btn:active { transform: scale(0.97); }
.status-btn .ico { width: 28px; height: 28px; }
.status-btn.current[data-code=walk], .status-btn.current[data-code=garden] {
  background: var(--active); border-color: var(--active); box-shadow: 0 0 0 4px rgba(251, 65, 67, 0.22);
}
.status-btn.current[data-code=home] { background: var(--home); border-color: var(--home); box-shadow: 0 0 0 4px rgba(12, 170, 76, 0.2); }

.details-toggle { margin-top: 14px; }
.details { margin-top: 12px; padding-top: 14px; border-top: 1px dashed var(--line); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 2px 0 14px; }
.chip {
  min-height: 38px; padding: 6px 14px; border-radius: 999px; font-size: 14px; font-weight: 800;
  border: 1px solid var(--line); background: var(--field); color: var(--ink);
}
.chip[aria-pressed=true] { background: var(--info); border-color: var(--info); color: #fff; }

/* Sąsiedzi */
.neighbour { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.neighbour:first-child { padding-top: 0; }
.neighbour:last-child { border-bottom: none; padding-bottom: 0; }
.badge {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 46px; height: 46px; border-radius: 50%; color: #fff; background: var(--home);
}
.badge .ico { width: 22px; height: 22px; }
.badge[data-code=walk] { background: var(--active); box-shadow: 0 0 0 4px rgba(251, 65, 67, 0.2); animation: pulse 2s ease-in-out infinite; }
.badge[data-code=garden] { background: var(--garden); }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(251, 65, 67, 0.08); } }
@media (prefers-reduced-motion: reduce) { .badge[data-code=walk] { animation: none; } }
.n-body { flex: 1; min-width: 0; }
.n-name { font: 700 17px/1.25 var(--font-head); }
.n-note { font-size: 14px; margin-top: 2px; overflow-wrap: anywhere; }
.updated { color: rgba(255, 255, 255, 0.75); font-size: 12px; text-align: right; margin: -6px 6px 0; }
.empty { color: var(--muted); text-align: center; margin: 4px 0; }

/* Zaproszenie */
.qr { display: flex; justify-content: center; margin: 12px 0; }
.qr svg { width: min(220px, 70vw); height: auto; aspect-ratio: 1; background: #fff; border-radius: 12px; padding: 6px; }
.invite-url { font-size: 13px; word-break: break-all; color: var(--muted); text-align: center; }

/* Listy i historia */
.list-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list-row:first-child { padding-top: 0; }
.list-row:last-child { border-bottom: none; padding-bottom: 0; }
.list-row > :first-child { min-width: 0; overflow-wrap: anywhere; }
.list-row .actions { display: flex; gap: 8px; flex: none; }
.list-row .actions button { min-height: 38px; padding: 6px 12px; font-size: 14px; }
.sub { color: var(--muted); font-size: 13px; }
.day { font-weight: 800; margin: 16px 0 4px; }
.day:first-child { margin-top: 0; }

.hidden { display: none !important; }
footer { margin-top: 32px; text-align: center; color: rgba(255, 255, 255, 0.6); font-size: 13px; }

/* Bardzo wąskie telefony */
@media (max-width: 360px) {
  .wrap { padding-left: 12px; padding-right: 12px; }
  .card { padding: 14px; }
  .status-btn { min-height: 76px; font-size: 13px; }
  .topbar nav a { font-size: 13px; }
  .list-row { flex-wrap: wrap; }
}

.hist-title { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.hist-title .ico { width: 18px; height: 18px; flex: none; color: var(--active); }
.hist-title[data-code=garden] .ico { color: var(--garden); }
.list-row > button { flex: none; min-height: 38px; padding: 6px 12px; font-size: 14px; }
