/* ─── Design Tokens ─────────────────────────────────────────── */
:root {
  /* Brand */
  --accent:        #c4438a;
  --accent-dark:   #9a2e6b;
  --accent-light:  #fdf0f7;
  --accent-glow:   rgba(196, 67, 138, 0.18);

  /* Neutrals — warm, not cold */
  --bg:            #f9f5f0;
  --surface:       #ffffff;
  --fg:            #1c1410;
  --muted:         #7e7069;
  --line:          #ece5da;
  --pill-bg:       #f2ece3;

  /* Semantic */
  --danger:        #be3531;
  --danger-bg:     #fdf0ef;
  --ok:            #2a7a50;
  --ok-bg:         #edf7f2;
  --warn:          #a87918;
  --warn-bg:       #fef8ec;

  /* Shadows */
  --shadow-xs:  0 1px 2px rgba(28, 20, 16, 0.07);
  --shadow-sm:  0 2px 8px rgba(28, 20, 16, 0.08), 0 1px 2px rgba(28, 20, 16, 0.05);
  --shadow-md:  0 6px 20px rgba(28, 20, 16, 0.09), 0 2px 6px rgba(28, 20, 16, 0.06);
  --shadow-lg:  0 16px 40px rgba(28, 20, 16, 0.12), 0 4px 10px rgba(28, 20, 16, 0.07);

  /* Typography */
  --font-body:    'DM Sans', system-ui, sans-serif;
  --font-display: 'Playfair Display', Georgia, serif;

  /* Radius */
  --r-sm:   6px;
  --r-md:   10px;
  --r-lg:   16px;
  --r-pill: 999px;

  /* Motion */
  --ease:   cubic-bezier(0.16, 1, 0.3, 1);
  --fast:   120ms var(--ease);
  --normal: 200ms var(--ease);
}

/* ─── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
  font-size: 15.5px;
  line-height: 1.6;
  color: var(--fg);
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 55% at 18% -5%,  rgba(196, 67, 138, 0.055) 0%, transparent 100%),
    radial-gradient(ellipse 65% 45% at 85% 108%, rgba(196, 154, 42,  0.045) 0%, transparent 100%);
  background-attachment: fixed;
  min-height: 100vh;
}

a {
  color: var(--accent-dark);
  transition: color var(--fast);
}
a:hover { color: var(--accent); }

h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.75rem;
  line-height: 1.2;
  margin: 0 0 0.5rem;
  letter-spacing: -0.01em;
}
h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  margin: 1.75rem 0 0.5rem;
  letter-spacing: -0.005em;
}

p { margin: 0 0 0.5rem; }

/* ─── Utilities ─────────────────────────────────────────────── */
.muted  { color: var(--muted); }
.small  { font-size: 0.875em; }
.tiny   { font-size: 0.8em; }

.error {
  background: var(--danger-bg);
  color: var(--danger);
  padding: 0.7rem 1rem;
  border-radius: var(--r-md);
  border: 1px solid rgba(190, 53, 49, 0.18);
  font-size: 0.9em;
}

/* ─── Topbar ────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: 58px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-xs);
}

.brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}
.brand-logo {
  height: 34px;
  width: auto;
  display: block;
  transition: opacity var(--fast);
}
.brand:hover .brand-logo { opacity: 0.8; }

.topnav {
  display: flex;
  gap: 0.25rem;
  align-items: center;
}

.topnav a {
  text-decoration: none;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.35rem 0.75rem;
  border-radius: var(--r-pill);
  transition: color var(--fast), background var(--fast);
}
.topnav a:hover {
  color: var(--fg);
  background: var(--pill-bg);
}
.topnav a.active {
  color: var(--accent-dark);
  background: var(--accent-light);
}

.logout-form { display: contents; }

/* ─── Main Content ──────────────────────────────────────────── */
.content {
  max-width: 840px;
  margin: 2rem auto;
  padding: 0 1.75rem;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.25rem;
}
.section-head h1, .section-head h2 { margin-bottom: 0; }

/* ─── Buttons ───────────────────────────────────────────────── */
button, .button-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: var(--r-pill);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  letter-spacing: 0.01em;
  white-space: nowrap;
  transition: background var(--fast), transform var(--fast), box-shadow var(--fast);
  box-shadow: 0 1px 3px rgba(196, 67, 138, 0.25);
}
button:hover, .button-link:hover {
  background: var(--accent-dark);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(196, 67, 138, 0.3);
}
button:active, .button-link:active {
  transform: translateY(0);
  box-shadow: none;
}

button.tiny, .button-link.tiny {
  padding: 0.3rem 0.7rem;
  font-size: 0.8rem;
  border-radius: var(--r-pill);
}

.link-button {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 0.9rem;
  color: var(--accent-dark);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  box-shadow: none;
  transition: color var(--fast);
}
.link-button:hover {
  background: none;
  transform: none;
  box-shadow: none;
  color: var(--accent);
}
.link-button.danger {
  color: var(--danger);
}
.link-button.danger:hover {
  color: var(--danger);
  opacity: 0.75;
}
.link-button.tiny { font-size: 0.8rem; }

/* ─── Forms ─────────────────────────────────────────────────── */
form label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--fg);
  letter-spacing: 0.01em;
}

input, select, textarea {
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 0.55rem 0.8rem;
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--fg);
  transition: border-color var(--fast), box-shadow var(--fast);
  appearance: auto;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
input::placeholder { color: var(--muted); opacity: 0.7; }

textarea { resize: vertical; line-height: 1.5; }

small.muted {
  font-size: 0.8em;
  display: block;
  margin-top: 0.15rem;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
}

.form-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}
.form-actions a {
  color: var(--muted);
  font-size: 0.9rem;
  text-decoration: none;
}
.form-actions a:hover { color: var(--fg); }

/* ─── Card ──────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 1.25rem 1.5rem;
  margin: 1rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  box-shadow: var(--shadow-sm);
}

/* ─── Auth Card ─────────────────────────────────────────────── */
.auth-card, .verify-card {
  max-width: 400px;
  margin: 3.5rem auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.auth-card::before, .verify-card::before {
  content: '';
  display: block;
  height: 4px;
  background: linear-gradient(90deg, var(--accent-dark), var(--accent), #e8729c);
  flex-shrink: 0;
}

.auth-card .auth-inner, .verify-card .verify-inner {
  padding: 1.75rem 2rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.auth-card h1, .verify-card h1 {
  font-size: 1.5rem;
  margin-bottom: 0;
}

.auth-card form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.auth-switch {
  text-align: center;
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
}

/* ─── Lists (shared) ────────────────────────────────────────── */
.friend-list, .party-list, .reminder-list, .shopping-list {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0;
}

.friend-list > li, .party-list > li, .reminder-list > li {
  padding: 0.875rem 0;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.friend-list > li:last-child,
.party-list > li:last-child,
.reminder-list > li:last-child {
  border-bottom: none;
}

/* ─── Party List ────────────────────────────────────────────── */
.party-list > li {
  flex-direction: row;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}
.party-list > li a {
  text-decoration: none;
  font-weight: 600;
  color: var(--fg);
  transition: color var(--fast);
}
.party-list > li a:hover { color: var(--accent-dark); }

/* ─── Reminder List ─────────────────────────────────────────── */
.reminder-list > li {
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.875rem 1rem;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  margin-bottom: 0.5rem;
}
.reminder-list > li:last-child { border-bottom: 1px solid var(--line); }

/* ─── Friend List ───────────────────────────────────────────── */
.friend-row-main {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
}
.friend-row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  color: var(--muted);
  font-size: 0.875em;
}
.friend-row-actions {
  display: flex;
  gap: 1rem;
  margin-top: 0.25rem;
  font-size: 0.875rem;
}
.friend-row-actions form { display: inline; margin: 0; }

/* ─── Badges ────────────────────────────────────────────────── */
.badge {
  background: var(--pill-bg);
  color: var(--muted);
  padding: 0.15rem 0.55rem;
  border-radius: var(--r-pill);
  font-size: 0.75em;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.badge.danger {
  background: var(--danger-bg);
  color: var(--danger);
}

/* ─── Guest Table ───────────────────────────────────────────── */
.guest-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 1rem;
  background: var(--surface);
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}
.guest-table th, .guest-table td {
  padding: 0.65rem 0.9rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.guest-table tr:last-child td { border-bottom: none; }
.guest-table th {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--pill-bg);
}
.guest-table tbody tr {
  transition: background var(--fast);
}
.guest-table tbody tr:hover {
  background: color-mix(in srgb, var(--accent-light) 30%, transparent);
}

.guest-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}
.guest-actions select {
  padding: 0.3rem 0.5rem;
  font-size: 0.85rem;
}
.guest-actions form { display: inline; margin: 0; }

/* ─── Status Pills ──────────────────────────────────────────── */
.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.65rem;
  border-radius: var(--r-pill);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.status-pill-open     { background: var(--pill-bg);  color: var(--muted); }
.status-pill-invited  { background: var(--warn-bg);  color: var(--warn); }
.status-pill-accepted { background: var(--ok-bg);    color: var(--ok); }
.status-pill-declined { background: var(--danger-bg); color: var(--danger); }

/* ─── Inline Form ───────────────────────────────────────────── */
.inline-form {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
  flex-wrap: wrap;
  margin: 0.75rem 0;
}
.inline-form select, .inline-form input {
  flex: 1 1 160px;
}
.qty-input { flex: 0 0 90px; }

/* ─── Shopping List ─────────────────────────────────────────── */
.shopping-list {
  margin-top: 0.5rem;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}
.shopping-list > li {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--line);
  transition: background var(--fast);
}
.shopping-list > li:last-child { border-bottom: none; }
.shopping-list > li:hover { background: color-mix(in srgb, var(--pill-bg) 40%, transparent); }
.shopping-list > li.done .item-label {
  text-decoration: line-through;
  color: var(--muted);
}

.check {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  background: none;
  border: 1.5px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  font-family: ui-monospace, monospace;
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0;
  transition: border-color var(--fast), background var(--fast), color var(--fast);
  box-shadow: none;
}
.check:hover {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--accent-dark);
  transform: none;
}

.item-label { flex: 1; font-size: 0.95rem; }
.qty {
  font-style: normal;
  background: var(--pill-bg);
  color: var(--muted);
  padding: 0.1rem 0.45rem;
  border-radius: var(--r-sm);
  font-size: 0.8em;
  font-weight: 600;
  margin-right: 0.3rem;
}

/* ─── Party / Shopping Actions ──────────────────────────────── */
.party-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}
.party-actions form { display: inline; margin: 0; }

.shopping-actions {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

/* ─── Form helpers ──────────────────────────────────────────── */
.inline-form.stacked { flex-direction: column; gap: 0.4rem; }
.full-width { width: 100%; flex: 1 1 100% !important; }

/* ─── Template Item List (editable rows) ───────────────────── */
.template-item-list {
  margin-top: 0.5rem;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}
.template-item {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--line);
}
.template-item:last-child { border-bottom: none; }
.template-item-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex: 1;
  flex-wrap: wrap;
}
.template-item-input { flex: 1 1 120px; }
.template-item-notes { flex: 1 1 100px; font-size: 0.875rem; color: var(--muted); }
.template-item input {
  padding: 0.3rem 0.55rem;
  font-size: 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg);
}
.template-item input:focus { border-color: var(--accent); outline: none; }

/* ─── Task List ─────────────────────────────────────────────── */
.task-list {
  margin-top: 0.5rem;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}
.task-item {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--line);
  transition: background var(--fast);
}
.task-item:last-child { border-bottom: none; }
.task-item:hover { background: color-mix(in srgb, var(--pill-bg) 40%, transparent); }
.task-item.done .task-title {
  text-decoration: line-through;
  color: var(--muted);
}
.task-toggle-form { display: contents; }
.task-check {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  background: none;
  border: 1.5px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  font-family: ui-monospace, monospace;
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0;
  transition: border-color var(--fast), background var(--fast), color var(--fast);
  box-shadow: none;
}
.task-check:hover,
.task-item.done .task-check {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--accent-dark);
}
.task-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.task-title { font-size: 0.95rem; }

/* ─── Sections ──────────────────────────────────────────────── */
section {
  margin-top: 2rem;
}

/* ─── Mobile ────────────────────────────────────────────────── */
/* ─── Teams ─────────────────────────────────────────────────── */
.invite-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
  margin-top: 0.5rem;
}
.invite-input {
  flex: 1;
  font-family: ui-monospace, monospace;
  font-size: 0.82rem;
  color: var(--muted);
  background: var(--pill-bg);
  border-color: var(--line);
}

@media (max-width: 600px) {
  .topbar { padding: 0 1rem; }
  .topnav { gap: 0; }
  .topnav a { padding: 0.3rem 0.5rem; font-size: 0.85rem; }
  .content { padding: 0 1rem; margin: 1.25rem auto; }
  .auth-card, .verify-card { margin: 1.5rem 1rem; }
  .reminder-list > li { flex-direction: column; align-items: flex-start; }
  .party-list > li { flex-direction: column; align-items: flex-start; }
  h1 { font-size: 1.4rem; }
}
