* {
  box-sizing: border-box;
}

:root {
  --bg: #f3f4f6;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --soft: #f9fafb;
  --primary: #111827;
  --danger: #b42318;
  --success: #067647;
  --warning: #b54708;
  --radius: 18px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

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

button {
  cursor: pointer;
}

.shell {
  width: min(1120px, calc(100% - 28px));
  margin: 0 auto;
  padding: 28px 0 60px;
}

.hidden {
  display: none !important;
}

.card,
.mini-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 28px rgba(17, 24, 39, 0.06);
}

.card {
  padding: 24px;
  margin-bottom: 20px;
}

.mini-card {
  padding: 18px;
}

.mini-card span {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 5px;
}

.mini-card strong {
  font-size: 1.5rem;
}

.auth-wrap {
  min-height: 88vh;
  display: grid;
  place-items: center;
}

.auth-card {
  width: min(100%, 520px);
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 24px;
}

.brand-icon {
  font-size: 2.5rem;
}

.brand h1,
.topbar h1,
.card h2 {
  margin: 0;
}

.brand p,
.muted {
  color: var(--muted);
}

.brand p {
  margin: 5px 0 0;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 22px;
}

.tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 9px;
  padding: 10px;
}

.tab.active {
  background: var(--primary);
  color: white;
}

label {
  display: block;
  font-weight: 650;
  margin-bottom: 15px;
}

input,
select,
textarea {
  width: 100%;
  margin-top: 7px;
  padding: 12px 13px;
  border: 1px solid #d1d5db;
  border-radius: 11px;
  background: white;
  color: var(--text);
}

textarea {
  min-height: 90px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid #d1d5db;
  outline-offset: 1px;
}

.primary,
.ghost,
.danger-btn,
.nav-btn {
  border: 0;
  border-radius: 11px;
  padding: 11px 15px;
}

.primary {
  background: var(--primary);
  color: white;
}

.primary:hover {
  opacity: 0.9;
}

.full {
  width: 100%;
}

.ghost {
  background: #eef0f3;
  color: var(--text);
}

.danger-btn {
  background: #fef3f2;
  color: var(--danger);
}

.message {
  min-height: 20px;
  margin: 14px 0 0;
  font-weight: 650;
}

.message.error {
  color: var(--danger);
}

.message.success {
  color: var(--success);
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  margin-bottom: 22px;
}

.topbar h1 {
  font-size: clamp(1.6rem, 4vw, 2.25rem);
}

.eyebrow {
  color: var(--muted);
  font-size: 0.76rem;
  letter-spacing: 0.14em;
  font-weight: 800;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sync-badge {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--warning);
}

.sync-badge.online {
  color: var(--success);
}

.nav {
  display: flex;
  gap: 8px;
  padding: 6px;
  margin-bottom: 20px;
  overflow-x: auto;
  background: white;
  border: 1px solid var(--border);
  border-radius: 15px;
}

.nav-btn {
  background: transparent;
  color: var(--muted);
  white-space: nowrap;
}

.nav-btn.active {
  background: var(--primary);
  color: white;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  align-items: center;
  margin-bottom: 18px;
}

.section-heading p {
  margin: 5px 0 0;
}

.add-grid {
  display: grid;
  grid-template-columns: minmax(180px, 2fr) 90px 120px minmax(150px, 1fr) auto;
  gap: 10px;
  align-items: end;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.add-grid input,
.add-grid select {
  margin: 0;
}

.shopping-list {
  margin-top: 14px;
}

.shopping-item {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 13px 12px;
  border-bottom: 1px solid var(--border);
}

.shopping-item:last-child {
  border-bottom: 0;
}

.shopping-item.checked {
  opacity: 0.55;
}

.shopping-item.checked .item-name {
  text-decoration: line-through;
}

.shopping-check {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
}

.item-main {
  flex: 1;
  min-width: 0;
}

.item-name {
  font-weight: 750;
  word-break: break-word;
}

.item-meta {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.88rem;
}

.empty-state {
  padding: 28px 8px;
  text-align: center;
  color: var(--muted);
}

.form-stack > *:last-child {
  margin-bottom: 0;
}

.invite-box {
  margin-top: 18px;
  padding: 18px;
  background: var(--soft);
  border: 1px dashed #c7cbd1;
  border-radius: 13px;
}

.invite-code {
  margin: 8px 0;
  font-size: 1.65rem;
  letter-spacing: 0.12em;
  font-weight: 850;
}

.member-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
}

.member-row:last-child {
  border-bottom: 0;
}

.role {
  color: var(--muted);
  font-size: 0.85rem;
}

.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.weekday-row,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 7px;
}

.weekday-row {
  margin-bottom: 7px;
  color: var(--muted);
  font-weight: 750;
  text-align: center;
  font-size: 0.82rem;
}

.calendar-day {
  min-height: 92px;
  padding: 9px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: white;
  color: var(--text);
  text-align: left;
}

.calendar-day:hover {
  background: var(--soft);
}

.calendar-day.empty {
  border: 0;
  background: transparent;
  cursor: default;
}

.day-number {
  font-weight: 800;
}

.day-total {
  display: block;
  margin-top: 9px;
  font-size: 0.75rem;
  color: var(--success);
  font-weight: 800;
}

.day-shopper {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trip-card {
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}

.trip-card:first-child {
  padding-top: 0;
}

.trip-card:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

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

.trip-price {
  font-size: 1.2rem;
  font-weight: 850;
}

.trip-meta {
  color: var(--muted);
  margin-top: 4px;
  font-size: 0.9rem;
}

.trip-items {
  margin: 12px 0;
  padding-left: 0;
  list-style: none;
}

.trip-items li {
  padding: 3px 0;
}

.trip-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(390px, calc(100% - 36px));
  background: #111827;
  color: white;
  padding: 13px 16px;
  border-radius: 12px;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.22);
  z-index: 999;
}

@media (max-width: 850px) {
  .add-grid {
    grid-template-columns: 1fr 1fr;
  }

  .add-grid > :first-child {
    grid-column: 1 / -1;
  }

  .add-grid button {
    grid-column: 1 / -1;
  }
}

@media (max-width: 680px) {
  .shell {
    width: min(100% - 18px, 1120px);
    padding-top: 14px;
  }

  .card {
    padding: 18px;
  }

  .grid-2,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions {
    width: 100%;
    justify-content: space-between;
  }

  .calendar-day {
    min-height: 67px;
    padding: 6px;
  }

  .day-total {
    font-size: 0.66rem;
  }

  .day-shopper {
    font-size: 0.6rem;
  }

  .trip-head {
    flex-direction: column;
  }
}


/* ============================================================
   V4 – FARBIGERES FAMILYCART-DESIGN
   ============================================================ */

body {
  background:
    radial-gradient(circle at 8% 6%, rgba(124, 58, 237, 0.16), transparent 28rem),
    radial-gradient(circle at 92% 16%, rgba(236, 72, 153, 0.14), transparent 30rem),
    radial-gradient(circle at 75% 90%, rgba(14, 165, 233, 0.12), transparent 28rem),
    linear-gradient(135deg, #f8f7ff 0%, #f1f8ff 48%, #fff7fb 100%);
  background-attachment: fixed;
}

.topbar {
  position: relative;
  overflow: hidden;
  padding: 26px;
  border-radius: 24px;
  color: white;
  background:
    linear-gradient(135deg, #5b4df7 0%, #7c3aed 48%, #db2777 100%);
  box-shadow: 0 18px 46px rgba(91, 77, 247, 0.24);
}

.topbar::after {
  content: "";
  position: absolute;
  width: 230px;
  height: 230px;
  right: -80px;
  top: -105px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  pointer-events: none;
}

.topbar-main,
.top-actions {
  position: relative;
  z-index: 1;
}

.topbar .eyebrow,
.topbar .muted {
  color: rgba(255, 255, 255, 0.82);
}

.topbar .ghost {
  color: white;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.24);
}

.topbar .ghost:hover {
  background: rgba(255, 255, 255, 0.24);
}

.sync-badge {
  padding: 8px 11px;
  border-radius: 999px;
  color: white;
  background: rgba(255, 255, 255, 0.14);
}

.sync-badge.online {
  color: white;
  background: rgba(16, 185, 129, 0.34);
}

.family-switcher {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 16px;
}

.family-switcher label {
  margin: 0;
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.82rem;
}

.family-switcher select {
  min-width: 210px;
  width: auto;
  margin: 0;
  padding: 9px 34px 9px 11px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  background: rgba(255, 255, 255, 0.96);
  color: #312e81;
  font-weight: 800;
}

.card {
  border: 1px solid rgba(124, 58, 237, 0.10);
  box-shadow:
    0 14px 38px rgba(49, 46, 129, 0.08),
    0 2px 5px rgba(17, 24, 39, 0.03);
}

.card::before {
  content: "";
  display: block;
  width: 58px;
  height: 5px;
  margin: -24px 0 19px;
  border-radius: 0 0 999px 999px;
  background: linear-gradient(90deg, #7c3aed, #ec4899, #0ea5e9);
}

.auth-card {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.98), rgba(255,255,255,0.94));
  box-shadow: 0 24px 70px rgba(91, 77, 247, 0.18);
}

.brand-icon {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  border-radius: 18px;
  background: linear-gradient(135deg, #ede9fe, #fce7f3);
}

.primary {
  background: linear-gradient(135deg, #5b4df7, #7c3aed 52%, #db2777);
  box-shadow: 0 7px 18px rgba(124, 58, 237, 0.20);
  transition: 160ms ease;
}

.primary:hover {
  opacity: 1;
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(124, 58, 237, 0.28);
}

.nav {
  padding: 7px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(14px);
  box-shadow: 0 8px 28px rgba(49, 46, 129, 0.06);
}

.nav-btn {
  transition: 160ms ease;
}

.nav-btn:hover {
  background: #f3e8ff;
  color: #6d28d9;
}

.nav-btn.active {
  background: linear-gradient(135deg, #5b4df7, #7c3aed);
  color: white;
  box-shadow: 0 6px 16px rgba(124, 58, 237, 0.23);
}

.mini-card:nth-child(1) {
  background: linear-gradient(135deg, #eef2ff, #ffffff);
  border-color: #c7d2fe;
}

.mini-card:nth-child(2) {
  background: linear-gradient(135deg, #ecfdf5, #ffffff);
  border-color: #a7f3d0;
}

.mini-card:nth-child(3) {
  background: linear-gradient(135deg, #fff1f2, #ffffff);
  border-color: #fecdd3;
}

.mini-card:nth-child(1) strong {
  color: #4f46e5;
}

.mini-card:nth-child(2) strong {
  color: #059669;
}

.mini-card:nth-child(3) strong {
  color: #e11d48;
}

.shopping-item {
  margin: 9px 0;
  padding: 14px;
  border: 1px solid #eef2ff;
  border-radius: 14px;
  background: linear-gradient(135deg, #ffffff, #fafaff);
}

.shopping-item:hover {
  border-color: #ddd6fe;
  box-shadow: 0 6px 18px rgba(124, 58, 237, 0.08);
}

.shopping-check {
  accent-color: #7c3aed;
}

.invite-box {
  background: linear-gradient(135deg, #f5f3ff, #fdf2f8);
  border-color: #c4b5fd;
}

.calendar-day {
  transition: 150ms ease;
}

.calendar-day:hover {
  background: linear-gradient(135deg, #f5f3ff, #eff6ff);
  border-color: #c4b5fd;
  transform: translateY(-1px);
}

.calendar-day:has(.day-total) {
  background: linear-gradient(145deg, #f0fdf4, #ffffff);
  border-color: #a7f3d0;
}

.day-shopper {
  color: #6d28d9;
}

.family-members-card::before {
  background: linear-gradient(90deg, #0ea5e9, #22c55e);
}

.invite-card::before {
  background: linear-gradient(90deg, #ec4899, #f97316);
}

.family-manager-card::before {
  background: linear-gradient(90deg, #7c3aed, #0ea5e9);
}

.family-action-box {
  padding: 18px;
  border-radius: 15px;
  border: 1px solid #e9d5ff;
  background: linear-gradient(145deg, #faf5ff, #ffffff);
}

.family-action-box:nth-child(2) {
  border-color: #bae6fd;
  background: linear-gradient(145deg, #f0f9ff, #ffffff);
}

.family-action-box h3 {
  margin-top: 0;
}

.family-count-badge {
  padding: 8px 12px;
  border-radius: 999px;
  background: #ede9fe;
  color: #6d28d9;
  font-weight: 850;
  white-space: nowrap;
}

@media (max-width: 680px) {
  .topbar {
    padding: 20px;
  }

  .family-switcher {
    align-items: stretch;
    flex-direction: column;
  }

  .family-switcher select {
    width: 100%;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }
}


/* ============================================================
   V5 – APP-ICON / INSTALLIERBARE PWA
   ============================================================ */

.brand-icon {
  overflow: hidden;
  padding: 0;
}

.brand-icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.install-btn {
  border: 1px solid rgba(255, 255, 255, 0.30);
  border-radius: 11px;
  padding: 10px 13px;
  color: white;
  background: rgba(255, 255, 255, 0.18);
  font-weight: 800;
  cursor: pointer;
}

.install-btn:hover {
  background: rgba(255, 255, 255, 0.28);
}

@media (max-width: 680px) {
  .top-actions {
    flex-wrap: wrap;
  }

  .install-btn {
    flex: 1 1 auto;
  }
}
