/* Familiendashboard: one stylesheet, no framework, no external fonts or CDNs (#23). */

:root {
  --bg: #f6f3ee;
  --surface: #ffffff;
  --surface-2: #f0ebe3;
  --text: #24211d;
  --muted: #6c655c;
  --line: #e2dbd0;
  --accent: #d0603a;
  --accent-text: #ffffff;
  --ok: #2f7d4f;
  --danger: #b3261e;
  --radius: 16px;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.06), 0 4px 16px rgb(0 0 0 / 0.04);
  font-family:
    system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
  line-height: 1.45;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171513;
    --surface: #221f1c;
    --surface-2: #2c2824;
    --text: #f1ece5;
    --muted: #a59d92;
    --line: #3a352f;
    --accent: #ec825d;
    --accent-text: #1a1310;
    --ok: #6cc28f;
    --danger: #f2867f;
    --shadow: none;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

main {
  max-width: 72rem;
  margin: 0 auto;
  padding: 1rem 1rem 4rem;
}

h1,
h2,
h3 {
  line-height: 1.2;
  margin: 0 0 0.5rem;
}

h1 {
  font-size: 1.6rem;
}

h2 {
  font-size: 1.15rem;
}

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

.muted {
  color: var(--muted);
}

.center {
  text-align: center;
}

.small {
  font-size: 0.875rem;
}

/* Top bar */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  max-width: 72rem;
  margin: 0 auto;
}

.brand {
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}

.topbar-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* Controls */

button,
.button {
  font: inherit;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 0.5rem 1rem;
  min-height: 2.5rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

button:hover,
.button:hover {
  border-color: var(--muted);
}

button.primary {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
  font-weight: 600;
}

button.danger {
  color: var(--danger);
}

button.icon {
  padding: 0.35rem 0.6rem;
  min-width: 2.5rem;
  justify-content: center;
}

button:disabled {
  opacity: 0.45;
  cursor: default;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

label {
  display: grid;
  gap: 0.25rem;
  font-size: 0.9rem;
  color: var(--muted);
}

input,
select {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.6rem 0.75rem;
  min-height: 2.75rem;
  width: 100%;
}

form.stack {
  display: grid;
  gap: 0.9rem;
}

.row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.error {
  color: var(--danger);
  min-height: 1.2em;
  margin: 0;
}

.note {
  color: var(--ok);
}

/* Cards */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow);
}

.narrow {
  max-width: 26rem;
  margin: 2rem auto;
}

/* Login: profile picker and PIN pad */

.profiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.profile {
  display: grid;
  justify-items: center;
  gap: 0.5rem;
  padding: 1.25rem 0.5rem;
  border-radius: var(--radius);
  min-height: 9rem;
  font-size: 1.05rem;
  font-weight: 600;
}

.avatar {
  display: inline-grid;
  place-items: center;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  background: var(--surface-2);
  font-size: 2rem;
  line-height: 1;
  flex: none;
}

.avatar.sm {
  width: 2.25rem;
  height: 2.25rem;
  font-size: 1.2rem;
}

.avatar.initials {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--muted);
}

.pin-dots {
  display: flex;
  justify-content: center;
  gap: 0.6rem;
  margin: 1rem 0;
  min-height: 1rem;
}

.pin-dots span {
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 50%;
  background: var(--accent);
}

.pinpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  max-width: 18rem;
  margin: 0 auto;
}

.pinpad button {
  font-size: 1.5rem;
  min-height: 4rem;
  border-radius: var(--radius);
  justify-content: center;
}

/* Dashboard */

.greeting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 0.5rem 0 1.25rem;
}

.widgets {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr));
  gap: 1rem;
}

.widget h2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.widget.hidden-widget {
  opacity: 0.5;
  border-style: dashed;
}

.widget-tools {
  display: flex;
  gap: 0.25rem;
}

.day {
  border-top: 1px solid var(--line);
  padding-top: 0.6rem;
  margin-top: 0.6rem;
}

.day:first-of-type {
  border-top: 0;
  margin-top: 0;
  padding-top: 0;
}

.day strong {
  display: block;
}

.week {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.35rem;
}

.week li {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

.empty {
  color: var(--muted);
  background: var(--surface-2);
  border-radius: 10px;
  padding: 0.75rem;
  margin: 0.5rem 0 0;
  font-size: 0.925rem;
}

.people {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.5rem;
}

.people li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.people .who {
  flex: 1;
  min-width: 8rem;
}

/* Admin page */

.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr));
  gap: 1rem;
  align-items: start;
}

.avatar-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.avatar-picker button {
  font-size: 1.4rem;
  padding: 0.3rem;
  width: 2.9rem;
  height: 2.9rem;
  justify-content: center;
}

.avatar-picker button[aria-pressed="true"] {
  border: 2px solid var(--accent);
  background: var(--surface-2);
}

.copy-box {
  display: flex;
  gap: 0.5rem;
}

.copy-box input {
  font-size: 0.85rem;
}

.badge {
  font-size: 0.75rem;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
}

.people button {
  min-height: 2rem;
  padding: 0.25rem 0.75rem;
  font-size: 0.875rem;
}

.badge.locked {
  color: var(--danger);
  margin-left: 0.25rem;
}
