:root {
  color-scheme: light;
  --bg: #f5f1e8;
  --panel: rgba(255, 251, 245, 0.88);
  --panel-strong: #fffaf4;
  --input-bg: #ffffff;
  --line: rgba(88, 62, 34, 0.12);
  --text: #2f2418;
  --muted: #6f5d4a;
  --primary: #b74d27;
  --primary-strong: #8f3717;
  --secondary: #d6b384;
  --success: #2f7d4f;
  --warning: #c4861b;
  --danger: #a43434;
  --shadow: 0 24px 60px rgba(84, 52, 18, 0.12);
  --bg-accent-a: rgba(215, 168, 96, 0.28);
  --bg-accent-b: rgba(183, 77, 39, 0.14);
  --bg-start: #f8f3ec;
  --bg-mid: #f3ede3;
  --bg-end: #ece4d6;
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #161311;
  --panel: rgba(30, 24, 20, 0.88);
  --panel-strong: #241d18;
  --input-bg: #1a1612;
  --line: rgba(255, 232, 206, 0.12);
  --text: #f3e6d4;
  --muted: #c0ad97;
  --primary: #df7b45;
  --primary-strong: #b85a2d;
  --secondary: #624533;
  --success: #79d09d;
  --warning: #f0c15f;
  --danger: #ef9183;
  --shadow: 0 28px 64px rgba(0, 0, 0, 0.35);
  --bg-accent-a: rgba(223, 123, 69, 0.18);
  --bg-accent-b: rgba(255, 211, 144, 0.08);
  --bg-start: #120f0d;
  --bg-mid: #181311;
  --bg-end: #1f1814;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", "Trebuchet MS", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, var(--bg-accent-a), transparent 36%),
    radial-gradient(circle at top right, var(--bg-accent-b), transparent 24%),
    linear-gradient(180deg, var(--bg-start) 0%, var(--bg-mid) 52%, var(--bg-end) 100%);
}

button,
input,
textarea,
select {
  font: inherit;
}

.shell {
  width: min(1480px, calc(100vw - 32px));
  margin: 16px auto;
  display: grid;
  gap: 16px;
}

.hero,
.panel,
.auth-card,
.modal-card {
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}

.hero {
  border-radius: var(--radius-lg);
  padding: 22px;
  display: grid;
  gap: 18px;
}

.hero-top,
.toolbar,
.card-actions,
.inline-actions,
.modal-actions,
.split {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.hero-top {
  justify-content: space-between;
}

.brand-block h1,
.auth-card h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1;
}

.brand-block p,
.meta,
.helper,
.badge-muted,
.empty {
  margin: 0;
  color: var(--muted);
}

.toolbar {
  justify-content: space-between;
}

.nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.nav button,
.chip,
.btn {
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  background: rgba(191, 144, 91, 0.12);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.nav button:hover,
.chip:hover,
.btn:hover {
  transform: translateY(-1px);
}

.nav button.active,
.nav button[aria-current="page"],
.btn-primary,
.chip.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: white;
  box-shadow: 0 10px 24px rgba(183, 77, 39, 0.24);
}

.btn-secondary {
  background: rgba(183, 77, 39, 0.12);
}

.btn-danger {
  background: rgba(164, 52, 52, 0.12);
  color: var(--danger);
}

.panel {
  border-radius: var(--radius-lg);
  padding: 20px;
  min-height: 72vh;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.panel-head h2,
.section h3,
.card h3,
.modal-card h3 {
  margin: 0;
}

.panel-grid,
.cards,
.form-grid,
.schedule-grid,
.user-grid {
  display: grid;
  gap: 14px;
}

.cards {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.schedule-grid,
.user-grid {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.schedule-days {
  display: grid;
  gap: 16px;
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel-strong);
  padding: 16px;
  display: grid;
  gap: 12px;
}

.card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.badges,
.roles,
.workflow {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.badge,
.step {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.85rem;
  background: rgba(191, 144, 91, 0.15);
  color: var(--text);
}

.badge.success,
.step.done {
  background: rgba(47, 125, 79, 0.15);
  color: var(--success);
}

.badge.warning {
  background: rgba(196, 134, 27, 0.16);
  color: var(--warning);
}

.badge.danger {
  background: rgba(164, 52, 52, 0.13);
  color: var(--danger);
}

.stack {
  display: grid;
  gap: 8px;
}

.list {
  display: grid;
  gap: 10px;
}

.line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  font-weight: 600;
  color: var(--muted);
}

.field input,
.field textarea,
.field select {
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(103, 77, 44, 0.16);
  background: var(--input-bg);
  padding: 12px 14px;
  color: var(--text);
}

.field textarea {
  min-height: 110px;
  resize: vertical;
}

.autocomplete-field {
  position: relative;
}

.address-suggestions {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 40;
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-strong);
  box-shadow: var(--shadow);
  padding: 6px;
}

.address-suggestions.visible {
  display: grid;
  gap: 4px;
}

.address-suggestion {
  width: 100%;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
}

.address-suggestion:hover,
.address-suggestion:focus-visible {
  background: rgba(183, 77, 39, 0.13);
  outline: none;
}

.form-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.form-grid .full {
  grid-column: 1 / -1;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.auth-card {
  width: min(920px, 100%);
  border-radius: var(--radius-lg);
  padding: 26px;
  display: grid;
  gap: 24px;
}

.auth-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.auth-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 18px;
  background: var(--panel-strong);
  display: grid;
  gap: 14px;
}

dialog {
  border: 0;
  padding: 0;
  background: transparent;
}

dialog::backdrop {
  background: rgba(39, 24, 11, 0.48);
  backdrop-filter: blur(6px);
}

.modal-card {
  width: min(860px, calc(100vw - 24px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  border-radius: var(--radius-lg);
  padding: 22px;
  display: grid;
  gap: 16px;
}

.modal-card.wide {
  width: min(1120px, calc(100vw - 24px));
}

.modal-actions {
  justify-content: flex-end;
}

.role-option,
.check-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(191, 144, 91, 0.13);
}

.thumb-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.household-card.expanded {
  gap: 16px;
}

.card-summary {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  text-align: left;
  padding: 0;
  cursor: pointer;
}

.card-summary h3 {
  margin: 0;
}

.card-summary p {
  margin-top: 6px;
}

.card-summary:hover h3 {
  color: var(--primary);
}

.schedule-day {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel-strong);
  padding: 18px;
  display: grid;
  gap: 14px;
}

.schedule-day-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.schedule-day-head h3 {
  margin: 0;
}

.schedule-list {
  display: grid;
  gap: 12px;
}

.schedule-entry {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(191, 144, 91, 0.08);
  padding: 14px;
  display: grid;
  gap: 10px;
}

.thumb {
  width: 138px;
  height: 104px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid var(--line);
}

.gallery-image {
  display: block;
  width: 100%;
  max-height: 460px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 100;
  border-radius: 999px;
  padding: 12px 18px;
  background: rgba(47, 36, 24, 0.92);
  color: white;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 720px) {
  .shell {
    width: min(100vw - 16px, 1480px);
    margin: 8px auto;
  }

  .hero,
  .panel,
  .auth-card,
  .modal-card {
    border-radius: 22px;
  }

  .panel {
    padding: 16px;
  }
}
